diff --git a/application/controllers/Agent.php b/application/controllers/Agent.php index dd9fb97d..6c005fbe 100755 --- a/application/controllers/Agent.php +++ b/application/controllers/Agent.php @@ -64,6 +64,10 @@ class Agent extends CI_Controller $this->load->view('header_agent', $data); if($action == 'new_consultation'){ $this->load->view('nano_health/agent/health_care_sheet_consultation_form'); + } else if($action == 'update_consultation'){ + $this->load->view('nano_health/agent/health_care_sheet_update_consultation_form'); + } else if($action == 'update_execution'){ + $this->load->view('nano_health/agent/health_care_sheet_update_execution_form'); } else { $this->load->view('nano_health/agent/health_care_sheet_execution_form'); } diff --git a/application/controllers/NanoHealthController.php b/application/controllers/NanoHealthController.php index 445b0b8f..6a41ad69 100644 --- a/application/controllers/NanoHealthController.php +++ b/application/controllers/NanoHealthController.php @@ -379,6 +379,41 @@ class NanoHealthController extends CI_Controller } } + public function updateHealthCareSheet($id) + { + if($this->isLogged()) { + if (isset($_POST)) { + $url = NANO_SANTE_SERVICE_URL.'/health-care-sheets/'.$id; + $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(); + foreach ($_POST as $key => $value){ + $body->{$key} = $value; + } + 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]); + } + } + } + } + public function calculateHealthCareSheetPerformancesAmount() { if($this->isLogged()) { diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index e09b3500..a3543664 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -835,4 +835,11 @@ $lang['pregnancy'] = "Pregnancy care" ; $lang['consultation_entered'] = "Consultation entered" ; $lang['new_execution'] = "Execute a prescription" ; $lang['execution_entered'] = "Execution entered" ; +$lang['update_consultation'] = "Modify a consultation"; +$lang['update_execution'] = "Modify an execution"; +$lang['consultation_updated'] = "Consultation modified"; +$lang['consultation_rule_1'] = "You must enter at least one benefit"; +$lang['execution_updated'] = "Modified execution"; +$lang['execution_rule_1'] = "You must enter at least one test or prescription"; +$lang['execution_rule_2'] = "An execution concerns only either examinations or medical prescriptions"; ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index 98e70b5a..d41451a8 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -846,4 +846,11 @@ $lang['pregnancy'] = "Soins grossesse"; $lang['consultation_entered'] = "Consultation saisie"; $lang['new_execution'] = "Executer une prescription"; $lang['execution_entered'] = "Execution saisie"; +$lang['update_consultation'] = "Modifier une consultation"; +$lang['update_execution'] = "Modifier une execution"; +$lang['consultation_updated'] = "Consultation modifiée"; +$lang['execution_updated'] = "Execution modifiée"; +$lang['consultation_rule_1'] = "Vous devez saisir au moins une prestation"; +$lang['execution_rule_1'] = "Vous devez saisir au moins un examen ou prescription"; +$lang['execution_rule_2'] = "Une execution concerne uniquement soit les examens , soit les prescriptions médicales"; ?> 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 ecc31b23..2829ac5f 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 @@ -158,22 +158,6 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
- result() as $row) { - echo "