Commit c3e40a85 by tungnq

TODO: Đã làm xong modal của list work với role là người giám sát

parent cddbcdf2
...@@ -16,6 +16,7 @@ import ItemGrid from './item'; ...@@ -16,6 +16,7 @@ import ItemGrid from './item';
import styles from './style'; import styles from './style';
import {useNavigation} from '@react-navigation/native'; import {useNavigation} from '@react-navigation/native';
import * as SCREENNAME from '../../routers/ScreenNames'; import * as SCREENNAME from '../../routers/ScreenNames';
import { LogBox } from 'react-native';
const HomeView = ({ const HomeView = ({
menuActivity, menuActivity,
...@@ -27,6 +28,11 @@ const HomeView = ({ ...@@ -27,6 +28,11 @@ const HomeView = ({
onSearchChange, onSearchChange,
}) => { }) => {
const navigate = useNavigation(); const navigate = useNavigation();
LogBox.ignoreLogs([
'VirtualizedLists should never be nested',
'Bottom Tab Navigator',
'Stack Navigator',
]);
const renderMenuItem = ({item}) => { const renderMenuItem = ({item}) => {
return <ItemGrid item={item} onPress={() => onMenuItemPress(item)} />; return <ItemGrid item={item} onPress={() => onMenuItemPress(item)} />;
......
...@@ -33,6 +33,10 @@ const styles = StyleSheet.create({ ...@@ -33,6 +33,10 @@ const styles = StyleSheet.create({
color: R.colors.black, color: R.colors.black,
marginBottom: 5, marginBottom: 5,
}, },
flatListSelect: {
flexDirection: 'row',
flexWrap: 'wrap',
},
required: { required: {
color: R.colors.red, color: R.colors.red,
}, },
...@@ -48,16 +52,17 @@ const styles = StyleSheet.create({ ...@@ -48,16 +52,17 @@ const styles = StyleSheet.create({
justifyContent: 'space-between', justifyContent: 'space-between',
paddingHorizontal: 5, paddingHorizontal: 5,
}, },
chip: { chip: {
backgroundColor: R.colors.grayLight, flexDirection: 'row',
borderRadius: 20,
paddingHorizontal: 15,
paddingVertical: 8,
margin: 5,
borderWidth: 1,
borderColor: R.colors.gray,
flex: 0.48,
alignItems: 'center', alignItems: 'center',
// position: 'relative',
paddingLeft: 10,
paddingRight: 10,
height: 25,
borderRadius: 10,
marginBottom: 10,
marginRight: 5,
backgroundColor: R.colors.blue2,
}, },
chipSelected: { chipSelected: {
backgroundColor: R.colors.blue1, backgroundColor: R.colors.blue1,
...@@ -77,9 +82,9 @@ const styles = StyleSheet.create({ ...@@ -77,9 +82,9 @@ const styles = StyleSheet.create({
}, },
textChip: { textChip: {
fontSize: R.fontsize.fontSizeContent, fontSize: R.fontsize.fontSizeContent,
color: R.colors.black, fontWeight: '400',
textAlign: 'center', fontFamily: R.fonts.fontRegular,
flex: 1, color: R.colors.blueTextChip,
}, },
textChipSelected: { textChipSelected: {
color: R.colors.blue, color: R.colors.blue,
......
...@@ -28,25 +28,10 @@ const AddMonitoringModalView = props => { ...@@ -28,25 +28,10 @@ const AddMonitoringModalView = props => {
handleRemoveItem, handleRemoveItem,
} = props; } = props;
const renderItem = ({item}) => { const renderItem_1 = ({item, onPress}) => {
const isSelected = selectedItems.some(selected => selected.id === item.id);
return ( return (
<TouchableOpacity <View style={styles.chip}>
style={[styles.chip, isSelected && styles.chipSelected]} <TouchableOpacity style={styles.containerIcon} onPress={onPress}>
onPress={() => handleSelectItem(item)}>
<Text style={[styles.textChip, isSelected && styles.textChipSelected]}>
{item.name}
</Text>
</TouchableOpacity>
);
};
const renderSelectedItem = ({item}) => {
return (
<View style={styles.selectedChip}>
<TouchableOpacity
style={styles.containerIcon}
onPress={() => handleRemoveItem(item.id)}>
<Image <Image
resizeMode="cover" resizeMode="cover"
source={R.images.icCancel} source={R.images.icCancel}
...@@ -54,7 +39,7 @@ const AddMonitoringModalView = props => { ...@@ -54,7 +39,7 @@ const AddMonitoringModalView = props => {
tintColor={R.colors.blue} tintColor={R.colors.blue}
/> />
</TouchableOpacity> </TouchableOpacity>
<Text style={styles.textChip}>{item.name}</Text> <Text style={styles.textChip}> {`${item.id}, ${item.name}`}</Text>
</View> </View>
); );
}; };
...@@ -68,53 +53,42 @@ const AddMonitoringModalView = props => { ...@@ -68,53 +53,42 @@ const AddMonitoringModalView = props => {
<View style={styles.overlay}> <View style={styles.overlay}>
<View style={styles.modalContainer}> <View style={styles.modalContainer}>
<ScrollView showsVerticalScrollIndicator={false}> <ScrollView showsVerticalScrollIndicator={false}>
<Text style={styles.title}>To công vic giám sát</Text> <Text style={styles.title}>Thêm công vic</Text>
<TextField <TextField
title="Tiêu đề công việc" title="Tiêu đề"
placeholder="Nhập tiêu đề công việc"
required={true} required={true}
value={formData.title} value={formData.title}
onChangeText={value => updateFormData('title', value)} onChangeText={value => updateFormData('title', value)}
containerMarginBottom={15} containerMarginBottom={10}
/> />
<View style={styles.containerDropdown}> <TextMulti
<Text style={styles.label}> title="Nội dung công việc"
Loi công vic <Text style={styles.required}>*</Text> required={true}
</Text> value={formData.content}
<Dropdown onChangeText={value => updateFormData('content', value)}
height={35} containerMarginBottom={10}
placeholder="Chọn loại công việc" />
onSelect={item => updateFormData('category', item)}
/>
</View>
<View style={styles.containerDropdown}> <View style={styles.containerDropdown}>
<Text style={styles.label}> <Text style={styles.label}>Th</Text>
Người chu trách nhim <Text style={styles.required}>*</Text>
</Text>
<Dropdown <Dropdown
height={35} height={35}
placeholder="Chọn người chịu trách nhiệm"
onSelect={item => updateFormData('responsible', item)} onSelect={item => updateFormData('responsible', item)}
/> />
</View> </View>
<View style={styles.containerDropdown}> <View style={styles.containerDropdown}>
<Text style={styles.label}> <Text style={styles.label}>Văn bn liên quan</Text>
Thi hn hoàn thành <Text style={styles.required}>*</Text>
</Text>
<Dropdown <Dropdown
height={35} height={35}
placeholder="Chọn thời hạn"
onSelect={item => updateFormData('deadline', item)} onSelect={item => updateFormData('deadline', item)}
/> />
</View> </View>
<TextMulti <TextField
title="Nội dung công việc" title="Ngày đến hạn"
placeholder="Nhập nội dung chi tiết công việc cần giám sát"
required={true} required={true}
value={formData.content} value={formData.content}
onChangeText={value => updateFormData('content', value)} onChangeText={value => updateFormData('content', value)}
...@@ -123,39 +97,53 @@ const AddMonitoringModalView = props => { ...@@ -123,39 +97,53 @@ const AddMonitoringModalView = props => {
<View style={styles.containerDropdown}> <View style={styles.containerDropdown}>
<Text style={styles.label}> <Text style={styles.label}>
Người thc hin <Text style={styles.required}>*</Text> Người theo dõi <Text style={styles.required}>*</Text>
</Text> </Text>
<Dropdown <Dropdown
height={35} height={35}
placeholder="Chọn người thực hiện"
onSelect={item => updateFormData('implementer', item)} onSelect={item => updateFormData('implementer', item)}
/> />
</View> </View>
<Text style={styles.label}>Danh sách người thc hin:</Text> <Text style={styles.label}>Danh sách người theo dõi :</Text>
<FlatList <FlatList
data={dataList} data={dataList}
renderItem={renderItem} renderItem={({item}) => renderItem_1({item, onPress: () => {}})}
keyExtractor={item => item.id.toString()} keyExtractor={(item, index) =>
item.id?.toString() || index.toString()
}
numColumns={2} numColumns={2}
style={styles.flatList} style={{maxHeight: 150, marginBottom: 10}}
showsVerticalScrollIndicator={false} showsVerticalScrollIndicator={true}
columnWrapperStyle={styles.flatListRow} columnWrapperStyle={styles.flatListSelect}
nestedScrollEnabled={true} nestedScrollEnabled={true}
scrollEnabled={false} scrollEnabled={true}
/> />
<Text style={styles.label}>Đã chn:</Text> <View style={styles.containerDropdown}>
<Text style={styles.label}>
Người thc hin công vic <Text style={styles.required}>*</Text>
</Text>
<Dropdown
height={35}
onSelect={item => updateFormData('implementer', item)}
/>
</View>
<Text style={styles.label}>
Danh sách người thc hin công vic :
</Text>
<FlatList <FlatList
data={selectedItems} data={dataList}
renderItem={renderSelectedItem} renderItem={({item}) => renderItem_1({item, onPress: () => {}})}
keyExtractor={item => item.id.toString()} keyExtractor={(item, index) =>
item.id?.toString() || index.toString()
}
numColumns={2} numColumns={2}
style={styles.selectedFlatList} style={{maxHeight: 150, marginBottom: 10}}
showsVerticalScrollIndicator={false} showsVerticalScrollIndicator={true}
columnWrapperStyle={styles.flatListRow} columnWrapperStyle={styles.flatListSelect}
nestedScrollEnabled={true} nestedScrollEnabled={true}
scrollEnabled={false} scrollEnabled={true}
/> />
<Text style={styles.label}>Tài liu đính kèm</Text> <Text style={styles.label}>Tài liu đính kèm</Text>
......
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