From c310cddba83e0e03a0776b5973ed98da49e166d9 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 20 Jan 2026 15:16:54 +0100 Subject: [PATCH] add request to link bank account feature on Agency Banking --- application/controllers/Admin_dash.php | 1 + application/controllers/Gestion.php | 3 +- application/controllers/Users.php | 3 +- application/helpers/functions_helper.php | 43 +- application/language/english/message_lang.php | 4 +- application/language/french/message_lang.php | 4 +- application/models/User_model.php | 28 + application/views/gestion_agency_banking.php | 773 ++++++++++-------- .../hyper/insurances_subscriptions.php | 2 +- 9 files changed, 517 insertions(+), 344 deletions(-) diff --git a/application/controllers/Admin_dash.php b/application/controllers/Admin_dash.php index 51cc558a..c82c9136 100755 --- a/application/controllers/Admin_dash.php +++ b/application/controllers/Admin_dash.php @@ -225,6 +225,7 @@ class Admin_dash extends CI_Controller $data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('current_hyper_member_code')); $data['agentWalletInfos'] = $this->user_model->getInfosWalletAgentForHyper($id_network); + $this->load->view('header', $data); if ($data['hasWallet']?->type == 'visa') $this->load->view('gestion_wallet_hyp'); diff --git a/application/controllers/Gestion.php b/application/controllers/Gestion.php index 9728bcc0..cdb9741d 100755 --- a/application/controllers/Gestion.php +++ b/application/controllers/Gestion.php @@ -2571,7 +2571,8 @@ class Gestion extends CI_Controller public function agency_banking(){ if ($this->isLogged()) { - $data['accounts'] = $this->user_model->getAllRequests(); + $data['request_bank_accounts'] = $this->user_model->getAllRequests(); + $data['request_links_bank_accounts'] = $this->user_model->getAllLinksBankAccounts(); $data['alert'] = ""; $data['active'] = "agency_banking"; $data['game_pays'] = $this->user_model->getGameCountry(); diff --git a/application/controllers/Users.php b/application/controllers/Users.php index 39a22d39..bef6992e 100755 --- a/application/controllers/Users.php +++ b/application/controllers/Users.php @@ -69,7 +69,7 @@ public function login() { $user_login = [ - 'user_email' => $this->input->post('user_mail'), + 'user_email' => trim($this->input->post('user_mail')), 'user_password' => $this->input->post('user_password'), 'user_role' => $this->input->post('user_role') ]; @@ -77,6 +77,7 @@ $email = $user_login['user_email']; $password = $user_login['user_password']; $role = $user_login['user_role']; + // CAS 1 : Agents valideurs – iLink Santé / World (role = 2) if ($role == 2 && filter_var($email, FILTER_VALIDATE_EMAIL)) { diff --git a/application/helpers/functions_helper.php b/application/helpers/functions_helper.php index 06f30ce0..7cfd2574 100755 --- a/application/helpers/functions_helper.php +++ b/application/helpers/functions_helper.php @@ -207,26 +207,39 @@ if (!function_exists('makeRequest')) { } } -function getStatusBadge($status, $lang) -{ - $label = $lang->line('status_'.$status); +if (!function_exists('getStatusBadge')) { + function getStatusBadge($status, $lang) + { + // On s'assure que le statut est propre + $statusKey = strtolower(trim($status)); + + $line = $lang->line('status_' . $statusKey); + $label = (!empty($line)) ? $line : ucfirst($statusKey); - switch (strtolower($status)) { + // Style commun pour garder l'effet "pillule" arrondi que vous aviez + $style = 'padding: 6px 12px; border-radius: 20px; font-size: 12px;'; - case 'pending': - return ''.$label.''; + switch ($statusKey) { - case 'active': - return ''.$label.''; + case 'pending': + return ''.$label.''; - case 'close': - return ''.$label.''; + case 'active': + return ''.$label.''; - case 'rejected': - return ''.$label.''; + case 'validated': + return ''.$label.''; - default: - return ''.$status.''; - } + case 'close': + case 'closed': + return ''.$label.''; + + case 'rejected': + return ''.$label.''; + + default: + return ''.$label.''; + } + } } diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index 58962262..4ce84bdd 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -1099,5 +1099,7 @@ $lang['status_pending'] = 'Pending'; $lang['status_active'] = 'Active'; $lang['status_close'] = 'Closed'; $lang['status_rejected'] = 'Rejected'; - +$lang['status_validated'] = 'Validated'; +$lang['subscriptions_history'] = "Subscription history"; +$lang["list_of_request_opening_bank_accounts"] = "List of bank account opening requests"; ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index e2abce04..683058f6 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -1102,10 +1102,12 @@ $lang["update_failed_one_error_occurred"] = "Mise à jour échouée, une erreur $lang["deletion_successfully"] = "Suppression effectuée avec succès"; $lang["deletion_failed_one_error_occurred"] = "Une erreur s'est produite lors de la suppression"; $lang["management_bank_accounts"] = "Gestion des comptes bancaires"; -$lang["list_bank_accounts"] = "Liste des comptes bancaires"; +$lang["list_of_request_opening_bank_accounts"] = "Liste des demandes d'ouverture de compte bancaire"; $lang['status_pending'] = 'En attente'; $lang['status_active'] = 'Actif'; $lang['status_close'] = 'Fermé'; $lang['status_rejected'] = 'Rejeté'; +$lang['status_validated'] = 'Validé'; +$lang['subscriptions_history'] = 'Historique des souscriptions'; ?> diff --git a/application/models/User_model.php b/application/models/User_model.php index 7d72750c..36124216 100755 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -2343,4 +2343,32 @@ class User_model extends CI_Model ->get('user_bank_accounts') ->row(); } + + public function getAllLinksBankAccounts() + { + $this->db->select(' + v.id_transaction, + v.user_code, + v.iban, + v.is_verified, + v.created_at, + u.firstname, + u.lastname, + u.email, + u.phone, + op.nom as bank_name, + opc.adresse as bank_address + '); + $this->db->from('users_banking_account_verification v'); + + $this->db->join('users u', 'u.user_code = v.user_code', 'left'); + + $this->db->join('operators_countries opc', 'opc.id = v.id_bank_country', 'left'); + $this->db->join('operators op', 'op.id = opc.id_operator', 'left'); + + $this->db->order_by('v.created_at', 'ASC'); + + $query = $this->db->get(); + return $query->num_rows() > 0 ? $query->result() : []; // Retourne un tableau d'objets + } } diff --git a/application/views/gestion_agency_banking.php b/application/views/gestion_agency_banking.php index dc9eeafa..a0a0328a 100755 --- a/application/views/gestion_agency_banking.php +++ b/application/views/gestion_agency_banking.php @@ -4,44 +4,43 @@ Agency | Banking Management - ') ?>"> + + + +
-

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

+

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

-
+ +
-

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

+

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

+
+ +
@@ -53,82 +52,186 @@ lang->line('firstname'); ?> lang->line('account'); ?> IBAN - Swift - lang->line('reason') ?> Type lang->line('balance'); ?> lang->line('status'); ?> Actions - - - - id ?> - lastname ?> - firstname ?> - account_number ?> - iban ?> - swift_code ?> - reason ?? '-' ?> - account_type ?> - balance,0,',',' ') ?> - - status, $this->lang) ?> - - - - data-id="id ?>" - data-lastname="lastname ?>" - data-firstname="firstname ?>" - data-account_number="account_number ?>" - data-iban="iban ?>" - data-swift_code="swift_code ?>" - data-status="status ?>" - data-reason="reason ?>" - data-balance="balance ?>" - data-birth_date="birth_date ?>" - data-birth_country="birth_country ?>" - data-birth_city="birth_city ?>" - data-father_firstname="father_firstname ?>" - data-father_lastname="father_lastname ?>" - data-mother_firstname="mother_firstname ?>" - data-mother_lastname="mother_lastname ?>" - data-marital_name="marital_name ?>" - data-nationality="nationality ?>" - data-marital_status="marital_status ?>" - data-profession="profession ?>" - data-sector_activity="sector_activity ?>" - data-subsector_activity="subsector_activity ?>" - data-tax_number="tax_number ?>" - data-employee_number="employee_number ?>" - data-position="position ?>" - data-employer_name="employer_name ?>" - data-employer_address="employer_address ?>" - data-created_at="created_at ?>" + + - > - - - - - - - - + + + + + + +
+
+ +
+
+

Demandes de Rattachement (Comptes Bancaires)

+
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + is_verified == 1) $statusStr = 'active'; + if($l->is_verified == 2) $statusStr = 'rejected'; + ?> + + + + + + + + + + + + + +
IDNom completUser CodeClientTéléphoneBanqueIBAN / Comptelang->line('status'); ?>Actions
lastname .' '. $l->firstname ?>user_code ?> + lastname ?> firstname ?>
+ email ?> +
phone ?> + bank_name ?>
+ bank_address, 0, 20) ?>... +
iban ?> + lang) ?> + + +
@@ -136,7 +239,99 @@
- + + + + + + + - - + - - - - - - + - - - - - - - - - - - - - - + + + + + + + + - - - + + diff --git a/application/views/nano_health/hyper/insurances_subscriptions.php b/application/views/nano_health/hyper/insurances_subscriptions.php index af42138a..58bbaf66 100755 --- a/application/views/nano_health/hyper/insurances_subscriptions.php +++ b/application/views/nano_health/hyper/insurances_subscriptions.php @@ -187,7 +187,7 @@ extend: 'pdfHtml5', orientation: 'landscape', pageSize: 'LEGAL', - title: "lang->line('Hsubscriptions_history') ?>", + title: "lang->line('subscriptions_history') ?>", trim: false, "action": newexportaction },