Execution et modification d'execution OK

This commit is contained in:
Brice Zele 2022-04-13 11:30:36 +01:00
parent 1b0184cfec
commit bf4d8e60cc
7 changed files with 320 additions and 280 deletions

File diff suppressed because one or more lines are too long

View File

@ -737,5 +737,6 @@
"BY_NAME": "Par nom", "BY_NAME": "Par nom",
"BY_QR_CODE": "Par QR Code", "BY_QR_CODE": "Par QR Code",
"SCAN": "Scanner", "SCAN": "Scanner",
"BRING_YOUR_CAMERA_CLOSER_TO_SCAN_QR_CODE": "Approchez votre caméra du QR Code afin de le scanner" "BRING_YOUR_CAMERA_CLOSER_TO_SCAN_QR_CODE": "Approchez votre caméra du QR Code afin de le scanner",
"QUANTITY_CANNOT_BE_SUPERIOR": "La quantité ne doit pas être supérieure à"
} }

View File

@ -34,6 +34,7 @@ import Button from 'apsl-react-native-button'
import I18n from 'react-native-i18n' import I18n from 'react-native-i18n'
import {IlinkEmitter} from "./../../utils/events" import {IlinkEmitter} from "./../../utils/events"
import _ from 'lodash'; import _ from 'lodash';
import {RNCamera} from "react-native-camera";
import Configuration from "../../webservice/persistences/Configuration"; import Configuration from "../../webservice/persistences/Configuration";
import {MaterialDialog} from "react-native-material-dialog"; import {MaterialDialog} from "react-native-material-dialog";
@ -2005,20 +2006,19 @@ class Home extends BaseScreen {
} }
userChangeMarker(item) { userChangeMarker(item) {
const marker = this.state.markers[item]; console.log("Item", item);
if (this.mapRef !== null && this.mapRef !== undefined) { if (this.mapRef !== null && this.mapRef !== undefined) {
const reg = { const reg = {
latitude: parseFloat(marker.latitude), latitude: parseFloat(item.latitude),
longitude: parseFloat(marker.longitude), longitude: parseFloat(item.longitude),
latitudeDelta: 0.03, latitudeDelta: 0.03,
longitudeDelta: 0.01, longitudeDelta: 0.01,
} }
this.mapRef.animateToCoordinate({ this.mapRef.animateToCoordinate({
latitude: parseFloat(marker.latitude), latitude: parseFloat(item.latitude),
longitude: parseFloat(marker.longitude) longitude: parseFloat(item.longitude)
}, 1000) }, 1000)
this.mapRef.animateToRegion(reg, 1000) this.mapRef.animateToRegion(reg, 1000);
console.log(marker);
} }
} }

View File

