From 1ef09b3298cb43f932ab6279ed007b79900578a8 Mon Sep 17 00:00:00 2001 From: Djery-Tom Date: Sat, 3 Oct 2020 12:14:16 +0100 Subject: [PATCH] + Update nano credit interface for administrator --- application/controllers/Gestion.php | 46 +++- application/controllers/Hyperviseur_dash.php | 1 + application/language/english/message_lang.php | 3 +- application/language/french/message_lang.php | 3 +- .../config_wallet_ilink_hyp/etat_soldes.php | 12 +- application/views/historique_recharges.php | 7 +- .../views/historique_remboursement.php | 10 +- application/views/historique_transactions.php | 11 +- .../views/historique_transactions_ilink.php | 13 +- .../historique_transferts_commission.php | 19 +- .../nano_credit/gestion_nano_credit_admin.php | 217 ++++-------------- .../nano_credit/historique_nano_credit.php | 15 +- .../views/nano_credit/historique_savings.php | 20 +- 13 files changed, 151 insertions(+), 226 deletions(-) diff --git a/application/controllers/Gestion.php b/application/controllers/Gestion.php index 863b63ba..648eebce 100755 --- a/application/controllers/Gestion.php +++ b/application/controllers/Gestion.php @@ -1924,6 +1924,7 @@ class Gestion extends CI_Controller $data['currency_name_en'] = $networkDetails->first_row()->currency_name_en; $data['currency_code'] = $networkDetails->first_row()->currency_code; } + $data['id_network'] = $network_id; $this->load->view('header_gestion', $data); if ($type == 'transaction') $this->load->view('historique_transactions'); @@ -2081,6 +2082,8 @@ class Gestion extends CI_Controller if ($this->input->get('history')) { $this->historique_nano_credit($data['network_id'], $this->input->get('d'), $this->input->get('f'), $this->input->get('history')); + } elseif ($this->input->get('group')) { + $this->users_group_details($data['network_id'],$this->input->get('group')); } else { $data['groups'] = $this->nano_credit_model->getUsersGroups($data['network_id']); $data['configWallet'] = $this->wallet_model->getConfigWallet($data['network_id'])->first_row(); @@ -2122,12 +2125,13 @@ class Gestion extends CI_Controller if ($type == 'nano_credit') { $data['transactions'] = $this->nano_credit_model->getUserDemandesCredit($startDate, $endDate, $network_id); } else if ($type == 'savings') { - $data['transactions'] = $this->wallet_model->getIlinkTransactions($startDate, $endDate, $network_id); + $data['transactions'] = $this->nano_credit_model->getUsersSavings($startDate, $endDate, $network_id); } $data['active'] = "nano_credit"; $data['alert'] = ""; $data['networks'] = $this->wallet_model->getAllActivatedNetworks(); $data['game_pays'] = $this->user_model->getGameCountry(); + $data['id_network'] = $network_id; $networkDetails = $this->user_model->getNetworkDetails($network_id); if ($networkDetails) { $data['network'] = $networkDetails->first_row()->network; @@ -2137,13 +2141,51 @@ class Gestion extends CI_Controller $data['currency_code'] = $networkDetails->first_row()->currency_code; } $this->load->view('header_gestion', $data); - if ($type == 'epargne') + if ($type == 'savings') $this->load->view('nano_credit/historique_savings'); else $this->load->view('nano_credit/historique_nano_credit'); $this->load->view('footer'); } + private function users_group_details($network_id , $group_code) + { + $data['active'] = "nano_credit"; + $data['alert'] = ""; + $data['game_pays'] = $this->user_model->getGameCountry(); + + + $networkDetails = $this->user_model->getNetworkDetails($network_id); + if ($networkDetails) { + $data['network'] = $networkDetails->first_row()->network; + $data['country'] = $networkDetails->first_row()->country; + $data['currency_code'] = $networkDetails->first_row()->currency_code; + } + + + $data['category'] = $this->session->userdata('category'); + $data['members'] = $this->nano_credit_model->getGroupMembers($group_code); + $data['group'] = $this->nano_credit_model->getGroup($group_code); + + //Calcul de la capacite d'emprunt + $CE = 0; + if($data['members']){ + $sommeCredits = 0; + $sommeEpargnes = 0; + foreach ($data['members']->result() as $user){ + $sommeCredits += $user->balance_credit; + $sommeEpargnes += $user->balance_epargne; + } + $CE = $sommeEpargnes - $sommeCredits; + } + + $data['CE'] = $CE; + $data['group_code'] = $group_code; + $this->load->view('header_gestion', $data); + $this->load->view('nano_credit/users_group_detail'); + $this->load->view('footer'); + } + public function activate_nano_credit() { if ($this->isLogged()) { diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php index 4fbcb392..24a31d5e 100755 --- a/application/controllers/Hyperviseur_dash.php +++ b/application/controllers/Hyperviseur_dash.php @@ -463,6 +463,7 @@ class Hyperviseur_dash extends CI_Controller $data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id')); $data['country'] = $this->session->userdata('current_pays'); $data['category'] = $this->session->userdata('category'); + $data['id_network'] = $network_id; $this->load->view('header_hyp', $data); if ($type == 'transaction') diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index 3dd40316..28200b88 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -501,5 +501,6 @@ $lang['max_amount_per_month'] = "Maximum amount per month"; $lang['define_the_limits'] = "Define the limits"; $lang['regulations_updated'] = 'Regulatory limits updated'; $lang['refunded_amount'] = "Amount refunded"; -$lang['remains_to_be_reimbursed'] = "Remainder to reimburse" +$lang['remains_to_be_reimbursed'] = "Remainder to reimburse"; +$lang['end_date'] = "End date"; ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index 40dfed68..d3aaec34 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -513,5 +513,6 @@ $lang['max_amount_per_month'] = "Montant maximum par mois"; $lang['define_the_limits'] = "Definir les limites"; $lang['regulations_updated'] = 'Limites réglementaires mis à jour'; $lang['refunded_amount'] = "Montant remboursé"; -$lang['remains_to_be_reimbursed'] = "Reste à rembourser" +$lang['remains_to_be_reimbursed'] = "Reste à rembourser"; +$lang['end_date'] = "Date de fin"; ?> diff --git a/application/views/config_wallet_ilink_hyp/etat_soldes.php b/application/views/config_wallet_ilink_hyp/etat_soldes.php index c0e7e435..fda0565e 100755 --- a/application/views/config_wallet_ilink_hyp/etat_soldes.php +++ b/application/views/config_wallet_ilink_hyp/etat_soldes.php @@ -8,14 +8,12 @@ lang->line('balance_statement') ?>"+' - Date : ' + moment().format("dddd, Do MMMM YYYY, h:mm:ss") }, { extend: 'csvHtml5', - title: 'Etat des soldes - Date : ' + moment().format("dddd, Do MMMM YYYY, h:mm:ss") + title: "lang->line('balance_statement') ?>"+' - Date : ' + moment().format("dddd, Do MMMM YYYY, h:mm:ss") }, { extend: 'pdfHtml5', orientation: 'portrait', pageSize: 'LEGAL', - title: 'Etat des soldes - Date : ' + moment().format("dddd, Do MMMM YYYY, h:mm:ss") + title: "lang->line('balance_statement') ?>"+' - Date : ' + moment().format("dddd, Do MMMM YYYY, h:mm:ss") } ] }); diff --git a/application/views/historique_recharges.php b/application/views/historique_recharges.php index 8bc6c6bc..c56e1186 100755 --- a/application/views/historique_recharges.php +++ b/application/views/historique_recharges.php @@ -5,7 +5,9 @@
"; $('input[name="daterange"]').daterangepicker({ opens: 'left', autoUpdateInput: false, @@ -184,7 +187,7 @@ if(category) window.location = "" + "?history=recharge" + "&d=" + debut + "&f=" + fin; else - window.location = "" + "?id=118&history=recharge" + "&d=" + debut + "&f=" + fin; + window.location = "" + "?id="+id_network+"&history=recharge" + "&d=" + debut + "&f=" + fin; }); @@ -194,7 +197,7 @@ if(category) window.location = "" + "?history=recharge"; else - window.location = "" + "?id=118&history=recharge"; + window.location = "" + "?id="+id_network+"&history=recharge"; }); }); diff --git a/application/views/historique_remboursement.php b/application/views/historique_remboursement.php index 39931810..eb9b81c3 100755 --- a/application/views/historique_remboursement.php +++ b/application/views/historique_remboursement.php @@ -6,14 +6,13 @@
"; $('input[name="daterange"]').daterangepicker({ opens: 'left', autoUpdateInput: false, @@ -227,7 +227,7 @@ if (category) window.location = "" + "?history=refund_history" + "&d=" + debut + "&f=" + fin; else - window.location = "" + "?id=118&history=refund_history" + "&d=" + debut + "&f=" + fin; + window.location = "" + "?id="+id_network+"&history=refund_history" + "&d=" + debut + "&f=" + fin; }); @@ -237,7 +237,7 @@ if (category) window.location = "" + "?history=refund_history"; else - window.location = "" + "?id=118&history=refund_history"; + window.location = "" + "?id="+id_network+"&history=refund_history"; }); }); diff --git a/application/views/historique_transactions.php b/application/views/historique_transactions.php index baa59197..f39760b6 100755 --- a/application/views/historique_transactions.php +++ b/application/views/historique_transactions.php @@ -6,8 +6,10 @@
setTimezone($timezone); @@ -219,6 +221,7 @@ $(function () { const lang = $('#picker').data('lang'); const category = $('#picker').data('category'); + const id_network = ""; $('input[name="daterange"]').daterangepicker({ opens: 'left', autoUpdateInput: false, @@ -232,7 +235,7 @@ if(category) window.location = "" + "?history=transaction" + "&d=" + debut + "&f=" + fin; else - window.location = "" + "?id=118&history=transaction" + "&d=" + debut + "&f=" + fin; + window.location = "" + "?id="+id_network+"&history=transaction" + "&d=" + debut + "&f=" + fin; }); @@ -242,7 +245,7 @@ if(category) window.location = "" + "?history=transaction"; else - window.location = "" + "?id=118&history=transaction"; + window.location = "" + "?id="+id_network+"&history=transaction"; }); }); diff --git a/application/views/historique_transactions_ilink.php b/application/views/historique_transactions_ilink.php index 97088267..7339dd87 100755 --- a/application/views/historique_transactions_ilink.php +++ b/application/views/historique_transactions_ilink.php @@ -282,7 +282,7 @@ function toLocateDate($date , $timezone){ 'pageLength', { extend: 'excelHtml5', - title: 'Histrotique des transactions', + title: "lang->line('Historique des transactions') ?>", exportOptions: { columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17] }, @@ -303,7 +303,7 @@ function toLocateDate($date , $timezone){ }, { extend: 'csvHtml5', - title: 'Histrotique des transactions', + title: "lang->line('Historique des transactions') ?>", exportOptions: { columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17] }, @@ -313,7 +313,7 @@ function toLocateDate($date , $timezone){ extend: 'pdfHtml5', orientation: 'landscape', pageSize: 'LEGAL', - title: 'Histrotique des transactions', + title: "lang->line('Historique des transactions') ?>", exportOptions: { columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17] }, @@ -335,7 +335,8 @@ function toLocateDate($date , $timezone){ $(function () { const lang = $('#picker').data('lang'); const category = $('#picker').data('category'); - $('input[name="daterange"]').daterangepicker({ + const id_network = ""; + $('input[name="daterange"]').daterangepicker({ opens: 'left', autoUpdateInput: false, locale: { @@ -348,7 +349,7 @@ function toLocateDate($date , $timezone){ if(category) window.location = "" + "?history=transaction_ilink" + "&d=" + debut + "&f=" + fin; else - window.location = "" + "?id=118&history=transaction_ilink" + "&d=" + debut + "&f=" + fin; + window.location = "" + "?id="+id_network+"&history=transaction_ilink" + "&d=" + debut + "&f=" + fin; }); @@ -358,7 +359,7 @@ function toLocateDate($date , $timezone){ if(category) window.location = "" + "?history=transaction_ilink"; else - window.location = "" + "?id=118&history=transaction_ilink"; + window.location = "" + "?id="+id_network+"&history=transaction_ilink"; }); }); diff --git a/application/views/historique_transferts_commission.php b/application/views/historique_transferts_commission.php index be54a776..e926ec4a 100755 --- a/application/views/historique_transferts_commission.php +++ b/application/views/historique_transferts_commission.php @@ -8,16 +8,14 @@ setTimezone($timezone); @@ -217,17 +215,17 @@ use Brick\Money\Money; 'pageLength', { extend: 'excelHtml5', - title: 'Histrotique des transferts de commission' + title: "lang->line('commission_transfer_historic')?>", }, { extend: 'csvHtml5', - title: 'Histrotique des transferts de commission' + title: "lang->line('commission_transfer_historic')?>", }, { extend: 'pdfHtml5', orientation: 'landscape', pageSize: 'LEGAL', - title: 'Histrotique des transferts de commission' + title: "lang->line('commission_transfer_historic')?>", } ] }); @@ -244,6 +242,7 @@ use Brick\Money\Money; $(function () { const lang = $('#picker').data('lang'); const category = $('#picker').data('category'); + const id_network = ""; $('input[name="daterange"]').daterangepicker({ opens: 'left', autoUpdateInput: false, @@ -257,7 +256,7 @@ use Brick\Money\Money; if(category) window.location = "" + "?history=commission_transfer" + "&d=" + debut + "&f=" + fin; else - window.location = "" + "?id=118&history=commission_transfer" + "&d=" + debut + "&f=" + fin; + window.location = "" + "?id="+id_network+"&history=commission_transfer" + "&d=" + debut + "&f=" + fin; }); @@ -267,7 +266,7 @@ use Brick\Money\Money; if(category) window.location = "" + "?history=commission_transfer"; else - window.location = "" + "?id=118&history=commission_transfer"; + window.location = "" + "?id="+id_network+"&history=commission_transfer"; }); }); diff --git a/application/views/nano_credit/gestion_nano_credit_admin.php b/application/views/nano_credit/gestion_nano_credit_admin.php index 07a6aa66..040ffc87 100755 --- a/application/views/nano_credit/gestion_nano_credit_admin.php +++ b/application/views/nano_credit/gestion_nano_credit_admin.php @@ -173,7 +173,7 @@ $context = new \Brick\Money\Context\AutoContext();
-

