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

View File

@ -437,6 +437,7 @@ const ExecuterPrescriptionScreen = ({
prescriptions: consultation.prescriptions.map(presta => {
return elementToSetPrice.id === presta.id ? {
...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
} : presta;
})
@ -572,7 +573,7 @@ const ExecuterPrescriptionScreen = ({
const renderPriceModal = () => (
<Formik validationSchema={PriceModal}
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_condition: elementToSetPrice !== null ? !elementToSetPrice.drugs ? elementToSetPrice.act.billing_type === 'UNIT_PRICE' : false : false,
code_acte: '' + elementToSetPrice !== null ? !elementToSetPrice.drugs ? elementToSetPrice.act : '' : '',
@ -608,29 +609,39 @@ const ExecuterPrescriptionScreen = ({
tmp_sheet_id: tmpSheetId,
});
} else {
setConsultation({
...consultation,
prescriptions: consultation.prescriptions.map(prescription => {
return elementToSetPrice.id === prescription.id ? {
...prescription,
unit_price: values.price
} : prescription;
})
});
fetchCheckInsuranceCoverageAmount({
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: consultation.prescriptions.filter(prescription => elementToSetPrice.id === prescription.id)[0].quantity
}
],
});
let quantityValue = historyItemDetail.prescriptions.filter(prescription => prescription.id = elementToSetPrice.id)[0].quantity;
if (parseInt(values.examen_quantity) > parseInt(quantityValue - parseInt(elementToSetPrice.billed_quantity !== null ? elementToSetPrice.billed_quantity : 0))) {
Alert.alert(I18n.t('ERROR_LABEL'), I18n.t('QUANTITY_CANNOT_BE_SUPERIOR') + " " + quantityValue,
[{
text: I18n.t('OK'), onPress: () => {
}
}]);
} else {
setConsultation({
...consultation,
prescriptions: consultation.prescriptions.map(prescription => {
return elementToSetPrice.id === prescription.id ? {
...prescription,
unit_price: values.price,
quantity: values.examen_quantity,
} : prescription;
})
});
fetchCheckInsuranceCoverageAmount({
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
style={{marginTop: 10}}
@ -1242,6 +1266,7 @@ const ExecuterPrescriptionScreen = ({
onPress={() => {
setElementToSetPrice({
...item,
quantity_original: item.quantity,
drugs: true
});
setConsultation({
@ -1312,7 +1337,11 @@ const ExecuterPrescriptionScreen = ({
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}
return {
id: prescription.id,
unit_price: prescription.unit_price,
quantity: prescription.quantity
}
}),
exams: consultation.exams.filter(exam => exam.checked)
.map(exam => {

View File

@ -513,6 +513,7 @@ const ModifierExecutionPrescriptionScreen = ({
prestations: consultation.prestations.map(presta => {
return elementToSetPrice.id === presta.id ? {
...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
} : presta;
})
@ -582,10 +583,10 @@ const ModifierExecutionPrescriptionScreen = ({
const renderPriceModal = () => (
<Formik validationSchema={PriceModal}
initialValues={{
examen_quantity: elementToSetPrice !== null ? elementToSetPrice.drugs ? parseInt(elementToSetPrice.quantity) - parseInt(elementToSetPrice.billed_quantity !== null ? elementToSetPrice.billed_quantity : 0) : '' : '',
price: elementToSetPrice.unit_price,
examen_quantity: elementToSetPrice.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 : '' : '',
}}
onSubmit={(values) => {
@ -618,30 +619,40 @@ const ModifierExecutionPrescriptionScreen = ({
tmp_sheet_id: tmpSheetId,
});
} else {
setConsultation({
...consultation,
prescriptions: consultation.prescriptions.map(exam => {
return elementToSetPrice.id === exam.id ? {
...exam,
unit_price: values.price
} : exam;
})
});
fetchCheckInsuranceCoverageAmount({
insurance_id: assure.id,
beneficiary_id: beneficiary !== null ? beneficiary.id : null,
care_condition: consultation._care_condition,
act_id: consultation.prescriptions.filter(prescription => elementToSetPrice.id === prescription.id)[0].act_id,
act_action: "UPDATE",
act_type: "PRESCRIPTION",
prescriptions: [
{
unit_price: values.price,
quantity: values.examen_quantity
}
],
tmp_sheet_id: tmpSheetId,
});
let quantityValue = historyItemDetail.prescriptions.filter(prescription => prescription.id = elementToSetPrice.id)[0].quantity;
if (parseInt(values.examen_quantity) > parseInt(quantityValue - parseInt(elementToSetPrice.billed_quantity !== null ? elementToSetPrice.billed_quantity : 0))) {
Alert.alert(I18n.t('ERROR_LABEL'), I18n.t('QUANTITY_CANNOT_BE_SUPERIOR') + " " + quantityValue,
[{
text: I18n.t('OK'), onPress: () => {
}
}]);
} else {
setConsultation({
...consultation,
prescriptions: consultation.prescriptions.map(exam => {
return elementToSetPrice.id === exam.id ? {
...exam,
unit_price: values.price,
quantity: values.examen_quantity,
} : exam;
})
});
fetchCheckInsuranceCoverageAmount({
insurance_id: assure.id,
beneficiary_id: beneficiary !== null ? beneficiary.id : null,
care_condition: consultation._care_condition,
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> :
<TextInput
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')}
value={values.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
style={{marginTop: 10}}

View File

@ -350,52 +350,38 @@ const DemandeAutorisationSoinScreen = ({
]}
key={item.id}
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'),
[{
text: I18n.t('OK'), onPress: () => {
}
}]);
} else 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,
);
fetchGetNetworkActs(wallet.id_network, '', `&user_id=${item.user.id}`);
dispatch(fetchGetUserByNameOrNumberReset());
wizard.current.next();
}*/
if (item.state === 'SUSPENDED') {
Alert.alert(I18n.t('ERROR_LABEL'), I18n.t('ASSURE_SUSPENDU'),
[{
text: I18n.t('OK'), onPress: () => {
}
}]);
} else 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,
);
fetchGetNetworkActs(wallet.id_network, '', `&user_id=${item.user.id}`);
dispatch(fetchGetUserByNameOrNumberReset());
wizard.current.next();
fetchGetListInsuranceWithBeneficiaries(`?user_id=${item.user.id}`);
}
}}>
<Text body2 semibold>
{`${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_QR_CODE": "Par QR Code",
"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 à"
}