diff --git a/application/controllers/NanoHealthController.php b/application/controllers/NanoHealthController.php index b56224dc..ca71d4b8 100644 --- a/application/controllers/NanoHealthController.php +++ b/application/controllers/NanoHealthController.php @@ -270,6 +270,40 @@ class NanoHealthController extends CI_Controller } } + public function resubmitHealthCareSheet(){ + if($this->isLogged()) { + if (isset($_POST)) { + $url = NANO_SANTE_SERVICE_URL.'/health-care-sheets'; + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); + /* set the content type json */ + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + 'Content-Type:application/json', + 'Authorization:'.NANO_SANTE_SERVICE_TOKEN, + 'X-localization:'. $this->session->userdata('site_lang') == 'french' ? 'fr' : 'en' + )); + /* set return type json */ + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $body = new \stdClass(); + $body->health_care_sheet_id = $this->input->post('health_care_sheet_id'); + $body->user_id = $this->input->post('user_id'); + $body->action = 'RESUBMIT'; + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); + + /* execute request */ + $result = curl_exec($ch); + /* close cURL resource */ + curl_close($ch); + + if ($result) { + echo $result; + } else { + echo json_encode(['status' => 500]); + } + } + } + } + private function isLogged() { diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index 7f8b0b23..2aa00df6 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -815,5 +815,9 @@ $lang['exam_class'] = "Exam class"; $lang['quantity'] = "Quantity"; $lang['medical_prescriptions'] = "Medical prescriptions"; $lang['dosage'] = "Dosage"; -$lang['drugs_or_device'] = "Drug / Device" +$lang['drugs_or_device'] = "Drug / Device"; +$lang['resubmit'] = "Resubmit"; +$lang['subscription_resubmitted'] = "The subscription has been resubmitted"; +$lang['insurance_part'] = "Insurance share"; +$lang['insurance_part'] = "Insurance share"; ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index 8a757e30..bc451169 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -815,7 +815,7 @@ $lang['practitioner'] = "Praticien"; $lang['accident_date'] = "Date de l'accident"; $lang['pregnancy_start_at'] = "Date de debut de la grossesse"; $lang['pregnancy_end_at'] = "Date de fin de la grossesse"; -$lang['performances'] = "Prescriptions"; +$lang['performances'] = "Prestations"; $lang['moderator_ticket'] = "Ticket modérateur"; $lang['home_visit_fees'] = "Frais de déplacement à domicile"; $lang['act'] = "Acte"; @@ -826,5 +826,9 @@ $lang['exam_class'] = "Classe de l'examen"; $lang['quantity'] = "Quantité"; $lang['medical_prescriptions'] = "Prescriptions médicales"; $lang['dosage'] = "Posologie"; -$lang['drugs_or_device'] = "Médicament / Appareillage" +$lang['drugs_or_device'] = "Médicament / Appareillage"; +$lang['resubmit'] = "Resoumettre"; +$lang['subscription_resubmitted'] = "La souscription a été re-soumise"; +$lang['insurance_part'] = "Part de l'assurance"; +$lang['insurance_part'] = "Part de l'assurance"; ?> 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 4898d929..0f5a1ce5 100755 --- a/application/views/nano_health/hyper/infos_health_care_sheet.php +++ b/application/views/nano_health/hyper/infos_health_care_sheet.php @@ -15,6 +15,14 @@

lang->line('health_care_sheets'). ' - ' . $health_care_sheet_id; ?> + +
+ state == 'REJECTED') { ?> + + +

-
+ num_rows() > 0 ) { ?> +

lang->line('exams') ?>

@@ -236,31 +245,45 @@ lang->line('exam_class'); ?> lang->line('exam_description'); ?> lang->line('quantity'); ?> + type == 'EXECUTION') { ?> + lang->line('UNIT_PRICE'); ?> + lang->line('percentage_insurer'); ?> + lang->line('percentage_insured'); ?> + result() as $i => $row) { -// $amount = Money::of(round($row->amount, 2), $insurance->currency_code, $this->context)->formatTo('fr_FR'); - - echo " + if($health_care_sheet->type == 'EXECUTION') { + $unit_price = Money::of(round($row->unit_price, 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR'); + $insurance_part = Money::of(round($row->insurer_paid_amount, 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR'); + $insured_part = Money::of(round($row->insured_paid_amount, 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR'); + } + echo " " . ($i+1) . " " . $row->act_name . " " . $row->description . " - " . $row->quantity. "" + " . $row->quantity. ""; + if($health_care_sheet->type == 'EXECUTION') { ?> + + + + - - +
+ -
+ + num_rows() > 0 ) { ?> +

lang->line('medical_prescriptions') ?>

@@ -272,29 +295,42 @@ lang->line('drugs_or_device'); ?> lang->line('dosage'); ?> lang->line('quantity'); ?> + type == 'EXECUTION') { ?> + lang->line('UNIT_PRICE'); ?> + lang->line('percentage_insurer'); ?> + lang->line('percentage_insured'); ?> + result() as $i => $row) { -// $amount = Money::of(round($row->amount, 2), $insurance->currency_code, $this->context)->formatTo('fr_FR'); + if($health_care_sheet->type == 'EXECUTION') { + // $amount = Money::of(round($row->amount, 2), $insurance->currency_code, $this->context)->formatTo('fr_FR'); + $unit_price = Money::of(round($row->unit_price, 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR'); + $insurance_part = Money::of(round($row->insurer_paid_amount, 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR'); + $insured_part = Money::of(round($row->insured_paid_amount, 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR'); + } echo " " . ($i+1) . " " . $row->drug_or_device_name . " " . $row->dosage . " - " . $row->quantity. "" - ?> - - " . $row->quantity. ""; + if($health_care_sheet->type == 'EXECUTION') { ?> + + + + + +
+ @@ -406,4 +442,37 @@ } ); + $('#resubmit').click(function() { + $.ajax({ + url: '', + type: 'POST', + dataType: 'json', + data: { + "health_care_sheet_id": "id ?>", + "user_id": "user_id ?>", + }, + success: function (data) { + // console.log('data',data); + if(data.status === 200){ + Swal.fire({ + icon: 'success', + title: "lang->line('subscription_resubmitted')?>", + text:"lang->line('informations_updated')?>", + timer: 3000 + }).then(()=>{ + location.reload(); + }); + // alert("Les informations ont été mises à jour.") ? "" : + }else{ + toastr.error(data.error , "lang->line('request_error')?>"); + } + }, + + error: function (resultat, statut, error) { + console.log(resultat + " " + error); + toastr.error("lang->line('error_message')?>" , "lang->line('request_error')?>"); + } + }); + }); +