Add Health Care Sheet form in agent panel
This commit is contained in:
parent
a136faf988
commit
831d70a1c2
|
@ -28,7 +28,8 @@ class Agent extends CI_Controller
|
||||||
$data['network'] = $this->session->userdata('network');
|
$data['network'] = $this->session->userdata('network');
|
||||||
$data['code_parrain'] = $this->session->userdata('parrain');
|
$data['code_parrain'] = $this->session->userdata('parrain');
|
||||||
$data['network_agent_id'] = $this->session->userdata('network_agent_id');
|
$data['network_agent_id'] = $this->session->userdata('network_agent_id');
|
||||||
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['network_id'] = $data['id_network'] = $this->session->userdata('network_id');
|
||||||
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($data['network_id']);
|
||||||
|
|
||||||
if ($this->input->get('history')) {
|
if ($this->input->get('history')) {
|
||||||
if($this->input->get('id') !== null){
|
if($this->input->get('id') !== null){
|
||||||
|
@ -51,6 +52,13 @@ class Agent extends CI_Controller
|
||||||
}
|
}
|
||||||
}else if($this->input->get('action')) {
|
}else if($this->input->get('action')) {
|
||||||
|
|
||||||
|
$nh_config = $this->nano_health_model->getConfig($data['network_id']);
|
||||||
|
$data['nh_config'] = $nh_config ? $nh_config->first_row() : null ;
|
||||||
|
$data['config_id'] = $data['nh_config'] ? $data['nh_config']->id : null ;
|
||||||
|
$data['acts'] = $this->nano_health_model->getConfigActs($data['config_id']);
|
||||||
|
$data['provider_classes'] = $this->nano_health_model->getProviderClasses($data['config_id']);
|
||||||
|
$data['drugs_and_devices'] = $this->nano_health_model->getDrugAndDevices($data['network_id']);
|
||||||
|
|
||||||
$this->load->view('header_agent', $data);
|
$this->load->view('header_agent', $data);
|
||||||
$this->load->view('nano_health/agent/health_care_sheet_form');
|
$this->load->view('nano_health/agent/health_care_sheet_form');
|
||||||
$this->load->view('footer');
|
$this->load->view('footer');
|
||||||
|
|
|
@ -304,6 +304,81 @@ class NanoHealthController extends CI_Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getInsured()
|
||||||
|
{
|
||||||
|
if($this->isLogged()) {
|
||||||
|
if (isset($_POST)) {
|
||||||
|
$url = NANO_SANTE_SERVICE_URL.'/insured';
|
||||||
|
$dataArray = [
|
||||||
|
'network_id' => $this->input->post('network_id'),
|
||||||
|
];
|
||||||
|
$query = $this->input->post('query');
|
||||||
|
$option = $this->input->post('option');
|
||||||
|
$dataArray[$option ?? 'name'] = $query;
|
||||||
|
|
||||||
|
$data = http_build_query($dataArray);
|
||||||
|
// $getUrl = $url."?".$data;
|
||||||
|
$ch = curl_init($url."?".$data);
|
||||||
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
|
||||||
|
/* 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);
|
||||||
|
|
||||||
|
|
||||||
|
/* execute request */
|
||||||
|
$result = curl_exec($ch);
|
||||||
|
/* close cURL resource */
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
echo $result;
|
||||||
|
} else {
|
||||||
|
echo json_encode(['status' => 500]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveHealthCareSheetConsultation()
|
||||||
|
{
|
||||||
|
if($this->isLogged()) {
|
||||||
|
if (isset($_POST)) {
|
||||||
|
$url = NANO_SANTE_SERVICE_URL.'/health-care-sheets/consultation';
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
||||||
|
/* 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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private function isLogged()
|
private function isLogged()
|
||||||
{
|
{
|
||||||
|
|
|
@ -822,4 +822,11 @@ $lang['insurance_part'] = "Insurance share";
|
||||||
$lang['insurance_part'] = "Insurance share";
|
$lang['insurance_part'] = "Insurance share";
|
||||||
$lang['consultation_id'] = "Consulation ID";
|
$lang['consultation_id'] = "Consulation ID";
|
||||||
$lang['new_care_sheet'] = "Enter a care sheet";
|
$lang['new_care_sheet'] = "Enter a care sheet";
|
||||||
|
$lang['new_prestation'] = "New service";
|
||||||
|
$lang['new_exam'] = "New exam";
|
||||||
|
$lang['new_prescription'] = "New prescription";
|
||||||
|
$lang['user_phone_number'] = "User phone number";
|
||||||
|
$lang['insured_not_found'] = "This insured does not exist";
|
||||||
|
$lang['finding_insured_by'] = "Finding the insured by:";
|
||||||
|
$lang['one_insured'] = "Insured";
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -833,4 +833,11 @@ $lang['insurance_part'] = "Part de l'assurance";
|
||||||
$lang['insurance_part'] = "Part de l'assurance";
|
$lang['insurance_part'] = "Part de l'assurance";
|
||||||
$lang['consultation_id'] = "ID de la consultation";
|
$lang['consultation_id'] = "ID de la consultation";
|
||||||
$lang['new_care_sheet'] = "Saisir une feuille de soins";
|
$lang['new_care_sheet'] = "Saisir une feuille de soins";
|
||||||
|
$lang['new_prestation'] = "Nouvelle prestation";
|
||||||
|
$lang['new_exam'] = "Nouvel examen";
|
||||||
|
$lang['new_prescription'] = "Nouvelle prescription";
|
||||||
|
$lang['user_phone_number'] = "Numéro de téléphone de l'usager";
|
||||||
|
$lang['insured_not_found'] = "Cet assuré n'existe pas";
|
||||||
|
$lang['finding_insured_by'] = "Recherche de l'assuré par :";
|
||||||
|
$lang['one_insured'] = "Assuré"
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -101,4 +101,9 @@ class Nano_health_model extends CI_Model
|
||||||
->join('nh_drugs_and_devices d', 'd.id = p.drug_or_device_id')
|
->join('nh_drugs_and_devices d', 'd.id = p.drug_or_device_id')
|
||||||
->where('sp.sheet_id',$healthCareSheetId)->order_by('sp.created_at','asc')->get();
|
->where('sp.sheet_id',$healthCareSheetId)->order_by('sp.created_at','asc')->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDrugAndDevices($networkId)
|
||||||
|
{
|
||||||
|
return $this->db->get_where('nh_drugs_and_devices',['network_id'=> $networkId]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,32 +39,65 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
||||||
</div>
|
</div>
|
||||||
<!-- /.box-header -->
|
<!-- /.box-header -->
|
||||||
<!-- form start -->
|
<!-- form start -->
|
||||||
<form role="form" id="walletForm">
|
<form id="sheet-form">
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
|
<div class="row" style="margin-bottom: 30px">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label><?= $this->lang->line('one_insured')?></label>
|
||||||
|
<select class="form-control" name="insured_id" required>
|
||||||
|
<option value="" selected disabled> Choisissez l'assuré</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group" id="patient">
|
||||||
|
<label>Patient</label>
|
||||||
|
<select class="form-control" name="beneficiary_id" required>
|
||||||
|
<option value="" selected disabled> Choisissez le patient</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div id="patient-details">
|
||||||
|
<div class="form-group">
|
||||||
|
<label><?= $this->lang->line('patient_lastname')?></label>
|
||||||
|
<input class="form-control" name="patient_lastname" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label><?= $this->lang->line('patient_firstname')?></label>
|
||||||
|
<input class="form-control" name="patient_firstname">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label><?= $this->lang->line('practitioner_lastname')?></label>
|
||||||
|
<input class="form-control" name="practitioner_lastname" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label><?= $this->lang->line('practitioner_firstname')?></label>
|
||||||
|
<input class="form-control" name="practitioner_firstname">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Classification</label>
|
||||||
|
<select required class="form-control" name="practitioner_provider_class_id">
|
||||||
|
<?php foreach ($provider_classes->result() as $row) { ?>
|
||||||
|
<option value="<?=$row->id ?>"> <?= $row->name ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label><?= $this->lang->line('care_condition')?></label>
|
||||||
|
<select class="form-control" name="care_condition" required>
|
||||||
|
<option value="CURRENT_AFFECTION"> <?= $this->lang->line('CURRENT_AFFECTION')?></option>
|
||||||
|
<option value="LONG_TERM_AFFECTION"> <?= $this->lang->line('LONG_TERM_AFFECTION')?></option>
|
||||||
|
<option value="EXONERATION"> <?= $this->lang->line('EXONERATION')?></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label><?= $this->lang->line('practitioner_lastname')?></label>
|
|
||||||
<input class="form-control" name="practitioner_lastname">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<label><?= $this->lang->line('practitioner_firstname')?></label>
|
<div class="form-group mt-2" style="overflow-x:auto;">
|
||||||
<input class="form-control" name="practitioner_firstname">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Classification</label>
|
|
||||||
<input class="form-control" name="practitioner_firstname">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label><?= $this->lang->line('care_condition')?></label>
|
|
||||||
<label>
|
|
||||||
<select class="form-control" name="care_condition">
|
|
||||||
<option value="CURRENT_AFFECTION"> <?= $this->lang->line('CURRENT_AFFECTION')?></option>
|
|
||||||
<option value="LONG_TERM_AFFECTION"> <?= $this->lang->line('LONG_TERM_AFFECTION')?></option>
|
|
||||||
<option value="EXONERATION"> <?= $this->lang->line('EXONERATION')?></option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group" style="overflow-x:auto;">
|
|
||||||
<div class="table-title">
|
<div class="table-title">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
|
@ -73,24 +106,26 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<button type="button" class="btn btn-info add-new new1"><i
|
<button type="button" class="btn btn-info add-new new1"><i
|
||||||
class="fa fa-plus"></i> <?php echo $this->lang->line('new_level'); ?>
|
class="fa fa-plus"></i> <?php echo $this->lang->line('new_prestation'); ?>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<table id="user_wallet_wallet" class="table table-bordered">
|
<table id="prestations" class="table table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Min</th>
|
<th><?php echo $this->lang->line('act_code'); ?> </th>
|
||||||
<th>Max</th>
|
<th><?php echo $this->lang->line('Montant'); ?></th>
|
||||||
<th><?php echo $this->lang->line('rate'); ?> (%)</th>
|
<th><?= $this->lang->line('moderator_ticket'); ?></th>
|
||||||
|
<th><?= $this->lang->line('insurance_amount'); ?></th>
|
||||||
|
<th><?= $this->lang->line('home_visit_fees'); ?></th>
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
if (isset($plr_user_wallet_wallet)) {
|
if (isset($plr_prestations)) {
|
||||||
foreach ($plr_user_wallet_wallet->result() as $row) {
|
foreach ($plr_prestations->result() as $row) {
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
<td>" . $row->min . "</td>
|
<td>" . $row->min . "</td>
|
||||||
<td>" . $row->max . "</td>
|
<td>" . $row->max . "</td>
|
||||||
|
@ -107,7 +142,51 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" style="overflow-x:auto;">
|
<div class="form-group mt-4" style="overflow-x:auto;">
|
||||||
|
<div class="table-title">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<label for="nom"
|
||||||
|
class="col-form-label"><?php echo $this->lang->line('exams'); ?></label>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<button type="button" class="btn btn-info add-new new2"><i
|
||||||
|
class="fa fa-plus"></i> <?php echo $this->lang->line('new_exam'); ?>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table id="exams" class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?= $this->lang->line('exam_class'); ?></th>
|
||||||
|
<th><?= $this->lang->line('exam_description'); ?></th>
|
||||||
|
<th><?= $this->lang->line('quantity'); ?></th>
|
||||||
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
if (isset($plr_prescriptions)) {
|
||||||
|
foreach ($plr_prescriptions->result() as $row) {
|
||||||
|
echo "<tr>
|
||||||
|
<td>" . $row->min . "</td>
|
||||||
|
<td>" . $row->max . "</td>
|
||||||
|
<td>" . $row->taux . "</td>" . '
|
||||||
|
<td>
|
||||||
|
<a class="add add2" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||||
|
<a class="edit edit2" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||||
|
<a class="delete delete2" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||||
|
</td>
|
||||||
|
</tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group mt-4" style="overflow-x:auto;">
|
||||||
<div class="table-title">
|
<div class="table-title">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
|
@ -115,33 +194,33 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
||||||
class="col-form-label"><?php echo $this->lang->line('medical_prescriptions'); ?></label>
|
class="col-form-label"><?php echo $this->lang->line('medical_prescriptions'); ?></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<button type="button" class="btn btn-info add-new new7"><i
|
<button type="button" class="btn btn-info add-new new3"><i
|
||||||
class="fa fa-plus"></i> <?php echo $this->lang->line('new_level'); ?>
|
class="fa fa-plus"></i> <?php echo $this->lang->line('new_prescription'); ?>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<table id="user_wallet_wallet_national" class="table table-bordered">
|
<table id="prescriptions" class="table table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Min</th>
|
<th><?= $this->lang->line('drugs_or_device'); ?></th>
|
||||||
<th>Max</th>
|
<th><?= $this->lang->line('dosage'); ?></th>
|
||||||
<th><?php echo $this->lang->line('rate'); ?> (%)</th>
|
<th><?= $this->lang->line('quantity'); ?></th>
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
if (isset($plr_user_wallet_wallet_national)) {
|
if (isset($plr_prescriptions)) {
|
||||||
foreach ($plr_user_wallet_wallet_national->result() as $row) {
|
foreach ($plr_prescriptions->result() as $row) {
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
<td>" . $row->min . "</td>
|
<td>" . $row->min . "</td>
|
||||||
<td>" . $row->max . "</td>
|
<td>" . $row->max . "</td>
|
||||||
<td>" . $row->taux . "</td>" . '
|
<td>" . $row->taux . "</td>" . '
|
||||||
<td>
|
<td>
|
||||||
<a class="add add7" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>
|
<a class="add add3" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||||
<a class="edit edit7" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>
|
<a class="edit edit3" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||||
<a class="delete delete7" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>
|
<a class="delete delete3" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||||
</td>
|
</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
@ -150,48 +229,10 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" style="overflow-x:auto;">
|
|
||||||
<div class="table-title">
|
<div class="form-group">
|
||||||
<div class="row">
|
<label><?= $this->lang->line('mot de passe')?></label>
|
||||||
<div class="col-sm-8">
|
<input type="password" class="form-control" name="password" required>
|
||||||
<label for="nom"
|
|
||||||
class="col-form-label"><?php echo $this->lang->line('exams'); ?></label>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-4">
|
|
||||||
<button type="button" class="btn btn-info add-new new7"><i
|
|
||||||
class="fa fa-plus"></i> <?php echo $this->lang->line('new_level'); ?>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<table id="user_wallet_wallet_national" class="table table-bordered">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Min</th>
|
|
||||||
<th>Max</th>
|
|
||||||
<th><?php echo $this->lang->line('rate'); ?> (%)</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
if (isset($plr_user_wallet_wallet_national)) {
|
|
||||||
foreach ($plr_user_wallet_wallet_national->result() as $row) {
|
|
||||||
echo "<tr>
|
|
||||||
<td>" . $row->min . "</td>
|
|
||||||
<td>" . $row->max . "</td>
|
|
||||||
<td>" . $row->taux . "</td>" . '
|
|
||||||
<td>
|
|
||||||
<a class="add add7" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>
|
|
||||||
<a class="edit edit7" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>
|
|
||||||
<a class="delete delete7" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>
|
|
||||||
</td>
|
|
||||||
</tr>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.box-body -->
|
<!-- /.box-body -->
|
||||||
|
@ -240,80 +281,170 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
||||||
toastr.options.closeDuration = 5000;
|
toastr.options.closeDuration = 5000;
|
||||||
toastr.options.closeEasing = 'swing';
|
toastr.options.closeEasing = 'swing';
|
||||||
|
|
||||||
$('#updateWallet').click(function () {
|
$(document).ready(function (){
|
||||||
const network_id = $(this).data('network-id');
|
$('#patient').hide();
|
||||||
const id_config = $(this).data('id-config');
|
$('#patient-details').hide();
|
||||||
if ($('#walletForm')[0].checkValidity()) {
|
// Get The Data
|
||||||
|
const insured = JSON.parse(sessionStorage.getItem('insured'));
|
||||||
// Paliers
|
if(insured && Array.isArray(insured)){
|
||||||
var plr_user_wallet_wallet = [];
|
var currentInsurance = null
|
||||||
|
// console.log('insured', insured)
|
||||||
var plr_user_wallet_wallet_national = [];
|
// insured.each()
|
||||||
|
$.each(insured, function (i, item) {
|
||||||
$('#user_wallet_wallet tr').has('td').each(function () {
|
$('#sheet-form').find('select[name="insured_id"]').append($('<option>', {
|
||||||
var arrayItem = {};
|
value: item.insured_id,
|
||||||
$('td', $(this)).each(function (index, item) {
|
text : item.insured_id+' - '+item.user.lastname +' '+(item.user.firstname || '')
|
||||||
if (index < 3)
|
}));
|
||||||
arrayItem[index] = parseFloat($(item).html());
|
|
||||||
});
|
|
||||||
plr_user_wallet_wallet.push(arrayItem);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#sheet-form').find('select[name="insured_id"]').change(function () {
|
||||||
$('#user_wallet_wallet_national tr').has('td').each(function () {
|
const insurance = insured.filter(i => i.insured_id === $(this).val());
|
||||||
var arrayItem = {};
|
$.each(insurance, function (i, item) {
|
||||||
$('td', $(this)).each(function (index, item) {
|
currentInsurance = item;
|
||||||
if (index < 3)
|
$('#sheet-form').find('select[name="beneficiary_id"]').append($('<optgroup>', {
|
||||||
arrayItem[index] = parseFloat($(item).html());
|
label: 'Assuré principal',
|
||||||
|
}));
|
||||||
|
$('#sheet-form').find('select[name="beneficiary_id"]').append($('<option>', {
|
||||||
|
value: 0,
|
||||||
|
text : item.user.lastname +' '+(item.user.firstname || '')
|
||||||
|
}));
|
||||||
|
$('#sheet-form').find('select[name="beneficiary_id"]').append($('<optgroup>', {
|
||||||
|
label: 'Ayants droits',
|
||||||
|
}));
|
||||||
|
$.each(item.beneficiaries, function (j, it) {
|
||||||
|
$('#sheet-form').find('select[name="beneficiary_id"]').append($('<option>', {
|
||||||
|
value: it.id,
|
||||||
|
text : it.lastname +' '+it.firstname
|
||||||
|
}));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
plr_user_wallet_wallet_national.push(arrayItem);
|
$('#patient').show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#sheet-form').find('select[name="beneficiary_id"]').change(function () {
|
||||||
|
var val = parseInt($(this).val());
|
||||||
|
|
||||||
$.ajax({
|
if(val === 0){
|
||||||
url: '<?php echo base_url('Gestion/config_wallet/update')?>',
|
$('#sheet-form').find('input[name="patient_lastname"]').val(currentInsurance.user.lastname)
|
||||||
type: 'POST',
|
$('#sheet-form').find('input[name="patient_firstname"]').val(currentInsurance.user.firstname)
|
||||||
dataType: 'json',
|
}else{
|
||||||
data: {
|
const b = currentInsurance.beneficiaries.filter(i => i.id === val);
|
||||||
"type": "ilink",
|
$('#sheet-form').find('input[name="patient_lastname"]').val(b[0].lastname)
|
||||||
"config":"user_wallet_wallet",
|
$('#sheet-form').find('input[name="patient_firstname"]').val(b[0].firstname)
|
||||||
"network_id": network_id, "id_config": id_config,
|
|
||||||
"plr_user_wallet_wallet": plr_user_wallet_wallet,
|
|
||||||
"plr_user_wallet_wallet_national": plr_user_wallet_wallet_national,
|
|
||||||
},
|
|
||||||
success: function (data) {
|
|
||||||
if (data == '200') {
|
|
||||||
Swal.fire({
|
|
||||||
icon: 'success',
|
|
||||||
title: "<?php echo $this->lang->line('wallet_update')?>",
|
|
||||||
text: "<?php echo $this->lang->line('informations_updated')?>",
|
|
||||||
timer: 3000
|
|
||||||
}).then(() => {
|
|
||||||
location.reload();
|
|
||||||
});
|
|
||||||
// alert("Les informations ont été mises à jour.") ? "" :
|
|
||||||
} else {
|
|
||||||
toastr.error("<?php echo $this->lang->line('error_message')?>", "<?php echo $this->lang->line('request_error')?>");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
error: function (resultat, statut, error) {
|
|
||||||
console.log(resultat + " " + error);
|
|
||||||
toastr.error("<?php echo $this->lang->line('error_message')?>", "<?php echo $this->lang->line('request_error')?>");
|
|
||||||
}
|
}
|
||||||
|
$('#patient-details').show();
|
||||||
});
|
});
|
||||||
|
}else{
|
||||||
|
history.back()
|
||||||
} else {
|
|
||||||
$('#walletForm')[0].reportValidity();
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
$("#sheet-form").submit(function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
// Paliers
|
||||||
|
var prestations = [];
|
||||||
|
var exams = [];
|
||||||
|
var prescriptions = [];
|
||||||
|
|
||||||
|
$('#prestations tr').has('td').each(function () {
|
||||||
|
var arrayItem = {};
|
||||||
|
$('td', $(this)).each(function (index, item) {
|
||||||
|
if (index === 0)
|
||||||
|
arrayItem['act_id'] = $(item).attr('value');
|
||||||
|
if (index === 1)
|
||||||
|
arrayItem['amount'] = parseFloat($(item).html());
|
||||||
|
if (index === 4)
|
||||||
|
arrayItem['home_visit_fees'] = parseFloat($(item).html()) || null;
|
||||||
|
});
|
||||||
|
prestations.push(arrayItem);
|
||||||
|
});
|
||||||
|
$('#exams tr').has('td').each(function () {
|
||||||
|
var arrayItem = {};
|
||||||
|
$('td', $(this)).each(function (index, item) {
|
||||||
|
if (index === 0)
|
||||||
|
arrayItem['act_id'] = $(item).attr('value');
|
||||||
|
if (index === 1)
|
||||||
|
arrayItem['description'] = $(item).html();
|
||||||
|
if (index === 2)
|
||||||
|
arrayItem['quantity'] = parseFloat($(item).html());
|
||||||
|
});
|
||||||
|
exams.push(arrayItem);
|
||||||
|
});
|
||||||
|
$('#prescriptions tr').has('td').each(function () {
|
||||||
|
var arrayItem = {};
|
||||||
|
$('td', $(this)).each(function (index, item) {
|
||||||
|
if (index === 0)
|
||||||
|
arrayItem['drug_or_device_id'] = $(item).attr('value');
|
||||||
|
if (index === 1)
|
||||||
|
arrayItem['dosage'] = $(item).html();
|
||||||
|
if (index === 2)
|
||||||
|
arrayItem['quantity'] = parseFloat($(item).html());
|
||||||
|
});
|
||||||
|
prescriptions.push(arrayItem);
|
||||||
|
});
|
||||||
|
|
||||||
|
if(prestations.length === 0){
|
||||||
|
return toastr.error("Vous devez saisir au moins une prestation", "<?php echo $this->lang->line('request_error')?>");
|
||||||
|
}
|
||||||
|
|
||||||
|
var unindexed_array = $(this).serializeArray();
|
||||||
|
var indexed_array = {};
|
||||||
|
|
||||||
|
$.map(unindexed_array, function(n, i){
|
||||||
|
indexed_array[n['name']] = n['value'];
|
||||||
|
});
|
||||||
|
|
||||||
|
indexed_array.beneficiary_id = parseInt(indexed_array.beneficiary_id) === 0 ? null : indexed_array.beneficiary_id;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '<?php echo base_url('NanoHealthController/saveHealthCareSheetConsultation')?>',
|
||||||
|
type: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
...indexed_array, "network_agent_id" : "<?= $network_agent_id ?>",
|
||||||
|
"performances": prestations, "exams": exams, "prescriptions": prescriptions,
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
if(data.status === 200){
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'success',
|
||||||
|
title: "<?= $this->lang->line('drug_and_device_updated')?>",
|
||||||
|
text:"<?= $this->lang->line('informations_updated')?>",
|
||||||
|
timer: 3000
|
||||||
|
}).then(()=>{
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
toastr.error(data.error , "<?= $this->lang->line('request_error')?>");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (resultat, statut, error) {
|
||||||
|
console.log(resultat + " " + error);
|
||||||
|
toastr.error("<?php echo $this->lang->line('error_message')?>", "<?php echo $this->lang->line('request_error')?>");
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// Paliers scripts
|
// Paliers scripts
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
function getActsOptions(selectedValue) {
|
||||||
|
var actsOptions = '';
|
||||||
|
<?php foreach ($acts->result() as $a ) {?>
|
||||||
|
var id = <?= $a->id ?>;
|
||||||
|
var selected = id === parseInt(selectedValue) ? 'selected' : '';
|
||||||
|
actsOptions += (`<option value=<?= $a->id ?> ${selected} > <?= $a->name ?> </option>`);
|
||||||
|
<?php } ?>
|
||||||
|
return actsOptions;
|
||||||
|
}
|
||||||
|
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
var actions1 = $("#user_wallet_wallet td:last-child").html();
|
|
||||||
|
var actions1 = $("#prestations td:last-child").html();
|
||||||
// Append table with add row form on add new button click
|
// Append table with add row form on add new button click
|
||||||
$(".new1").click(function () {
|
$(".new1").click(function () {
|
||||||
if (!actions1) {
|
if (!actions1) {
|
||||||
|
@ -322,49 +453,36 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
||||||
' <a class="delete delete1" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>';
|
' <a class="delete delete1" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>';
|
||||||
}
|
}
|
||||||
$(this).attr("disabled", "disabled");
|
$(this).attr("disabled", "disabled");
|
||||||
var index = $("#user_wallet_wallet tbody tr:last-child").index();
|
var index = $("#prestations tbody tr:last-child").index();
|
||||||
var row = '<tr>' +
|
var row = '<tr>' +
|
||||||
'<td><input type="number" required min="0" class="form-control" name="min" id="min"></td>' +
|
'<td>' +
|
||||||
'<td><input type="number" required class="form-control" name="max" id="max"></td>' +
|
'<select required class="form-control" name="act_id" >' +
|
||||||
'<td><input type="number" required class="form-control" min="0" name="taux" id="taux"></td>' +
|
getActsOptions(null)+
|
||||||
|
'</select>' +
|
||||||
|
'</td>' +
|
||||||
|
'<td><input type="number" required class="form-control" name="amount" min="0"></td>' +
|
||||||
|
'<td><input class="form-control" name="moderator_ticket" disabled></td>' +
|
||||||
|
'<td><input class="form-control" name="insurance_amount" disabled ></td>' +
|
||||||
|
'<td><input type="number" class="form-control" name="home_visit_fees" min="0"></td>' +
|
||||||
'<td> ' + actions1 + '</td>' +
|
'<td> ' + actions1 + '</td>' +
|
||||||
'</tr>';
|
'</tr>';
|
||||||
$("#user_wallet_wallet").append(row);
|
$("#prestations").append(row);
|
||||||
$("#user_wallet_wallet tbody tr").eq(index + 1).find(".add, .edit").toggle();
|
$("#prestations tbody tr").eq(index + 1).find(".add, .edit").toggle();
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
});
|
});
|
||||||
// Add row on add button click
|
// Add row on add button click
|
||||||
$(document).on("click", ".add1", function () {
|
$(document).on("click", ".add1", function () {
|
||||||
var empty = false;
|
var empty = false;
|
||||||
var input = $(this).parents("tr").find('input[type="number"]');
|
var input = $(this).parents("tr").find('input');
|
||||||
var min = parseFloat($(this).parents("tr").find('input[id="min"]').first().val());
|
var select = $(this).parents("tr").find('select');
|
||||||
var max = parseFloat($(this).parents("tr").find('input[id="max"]').first().val());
|
|
||||||
|
|
||||||
input.each(function () {
|
input.each(function () {
|
||||||
if ($(this).attr('id') == 'min') {
|
if (!$(this)[0].checkValidity()) {
|
||||||
if (min >= max) {
|
$(this).addClass("error");
|
||||||
$(this).addClass("error");
|
$(this)[0].reportValidity();
|
||||||
$(this)[0].reportValidity();
|
empty = true;
|
||||||
empty = true;
|
|
||||||
} else {
|
|
||||||
$(this).removeClass("error");
|
|
||||||
}
|
|
||||||
} else if ($(this).attr('id') == 'max') {
|
|
||||||
if (max <= min) {
|
|
||||||
$(this).addClass("error");
|
|
||||||
$(this)[0].reportValidity();
|
|
||||||
empty = true;
|
|
||||||
} else {
|
|
||||||
$(this).removeClass("error");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (!$(this)[0].checkValidity()) {
|
$(this).removeClass("error");
|
||||||
$(this).addClass("error");
|
|
||||||
$(this)[0].reportValidity();
|
|
||||||
empty = true;
|
|
||||||
} else {
|
|
||||||
$(this).removeClass("error");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$(this).parents("tr").find(".error").first().focus();
|
$(this).parents("tr").find(".error").first().focus();
|
||||||
|
@ -375,16 +493,24 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
||||||
$(this).parents("tr").find(".add, .edit").toggle();
|
$(this).parents("tr").find(".add, .edit").toggle();
|
||||||
$(".new1").removeAttr("disabled");
|
$(".new1").removeAttr("disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
select.each(function () {
|
||||||
|
$(this).parent("td").html($(this).find('option:selected').text()).attr("value",$(this).val());
|
||||||
|
});
|
||||||
});
|
});
|
||||||
// Edit row on edit button click
|
// Edit row on edit button click
|
||||||
$(document).on("click", ".edit1", function () {
|
$(document).on("click", ".edit1", function () {
|
||||||
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
|
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
$(this).html('<input type="number" required class="form-control" min="0" id="min" value="' + $(this).text() + '">');
|
$(this).html('<select class="form-control" name="act_id" required >'+ getActsOptions($(this).attr("value"))+ '</select>');
|
||||||
if (index == 1)
|
if (index == 1)
|
||||||
$(this).html('<input type="number" required class="form-control" id="max" value="' + $(this).text() + '">');
|
$(this).html('<input type="number" required class="form-control" name="amount" min="0" value="' + $(this).text() + '">');
|
||||||
if (index == 2)
|
if (index == 2)
|
||||||
$(this).html('<input type="number" required class="form-control" min="0" value="' + $(this).text() + '">');
|
$(this).html('<input class="form-control" name="moderator_ticket" disabled value="' + $(this).text() + '">');
|
||||||
|
if (index == 3)
|
||||||
|
$(this).html('<input class="form-control" name="insurance_amount" disabled value="' + $(this).text() + '">');
|
||||||
|
if (index == 4)
|
||||||
|
$(this).html('<input type="number" class="form-control" name="home_visit_fees" min="0" value="' + $(this).text() + '">');
|
||||||
});
|
});
|
||||||
$(this).parents("tr").find(".add, .edit").toggle();
|
$(this).parents("tr").find(".add, .edit").toggle();
|
||||||
$(".new1").attr("disabled", "disabled");
|
$(".new1").attr("disabled", "disabled");
|
||||||
|
@ -394,63 +520,46 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
||||||
$(this).parents("tr").remove();
|
$(this).parents("tr").remove();
|
||||||
$(".new1").removeAttr("disabled");
|
$(".new1").removeAttr("disabled");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Table Examens
|
||||||
|
|
||||||
|
var actions2 = $("#exams td:last-child").html();
|
||||||
// Paliers nationaux
|
// Append table with add row form on add new button click
|
||||||
|
$(".new2").click(function () {
|
||||||
// Table 7
|
if (!actions2) {
|
||||||
var actions7 = $("#user_wallet_wallet_national td:last-child").html();
|
actions2 = '<a class="add add2" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
||||||
// Append table with add row form on add new button click
|
' <a class="edit edit2" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
||||||
$(".new7").click(function () {
|
' <a class="delete delete2" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>';
|
||||||
if (!actions7) {
|
|
||||||
actions7 = '<a class="add add7" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
|
||||||
' <a class="edit edit7" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
|
||||||
' <a class="delete delete7" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>';
|
|
||||||
}
|
}
|
||||||
$(this).attr("disabled", "disabled");
|
$(this).attr("disabled", "disabled");
|
||||||
var index = $("#user_wallet_wallet_national tbody tr:last-child").index();
|
var index = $("#exams tbody tr:last-child").index();
|
||||||
var row = '<tr>' +
|
var row = '<tr>' +
|
||||||
'<td><input type="number" required min="0" class="form-control" name="min" id="min"></td>' +
|
'<td>' +
|
||||||
'<td><input type="number" required class="form-control" name="max" id="max"></td>' +
|
'<select required class="form-control" name="act_id" >' +
|
||||||
'<td><input type="number" required class="form-control" name="taux" id="taux"></td>' +
|
getActsOptions(null)+
|
||||||
'<td> ' + actions7 + '</td>' +
|
'</select>' +
|
||||||
'</tr>';
|
'</td>' +
|
||||||
$("#user_wallet_wallet_national").append(row);
|
'<td><input class="form-control" name="description"></td>' +
|
||||||
$("#user_wallet_wallet_national tbody tr").eq(index + 1).find(".add, .edit").toggle();
|
'<td><input class="form-control" name="quantity" min="1" step="1" type="number"></td>' +
|
||||||
|
'<td> ' + actions2 + '</td>' +
|
||||||
|
'</tr>';
|
||||||
|
$("#exams").append(row);
|
||||||
|
$("#exams tbody tr").eq(index + 1).find(".add, .edit").toggle();
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
});
|
});
|
||||||
// Add row on add button click
|
// Add row on add button click
|
||||||
$(document).on("click", ".add7", function () {
|
$(document).on("click", ".add2", function () {
|
||||||
var empty = false;
|
var empty = false;
|
||||||
var input = $(this).parents("tr").find('input[type="number"]');
|
var input = $(this).parents("tr").find('input');
|
||||||
var min = parseFloat($(this).parents("tr").find('input[id="min"]').first().val());
|
var select = $(this).parents("tr").find('select');
|
||||||
var max = parseFloat($(this).parents("tr").find('input[id="max"]').first().val());
|
|
||||||
|
|
||||||
input.each(function () {
|
input.each(function () {
|
||||||
if ($(this).attr('id') == 'min') {
|
if (!$(this)[0].checkValidity()) {
|
||||||
if (min >= max) {
|
$(this).addClass("error");
|
||||||
$(this).addClass("error");
|
$(this)[0].reportValidity();
|
||||||
$(this)[0].reportValidity();
|
empty = true;
|
||||||
empty = true;
|
|
||||||
} else {
|
|
||||||
$(this).removeClass("error");
|
|
||||||
}
|
|
||||||
} else if ($(this).attr('id') == 'max') {
|
|
||||||
if (max <= min) {
|
|
||||||
$(this).addClass("error");
|
|
||||||
$(this)[0].reportValidity();
|
|
||||||
empty = true;
|
|
||||||
} else {
|
|
||||||
$(this).removeClass("error");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (!$(this)[0].checkValidity()) {
|
$(this).removeClass("error");
|
||||||
$(this).addClass("error");
|
|
||||||
$(this)[0].reportValidity();
|
|
||||||
empty = true;
|
|
||||||
} else {
|
|
||||||
$(this).removeClass("error");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$(this).parents("tr").find(".error").first().focus();
|
$(this).parents("tr").find(".error").first().focus();
|
||||||
|
@ -459,26 +568,114 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
||||||
$(this).parent("td").html($(this).val());
|
$(this).parent("td").html($(this).val());
|
||||||
});
|
});
|
||||||
$(this).parents("tr").find(".add, .edit").toggle();
|
$(this).parents("tr").find(".add, .edit").toggle();
|
||||||
$(".new7").removeAttr("disabled");
|
$(".new2").removeAttr("disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
select.each(function () {
|
||||||
|
$(this).parent("td").html($(this).find('option:selected').text()).attr("value",$(this).val());
|
||||||
|
});
|
||||||
});
|
});
|
||||||
// Edit row on edit button click
|
// Edit row on edit button click
|
||||||
$(document).on("click", ".edit7", function () {
|
$(document).on("click", ".edit2", function () {
|
||||||
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
|
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
$(this).html('<input type="number" required class="form-control" min="0" id="min" value="' + $(this).text() + '">');
|
$(this).html('<select class="form-control" name="act_id" required >'+ getActsOptions($(this).attr("value"))+ '</select>');
|
||||||
if (index == 1)
|
if (index == 1)
|
||||||
$(this).html('<input type="number" required class="form-control" id="max" value="' + $(this).text() + '">');
|
$(this).html('<input class="form-control" name="description" value="' + $(this).text() + '">');
|
||||||
if (index == 2)
|
if (index == 2)
|
||||||
$(this).html('<input type="number" required class="form-control" min="0" value="' + $(this).text() + '">');
|
$(this).html('<input class="form-control" name="quantity" min="1" step="1" value="' + $(this).text() + '">');
|
||||||
});
|
});
|
||||||
$(this).parents("tr").find(".add, .edit").toggle();
|
$(this).parents("tr").find(".add, .edit").toggle();
|
||||||
$(".new7").attr("disabled", "disabled");
|
$(".new2").attr("disabled", "disabled");
|
||||||
|
});
|
||||||
|
// Delete row on delete button click
|
||||||
|
$(document).on("click", ".delete2", function () {
|
||||||
|
$(this).parents("tr").remove();
|
||||||
|
$(".new2").removeAttr("disabled");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Table prescription
|
||||||
|
|
||||||
|
function getDrugAndDevicesOptions(selectedValue) {
|
||||||
|
var actsOptions = '';
|
||||||
|
<?php foreach ($drugs_and_devices->result() as $a ) {?>
|
||||||
|
var id = <?= $a->id ?>;
|
||||||
|
var selected = id === parseInt(selectedValue) ? 'selected' : '';
|
||||||
|
actsOptions += (`<option value=<?= $a->id ?> ${selected} > <?= $a->name ?> </option>`);
|
||||||
|
<?php } ?>
|
||||||
|
return actsOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Table prescriptions
|
||||||
|
var actions3 = $("#prescriptions td:last-child").html();
|
||||||
|
// Append table with add row form on add new button click
|
||||||
|
$(".new3").click(function () {
|
||||||
|
if (!actions3) {
|
||||||
|
actions3 = '<a class="add add3" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
||||||
|
' <a class="edit edit3" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
||||||
|
' <a class="delete delete3" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>';
|
||||||
|
}
|
||||||
|
$(this).attr("disabled", "disabled");
|
||||||
|
var index = $("#prescriptions tbody tr:last-child").index();
|
||||||
|
var row = '<tr>' +
|
||||||
|
'<td>' +
|
||||||
|
'<select required class="form-control" name="drug_or_device_id" >' +
|
||||||
|
getDrugAndDevicesOptions(null)+
|
||||||
|
'</select>' +
|
||||||
|
'</td>' +
|
||||||
|
'<td><input required class="form-control" name="dosage" ></td>' +
|
||||||
|
'<td><input type="number" required class="form-control" min="1" step="1" name="quantity"></td>' +
|
||||||
|
'<td> ' + actions3 + '</td>' +
|
||||||
|
'</tr>';
|
||||||
|
$("#prescriptions").append(row);
|
||||||
|
$("#prescriptions tbody tr").eq(index + 1).find(".add, .edit").toggle();
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
});
|
||||||
|
// Add row on add button click
|
||||||
|
$(document).on("click", ".add3", function () {
|
||||||
|
var empty = false;
|
||||||
|
var input = $(this).parents("tr").find('input');
|
||||||
|
var select = $(this).parents("tr").find('select');
|
||||||
|
|
||||||
|
input.each(function () {
|
||||||
|
if (!$(this)[0].checkValidity()) {
|
||||||
|
$(this).addClass("error");
|
||||||
|
$(this)[0].reportValidity();
|
||||||
|
empty = true;
|
||||||
|
} else {
|
||||||
|
$(this).removeClass("error");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$(this).parents("tr").find(".error").first().focus();
|
||||||
|
if (!empty) {
|
||||||
|
input.each(function () {
|
||||||
|
$(this).parent("td").html($(this).val());
|
||||||
|
});
|
||||||
|
$(this).parents("tr").find(".add, .edit").toggle();
|
||||||
|
$(".new3").removeAttr("disabled");
|
||||||
|
}
|
||||||
|
select.each(function () {
|
||||||
|
$(this).parent("td").html($(this).find('option:selected').text()).attr("value",$(this).val());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
// Edit row on edit button click
|
||||||
|
$(document).on("click", ".edit3", function () {
|
||||||
|
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
|
||||||
|
if (index == 0)
|
||||||
|
$(this).html('<select class="form-control" name="drug_or_device_id" required >'+ getDrugAndDevicesOptions($(this).attr("value"))+ '</select>');
|
||||||
|
if (index == 1)
|
||||||
|
$(this).html('<input required class="form-control" name="dosage" value="' + $(this).text() + '">');
|
||||||
|
if (index == 2)
|
||||||
|
$(this).html('<input type="number" required class="form-control" name="quantity" min="1" step="1" value="' + $(this).text() + '">');
|
||||||
|
});
|
||||||
|
$(this).parents("tr").find(".add, .edit").toggle();
|
||||||
|
$(".new3").attr("disabled", "disabled");
|
||||||
});
|
});
|
||||||
// Delete row on delete button click
|
// Delete row on delete button click
|
||||||
$(document).on("click", ".delete7", function () {
|
$(document).on("click", ".delete3", function () {
|
||||||
$(this).parents("tr").remove();
|
$(this).parents("tr").remove();
|
||||||
$(".new7").removeAttr("disabled");
|
$(".new3").removeAttr("disabled");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -44,9 +44,9 @@
|
||||||
<div class="box-header">
|
<div class="box-header">
|
||||||
<h3 class="box-title"><?= $this->lang->line('export_health_care_sheets_list') ?></h3>
|
<h3 class="box-title"><?= $this->lang->line('export_health_care_sheets_list') ?></h3>
|
||||||
<div class="box-tools">
|
<div class="box-tools">
|
||||||
<a class="btn btn-primary" href="<?= current_url().('?action=new')?>">
|
<button class="btn btn-success" data-toggle="modal" data-target="#modal-add">
|
||||||
<?= $this->lang->line('new_care_sheet'); ?>
|
<?= $this->lang->line('new_care_sheet'); ?>
|
||||||
</a>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-body" style="overflow-x:auto;">
|
<div class="box-body" style="overflow-x:auto;">
|
||||||
|
@ -72,6 +72,40 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" id="modal-add">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
<h3 class="modal-title"><?= $this->lang->line('new_care_sheet'); ?></h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="search-form">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-form-label"><?= $this->lang->line('finding_insured_by'); ?></label>
|
||||||
|
<select class="form-control" name="option">
|
||||||
|
<option value="name"><?= $this->lang->line('Nom'); ?></option>
|
||||||
|
<option value="phone"><?= $this->lang->line('Telephone'); ?></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" required class="form-control" name="query">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default pull-left"
|
||||||
|
data-dismiss="modal"><?= $this->lang->line('Fermer'); ?></button>
|
||||||
|
<button type="button" id="check-insured"
|
||||||
|
class="btn btn-primary"><?= $this->lang->line('Continuer'); ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
@ -208,3 +242,38 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$('#check-insured').click(function () {
|
||||||
|
if ($('#search-form')[0].checkValidity()) {
|
||||||
|
let option = $('#search-form').find('select[name="option"]').val();
|
||||||
|
let query = $('#search-form').find('input[name="query"]').val();
|
||||||
|
$.ajax({
|
||||||
|
url: '<?= base_url('NanoHealthController/getInsured')?>',
|
||||||
|
type: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
data: { network_id : "<?= $id_network ?? null ?>" , query : query , option : option},
|
||||||
|
success: function (data) {
|
||||||
|
if(data.status === 200){
|
||||||
|
if (data.response.length === 0 ) {
|
||||||
|
toastr.error("<?= $this->lang->line('insured_not_found')?>", "<?= $this->lang->line('request_error')?>");
|
||||||
|
}else{
|
||||||
|
// Set data
|
||||||
|
sessionStorage.setItem('insured' , JSON.stringify(data.response));
|
||||||
|
window.location = '<?= current_url().('?action=new')?>';
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
toastr.error(data.error , "<?= $this->lang->line('request_error')?>");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (resultat, statut, error) {
|
||||||
|
console.log(resultat + " " + error);
|
||||||
|
toastr.error("<?= $this->lang->line('error_message')?>", "<?= $this->lang->line('request_error')?>");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#search-form')[0].reportValidity();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue