diff --git a/application/views/nano_health/agent/health_care_sheet_consultation_form.php b/application/views/nano_health/agent/health_care_sheet_consultation_form.php index b5cffba2..ecc31b23 100755 --- a/application/views/nano_health/agent/health_care_sheet_consultation_form.php +++ b/application/views/nano_health/agent/health_care_sheet_consultation_form.php @@ -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('Choisissez le patient'); + $('#sheet-form').find('select[name="beneficiary_id"]').append($('', { label: 'Assuré principal', })); diff --git a/application/views/nano_health/agent/health_care_sheet_execution_form.php b/application/views/nano_health/agent/health_care_sheet_execution_form.php index 4cd82d53..c2849389 100755 --- a/application/views/nano_health/agent/health_care_sheet_execution_form.php +++ b/application/views/nano_health/agent/health_care_sheet_execution_form.php @@ -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($('', { + label: 'Assuré principal', + })); $('#sheet-form').find('select[name="insured_id"]').append($('', { - 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($('', { + label: 'Ayants droits', + })); + $.each(item.beneficiaries, function (j, it) { + $('#sheet-form').find('select[name="insured_id"]').append($('', { + 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('Choisissez la consultation'); + $.each(consultations, function (j, it) { $('#sheet-form').find('select[name="health_care_sheet_id"]').append($('', { value: it.id, diff --git a/application/views/nano_health/hyper/infos_health_care_sheet.php b/application/views/nano_health/hyper/infos_health_care_sheet.php index 83d92c0e..f66beb42 100755 --- a/application/views/nano_health/hyper/infos_health_care_sheet.php +++ b/application/views/nano_health/hyper/infos_health_care_sheet.php @@ -22,6 +22,11 @@ = $this->lang->line('health_care_sheets'). ' - ' . $health_care_sheet_id; ?> + state == 'UNDER_VALIDATION' && $health_care_sheet->network_agent_id == $network_agent_id) { ?> + + = $this->lang->line('Modifier') ?> + + state == 'REJECTED') { ?> = $this->lang->line('resubmit') ?>