@ -437,6 +437,7 @@ const ExecuterPrescriptionScreen = ({
prescriptions: consultation.prescriptions.map(presta => { prescriptions: consultation.prescriptions.map(presta => {
return elementToSetPrice.id === presta.id ? { return elementToSetPrice.id === presta.id ? {
...presta, ...presta,
quantity: consultationClone.exams.filter(prestation => prestation.id === elementToSetPrice.id)[0].quantity,
unit_price: consultationClone.exams.filter(prestation => prestation.id === elementToSetPrice.id)[0].unit_price unit_price: consultationClone.exams.filter(prestation => prestation.id === elementToSetPrice.id)[0].unit_price
} : presta; } : presta;
}) })
@ -572,7 +573,7 @@ const ExecuterPrescriptionScreen = ({
const renderPriceModal = () => ( const renderPriceModal = () => (
<Formik validationSchema={PriceModal} <Formik validationSchema={PriceModal}
initialValues={{ initialValues={{
examen_quantity: '', examen_quantity: elementToSetPrice !== null ? elementToSetPrice.drugs ? parseInt(elementToSetPrice.quantity) - parseInt(elementToSetPrice.billed_quantity !== null ? elementToSetPrice.billed_quantity : 0) : '' : '',
unit_quantity: '', unit_quantity: '',
unit_quantity_condition: elementToSetPrice !== null ? !elementToSetPrice.drugs ? elementToSetPrice.act.billing_type === 'UNIT_PRICE' : false : false, unit_quantity_condition: elementToSetPrice !== null ? !elementToSetPrice.drugs ? elementToSetPrice.act.billing_type === 'UNIT_PRICE' : false : false,
code_acte: '' + elementToSetPrice !== null ? !elementToSetPrice.drugs ? elementToSetPrice.act : '' : '', code_acte: '' + elementToSetPrice !== null ? !elementToSetPrice.drugs ? elementToSetPrice.act : '' : '',
@ -608,29 +609,39 @@ const ExecuterPrescriptionScreen = ({
tmp_sheet_id: tmpSheetId, tmp_sheet_id: tmpSheetId,
}); });
} else { } else {
setConsultation({ let quantityValue = historyItemDetail.prescriptions.filter(prescription => prescription.id = elementToSetPrice.id)[0].quantity;
...consultation, if (parseInt(values.examen_quantity) > parseInt(quantityValue - parseInt(elementToSetPrice.billed_quantity !== null ? elementToSetPrice.billed_quantity : 0))) {
prescriptions: consultation.prescriptions.map(prescription => { Alert.alert(I18n.t('ERROR_LABEL'), I18n.t('QUANTITY_CANNOT_BE_SUPERIOR') + " " + quantityValue,
return elementToSetPrice.id === prescription.id ? { [{
...prescription, text: I18n.t('OK'), onPress: () => {
unit_price: values.price }
} : prescription; }]);
}) } else {
}); setConsultation({
fetchCheckInsuranceCoverageAmount({ ...consultation,
insurance_id: assure.id, prescriptions: consultation.prescriptions.map(prescription => {
beneficiary_id: beneficiary !== null ? beneficiary.id : null, return elementToSetPrice.id === prescription.id ? {
care_condition: consultation._care_condition, ...prescription,
act_action: "INSERT", unit_price: values.price,
act_type: "PRESCRIPTION", quantity: values.examen_quantity,
tmp_sheet_id: tmpSheetId, } : prescription;
prescriptions: [ })
{ });
unit_price: values.price, fetchCheckInsuranceCoverageAmount({
quantity: consultation.prescriptions.filter(prescription => elementToSetPrice.id === prescription.id)[0].quantity insurance_id: assure.id,
} beneficiary_id: beneficiary !== null ? beneficiary.id : null,
], care_condition: consultation._care_condition,
}); act_action: "INSERT",
act_type: "PRESCRIPTION",
tmp_sheet_id: tmpSheetId,
prescriptions: [
{
unit_price: values.price,
quantity: values.examen_quantity
}
],
});
}
} }
}}> }}>
@ -743,7 +754,20 @@ const ExecuterPrescriptionScreen = ({
</> : </> :
<> <>
<Text body2 style={{marginTop: 10}}>{I18n.t('AMOUNT_LABEL')}</Text> <Text body2 style={{marginTop: 10}}>{I18n.t('EXECUTION')}</Text>
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('QUANTITE')}
value={'' + values.examen_quantity}
onChangeText={handleChange('examen_quantity')}
onBlur={handleBlur('examen_quantity')}
success={touched.examen_quantity && !errors.examen_quantity}
touched={touched.examen_quantity}
error={errors.examen_quantity}
keyboardType='numeric'
/>
<TextInput <TextInput
style={{marginTop: 10}} style={{marginTop: 10}}
@ -1242,6 +1266,7 @@ const ExecuterPrescriptionScreen = ({
onPress={() => { onPress={() => {
setElementToSetPrice({ setElementToSetPrice({
...item, ...item,
quantity_original: item.quantity,
drugs: true drugs: true
}); });
setConsultation({ setConsultation({
@ -1312,7 +1337,11 @@ const ExecuterPrescriptionScreen = ({
practitioner_provider_class_id: values.practitioner_provider_class_id, practitioner_provider_class_id: values.practitioner_provider_class_id,
prescriptions: consultation.prescriptions.filter(prescription => prescription.checked) prescriptions: consultation.prescriptions.filter(prescription => prescription.checked)
.map(prescription => { .map(prescription => {
return {id: prescription.id, unit_price: prescription.unit_price} return {
id: prescription.id,
unit_price: prescription.unit_price,
quantity: prescription.quantity
}
}), }),
exams: consultation.exams.filter(exam => exam.checked) exams: consultation.exams.filter(exam => exam.checked)
.map(exam => { .map(exam => {

View File

@ -513,6 +513,7 @@ const ModifierExecutionPrescriptionScreen = ({
prestations: consultation.prestations.map(presta => { prestations: consultation.prestations.map(presta => {
return elementToSetPrice.id === presta.id ? { return elementToSetPrice.id === presta.id ? {
...presta, ...presta,
quantity: consultationClone.exams.filter(prestation => prestation.id === elementToSetPrice.id)[0].quantity,
unit_price: consultationClone.exams.filter(prestation => prestation.id === elementToSetPrice.id)[0].unit_price unit_price: consultationClone.exams.filter(prestation => prestation.id === elementToSetPrice.id)[0].unit_price
} : presta; } : presta;
}) })
@ -582,10 +583,10 @@ const ModifierExecutionPrescriptionScreen = ({
const renderPriceModal = () => ( const renderPriceModal = () => (
<Formik validationSchema={PriceModal} <Formik validationSchema={PriceModal}
initialValues={{ initialValues={{
examen_quantity: elementToSetPrice !== null ? elementToSetPrice.drugs ? parseInt(elementToSetPrice.quantity) - parseInt(elementToSetPrice.billed_quantity !== null ? elementToSetPrice.billed_quantity : 0) : '' : '',
price: elementToSetPrice.unit_price, price: elementToSetPrice.unit_price,
examen_quantity: elementToSetPrice.quantity,
unit_quantity: elementToSetPrice.unit_quantity !== null ? elementToSetPrice.unit_quantity : '', unit_quantity: elementToSetPrice.unit_quantity !== null ? elementToSetPrice.unit_quantity : '',
unit_quantity_condition: elementToSetPrice !== null ? elementToSetPrice.act.billing_type === 'UNIT_PRICE' : false, unit_quantity_condition: elementToSetPrice !== null ? elementToSetPrice.hasOwnProperty('act') ? elementToSetPrice.act.billing_type === "UNIT_PRICE" : false : false,
code_acte: '' + elementToSetPrice !== null ? !elementToSetPrice.drugs ? elementToSetPrice.act : '' : '', code_acte: '' + elementToSetPrice !== null ? !elementToSetPrice.drugs ? elementToSetPrice.act : '' : '',
}} }}
onSubmit={(values) => { onSubmit={(values) => {
@ -618,30 +619,40 @@ const ModifierExecutionPrescriptionScreen = ({
tmp_sheet_id: tmpSheetId, tmp_sheet_id: tmpSheetId,
}); });
} else { } else {
setConsultation({ let quantityValue = historyItemDetail.prescriptions.filter(prescription => prescription.id = elementToSetPrice.id)[0].quantity;
...consultation, if (parseInt(values.examen_quantity) > parseInt(quantityValue - parseInt(elementToSetPrice.billed_quantity !== null ? elementToSetPrice.billed_quantity : 0))) {
prescriptions: consultation.prescriptions.map(exam => { Alert.alert(I18n.t('ERROR_LABEL'), I18n.t('QUANTITY_CANNOT_BE_SUPERIOR') + " " + quantityValue,
return elementToSetPrice.id === exam.id ? { [{
...exam, text: I18n.t('OK'), onPress: () => {
unit_price: values.price }
} : exam; }]);
}) } else {
}); setConsultation({
fetchCheckInsuranceCoverageAmount({ ...consultation,
insurance_id: assure.id, prescriptions: consultation.prescriptions.map(exam => {
beneficiary_id: beneficiary !== null ? beneficiary.id : null, return elementToSetPrice.id === exam.id ? {
care_condition: consultation._care_condition, ...exam,
act_id: consultation.prescriptions.filter(prescription => elementToSetPrice.id === prescription.id)[0].act_id, unit_price: values.price,
act_action: "UPDATE", quantity: values.examen_quantity,
act_type: "PRESCRIPTION", } : exam;
prescriptions: [ })
{ });
unit_price: values.price, fetchCheckInsuranceCoverageAmount({
quantity: values.examen_quantity insurance_id: assure.id,
} beneficiary_id: beneficiary !== null ? beneficiary.id : null,
], care_condition: consultation._care_condition,
tmp_sheet_id: tmpSheetId, act_id: elementToSetPrice.id,
}); act_action: "UPDATE",
act_type: "PRESCRIPTION",
prescriptions: [
{
unit_price: values.price,
quantity: values.examen_quantity
}
],
tmp_sheet_id: tmpSheetId,
});
}
} }
}}> }}>
@ -740,7 +751,7 @@ const ModifierExecutionPrescriptionScreen = ({
</View> : </View> :
<TextInput <TextInput
style={{marginTop: 10}} style={{marginTop: 10}}
editable={elementToSetPrice.act.billing_type === "FREE"} editable={elementToSetPrice.hasOwnProperty('act') ? elementToSetPrice.act.billing_type === "FREE" : true}
placeholder={I18n.t('AMOUNT_LABEL_DESCRIPTION')} placeholder={I18n.t('AMOUNT_LABEL_DESCRIPTION')}
value={values.price} value={values.price}
onChangeText={handleChange('price')} onChangeText={handleChange('price')}
@ -754,8 +765,20 @@ const ModifierExecutionPrescriptionScreen = ({
</> : </> :
<> <>
<Text body2 style={{marginTop: 10}}>{I18n.t('AMOUNT_LABEL')}</Text> <Text body2 style={{marginTop: 10}}>{I18n.t('EXECUTION')}</Text>
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('QUANTITE')}
value={'' + values.examen_quantity}
onChangeText={handleChange('examen_quantity')}
onBlur={handleBlur('examen_quantity')}
success={touched.examen_quantity && !errors.examen_quantity}
touched={touched.examen_quantity}
error={errors.examen_quantity}
keyboardType='numeric'
/>
<TextInput <TextInput
style={{marginTop: 10}} style={{marginTop: 10}}

View File

@ -350,52 +350,38 @@ const DemandeAutorisationSoinScreen = ({
]} ]}
key={item.id} key={item.id}
onPress={() => { onPress={() => {
setAssure(item);
setBeneficiary(null);
setStatutPatient(1);
setModalListAssure(false);
setFieldValue(
'lastname_patient',
item.user.lastname,
);
setFieldValue(
'firstname_patient',
item.user.firstname,
);
fetchGetNetworkActs(wallet.id_network, '', `&user_id=${item.user.id}`);
dispatch(fetchGetUserByNameOrNumberReset());
wizard.current.next();
fetchGetListInsuranceWithBeneficiaries(`?user_id=${item.user.id}`);
/* if (item.state === 'SUSPENDED') {
Alert.alert(I18n.t('ERROR_LABEL'), I18n.t('ASSURE_SUSPENDU'), if (item.state === 'SUSPENDED') {
[{ Alert.alert(I18n.t('ERROR_LABEL'), I18n.t('ASSURE_SUSPENDU'),
text: I18n.t('OK'), onPress: () => { [{
} text: I18n.t('OK'), onPress: () => {
}]); }
} else if (item.state !== 'PAID') { }]);
Alert.alert(I18n.t('ERROR_LABEL'), I18n.t('ASSURE_NON_EN_REGLE'), } else if (item.state !== 'PAID') {
[{ Alert.alert(I18n.t('ERROR_LABEL'), I18n.t('ASSURE_NON_EN_REGLE'),
text: I18n.t('OK'), onPress: () => { [{
} text: I18n.t('OK'), onPress: () => {
}]); }
} else { }]);
setAssure(item); } else {
setBeneficiary(null); setAssure(item);
setStatutPatient(1); setBeneficiary(null);
setModalListAssure(false); setStatutPatient(1);
setFieldValue( setModalListAssure(false);
'lastname_patient', setFieldValue(
item.user.lastname, 'lastname_patient',
); item.user.lastname,
setFieldValue( );
'firstname_patient', setFieldValue(
item.user.firstname, 'firstname_patient',
); item.user.firstname,
fetchGetNetworkActs(wallet.id_network, '', `&user_id=${item.user.id}`); );
dispatch(fetchGetUserByNameOrNumberReset()); fetchGetNetworkActs(wallet.id_network, '', `&user_id=${item.user.id}`);
wizard.current.next(); dispatch(fetchGetUserByNameOrNumberReset());
}*/ wizard.current.next();
fetchGetListInsuranceWithBeneficiaries(`?user_id=${item.user.id}`);
}
}}> }}>
<Text body2 semibold> <Text body2 semibold>
{`${item.user.firstname !== null ? item.user.firstname : ''} ${item.user.lastname !== null ? item.user.lastname : ''}`} {`${item.user.firstname !== null ? item.user.firstname : ''} ${item.user.lastname !== null ? item.user.lastname : ''}`}

View File

@ -737,5 +737,6 @@
"BY_NAME": "Par nom", "BY_NAME": "Par nom",
"BY_QR_CODE": "Par QR Code", "BY_QR_CODE": "Par QR Code",
"SCAN": "Scanner", "SCAN": "Scanner",
"BRING_YOUR_CAMERA_CLOSER_TO_SCAN_QR_CODE": "Approchez votre caméra du QR Code afin de le scanner" "BRING_YOUR_CAMERA_CLOSER_TO_SCAN_QR_CODE": "Approchez votre caméra du QR Code afin de le scanner",
"QUANTITY_CANNOT_BE_SUPERIOR": "La quantité ne doit pas être supérieure à"
} }