Commit 1fc5f40c by tungnq

TODO: Tái cấu trúc các componet và style trong modal list work

parent cbd22b47
...@@ -207,33 +207,32 @@ const ListSendView = props => { ...@@ -207,33 +207,32 @@ const ListSendView = props => {
</View> </View>
); );
}; };
const renderFilter = () =>{ const renderFilter = () => {
return ( return (
<View style={styles.box_3}>
<View style={styles.box_3}> <View style={styles.searchBox}>
<View style={styles.searchBox}> <Image source={R.images.icSearch} style={{width: 20, height: 20}} />
<Image source={R.images.icSearch} style={{width: 20, height: 20}} /> <View style={{flex: 1}}>
<View style={{flex: 1}}> <TextInput
<TextInput placeholder="Tìm kiếm"
placeholder="Tìm kiếm" style={[styles.text, {padding: 0}]}
style={[styles.text, {padding: 0}]} value={searchQuery}
value={searchQuery} onChangeText={setSearchQuery}
onChangeText={setSearchQuery} />
/>
</View>
</View> </View>
<View style={{flex: 0.1}}></View> </View>
<View style={{flex: 0.1}}></View>
<View style={styles.boxFilter}> <View style={styles.boxFilter}>
<Dropdown title={'Tìm kiếm'} height={35} /> <Dropdown title={'Tìm kiếm'} height={35} />
</View>
</View> </View>
) </View>
} );
};
const renderCard = () => { const renderCard = () => {
return ( return (
<View > <View>
<View style={styles.card}> <View style={styles.card}>
<TouchableOpacity style={styles.btnCard}> <TouchableOpacity style={styles.btnCard}>
<Text <Text
...@@ -250,7 +249,7 @@ const ListSendView = props => { ...@@ -250,7 +249,7 @@ const ListSendView = props => {
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
{renderFilter()} {renderFilter()}
</View> </View>
); );
}; };
......
...@@ -22,8 +22,6 @@ const WorkReportModal = ({visible, onClose, onSubmit}) => { ...@@ -22,8 +22,6 @@ const WorkReportModal = ({visible, onClose, onSubmit}) => {
}; };
const handleAddAttachment = () => { const handleAddAttachment = () => {
// Handle add attachment logic
console.log('Add attachment');
}; };
return ( return (
......
import { StyleSheet } from "react-native"; import {StyleSheet} from 'react-native';
import R from "../../../../../assets/R"; import R from '../../../../../assets/R';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
overlay: { overlay: {
flex: 1, flex: 1,
backgroundColor: R.colors.blackShadow, backgroundColor: R.colors.blackShadow,
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
}, },
modalContainer: { modalContainer: {
backgroundColor: 'white', backgroundColor: 'white',
borderRadius: 12, borderRadius: 12,
padding: 20, padding: 20,
width: '90%', width: '90%',
maxWidth: 400, maxWidth: 400,
}, },
title: { title: {
fontSize: R.fontsize.fontsSizeTitle, fontSize: R.fontsize.fontsSizeTitle,
fontWeight: '600', fontWeight: '600',
color: R.colors.blue, color: R.colors.blue,
textAlign: 'center', textAlign: 'center',
}, },
required: { required: {
color: R.colors.red, color: R.colors.red,
fontSize: 14, fontSize: 14,
fontWeight: '500', fontWeight: '500',
}, },
label: { label: {
fontSize: R.fontsize.fontSizeContent, fontSize: R.fontsize.fontSizeContent,
fontWeight: '600', fontWeight: '600',
fontFamily: R.fonts.fontMedium, fontFamily: R.fonts.fontMedium,
color: R.colors.black, color: R.colors.black,
}, },
textInput: { textInput: {
borderWidth: 1, borderWidth: 1,
borderColor: R.colors.gray, borderColor: R.colors.gray,
borderRadius: 8, borderRadius: 8,
padding: 12, padding: 12,
fontSize: 14, fontSize: 14,
color: R.colors.black, color: R.colors.black,
marginBottom: 16, marginBottom: 16,
minHeight: 120, minHeight: 120,
}, },
attachmentContainer: { attachmentContainer: {
borderWidth: 1, borderWidth: 1,
borderColor: R.colors.blue, borderColor: R.colors.blue,
borderRadius: 8, borderRadius: 8,
padding: 20, padding: 20,
alignItems: 'center', alignItems: 'center',
marginBottom: 20, marginBottom: 20,
}, },
uploadIcon: { uploadIcon: {
width: 23, width: 23,
height: 28, height: 28,
tintColor: R.colors.blue, tintColor: R.colors.blue,
marginBottom: 5, marginBottom: 5,
}, },
attachmentText: { attachmentText: {
fontSize: R.fontsize.fontSizeContent, fontSize: R.fontsize.fontSizeContent,
color: R.colors.blue, color: R.colors.blue,
fontWeight: '500', fontWeight: '500',
}, },
buttonContainer: { buttonContainer: {
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'flex-end', justifyContent: 'flex-end',
}, },
cancelButton: { cancelButton: {
flex: 1, flex: 1,
backgroundColor: R.colors.orange, backgroundColor: R.colors.orange,
borderRadius: 8, borderRadius: 8,
paddingVertical: 12, paddingVertical: 12,
alignItems: 'center', alignItems: 'center',
}, },
submitButton: { submitButton: {
flex: 1, flex: 1,
backgroundColor: R.colors.blue, backgroundColor: R.colors.blue,
borderRadius: 8, borderRadius: 8,
paddingVertical: 12, paddingVertical: 12,
alignItems: 'center', alignItems: 'center',
}, },
disabledButton: { disabledButton: {
backgroundColor: R.colors.gray, backgroundColor: R.colors.gray,
}, },
cancelButtonText: { cancelButtonText: {
color: 'white', color: 'white',
fontSize: 16, fontSize: 16,
fontWeight: '600', fontWeight: '600',
}, },
submitButtonText: { submitButtonText: {
color: 'white', color: 'white',
fontSize: 16, fontSize: 16,
fontWeight: '600', fontWeight: '600',
}, },
}); });
export default styles; export default styles;
...@@ -14,7 +14,6 @@ const WorkReportModalView = ({ ...@@ -14,7 +14,6 @@ const WorkReportModalView = ({
onCancel, onCancel,
onAddAttachment, onAddAttachment,
}) => { }) => {
return ( return (
<Modal <Modal
visible={visible} visible={visible}
...@@ -34,7 +33,9 @@ const WorkReportModalView = ({ ...@@ -34,7 +33,9 @@ const WorkReportModalView = ({
/> />
<Text style={styles.label}>Tài liu đính kèm</Text> <Text style={styles.label}>Tài liu đính kèm</Text>
<TouchableOpacity style={styles.attachmentContainer} onPress={onAddAttachment}> <TouchableOpacity
style={styles.attachmentContainer}
onPress={onAddAttachment}>
<Image source={R.images.icDocument} style={styles.uploadIcon} /> <Image source={R.images.icDocument} style={styles.uploadIcon} />
<Text style={styles.attachmentText}>Thêm tài liu</Text> <Text style={styles.attachmentText}>Thêm tài liu</Text>
</TouchableOpacity> </TouchableOpacity>
......
...@@ -4,7 +4,6 @@ import EditReportModalView from './view'; ...@@ -4,7 +4,6 @@ import EditReportModalView from './view';
const EditReportModal = ({visible, onClose, onSubmit, initialContent = ''}) => { const EditReportModal = ({visible, onClose, onSubmit, initialContent = ''}) => {
const [reportContent, setReportContent] = useState(initialContent); const [reportContent, setReportContent] = useState(initialContent);
// Update reportContent when initialContent changes
useEffect(() => { useEffect(() => {
setReportContent(initialContent); setReportContent(initialContent);
}, [initialContent]); }, [initialContent]);
...@@ -26,13 +25,9 @@ const EditReportModal = ({visible, onClose, onSubmit, initialContent = ''}) => { ...@@ -26,13 +25,9 @@ const EditReportModal = ({visible, onClose, onSubmit, initialContent = ''}) => {
}; };
const handleDeleteAttachment = () => { const handleDeleteAttachment = () => {
// Handle attachment deletion logic
console.log('Delete attachment');
}; };
const handleAddAttachment = () => { const handleAddAttachment = () => {
// Handle add attachment logic
console.log('Add attachment');
}; };
return ( return (
......
...@@ -4,12 +4,12 @@ import R from "../../../../../assets/R"; ...@@ -4,12 +4,12 @@ import R from "../../../../../assets/R";
const styles = StyleSheet.create({ const styles = StyleSheet.create({
overlay: { overlay: {
flex: 1, flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.5)', backgroundColor: R.colors.blackShadow,
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
}, },
modalContainer: { modalContainer: {
backgroundColor: 'white', backgroundColor: R.colors.white,
borderRadius: 12, borderRadius: 12,
padding: 20, padding: 20,
width: '90%', width: '90%',
...@@ -98,12 +98,12 @@ const styles = StyleSheet.create({ ...@@ -98,12 +98,12 @@ const styles = StyleSheet.create({
alignItems: 'center', alignItems: 'center',
}, },
cancelButtonText: { cancelButtonText: {
color: 'white', color: R.colors.white,
fontSize: 16, fontSize: 16,
fontWeight: '600', fontWeight: '600',
}, },
submitButtonText: { submitButtonText: {
color: 'white', color: R.colors.white,
fontSize: 16, fontSize: 16,
fontWeight: '600', fontWeight: '600',
}, },
......
...@@ -14,7 +14,6 @@ const EditReportModalView = ({ ...@@ -14,7 +14,6 @@ const EditReportModalView = ({
onDeleteAttachment, onDeleteAttachment,
onAddAttachment, onAddAttachment,
}) => { }) => {
return ( return (
<Modal <Modal
visible={visible} visible={visible}
...@@ -44,7 +43,9 @@ const EditReportModalView = ({ ...@@ -44,7 +43,9 @@ const EditReportModalView = ({
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<TouchableOpacity style={styles.attachmentContainer} onPress={onAddAttachment}> <TouchableOpacity
style={styles.attachmentContainer}
onPress={onAddAttachment}>
<Image source={R.images.icDocument} style={styles.uploadIcon} /> <Image source={R.images.icDocument} style={styles.uploadIcon} />
<Text style={styles.attachmentText}>Thêm tài liu</Text> <Text style={styles.attachmentText}>Thêm tài liu</Text>
</TouchableOpacity> </TouchableOpacity>
......
...@@ -34,7 +34,9 @@ const AddWorkModalView = props => { ...@@ -34,7 +34,9 @@ const AddWorkModalView = props => {
const renderItem_1 = ({item, onPress}) => { const renderItem_1 = ({item, onPress}) => {
return ( return (
<View style={styles.chip}> <View style={styles.chip}>
<TouchableOpacity style={styles.containerIcon} onPress={() => handleItemPress(item)}> <TouchableOpacity
style={styles.containerIcon}
onPress={() => handleItemPress(item)}>
<Image <Image
resizeMode="cover" resizeMode="cover"
source={R.images.icCancel} source={R.images.icCancel}
...@@ -64,7 +66,7 @@ const AddWorkModalView = props => { ...@@ -64,7 +66,7 @@ const AddWorkModalView = props => {
title="Tiêu đề" title="Tiêu đề"
required required
value={formData.title} value={formData.title}
onChangeText={(value) => updateFormData('title', value)} onChangeText={value => updateFormData('title', value)}
containerMarginBottom={10} containerMarginBottom={10}
/> />
...@@ -72,7 +74,7 @@ const AddWorkModalView = props => { ...@@ -72,7 +74,7 @@ const AddWorkModalView = props => {
title="Mô tả" title="Mô tả"
required required
value={formData.content} value={formData.content}
onChangeText={(value) => updateFormData('content', value)} onChangeText={value => updateFormData('content', value)}
containerMarginBottom={10} containerMarginBottom={10}
fontFamily={R.fonts.fontMedium} fontFamily={R.fonts.fontMedium}
titleFontSize={R.fontsize.fontSizeContent} titleFontSize={R.fontsize.fontSizeContent}
...@@ -158,7 +160,7 @@ const AddWorkModalView = props => { ...@@ -158,7 +160,7 @@ const AddWorkModalView = props => {
title="Ngày đến hạn" title="Ngày đến hạn"
required required
value={formData.deadline} value={formData.deadline}
onChangeText={(value) => updateFormData('deadline', value)} onChangeText={value => updateFormData('deadline', value)}
containerMarginBottom={10} containerMarginBottom={10}
/> />
......
...@@ -47,7 +47,7 @@ const AddMonitoringModal = ({visible, onClose, onSave}) => { ...@@ -47,7 +47,7 @@ const AddMonitoringModal = ({visible, onClose, onSave}) => {
const workData = { const workData = {
...formData, ...formData,
selectedImplementers: selectedItems, selectedImplementers: selectedItems,
type: 'monitoring', // Đánh dấu đây là công việc giám sát type: 'monitoring',
}; };
onSave(workData); onSave(workData);
resetForm(); resetForm();
......
...@@ -52,10 +52,9 @@ const styles = StyleSheet.create({ ...@@ -52,10 +52,9 @@ const styles = StyleSheet.create({
justifyContent: 'space-between', justifyContent: 'space-between',
paddingHorizontal: 5, paddingHorizontal: 5,
}, },
chip: { chip: {
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
// position: 'relative',
paddingLeft: 10, paddingLeft: 10,
paddingRight: 10, paddingRight: 10,
height: 25, height: 25,
......
...@@ -20,12 +20,9 @@ const AddMonitoringModalView = props => { ...@@ -20,12 +20,9 @@ const AddMonitoringModalView = props => {
visible, visible,
formData, formData,
dataList, dataList,
selectedItems,
updateFormData, updateFormData,
handleSave, handleSave,
handleClose, handleClose,
handleSelectItem,
handleRemoveItem,
} = props; } = props;
const renderItem_1 = ({item, onPress}) => { const renderItem_1 = ({item, onPress}) => {
......
...@@ -9,7 +9,6 @@ const ModalRequestReport = props => { ...@@ -9,7 +9,6 @@ const ModalRequestReport = props => {
const [reportDeadline, setReportDeadline] = useState(''); const [reportDeadline, setReportDeadline] = useState('');
const handleSubmit = () => { const handleSubmit = () => {
// Validation
if (!reportTitle.trim()) { if (!reportTitle.trim()) {
alert('Vui lòng nhập tiêu đề báo cáo'); alert('Vui lòng nhập tiêu đề báo cáo');
return; return;
...@@ -23,7 +22,6 @@ const ModalRequestReport = props => { ...@@ -23,7 +22,6 @@ const ModalRequestReport = props => {
return; return;
} }
// Tạo data để submit
const reportData = { const reportData = {
title: reportTitle.trim(), title: reportTitle.trim(),
content: reportContent.trim(), content: reportContent.trim(),
...@@ -32,10 +30,8 @@ const ModalRequestReport = props => { ...@@ -32,10 +30,8 @@ const ModalRequestReport = props => {
implementers: workData?.implementer || [], implementers: workData?.implementer || [],
}; };
// Gọi callback để submit
onSubmitReport(reportData); onSubmitReport(reportData);
// Reset form
resetForm(); resetForm();
}; };
......
...@@ -21,7 +21,7 @@ const styles = StyleSheet.create({ ...@@ -21,7 +21,7 @@ const styles = StyleSheet.create({
height: 2, height: 2,
}, },
shadowOpacity: 0.25, shadowOpacity: 0.25,
padding:10 padding: 10,
}, },
modalHeader: { modalHeader: {
flexDirection: 'row', flexDirection: 'row',
...@@ -36,7 +36,7 @@ const styles = StyleSheet.create({ ...@@ -36,7 +36,7 @@ const styles = StyleSheet.create({
fontWeight: '600', fontWeight: '600',
fontFamily: R.fonts.fontMedium, fontFamily: R.fonts.fontMedium,
color: R.colors.blue, color: R.colors.blue,
textAlign:'center' textAlign: 'center',
}, },
closeButton: { closeButton: {
padding: 5, padding: 5,
...@@ -151,16 +151,16 @@ const styles = StyleSheet.create({ ...@@ -151,16 +151,16 @@ const styles = StyleSheet.create({
fontFamily: R.fonts.fontMedium, fontFamily: R.fonts.fontMedium,
color: R.colors.white, color: R.colors.white,
}, },
buttonContainerStyle:{ buttonContainerStyle: {
borderRadius:15, borderRadius: 15,
color:R.colors.white, color: R.colors.white,
},
containerButton: {
flexDirection: 'row',
justifyContent: 'flex-end',
alignItems: 'center',
marginTop: 10,
}, },
containerButton:{
flexDirection:'row',
justifyContent:'flex-end',
alignItems:'center',
marginTop:10
}
}); });
export default styles; export default styles;
...@@ -3,10 +3,6 @@ import { ...@@ -3,10 +3,6 @@ import {
Modal, Modal,
View, View,
Text, Text,
TouchableOpacity,
Image,
TextInput,
ScrollView,
} from 'react-native'; } from 'react-native';
import styles from './style'; import styles from './style';
import R from '../../../../assets/R'; import R from '../../../../assets/R';
...@@ -18,13 +14,8 @@ const ModalRequestReportView = props => { ...@@ -18,13 +14,8 @@ const ModalRequestReportView = props => {
visible, visible,
onClose, onClose,
onSubmit, onSubmit,
reportTitle,
setReportTitle,
reportContent,
setReportContent,
reportDeadline, reportDeadline,
setReportDeadline, setReportDeadline,
implementers,
} = props; } = props;
return ( return (
...@@ -35,40 +26,36 @@ const ModalRequestReportView = props => { ...@@ -35,40 +26,36 @@ const ModalRequestReportView = props => {
onRequestClose={onClose}> onRequestClose={onClose}>
<View style={styles.modalOverlay}> <View style={styles.modalOverlay}>
<View style={styles.modalContainer}> <View style={styles.modalContainer}>
<Text style={styles.modalTitle}> <Text style={styles.modalTitle}>Yêu cu báo cáo</Text>
Yêu cu báo cáo <TextField
</Text> title={'Hạn nộp báo cáo'}
<TextField required={true}
title={'Hạn nộp báo cáo'} value={reportDeadline}
required={true} onChangeText={setReportDeadline}
value={reportDeadline} />
onChangeText={setReportDeadline} <View style={styles.containerButton}>
<Button
title={'Huỷ'}
onPress={onClose}
backgroundColor={R.colors.orange}
textColor={R.colors.white}
fontSize={R.fontsize.fontSizeContent}
height={30}
width={100}
marginRight={10}
containerStyle={styles.buttonContainerStyle}
/> />
<View style={styles.containerButton}> <Button
<Button title={'Yêu cầu báo cáo'}
title={'Huỷ'} onPress={onSubmit}
onPress={onClose} backgroundColor={R.colors.blue}
backgroundColor={R.colors.orange} textColor={R.colors.white}
textColor={R.colors.white} fontSize={R.fontsize.fontSizeContent}
fontSize={R.fontsize.fontSizeContent} height={30}
height={30} width={130}
width={100} containerStyle={styles.buttonContainerStyle}
marginRight={10} />
containerStyle={styles.buttonContainerStyle} </View>
/>
<Button
title={'Yêu cầu báo cáo'}
onPress={onSubmit}
backgroundColor={R.colors.blue}
textColor={R.colors.white}
fontSize={R.fontsize.fontSizeContent}
height={30}
width={130}
containerStyle={styles.buttonContainerStyle}
/>
</View>
</View> </View>
</View> </View>
</Modal> </Modal>
......
...@@ -230,7 +230,7 @@ const DetailListWorkMonitoringView = props => { ...@@ -230,7 +230,7 @@ const DetailListWorkMonitoringView = props => {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Header title={'Chi tiết công việc giám sát'} /> <Header title={'Chi tiết công việc giám sát'} isBack={true}/>
<ScrollView showsVerticalScrollIndicator={false}> <ScrollView showsVerticalScrollIndicator={false}>
{renderBody()} {renderBody()}
</ScrollView> </ScrollView>
......
...@@ -24,7 +24,6 @@ const NotificationView = props => { ...@@ -24,7 +24,6 @@ const NotificationView = props => {
onSearchChange, onSearchChange,
} = props; } = props;
const navigate = useNavigation(); const navigate = useNavigation();
//Xử lý render item cho tab view
const getRenderItemFunction = () => { const getRenderItemFunction = () => {
switch (activeTab) { switch (activeTab) {
case 'Tuition': case 'Tuition':
...@@ -33,7 +32,6 @@ const NotificationView = props => { ...@@ -33,7 +32,6 @@ const NotificationView = props => {
return renderNotificationItemView; return renderNotificationItemView;
} }
}; };
//Xử lý màu trạng thái khi ở tab view
const getStatusColor = status => { const getStatusColor = status => {
switch (status) { switch (status) {
case 'Đã gửi': case 'Đã gửi':
...@@ -44,7 +42,6 @@ const NotificationView = props => { ...@@ -44,7 +42,6 @@ const NotificationView = props => {
return R.colors.gray || '#9E9E9E'; return R.colors.gray || '#9E9E9E';
} }
}; };
//TabView
const renderTabViewItem = ({item}) => { const renderTabViewItem = ({item}) => {
const isActivity = activeTab === item.key; const isActivity = activeTab === item.key;
return ( return (
...@@ -68,7 +65,6 @@ const NotificationView = props => { ...@@ -68,7 +65,6 @@ const NotificationView = props => {
</View> </View>
); );
}; };
//Search
const renderSearchBox = () => { const renderSearchBox = () => {
return ( return (
<View style={styles.containerSearchBox}> <View style={styles.containerSearchBox}>
...@@ -92,7 +88,6 @@ const NotificationView = props => { ...@@ -92,7 +88,6 @@ const NotificationView = props => {
</View> </View>
); );
}; };
//List Notification View
const renderNotificationItemView = ({item}) => { const renderNotificationItemView = ({item}) => {
return ( return (
<View style={styles.cardItem}> <View style={styles.cardItem}>
...@@ -110,7 +105,6 @@ const NotificationView = props => { ...@@ -110,7 +105,6 @@ const NotificationView = props => {
</View> </View>
); );
}; };
//List Notification Tution
const renderNotificationItemTution = ({item}) => { const renderNotificationItemTution = ({item}) => {
const statusColor = getStatusColor(item.status); const statusColor = getStatusColor(item.status);
return ( return (
...@@ -194,7 +188,6 @@ const NotificationView = props => { ...@@ -194,7 +188,6 @@ const NotificationView = props => {
/> />
); );
}; };
//Empty
const renderItemEmpty = () => { const renderItemEmpty = () => {
return ( return (
<View style={styles.containerEmpty}> <View style={styles.containerEmpty}>
...@@ -206,7 +199,6 @@ const NotificationView = props => { ...@@ -206,7 +199,6 @@ const NotificationView = props => {
const renderList = () =>{ const renderList = () =>{
return ( return (
<View style={styles.containerBody}> <View style={styles.containerBody}>
{/* {(dataNotifi[activeTab] && dataNotifi[activeTab].length > 0) && renderSearchBox()} */}
{dataNotifi[activeTab].length === 0 {dataNotifi[activeTab].length === 0
? renderItemEmpty() ? renderItemEmpty()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment