2021-12-16 14:28:24 +00:00
|
|
|
/**
|
|
|
|
* 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 {
|
2022-03-18 10:58:47 +00:00
|
|
|
fetchActivePaySubscription,
|
|
|
|
fetchCheckInsuranceCoverageAmount,
|
|
|
|
fetchCheckInsuranceCoverageAmountReset,
|
2021-12-16 14:28:24 +00:00
|
|
|
fetchCreateConsultation,
|
|
|
|
fetchCreateConsultationReset,
|
|
|
|
fetchExecutionPrescription,
|
|
|
|
fetchExecutionPrescriptionReset,
|
|
|
|
fetchGetAmountConsultation,
|
|
|
|
fetchGetConsultation,
|
|
|
|
fetchGetConsultationReset,
|
|
|
|
fetchGetProviderClass,
|
|
|
|
fetchGetProviderClassReset,
|
|
|
|
fetchGetSubscriptionListReset,
|
|
|
|
fetchGetUserByIdQRCode,
|
|
|
|
fetchGetUserByIdQRCodeReset,
|
|
|
|
fetchGetUserByNameOrNumber,
|
|
|
|
fetchGetUserByNameOrNumberReset
|
|
|
|
} 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 {
|
2022-03-18 10:58:47 +00:00
|
|
|
selectActivatePaySubscription,
|
|
|
|
selectCheckInsuranceCoverageAmount,
|
2021-12-16 14:28:24 +00:00
|
|
|
selectExecutionPrescription,
|
|
|
|
selectGetAmountConsultation,
|
|
|
|
selectGetConsultation,
|
|
|
|
selectGetProviderClass,
|
|
|
|
selectGetUserByIdQRCode,
|
|
|
|
selectGetUserByIdQRCodeReducer,
|
|
|
|
selectGetUserByNameOrNumber,
|
|
|
|
selectGetUserByNameOrNumberReducer
|
|
|
|
} 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";
|
2021-12-21 14:57:45 +00:00
|
|
|
import {displayToast, uppercaseFirstLetter} from "../../../utils/UtilsFunction";
|
2021-12-16 14:28:24 +00:00
|
|
|
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 ExecuterPrescriptionScreen = ({
|
|
|
|
subscriptionList,
|
|
|
|
fetchGetUserByIdQRCode,
|
|
|
|
fetchGetUserByNameOrNumber,
|
|
|
|
fetchGetProviderClass,
|
|
|
|
fetchGetConsultation,
|
|
|
|
fetchExecutionPrescription,
|
2022-02-28 09:41:54 +00:00
|
|
|
fetchCheckInsuranceCoverageAmount,
|
|
|
|
checkInsuranceCoverageAmount,
|
2021-12-16 14:28:24 +00:00
|
|
|
getConsultation,
|
|
|
|
getUserByNameOrNumber,
|
|
|
|
getUserByIdQRCode,
|
|
|
|
getProviderClass,
|
|
|
|
createConsultation,
|
|
|
|
getAmountConsultation,
|
|
|
|
executionPrescription,
|
|
|
|
navigation
|
|
|
|
}) => {
|
|
|
|
|
|
|
|
|
|
|
|
const [showQRCodeScanner, setShowQRCodeScanner] = useState(false);
|
|
|
|
|
|
|
|
const [wallet] = useState(store.getState().walletDetailReducer.result.response);
|
2022-01-04 11:42:58 +00:00
|
|
|
console.log("Wallet", wallet);
|
2021-12-16 14:28:24 +00:00
|
|
|
|
2022-01-20 03:51:20 +00:00
|
|
|
const [isNumeroAssureSearch, setIsNumeroAssureSearch] = useState(false);
|
|
|
|
const [isPhoneAssureSearch, setIsPhoneAssureSearch] = useState(false);
|
2021-12-16 14:28:24 +00:00
|
|
|
|
|
|
|
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);
|
2021-12-21 14:57:45 +00:00
|
|
|
const [consultation, setConsultation] = useState(null);
|
2022-02-28 09:41:54 +00:00
|
|
|
const [consultationClone, setConsultationClone] = useState(null);
|
|
|
|
|
2021-12-16 14:28:24 +00:00
|
|
|
|
|
|
|
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);
|
2022-03-18 10:58:47 +00:00
|
|
|
const [tmpSheetId, setTmpSheetId] = useState('' + Date.now());
|
2021-12-16 14:28:24 +00:00
|
|
|
|
|
|
|
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());
|
2022-02-28 09:41:54 +00:00
|
|
|
dispatch(fetchCheckInsuranceCoverageAmountReset());
|
2021-12-16 14:28:24 +00:00
|
|
|
|
|
|
|
fetchGetProviderClass(wallet.id_network);
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (user !== null) {
|
|
|
|
console.log("user", user);
|
|
|
|
}
|
|
|
|
}, [user]);
|
|
|
|
|
2022-03-18 10:58:47 +00:00
|
|
|
useEffect(() => {
|
|
|
|
console.log("getUserByNameOrNumber.result", getUserByIdQRCode);
|
|
|
|
if (getUserByIdQRCode.result !== null) {
|
|
|
|
setIsNumeroAssureSearch(false);
|
|
|
|
setIsPhoneAssureSearch(true);
|
|
|
|
setFieldValue('numero_assure', getUserByIdQRCode.result.response.phone);
|
|
|
|
fetchGetUserByNameOrNumber(wallet.id_network, `&phone=${getUserByIdQRCode.result.response.phone}`);
|
|
|
|
}
|
2022-02-28 09:41:54 +00:00
|
|
|
|
2022-03-18 10:58:47 +00:00
|
|
|
if (getUserByIdQRCode.error) {
|
|
|
|
Alert.alert(
|
|
|
|
I18n.t("ERROR_LABLE"),
|
|
|
|
Utils.getErrorMsg(getUserByIdQRCode),
|
|
|
|
[
|
|
|
|
{
|
|
|
|
text: I18n.t("OK"), onPress: () => {
|
|
|
|
dispatch(fetchGetUserByIdQRCodeReset());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
{cancelable: false}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}, [getUserByIdQRCode]);
|
2022-02-28 09:41:54 +00:00
|
|
|
|
2021-12-16 14:28:24 +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'),
|
|
|
|
);
|
|
|
|
//dispatch(fetchGetUserByNameOrNumberReset());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (getUserByNameOrNumber.error) {
|
2022-02-09 17:43:48 +00:00
|
|
|
Alert.alert(
|
|
|
|
I18n.t("ERROR_LABLE"),
|
|
|
|
Utils.getErrorMsg(getUserByNameOrNumber),
|
|
|
|
[
|
|
|
|
{
|
|
|
|
text: I18n.t("OK"), onPress: () => {
|
|
|
|
dispatch(fetchGetUserByNameOrNumberReset());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
2022-03-18 10:58:47 +00:00
|
|
|
{cancelable: false}
|
2021-12-16 14:28:24 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}, [getUserByNameOrNumber]);
|
|
|
|
|
2022-02-28 09:41:54 +00:00
|
|
|
useEffect(() => {
|
|
|
|
setModalPrice(false);
|
|
|
|
if (checkInsuranceCoverageAmount.result !== null) {
|
|
|
|
if (checkInsuranceCoverageAmount.result.response !== null) {
|
|
|
|
dispatch(fetchCheckInsuranceCoverageAmountReset());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (checkInsuranceCoverageAmount.error) {
|
|
|
|
Alert.alert(
|
|
|
|
I18n.t("INFORMATION_MESSAGE"),
|
|
|
|
Utils.getErrorMsg(checkInsuranceCoverageAmount),
|
|
|
|
[
|
|
|
|
{
|
|
|
|
text: I18n.t("OK"), onPress: () => {
|
2022-03-18 10:58:47 +00:00
|
|
|
if (elementToSetPrice.examen) {
|
2022-02-28 09:41:54 +00:00
|
|
|
setConsultation({
|
|
|
|
...consultation,
|
|
|
|
exams: consultation.exams.map(exam => {
|
|
|
|
return elementToSetPrice.id === exam.id ? {
|
|
|
|
...exam,
|
|
|
|
unit_price: consultationClone.exams.filter(examen => examen.id === elementToSetPrice.id)[0].unit_price
|
|
|
|
} : exam;
|
|
|
|
})
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
setConsultation({
|
|
|
|
...consultation,
|
|
|
|
prestations: consultation.prestations.map(presta => {
|
|
|
|
return elementToSetPrice.id === presta.id ? {
|
|
|
|
...presta,
|
|
|
|
unit_price: consultationClone.exams.filter(prestation => prestation.id === elementToSetPrice.id)[0].unit_price
|
|
|
|
} : presta;
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
dispatch(fetchCheckInsuranceCoverageAmountReset());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
2022-03-18 10:58:47 +00:00
|
|
|
{cancelable: false}
|
2022-02-28 09:41:54 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}, [checkInsuranceCoverageAmount]);
|
2021-12-16 14:28:24 +00:00
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (getConsultation.result !== null)
|
|
|
|
setModalConsultation(true);
|
|
|
|
|
|
|
|
if (getConsultation.error) {
|
2022-02-09 17:43:48 +00:00
|
|
|
Alert.alert(
|
|
|
|
I18n.t("ERROR_LABLE"),
|
|
|
|
Utils.getErrorMsg(getConsultation),
|
|
|
|
[
|
|
|
|
{
|
|
|
|
text: I18n.t("OK"), onPress: () => {
|
|
|
|
dispatch(fetchGetConsultationReset());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
2022-03-18 10:58:47 +00:00
|
|
|
{cancelable: false}
|
2021-12-16 14:28:24 +00:00
|
|
|
);
|
2022-03-18 10:58:47 +00:00
|
|
|
/* dropDownAlertRef.alertWithType(
|
|
|
|
'error',
|
|
|
|
I18n.t('ERROR_LABEL'),
|
|
|
|
Utils.getErrorMsg(getConsultation),
|
|
|
|
);
|
|
|
|
dispatch(fetchGetConsultationReset());*/
|
2021-12-16 14:28:24 +00:00
|
|
|
}
|
|
|
|
}, [getConsultation]);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (executionPrescription.result !== null) {
|
|
|
|
Alert.alert(
|
|
|
|
I18n.t("SUCCESS"),
|
|
|
|
executionPrescription.result.response,
|
|
|
|
[
|
|
|
|
{
|
|
|
|
text: I18n.t("OK"), onPress: () => {
|
|
|
|
dispatch(fetchExecutionPrescriptionReset());
|
|
|
|
navigation.goBack();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
],
|
|
|
|
{cancelable: false}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
if (executionPrescription.error) {
|
2022-02-09 17:43:48 +00:00
|
|
|
Alert.alert(
|
|
|
|
I18n.t("ERROR_LABLE"),
|
|
|
|
Utils.getErrorMsg(executionPrescription),
|
|
|
|
[
|
|
|
|
{
|
|
|
|
text: I18n.t("OK"), onPress: () => {
|
|
|
|
dispatch(fetchExecutionPrescriptionReset());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
2022-03-18 10:58:47 +00:00
|
|
|
{cancelable: false}
|
2021-12-16 14:28:24 +00:00
|
|
|
);
|
2022-03-18 10:58:47 +00:00
|
|
|
/* dropDownAlertRef.alertWithType(
|
|
|
|
'error',
|
|
|
|
I18n.t('ERROR_LABEL'),
|
|
|
|
Utils.getErrorMsg(executionPrescription),
|
|
|
|
);
|
|
|
|
dispatch(fetchExecutionPrescriptionReset());*/
|
2021-12-16 14:28:24 +00:00
|
|
|
}
|
|
|
|
}, [executionPrescription]);
|
|
|
|
|
|
|
|
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 (
|
|
|
|
<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);
|
2022-03-18 10:58:47 +00:00
|
|
|
fetchGetUserByIdQRCode(result.data);
|
2021-12-16 14:28:24 +00:00
|
|
|
}}
|
|
|
|
flashMode={RNCamera.Constants.FlashMode.off}
|
|
|
|
/>
|
|
|
|
</ScrollView>
|
|
|
|
|
|
|
|
<Dialog.Button bold={true} label={I18n.t('CLOSE')} onPress={() => {
|
|
|
|
setShowQRCodeScanner(false);
|
|
|
|
}}/>
|
|
|
|
</Dialog.Container>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const renderPriceModal = () => (
|
|
|
|
<Formik validationSchema={PriceModal}
|
|
|
|
initialValues={{
|
|
|
|
price: '',
|
|
|
|
}}
|
|
|
|
onSubmit={(values) => {
|
|
|
|
console.log("Value", elementToSetPrice);
|
|
|
|
if (elementToSetPrice.examen) {
|
2022-02-28 09:41:54 +00:00
|
|
|
|
2021-12-16 14:28:24 +00:00
|
|
|
setConsultation({
|
|
|
|
...consultation,
|
|
|
|
exams: consultation.exams.map(exam => {
|
|
|
|
return elementToSetPrice.id === exam.id ? {
|
|
|
|
...exam,
|
|
|
|
unit_price: values.price
|
2021-12-21 14:57:45 +00:00
|
|
|
} : exam;
|
2021-12-16 14:28:24 +00:00
|
|
|
})
|
|
|
|
});
|
2022-02-28 09:41:54 +00:00
|
|
|
fetchCheckInsuranceCoverageAmount({
|
|
|
|
insurance_id: assure.id,
|
|
|
|
beneficiary_id: beneficiary !== null ? beneficiary.id : null,
|
|
|
|
care_condition: consultation._care_condition,
|
|
|
|
act_action: "INSERT",
|
|
|
|
act_type: "EXAM",
|
|
|
|
exams: [
|
|
|
|
{
|
|
|
|
unit_price: values.price,
|
2022-03-18 10:58:47 +00:00
|
|
|
quantity: consultation.exams.filter(exam => elementToSetPrice.id === exam.id)[0].quantity
|
2022-02-28 09:41:54 +00:00
|
|
|
}
|
|
|
|
],
|
2022-03-18 10:58:47 +00:00
|
|
|
tmp_sheet_id: tmpSheetId,
|
2022-02-28 09:41:54 +00:00
|
|
|
});
|
2021-12-16 14:28:24 +00:00
|
|
|
} else {
|
|
|
|
setConsultation({
|
|
|
|
...consultation,
|
2022-02-28 09:41:54 +00:00
|
|
|
prescriptions: consultation.prescriptions.map(prescription => {
|
|
|
|
return elementToSetPrice.id === prescription.id ? {
|
|
|
|
...prescription,
|
2021-12-16 14:28:24 +00:00
|
|
|
unit_price: values.price
|
2022-02-28 09:41:54 +00:00
|
|
|
} : prescription;
|
2021-12-16 14:28:24 +00:00
|
|
|
})
|
|
|
|
});
|
2022-02-28 09:41:54 +00:00
|
|
|
fetchCheckInsuranceCoverageAmount({
|
|
|
|
insurance_id: assure.id,
|
|
|
|
beneficiary_id: beneficiary !== null ? beneficiary.id : null,
|
|
|
|
care_condition: consultation._care_condition,
|
|
|
|
act_action: "INSERT",
|
|
|
|
act_type: "PRESCRIPTION",
|
2022-03-18 10:58:47 +00:00
|
|
|
tmp_sheet_id: tmpSheetId,
|
2022-02-28 09:41:54 +00:00
|
|
|
prescriptions: [
|
|
|
|
{
|
|
|
|
unit_price: values.price,
|
2022-03-18 10:58:47 +00:00
|
|
|
quantity: consultation.prescriptions.filter(prescription => elementToSetPrice.id === prescription.id)[0].quantity
|
2022-02-28 09:41:54 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
});
|
2021-12-16 14:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}}>
|
|
|
|
|
|
|
|
{({
|
|
|
|
values,
|
|
|
|
errors,
|
|
|
|
touched,
|
|
|
|
handleChange,
|
|
|
|
setFieldValue,
|
|
|
|
setFieldTouched,
|
|
|
|
handleBlur,
|
|
|
|
handleSubmit,
|
|
|
|
isSubmitting,
|
|
|
|
}) => (
|
|
|
|
<ScrollView style={{flex: 1}}>
|
|
|
|
<View style={[styles.containModal, {backgroundColor: Color.containerBackgroundColor}]}>
|
|
|
|
<Modal
|
|
|
|
isVisible={modalPrice}
|
|
|
|
onSwipeComplete={() => {
|
|
|
|
setModalPrice(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('AMOUNT_LABEL')}</Text>
|
|
|
|
|
|
|
|
<TextInput
|
|
|
|
style={{marginTop: 10}}
|
|
|
|
placeholder={I18n.t('AMOUNT_LABEL_DESCRIPTION')}
|
|
|
|
value={values.price}
|
|
|
|
onChangeText={handleChange('price')}
|
|
|
|
onBlur={handleBlur('price')}
|
|
|
|
success={touched.price && !errors.price}
|
|
|
|
touched={touched.price}
|
|
|
|
error={errors.price}
|
|
|
|
keyboardType='numeric'
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Button
|
2022-02-28 09:41:54 +00:00
|
|
|
loading={checkInsuranceCoverageAmount.loading}
|
2021-12-16 14:28:24 +00:00
|
|
|
full
|
|
|
|
style={{marginTop: 10, marginBottom: 20}}
|
|
|
|
onPress={handleSubmit}>
|
|
|
|
{I18n.t('OK')}
|
|
|
|
</Button>
|
|
|
|
</View>
|
|
|
|
</Modal>
|
|
|
|
</View>
|
|
|
|
</ScrollView>
|
|
|
|
)}
|
|
|
|
</Formik>
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
const renderExamList = () => (
|
|
|
|
<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('EXAMEN')}</Text>
|
|
|
|
|
|
|
|
<FlatList data={consultation.exams}
|
|
|
|
extraData={consultation.exams}
|
|
|
|
keyExtractor={(item, index) => index}
|
|
|
|
renderItem={({item, index}) => {
|
|
|
|
return (
|
|
|
|
|
|
|
|
<TouchableOpacity
|
|
|
|
style={[
|
|
|
|
styles.contentActionModalBottom,
|
|
|
|
{borderBottomColor: Color.borderColor, width: "100%"},
|
|
|
|
]}
|
|
|
|
key={item.id}
|
|
|
|
onPress={() => {
|
|
|
|
setElementToSetPrice({
|
|
|
|
...item,
|
|
|
|
examen: true
|
|
|
|
});
|
|
|
|
setConsultation({
|
|
|
|
...consultation,
|
|
|
|
exams: consultation.exams.map(exam => {
|
|
|
|
return item.id === exam.id ? {
|
|
|
|
...exam,
|
|
|
|
checked: !item.checked
|
2021-12-21 14:57:45 +00:00
|
|
|
} : exam;
|
2021-12-16 14:28:24 +00:00
|
|
|
})
|
|
|
|
});
|
|
|
|
if (!item.checked)
|
|
|
|
setModalPrice(true);
|
|
|
|
|
|
|
|
}}>
|
|
|
|
<Text body2 semibold numberOfLines={2}>
|
|
|
|
{`${item.quantity} ${item.description} ${item.unit_price ? ' - ' + item.unit_price : ''} \n ${item.act.name}`}
|
|
|
|
</Text>
|
|
|
|
{item.checked && (
|
|
|
|
<Icon name="check" size={14} color={Color.primaryColor}/>
|
|
|
|
)}
|
|
|
|
</TouchableOpacity>
|
|
|
|
)
|
|
|
|
}}/>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
full
|
|
|
|
style={{marginTop: 10, marginBottom: 20}}
|
|
|
|
onPress={() => setModalExamen(false)}>
|
|
|
|
{I18n.t('OK')}
|
|
|
|
</Button>
|
|
|
|
</View>
|
|
|
|
</Modal>
|
|
|
|
</View>
|
|
|
|
</ScrollView>
|
|
|
|
);
|
|
|
|
|
2021-12-21 14:57:45 +00:00
|
|
|
console.log("consultaiton", consultation);
|
|
|
|
|
2021-12-16 14:28:24 +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}
|
2022-01-04 11:42:58 +00:00
|
|
|
ListEmptyComponent={<Text body2>{I18n.t('NO_ASSURE_MATCH_SEARCH')}</Text>}
|
2021-12-16 14:28:24 +00:00
|
|
|
keyExtractor={(item, index) => index}
|
|
|
|
renderItem={({item, index}) => {
|
|
|
|
return (
|
2022-01-04 11:42:58 +00:00
|
|
|
<View style={{
|
|
|
|
paddingVertical: 15,
|
|
|
|
alignItems: 'flex-start',
|
|
|
|
}}>
|
2022-01-17 02:02:01 +00:00
|
|
|
<TouchableOpacity
|
|
|
|
style={[
|
|
|
|
styles.contentActionModalBottom,
|
2022-03-18 10:58:47 +00:00
|
|
|
{
|
|
|
|
borderBottomColor: Color.borderColor,
|
|
|
|
width: "100%",
|
|
|
|
flexDirection: 'column',
|
|
|
|
},
|
2022-01-17 02:02:01 +00:00
|
|
|
]}
|
|
|
|
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());
|
|
|
|
fetchGetConsultation(item.user.id, 'TO_BILL', 'CONSULTATION');
|
|
|
|
}
|
|
|
|
}}>
|
|
|
|
<Text body2 semibold>
|
2022-02-09 17:43:48 +00:00
|
|
|
{`${item.user.firstname !== null ? item.user.firstname : ''} ${item.user.lastname !== null ? item.user.lastname : ''}`}
|
2022-01-04 11:42:58 +00:00
|
|
|
</Text>
|
2022-03-02 06:20:17 +00:00
|
|
|
<Text footnote>
|
|
|
|
{`${I18n.t('MONTANT_ASSURANCE_CONSOMME')}: ${item.insurance_consumed_amount}`}
|
|
|
|
</Text>
|
|
|
|
<Text footnote>
|
|
|
|
{`${I18n.t('MONTANT_ASSURANCE_RESTANTE')}: ${item.insurance_remaining_amount}`}
|
|
|
|
</Text>
|
2022-01-17 02:02:01 +00:00
|
|
|
</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,
|
|
|
|
);
|
|
|
|
fetchGetConsultation(item.user.id, 'TO_BILL', 'CONSULTATION', `&beneficiary_id=${beneficiary.id}`);
|
|
|
|
|
|
|
|
}}>
|
|
|
|
<View style={{width: 10}}/>
|
|
|
|
<View style={{paddingHorizontal: 10, alignItems: 'flex-start'}}>
|
2022-03-02 06:20:17 +00:00
|
|
|
<Text subhead semibold textAlign="left">
|
2022-02-09 17:43:48 +00:00
|
|
|
{`${beneficiary.firstname !== null ? beneficiary.firstname : ''} ${beneficiary.lastname !== null ? beneficiary.lastname : ''} (${I18n.t('AYANT_DROITS')})`}
|
2022-01-17 02:02:01 +00:00
|
|
|
</Text>
|
2022-03-02 06:20:17 +00:00
|
|
|
<Text footnote>
|
|
|
|
{`${I18n.t('MONTANT_ASSURANCE_CONSOMME')}: ${beneficiary.insurance_consumed_amount}`}
|
|
|
|
</Text>
|
|
|
|
<Text footnote>
|
2022-03-18 10:58:47 +00:00
|
|
|
{`${I18n.t('MONTANT_ASSURANCE_RESTANTE')}: ${beneficiary.insurance_remaining_amount}`}
|
2022-03-02 06:20:17 +00:00
|
|
|
</Text>
|
2022-01-17 02:02:01 +00:00
|
|
|
</View>
|
|
|
|
</TouchableOpacity>
|
|
|
|
))}
|
|
|
|
</View>
|
2021-12-16 14:28:24 +00:00
|
|
|
)
|
|
|
|
}}/>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
full
|
|
|
|
style={{marginTop: 10, marginBottom: 20}}
|
|
|
|
onPress={() => setModalListAssure(false)}>
|
|
|
|
{I18n.t('OK')}
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
</View>
|
|
|
|
</Modal>
|
|
|
|
</View>
|
|
|
|
</ScrollView>
|
|
|
|
);
|
|
|
|
|
|
|
|
const renderListConsultation = () => (
|
|
|
|
<ScrollView style={{flex: 1}}>
|
|
|
|
<View style={[styles.containModal, {backgroundColor: Color.containerBackgroundColor}]}>
|
|
|
|
<Modal
|
|
|
|
isVisible={modalConsultation}
|
|
|
|
onSwipeComplete={() => {
|
|
|
|
setModalConsultation(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_CONSULTATION')}</Text>
|
|
|
|
|
|
|
|
<FlatList data={getConsultation.result?.response}
|
|
|
|
extraData={getConsultation.result?.response}
|
2022-01-04 11:42:58 +00:00
|
|
|
ListEmptyComponent={<Text body2>{I18n.t('NO_CONSULTATION')}</Text>}
|
2021-12-16 14:28:24 +00:00
|
|
|
keyExtractor={(item, index) => index}
|
|
|
|
renderItem={({item, index}) => {
|
|
|
|
return (
|
|
|
|
|
|
|
|
<TouchableOpacity
|
|
|
|
style={[
|
|
|
|
styles.contentActionModalBottom,
|
|
|
|
{borderBottomColor: Color.borderColor, width: "100%"},
|
|
|
|
]}
|
|
|
|
key={item.id}
|
|
|
|
onPress={() => {
|
|
|
|
setHistoryItemDetail(item);
|
|
|
|
setDisplayModalHistory(true);
|
|
|
|
}}>
|
|
|
|
<Text body2 semibold>
|
|
|
|
{`${item.type} #${item.health_care_sheet_id} - ${moment(item.created_at).format('YYYY-MM-DD')}`}
|
|
|
|
</Text>
|
|
|
|
</TouchableOpacity>
|
|
|
|
)
|
|
|
|
}}/>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
full
|
|
|
|
style={{marginTop: 10, marginBottom: 20}}
|
|
|
|
onPress={() => setModalConsultation(false)}>
|
|
|
|
{I18n.t('OK')}
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
</View>
|
|
|
|
</Modal>
|
|
|
|
</View>
|
|
|
|
</ScrollView>
|
|
|
|
);
|
|
|
|
|
|
|
|
const renderModalHistoryDetail = () => (
|
|
|
|
<Dialog.Container useNativeDriver={true} visible={displayModalHistory}>
|
|
|
|
|
|
|
|
<Dialog.Title>{I18n.t('DETAIL')}</Dialog.Title>
|
|
|
|
|
|
|
|
<ScrollView persistentScrollbar={true}>
|
|
|
|
<View style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
|
|
|
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
|
|
|
<View style={{flex: 1}}>
|
|
|
|
<Text style={[styles.body2]}>{I18n.t('PATIENT')}</Text>
|
|
|
|
</View>
|
|
|
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
|
|
|
<Text
|
|
|
|
style={[Typography.caption1, Color.grayColor]}>{`${historyItemDetail.patient_lastname} ${historyItemDetail.patient_firstname}`}</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
|
|
|
<View style={{flex: 1}}>
|
|
|
|
<Text style={[styles.body2]}>Situation</Text>
|
|
|
|
</View>
|
|
|
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
|
|
|
<Text
|
|
|
|
style={[Typography.caption1, Color.grayColor]}>{historyItemDetail.patient_situation.toLowerCase()}</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
|
|
|
<View style={{flex: 1}}>
|
|
|
|
<Text style={[styles.body2]}>{I18n.t('PRATICIEN')}</Text>
|
|
|
|
</View>
|
|
|
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
|
|
|
<Text
|
|
|
|
style={[Typography.caption1, Color.grayColor]}>{`${historyItemDetail.practitioner_lastname} ${historyItemDetail.practitioner_firstname}`}</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
|
|
|
<View style={{flex: 1}}>
|
|
|
|
<Text style={[styles.body2]}>{I18n.t('CLASSE_PRESTATAIRE')}</Text>
|
|
|
|
</View>
|
|
|
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
|
|
|
<Text
|
|
|
|
style={[Typography.caption1, Color.grayColor]}>{uppercaseFirstLetter(historyItemDetail.practitioner_provider_class.toLowerCase())}</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
|
|
|
<View style={{flex: 1}}>
|
|
|
|
<Text style={[styles.body2]}>{I18n.t('STATE')}</Text>
|
|
|
|
</View>
|
|
|
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
|
|
|
<Text
|
|
|
|
style={[Typography.caption1, Color.grayColor]}>{uppercaseFirstLetter(historyItemDetail.state.toLowerCase())}</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
|
|
|
<View style={{flex: 1}}>
|
|
|
|
<Text style={[styles.body2]}>Type</Text>
|
|
|
|
</View>
|
|
|
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
|
|
|
<Text
|
|
|
|
style={[Typography.caption1, Color.grayColor]}>{uppercaseFirstLetter(historyItemDetail.type.toLowerCase())}</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
|
|
|
<View style={{flex: 1}}>
|
|
|
|
<Text style={[styles.body2]}>{I18n.t('CONDITION_PRISE_CHARGE')}</Text>
|
|
|
|
</View>
|
|
|
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
|
|
|
<Text
|
|
|
|
style={[Typography.caption1, Color.grayColor]}>{uppercaseFirstLetter(historyItemDetail.care_condition.toLowerCase())}</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
|
|
|
<View style={{flex: 1}}>
|
|
|
|
<Text style={[styles.body2]}>{I18n.t('INSTITUTE_NAME')}</Text>
|
|
|
|
</View>
|
|
|
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
|
|
|
<Text
|
|
|
|
style={[Typography.caption1, Color.grayColor]}>{uppercaseFirstLetter(historyItemDetail.institution_name.toLowerCase())}</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
|
|
|
<View style={{flex: 1}}>
|
|
|
|
<Text style={[styles.body2]}>Date</Text>
|
|
|
|
</View>
|
|
|
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
|
|
|
<Text
|
|
|
|
style={[Typography.caption1, Color.grayColor]}>{moment(historyItemDetail.created_at).format('YYYY-MM-DD')}</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
|
|
|
<View style={{flex: 1}}>
|
2022-01-04 11:42:58 +00:00
|
|
|
<Text style={[styles.body2]}>{I18n.t('PRESTATION')}</Text>
|
2021-12-16 14:28:24 +00:00
|
|
|
</View>
|
|
|
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
2022-01-04 11:42:58 +00:00
|
|
|
{historyItemDetail.performances.map(performance => (
|
2021-12-16 14:28:24 +00:00
|
|
|
<Text
|
2022-01-04 11:42:58 +00:00
|
|
|
style={[Typography.caption1, Color.grayColor]}>{`${performance.act.name} \n ${performance.amount} \n`}</Text>
|
2021-12-16 14:28:24 +00:00
|
|
|
))}
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
|
|
|
<View style={{flex: 1}}>
|
2022-01-04 11:42:58 +00:00
|
|
|
<Text style={[styles.body2]}>{I18n.t('EXAMEN')}</Text>
|
2021-12-16 14:28:24 +00:00
|
|
|
</View>
|
|
|
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
2022-01-04 11:42:58 +00:00
|
|
|
{historyItemDetail.exams.map(exam => (
|
2021-12-16 14:28:24 +00:00
|
|
|
<Text
|
2022-01-04 11:42:58 +00:00
|
|
|
style={[Typography.caption1, Color.grayColor]}>{`${exam.description} \n ${exam.act.name} \n`}</Text>
|
2021-12-16 14:28:24 +00:00
|
|
|
))}
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
|
|
|
<View style={{flex: 1}}>
|
2022-01-04 11:42:58 +00:00
|
|
|
<Text style={[styles.body2]}>{I18n.t('MEDICAMENT')}</Text>
|
2021-12-16 14:28:24 +00:00
|
|
|
</View>
|
|
|
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
2022-01-04 11:42:58 +00:00
|
|
|
{historyItemDetail.prescriptions.map(prescription => (
|
2021-12-16 14:28:24 +00:00
|
|
|
<Text
|
2022-01-04 11:42:58 +00:00
|
|
|
style={[Typography.caption1, Color.grayColor]}>{`${prescription.drug_or_device.name} \n ${prescription.dosage} \n`}</Text>
|
2021-12-16 14:28:24 +00:00
|
|
|
))}
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
|
|
|
|
</View>
|
|
|
|
</ScrollView>
|
|
|
|
|
|
|
|
<Dialog.Button bold={true} label={I18n.t('CANCEL_LABEL')} onPress={() => {
|
|
|
|
setDisplayModalHistory(false);
|
|
|
|
}}/>
|
|
|
|
|
|
|
|
|
|
|
|
<Dialog.Button bold={true} label={I18n.t('OK')} onPress={() => {
|
|
|
|
setDisplayModalHistory(false);
|
|
|
|
setModalListAssure(false);
|
|
|
|
setModalConsultation(false);
|
|
|
|
setConsultation(historyItemDetail);
|
2022-02-28 09:41:54 +00:00
|
|
|
setConsultationClone(historyItemDetail);
|
2021-12-16 14:28:24 +00:00
|
|
|
//dispatch(fetchGetUserByNameOrNumberReset());
|
|
|
|
wizard.current.next();
|
|
|
|
}}/>
|
|
|
|
|
|
|
|
</Dialog.Container>
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
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>
|
|
|
|
|
2022-01-04 11:42:58 +00:00
|
|
|
<Text body2 style={{marginTop: 10}}>{I18n.t('MEDICAMENTS')}</Text>
|
2021-12-16 14:28:24 +00:00
|
|
|
|
|
|
|
<FlatList data={consultation.prescriptions}
|
|
|
|
extraData={consultation.prescriptions}
|
|
|
|
keyExtractor={(item, index) => index}
|
|
|
|
renderItem={({item, index}) => {
|
|
|
|
return (
|
|
|
|
|
|
|
|
<TouchableOpacity
|
|
|
|
style={[
|
|
|
|
styles.contentActionModalBottom,
|
|
|
|
{borderBottomColor: Color.borderColor, width: "100%"},
|
|
|
|
]}
|
|
|
|
key={item.id}
|
|
|
|
onPress={() => {
|
|
|
|
setElementToSetPrice({
|
|
|
|
...item,
|
|
|
|
drugs: true
|
|
|
|
});
|
|
|
|
setConsultation({
|
|
|
|
...consultation,
|
|
|
|
prescriptions: consultation.prescriptions.map(drug => {
|
|
|
|
return item.id === drug.id ? {
|
|
|
|
...drug,
|
|
|
|
checked: !item.checked
|
2021-12-21 14:57:45 +00:00
|
|
|
} : drug;
|
2021-12-16 14:28:24 +00:00
|
|
|
})
|
|
|
|
});
|
|
|
|
if (!item.checked)
|
|
|
|
setModalPrice(true);
|
|
|
|
|
|
|
|
}}>
|
|
|
|
<Text body2 semibold numberOfLines={2}>
|
|
|
|
{`${item.quantity} ${item.drug_or_device.name} ${item.unit_price ? ' - ' + item.unit_price : ''} \n ${item.dosage}`}
|
|
|
|
</Text>
|
|
|
|
{item.checked && (
|
|
|
|
<Icon name="check" size={14} color={Color.primaryColor}/>
|
|
|
|
)}
|
|
|
|
</TouchableOpacity>
|
|
|
|
)
|
|
|
|
}}/>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
full
|
|
|
|
style={{marginTop: 10, marginBottom: 20}}
|
|
|
|
onPress={() => setModalListMedicament(false)}>
|
|
|
|
{I18n.t('OK')}
|
|
|
|
</Button>
|
|
|
|
</View>
|
|
|
|
</Modal>
|
|
|
|
</View>
|
|
|
|
</ScrollView>
|
|
|
|
)
|
|
|
|
|
|
|
|
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 => {
|
|
|
|
fetchExecutionPrescription({
|
|
|
|
health_care_sheet_id: consultation.id,
|
2022-01-04 11:42:58 +00:00
|
|
|
network_agent_id: wallet.network_agent_id,
|
2021-12-16 14:28:24 +00:00
|
|
|
password: values.password,
|
|
|
|
practitioner_lastname: values.practitioner_lastname,
|
|
|
|
practitioner_firstname: values.practitioner_firstname,
|
|
|
|
practitioner_provider_class_id: values.practitioner_provider_class_id,
|
|
|
|
prescriptions: consultation.prescriptions.filter(prescription => prescription.checked)
|
|
|
|
.map(prescription => {
|
|
|
|
return {id: prescription.id, unit_price: prescription.unit_price}
|
|
|
|
}),
|
|
|
|
exams: consultation.exams.filter(exam => exam.checked)
|
|
|
|
.map(exam => {
|
|
|
|
return {id: exam.id, unit_price: exam.unit_price}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const onNext = () => {
|
|
|
|
console.log("currentStep", currentStep);
|
|
|
|
switch (currentStep) {
|
|
|
|
case 0:
|
2022-01-20 03:51:20 +00:00
|
|
|
console.log("values", values);
|
2022-02-09 17:43:48 +00:00
|
|
|
dispatch(fetchGetUserByNameOrNumberReset());
|
2022-03-18 10:58:47 +00:00
|
|
|
if (values.numero_assure !== '' && getUserByNameOrNumber.result === null) {
|
2022-01-20 03:51:20 +00:00
|
|
|
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-12-16 14:28:24 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return true;
|
|
|
|
}
|
2022-03-18 10:58:47 +00:00
|
|
|
};
|
|
|
|
;
|
2021-12-16 14:28:24 +00:00
|
|
|
|
2021-12-21 14:57:45 +00:00
|
|
|
|
|
|
|
const renderBtnExamen = () => (
|
|
|
|
<TouchableOpacity
|
|
|
|
style={[
|
|
|
|
styles.iconNavigationButton,
|
|
|
|
{
|
|
|
|
borderRadius: 5,
|
|
|
|
width: 100,
|
|
|
|
height: 30,
|
|
|
|
flexDirection: "row",
|
|
|
|
backgroundColor:
|
|
|
|
Color.primaryColor,
|
|
|
|
borderColor:
|
|
|
|
Color.primaryColor,
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
onPress={e => {
|
|
|
|
if (consultation.prescriptions.filter(exam => exam.checked).length > 0)
|
|
|
|
displayToast("Vous avez deja renseigner les médicaments");
|
|
|
|
else
|
|
|
|
setModalExamen(true);
|
|
|
|
}}>
|
|
|
|
<Text whiteColor>{I18n.t('EXAMEN')}</Text>
|
|
|
|
<FontAwesome5
|
|
|
|
name="file-medical"
|
|
|
|
size={20}
|
|
|
|
color={Color.whiteColor}
|
|
|
|
/>
|
|
|
|
</TouchableOpacity>
|
|
|
|
);
|
|
|
|
|
|
|
|
const renderBtnMedicament = () => (
|
|
|
|
<TouchableOpacity
|
|
|
|
style={[
|
|
|
|
styles.iconNavigationButton,
|
|
|
|
{
|
|
|
|
borderRadius: 5,
|
|
|
|
width: 110,
|
|
|
|
height: 30,
|
|
|
|
flexDirection: "row",
|
|
|
|
backgroundColor:
|
|
|
|
Color.primaryColor,
|
|
|
|
borderColor:
|
|
|
|
Color.primaryColor,
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
onPress={e => {
|
|
|
|
if (consultation.exams.filter(exam => exam.checked).length > 0)
|
|
|
|
displayToast("Vous avez deja renseigner les examens");
|
|
|
|
else
|
|
|
|
setModalListMedicament(true);
|
|
|
|
}}>
|
|
|
|
<Text whiteColor>{I18n.t('MEDICAMENT')}</Text>
|
|
|
|
<Fontisto
|
|
|
|
name="drug-pack"
|
|
|
|
size={20}
|
|
|
|
color={Color.whiteColor}
|
|
|
|
/>
|
|
|
|
</TouchableOpacity>
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2021-12-16 14:28: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-12-16 14:28:24 +00:00
|
|
|
value={values.numero_assure}
|
2022-01-20 03:51:20 +00:00
|
|
|
keyboardType={isPhoneAssureSearch ? 'numeric' : 'default'}
|
2021-12-16 14:28: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-12-16 14:28:24 +00:00
|
|
|
size={20}
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
<View style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
position: 'absolute',
|
|
|
|
top: 22,
|
2022-01-20 03:51:20 +00:00
|
|
|
right: 50,
|
2021-12-16 14:28: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-12-16 14:28:24 +00:00
|
|
|
size={20}
|
|
|
|
color={Color.primaryColor}
|
|
|
|
onPress={() => {
|
2022-01-20 03:51:20 +00:00
|
|
|
setIsNumeroAssureSearch(false);
|
|
|
|
setIsPhoneAssureSearch(false);
|
2021-12-16 14:28:24 +00:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Icon
|
|
|
|
style={{paddingRight: 5}}
|
|
|
|
name="qrcode"
|
|
|
|
size={20}
|
|
|
|
color={Color.primaryColor}
|
|
|
|
onPress={() => {
|
|
|
|
setShowQRCodeScanner(true);
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</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}
|
|
|
|
editable={false}
|
|
|
|
error={errors.lastname_patient}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<TextInput
|
|
|
|
style={{marginTop: 10}}
|
|
|
|
placeholder={I18n.t('PRENOM_CLIENT')}
|
|
|
|
value={values.firstname_patient}
|
|
|
|
editable={false}
|
|
|
|
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}
|
|
|
|
disabled={true}
|
|
|
|
value={statutPatient}
|
|
|
|
initial={statutPatient}
|
|
|
|
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}
|
|
|
|
editable={false}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<TextInput
|
|
|
|
style={{marginTop: 10}}
|
|
|
|
placeholder={I18n.t('NOM_PRATICIEN')}
|
|
|
|
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}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<TextInput
|
|
|
|
style={{marginTop: 10}}
|
|
|
|
placeholder={I18n.t('PRENOM_PRATICIEN')}
|
|
|
|
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}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<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')}
|
|
|
|
data={getProviderClass.result !== null ? getProviderClass.result?.response : []}
|
|
|
|
useNativeDriver={true}
|
|
|
|
onChangeText={(value, index, data) => {
|
|
|
|
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
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</Animatable.View>
|
|
|
|
|
|
|
|
<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
|
|
|
|
/>
|
|
|
|
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
marginTop: 25,
|
|
|
|
}}>
|
|
|
|
<View style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
}}>
|
|
|
|
|
2021-12-21 14:57:45 +00:00
|
|
|
{consultation !== null ?
|
|
|
|
!consultation.prescriptions.filter(exam => exam.checked).length > 0 ?
|
|
|
|
renderBtnExamen() : <View/> : null}
|
2021-12-16 14:28:24 +00:00
|
|
|
|
2021-12-21 14:57:45 +00:00
|
|
|
{consultation !== null ?
|
|
|
|
!consultation.exams.filter(exam => exam.checked).length > 0 ?
|
|
|
|
renderBtnMedicament() : <View/> : null}
|
2021-12-16 14:28:24 +00:00
|
|
|
|
|
|
|
</View>
|
|
|
|
</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={() => {
|
|
|
|
if (currentStep === 0)
|
|
|
|
dispatch(fetchGetUserByNameOrNumberReset());
|
|
|
|
}}
|
|
|
|
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/>
|
|
|
|
)}
|
|
|
|
{currentStep === 2 ? (
|
|
|
|
<Button
|
|
|
|
loading={executionPrescription.loading}
|
|
|
|
onPress={handleSubmit}>
|
|
|
|
{I18n.t('SUBMIT_LABEL')}
|
|
|
|
</Button>
|
|
|
|
) : (
|
|
|
|
<TouchableOpacity
|
|
|
|
style={[
|
|
|
|
styles.iconNavigationButton,
|
|
|
|
{
|
|
|
|
backgroundColor:
|
|
|
|
Color.primaryColor,
|
|
|
|
borderColor:
|
|
|
|
Color.primaryColor,
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
onPress={e => {
|
|
|
|
handleSubmit(e);
|
|
|
|
if (onNext())
|
|
|
|
wizard.current.next();
|
|
|
|
}}>
|
|
|
|
{(getUserByNameOrNumber.loading || getUserByIdQRCode.loading || getConsultation.loading) ?
|
|
|
|
<ActivityIndicator
|
|
|
|
size="small"
|
|
|
|
color="#fff"
|
|
|
|
/>
|
|
|
|
: <Icon
|
|
|
|
name="arrow-right"
|
|
|
|
size={24}
|
|
|
|
color={Color.whiteColor}
|
|
|
|
/>}
|
|
|
|
</TouchableOpacity>
|
|
|
|
)}
|
|
|
|
</View>
|
|
|
|
{modalExamen && renderExamList()}
|
|
|
|
{showQRCodeScanner && renderDialogQRCodeScanner()}
|
|
|
|
{modalListAssure && renderListAssure()}
|
|
|
|
{modalListMedicament && renderListMedicament()}
|
|
|
|
{modalConsultation && renderListConsultation()}
|
|
|
|
{displayModalHistory && renderModalHistoryDetail()}
|
|
|
|
{modalPrice && renderPriceModal()}
|
|
|
|
</View>
|
|
|
|
</ScrollView>
|
|
|
|
</KeyboardAvoidingView>
|
|
|
|
</ScreenComponent>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const mapStateToProps = createStructuredSelector({
|
|
|
|
activatePaySubscription: selectActivatePaySubscription,
|
|
|
|
getUserByNameOrNumber: selectGetUserByNameOrNumber,
|
|
|
|
getUserByIdQRCode: selectGetUserByIdQRCode,
|
|
|
|
getProviderClass: selectGetProviderClass,
|
|
|
|
getAmountConsultation: selectGetAmountConsultation,
|
|
|
|
executionPrescription: selectExecutionPrescription,
|
|
|
|
getConsultation: selectGetConsultation,
|
2022-02-28 09:41:54 +00:00
|
|
|
checkInsuranceCoverageAmount: selectCheckInsuranceCoverageAmount
|
2021-12-16 14:28:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, {
|
|
|
|
fetchActivePaySubscription,
|
|
|
|
fetchGetUserByIdQRCode,
|
|
|
|
fetchGetUserByNameOrNumber,
|
|
|
|
fetchGetProviderClass,
|
|
|
|
fetchCreateConsultation,
|
|
|
|
fetchGetAmountConsultation,
|
|
|
|
fetchGetConsultation,
|
2022-02-28 09:41:54 +00:00
|
|
|
fetchExecutionPrescription,
|
|
|
|
fetchCheckInsuranceCoverageAmount
|
2021-12-16 14:28:24 +00:00
|
|
|
})(
|
|
|
|
ExecuterPrescriptionScreen,
|
|
|
|
);
|