optimization leave screen

parent 32fb9014
...@@ -7,6 +7,7 @@ const confirmDateAPI = { ...@@ -7,6 +7,7 @@ const confirmDateAPI = {
axiosClient.get( axiosClient.get(
`myAbsentApprovalRequests?Filters=${filter}&Sorts=${sort}&Page=${page}&PageSize=${pageSize}`, `myAbsentApprovalRequests?Filters=${filter}&Sorts=${sort}&Page=${page}&PageSize=${pageSize}`,
), ),
requestGetAbsentChart: () => axiosClient.get('myAbsentRequests/statistic'),
}; };
export default confirmDateAPI; export default confirmDateAPI;
...@@ -31,6 +31,7 @@ import { ...@@ -31,6 +31,7 @@ import {
deleteApproveConfirmDay, deleteApproveConfirmDay,
} from '../../../store/actions/UserAction'; } from '../../../store/actions/UserAction';
import AppText from '../../../components/AppText'; import AppText from '../../../components/AppText';
import Utils from '../../../utils';
const windowWidth = Dimensions.get('window').width; const windowWidth = Dimensions.get('window').width;
const windowHeight = Dimensions.get('window').height; const windowHeight = Dimensions.get('window').height;
const ConfirmModalAddNew = ({ const ConfirmModalAddNew = ({
...@@ -174,13 +175,7 @@ const ConfirmModalAddNew = ({ ...@@ -174,13 +175,7 @@ const ConfirmModalAddNew = ({
} }
//console.log('deleteItem', detailItem); //console.log('deleteItem', detailItem);
}; };
const minutesToHours = (start, finish) => {
//console.log(start, finish);
let time = Moment(finish).diff(Moment(start), 'minutes');
var Hours = Math.floor(time / 60);
var minutes = time % 60;
return `${Hours}:${minutes} giờ`;
};
useEffect(() => { useEffect(() => {
onOpenDetail(detailItem); onOpenDetail(detailItem);
}, []); }, []);
...@@ -271,7 +266,7 @@ const ConfirmModalAddNew = ({ ...@@ -271,7 +266,7 @@ const ConfirmModalAddNew = ({
Thi gian ngh Thi gian ngh
</AppText> </AppText>
<AppText> <AppText>
{minutesToHours( {Utils.minutesToHours(
confirmDateDetail.start, confirmDateDetail.start,
confirmDateDetail.finish, confirmDateDetail.finish,
)} )}
......
export default function confirmDatePropsProvider(props) { export default function confirmDatePropsProvider(props) {
const { const {
userInfo, userInfo,
showAlert,
requestApproveArr, requestApproveArr,
confirmList, confirmList,
isDisableLoadMore,
dataChart, dataChart,
modalContent,
approveReqPayload, approveReqPayload,
dayPress, dayPress,
modalRequestConfirmWorkingDays,
onChangeDayPressInChart, onChangeDayPressInChart,
onOpenDetailModal, onOpenDetailModal,
onOpenAddModal,
onLoadMoreConfirmList, onLoadMoreConfirmList,
onHideAlert,
navigateToDayWage, navigateToDayWage,
alertMessage,
onLoadMoreRequestApprove, onLoadMoreRequestApprove,
onRefreshApproveList, onRefreshApproveList,
onRefreshConfirmList, onRefreshConfirmList,
onChangeSelectFilter, onChangeSelectFilter,
onChangeMonthFilter, onChangeMonthFilter,
minutesToHours, onCloseModalRequestConfirmWorkingDays,
onOpenModalRequestConfirmWorkingDays,
} = props; } = props;
return { return {
userInfo, userInfo,
showAlert,
requestApproveArr, requestApproveArr,
confirmList, confirmList,
isDisableLoadMore,
dataChart, dataChart,
modalContent,
approveReqPayload, approveReqPayload,
dayPress, dayPress,
modalRequestConfirmWorkingDays,
onChangeDayPressInChart, onChangeDayPressInChart,
onOpenDetailModal, onOpenDetailModal,
onOpenAddModal,
onLoadMoreConfirmList, onLoadMoreConfirmList,
onHideAlert,
navigateToDayWage, navigateToDayWage,
alertMessage,
onLoadMoreRequestApprove, onLoadMoreRequestApprove,
onRefreshApproveList, onRefreshApproveList,
onRefreshConfirmList, onRefreshConfirmList,
onChangeSelectFilter, onChangeSelectFilter,
onChangeMonthFilter, onChangeMonthFilter,
minutesToHours, approveRequestWorkingDaysProps: {
approveReqPayload,
onChangeSelectFilter,
requestApproveArr,
onOpenDetailModal,
},
onCloseModalRequestConfirmWorkingDays,
onOpenModalRequestConfirmWorkingDays,
}; };
} }
...@@ -33,6 +33,20 @@ export const getConfirmApprovedDate = createAsyncThunk( ...@@ -33,6 +33,20 @@ export const getConfirmApprovedDate = createAsyncThunk(
}); });
}, },
); );
export const getAbsentChart = createAsyncThunk(
'confirmDate/getAbsentChart',
async (data, thunkAPI) => {
return serviceRequest({
dispatch: thunkAPI.dispatch,
serviceMethod: confirmDateAPI.requestGetAbsentChart,
payload: data,
options: {
skipLoader: false,
},
});
},
);
const authSlice = createSlice({ const authSlice = createSlice({
name: 'confirmDate', name: 'confirmDate',
initialState: initialState, initialState: initialState,
......
...@@ -67,49 +67,42 @@ const styles = StyleSheet.create({ ...@@ -67,49 +67,42 @@ const styles = StyleSheet.create({
marginRight: 5, marginRight: 5,
}, },
view: { view: {
width: windowWidth, width: windowWidth - 20,
alignSelf: 'center',
borderWidth: 1,
backgroundColor: colors.white, backgroundColor: colors.white,
borderColor: colors.white, borderColor: colors.white,
padding: 10, padding: 10,
marginTop: 10, marginHorizontal: 10,
borderRadius: 5,
}, },
btnConfirm: { btnConfirm: {
backgroundColor: '#5d78ff', backgroundColor: colors.purple_blue,
alignItems: 'center', borderRadius: 5,
justifyContent: 'center',
borderWidth: 1,
borderColor: '#5d78ff',
borderRadius: 8,
width: windowWidth - 100,
height: 35,
flexDirection: 'row', flexDirection: 'row',
padding: 10,
}, },
whiteTxt: { whiteTxt: {
color: colors.white, color: colors.white,
fontWeight: '500', fontWeight: '500',
}, },
blueTxt: { blueTxt: {
color: '#5d78ff', color: colors.purple_blue,
fontWeight: '500', fontWeight: '500',
}, },
iconPlus: { iconPlus: {
width: 20, width: 20,
height: 20, height: 20,
marginRight: 10, marginRight: 5,
}, },
primary_blue: { primary_blue: {
color: '#5d78ff', color: colors.purple_blue,
}, },
item: { item: {
padding: 20, padding: 10,
marginVertical: 8, margin: 8,
marginHorizontal: 16,
borderWidth: 1, borderWidth: 1,
borderBottomColor: '#f2f2f2', borderBottomColor: colors.gray95,
borderTopColor: '#f2f2f2', borderTopColor: colors.gray95,
borderRightColor: '#f2f2f2', borderRightColor: colors.gray95,
borderTopLeftRadius: 10, borderTopLeftRadius: 10,
borderBottomLeftRadius: 10, borderBottomLeftRadius: 10,
borderLeftWidth: 5, borderLeftWidth: 5,
...@@ -203,7 +196,7 @@ const styles = StyleSheet.create({ ...@@ -203,7 +196,7 @@ const styles = StyleSheet.create({
width: 50, width: 50,
}, },
btnSubmit: { btnSubmit: {
backgroundColor: '#5d78ff', backgroundColor: colors.purple_blue,
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
height: 40, height: 40,
...@@ -336,7 +329,7 @@ const styles = StyleSheet.create({ ...@@ -336,7 +329,7 @@ const styles = StyleSheet.create({
paddingHorizontal: 8, paddingHorizontal: 8,
}, },
wrapperComment: { wrapperComment: {
borderColor: '#5d78ff', borderColor: colors.purple_blue,
borderStyle: 'dashed', borderStyle: 'dashed',
borderWidth: 0.5, borderWidth: 0.5,
borderRadius: 4, borderRadius: 4,
...@@ -351,7 +344,7 @@ const styles = StyleSheet.create({ ...@@ -351,7 +344,7 @@ const styles = StyleSheet.create({
flexDirection: 'row', flexDirection: 'row',
paddingHorizontal: 8, paddingHorizontal: 8,
paddingVertical: 12, paddingVertical: 12,
backgroundColor: '#5d78ff', backgroundColor: colors.purple_blue,
borderRadius: 4, borderRadius: 4,
}, },
btnReject: { btnReject: {
...@@ -381,7 +374,7 @@ const styles = StyleSheet.create({ ...@@ -381,7 +374,7 @@ const styles = StyleSheet.create({
justifyContent: 'space-between', justifyContent: 'space-between',
alignItems: 'center', alignItems: 'center',
borderBottomWidth: 1, borderBottomWidth: 1,
borderBottomColor: '#5d78ff', borderBottomColor: colors.purple_blue,
paddingBottom: 5, paddingBottom: 5,
paddingLeft: 10, paddingLeft: 10,
paddingRight: 15, paddingRight: 15,
...@@ -395,6 +388,19 @@ const styles = StyleSheet.create({ ...@@ -395,6 +388,19 @@ const styles = StyleSheet.create({
borderColor: '#7d93ff', borderColor: '#7d93ff',
paddingTop: 15, paddingTop: 15,
}, },
refreshBtn: {
justifyContent: 'center',
alignItems: 'center',
padding: 10,
flexDirection: 'row',
},
emptyConfirmWorkingDays: {
justifyContent: 'center',
alignItems: 'center',
backgroundColor: colors.white,
marginTop: 10,
padding: 20,
},
}); });
export const statisticsConfirmWorkdaysStyles = StyleSheet.create({ export const statisticsConfirmWorkdaysStyles = StyleSheet.create({
container: { container: {
......
import Moment from 'moment'; import Moment from 'moment';
import React, {memo} from 'react'; import React, {memo} from 'react';
import {Image, View} from 'react-native'; import {View} from 'react-native';
import {IMAGES} from '../../../../values/images';
import styles, {statisticsConfirmWorkdaysStyles} from '../../style'; import styles, {statisticsConfirmWorkdaysStyles} from '../../style';
import SelectDropdown from 'react-native-select-dropdown';
import AppText from '../../../../components/AppText'; import AppText from '../../../../components/AppText';
import SelectDropdownComponent from '../../../../components/Select'; import SelectDropdownComponent from '../../../../components/Select';
import commonStyles from '../../../../styles/commonStyles'; import commonStyles from '../../../../styles/commonStyles';
......
...@@ -250,14 +250,6 @@ const OnLeaveContainer = props => { ...@@ -250,14 +250,6 @@ const OnLeaveContainer = props => {
setLeaveRequestList([...format]); setLeaveRequestList([...format]);
}; };
const minutesToHours = (start, finish) => {
//console.log(start, finish);
let time = Moment(finish).diff(Moment(start), 'minutes');
var Hours = Math.floor(time / 60);
var minutes = time % 60;
return `${Hours}:${minutes} giờ`;
};
const getAndOpenModal = async id => { const getAndOpenModal = async id => {
const res = await dispatch(getUserLeavesById(id)); const res = await dispatch(getUserLeavesById(id));
if (res) { if (res) {
...@@ -478,7 +470,6 @@ const OnLeaveContainer = props => { ...@@ -478,7 +470,6 @@ const OnLeaveContainer = props => {
onOpenRequestLeavesModal, onOpenRequestLeavesModal,
onCloseModal, onCloseModal,
onChangeSelectFilter, onChangeSelectFilter,
minutesToHours,
onSubmitLeaveRequest, onSubmitLeaveRequest,
onSelectManagerLeaveRequest, onSelectManagerLeaveRequest,
onSubmitApproveLeaveRequest, onSubmitApproveLeaveRequest,
......
...@@ -23,7 +23,6 @@ export default function onLeavePropsProvider(props) { ...@@ -23,7 +23,6 @@ export default function onLeavePropsProvider(props) {
onOpenRequestLeavesModal, onOpenRequestLeavesModal,
onCloseModal, onCloseModal,
onChangeSelectFilter, onChangeSelectFilter,
minutesToHours,
leavesDaysModal, leavesDaysModal,
leaveCategory, leaveCategory,
directManagersList, directManagersList,
...@@ -65,7 +64,6 @@ export default function onLeavePropsProvider(props) { ...@@ -65,7 +64,6 @@ export default function onLeavePropsProvider(props) {
onOpenRequestLeavesModal, onOpenRequestLeavesModal,
onCloseModal, onCloseModal,
onChangeSelectFilter, onChangeSelectFilter,
minutesToHours,
approveRequestLeavesDaysProps: { approveRequestLeavesDaysProps: {
payloadApproveRequestLeavesDays, payloadApproveRequestLeavesDays,
onChangeSelectFilter, onChangeSelectFilter,
......
...@@ -2,23 +2,170 @@ ...@@ -2,23 +2,170 @@
import CheckBox from '@react-native-community/checkbox'; import CheckBox from '@react-native-community/checkbox';
import Moment from 'moment'; import Moment from 'moment';
import React, {useMemo} from 'react'; import React, {useMemo} from 'react';
import { import {Image, Modal, ScrollView, TouchableOpacity, View} from 'react-native';
Image,
Modal,
ScrollView,
TextInput,
TouchableOpacity,
View,
} from 'react-native';
import DateTimePickerModal from 'react-native-modal-datetime-picker'; import DateTimePickerModal from 'react-native-modal-datetime-picker';
import AppText from '../../../../components/AppText'; import AppText from '../../../../components/AppText';
import ButtonComponent from '../../../../components/ButtonComponent'; import ButtonComponent from '../../../../components/ButtonComponent';
import SelectDropdownComponent from '../../../../components/Select'; import SelectDropdownComponent from '../../../../components/Select';
import TextInputComponent from '../../../../components/TextInputComponent';
import config from '../../../../config'; import config from '../../../../config';
import {IMAGES} from '../../../../values/images'; import {IMAGES} from '../../../../values/images';
import {leavesModalStyles} from '../../style'; import {leavesModalStyles} from '../../style';
import TextInputComponent from '../../../../components/TextInputComponent';
import colors from '../../../../values/colors'; // const ButtonAction = React.memo(
// ({
// onCloseModal,
// onSubmitApproveLeaveRequest,
// isRequest,
// onSubmitLeaveRequest,
// userInfo,
// }) => {
// return (
// <View
// style={{
// flexDirection: 'row',
// justifyContent: 'flex-end',
// marginTop: 20,
// }}>
// <TouchableOpacity
// onPress={onCloseModal}
// style={leavesModalStyles.btnCancel}>
// <AppText style={leavesModalStyles.blueTxt}>Hủy</AppText>
// </TouchableOpacity>
// {isRequest && (
// <TouchableOpacity
// style={leavesModalStyles.btnSubmit}
// onPress={onSubmitLeaveRequest}>
// <AppText style={leavesModalStyles.whiteTxt}>Gửi yêu cầu</AppText>
// </TouchableOpacity>
// )}
// {userInfo?.isApprover && (
// <TouchableOpacity
// style={leavesModalStyles.btnSubmit}
// onPress={() => onSubmitApproveLeaveRequest(userInfo?.leave_id)}>
// <AppText style={leavesModalStyles.whiteTxt}>Duyệt yêu cầu</AppText>
// </TouchableOpacity>
// )}
// </View>
// );
// },
// function areEquals(prevProps, nextProps) {
// return (
// prevProps.isRequest === nextProps.isRequest ||
// prevProps.userInfo === nextProps.userInfo ||
// prevProps.onSubmitLeaveRequest === nextProps.onSubmitLeaveRequest ||
// prevProps.onCloseModal === nextProps.onCloseModal ||
// prevProps.onSubmitApproveLeaveRequest ===
// nextProps.onSubmitApproveLeaveRequest
// );
// },
// );
const UserHeader = React.memo(
({userInfo, fullName}) => {
return (
<View style={{flexDirection: 'row', marginVertical: 10}}>
<Image
source={
userInfo?.avatar
? {
uri: config.imageEndPoint + userInfo?.avatar,
}
: IMAGES.IcAvatarDefault
}
style={leavesModalStyles.ImgAvatar}
/>
<View style={{marginLeft: 15}}>
<AppText
style={
leavesModalStyles.modalTitle
}>{`${fullName} - ${userInfo?.employee_code}`}</AppText>
<AppText>{userInfo?.position}</AppText>
</View>
</View>
);
},
function areEqual(prevProps, nextProps) {
return (
prevProps.userInfo === nextProps.userInfo ||
prevProps.fullName === nextProps.fullName
);
},
);
const Attachments = React.memo(
({leaveRequestImage, onDeleteLeaveRequestImage, openGallery}) => {
return (
<View style={leavesModalStyles.rowView}>
<AppText>Tệp đính kèm</AppText>
<View style={{flexDirection: 'row'}}>
{leaveRequestImage.length > 0 &&
leaveRequestImage.map((item, index) => {
//console.log("item", item[0].uri)
return (
<View key={index}>
<ButtonComponent
iconSource={IMAGES.IcReject}
style={leavesModalStyles.btnClose}
onPress={() => onDeleteLeaveRequestImage(index)}
/>
<Image
source={{uri: item.uri}}
style={leavesModalStyles.imgUpload}
/>
</View>
);
})}
{leaveRequestImage.length < 3 && (
<ButtonComponent
style={leavesModalStyles.addLeaveRequestImageBtn}
onPress={openGallery}
iconSource={IMAGES.IcAddMoreImg}
/>
)}
</View>
</View>
);
},
);
const ButtonAction = ({
onCloseModal,
onSubmitApproveLeaveRequest,
isRequest,
onSubmitLeaveRequest,
userInfo,
}) => {
return (
<View
style={{
flexDirection: 'row',
justifyContent: 'flex-end',
marginTop: 20,
}}>
<TouchableOpacity
onPress={onCloseModal}
style={leavesModalStyles.btnCancel}>
<AppText style={leavesModalStyles.blueTxt}>Hủy</AppText>
</TouchableOpacity>
{isRequest && (
<TouchableOpacity
style={leavesModalStyles.btnSubmit}
onPress={onSubmitLeaveRequest}>
<AppText style={leavesModalStyles.whiteTxt}>Gửi yêu cầu</AppText>
</TouchableOpacity>
)}
{userInfo?.isApprover && (
<TouchableOpacity
style={leavesModalStyles.btnSubmit}
onPress={() => onSubmitApproveLeaveRequest(userInfo?.leave_id)}>
<AppText style={leavesModalStyles.whiteTxt}>Duyệt yêu cầu</AppText>
</TouchableOpacity>
)}
</View>
);
};
const RequestLeavesDays = props => { const RequestLeavesDays = props => {
const { const {
userInfo, userInfo,
...@@ -71,25 +218,7 @@ const RequestLeavesDays = props => { ...@@ -71,25 +218,7 @@ const RequestLeavesDays = props => {
Nghỉ phép mới Nghỉ phép mới
</AppText> </AppText>
</View> </View>
<View style={{flexDirection: 'row', marginVertical: 10}}> <UserHeader userInfo={userInfo} fullName={fullName} />
<Image
source={
userInfo?.avatar
? {
uri: config.imageEndPoint + userInfo?.avatar,
}
: IMAGES.IcAvatarDefault
}
style={leavesModalStyles.ImgAvatar}
/>
<View style={{marginLeft: 15}}>
<AppText
style={
leavesModalStyles.modalTitle
}>{`${fullName} - ${userInfo?.employee_code}`}</AppText>
<AppText>{userInfo?.position}</AppText>
</View>
</View>
<View> <View>
<AppText style={leavesModalStyles.modalTitle}> <AppText style={leavesModalStyles.modalTitle}>
Thông tin chung Thông tin chung
...@@ -299,7 +428,12 @@ const RequestLeavesDays = props => { ...@@ -299,7 +428,12 @@ const RequestLeavesDays = props => {
/> />
</View> </View>
</View> </View>
<View style={leavesModalStyles.rowView}> <Attachments
leaveRequestImage={leaveRequestImage}
onDeleteLeaveRequestImage={onDeleteLeaveRequestImage}
openGallery={openGallery}
/>
{/* <View style={leavesModalStyles.rowView}>
<AppText>Tệp đính kèm</AppText> <AppText>Tệp đính kèm</AppText>
<View style={{flexDirection: 'row'}}> <View style={{flexDirection: 'row'}}>
{leaveRequestImage.length > 0 && {leaveRequestImage.length > 0 &&
...@@ -328,7 +462,7 @@ const RequestLeavesDays = props => { ...@@ -328,7 +462,7 @@ const RequestLeavesDays = props => {
/> />
)} )}
</View> </View>
</View> </View> */}
{isRequest && directManagersList.length > 0 && ( {isRequest && directManagersList.length > 0 && (
<View style={{marginTop: 10}}> <View style={{marginTop: 10}}>
<AppText <AppText
...@@ -385,36 +519,13 @@ const RequestLeavesDays = props => { ...@@ -385,36 +519,13 @@ const RequestLeavesDays = props => {
</View> </View>
)} )}
</View> </View>
<View <ButtonAction
style={{ onCloseModal={onCloseModal}
flexDirection: 'row', isRequest={isRequest}
justifyContent: 'flex-end', userInfo={userInfo}
marginTop: 20, onSubmitLeaveRequest={onSubmitLeaveRequest}
}}> onSubmitApproveLeaveRequest={onSubmitApproveLeaveRequest}
<TouchableOpacity />
onPress={onCloseModal}
style={leavesModalStyles.btnCancel}>
<AppText style={leavesModalStyles.blueTxt}>Hủy</AppText>
</TouchableOpacity>
{isRequest && (
<TouchableOpacity
style={leavesModalStyles.btnSubmit}
onPress={onSubmitLeaveRequest}>
<AppText style={leavesModalStyles.whiteTxt}>
Gửi yêu cầu
</AppText>
</TouchableOpacity>
)}
{userInfo?.isApprover && (
<TouchableOpacity
style={leavesModalStyles.btnSubmit}
onPress={() => onSubmitApproveLeaveRequest(userInfo?.leave_id)}>
<AppText style={leavesModalStyles.whiteTxt}>
Duyệt yêu cầu
</AppText>
</TouchableOpacity>
)}
</View>
</View> </View>
</ScrollView> </ScrollView>
</Modal> </Modal>
......
...@@ -275,12 +275,6 @@ const OvertimeContainer = props => { ...@@ -275,12 +275,6 @@ const OvertimeContainer = props => {
RootNavigation.navigate(APP_NAVIGATE_SCREEN.ON_LEAVE); RootNavigation.navigate(APP_NAVIGATE_SCREEN.ON_LEAVE);
}; };
const minutesToHours = (start, finish) => {
let time = Moment(finish).diff(Moment(start), 'minutes');
var Hours = Math.floor(time / 60);
var minutes = time % 60;
return `${Hours}:${minutes} giờ`;
};
const onChangeSelectFilter = selectedItem => { const onChangeSelectFilter = selectedItem => {
if (selectedItem === 'Tất cả') { if (selectedItem === 'Tất cả') {
setPayloadOtApproveList({ setPayloadOtApproveList({
...@@ -409,7 +403,6 @@ const OvertimeContainer = props => { ...@@ -409,7 +403,6 @@ const OvertimeContainer = props => {
onLoadMoreOtList, onLoadMoreOtList,
setShowAlert, setShowAlert,
setMonth, setMonth,
minutesToHours,
navigateToConfirmDate, navigateToConfirmDate,
navigateToOnLeave, navigateToOnLeave,
onLoadMoreOtApproveReqList, onLoadMoreOtApproveReqList,
......
/* eslint-disable prettier/prettier */
/* eslint-disable react/self-closing-comp */
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable react-native/no-inline-styles */
import React from 'react'; import React from 'react';
import { import {
Image, Image,
...@@ -21,6 +17,7 @@ import FastImage from 'react-native-fast-image'; ...@@ -21,6 +17,7 @@ import FastImage from 'react-native-fast-image';
import AppText from '../../components/AppText'; import AppText from '../../components/AppText';
import ButtonComponent from '../../components/ButtonComponent'; import ButtonComponent from '../../components/ButtonComponent';
import styles from './style'; import styles from './style';
import Utils from '../../utils';
const OvertimeScreen = ({ const OvertimeScreen = ({
userDetails, userDetails,
otVoucherList, otVoucherList,
...@@ -32,7 +29,6 @@ const OvertimeScreen = ({ ...@@ -32,7 +29,6 @@ const OvertimeScreen = ({
showAlert, showAlert,
setShowAlert, setShowAlert,
setMonth, setMonth,
minutesToHours,
isDisableLoadMore, isDisableLoadMore,
onLoadMoreOtList, onLoadMoreOtList,
onLoadMoreOtApproveReqList, onLoadMoreOtApproveReqList,
...@@ -336,7 +332,7 @@ const OvertimeScreen = ({ ...@@ -336,7 +332,7 @@ const OvertimeScreen = ({
}}> }}>
<AppText>{''}</AppText> <AppText>{''}</AppText>
<AppText style={{textAlign: 'right'}}> <AppText style={{textAlign: 'right'}}>
{minutesToHours(item.start, item.finish)} {Utils.minutesToHours(item.start, item.finish)}
</AppText> </AppText>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
......
...@@ -17,5 +17,12 @@ const commonStyles = StyleSheet.create({ ...@@ -17,5 +17,12 @@ const commonStyles = StyleSheet.create({
elevation: 5, elevation: 5,
}, },
row: {
flexDirection: 'row',
},
spaceBetweenCenter: {justifyContent: 'space-between', alignItems: 'center'},
marginVertical10: {
marginVertical: 10,
},
}); });
export default commonStyles; export default commonStyles;
...@@ -168,7 +168,14 @@ const formatCurrency = price => { ...@@ -168,7 +168,14 @@ const formatCurrency = price => {
const getCategoryNotification = category => { const getCategoryNotification = category => {
return Object.keys(config.categoryNotification).find(el => el === category); return Object.keys(config.categoryNotification).find(el => el === category);
}; };
const minutesToHours = (start, finish) => {
//console.log(start, finish);
if (!start || !finish) return '00:00';
let time = moment(finish).diff(moment(start), 'minutes');
var Hours = Math.floor(time / 60);
var minutes = time % 60;
return `${Hours}:${minutes} gi`;
};
const Utils = { const Utils = {
storeData, storeData,
getData, getData,
...@@ -180,5 +187,6 @@ const Utils = { ...@@ -180,5 +187,6 @@ const Utils = {
formatMonthVietNamLanguage, formatMonthVietNamLanguage,
formatCurrency, formatCurrency,
getCategoryNotification, getCategoryNotification,
minutesToHours,
}; };
export default Utils; export default Utils;
...@@ -31,6 +31,7 @@ const colors = { ...@@ -31,6 +31,7 @@ const colors = {
blue5c: '#5c65dc', blue5c: '#5c65dc',
gray59: '#595959', gray59: '#595959',
grayE9: '#e9eaf9', grayE9: '#e9eaf9',
gray95: '#f2f2f2',
textColor: '#202121', textColor: '#202121',
baseShadowColor: '#000', baseShadowColor: '#000',
}; };
......
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