Fix bugs while making consulation as agent

This commit is contained in:
Djery-Tom 2022-06-02 16:07:58 +01:00
parent fb76484dea
commit b94163e756
8 changed files with 167 additions and 175 deletions

View File

@ -689,7 +689,7 @@ $lang['add_act'] = "Add a procedure";
$lang['edit_act'] = "Edit an act";
$lang['billing_type'] = "Billing type";
$lang['authorization_type'] = "authorization type";
$lang['subscriptions_of_the_last_12_months'] = "Subscriptions and care requests of the last 12 months";
$lang['subscriptions_of_the_last_12_months'] = "Subscriptions of the last 12 months";
$lang['subscriptions_historic'] = "Subscription history";
$lang['PACKAGE'] = "Package";
$lang['UNIT_PRICE'] = "Unit price";
@ -945,5 +945,6 @@ $lang['UNPAID'] = "Unpaid";
$lang['UNDER_RENEW'] = "Under renew";
$lang['STOPPED'] = "Stopped";
$lang['profile_image'] = "Profile image";
$lang['open_wallet_at_mobile_login'] = "Open wallet at mobile login"
$lang['open_wallet_at_mobile_login'] = "Open wallet at mobile login";
$lang['MODIFIED'] = "Modified";
?>

View File

@ -700,7 +700,7 @@ $lang['add_act'] = "Ajouter un acte";
$lang['edit_act'] = "Modifier un acte";
$lang['billing_type'] = "Type de facturation";
$lang['authorization_type'] = "Type d'autorisation";
$lang['subscriptions_of_the_last_12_months'] = "Souscriptions et demandes de prise en charge des 12 derniers mois";
$lang['subscriptions_of_the_last_12_months'] = "Souscriptions des 12 derniers mois";
$lang['subscriptions_historic'] = "Historique des souscriptions";
$lang['PACKAGE'] = "Forfait";
$lang['UNIT_PRICE'] = "Prix unitaire";
@ -938,7 +938,7 @@ $lang['PARTIALLY_PAID'] = "Partiellement payée";
$lang['SUSPENDED'] = "Suspendue";
$lang['amount_required'] = "Le montant est requis";
$lang['reminder_delay_days'] = "Délai de relance de paiement d'une facture en jours";
$lang['suspension_delay_days_after_reminder'] = "Délai de suspension apres le délai de relance de jours";
$lang['suspension_delay_days_after_reminder'] = "Délai de suspension apres le délai de relance en jours";
$lang['unit_value'] = "Valeur de l'unité";
$lang['unit_value_required'] = "La valeur de l'unité est requise";
$lang['issuer_agent'] = "Agent emetteur";
@ -954,5 +954,6 @@ $lang['UNPAID'] = "Non Payée";
$lang['UNDER_RENEW'] = "En cours de renouvellement";
$lang['STOPPED'] = "Arretée";
$lang['profile_image'] = "Photo de profil";
$lang['open_wallet_at_mobile_login'] = "Ouverture du wallet à la connexion mobile"
$lang['open_wallet_at_mobile_login'] = "Ouverture du wallet à la connexion mobile";
$lang['MODIFIED'] = "Modifiée";
?>

View File

@ -220,6 +220,14 @@
<span><?= $this->lang->line('drugs_and_devices'); ?></span>
</a>
</li>
<li class="<?php if ($active == "wallet_validating_agents") {
echo "active";
} ?>">
<a href="<?= base_url('Hyperviseur_dash/validating_agents') ?>">
<i class="fa fa-user"></i>
<span><?= $this->lang->line('validating_agents'); ?></span>
</a>
</li>
<li class="<?php if ($active == "wallet_validating_doctors") {
echo "active";
} ?>">
@ -236,14 +244,6 @@
<span><?= $this->lang->line('controllers_doctors'); ?></span>
</a>
</li>
<li class="<?php if ($active == "wallet_validating_agents") {
echo "active";
} ?>">
<a href="<?= base_url('Hyperviseur_dash/validating_agents') ?>">
<i class="fa fa-user"></i>
<span><?= $this->lang->line('validating_agents'); ?></span>
</a>
</li>
<li class="<?php if ($active == "wallet_insured") {
echo "active";
} ?>">