lang->line('savings_interest_rates'); ?>

+

lang->line('savings_tax'); ?>

@@ -211,6 +211,10 @@ $context = new \Brick\Money\Context\AutoContext();

lang->line('users_groups') ?>

- - - - "; - ?> - + + + "; + ?> + - - result() as $row) { - echo " + + result() as $row) { + echo " - - - "; - ?> - actif) { - ?> - - - - - - - + actif) { ?> + + + - + + + + + + + +
" . $this->lang->line('Nom') . " " . $this->lang->line('creator') . " " . $this->lang->line('credit_limit') . " Sponsor 1 Sponsor 2 Sponsor 3 Status" . $this->lang->line('created_date') . "
" . $this->lang->line('number_of_users') . "" . $this->lang->line('created_date') . " Action
" . $row->code_groupe . " " . $row->nom . " " . $row->createur . " " . Money::of(round($row->limite_credit, 2), $row->currency_code, $context)->formatTo('fr_FR') . "" . $row->sponsor1 . "" . $row->sponsor2 . "" . $row->sponsor3 . " - lang->line('Actif') ?> - - lang->line('Inactif') ?> - date_creation ?>
+ lang->line('Actif') ?> + + lang->line('Inactif') ?> +
nombre_utilisateurs?> date_creation ?> + id_network) echo "disabled"?> > + lang->line('Voir plus...'); ?> + +
-
@@ -360,106 +328,13 @@ $context = new \Brick\Money\Context\AutoContext(); moment.updateLocale(moment.locale(format), {invalidDate: ""}); $('#example1').DataTable({ - "aaSorting": [[8, "desc"]], + "aaSorting": [[6, "desc"]], "columnDefs": [{ - targets: 8, + targets: 6, render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format) }] }); }) - - diff --git a/application/views/nano_credit/historique_nano_credit.php b/application/views/nano_credit/historique_nano_credit.php index 6eb0b7e7..748eca14 100755 --- a/application/views/nano_credit/historique_nano_credit.php +++ b/application/views/nano_credit/historique_nano_credit.php @@ -138,7 +138,7 @@ Retrait en cash Date de la demande Date de remboursement - Date + lang->line('created_date') ?> @@ -246,12 +246,12 @@ 'pageLength', { extend: 'excelHtml5', - title: 'Histrotique des demandes de credit', + title: "lang->line('nano_credit_history') ?>", customizeData: function (data) { for (var i = 0; i < data.body.length; i++) { for (var j = 0; j < data.body[i].length; j++) { // data.body[i][j] = '\u200C' + data.body[i][j]; - if ([4, 5, 6].includes(j)) { + if ([4, 5, 6, 7].includes(j)) { // Get the value and strip the non numeric characters // var value = $(this).text(); value = data.body[i][j].replace(',', ".") @@ -264,14 +264,14 @@ }, { extend: 'csvHtml5', - title: 'Histrotique des demandes de credit', + title: "lang->line('nano_credit_history') ?>", trim: false }, { extend: 'pdfHtml5', orientation: 'landscape', pageSize: 'LEGAL', - title: 'Histrotique des demandes de credit', + title: "lang->line('nano_credit_history') ?>", trim: false }, // 'colvis' @@ -290,6 +290,7 @@ $(function () { const lang = $('#picker').data('lang'); const category = $('#picker').data('category'); + const id_network = ""; $('input[name="daterange"]').daterangepicker({ opens: 'left', autoUpdateInput: false, @@ -308,7 +309,7 @@ } else - window.location = "" + "?id=118&history=nano_credit" + "&d=" + debut + "&f=" + fin; + window.location = "" + "?id="+id_network+"&history=nano_credit" + "&d=" + debut + "&f=" + fin; }); @@ -322,7 +323,7 @@ window.location = "" + "?history=nano_credit"; } else - window.location = "" + "?id=118&history=nano_credit"; + window.location = "" + "?id="+id_network+"&history=nano_credit"; }); }); diff --git a/application/views/nano_credit/historique_savings.php b/application/views/nano_credit/historique_savings.php index 62697bdb..a39c535a 100644 --- a/application/views/nano_credit/historique_savings.php +++ b/application/views/nano_credit/historique_savings.php @@ -8,13 +8,12 @@ lang->line('interest') ?> lang->line('tax') ?> lang->line('issuer_id') ?> - Date de creation + lang->line('created_date') ?> lang->line('cassation_date') ?> - Date de fin + lang->line('end_date') ?> @@ -235,7 +234,7 @@ 'pageLength', { extend: 'excelHtml5', - title: 'Historique des épargnes', + title: "lang->line('savings_history') ?>", customizeData: function (data) { for (var i = 0; i < data.body.length; i++) { for (var j = 0; j < data.body[i].length; j++) { @@ -253,14 +252,14 @@ }, { extend: 'csvHtml5', - title: 'Historique des épargnes', + title: "lang->line('savings_history') ?>", trim: false }, { extend: 'pdfHtml5', orientation: 'landscape', pageSize: 'LEGAL', - title: 'Historique des épargnes', + title: "lang->line('savings_history') ?>", trim: false }, // 'colvis' @@ -279,6 +278,7 @@ $(function () { const lang = $('#picker').data('lang'); const category = $('#picker').data('category'); + const id_network = ""; $('input[name="daterange"]').daterangepicker({ opens: 'left', autoUpdateInput: false, @@ -292,7 +292,7 @@ if (category) window.location = "" + "?history=savings" + "&d=" + debut + "&f=" + fin; else - window.location = "" + "?id=118&history=savings" + "&d=" + debut + "&f=" + fin; + window.location = "" + "?id="+id_network+"&history=savings" + "&d=" + debut + "&f=" + fin; }); @@ -302,7 +302,7 @@ if (category) window.location = "" + "?history=savings"; else - window.location = "" + "?id=118&history=savings"; + window.location = "" + "?id="+id_network+"&history=savings"; }); });