From 449a0f0584306745cc96908c0b04f57c9dc8bdc1 Mon Sep 17 00:00:00 2001 From: Brice Zele Date: Mon, 17 Jan 2022 03:02:01 +0100 Subject: [PATCH] Modification execution --- App.js | 2 + route.json | 1 + screens/optionMenu/OptionsMenu.js | 2 +- .../agent/ExecuterPrescriptionScreen.js | 120 +- .../ModifierExecutionPrescriptionScreen.js | 1492 +++++++++++++++++ .../wallet/agent/ModifierFeuilleSoinScreen.js | 2 +- utils/UtilsFunction.js | 5 + utils/i18n/fr.json | 5 +- 8 files changed, 1566 insertions(+), 63 deletions(-) create mode 100644 screens/wallet/agent/ModifierExecutionPrescriptionScreen.js diff --git a/App.js b/App.js index 67349666..52afa7fc 100755 --- a/App.js +++ b/App.js @@ -91,6 +91,7 @@ import ValidateConsultationScreen from "./screens/wallet/user/ValidateConsultati import ValidateConsultationDetailScreen from "./screens/wallet/user/ValidateConsultationDetailScreen"; import ExecuterPrescriptionScreen from "./screens/wallet/agent/ExecuterPrescriptionScreen"; import ModifierFeuilleSoinScreen from "./screens/wallet/agent/ModifierFeuilleSoinScreen"; +import ModifierExecutionPrescriptionScreen from "./screens/wallet/agent/ModifierExecutionPrescriptionScreen"; const instructions = Platform.select({ @@ -259,6 +260,7 @@ const AppAgentStack = createDrawerNavigator({ creditrequest: HistoryRequester, saisirFeuilleSoinScreen: SaisirFeuilleSoinScreen, executerPrescriptionScreen: ExecuterPrescriptionScreen, + modifierExecutionPrescriptionScreen: ModifierExecutionPrescriptionScreen, modifierFeuilleSoinScreen: ModifierFeuilleSoinScreen, addNetwork: AddNetwork, updateinformation: UpdateInformations, diff --git a/route.json b/route.json index a3d57af5..72ef8125 100644 --- a/route.json +++ b/route.json @@ -71,4 +71,5 @@ "saisirFeuilleSoinScreen": "saisirFeuilleSoinScreen", "executerPrescriptionScreen": "executerPrescriptionScreen", "modifierFeuilleSoinScreen": "modifierFeuilleSoinScreen", + "modifierExecutionPrescriptionScreen": "modifierExecutionPrescriptionScreen", } diff --git a/screens/optionMenu/OptionsMenu.js b/screens/optionMenu/OptionsMenu.js index 659f35b7..8fcae83a 100755 --- a/screens/optionMenu/OptionsMenu.js +++ b/screens/optionMenu/OptionsMenu.js @@ -273,7 +273,7 @@ export default class OptionsMenu extends Component { || item === 'adhererGroupNanoCredit' || item === 'myNanoCreditGroup' || item === 'askNanoCredit' || item === 'refundNanoCreditUser' || item === 'cautionNanoCreditAgent' || item === 'epargnerArgentUser' || item === 'askNanoCredit' || item === 'casserEpargneUser' || item === 'envoieWalletToBankAgent' || item === 'reattachAccountUser' || item === 'insuranceSubscriptionScreen' || item === 'addBeneficiaryScreen' || item === 'activateBuySubscriptionScreen' || item === 'saisirFeuilleSoinScreen' || item === 'validateConsultationScreen' || item === 'validateConsultationDetailScreen' - || item === 'executerPrescriptionScreen' || item === 'modifierFeuilleSoinScreen') { + || item === 'executerPrescriptionScreen' || item === 'modifierFeuilleSoinScreen' || item === 'modifierExecutionPrescriptionScreen') { return null } else { const color = this.state.currentId === item.id ? theme.accent : "grey" diff --git a/screens/wallet/agent/ExecuterPrescriptionScreen.js b/screens/wallet/agent/ExecuterPrescriptionScreen.js index f5bff990..f2dbf5a7 100644 --- a/screens/wallet/agent/ExecuterPrescriptionScreen.js +++ b/screens/wallet/agent/ExecuterPrescriptionScreen.js @@ -648,67 +648,67 @@ const ExecuterPrescriptionScreen = ({ paddingVertical: 15, alignItems: 'flex-start', }}> - { - 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()); - fetchGetConsultation(item.user.id, 'TO_BILL', 'CONSULTATION'); - } - }}> - - {`${item.user.firstname} ${item.user.lastname}`} - - - {item.beneficiaries.map((beneficiary) => ( - { - setAssure(item); - setBeneficiary(beneficiary); - setStatutPatient(0); - setModalListAssure(false); - setFieldValue( - 'lastname_patient', - beneficiary.lastname, - ); - setFieldValue( - 'firstname_patient', - beneficiary.firstname, - ); - fetchGetConsultation(beneficiary.id, 'TO_BILL', 'CONSULTATION'); - - }}> - - - - {`${beneficiary.firstname} ${beneficiary.lastname} (${I18n.t('AYANT_DROITS')})`} + { + 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()); + fetchGetConsultation(item.user.id, 'TO_BILL', 'CONSULTATION'); + } + }}> + + {`${item.user.firstname} ${item.user.lastname}`} - - - ))} - + + {item.beneficiaries.map((beneficiary) => ( + { + setAssure(item); + setBeneficiary(beneficiary); + setStatutPatient(0); + setModalListAssure(false); + setFieldValue( + 'lastname_patient', + beneficiary.lastname, + ); + setFieldValue( + 'firstname_patient', + beneficiary.firstname, + ); + fetchGetConsultation(item.user.id, 'TO_BILL', 'CONSULTATION', `&beneficiary_id=${beneficiary.id}`); + + }}> + + + + {`${beneficiary.firstname} ${beneficiary.lastname} (${I18n.t('AYANT_DROITS')})`} + + + + ))} + ) }}/> diff --git a/screens/wallet/agent/ModifierExecutionPrescriptionScreen.js b/screens/wallet/agent/ModifierExecutionPrescriptionScreen.js new file mode 100644 index 00000000..4693b721 --- /dev/null +++ b/screens/wallet/agent/ModifierExecutionPrescriptionScreen.js @@ -0,0 +1,1492 @@ +/** + * Project iLinkWorld + * File ExecuterPrescriptionScreen + * Path screens/wallet/agent + * Created by BRICE ZELE + * Date: 11/11/2021 + */ +import React, {useEffect, useRef, useState} from 'react'; +import { + ActivityIndicator, + Alert, + Dimensions, + FlatList, + KeyboardAvoidingView, + Platform, + ScrollView, + StyleSheet, + TouchableOpacity, + View, +} from 'react-native'; +import {connect, useDispatch} from 'react-redux'; +import Dialog from "react-native-dialog"; +import {Formik, useFormik} from 'formik'; +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, + fetchCreateConsultation, + fetchCreateConsultationReset, + fetchExecutionPrescription, + fetchExecutionPrescriptionReset, + fetchGetAmountConsultation, + fetchGetConsultation, + fetchGetConsultationReset, + fetchGetProviderClass, + fetchGetProviderClassReset, + fetchGetSubscriptionListReset, + fetchGetUserByIdQRCode, + fetchGetUserByIdQRCodeReset, + fetchGetUserByNameOrNumber, + fetchGetUserByNameOrNumberReset, + fetchModifyPrescription, + fetchModifyPrescriptionReset +} from "../../../redux/insurance/insurance.actions"; +import DropdownAlert from "react-native-dropdownalert"; +import {readUser} from "../../../webservice/AuthApi"; +import TextInput from "../../../components/TextInput"; +import {createStructuredSelector} from "reselect"; +import { + selectActivatePaySubscription, + selectExecutionPrescription, + selectGetAmountConsultation, + selectGetConsultation, + selectGetProviderClass, + selectGetUserByIdQRCode, + selectGetUserByIdQRCodeReducer, + selectGetUserByNameOrNumber, + selectGetUserByNameOrNumberReducer, + selectModifyPrescription +} from "../../../redux/insurance/insurance.selector"; +import StepHeader from "../../../components/StepHeaderComponent"; +import Wizard from "react-native-wizard"; +import Icon from "react-native-vector-icons/FontAwesome5"; +import FontAwesome5 from "react-native-vector-icons/FontAwesome5"; +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"; +import {Dropdown} from "react-native-material-dropdown"; +import Modal from "react-native-modal"; +import QRCodeScanner from "react-native-qrcode-scanner"; +import {RNCamera} from "react-native-camera"; +import * as Utils from "../../../utils/UtilsFunction"; +import {displayToast, uppercaseFirstLetter} from "../../../utils/UtilsFunction"; +import {store} from "../../../redux/store"; +import Fontisto from "react-native-vector-icons/Fontisto"; +import {Typography} from "../../../config/typography"; + +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: 10, + marginBottom: 10, + 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, + }, + iconNavigation: { + width: '100%', + flexDirection: 'row', + marginTop: 20, + justifyContent: 'space-between', + alignItems: 'center', + }, + iconNavigationButton: { + borderWidth: 1, + borderRadius: 25, + width: 50, + height: 50, + alignItems: 'center', + justifyContent: 'center' + }, + beneficiarySubSection: { + marginTop: 10, + flexDirection: 'row', + width: '100%', + } +}); + +const ModifierExecutionPrescriptionScreen = ({ + subscriptionList, + fetchGetUserByIdQRCode, + fetchGetUserByNameOrNumber, + fetchGetProviderClass, + fetchGetConsultation, + fetchExecutionPrescription, + fetchModifyPrescription, + modifyPrescription, + getConsultation, + getUserByNameOrNumber, + getUserByIdQRCode, + getProviderClass, + createConsultation, + getAmountConsultation, + executionPrescription, + navigation + }) => { + + + const [showQRCodeScanner, setShowQRCodeScanner] = useState(false); + + const [wallet] = useState(store.getState().walletDetailReducer.result.response); + console.log("Wallet", wallet); + + const [isNumeroAssureSearch, setIsNumeroAssureSearch] = useState(true); + + const [user, setUser] = useState(null); + const [assure, setAssure] = useState(null); + const [beneficiary, setBeneficiary] = useState(null); + const [medicament, setMedicament] = useState(null); + const [elementToSetPrice, setElementToSetPrice] = useState(null); + + const wizard = useRef(); + const [isFirstStep, setIsFirstStep] = useState(true); + const [isLastStep, setIsLastStep] = useState(false); + const [currentStep, setCurrentStep] = useState(1); + + const [modalConsultation, setModalConsultation] = useState(false); + const [consultation, setConsultation] = useState(null); + + const [displayModalHistory, setDisplayModalHistory] = useState(false); + const [historyItemDetail, setHistoryItemDetail] = useState({}); + + const [modalExamen, setModalExamen] = useState(false); + const [modalPrice, setModalPrice] = useState(false); + const [modalListAssure, setModalListAssure] = useState(false); + const [modalListMedicament, setModalListMedicament] = useState(false); + + const [prestations, setPrestations] = useState([]); + + const [examens, setExamens] = useState([]); + + const [prescriptions, setPrescriptions] = useState([]); + + const [statutPatientOption] = useState([ + {label: I18n.t('AYANT_DROITS'), value: "M"}, + {label: I18n.t('ASSURE'), value: "F"}, + ]); + const [statutPatient, setStatutPatient] = useState(1); + + 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"}, + ]); + + const dispatch = useDispatch(); + let dropDownAlertRef: any = null; + let classificationRef = null; + let codeActeRef = null; + let onPrescriptionRef = null; + + console.log("Health sheet", consultation); + console.log("executionPrescription", executionPrescription); + + useEffect(() => { + readUser().then((user) => { + setFieldValue('agrement_praticien', user.code_membre); + console.log("User", user); + setUser(user) + }); + dispatch(fetchGetSubscriptionListReset()); + dispatch(fetchGetUserByNameOrNumberReset()); + dispatch(fetchGetUserByIdQRCodeReset()); + dispatch(fetchCreateConsultationReset()); + dispatch(fetchGetProviderClassReset()); + dispatch(fetchGetConsultationReset()); + dispatch(fetchExecutionPrescriptionReset()); + + fetchGetProviderClass(wallet.id_network); + }, []); + + useEffect(() => { + if (user !== null) { + console.log("user", user); + } + }, [user]); + + 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'), + ); + //dispatch(fetchGetUserByNameOrNumberReset()); + } + + } + + if (getUserByNameOrNumber.error) { + dropDownAlertRef.alertWithType( + 'error', + I18n.t('ERROR_LABEL'), + Utils.getErrorMsg(getUserByNameOrNumber), + ); + dispatch(fetchGetUserByNameOrNumberReset()); + } + }, [getUserByNameOrNumber]); + + + useEffect(() => { + if (getConsultation.result !== null) + setModalConsultation(true); + + if (getConsultation.error) { + dropDownAlertRef.alertWithType( + 'error', + I18n.t('ERROR_LABEL'), + Utils.getErrorMsg(getConsultation), + ); + dispatch(fetchGetConsultationReset()); + } + }, [getConsultation]); + + useEffect(() => { + if (modifyPrescription.result !== null) { + Alert.alert( + I18n.t("SUCCESS"), + modifyPrescription.result.response, + [ + { + text: I18n.t("OK"), onPress: () => { + dispatch(fetchModifyPrescriptionReset()); + navigation.goBack(); + } + } + + ], + {cancelable: false} + ) + } + + if (modifyPrescription.error) { + dropDownAlertRef.alertWithType( + 'error', + I18n.t('ERROR_LABEL'), + Utils.getErrorMsg(modifyPrescription), + ); + dispatch(fetchModifyPrescriptionReset()); + } + }, [modifyPrescription]); + + const ExecuterPrescriptionSchema = Yup.object().shape({ + numero_assure: Yup.string() + .required(I18n.t('THIS_FIELD_IS_REQUIRED')), + password: Yup.string() + .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')), + }); + + const PriceModal = Yup.object().shape({ + price: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED')), + }); + + const renderDialogQRCodeScanner = () => { + + return ( + + + {I18n.t('SCAN')} + + + + {I18n.t('BRING_YOUR_CAMERA_CLOSER_TO_SCAN_QR_CODE')} + + { + setShowQRCodeScanner(false); + console.log("result", result.data); + }} + flashMode={RNCamera.Constants.FlashMode.off} + /> + + + { + setShowQRCodeScanner(false); + }}/> + + ) + } + + + const renderPriceModal = () => ( + { + console.log("Value", elementToSetPrice); + if (elementToSetPrice.examen) { + setConsultation({ + ...consultation, + exams: consultation.exams.map(exam => { + return elementToSetPrice.id === exam.id ? { + ...exam, + unit_price: values.price + } : exam; + }) + }); + } else { + setConsultation({ + ...consultation, + prescriptions: consultation.prescriptions.map(exam => { + return elementToSetPrice.id === exam.id ? { + ...exam, + unit_price: values.price + } : exam; + }) + }); + } + + setModalPrice(false); + }}> + + {({ + values, + errors, + touched, + handleChange, + setFieldValue, + setFieldTouched, + handleBlur, + handleSubmit, + isSubmitting, + }) => ( + + + { + setModalPrice(false); + }} + swipeDirection={['down']} + style={styles.bottomModal}> + + + + + + {I18n.t('AMOUNT_LABEL')} + + + + + + + + + )} + + ); + + + const renderExamList = () => ( + + + { + setModalExamen(false); + }} + swipeDirection={['down']} + style={styles.bottomModal}> + + + + + + {I18n.t('EXAMEN')} + + index} + renderItem={({item, index}) => { + return ( + + { + setElementToSetPrice({ + ...item, + examen: true + }); + setConsultation({ + ...consultation, + exams: consultation.exams.map(exam => { + return item.id === exam.id ? { + ...exam, + checked: !item.checked + } : exam; + }) + }); + if (!item.checked) + setModalPrice(true); + + }}> + + {`${item.quantity} ${item.description} ${item.unit_price ? ' - ' + item.unit_price : ''} \n ${item.act.name}`} + + {item.checked && ( + + )} + + ) + }}/> + + + + + + + ); + + console.log("consultaiton", consultation); + + const renderListAssure = () => ( + + + { + setModalListAssure(false); + }} + swipeDirection={['down']} + style={styles.bottomModal}> + + + + + + {I18n.t('LIST_ASSURE')} + + {I18n.t('NO_ASSURE_MATCH_SEARCH')}} + keyExtractor={(item, index) => index} + renderItem={({item, index}) => { + return ( + + { + 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()); + fetchGetConsultation(item.user.id, 'UNTREATED', 'EXECUTION'); + } + }}> + + {`${item.user.firstname} ${item.user.lastname}`} + + + {item.beneficiaries.map((beneficiary) => ( + { + setAssure(item); + setBeneficiary(beneficiary); + setStatutPatient(0); + setModalListAssure(false); + setFieldValue( + 'lastname_patient', + beneficiary.lastname, + ); + setFieldValue( + 'firstname_patient', + beneficiary.firstname, + ); + fetchGetConsultation(item.user.id, 'TO_BILL', 'CONSULTATION', `&beneficiary_id=${beneficiary.id}`); + + }}> + + + + {`${beneficiary.firstname} ${beneficiary.lastname} (${I18n.t('AYANT_DROITS')})`} + + + + ))} + + ) + }}/> + + + + + + + + ); + + const renderListConsultation = () => ( + + + { + setModalConsultation(false); + }} + swipeDirection={['down']} + style={styles.bottomModal}> + + + + + + {I18n.t('LIST_EXECUTION')} + + {I18n.t('NO_EXECUTION')}} + keyExtractor={(item, index) => index} + renderItem={({item, index}) => { + return ( + + { + setHistoryItemDetail(item); + setDisplayModalHistory(true); + }}> + + {`${item.type} #${item.health_care_sheet_id} - ${moment(item.created_at).format('YYYY-MM-DD')}`} + + + ) + }}/> + + + + + + + + ); + + const renderModalHistoryDetail = () => ( + + + {I18n.t('DETAIL')} + + + + + + {I18n.t('PATIENT')} + + + {`${historyItemDetail.patient_lastname} ${historyItemDetail.patient_firstname}`} + + + + + Situation + + + {historyItemDetail.patient_situation.toLowerCase()} + + + + + {I18n.t('PRATICIEN')} + + + {`${historyItemDetail.practitioner_lastname} ${historyItemDetail.practitioner_firstname}`} + + + + + {I18n.t('CLASSE_PRESTATAIRE')} + + + {uppercaseFirstLetter(historyItemDetail.practitioner_provider_class.toLowerCase())} + + + + + {I18n.t('STATE')} + + + {uppercaseFirstLetter(historyItemDetail.state.toLowerCase())} + + + + + Type + + + {uppercaseFirstLetter(historyItemDetail.type.toLowerCase())} + + + + + {I18n.t('CONDITION_PRISE_CHARGE')} + + + {uppercaseFirstLetter(historyItemDetail.care_condition.toLowerCase())} + + + + + {I18n.t('INSTITUTE_NAME')} + + + {uppercaseFirstLetter(historyItemDetail.institution_name.toLowerCase())} + + + + + Date + + + {moment(historyItemDetail.created_at).format('YYYY-MM-DD')} + + + + + {I18n.t('PRESTATION')} + + + {historyItemDetail.performances.map(performance => ( + {`${performance.act.name} \n ${performance.amount} \n`} + ))} + + + + + {I18n.t('EXAMEN')} + + + {historyItemDetail.exams.map(exam => ( + {`${exam.description} \n ${exam.act.name} \n`} + ))} + + + + + {I18n.t('MEDICAMENT')} + + + {historyItemDetail.prescriptions.map(prescription => ( + {`${prescription.drug_or_device.name} \n ${prescription.dosage} \n`} + ))} + + + + + + + { + setDisplayModalHistory(false); + }}/> + + + { + setDisplayModalHistory(false); + setModalListAssure(false); + setModalConsultation(false); + setConsultation(historyItemDetail); + setFieldValue( + 'practitioner_firstname', + historyItemDetail.practitioner_firstname, + ); + setFieldValue( + 'practitioner_lastname', + historyItemDetail.practitioner_lastname, + ); + //dispatch(fetchGetUserByNameOrNumberReset()); + wizard.current.next(); + }}/> + + + ) + + + const renderListMedicament = () => ( + + + { + setModalListMedicament(false); + }} + swipeDirection={['down']} + style={styles.bottomModal}> + + + + + + {I18n.t('MEDICAMENTS')} + + index} + renderItem={({item, index}) => { + return ( + + { + setElementToSetPrice({ + ...item, + drugs: true + }); + setConsultation({ + ...consultation, + prescriptions: consultation.prescriptions.map(drug => { + return item.id === drug.id ? { + ...drug, + checked: !item.checked + } : drug; + }) + }); + if (!item.checked) + setModalPrice(true); + + }}> + + {`${item.quantity} ${item.drug_or_device.name} ${item.unit_price ? ' - ' + item.unit_price : ''} \n ${item.dosage}`} + + {item.checked && ( + + )} + + ) + }}/> + + + + + + + ) + + const { + handleChange, + handleSubmit, + handleBlur, + values, + errors, + touched, + setFieldValue, + setFieldTouched, + isValid, + } = useFormik({ + validationSchema: ExecuterPrescriptionSchema, + initialValues: { + numero_assure: '', + password: '', + firstname_patient: '', + lastname_patient: '', + practitioner_firstname: '', + practitioner_lastname: '', + agrement_praticien: user?.code_membre, + pregnancy_start_at: null, + pregnancy_end_at: null, + }, + onSubmit: values => { + fetchModifyPrescription(consultation.id, { + network_agent_id: wallet.network_agent_id, + password: values.password, + practitioner_lastname: values.practitioner_lastname, + practitioner_firstname: values.practitioner_firstname, + practitioner_provider_class_id: values.practitioner_provider_class_id, + performances: consultation.performances, + prescriptions: consultation.prescriptions, + }); + }, + }); + + const onNext = () => { + console.log("currentStep", currentStep); + console.log("values", values); + switch (currentStep) { + case 0: + if (values.numero_assure !== '') { + if (getUserByNameOrNumber.result === null) { + if (isNumeroAssureSearch) + fetchGetUserByNameOrNumber(wallet.id_network, `&phone=${values.numero_assure}`); + else + fetchGetUserByNameOrNumber(wallet.id_network, `&name=${values.numero_assure}`) + console.log("errors", errors); + } + } + return false; + break; + + default: + return true; + } + }; + + + const renderBtnExamen = () => ( + { + if (consultation.prescriptions.filter(exam => exam.checked).length > 0) + displayToast("Vous avez deja renseigner les médicaments"); + else + setModalExamen(true); + }}> + {I18n.t('EXAMEN')} + + + ); + + const renderBtnMedicament = () => ( + { + if (consultation.exams.filter(exam => exam.checked).length > 0) + displayToast("Vous avez deja renseigner les examens"); + else + setModalListMedicament(true); + }}> + {I18n.t('MEDICAMENT')} + + + ); + + + const stepList = [ + { + title: I18n.t('ASSURE'), + content: ( + + + } + /> + + { + setIsNumeroAssureSearch(!isNumeroAssureSearch); + }} + /> + { + setShowQRCodeScanner(true); + }} + /> + + + ), + }, + { + title: I18n.t('PATIENT'), + content: ( + + + + + + + {I18n.t('SITUATION')} + + { + //setGender(value); + }}/> + + + + ), + }, + { + title: I18n.t('PRATICIEN'), + content: ( + + + + + + + + { + classificationRef = comp + }} + style={{ + width: responsiveWidth(90), + height: 60, + alignSelf: 'center', + borderRadius: 10, + paddingLeft: 20, + marginTop: 10, + paddingRight: 20, + backgroundColor: 'white' + }}> + { + setFieldTouched('practitioner_provider_class_id'); + setFieldValue('practitioner_provider_class_id', value.id); + console.log("Value", value); + }} + valueExtractor={(value) => { + return value + }} + labelExtractor={(value) => { + return value.name + }} + /> + + + + + + + + {consultation !== null ? + !consultation.prescriptions.filter(exam => exam.checked).length > 0 ? + renderBtnExamen() : : null} + + {consultation !== null ? + !consultation.exams.filter(exam => exam.checked).length > 0 ? + renderBtnMedicament() : : null} + + + + + + ), + }, + ]; + + return ( + + (dropDownAlertRef = ref)}/> + + + + + + + + + + setIsFirstStep(val) + } + isLastStep={val => + setIsLastStep(val) + } + onNext={() => { + onNext(); + }} + onPrev={() => { + if (currentStep === 0) + dispatch(fetchGetUserByNameOrNumberReset()); + }} + currentStep={({ + currentStep, + isLastStep, + isFirstStep, + }) => { + setCurrentStep(currentStep); + setIsFirstStep(isFirstStep); + setIsLastStep(isLastStep); + }} + /> + + + + {!isFirstStep ? ( + + wizard.current.prev() + }> + + + ) : ( + + )} + {currentStep === 2 ? ( + + ) : ( + { + handleSubmit(e); + if (onNext()) + wizard.current.next(); + }}> + {(getUserByNameOrNumber.loading || getUserByIdQRCode.loading || getConsultation.loading) ? + + : } + + )} + + {modalExamen && renderExamList()} + {showQRCodeScanner && renderDialogQRCodeScanner()} + {modalListAssure && renderListAssure()} + {modalListMedicament && renderListMedicament()} + {modalConsultation && renderListConsultation()} + {displayModalHistory && renderModalHistoryDetail()} + {modalPrice && renderPriceModal()} + + + + + ); +}; + +const mapStateToProps = createStructuredSelector({ + activatePaySubscription: selectActivatePaySubscription, + getUserByNameOrNumber: selectGetUserByNameOrNumber, + getUserByIdQRCode: selectGetUserByIdQRCode, + getProviderClass: selectGetProviderClass, + getAmountConsultation: selectGetAmountConsultation, + executionPrescription: selectExecutionPrescription, + getConsultation: selectGetConsultation, + modifyPrescription: selectModifyPrescription + +}); + +export default connect(mapStateToProps, { + fetchActivePaySubscription, + fetchGetUserByIdQRCode, + fetchGetUserByNameOrNumber, + fetchGetProviderClass, + fetchCreateConsultation, + fetchGetAmountConsultation, + fetchGetConsultation, + fetchExecutionPrescription, + fetchModifyPrescription +})( + ModifierExecutionPrescriptionScreen, +); diff --git a/screens/wallet/agent/ModifierFeuilleSoinScreen.js b/screens/wallet/agent/ModifierFeuilleSoinScreen.js index c2fd5952..113cb02d 100644 --- a/screens/wallet/agent/ModifierFeuilleSoinScreen.js +++ b/screens/wallet/agent/ModifierFeuilleSoinScreen.js @@ -1988,7 +1988,7 @@ const ModifierFeuilleSoinScreen = ({ 'firstname_patient', beneficiary.firstname, ); - fetchGetConsultation(beneficiary.id, 'TO_BILL', 'CONSULTATION'); + fetchGetConsultation(item.user.id, 'TO_BILL', 'CONSULTATION', `&beneficiary_id=${beneficiary.id}`); }}> diff --git a/utils/UtilsFunction.js b/utils/UtilsFunction.js index 0e8084be..4ff77e55 100755 --- a/utils/UtilsFunction.js +++ b/utils/UtilsFunction.js @@ -629,6 +629,11 @@ export const optionNanoSanteAgentScreen = { screen: route.modifierFeuilleSoinScreen, icon: 'edit', title: 'MODIFY_CONSULTATION', + }, + { + screen: route.modifierExecutionPrescriptionScreen, + icon: 'edit', + title: 'MODIFY_EXECUTION', } ] } diff --git a/utils/i18n/fr.json b/utils/i18n/fr.json index 3150975d..5b8b06d0 100755 --- a/utils/i18n/fr.json +++ b/utils/i18n/fr.json @@ -691,5 +691,8 @@ "MODIFY_PRESTATION": "Modifier une prestation", "LIST_PRESTATION": "Liste des prestations", "NO_CONSULTATION": "Aucune consultation", - "LISTE_CONSULTATION": "Liste des consultations" +"NO_EXECUTION": "Aucune exécution", + "LISTE_CONSULTATION": "Liste des consultations", + "LIST_EXECUTION": "Liste des exécutions", + "MODIFY_EXECUTION": "Modifier une exécution" }