Update execution of prescription
This commit is contained in:
parent
8aed9f4d09
commit
f026fed0a4
|
@ -355,6 +355,9 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
const insurance = insured.filter(i => i.insured_id === $(this).val());
|
||||
$.each(insurance, function (i, item) {
|
||||
currentInsurance = item;
|
||||
$('#sheet-form').find('select[name="beneficiary_id"]').children().remove().end()
|
||||
.append('<option selected disabled value="">Choisissez le patient</option>');
|
||||
|
||||
$('#sheet-form').find('select[name="beneficiary_id"]').append($('<optgroup>', {
|
||||
label: 'Assuré principal',
|
||||
}));
|
||||
|
|
|
@ -220,18 +220,32 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
if(insured && Array.isArray(insured)){
|
||||
var currentInsurance = null;
|
||||
var consultations = [];
|
||||
// console.log('insured', insured)
|
||||
// insured.each()
|
||||
|
||||
$.each(insured, function (i, item) {
|
||||
$('#sheet-form').find('select[name="insured_id"]').append($('<optgroup>', {
|
||||
label: 'Assuré principal',
|
||||
}));
|
||||
$('#sheet-form').find('select[name="insured_id"]').append($('<option>', {
|
||||
value: item.insured_id,
|
||||
insured_id : item.insured_id,
|
||||
value: 0,
|
||||
text : item.insured_id+' - '+item.user.lastname +' '+(item.user.firstname || '')
|
||||
}));
|
||||
$('#sheet-form').find('select[name="insured_id"]').append($('<optgroup>', {
|
||||
label: 'Ayants droits',
|
||||
}));
|
||||
$.each(item.beneficiaries, function (j, it) {
|
||||
$('#sheet-form').find('select[name="insured_id"]').append($('<option>', {
|
||||
insured_id : item.insured_id,
|
||||
value: it.id,
|
||||
text : item.insured_id+' - '+it.lastname +' '+(it.firstname || '')
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
$('#sheet-form').find('select[name="insured_id"]').change(function () {
|
||||
const insurance = insured.filter(i => i.insured_id === $(this).val());
|
||||
|
||||
let insurance = insured.filter(i => i.insured_id === $(this).find(":selected").attr('insured_id'));
|
||||
// Definir benficiary_id to null si c'est l'assuré principal
|
||||
let beneficiary_id = parseInt($(this).val()) === 0 ? null : $(this).val();
|
||||
$.each(insurance, function (i, item) {
|
||||
currentInsurance = item;
|
||||
$.ajax({
|
||||
|
@ -239,11 +253,15 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
"user_id" : item.user.id, "state" : "TO_BILL"
|
||||
"user_id" : item.user.id, "beneficiary_id" : beneficiary_id, "state" : "TO_BILL"
|
||||
},
|
||||
success: function (data) {
|
||||
console.log('reponse', data);
|
||||
if(data.status === 200){
|
||||
consultations = data.response;
|
||||
$('#sheet-form').find('select[name="health_care_sheet_id"]').children().remove().end()
|
||||
.append('<option selected disabled value="">Choisissez la consultation</option>');
|
||||
|
||||
$.each(consultations, function (j, it) {
|
||||
$('#sheet-form').find('select[name="health_care_sheet_id"]').append($('<option>', {
|
||||
value: it.id,
|
||||
|
|
|
@ -22,6 +22,11 @@
|
|||
<?= $this->lang->line('health_care_sheets'). ' - ' . $health_care_sheet_id; ?>
|
||||
|
||||
<div class="pull-right">
|
||||
<?php if($health_care_sheet->state == 'UNDER_VALIDATION' && $health_care_sheet->network_agent_id == $network_agent_id) { ?>
|
||||
<a href="<?= base_url()?>" class="btn btn-primary" >
|
||||
<?= $this->lang->line('Modifier') ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if($health_care_sheet->state == 'REJECTED') { ?>
|
||||
<button id="resubmit" class="btn btn-success" >
|
||||
<?= $this->lang->line('resubmit') ?>
|
||||
|
|
Loading…
Reference in New Issue