Add awaiting more information while reject insurances subscription

This commit is contained in:
Djery-Tom 2021-11-05 17:15:59 +01:00
parent 1120965566
commit d2a824376e
7 changed files with 112 additions and 8 deletions

View File

@ -215,6 +215,7 @@ class NanoHealthController extends CI_Controller
$body = new \stdClass(); $body = new \stdClass();
$body->agent_id = $this->input->post('agent_id'); $body->agent_id = $this->input->post('agent_id');
$body->nh_validating_agent_id = $this->input->post('nh_validating_agent_id'); $body->nh_validating_agent_id = $this->input->post('nh_validating_agent_id');
$body->type = $this->input->post('type');
$body->reason = $this->input->post('reason'); $body->reason = $this->input->post('reason');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));

View File

@ -742,4 +742,9 @@ $lang['manage_insured'] = "Insured management";
$lang['PAID'] = "Paid"; $lang['PAID'] = "Paid";
$lang['insured_id'] = "Insured ID"; $lang['insured_id'] = "Insured ID";
$lang['subscription_id'] = "Subscription ID"; $lang['subscription_id'] = "Subscription ID";
$lang['more_information'] = "More information";
$lang['more_information_subscription'] = "More information for the subscription";
$lang['message_rule'] = "The message must not exceed 500 characters";
$lang['subscription_more_information'] = "Subscription awaiting additional information";
$lang['AWAITING_FURTHER_INFORMATION'] = "Awaiting further information";
?> ?>

View File

@ -754,4 +754,9 @@ $lang['manage_insured'] = "Gestion des assurés";
$lang['PAID'] = "Payée"; $lang['PAID'] = "Payée";
$lang['insured_id'] = "ID de l'assuré"; $lang['insured_id'] = "ID de l'assuré";
$lang['souscription_id'] = "ID de la souscription"; $lang['souscription_id'] = "ID de la souscription";
$lang['more_information'] = "Complément d'informations";
$lang['more_information_subscription'] = "Complément d'informations pour la subscription";
$lang['message_rule'] = "Le message ne doit pas dépasser 500 caractères";
$lang['subscription_more_information'] = "Souscription en attente de complement d'informations";
$lang['AWAITING_FURTHER_INFORMATION'] = "En attente d'informations complémentaires"
?> ?>

View File

