ilink-world/screens/wallet/agent/SaisirFeuilleSoinScreen.js

2031 lines
90 KiB
JavaScript
Raw Normal View History

2021-11-11 11:43:33 +00:00
/**
* Project iLinkWorld
* File SaisirFeuilleSoinScreen
* Path screens/wallet/agent
* Created by BRICE ZELE
* Date: 11/11/2021
*/
2021-11-15 20:15:24 +00:00
import React, {useEffect, useRef, useState} from 'react';
import {
ActivityIndicator,
2021-11-22 18:20:54 +00:00
Alert,
2021-11-15 20:15:24 +00:00
Dimensions,
2021-11-22 18:20:54 +00:00
FlatList,
2021-11-15 20:15:24 +00:00
Keyboard,
KeyboardAvoidingView,
Platform,
ScrollView,
StyleSheet,
TouchableOpacity,
View,
} from 'react-native';
2021-11-11 11:43:33 +00:00
import {connect, useDispatch} from 'react-redux';
2021-11-22 09:44:45 +00:00
import Dialog from "react-native-dialog";
2021-11-15 20:15:24 +00:00
import {Formik, useFormik} from 'formik';
2021-11-11 11:43:33 +00:00
import * as Yup from 'yup';
import {Color} from "../../../config/Color";
import I18n from 'react-native-i18n';
import {ScreenComponent} from "../../../components/ScreenComponent";
import Button from "../../../components/Button";
import {responsiveWidth} from "react-native-responsive-dimensions";
import {
fetchActivePaySubscription,
fetchActivePaySubscriptionReset,
2021-11-29 11:30:04 +00:00
fetchAddDrug,
2021-11-30 15:33:51 +00:00
fetchAddDrugReset,
2021-11-29 11:30:04 +00:00
fetchCreateConsultation,
fetchCreateConsultationReset,
2021-11-30 15:33:51 +00:00
fetchGetAmountConsultation,
fetchGetAmountConsultationReset,
2021-11-29 11:30:04 +00:00
fetchGetDrugAppareil,
fetchGetDrugAppareilReset,
fetchGetNetworkActs,
fetchGetNetworkActsReset,
fetchGetProviderClass,
fetchGetProviderClassReset,
2021-11-11 11:43:33 +00:00
fetchGetSubscriptionList,
2021-11-22 18:20:54 +00:00
fetchGetSubscriptionListReset,
fetchGetUserByIdQRCode,
fetchGetUserByIdQRCodeReset,
fetchGetUserByNameOrNumber,
fetchGetUserByNameOrNumberReset
2021-11-11 11:43:33 +00:00
} from "../../../redux/insurance/insurance.actions";
import DropdownAlert from "react-native-dropdownalert";
import {readUser} from "../../../webservice/AuthApi";
2021-11-15 20:15:24 +00:00
import TextInput from "../../../components/TextInput";
2021-11-11 11:43:33 +00:00
import {createStructuredSelector} from "reselect";
2021-11-22 18:20:54 +00:00
import {
selectActivatePaySubscription,
2021-11-29 11:30:04 +00:00
selectAddDrug,
selectCreateConsultation,
2021-11-30 15:33:51 +00:00
selectGetAmountConsultation,
2021-11-29 11:30:04 +00:00
selectGetDrugAppareil,
selectGetNetworkAct,
selectGetProviderClass,
2021-11-22 18:20:54 +00:00
selectGetUserByIdQRCode,
selectGetUserByIdQRCodeReducer,
selectGetUserByNameOrNumber,
selectGetUserByNameOrNumberReducer,
selectSubscriptionList
} from "../../../redux/insurance/insurance.selector";
2021-11-15 20:15:24 +00:00
import StepHeader from "../../../components/StepHeaderComponent";
import Wizard from "react-native-wizard";
import Icon from "react-native-vector-icons/FontAwesome5";
2021-11-29 11:30:04 +00:00
import FontAwesome5 from "react-native-vector-icons/FontAwesome5";
2021-11-15 20:15:24 +00:00
import FontAwesome from "react-native-vector-icons/FontAwesome";
import Text from "../../../components/Text";
import SwitchSelector from "react-native-switch-selector";
import * as Animatable from "react-native-animatable";
2021-11-11 11:43:33 +00:00
import {Dropdown} from "react-native-material-dropdown";
2021-11-15 20:15:24 +00:00
import Modal from "react-native-modal";
import DateTimePicker from "@react-native-community/datetimepicker";
2021-11-22 09:44:45 +00:00
import QRCodeScanner from "react-native-qrcode-scanner";
import {RNCamera} from "react-native-camera";
2021-11-22 18:20:54 +00:00
import * as Utils from "../../../utils/UtilsFunction";
import {store} from "../../../redux/store";
2021-11-29 11:30:04 +00:00
import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons";
import Fontisto from "react-native-vector-icons/Fontisto";
2021-11-11 11:43:33 +00:00
let moment = require('moment-timezone');
const {width, height} = Dimensions.get('window');
const CIRCLE_SIZE = width * 0.5;
const styles = StyleSheet.create({
textInput: {
height: 46,
backgroundColor: Color.fieldColor,
borderRadius: 5,
marginTop: 10,
padding: 10,
width: '100%',
},
lineRow: {
flexDirection: 'row',
justifyContent: 'space-between',
paddingBottom: 20,
},
contain: {
alignItems: 'center',
marginTop: 40,
paddingBottom: 20,
paddingLeft: 20,
paddingRight: 20,
flex: 1,
},
circle: {
width: CIRCLE_SIZE,
height: CIRCLE_SIZE,
borderRadius: CIRCLE_SIZE / 2,
position: 'absolute',
top: '15%',
},
circleContainer: {
alignItems: 'flex-end',
right: -(CIRCLE_SIZE / 3),
top: -(CIRCLE_SIZE / 1.5),
},
lineSeparator: {
borderWidth: 1,
width: '40%',
height: 1,
alignSelf: 'center',
},
line: {
width: 1,
height: 14,
backgroundColor: Color.grayColor,
marginLeft: 10,
},
contentModeView: {
width: 30,
height: '100%',
alignItems: 'flex-end',
justifyContent: 'center',
},
contentFilter: {
flexDirection: 'row',
alignItems: 'center',
marginLeft: 10,
},
bottomModal: {
justifyContent: 'flex-end',
margin: 0,
},
contentFilterBottom: {
width: "100%",
borderTopLeftRadius: 8,
borderTopRightRadius: 8,
paddingHorizontal: 20
},
contentSwipeDown: {
paddingTop: 10,
alignItems: 'center',
},
lineSwipeDown: {
width: 30,
height: 2.5,
backgroundColor: Color.dividerColor,
},
contentActionModalBottom: {
flexDirection: 'row',
paddingVertical: 15,
justifyContent: 'space-between',
borderBottomWidth: 1,
},
containModal: {
paddingVertical: 10,
paddingHorizontal: 20,
flexDirection: 'row',
justifyContent: 'space-between',
},
floatingButtonAdd: {
backgroundColor: Color.accentColor,
position: "absolute",
width: 25,
bottom: 0,
zIndex: 1000,
right: 20,
top: 35,
height: 25,
borderRadius: 12.5,
alignItems: 'center',
justifyContent: 'center',
},
contentSwitch: {
width: responsiveWidth(40),
},
switch: {},
choosePhotoBtn: {
marginTop: 10,
marginBottom: 10,
width: "auto",
height: "auto",
padding: 5,
alignItems: 'center',
borderColor: Color.borderColor,
marginRight: 10,
elevation: 2,
},
checkbox: {
alignSelf: "center",
color: "white"
},
itemAmountPerMonth: {
paddingLeft: 10,
marginTop: 10,
flexDirection: 'row',
},
dot: {
width: 12,
height: 12,
borderRadius: 6
},
blockView: {
paddingVertical: 10,
borderBottomWidth: 0.5,
},
2021-11-15 20:15:24 +00:00
iconNavigation: {
width: '100%',
flexDirection: 'row',
marginTop: 20,
justifyContent: 'space-between',
alignItems: 'center',
},
iconNavigationButton: {
borderWidth: 1,
borderRadius: 25,
width: 50,
height: 50,
alignItems: 'center',
2021-11-29 11:30:04 +00:00
justifyContent: 'center'
2021-11-15 20:15:24 +00:00
},
2021-11-29 11:30:04 +00:00
beneficiarySubSection: {
marginTop: 10,
flexDirection: 'row',
width: '100%',
}
2021-11-11 11:43:33 +00:00
});
const SaisirFeuilleSoinScreen = ({
activatePaySubscription,
fetchGetSubscriptionList,
subscriptionList,
fetchActivePaySubscription,
2021-11-22 18:20:54 +00:00
fetchGetUserByIdQRCode,
fetchGetUserByNameOrNumber,
2021-11-29 11:30:04 +00:00
fetchGetDrugAppareil,
fetchAddDrug,
fetchGetProviderClass,
fetchGetNetworkActs,
fetchCreateConsultation,
2021-11-30 15:33:51 +00:00
fetchGetAmountConsultation,
2021-11-22 18:20:54 +00:00
getUserByNameOrNumber,
getUserByIdQRCode,
2021-11-29 11:30:04 +00:00
getDrugAppareil,
getProviderClass,
addDrug,
createConsultation,
getNetworkAct,
2021-11-30 15:33:51 +00:00
getAmountConsultation,
2021-11-11 11:43:33 +00:00
navigation
}) => {
2021-11-30 15:33:51 +00:00
const [datePrestation, setDatePrestation] = useState('' + moment(new Date()).format('YYYY-MM-DD HH:mm'));
2021-11-15 20:15:24 +00:00
const [showDatePrestation, setShowDatePrestation] = useState(false);
const [dateAccident, setDateAccident] = useState(null);
const [isAccident, setIsAccident] = useState(false);
2021-11-22 09:44:45 +00:00
const [showQRCodeScanner, setShowQRCodeScanner] = useState(false);
2021-11-15 20:15:24 +00:00
const [showDateAccidentPicker, setShowDateAccidentPicker] = useState(false);
2021-11-22 18:20:54 +00:00
const [wallet] = useState(store.getState().walletDetailReducer.result.response);
2022-01-20 03:51:20 +00:00
const [isNumeroAssureSearch, setIsNumeroAssureSearch] = useState(false);
const [isPhoneAssureSearch, setIsPhoneAssureSearch] = useState(false);
2021-11-22 18:20:54 +00:00
2021-11-15 20:15:24 +00:00
const [dateDebutGrossesse, setDateDebutGrossesse] = useState(null);
const [dateFinGrossesse, setDateFinGrossesse] = useState(null);
const [isGrossesse, setIsGrossesse] = useState(false);
const [showDateDebutGrossessePicker, setShowDateDebutGrossessePicker] = useState(false);
const [showDateFinGrossessePicker, setShowDateFinGrossessePicker] = useState(false);
2021-11-30 15:33:51 +00:00
const [careConditon, setCareCondition] = useState(null);
2021-11-15 20:15:24 +00:00
2021-11-11 11:43:33 +00:00
const [user, setUser] = useState(null);
2021-11-22 18:20:54 +00:00
const [assure, setAssure] = useState(null);
2021-11-29 11:30:04 +00:00
const [beneficiary, setBeneficiary] = useState(null);
const [medicament, setMedicament] = useState(null);
2021-11-15 20:15:24 +00:00
const wizard = useRef();
const [isFirstStep, setIsFirstStep] = useState(true);
const [isLastStep, setIsLastStep] = useState(false);
const [currentStep, setCurrentStep] = useState(1);
const [modalPrestation, setModalPrestation] = useState(false);
2021-11-29 11:30:04 +00:00
const [modalMedicament, setModalMedicament] = useState(false);
2021-11-30 15:33:51 +00:00
const [modalAddMedicament, setModalAddMedicament] = useState(false);
2021-11-29 11:30:04 +00:00
const [modalExamen, setModalExamen] = useState(false);
2021-11-22 18:20:54 +00:00
const [modalListAssure, setModalListAssure] = useState(false);
2021-11-29 11:30:04 +00:00
const [modalListMedicament, setModalListMedicament] = useState(false);
const [networkAct, setNetworkAct] = useState(null);
const [prestations, setPrestations] = useState([]);
const [examens, setExamens] = useState([]);
const [prescriptions, setPrescriptions] = useState([]);
console.log("Prestations", prestations);
console.log("examens", examens);
console.log("prescriptions", prescriptions);
2021-11-15 20:15:24 +00:00
const [statutPatientOption] = useState([
{label: I18n.t('AYANT_DROITS'), value: "M"},
{label: I18n.t('ASSURE'), value: "F"},
]);
2021-11-29 11:30:04 +00:00
const [statutPatient, setStatutPatient] = useState(1);
2021-11-15 20:15:24 +00:00
const [accident] = useState([
{label: I18n.t('YES'), value: "YES"},
{label: I18n.t('NO'), value: "NO"},
]);
const [grossesse] = useState([
{label: I18n.t('YES'), value: "YES"},
{label: I18n.t('NO'), value: "NO"},
]);
const [visiteDomicile] = useState([
{label: I18n.t('YES'), value: "YES"},
{label: I18n.t('NO'), value: "NO"},
]);
2021-11-29 11:30:04 +00:00
const [isVisiteDomicile, setIsVisiteDomicile] = useState(false);
2021-11-15 20:15:24 +00:00
const [conditionPriseEnChange] = useState([
2021-11-29 11:30:04 +00:00
{label: I18n.t('AFFECTION_COURANTE'), value: "CURRENT_AFFECTION"},
{label: I18n.t('AFFECTION_LONGUE'), value: "LONG_TERM_AFFECTION"},
2021-11-30 15:33:51 +00:00
{
label:
I18n.t('EXONERE'), value: "EXONERATION"
},
]);
const [onPrescription] = useState([
{label: I18n.t('COMPRESSED'), value: "COMPRESSED"},
{label: I18n.t('SYRUP'), value: "SYRUP"},
{label: I18n.t('SOLUTION'), value: "SOLUTION"},
{label: I18n.t('SUPPOSITORY'), value: "SUPPOSITORY"},
{label: I18n.t('DEVICE'), value: "DEVICE"},
2021-11-15 20:15:24 +00:00
]);
2021-11-11 11:43:33 +00:00
const dispatch = useDispatch();
let dropDownAlertRef: any = null;
2021-11-15 20:15:24 +00:00
let classificationRef = null;
let codeActeRef = null;
2021-11-30 15:33:51 +00:00
let onPrescriptionRef = null;
2021-11-11 11:43:33 +00:00
useEffect(() => {
readUser().then((user) => {
2021-11-29 11:30:04 +00:00
setFieldValue('agrement_praticien', user.code_membre);
console.log("User", user);
2021-11-11 11:43:33 +00:00
setUser(user)
});
dispatch(fetchGetSubscriptionListReset());
dispatch(fetchActivePaySubscriptionReset());
2021-11-22 18:20:54 +00:00
dispatch(fetchGetUserByNameOrNumberReset());
dispatch(fetchGetUserByIdQRCodeReset());
2021-11-29 11:30:04 +00:00
dispatch(fetchGetDrugAppareilReset());
dispatch(fetchCreateConsultationReset());
dispatch(fetchGetNetworkActsReset());
dispatch(fetchGetProviderClassReset());
2021-11-30 15:33:51 +00:00
dispatch(fetchAddDrugReset());
2021-11-29 11:30:04 +00:00
fetchGetProviderClass(wallet.id_network);
fetchGetNetworkActs(wallet.id_network, '');
2021-11-11 11:43:33 +00:00
}, []);
useEffect(() => {
if (user !== null) {
2021-11-22 18:20:54 +00:00
console.log("user", user);
2021-11-11 11:43:33 +00:00
}
}, [user]);
2021-11-22 18:20:54 +00:00
useEffect(() => {
console.log("getUserByNameOrNumber.result", getUserByNameOrNumber);
if (getUserByNameOrNumber.result !== null) {
if (getUserByNameOrNumber.result.response.length > 0) {
setModalListAssure(true);
//wizard.current.next();
} else {
dropDownAlertRef.alertWithType(
'warn',
I18n.t('EMPTY_LIST'),
I18n.t('NO_ASSURE_MATCH_SEARCH'),
);
2022-01-20 03:51:20 +00:00
dispatch(fetchGetUserByNameOrNumberReset());
2021-11-22 18:20:54 +00:00
}
}
if (getUserByNameOrNumber.error) {
dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(getUserByNameOrNumber),
);
dispatch(fetchGetUserByNameOrNumberReset());
}
}, [getUserByNameOrNumber]);
2021-11-29 11:30:04 +00:00
useEffect(() => {
if (getDrugAppareil.result !== null) {
if (getDrugAppareil.result.response.length > 0) {
setModalListMedicament(true);
2021-11-30 15:33:51 +00:00
} else {
Alert.alert(
I18n.t("ERROR_LABEL"),
I18n.t('NO_DRUG_MATCH_YOU_SEARCH'),
[
{
text: I18n.t("OK"), onPress: () => {
setModalAddMedicament(true);
dispatch(fetchGetDrugAppareilReset());
dispatch(fetchAddDrugReset());
}
}
],
{cancelable: false}
)
2021-11-29 11:30:04 +00:00
}
}
if (getDrugAppareil.error) {
dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(getDrugAppareil),
);
dispatch(fetchGetDrugAppareilReset());
}
}, [getDrugAppareil]);
2021-11-30 15:33:51 +00:00
useEffect(() => {
if (addDrug.result !== null) {
setModalAddMedicament(false);
setMedicament(addDrug.result.response);
}
if (addDrug.error) {
dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(addDrug),
);
dispatch(fetchAddDrugReset());
}
}, [addDrug]);
2021-11-29 11:30:04 +00:00
useEffect(() => {
if (createConsultation.result !== null) {
Alert.alert(
I18n.t("SUCCESS"),
createConsultation.result.response,
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchCreateConsultationReset());
navigation.goBack();
}
}
],
{cancelable: false}
)
}
if (createConsultation.error) {
dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(createConsultation),
);
dispatch(fetchCreateConsultationReset());
}
}, [createConsultation]);
2021-11-15 20:15:24 +00:00
const SaisirFeuilleSoinSchema = Yup.object().shape({
numero_assure: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')),
password: Yup.string()
2021-11-29 11:30:04 +00:00
.required(I18n.t('THIS_FIELD_IS_REQUIRED')),
practitioner_lastname: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')),
practitioner_firstname: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED')),
2021-11-15 20:15:24 +00:00
});
2021-11-11 11:43:33 +00:00
2021-11-29 11:30:04 +00:00
const AddNewPrestation = Yup.object().shape({
amount_prestation: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
code_acte: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
frais_deplacement: Yup.number(),
date_prestation: Yup.date(),
ticker_moderateur: Yup.number(),
});
const AddNewExamen = Yup.object().shape({
examen_name: Yup.string().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
code_acte: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
examen_quantite: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED'))
});
const AddNewMedicament = Yup.object().shape({
drug_name: Yup.string().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
drug_quantity: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
drug_posologie: Yup.string().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
2021-11-15 20:15:24 +00:00
});
2021-11-11 11:43:33 +00:00
2021-11-30 15:33:51 +00:00
const AddNewMedicamentToDB = Yup.object().shape({
code: Yup.string().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
name: Yup.string().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
type: Yup.string().required(I18n.t('THIS_FIELD_IS_REQUIRED'))
});
2021-11-15 20:15:24 +00:00
const onChangeDatePrestation = (event, selectedDate) => {
const currentDate = selectedDate || '' + moment(new Date()).format('YYYY-MM-DD');
setShowDatePrestation(Platform.OS === 'ios');
setDatePrestation(currentDate);
};
2021-11-11 11:43:33 +00:00
2021-11-15 20:15:24 +00:00
const renderDatePrestationPicker = () => {
return (<DateTimePicker
timeZoneOffsetInMinutes={0}
is24Hour={true}
2021-11-30 15:33:51 +00:00
value={new Date(datePrestation)}
2021-11-15 20:15:24 +00:00
mode='date'
display="spinner"
onChange={onChangeDatePrestation}
/>
);
}
2021-11-11 11:43:33 +00:00
2021-11-15 20:15:24 +00:00
const onChangeDateAccident = (event, selectedDate) => {
const currentDate = selectedDate || new Date();
setShowDateAccidentPicker(Platform.OS === 'ios');
setDateAccident(moment(currentDate).format('YYYY-MM-DD'));
2021-11-29 11:30:04 +00:00
setFieldValue('accident_date', moment(currentDate).format('YYYY-MM-DD'));
2021-11-15 20:15:24 +00:00
};
2021-11-11 11:43:33 +00:00
2021-11-15 20:15:24 +00:00
const renderDateAccidentPicker = () => {
return (<DateTimePicker
timeZoneOffsetInMinutes={0}
is24Hour={true}
value={new Date()}
mode='date'
display="spinner"
onChange={onChangeDateAccident}
/>
);
}
const onChangeDateDebutGrossesse = (event, selectedDate) => {
const currentDate = selectedDate || new Date();
setShowDateDebutGrossessePicker(Platform.OS === 'ios');
setDateDebutGrossesse(moment(currentDate).format('YYYY-MM-DD'));
2021-11-29 11:30:04 +00:00
setFieldValue('pregnancy_start_at', moment(currentDate).format('YYYY-MM-DD'));
2021-11-15 20:15:24 +00:00
};
const renderDateDebutGrossessePicker = () => {
return (<DateTimePicker
timeZoneOffsetInMinutes={0}
is24Hour={true}
value={new Date()}
mode='date'
display="spinner"
onChange={onChangeDateDebutGrossesse}
/>
);
}
const onChangeDateFinGrossesse = (event, selectedDate) => {
const currentDate = selectedDate || new Date();
setShowDateFinGrossessePicker(Platform.OS === 'ios');
setDateFinGrossesse(moment(currentDate).format('YYYY-MM-DD'));
2021-11-29 11:30:04 +00:00
setFieldValue('pregnancy_end_at', moment(currentDate).format('YYYY-MM-DD'));
2021-11-15 20:15:24 +00:00
};
const renderDateFinGrossessePicker = () => {
return (<DateTimePicker
timeZoneOffsetInMinutes={0}
is24Hour={true}
value={new Date()}
mode='date'
display="spinner"
onChange={onChangeDateFinGrossesse}
/>
);
}
2021-11-11 11:43:33 +00:00
2021-11-22 09:44:45 +00:00
const renderDialogQRCodeScanner = () => {
return (
<Dialog.Container contentStyle={{width: responsiveWidth(80)}} useNativeDriver={true}
visible={showQRCodeScanner}>
<Dialog.Title>{I18n.t('SCAN')}</Dialog.Title>
<ScrollView style={[styles.blockView, {borderBottomColor: Color.borderColor, maxHeight: 300}]}>
<Text>
{I18n.t('BRING_YOUR_CAMERA_CLOSER_TO_SCAN_QR_CODE')}
</Text>
<QRCodeScanner
onRead={(result) => {
setShowQRCodeScanner(false);
console.log("result", result.data);
}}
flashMode={RNCamera.Constants.FlashMode.off}
/>
</ScrollView>
<Dialog.Button bold={true} label={I18n.t('CLOSE')} onPress={() => {
setShowQRCodeScanner(false);
}}/>
</Dialog.Container>
)
}
2021-11-15 20:15:24 +00:00
const renderAddNewPrestation = () => (
2021-11-29 11:30:04 +00:00
<Formik validationSchema={AddNewPrestation}
2021-11-15 20:15:24 +00:00
initialValues={{
amount_prestation: '',
2021-11-29 11:30:04 +00:00
frais_deplacement: '',
code_acte: ''
2021-11-15 20:15:24 +00:00
}}
onSubmit={(values) => {
2021-11-29 11:30:04 +00:00
if (values.code_acte === '')
codeActeRef.shake(200)
2021-11-30 15:33:51 +00:00
else {
2021-11-29 11:30:04 +00:00
setPrestations([{
act_id: values.code_acte,
amount: values.amount_prestation,
home_visit_fees: values.frais_deplacement
}, ...prestations]);
2021-11-30 15:33:51 +00:00
setModalPrestation(false);
Utils.displayToast(I18n.t('PRESTATION_SUCCESSFULLY_ADD'));
}
2021-11-15 20:15:24 +00:00
}}>
{({
values,
errors,
touched,
handleChange,
handleBlur,
2021-11-29 11:30:04 +00:00
setFieldValue,
setFieldTouched,
2021-11-15 20:15:24 +00:00
handleSubmit,
isSubmitting,
}) => (
2021-11-11 11:43:33 +00:00
<ScrollView style={{flex: 1}}>
2021-11-15 20:15:24 +00:00
<View style={[styles.containModal, {backgroundColor: Color.containerBackgroundColor}]}>
<Modal
isVisible={modalPrestation}
onSwipeComplete={() => {
setModalPrestation(false);
2021-11-11 11:43:33 +00:00
}}
2021-11-15 20:15:24 +00:00
swipeDirection={['down']}
style={styles.bottomModal}>
<View
style={[
styles.contentFilterBottom,
{backgroundColor: Color.containerBackgroundColor},
]}>
<View style={styles.contentSwipeDown}>
<View style={styles.lineSwipeDown}/>
</View>
<Text body2 style={{marginTop: 10}}>{I18n.t('ADD_PRESTATION')}</Text>
<TextInput
style={{marginTop: 10}}
2021-11-29 11:30:04 +00:00
placeholder={I18n.t('DATE')}
2021-11-30 15:33:51 +00:00
value={'' + moment(datePrestation).format('YYYY-MM-DD HH:mm')}
editable={false}
2021-11-15 20:15:24 +00:00
/>
<Animatable.View ref={(comp) => {
codeActeRef = comp
}}
style={{
width: responsiveWidth(90),
height: 60,
alignSelf: 'center',
borderRadius: 10,
paddingLeft: 20,
marginTop: 10,
paddingRight: 20,
backgroundColor: 'white'
}}>
<Dropdown
label={I18n.t('CODE_ACTE')}
2021-11-29 11:30:04 +00:00
data={getNetworkAct.result !== null ? getNetworkAct.result?.response : []}
2021-11-15 20:15:24 +00:00
useNativeDriver={true}
onChangeText={(value, index, data) => {
2021-11-29 11:30:04 +00:00
setFieldTouched('code_acte');
setFieldValue('code_acte', value.id);
2021-11-15 20:15:24 +00:00
}}
valueExtractor={(value) => {
return value
}}
labelExtractor={(value) => {
return value.name
}}
/>
</Animatable.View>
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('AMOUNT')}
value={values.amount_prestation}
onChangeText={handleChange('amount_prestation')}
onBlur={handleBlur('amount_prestation')}
success={touched.amount_prestation && !errors.amount_prestation}
touched={touched.amount_prestation}
error={errors.amount_prestation}
2021-11-30 15:33:51 +00:00
onKeyPress={() => {
fetchGetAmountConsultation({
network_id: wallet.id_network,
amount: values.amount_prestation,
care_condition: careConditon
});
}}
2021-11-15 20:15:24 +00:00
/>
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('TICKET_MONDERATEUR')}
2021-11-30 15:33:51 +00:00
editable={false}
value={getAmountConsultation.result !== null ? getAmountConsultation.result.response.moderator_ticket : ''}
2021-11-15 20:15:24 +00:00
/>
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('AMOUNT_PER_INSURANCE')}
2021-11-29 11:30:04 +00:00
editable={false}
2021-11-30 15:33:51 +00:00
value={getAmountConsultation.result !== null ? getAmountConsultation.result.response.insurance_amount : ''}/>
2021-11-15 20:15:24 +00:00
<View style={{
marginTop: 10,
width: "100%",
flexDirection: 'row',
justifyContent: "space-between"
}}>
<Text body2>{I18n.t('VISITE_DOMICILE')}</Text>
<View style={styles.contentSwitch}>
<SwitchSelector options={visiteDomicile}
2021-11-29 11:30:04 +00:00
initial={1}
2021-11-15 20:15:24 +00:00
buttonColor={Color.accentColor}
backgroundColor={Color.primaryDarkColor}
textColor='white'
bold={true}
hasPadding
height={32}
onPress={(value) => {
2021-11-29 11:30:04 +00:00
setIsVisiteDomicile(value === 'YES')
2021-11-15 20:15:24 +00:00
}}/>
</View>
</View>
2021-11-29 11:30:04 +00:00
{isVisiteDomicile && (
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('FRAIS_DEPLACEMENT')}
value={values.frais_deplacement}
onChangeText={handleChange('frais_deplacement')}
onBlur={handleBlur('frais_deplacement')}
success={touched.frais_deplacement && !errors.frais_deplacement}
touched={touched.frais_deplacement}
error={errors.frais_deplacement}
/>
)
}
2021-11-15 20:15:24 +00:00
<Button
style={{marginTop: 20, marginBottom: 20}}
full
onPress={handleSubmit}>
{I18n.t('SUBMIT_LABEL')}
</Button>
</View>
</Modal>
</View>
</ScrollView>
)}
</Formik>
);
2021-11-29 11:30:04 +00:00
const renderAddNewMedicament = () => (
<Formik validationSchema={AddNewMedicament}
2021-11-15 20:15:24 +00:00
initialValues={{
2021-11-29 11:30:04 +00:00
drug_name: '',
drug_posologie: '',
drug_quantity: ''
2021-11-15 20:15:24 +00:00
}}
onSubmit={(values) => {
2021-11-29 11:30:04 +00:00
setPrescriptions([{
drug_or_device_id: medicament.id,
dosage: values.drug_posologie,
quantity: values.drug_quantity
}, ...prescriptions]);
setModalMedicament(false);
Utils.displayToast(I18n.t('PRESCRIPTIONS_SUCCESSFULLY_ADD'));
2021-11-15 20:15:24 +00:00
}}>
{({
values,
errors,
touched,
handleChange,
handleBlur,
handleSubmit,
2021-11-29 11:30:04 +00:00
2021-11-15 20:15:24 +00:00
isSubmitting,
}) => (
<ScrollView style={{flex: 1}}>
<View style={[styles.containModal, {backgroundColor: Color.containerBackgroundColor}]}>
<Modal
2021-11-29 11:30:04 +00:00
isVisible={modalMedicament}
2021-11-15 20:15:24 +00:00
onSwipeComplete={() => {
2021-11-29 11:30:04 +00:00
setModalMedicament(false);
2021-11-15 20:15:24 +00:00
}}
swipeDirection={['down']}
style={styles.bottomModal}>
<View
style={[
styles.contentFilterBottom,
{backgroundColor: Color.containerBackgroundColor},
]}>
<View style={styles.contentSwipeDown}>
<View style={styles.lineSwipeDown}/>
</View>
2021-11-29 11:30:04 +00:00
<Text body2 style={{marginTop: 10}}>{I18n.t('AJOUTER_MEDICAMENT')}</Text>
<View style={{flexDirection: 'row'}}>
<TextInput
style={{marginTop: 10, width: "90%"}}
placeholder={I18n.t('NAME')}
value={medicament !== null ? medicament.name : values.drug_name}
onChangeText={handleChange('drug_name')}
onBlur={handleBlur('drug_name')}
success={touched.drug_name && !errors.drug_name}
touched={touched.drug_name}
error={errors.drug_name}
2021-11-30 15:33:51 +00:00
editable={medicament === null}
2021-11-29 11:30:04 +00:00
/>
<TouchableOpacity
style={[
styles.iconNavigationButton,
{
backgroundColor:
Color.primaryColor,
borderColor:
Color.primaryColor,
marginTop: 10,
width: 40,
height: 40,
},
]}
onPress={e => {
fetchGetDrugAppareil(wallet.id_network, values.drug_name);
}}>
{(getDrugAppareil.loading) ?
<ActivityIndicator
size="small"
color="#fff"
/>
: <FontAwesome
name="search"
size={24}
color={Color.whiteColor}
/>}
</TouchableOpacity>
</View>
2021-11-15 20:15:24 +00:00
<TextInput
style={{marginTop: 10}}
2021-11-29 11:30:04 +00:00
placeholder={I18n.t('POSOLOGIE')}
value={values.drug_posologie}
onChangeText={handleChange('drug_posologie')}
onBlur={handleBlur('drug_posologie')}
success={touched.drug_posologie && !errors.drug_posologie}
touched={touched.drug_posologie}
error={errors.drug_posologie}
/>
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('QUANTITE')}
value={values.drug_quantity}
onChangeText={handleChange('drug_quantity')}
onBlur={handleBlur('drug_quantity')}
success={touched.drug_quantity && !errors.drug_quantity}
touched={touched.drug_quantity}
error={errors.drug_quantity}
keyboardType='numeric'
2021-11-15 20:15:24 +00:00
/>
2021-11-29 11:30:04 +00:00
<Button
style={{marginTop: 20, marginBottom: 20}}
full
onPress={handleSubmit}>
{I18n.t('SUBMIT_LABEL')}
</Button>
</View>
</Modal>
</View>
</ScrollView>
)}
</Formik>
);
2021-11-30 15:33:51 +00:00
const renderAddNewMedicamentToDB = () => (
<Formik validationSchema={AddNewMedicamentToDB}
initialValues={{
code: '',
name: '',
type: '',
on_prescription: false
}}
onSubmit={(values) => {
setMedicament(null);
fetchAddDrug({
network_id: wallet.id_network,
code: values.code,
name: values.name,
type: values.type,
on_prescription: values.on_prescription
})
}}>
{({
values,
errors,
touched,
handleChange,
handleBlur,
handleSubmit,
setFieldValue,
isSubmitting,
}) => (
<ScrollView style={{flex: 1}}>
<View style={[styles.containModal, {backgroundColor: Color.containerBackgroundColor}]}>
<Modal
isVisible={modalAddMedicament}
onSwipeComplete={() => {
setModalAddMedicament(false);
}}
swipeDirection={['down']}
style={styles.bottomModal}>
<View
style={[
styles.contentFilterBottom,
{backgroundColor: Color.containerBackgroundColor},
]}>
<View style={styles.contentSwipeDown}>
<View style={styles.lineSwipeDown}/>
</View>
<Text body2 style={{marginTop: 10}}>{I18n.t('AJOUTER_NOUVEAU_MEDICAMENT')}</Text>
<TextInput
style={{marginTop: 10}}
placeholder='Code'
value={values.code}
onChangeText={handleChange('code')}
onBlur={handleBlur('code')}
success={touched.code && !errors.code}
touched={touched.code}
error={errors.code}
/>
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('NAME')}
value={values.name}
onChangeText={handleChange('name')}
onBlur={handleBlur('name')}
success={touched.name && !errors.name}
touched={touched.name}
error={errors.name}
/>
<Animatable.View ref={(comp) => {
onPrescriptionRef = comp
}}
style={{
width: responsiveWidth(90),
height: 60,
alignSelf: 'center',
borderRadius: 10,
paddingLeft: 20,
marginTop: 10,
paddingRight: 20,
backgroundColor: 'white'
}}>
<Dropdown
label='Type'
data={onPrescription}
useNativeDriver={true}
onChangeText={(value, index, data) => {
setFieldValue('type', value.value);
}}
valueExtractor={(value) => {
return value
}}
labelExtractor={(value) => {
return value.label
}}
/>
</Animatable.View>
<View style={{
marginTop: 10,
flexDirection: 'row',
justifyContent: "space-between"
}}>
<Text body2>{I18n.t('SOUS_ORDONNANCE')}</Text>
<View style={{width: responsiveWidth(60)}}>
<SwitchSelector options={grossesse}
initial={1}
buttonColor={Color.accentColor}
backgroundColor={Color.primaryDarkColor}
textColor='white'
bold={true}
hasPadding
height={32}
onPress={(value) => {
setFieldValue('on_prescription', value === 'YES');
console.log("On Prescription", value);
//setGender(value);
}}/>
</View>
</View>
<Button
style={{marginTop: 20, marginBottom: 20}}
full
loading={addDrug.loading}
onPress={handleSubmit}>
{I18n.t('SUBMIT_LABEL')}
</Button>
</View>
</Modal>
</View>
</ScrollView>
)}
</Formik>
);
2021-11-29 11:30:04 +00:00
const renderAddNewExamen = () => (
<Formik validationSchema={AddNewExamen}
initialValues={{
examen_name: '',
examen_quantite: '',
code_acte: ''
}}
onSubmit={(values) => {
console.log("Value", values);
setExamens([{
act_id: values.code_acte,
description: values.examen_name,
quantity: values.examen_quantite
}, ...examens]);
setModalExamen(false);
Utils.displayToast(I18n.t('EXAMENS_SUCCESSFULLY_ADD'));
}}>
{({
values,
errors,
touched,
handleChange,
setFieldValue,
setFieldTouched,
handleBlur,
handleSubmit,
isSubmitting,
}) => (
<ScrollView style={{flex: 1}}>
<View style={[styles.containModal, {backgroundColor: Color.containerBackgroundColor}]}>
<Modal
isVisible={modalExamen}
onSwipeComplete={() => {
setModalExamen(false);
}}
swipeDirection={['down']}
style={styles.bottomModal}>
<View
style={[
styles.contentFilterBottom,
{backgroundColor: Color.containerBackgroundColor},
]}>
<View style={styles.contentSwipeDown}>
<View style={styles.lineSwipeDown}/>
</View>
<Text body2 style={{marginTop: 10}}>{I18n.t('AJOUTER_EXAMEN')}</Text>
2021-11-11 11:43:33 +00:00
<Animatable.View ref={(comp) => {
2021-11-15 20:15:24 +00:00
codeActeRef = comp
2021-11-11 11:43:33 +00:00
}}
style={{
width: responsiveWidth(90),
height: 60,
alignSelf: 'center',
borderRadius: 10,
paddingLeft: 20,
2021-11-15 20:15:24 +00:00
marginTop: 10,
2021-11-11 11:43:33 +00:00
paddingRight: 20,
backgroundColor: 'white'
}}>
<Dropdown
2021-11-15 20:15:24 +00:00
label={I18n.t('CODE_ACTE')}
2021-11-29 11:30:04 +00:00
data={getNetworkAct.result !== null ? getNetworkAct.result?.response : []}
2021-11-11 11:43:33 +00:00
useNativeDriver={true}
onChangeText={(value, index, data) => {
console.log("Value", value);
2021-11-29 11:30:04 +00:00
setFieldTouched('code_acte');
setFieldValue('code_acte', value.id);
2021-11-11 11:43:33 +00:00
}}
valueExtractor={(value) => {
return value
}}
labelExtractor={(value) => {
2021-11-15 20:15:24 +00:00
return value.name
2021-11-11 11:43:33 +00:00
}}
/>
</Animatable.View>
2021-11-15 20:15:24 +00:00
<TextInput
style={{marginTop: 10}}
2021-11-29 11:30:04 +00:00
placeholder={I18n.t('NAME')}
value={values.examen_name}
onChangeText={handleChange('examen_name')}
onBlur={handleBlur('examen_name')}
success={touched.examen_name && !errors.examen_name}
touched={touched.examen_name}
error={errors.examen_name}
2021-11-15 20:15:24 +00:00
/>
<TextInput
2021-11-11 11:43:33 +00:00
style={{marginTop: 10}}
2021-11-29 11:30:04 +00:00
placeholder={I18n.t('QUANTITE')}
value={values.examen_quantite}
onChangeText={handleChange('examen_quantite')}
onBlur={handleBlur('examen_quantite')}
success={touched.examen_quantite && !errors.examen_quantite}
touched={touched.examen_quantite}
error={errors.examen_quantite}
keyboardType='numeric'
2021-11-11 11:43:33 +00:00
/>
<Button
2021-11-15 20:15:24 +00:00
style={{marginTop: 20, marginBottom: 20}}
2021-11-11 11:43:33 +00:00
full
2021-11-29 11:30:04 +00:00
onPress={() => {
console.log("errors", errors);
console.log("values", values);
handleSubmit();
}}>
2021-11-11 11:43:33 +00:00
{I18n.t('SUBMIT_LABEL')}
</Button>
</View>
2021-11-15 20:15:24 +00:00
</Modal>
</View>
</ScrollView>
)}
</Formik>
);
2021-11-22 18:20:54 +00:00
const renderListAssure = () => (
<ScrollView style={{flex: 1}}>
<View style={[styles.containModal, {backgroundColor: Color.containerBackgroundColor}]}>
<Modal
isVisible={modalListAssure}
onSwipeComplete={() => {
setModalListAssure(false);
}}
swipeDirection={['down']}
style={styles.bottomModal}>
<View
style={[
styles.contentFilterBottom,
{backgroundColor: Color.containerBackgroundColor},
]}>
<View style={styles.contentSwipeDown}>
<View style={styles.lineSwipeDown}/>
</View>
<Text body2 style={{marginTop: 10}}>{I18n.t('LIST_ASSURE')}</Text>
<FlatList data={getUserByNameOrNumber.result?.response}
extraData={getUserByNameOrNumber.result?.response}
keyExtractor={(item, index) => index}
2022-01-04 11:42:58 +00:00
ListEmptyComponent={<Text body2>{I18n.t('NO_ASSURE_MATCH_SEARCH')}</Text>}
2021-11-22 18:20:54 +00:00
renderItem={({item, index}) => {
return (
2021-11-29 11:30:04 +00:00
<View style={{
paddingVertical: 15,
alignItems: 'flex-start',
}}>
<TouchableOpacity
style={[
styles.contentActionModalBottom,
{borderBottomColor: Color.borderColor, width: "100%"},
]}
key={item.id}
onPress={() => {
if (item.state !== 'PAID') {
Alert.alert(I18n.t('ERROR_LABEL'), I18n.t('ASSURE_NON_EN_REGLE'),
[{
text: I18n.t('OK'), onPress: () => {
}
}]);
} else {
setAssure(item);
setBeneficiary(null);
setStatutPatient(1);
setModalListAssure(false);
setFieldValue(
'lastname_patient',
item.user.lastname,
);
setFieldValue(
'firstname_patient',
item.user.firstname,
);
dispatch(fetchGetUserByNameOrNumberReset());
wizard.current.next();
}
}}>
<Text body2 semibold>
{`${item.user.firstname} ${item.user.lastname}`}
</Text>
</TouchableOpacity>
{item.beneficiaries.map((beneficiary) => (
<TouchableOpacity style={styles.beneficiarySubSection}
onPress={() => {
setAssure(item);
setBeneficiary(beneficiary);
setStatutPatient(0);
setModalListAssure(false);
setFieldValue(
'lastname_patient',
beneficiary.lastname,
);
setFieldValue(
'firstname_patient',
beneficiary.firstname,
);
dispatch(fetchGetUserByNameOrNumberReset());
wizard.current.next();
}}>
<View style={{width: 10}}/>
<View style={{paddingHorizontal: 10, alignItems: 'flex-start'}}>
<Text subhead semibold>
{`${beneficiary.firstname} ${beneficiary.lastname} (${I18n.t('AYANT_DROITS')})`}
</Text>
</View>
</TouchableOpacity>
))}
</View>
2021-11-22 18:20:54 +00:00
)
}}/>
<Button
full
style={{marginTop: 10, marginBottom: 20}}
onPress={() => setModalListAssure(false)}>
{I18n.t('OK')}
</Button>
</View>
</Modal>
</View>
</ScrollView>
)
2021-11-29 11:30:04 +00:00
const renderListMedicament = () => (
<ScrollView style={{flex: 1}}>
<View style={[styles.containModal, {backgroundColor: Color.containerBackgroundColor}]}>
<Modal
isVisible={modalListMedicament}
onSwipeComplete={() => {
setModalListMedicament(false);
}}
swipeDirection={['down']}
style={styles.bottomModal}>
<View
style={[
styles.contentFilterBottom,
{backgroundColor: Color.containerBackgroundColor},
]}>
<View style={styles.contentSwipeDown}>
<View style={styles.lineSwipeDown}/>
</View>
<Text body2 style={{marginTop: 10}}>{I18n.t('LISTE_MEDICAMENT')}</Text>
<FlatList data={getDrugAppareil.result?.response}
extraData={getDrugAppareil.result?.response}
keyExtractor={(item, index) => index}
renderItem={({item, index}) => {
return (
<View style={{
paddingVertical: 15,
alignItems: 'flex-start',
}}>
<TouchableOpacity
style={[
styles.contentActionModalBottom,
{borderBottomColor: Color.borderColor, width: "100%"},
]}
key={item.id}
onPress={() => {
setMedicament(item);
setModalListMedicament(false);
}}>
<Text body2 semibold>
{`${item.name} | ${item.type}`}
</Text>
</TouchableOpacity>
</View>
)
}}/>
<Button
full
style={{marginTop: 10, marginBottom: 20}}
onPress={() => setModalListMedicament(false)}>
{I18n.t('OK')}
</Button>
</View>
</Modal>
</View>
</ScrollView>
)
2021-11-15 20:15:24 +00:00
const {
handleChange,
handleSubmit,
handleBlur,
values,
errors,
touched,
setFieldValue,
setFieldTouched,
isValid,
} = useFormik({
validationSchema: SaisirFeuilleSoinSchema,
initialValues: {
numero_assure: '',
password: '',
firstname_patient: '',
lastname_patient: '',
2021-11-29 11:30:04 +00:00
practitioner_firstname: '',
practitioner_lastname: '',
agrement_praticien: user?.code_membre,
accident_date: null,
pregnancy_start_at: null,
pregnancy_end_at: null,
2021-11-15 20:15:24 +00:00
},
onSubmit: values => {
2021-11-29 11:30:04 +00:00
if (prestations.length === 0) {
dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
I18n.t('YOU_MUST_ADD_AT_LEAST_ONE_PRESTATION'),
);
} else {
fetchCreateConsultation({
insured_id: assure.insured_id,
2022-01-04 11:42:58 +00:00
network_agent_id: wallet.network_agent_id,
2021-11-29 11:30:04 +00:00
password: values.password,
beneficiary_id: beneficiary !== null ? beneficiary.id : null,
practitioner_lastname: values.practitioner_lastname,
practitioner_firstname: values.practitioner_firstname,
practitioner_provider_class_id: values.practitioner_provider_class_id,
care_condition: values.care_condition,
accident_date: values.accident_date,
pregnancy_start_at: values.pregnancy_start_at,
pregnancy_end_at: values.pregnancy_end_at,
performances: prestations,
prescriptions: prescriptions,
exams: examens
})
}
2021-11-15 20:15:24 +00:00
},
});
const onNext = () => {
2021-11-22 18:20:54 +00:00
console.log("currentStep", currentStep);
2021-11-15 20:15:24 +00:00
switch (currentStep) {
2021-11-22 18:20:54 +00:00
case 0:
2022-01-20 03:51:20 +00:00
console.log("values", values);
2021-11-22 18:20:54 +00:00
if (values.numero_assure !== '') {
2022-01-20 03:51:20 +00:00
dispatch(fetchGetUserByNameOrNumberReset());
if (isNumeroAssureSearch)
fetchGetUserByNameOrNumber(wallet.id_network, `&insured_id=${values.numero_assure}`);
else if (isPhoneAssureSearch)
fetchGetUserByNameOrNumber(wallet.id_network, `&phone=${values.numero_assure}`);
else
fetchGetUserByNameOrNumber(wallet.id_network, `&name=${values.numero_assure}`)
console.log("errors", errors);
2021-11-22 18:20:54 +00:00
}
return false;
2021-11-15 20:15:24 +00:00
break;
default:
2021-11-22 18:20:54 +00:00
return true;
2021-11-15 20:15:24 +00:00
}
};
const stepList = [
{
title: I18n.t('ASSURE'),
content: (
<View>
<TextInput
style={{marginTop: 10}}
2022-01-20 03:51:20 +00:00
placeholder={isNumeroAssureSearch ? I18n.t('NUMERO_ASSURE') : isPhoneAssureSearch ? I18n.t('PHONE_NUMBER') : I18n.t('NOM_ASSURE')}
2021-11-15 20:15:24 +00:00
value={values.numero_assure}
2022-01-20 03:51:20 +00:00
keyboardType={isPhoneAssureSearch ? 'numeric' : 'default'}
2021-11-15 20:15:24 +00:00
onChangeText={handleChange('numero_assure')}
onBlur={handleBlur('numero_assure')}
success={touched.numero_assure && !errors.numero_assure}
touched={touched.numero_assure}
error={errors.numero_assure}
icon={
<FontAwesome
style={{zIndex: 10}}
2022-01-20 03:51:20 +00:00
name={isNumeroAssureSearch ? 'lock' : isPhoneAssureSearch ? 'phone' : 'user'}
2021-11-15 20:15:24 +00:00
size={20}
/>
}
/>
<View style={{
flexDirection: 'row',
position: 'absolute',
top: 22,
2022-01-20 03:51:20 +00:00
right: 50,
2021-11-15 20:15:24 +00:00
justifyContent: 'space-between',
width: 50
}}>
<Icon
style={{paddingRight: 5}}
2022-01-20 03:51:20 +00:00
name='lock'
size={20}
color={Color.primaryColor}
onPress={() => {
setIsNumeroAssureSearch(true);
setIsPhoneAssureSearch(false);
}}
/>
<Icon
style={{paddingRight: 5}}
name='phone'
size={20}
color={Color.primaryColor}
onPress={() => {
setIsNumeroAssureSearch(false);
setIsPhoneAssureSearch(true);
}}
/>
<Icon
style={{paddingRight: 5}}
name='user'
2021-11-15 20:15:24 +00:00
size={20}
color={Color.primaryColor}
onPress={() => {
2022-01-20 03:51:20 +00:00
setIsNumeroAssureSearch(false);
setIsPhoneAssureSearch(false);
2021-11-15 20:15:24 +00:00
}}
/>
<Icon
style={{paddingRight: 5}}
name="qrcode"
size={20}
color={Color.primaryColor}
onPress={() => {
2021-11-22 09:44:45 +00:00
setShowQRCodeScanner(true);
2021-11-15 20:15:24 +00:00
}}
/>
</View>
</View>
),
},
{
title: I18n.t('PATIENT'),
content: (
<View>
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('NOM_CLIENT')}
value={values.lastname_patient}
onChangeText={handleChange('lastname_patient')}
onBlur={handleBlur('lastname_patient')}
success={touched.lastname_patient && !errors.lastname_patient}
touched={touched.lastname_patient}
2021-11-29 11:30:04 +00:00
editable={false}
2021-11-15 20:15:24 +00:00
error={errors.lastname_patient}
/>
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('PRENOM_CLIENT')}
value={values.firstname_patient}
2021-11-29 11:30:04 +00:00
editable={false}
2021-11-15 20:15:24 +00:00
onChangeText={handleChange('firstname_patient')}
onBlur={handleBlur('firstname_patient')}
success={touched.firstname_patient && !errors.firstname_patient}
touched={touched.firstname_patient}
error={errors.firstname_patient}
/>
<View style={{
marginTop: 10,
flexDirection: 'row',
justifyContent: "space-between"
}}>
<Text body2>{I18n.t('SITUATION')}</Text>
<View style={{width: responsiveWidth(60)}}>
<SwitchSelector options={statutPatientOption}
2021-11-29 11:30:04 +00:00
disabled={true}
value={statutPatient}
initial={statutPatient}
2021-11-15 20:15:24 +00:00
buttonColor={Color.accentColor}
backgroundColor={Color.primaryDarkColor}
textColor='white'
bold={true}
hasPadding
height={32}
onPress={(value) => {
//setGender(value);
}}/>
</View>
</View>
</View>
),
},
{
title: I18n.t('PRATICIEN'),
content: (
<View>
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('CODE_AGREMENT')}
value={values.agrement_praticien}
2021-11-29 11:30:04 +00:00
editable={false}
2021-11-15 20:15:24 +00:00
/>
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('NOM_PRATICIEN')}
2021-11-29 11:30:04 +00:00
value={values.practitioner_lastname}
onChangeText={handleChange('practitioner_lastname')}
onBlur={handleBlur('practitioner_lastname')}
success={touched.practitioner_lastname && !errors.practitioner_lastname}
touched={touched.practitioner_lastname}
error={errors.practitioner_lastname}
2021-11-15 20:15:24 +00:00
/>
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('PRENOM_PRATICIEN')}
2021-11-29 11:30:04 +00:00
value={values.practitioner_firstname}
onChangeText={handleChange('practitioner_firstname')}
onBlur={handleBlur('practitioner_firstname')}
success={touched.practitioner_firstname && !errors.practitioner_firstname}
touched={touched.practitioner_firstname}
error={errors.practitioner_firstname}
2021-11-15 20:15:24 +00:00
/>
2021-11-11 11:43:33 +00:00
2021-11-15 20:15:24 +00:00
<Animatable.View ref={(comp) => {
classificationRef = comp
}}
style={{
width: responsiveWidth(90),
height: 60,
alignSelf: 'center',
borderRadius: 10,
paddingLeft: 20,
marginTop: 10,
paddingRight: 20,
backgroundColor: 'white'
}}>
<Dropdown
label={I18n.t('CLASSIFICATION')}
2021-11-29 11:30:04 +00:00
data={getProviderClass.result !== null ? getProviderClass.result?.response : []}
2021-11-15 20:15:24 +00:00
useNativeDriver={true}
onChangeText={(value, index, data) => {
2021-11-29 11:30:04 +00:00
setFieldTouched('practitioner_provider_class_id');
setFieldValue('practitioner_provider_class_id', value.id);
2021-11-15 20:15:24 +00:00
console.log("Value", value);
}}
valueExtractor={(value) => {
return value
}}
labelExtractor={(value) => {
return value.name
}}
/>
</Animatable.View>
<Animatable.View ref={(comp) => {
classificationRef = comp
}}
style={{
width: responsiveWidth(90),
height: 60,
alignSelf: 'center',
borderRadius: 10,
paddingLeft: 20,
marginTop: 10,
paddingRight: 20,
backgroundColor: 'white'
}}>
<Dropdown
label={I18n.t('CONDITION_PRISE_CHARGE')}
data={conditionPriseEnChange}
useNativeDriver={true}
onChangeText={(value, index, data) => {
console.log("Value", value);
2021-11-30 15:33:51 +00:00
setCareCondition(value);
2021-11-29 11:30:04 +00:00
setFieldTouched('care_condition');
setFieldValue('care_condition', value);
2021-11-15 20:15:24 +00:00
}}
valueExtractor={(value) => {
2021-11-29 11:30:04 +00:00
return value.value
2021-11-15 20:15:24 +00:00
}}
labelExtractor={(value) => {
return value.label
}}
/>
</Animatable.View>
<View style={{
marginTop: 10,
flexDirection: 'row',
justifyContent: "space-between"
}}>
<Text body2>{I18n.t('ACCIDENT')}</Text>
<View style={{width: responsiveWidth(40)}}>
<SwitchSelector options={accident}
initial={1}
buttonColor={Color.accentColor}
backgroundColor={Color.primaryDarkColor}
textColor='white'
bold={true}
hasPadding
height={32}
onPress={(value) => {
console.log(value);
setIsAccident(value === 'YES');
}}/>
</View>
</View>
{
isAccident && (
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('DATE_ACCIDENT')}
value={dateAccident !== null ? dateAccident : ''}
onChangeText={handleChange('date_accident')}
onBlur={handleBlur('date_accident')}
onFocus={() => {
Keyboard.dismiss();
//setDateAccident('' + moment(new Date()).format('YYYY-MM-DD'));
setShowDateAccidentPicker(true);
}}
success={touched.date_accident && !errors.date_accident}
touched={touched.date_accident}
error={errors.date_accident}
/>
)
}
<View style={{
marginTop: 10,
flexDirection: 'row',
justifyContent: "space-between"
}}>
<Text body2>{I18n.t('GROSSESSE')}</Text>
<View style={styles.contentSwitch}>
<SwitchSelector options={grossesse}
initial={1}
buttonColor={Color.accentColor}
backgroundColor={Color.primaryDarkColor}
textColor='white'
bold={true}
hasPadding
height={32}
onPress={(value) => {
setIsGrossesse(value === 'YES');
}}/>
</View>
</View>
{
isGrossesse && (
<>
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('DATE_DEBUT_GROSSESSE')}
value={dateDebutGrossesse !== null ? dateDebutGrossesse : ''}
onChangeText={handleChange('date_debut_grossesse')}
onBlur={handleBlur('date_debut_grossesse')}
onFocus={() => {
Keyboard.dismiss();
//setDateAccident('' + moment(new Date()).format('YYYY-MM-DD'));
setShowDateDebutGrossessePicker(true);
}}
success={touched.date_debut_grossesse && !errors.date_debut_grossesse}
touched={touched.date_debut_grossesse}
error={errors.date_debut_grossesse}
/>
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('DATE_FIN_GROSSESSE')}
value={dateFinGrossesse !== null ? dateFinGrossesse : ''}
onChangeText={handleChange('date_fin_grossesse')}
onBlur={handleBlur('date_fin_grossesse')}
onFocus={() => {
Keyboard.dismiss();
//setDateAccident('' + moment(new Date()).format('YYYY-MM-DD'));
setShowDateFinGrossessePicker(true);
}}
success={touched.date_fin_grossesse && !errors.date_fin_grossesse}
touched={touched.date_fin_grossesse}
error={errors.date_fin_grossesse}
/>
</>
)
}
2021-11-29 11:30:04 +00:00
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('PASSWORD')}
value={values.password}
onChangeText={handleChange('password')}
onBlur={handleBlur('password')}
success={touched.password && !errors.password}
touched={touched.password}
error={errors.password}
secureTextEntry
/>
2021-11-15 20:15:24 +00:00
<View
style={{
2021-11-29 11:30:04 +00:00
marginTop: 25,
}}>
<View style={{
flexDirection: 'row',
2021-11-15 20:15:24 +00:00
alignItems: 'center',
justifyContent: 'space-between',
}}>
2021-11-29 11:30:04 +00:00
<TouchableOpacity
style={[
styles.iconNavigationButton,
{
borderRadius: 5,
width: 100,
height: 30,
flexDirection: "row",
backgroundColor:
Color.primaryColor,
borderColor:
Color.primaryColor,
},
]}
onPress={e => {
2021-11-30 15:33:51 +00:00
dispatch(fetchGetAmountConsultationReset());
2021-12-07 05:25:01 +00:00
setIsVisiteDomicile(false);
2021-12-21 14:57:45 +00:00
if (careConditon === null) {
2021-11-30 15:33:51 +00:00
dropDownAlertRef.alertWithType(
'warn',
I18n.t('ERROR_LABEL'),
I18n.t('PLEASE_SELECT_CONDITON_PRISE_CHARGE_FIRST'),
);
} else setModalPrestation(true);
2021-11-29 11:30:04 +00:00
}}>
<Text whiteColor>{I18n.t('PRESTATION')}</Text>
<MaterialCommunityIcons
name="medical-bag"
size={20}
color={Color.whiteColor}
/>
</TouchableOpacity>
<TouchableOpacity
style={[
styles.iconNavigationButton,
{
borderRadius: 5,
width: 100,
height: 30,
flexDirection: "row",
backgroundColor:
Color.primaryColor,
borderColor:
Color.primaryColor,
},
]}
onPress={e => {
setModalExamen(true);
}}>
<Text whiteColor>{I18n.t('EXAMEN')}</Text>
<FontAwesome5
name="file-medical"
size={20}
color={Color.whiteColor}
/>
</TouchableOpacity>
<TouchableOpacity
style={[
styles.iconNavigationButton,
{
borderRadius: 5,
width: 110,
height: 30,
flexDirection: "row",
backgroundColor:
Color.primaryColor,
borderColor:
Color.primaryColor,
},
]}
onPress={e => {
setModalMedicament(true);
2021-12-21 14:57:45 +00:00
setMedicament(null);
2021-11-29 11:30:04 +00:00
}}>
<Text whiteColor>{I18n.t('MEDICAMENT')}</Text>
<Fontisto
name="drug-pack"
size={20}
color={Color.whiteColor}
/>
</TouchableOpacity>
</View>
2021-11-15 20:15:24 +00:00
</View>
</View>
),
},
];
return (
<ScreenComponent>
<DropdownAlert ref={ref => (dropDownAlertRef = ref)}/>
<KeyboardAvoidingView
behavior={Platform.OS === 'android' ? 'height' : 'padding'}
style={{flex: 1}}>
<ScrollView style={{flex: 1}}>
<View style={styles.contain}>
<StepHeader
steps={stepList}
currentStepIndex={currentStep + 1}
/>
<View
style={{
flexDirection: 'column',
alignItems: 'center',
}}>
<Wizard
ref={wizard}
activeStep={0}
steps={stepList}
useNativeDriver
nextStepAnimation="slideLeft"
prevStepAnimation="slideRight"
isFirstStep={val =>
setIsFirstStep(val)
}
isLastStep={val =>
setIsLastStep(val)
}
onNext={() => {
onNext();
}}
onPrev={() => {
}}
currentStep={({
currentStep,
isLastStep,
isFirstStep,
}) => {
setCurrentStep(currentStep);
setIsFirstStep(isFirstStep);
setIsLastStep(isLastStep);
}}
/>
</View>
<View style={styles.iconNavigation}>
{!isFirstStep ? (
<TouchableOpacity
style={[
styles.iconNavigationButton,
{
backgroundColor:
Color.primaryColor,
borderColor:
Color.primaryColor,
},
]}
onPress={() =>
wizard.current.prev()
}>
<Icon
name="arrow-left"
size={20}
color={Color.whiteColor}
/>
</TouchableOpacity>
) : (
<View/>
)}
2021-11-29 11:30:04 +00:00
{currentStep === 2 ? (
2021-11-15 20:15:24 +00:00
<Button
2021-11-29 11:30:04 +00:00
loading={createConsultation.loading}
onPress={handleSubmit}>
2021-11-15 20:15:24 +00:00
{I18n.t('SUBMIT_LABEL')}
</Button>
) : (
<TouchableOpacity
style={[
styles.iconNavigationButton,
{
backgroundColor:
Color.primaryColor,
borderColor:
Color.primaryColor,
},
]}
onPress={e => {
handleSubmit(e);
2021-11-22 18:20:54 +00:00
if (onNext())
wizard.current.next();
2021-11-15 20:15:24 +00:00
}}>
2021-11-22 18:20:54 +00:00
{(subscriptionList.loading || getUserByNameOrNumber.loading || getUserByIdQRCode.loading) ?
2021-11-15 20:15:24 +00:00
<ActivityIndicator
size="small"
2021-11-22 18:20:54 +00:00
color="#fff"
2021-11-15 20:15:24 +00:00
/>
: <Icon
name="arrow-right"
size={24}
color={Color.whiteColor}
/>}
</TouchableOpacity>
)}
</View>
{modalPrestation && renderAddNewPrestation()}
2021-11-29 11:30:04 +00:00
{modalMedicament && renderAddNewMedicament()}
{modalExamen && renderAddNewExamen()}
2021-11-15 20:15:24 +00:00
{showDatePrestation && renderDatePrestationPicker()}
{showDateAccidentPicker && renderDateAccidentPicker()}
{showDateDebutGrossessePicker && renderDateDebutGrossessePicker()}
{showDateFinGrossessePicker && renderDateFinGrossessePicker()}
2021-11-22 09:44:45 +00:00
{showQRCodeScanner && renderDialogQRCodeScanner()}
2021-11-22 18:20:54 +00:00
{modalListAssure && renderListAssure()}
2021-11-29 11:30:04 +00:00
{modalListMedicament && renderListMedicament()}
2021-11-30 15:33:51 +00:00
{modalAddMedicament && renderAddNewMedicamentToDB()}
2021-11-15 20:15:24 +00:00
</View>
2021-11-11 11:43:33 +00:00
</ScrollView>
</KeyboardAvoidingView>
</ScreenComponent>
);
};
const mapStateToProps = createStructuredSelector({
subscriptionList: selectSubscriptionList,
2021-11-22 18:20:54 +00:00
activatePaySubscription: selectActivatePaySubscription,
getUserByNameOrNumber: selectGetUserByNameOrNumber,
getUserByIdQRCode: selectGetUserByIdQRCode,
2021-11-29 11:30:04 +00:00
getDrugAppareil: selectGetDrugAppareil,
addDrug: selectAddDrug,
getProviderClass: selectGetProviderClass,
createConsultation: selectCreateConsultation,
2021-11-30 15:33:51 +00:00
getNetworkAct: selectGetNetworkAct,
getAmountConsultation: selectGetAmountConsultation
2021-11-11 11:43:33 +00:00
});
export default connect(mapStateToProps, {
fetchActivePaySubscription,
fetchGetSubscriptionList,
2021-11-22 18:20:54 +00:00
fetchGetUserByIdQRCode,
2021-11-29 11:30:04 +00:00
fetchGetUserByNameOrNumber,
fetchGetDrugAppareil,
fetchAddDrug,
fetchGetProviderClass,
fetchGetNetworkActs,
2021-11-30 15:33:51 +00:00
fetchCreateConsultation,
fetchGetAmountConsultation
2021-11-11 11:43:33 +00:00
})(
SaisirFeuilleSoinScreen,
);