View File

@ -129,14 +129,17 @@
if($this->session->userdata('site_lang')=='french'){
?>
<form style="display: inline-block;" action="<?= base_url('flipbook/fr/super/') ?>" method="get" target="_blank">
<input style="color: black" type="submit" value="Superviseur" class="btn btn-light" name="profil" id="super" />
<input style="color: black" type="submit" value="Notions générales" class="btn btn-light" name="profil" id="super" />
</form>
<form style="display: inline-block;" action="<?= base_url('flipbook/fr/hyper/') ?>" method="get" target="_blank">
<input style="color: black" type="submit" value="Hyperviseur" class="btn btn-light" name="profil" id="hyper" />
<input style="color: black" type="submit" value="Transfert d'argent" class="btn btn-light" name="profil" id="hyper" />
</form>
<form style="display: inline-block;" action="<?= base_url('flipbook/fr/admin/') ?>" method="get" target="_blank">
<input style="color: black" type="submit" value="Administrateur" class="btn btn-light" name="profil" id="admin" />
<input style="color: black" type="submit" value="Nano Crédit" class="btn btn-light" name="profil" id="admin" />
</form>
<form style="display: inline-block;" action="<?= base_url('flipbook/fr/admin/') ?>" method="get" target="_blank">
<input style="color: black" type="submit" value="Nano Santé" class="btn btn-light" name="profil" id="admin" />
</form>
<?php
}elseif ($this->session->userdata('site_lang')=='english'){
?>

View File

@ -267,8 +267,8 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
toastr.options.closeDuration = 5000;
toastr.options.closeEasing = 'swing';
let network_id = "<?= $network_id ?>"
var acts = []
$(document).ready(function (){
$('#patient').hide();
$('#patient-details').hide();
@ -345,26 +345,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
}
// Fetch acts
$.ajax({
url: '<?= base_url('NanoHealthController/getActs')?>',
type: 'POST',
dataType: 'json',
data: {
"network_id": "<?=$network_id?>", "user_id": currentInsurance.user.id, "beneficiary_id": beneficiary == null ? null : beneficiary[0].id,
},
success: function (data) {
if(data.status === 200){
acts = data.response
$('#patient-details').show();
}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')?>");
}
});
fetchActs(currentInsurance.user.id, beneficiary == null ? null : beneficiary[0].id);
});
}else{
history.back()
@ -468,68 +449,14 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
});
</script>
<!-- Common scripts-->
<?php $this->load->view('nano_health/agent/scripts') ?>
<script type="text/javascript">
// Paliers scripts
$(document).ready(function () {
function getActsOptions(selectedValue , type) {
var actsOptions = '';
acts.forEach(function (a) {
if(type === a.type) {
var selected = a.id === parseInt(selectedValue) ? 'selected' : '';
actsOptions += (`<option value=${a.id} ${selected} > ${a.name} </option>`);
}
})
return actsOptions;
}
function calculatePrestationsAmount(){
$('#amount').on('input',fetchPrestationsAmount)
$('#fees').on('input',fetchPrestationsAmount)
}
function fetchPrestationsAmount(){
var amount = parseFloat($("#amount").val());
var fees = parseFloat($("#fees").val());
fees = isNaN(fees) ? 0 : fees;
var care_condition = $('#sheet-form').find('select[name="care_condition"]').val();
if(isNaN(amount + fees)){
$('#moderator-ticket').val('');
$('#insurance-amount').val('');
}else{
$.ajax({
url: '<?= base_url('NanoHealthController/calculateHealthCareSheetPerformancesAmount')?>',
type: 'POST',
dataType: 'json',
data: {
"network_id" : "<?= $network_id ?>", "amount": (amount + fees), "care_condition": care_condition
},
success: function (data) {
if(data.status === 200){
$('#moderator-ticket').val(data.response.moderator_ticket);
$('#insurance-amount').val(data.response.insurance_amount);
}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')?>");
}
});
}
}
function autoFetchPrestationAmount(){
$('#act').on('change',function () {
let amount = $(this).find(":selected").attr('amount')
$("#amount").val(amount);
})
}
$('[data-toggle="tooltip"]').tooltip();
var actions1 = $("#prestations td:last-child").html();
// Append table with add row form on add new button click
$(".new1").click(function () {
@ -585,16 +512,21 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
}
select.each(function () {
$(this).parent("td").html($(this).find('option:selected').text()).attr("value",$(this).val());
let selected = $(this).find('option:selected')
$(this).parent("td").html(selected.text()).attr("value",$(this).val()).attr("amount",selected.data('amount'));
});
});
// Edit row on edit button click
$(document).on("click", ".edit1", function () {
let amount = NaN
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
if (index == 0)
if (index == 0){
$(this).html('<select class="form-control" name="act_id" required >'+ getActsOptions($(this).attr("value"),'CONSULTATION')+ '</select>');
if (index == 1)
$(this).html('<input type="number" required class="form-control" name="amount" min="0" id="amount" value="' + $(this).text() + '">');
amount = parseFloat($(this).attr("amount"))
}
if (index == 1){
$(this).html(`<input type="number" required class="form-control" name="amount" min="0" id="amount" ${(isNaN(amount) ? '' : 'disabled')} value="${$(this).text()}">`);
}
if (index == 2)
$(this).html('<input type="number" class="form-control" name="home_visit_fees" min="0" value="' + $(this).text() + '">');
if (index == 3)
@ -612,7 +544,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
$(this).parents("tr").remove();
$(".new1").removeAttr("disabled");
});
// Table Examens
var actions2 = $("#exams td:last-child").html();
@ -685,8 +617,8 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
$(this).parents("tr").remove();
$(".new2").removeAttr("disabled");
});
// Table prescription
function getDrugAndDevicesOptions(selectedValue) {

View File

@ -178,7 +178,6 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
<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>
@ -281,6 +280,8 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
toastr.options.closeDuration = 5000;
toastr.options.closeEasing = 'swing';
let network_id = "<?= $network_id ?>"
var acts = []
$(document).ready(function (){
$('#consultation').hide();
$('#patient-details').hide();
@ -332,10 +333,11 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
});
});
let beneficiary_id = null
$('#sheet-form').find('select[name="insured_id"]').change(function () {
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();
beneficiary_id = parseInt($(this).val()) === 0 ? null : $(this).val();
$.each(insurance, function (i, item) {
currentInsurance = item;
$.ajax({
@ -414,7 +416,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
$("#prestations tbody").children().remove();
$.each(consultation.performances, function (j, it) {
$('#prestations').append('<tr>' +
'<td id="'+it.id+'" act_id="'+it.act.id+'">'+(it.act.name|| '')+'</td>' +
'<td id="'+it.id+'" act_id="'+it.act.id+'" amount="'+it.act.amount+'">'+(it.act.name|| '')+'</td>' +
'<td>'+(parseFloat(it.amount) || '')+'</td>' +
'<td>'+(parseFloat(it.home_visit_fees) || '')+'</td>' +
'<td>'+(it.moderator_ticket_formatted || '')+'</td>' +
@ -432,7 +434,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
$('#exams').append('<tr>' +
'<td id="'+it.id+'" act_id="'+it.act.id+'">'+(it.act.name|| '')+'</td>' +
'<td>'+(it.description || '')+'</td>' +
'<td>'+(it.quantity || '')+'</td>' +
// '<td>'+(it.quantity || '')+'</td>' +
'<td>'+actions2+'</td>' +
'</tr>')
});
@ -454,6 +456,8 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
});
$('#patient-details').show();
fetchActs(currentInsurance.user.id, beneficiary_id);
}
});
}else{
@ -499,8 +503,8 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
}
if (index === 1)
arrayItem['description'] = $(item).html();
if (index === 2)
arrayItem['quantity'] = parseFloat($(item).html());
// if (index === 2)
// arrayItem['quantity'] = parseFloat($(item).html());
});
exams.push(arrayItem);
});
@ -573,59 +577,15 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
});
</script>
<!-- Common scripts-->
<?php $this->load->view('nano_health/agent/scripts') ?>
<script type="text/javascript">
// Paliers scripts
$(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;
}
function calculatePrestationsAmount(){
$('#amount').on('input',fetchPrestationsAmount)
$('#fees').on('input',fetchPrestationsAmount)
}
function fetchPrestationsAmount(){
var amount = parseFloat($("#amount").val());
var fees = parseFloat($("#fees").val());
fees = isNaN(fees) ? 0 : fees;
var care_condition = $('#sheet-form').find('select[name="care_condition"]').val();
if(isNaN(amount + fees)){
$('#moderator-ticket').val('');
$('#insurance-amount').val('');
}else{
$.ajax({
url: '<?= base_url('NanoHealthController/calculateHealthCareSheetPerformancesAmount')?>',
type: 'POST',
dataType: 'json',
data: {
"network_id" : "<?= $network_id ?>", "amount": (amount + fees), "care_condition": care_condition
},
success: function (data) {
if(data.status === 200){
$('#moderator-ticket').val(data.response.moderator_ticket);
$('#insurance-amount').val(data.response.insurance_amount);
}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')?>");
}
});
}
}
$('[data-toggle="tooltip"]').tooltip();
var actions1 = $("#prestations td:last-child").html();
// Append table with add row form on add new button click
$(".new1").click(function () {
@ -638,8 +598,8 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
var index = $("#prestations tbody tr:last-child").index();
var row = '<tr>' +
'<td>' +
'<select required class="form-control" name="act_id" >' +
getActsOptions(null)+
'<select required class="form-control" name="act_id" id="act">' +
getActsOptions(null,'CONSULTATION')+
'</select>' +
'</td>' +
'<td><input type="number" required class="form-control" name="amount" min="0" id="amount"></td>' +
@ -653,7 +613,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
$('[data-toggle="tooltip"]').tooltip();
calculatePrestationsAmount();
autoFetchPrestationAmount();
});
// Add row on add button click
$(document).on("click", ".add1", function () {
@ -680,22 +640,25 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
}
select.each(function () {
$(this).parent("td").html($(this).find('option:selected').text()).attr("value",$(this).val());
let selected = $(this).find('option:selected')
$(this).parent("td").html(selected.text()).attr("value",$(this).val()).attr("amount",selected.data('amount'));
});
});
// Edit row on edit button click
$(document).on("click", ".edit1", function () {
let amount = NaN
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
if (index === 0){
let val = $(this).attr("value");
if(!val){
val = $(this).attr("act_id");
}
$(this).html('<select class="form-control" name="act_id" required >'+ getActsOptions(val)+ '</select>');
$(this).html('<select class="form-control" name="act_id" required >'+ getActsOptions(val,'CONSULTATION')+ '</select>');
amount = parseFloat($(this).attr("amount"))
}
if (index == 1) {
$(this).html(`<input type="number" required class="form-control" name="amount" min="0" id="amount" ${(isNaN(amount) ? '' : 'disabled')} value="${$(this).text()}">`);
}
if (index === 1)
$(this).html('<input type="number" required class="form-control" name="amount" min="0" id="amount" value="' + $(this).text() + '">');
if (index === 2)
$(this).html('<input type="number" class="form-control" name="home_visit_fees" id="fees" min="0" value="' + $(this).text() + '">');
if (index === 3)
@ -726,7 +689,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
}
});
});
// Table Examens
var actions2 = $("#exams td:last-child").html();
@ -742,11 +705,11 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
var row = '<tr>' +
'<td>' +
'<select required class="form-control" name="act_id" >' +
getActsOptions(null)+
getActsOptions(null,'EXAM_OR_OTHER')+
'</select>' +
'</td>' +
'<td><input class="form-control" name="description"></td>' +
'<td><input class="form-control" name="quantity" min="1" step="1" type="number"></td>' +
// '<td><input class="form-control" name="quantity" min="1" step="1" type="number"></td>' +
'<td> ' + actions2 + '</td>' +
'</tr>';
$("#exams").append(row);
@ -789,12 +752,12 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
if(!val){
val = $(this).attr("act_id");
}
$(this).html('<select class="form-control" name="act_id" required >'+ getActsOptions(val)+ '</select>');
$(this).html('<select class="form-control" name="act_id" required >'+ getActsOptions(val,'EXAM_OR_OTHER')+ '</select>');
}
if (index == 1)
$(this).html('<input class="form-control" name="description" value="' + $(this).text() + '">');
if (index == 2)
$(this).html('<input class="form-control" name="quantity" min="1" step="1" value="' + $(this).text() + '">');
// if (index == 2)
// $(this).html('<input class="form-control" name="quantity" min="1" step="1" value="' + $(this).text() + '">');
});
$(this).parents("tr").find(".add, .edit").toggle();
$(".new2").attr("disabled", "disabled");
@ -818,8 +781,8 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
}
});
});
// Table prescription
function getDrugAndDevicesOptions(selectedValue) {

View File

@ -0,0 +1,94 @@
<script>
function fetchActs(user_id , beneficiary_id){
// Fetch acts
$.ajax({
url: '<?= base_url('NanoHealthController/getActs')?>',
type: 'POST',
dataType: 'json',
data: {
"network_id": network_id, "user_id": user_id, "beneficiary_id": beneficiary_id,
},
success: function (data) {
if(data.status === 200){
acts = data.response
$('#patient-details').show();
}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')?>");
}
});
}
function getActsOptions(selectedValue , type) {
var actsOptions = '';
acts.forEach(function (a) {
if(type === a.type) {
var selected = a.id === parseInt(selectedValue) ? 'selected' : '';
actsOptions += (`<option value=${a.id} ${selected} data-amount=${a.amount} > ${a.name} </option>`);
}
})
return actsOptions;
}
function calculatePrestationsAmount(){
$('#amount').on('input',fetchPrestationsAmount)
$('#fees').on('input',fetchPrestationsAmount)
}
function fetchPrestationsAmount(){
var amount = parseFloat($("#amount").val());
var fees = parseFloat($("#fees").val());
fees = isNaN(fees) ? 0 : fees;
var care_condition = $('#sheet-form').find('select[name="care_condition"]').val();
if(isNaN(amount + fees)){
$('#moderator-ticket').val('');
$('#insurance-amount').val('');
}else{
$.ajax({
url: '<?= base_url('NanoHealthController/calculateHealthCareSheetPerformancesAmount')?>',
type: 'POST',
dataType: 'json',
data: {
"network_id" : network_id, "amount": (amount + fees), "care_condition": care_condition
},
success: function (data) {
if(data.status === 200){
$('#moderator-ticket').val(data.response.moderator_ticket);
$('#insurance-amount').val(data.response.insurance_amount);
}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')?>");
}
});
}
}
function autoFetchPrestationAmount(){
console.log('auto fect')
// Definir le montant du 1er acte selectionné
let amount = parseFloat($('#act').find(":selected").data('amount'))
if(!isNaN(amount)) {
$("#amount").attr('disabled', true).val(amount).trigger('input');
}
$('#act').on('change',function () {
let amount = parseFloat($(this).find(":selected").data('amount'))
if(!isNaN(amount)){
$("#amount").attr('disabled',true).val(amount).trigger('input');
}else{
$("#amount").attr('disabled',false).val(null);
}
console.log(amount)
})
}
</script>

View File

@ -425,10 +425,8 @@
<table id="consultation-exams" class="table table-bordered">
<thead>
<tr>
<th><?= $this->lang->line('exam_class'); ?></th>
<th width="50"><?= $this->lang->line('exam_class'); ?></th>
<th><?= $this->lang->line('exam_description'); ?></th>
<th><?= $this->lang->line('quantity'); ?></th>
</tr>
</thead>
<tbody></tbody>
@ -895,7 +893,7 @@
$('#consultation-exams').append('<tr>' +
'<td id="'+it.id+'" act_id="'+it.act.id+'">'+(it.act.name|| '')+'</td>' +
'<td>'+(it.description || '')+'</td>' +
'<td>'+(it.quantity || '')+'</td>' +
// '<td>'+(it.quantity || '')+'</td>' +
'</tr>')
});