@ -1749,7 +1749,7 @@ class User_model extends CI_Model
public function get_simple_user($phone, $name , $country = null){ public function get_simple_user($phone, $name , $country = null){
$end_query = $country ? "AND countries.name = '".$country."'" : ''; $end_query = $country ? "AND countries.name = '".$country."'" : '';
$query = $this->db->query("SELECT users.id AS id_user,users.active AS etat,users.lastname,users.phone,users.email,users.adresse,users.date_created, $query = $this->db->query("SELECT users.id AS id_user,users.active AS etat,users.lastname,users.phone,users.email,users.adresse,users.date_created,
networks.name AS network,countries.name AS country,i.firstname as id_firstname , i.lastname as id_lastname , i.birth_date , i.town as id_town , i.country as id_country, networks.name AS network,countries.name AS country,i.firstname as id_firstname , i.lastname as id_lastname , i.birth_date , i.gender, i.town as id_town , i.country as id_country,
i.identity_document , i.id_identity_document ,i.expiry_date_document , i.status, i.user_image , i.document_image_back , i.document_image_front i.identity_document , i.id_identity_document ,i.expiry_date_document , i.status, i.user_image , i.document_image_back , i.document_image_front
FROM users FROM users
INNER JOIN networks ON networks.id=users.network_id INNER JOIN networks ON networks.id=users.network_id

View File

@ -413,18 +413,24 @@
?> ?>
<label class="text-center text-muted" style="padding: 10px"> Identification </label> <label class="text-center text-muted" style="padding: 10px"> Identification </label>
<div class="row"> <div class="row">
<div class="form-group col-sm-6"> <div class="form-group col-sm-5">
<label <label
class="col-form-label"><?php echo $this->lang->line('Nom'); ?></label> class="col-form-label"><?php echo $this->lang->line('Nom'); ?></label>
<input class="form-control" readonly <input class="form-control" readonly
value="<?php echo $row->id_firstname ?>"> value="<?php echo $row->id_firstname ?>">
</div> </div>
<div class="form-group col-sm-6"> <div class="form-group col-sm-5">
<label <label
class="col-form-label"><?php echo $this->lang->line('Prénom'); ?></label> class="col-form-label"><?php echo $this->lang->line('Prénom'); ?></label>
<input class="form-control" readonly <input class="form-control" readonly
value="<?php echo $row->id_lastname ?>"> value="<?php echo $row->id_lastname ?>">
</div> </div>
<div class="form-group col-sm-2">
<label
class="col-form-label"><?php echo $this->lang->line('gender'); ?></label>
<input class="form-control" readonly
value="<?php echo $row->gender ?>">
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="form-group col-sm-4"> <div class="form-group col-sm-4">
@ -616,19 +622,25 @@
?> ?>
<label class="text-center text-muted" style="padding: 10px"> Identification </label> <label class="text-center text-muted" style="padding: 10px"> Identification </label>
<div class="row"> <div class="row">
<div class="form-group col-sm-6"> <div class="form-group col-sm-5">
<label <label
class="col-form-label"><?php echo $this->lang->line('Nom'); ?></label> class="col-form-label"><?php echo $this->lang->line('Nom'); ?></label>
<input class="form-control" readonly <input class="form-control" readonly
value="<?php echo $row->id_firstname ?>"> value="<?php echo $row->id_firstname ?>">
</div> </div>
<div class="form-group col-sm-6"> <div class="form-group col-sm-5">
<label <label
class="col-form-label"><?php echo $this->lang->line('Prénom'); ?></label> class="col-form-label"><?php echo $this->lang->line('Prénom'); ?></label>
<input class="form-control" readonly <input class="form-control" readonly
value="<?php echo $row->id_lastname ?>"> value="<?php echo $row->id_lastname ?>">
</div> </div>
<div class="form-group col-sm-2">
<label
class="col-form-label"><?php echo $this->lang->line('gender'); ?></label>
<input class="form-control" readonly
value="<?php echo $row->gender ?>">
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="form-group col-sm-4"> <div class="form-group col-sm-4">

View File

@ -17,10 +17,15 @@
<?= $this->lang->line('subscriptions') . ' :: ' . $this->lang->line('subscription_detail') . ' - ' . $insurance_subscription_id; ?> <?= $this->lang->line('subscriptions') . ' :: ' . $this->lang->line('subscription_detail') . ' - ' . $insurance_subscription_id; ?>
<div class="pull-right"> <div class="pull-right">
<?php if($subscription->state == 'UNDER_VALIDATION') { ?> <?php if(in_array($subscription->state,['UNDER_VALIDATION','AWAITING_FURTHER_INFORMATION'])) { ?>
<button id="accept-subscription" class="btn btn-success" > <button id="accept-subscription" class="btn btn-success" >
<?= $this->lang->line('accept') ?> <?= $this->lang->line('accept') ?>
</button> </button>
<?php if($subscription->state == 'UNDER_VALIDATION') { ?>
<button class="btn btn-warning" data-toggle="modal" data-target="#more-information-modal">
<?= $this->lang->line('more_information') ?>
</button>
<?php } ?>
<button class="btn btn-danger" data-toggle="modal" data-target="#reject-modal"> <button class="btn btn-danger" data-toggle="modal" data-target="#reject-modal">
<?= $this->lang->line('reject') ?> <?= $this->lang->line('reject') ?>
</button> </button>
@ -326,6 +331,36 @@
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="more-information-modal">
<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">&times;</span>
</button>
<h4 class="modal-title"><?= $this->lang->line('more_information_subscription') ?></h4>
</div>
<div class="modal-body">
<form id="more-information-form">
<div class="row">
<div class="col-lg-12">
<div class="form-group">
<label class="col-form-label">Message</label>
<textarea required class="form-control" rows="5" name="message"></textarea>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-danger pull-left"
id="more-information-subscription"><?= $this->lang->line('Confirmer'); ?></button>
<button type="button" class="btn btn-default pull-right"
data-dismiss="modal"><?= $this->lang->line('Fermer'); ?></button>
</div>
</div>
</div>
</div>
</section> </section>
</div> </div>
@ -472,7 +507,8 @@
<?php } else { ?> <?php } else { ?>
"agent_id": "<?= $this->session->userdata('agent_id') ?>", "agent_id": "<?= $this->session->userdata('agent_id') ?>",
<?php } ?> <?php } ?>
"reason": reason "reason": reason,
"type" : "NORMAL"
}, },
success: function (data) { success: function (data) {
if (data.status === 200) { if (data.status === 200) {
@ -499,4 +535,49 @@
} }
}); });
$('#more-information-subscription').click(function () {
if ($('#more-information-form')[0].checkValidity()) {
let message = $("textarea[name=message]").val();
if(message.length > 500 ){
toastr.warning( "<?= $this->lang->line('message_rule')?>", "<?= $this->lang->line('management_rule')?>");
}else{
$.ajax({
url: '<?php echo base_url('NanoHealthController/rejectSubscription')?>',
type: 'POST',
dataType: 'json',
data: {
"subscription_id": "<?=$subscription->id ?>",
<?php if(isset($category) && $category == 'AGENT') { ?>
"nh_validating_agent_id": "<?= $this->session->userdata('agent_id') ?>",
<?php } else { ?>
"agent_id": "<?= $this->session->userdata('agent_id') ?>",
<?php } ?>
"reason": message,
"type" : "MORE_INFORMATION"
},
success: function (data) {
if (data.status === 200) {
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('subscription_more_information')?>",
text: "<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(() => {
location.reload();
});
} else {
toastr.error(data.error, "<?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')?>");
}
});
}
} else {
$('#more-information-form')[0].reportValidity();
}
});
</script> </script>