feat: Implement document management features
- Added a new DocumentsScreen for managing user documents with search and date filtering capabilities. - Created AddDocumentModal for uploading documents with file selection and custom title options. - Introduced SiteDocumentsScreen to display documents related to specific construction sites. - Implemented SitesScreen for listing construction sites with search functionality. - Updated ProfileScreen to link to the new DocumentsScreen. - Refactored RangePickerModal for selecting date ranges in document filtering. - Improved date formatting utilities for better timestamp handling. - Added necessary API calls for document and site management. - Updated types to reflect changes in document structure and site information. - Added expo-document-picker dependency for document selection functionality.
This commit is contained in:
@ -1,15 +1,20 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { Alert, Modal, Text, TouchableOpacity, View } from 'react-native';
|
||||
import DateTimePicker, { DateType, useDefaultStyles, useDefaultClassNames } from 'react-native-ui-datepicker';
|
||||
import DateTimePicker, { DateType, useDefaultStyles } from 'react-native-ui-datepicker';
|
||||
import { Check, X } from 'lucide-react-native';
|
||||
|
||||
export const RangePickerModal = ({ visible, onClose, currentRange, onApply }: any) => {
|
||||
export const RangePickerModal = ({ visible, onClose, onApply }: any) => {
|
||||
const defaultStyles = useDefaultStyles();
|
||||
// const defaultClassNames = useDefaultClassNames();
|
||||
const [range, setRange] = useState<{
|
||||
startDate: DateType;
|
||||
endDate: DateType;
|
||||
}>({ startDate: undefined, endDate: undefined });
|
||||
}>({ startDate: null, endDate: null });
|
||||
|
||||
const clearCalendar = () => {
|
||||
setRange({ startDate: null, endDate: null });
|
||||
onApply({ startDate: null, endDate: null });
|
||||
onClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
@ -38,10 +43,6 @@ export const RangePickerModal = ({ visible, onClose, currentRange, onApply }: an
|
||||
...defaultStyles,
|
||||
selected: { backgroundColor: '#099499' }
|
||||
}}
|
||||
// classNames={{
|
||||
// ...defaultClassNames,
|
||||
// selected: 'bg-#099499'
|
||||
// }}
|
||||
/>
|
||||
|
||||
<TouchableOpacity
|
||||
@ -57,11 +58,7 @@ export const RangePickerModal = ({ visible, onClose, currentRange, onApply }: an
|
||||
<Text className="text-white font-bold text-lg ml-2">Applica Filtro</Text>
|
||||
</TouchableOpacity>
|
||||
<TouchableOpacity
|
||||
onPress={() => {
|
||||
console.log("Reset pressed");
|
||||
range.startDate = range.endDate = undefined;
|
||||
// TODO: deselect dates from calendar
|
||||
}}
|
||||
onPress={clearCalendar}
|
||||
className="mt-2 bg-gray-200 rounded-xl py-4 flex-row justify-center items-center active:bg-gray-300"
|
||||
>
|
||||
<Text className="text-gray-700 font-bold text-lg ml-2">Reset</Text>
|
||||
|
||||
Reference in New Issue
Block a user