fix issus in the updating abd delete function on agency banking Tab
This commit is contained in:
parent
9de7bbf21a
commit
a767a8b764
|
|
@ -23,7 +23,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
| a PHP script and you can easily do that on your own.
|
||||
|
|
||||
*/
|
||||
$config['base_url'] = 'https://'.$_SERVER['SERVER_NAME'].'/backoffice';
|
||||
$config['base_url'] = '/';// 'https://'.$_SERVER['SERVER_NAME'].'/backoffice';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -77,8 +77,10 @@ $db['default'] = array(
|
|||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'root',
|
||||
'password' => '@iLink@2025',
|
||||
'database' => 'iLink_preprod',
|
||||
'password' => 'songuinho',
|
||||
'database' => 'iLink_world',
|
||||
// 'password' => '@iLink@2025',
|
||||
// 'database' => 'iLink_preprod',
|
||||
'dbdriver' => 'mysqli',
|
||||
'dbprefix' => '',
|
||||
'pconnect' => FALSE,
|
||||
|
|
|
|||
|
|
@ -2568,6 +2568,81 @@ class Gestion extends CI_Controller
|
|||
}
|
||||
}
|
||||
|
||||
public function agency_banking(){
|
||||
if ($this->isLogged()) {
|
||||
|
||||
$data['accounts'] = $this->user_model->getAllRequests();
|
||||
$data['alert'] = "";
|
||||
$data['active'] = "agency_banking";
|
||||
$data['game_pays'] = $this->user_model->getGameCountry();
|
||||
|
||||
$this->load->view('header_gestion', $data);
|
||||
$this->load->view('gestion_agency_banking');
|
||||
$this->load->view('footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function update_request_agency() {
|
||||
$id = $this->input->post('id');
|
||||
|
||||
$data = $this->input->post();
|
||||
if (!$id) {
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'message' => "ID manquant"
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
unset($data['id']); // on retire l'id pour éviter un update
|
||||
|
||||
$response = $this->user_model->updateInfoAgency($id, $data);
|
||||
if($response) {
|
||||
echo json_encode([
|
||||
'alert' => 'ok',
|
||||
'success' => 'ok',
|
||||
'message' => $this->lang->line('update_successfully')
|
||||
]);
|
||||
} else {
|
||||
echo json_encode([
|
||||
'alert' => 'ok',
|
||||
'success' => 'false',
|
||||
'message' => $this->lang->line('update_failed_one_error_occurred')
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function delete_request_agency() {
|
||||
$id = $this->input->post('id');
|
||||
if(!$id){
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'message' => "ID manquant"
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$response = $this->user_model->deleteInfoAgency($id);
|
||||
if($response) {
|
||||
echo json_encode([
|
||||
"alert"=> "ok",
|
||||
"success"=> "ok",
|
||||
"message"=> $this->lang->line("deletion_successfully")
|
||||
]);
|
||||
}else{
|
||||
echo json_encode([
|
||||
"alert"=> "ok",
|
||||
"success"=> "false",
|
||||
"message"=> $this->lang->line("deletion_failed_one_error_occurred")
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function get_account_data() {
|
||||
$id = $this->input->post('id');
|
||||
$data = $this->user_model->get_account($id);
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -206,3 +206,27 @@ if (!function_exists('makeRequest')) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getStatusBadge($status, $lang)
|
||||
{
|
||||
$label = $lang->line('status_'.$status);
|
||||
|
||||
switch (strtolower($status)) {
|
||||
|
||||
case 'pending':
|
||||
return '<span class="badge bg-warning text-dark" style="padding:6px 12px; border-radius:20px;">'.$label.'</span>';
|
||||
|
||||
case 'active':
|
||||
return '<span class="badge bg-success" style="padding:6px 12px; border-radius:20px;">'.$label.'</span>';
|
||||
|
||||
case 'close':
|
||||
return '<span class="badge bg-secondary" style="padding:6px 12px; border-radius:20px;">'.$label.'</span>';
|
||||
|
||||
case 'rejected':
|
||||
return '<span class="badge bg-danger" style="padding:6px 12px; border-radius:20px;">'.$label.'</span>';
|
||||
|
||||
default:
|
||||
return '<span class="badge bg-dark" style="padding:6px 12px; border-radius:20px;">'.$status.'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1083,4 +1083,21 @@ $lang['add_rate'] = "Add a rate";
|
|||
$lang['channel'] = "Channel/Réseau";
|
||||
$lang["select_country"] = "Select a country";
|
||||
$lang["confirm_recharge_account"] = "Confirm account recharge";
|
||||
$lang["agency_banking"] = "Agency banking";
|
||||
$lang["lastname"] = "lastname";
|
||||
$lang["firstname"] = "firstname";
|
||||
$lang["account"] = "account";
|
||||
$lang["balance"] = "balance";
|
||||
$lang["status"] = "Status du compte";
|
||||
$lang["update_successfully"] = "Updated successfully";
|
||||
$lang["update_failed_one_error_occurred"] = "Update failed, one error occurred";
|
||||
$lang["deletion_successfully"] = "Deleted successfully";
|
||||
$lang["deletion_failed_one_error_occurred"] = "Deletion failed, one error occurred";
|
||||
$lang["management_bank_accounts"] = "Management of bank accounts";
|
||||
$lang["list_bank_accounts"] = "List of bank accounts";
|
||||
$lang['status_pending'] = 'Pending';
|
||||
$lang['status_active'] = 'Active';
|
||||
$lang['status_close'] = 'Closed';
|
||||
$lang['status_rejected'] = 'Rejected';
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1091,4 +1091,21 @@ $lang['add_rate'] = "Ajouter un taux";
|
|||
$lang['channel'] = "Cannal/Réseau";
|
||||
$lang["select_country"] = "Sélectionner un pays";
|
||||
$lang["confirm_recharge_account"] = "Confirmer le rechargement du compte";
|
||||
$lang["agency_banking"] = "Agence bancaire";
|
||||
$lang["lastname"] = "Nom";
|
||||
$lang["firstname"] = "Prénom";
|
||||
$lang["account"] = "Compte";
|
||||
$lang["balance"] = "Solde";
|
||||
$lang["status"] = "Statut";
|
||||
$lang["update_successfully"] = "Mise à jour effectuée avec succès";
|
||||
$lang["update_failed_one_error_occurred"] = "Mise à jour échouée, une erreur s'est produite";
|
||||
$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['status_pending'] = 'En attente';
|
||||
$lang['status_active'] = 'Actif';
|
||||
$lang['status_close'] = 'Fermé';
|
||||
$lang['status_rejected'] = 'Rejeté';
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -2322,4 +2322,25 @@ class User_model extends CI_Model
|
|||
preg_match("/^enum\(\'(.*)\'\)$/", $type, $matches);
|
||||
return explode("','", $matches[1]);
|
||||
}
|
||||
|
||||
function getAllRequests(){
|
||||
$result = $this->db->query("SELECT * FROM user_bank_accounts")->result();
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function updateInfoAgency($id, $data) {
|
||||
$this->db->where("id", $id);
|
||||
return $this->db->update("user_bank_accounts", $data);
|
||||
}
|
||||
|
||||
public function deleteInfoAgency($id) {
|
||||
$this->db->where("id", $id);
|
||||
return $this->db->delete("user_bank_accounts");
|
||||
}
|
||||
|
||||
public function get_account($id) {
|
||||
return $this->db->where('id', $id)
|
||||
->get('user_bank_accounts')
|
||||
->row();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,509 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Agency | Banking Management</title>
|
||||
<link rel="stylesheet" href="<?= base_url('<link rel="stylesheet"href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap.min.css">') ?>">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/css/bootstrap-multiselect.css">
|
||||
<link rel="stylesheet" href="<?= base_url('bower_components/toastr/toastr.css') ?>">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
|
||||
|
||||
<style>
|
||||
div.dataTables_wrapper {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
gap: 6px; /* espace entre les boutons */
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.action-buttons button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content-wrapper">
|
||||
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
<?= $this->lang->line('management_bank_accounts'); ?>
|
||||
</h1>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title"><?= $this->lang->line('list_bank_accounts'); ?></h3>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
<table class="table table-bordered table-striped" id="accountsTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">ID</th>
|
||||
<th class="text-center"><?= $this->lang->line('lastname'); ?></th>
|
||||
<th class="text-center"><?= $this->lang->line('firstname'); ?></th>
|
||||
<th class="text-center"><?= $this->lang->line('account'); ?></th>
|
||||
<th class="text-center">IBAN</th>
|
||||
<th class="text-center">Swift</th>
|
||||
<th class="text-center"><?= $this->lang->line('reason') ?></th>
|
||||
<th class="text-center">Type</th>
|
||||
<th class="text-center"><?= $this->lang->line('balance'); ?></th>
|
||||
<th class="text-center"><?= $this->lang->line('status'); ?></th>
|
||||
<th class="text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($accounts as $a): ?>
|
||||
<tr>
|
||||
<td class="text-center"><?= $a->id ?></td>
|
||||
<td class="text-center"><?= $a->lastname ?></td>
|
||||
<td class="text-center"><?= $a->firstname ?></td>
|
||||
<td class="text-center"><?= $a->account_number ?></td>
|
||||
<td class="text-center"><?= $a->iban ?></td>
|
||||
<td class="text-center"><?= $a->swift_code ?></td>
|
||||
<td class="text-center"><?= $a->reason ?? '-' ?></td>
|
||||
<td class="text-center"><?= $a->account_type ?></td>
|
||||
<td class="text-center"><?= number_format($a->balance,0,',',' ') ?></td>
|
||||
<td class="text-center">
|
||||
<?= getStatusBadge($a->status, $this->lang) ?>
|
||||
</td>
|
||||
<td class="text-center action-buttons">
|
||||
<button
|
||||
data-toggle="modal"
|
||||
data-target="#editModal"
|
||||
class="open-edit-modal btn btn-primary btn-sm"
|
||||
|
||||
data-id="<?= $a->id ?>"
|
||||
data-lastname="<?= $a->lastname ?>"
|
||||
data-firstname="<?= $a->firstname ?>"
|
||||
data-account_number="<?= $a->account_number ?>"
|
||||
data-iban="<?= $a->iban ?>"
|
||||
data-swift_code="<?= $a->swift_code ?>"
|
||||
data-status="<?= $a->status ?>"
|
||||
data-reason="<?= $a->reason ?>"
|
||||
data-balance="<?= $a->balance ?>"
|
||||
data-birth_date="<?= $a->birth_date ?>"
|
||||
data-birth_country="<?= $a->birth_country ?>"
|
||||
data-birth_city="<?= $a->birth_city ?>"
|
||||
data-father_firstname="<?= $a->father_firstname ?>"
|
||||
data-father_lastname="<?= $a->father_lastname ?>"
|
||||
data-mother_firstname="<?= $a->mother_firstname ?>"
|
||||
data-mother_lastname="<?= $a->mother_lastname ?>"
|
||||
data-marital_name="<?= $a->marital_name ?>"
|
||||
data-nationality="<?= $a->nationality ?>"
|
||||
data-marital_status="<?= $a->marital_status ?>"
|
||||
data-profession="<?= $a->profession ?>"
|
||||
data-sector_activity="<?= $a->sector_activity ?>"
|
||||
data-subsector_activity="<?= $a->subsector_activity ?>"
|
||||
data-tax_number="<?= $a->tax_number ?>"
|
||||
data-employee_number="<?= $a->employee_number ?>"
|
||||
data-position="<?= $a->position ?>"
|
||||
data-employer_name="<?= $a->employer_name ?>"
|
||||
data-employer_address="<?= $a->employer_address ?>"
|
||||
data-created_at="<?= $a->created_at ?>"
|
||||
|
||||
>
|
||||
<i class='fa fa-edit'></i>
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="delete-account btn btn-danger btn-sm"
|
||||
data-id="<?= $a->id ?>"
|
||||
onclick="deleteRequest(<?= $a->id ?>)"
|
||||
>
|
||||
<i class='fa fa-trash'></i>
|
||||
</button>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- MODAL EDIT -->
|
||||
<div class="modal fade" id="editModal">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span>×</span></button>
|
||||
<h4 class="modal-title text-center">Modifier la demande</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<form id="update-form" class="bottom-75 center-block">
|
||||
|
||||
<input type="hidden" name="id" id="edit_id">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Nom</label>
|
||||
<input id="edit_lastname" name="lastname" class="form-control input-lg" required>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Prénom</label>
|
||||
<input id="edit_firstname" name="firstname" class="form-control input-lg" required>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Numéro de compte</label>
|
||||
<input id="edit_account_number" name="account_number" class="form-control input-lg">
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>IBAN</label>
|
||||
<input id="edit_iban" name="iban" class="form-control input-lg">
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Swift</label>
|
||||
<input id="edit_swift_code" name="swift_code" class="form-control input-lg">
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Type de compte</label>
|
||||
<input id="edit_account_type" name="account_type" class="form-control input-lg">
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Balance</label>
|
||||
<input id="edit_balance" name="balance" class="form-control input-lg" required>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Statut du compte</label>
|
||||
<select id="edit_status" name="status" class="form-control input-lg" required>
|
||||
<option value="pending">En attente</option>
|
||||
<option value="active">Activé</option>
|
||||
<option value="rejected">Rejeté</option>
|
||||
<option value="close">Fermé</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Motif</label>
|
||||
<input id="edit_reason" name="reason" class="form-control input-lg" required>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Date de naissance</label>
|
||||
<input id="edit_birth_date" name="birth_date" class="form-control input-lg" required>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Pays de naissance</label>
|
||||
<input id="edit_birth_country" name="birth_country" class="form-control input-lg" required>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Ville de naissance</label>
|
||||
<input id="edit_birth_city" name="birth_city" class="form-control input-lg" required>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Nationalité</label>
|
||||
<input id="edit_nationality" name="nationality" class="form-control input-lg" required>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Nom de la mère</label>
|
||||
<input id="edit_mother_lastname" name="mother_lastname" class="form-control input-lg" required>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Prénom de la mère</label>
|
||||
<input id="edit_mother_firstname" name="mother_firstname" class="form-control input-lg" required>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Nom du père</label>
|
||||
<input id="edit_father_lastname" name="father_lastname" class="form-control input-lg" required>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Prénom du père</label>
|
||||
<input id="edit_father_firstname" name="father_firstname" class="form-control input-lg" required>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Statut matrimonial</label>
|
||||
<select id="edit_marital_status" name="marital_status" class="form-control input-lg" required>
|
||||
<option value="celibataire">Célibataire</option>
|
||||
<option value="marie">Marié</option>
|
||||
<option value="veuf">Veuf</option>
|
||||
<option value="divorce">Divorcé</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label> Numéro fiscal</label>
|
||||
<input id="edit_tax_number" name="tax_number" class="form-control input-lg" required>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Secteur d'activité</label>
|
||||
<input id="edit_sector_activity" name="sector_activity" class="form-control input-lg">
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Profession</label>
|
||||
<input id="edit_profession" name="profession" class="form-control input-lg" required>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Nom de l’employeur</label>
|
||||
<input id="edit_employer_name" name="employer_name" class="form-control input-lg">
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Adresse de l’employeur</label>
|
||||
<input id="edit_employer_address" name="employer_address" class="form-control input-lg">
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Matricule de l’employeur</label>
|
||||
<input id="edit_employee_number" name="employee_number" class="form-control input-lg">
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label>Date de création</label>
|
||||
<input id="edit_created_at" readonly class="form-control input-lg">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<button type="submit" class="btn btn-primary" id="btn-save-edit">Enregistrer</button>
|
||||
<button type="button" class="btn btn-default pull-right" data-dismiss="modal">Fermer</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- MODAL DELETE -->
|
||||
<div class="modal fade" id="deleteModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span>×</span></button>
|
||||
<h4 class="modal-title">Confirmer la suppression</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<p>Voulez-vous vraiment supprimer ce compte ?</p>
|
||||
<input type="hidden" id="delete_id">
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" id="confirmDelete" class="btn btn-danger">Supprimer</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<!-- jQuery 2.2.4 -->
|
||||
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
|
||||
|
||||
<!-- Bootstrap 3.3.7 -->
|
||||
<script src="<?= base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
|
||||
<!-- DataTables -->
|
||||
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap.min.js"></script>
|
||||
<!-- Slimscroll -->
|
||||
<script src="<?= base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
|
||||
<!-- FastClick -->
|
||||
<script src="<?= base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
|
||||
<!-- AdminLTE App -->
|
||||
<script src="<?= base_url('dist/js/adminlte.min.js') ?>"></script>
|
||||
<!-- AdminLTE for demo purposes -->
|
||||
<script src="<?= base_url('dist/js/demo.js') ?>"></script>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/js/bootstrap-multiselect.js"></script>
|
||||
|
||||
<script src="<?= base_url('bower_components/toastr/toastr.js') ?>"></script>
|
||||
<script src="<?= base_url('dist/js/sweetalert2.js') ?>"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
/* =====================================================
|
||||
* INITIALISATION DATATABLE
|
||||
* ===================================================== */
|
||||
$('#accountsTable').DataTable({
|
||||
"pageLength": 10,
|
||||
"ordering": true,
|
||||
"scrollX": true,
|
||||
dom: 'Bfrtip',
|
||||
"buttons": [
|
||||
'pageLength',
|
||||
{
|
||||
"extend": 'excelHtml5',
|
||||
title: "<?= $this->lang->line('list_bank_accounts') ?>",
|
||||
},
|
||||
{
|
||||
extend: 'csvHtml5',
|
||||
title: "<?= $this->lang->line('list_bank_accounts') ?>",
|
||||
},
|
||||
{
|
||||
extend: 'pdfHtml5',
|
||||
orientation: 'landscape',
|
||||
pageSize: 'LEGAL',
|
||||
title: "<?= $this->lang->line('list_bank_accounts') ?>",
|
||||
},
|
||||
// 'colvis'
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
// === FLATPICKR ===
|
||||
flatpickr("#edit_birth_date",
|
||||
{
|
||||
dateFormat: "Y-m-d",
|
||||
maxDate: "today",
|
||||
disableMobile: true
|
||||
});
|
||||
|
||||
/* =====================================================
|
||||
* OUVERTURE DU MODAL : AUTO-FILL DES DONNÉES
|
||||
* ===================================================== */
|
||||
$(document).on("click", ".open-edit-modal", function () {
|
||||
|
||||
const fields = [
|
||||
"id", "lastname", "firstname", "account_number", "iban", "swift_code",
|
||||
"status", "reason", "balance", "birth_date", "birth_country",
|
||||
"birth_city", "father_firstname", "father_lastname",
|
||||
"mother_firstname", "mother_lastname", "marital_name", "nationality",
|
||||
"marital_status", "profession", "sector_activity",
|
||||
"subsector_activity", "tax_number", "employee_number", "position",
|
||||
"employer_name", "employer_address", "created_at", "account_type"
|
||||
];
|
||||
|
||||
fields.forEach(f => {
|
||||
$("#edit_" + f).val($(this).data(f));
|
||||
});
|
||||
});
|
||||
|
||||
// === ENVOI DU FORMULAIRE DE MISE À JOUR ===
|
||||
$("#btn-save-edit").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
$.ajax({
|
||||
url: "<?= base_url('Gestion/update_request_agency'); ?>",
|
||||
type: "POST",
|
||||
data: $("#update-form").serialize(),
|
||||
dataType: "json",
|
||||
|
||||
success: function (res) {
|
||||
|
||||
// Vérification de base
|
||||
if (!res) {
|
||||
toastr.error("Réponse invalide du serveur");
|
||||
return;
|
||||
}
|
||||
|
||||
// Si le serveur a envoyé alert = ok
|
||||
if (res.alert === "ok") {
|
||||
|
||||
// Succès total
|
||||
if (res.success === "ok") {
|
||||
|
||||
// Fermer la modal
|
||||
$('#editModal').modal('hide');
|
||||
|
||||
//Afficher reponse
|
||||
toastr.success(res.message)
|
||||
|
||||
setTimeout(() => {
|
||||
location.reload();
|
||||
}, 2600);
|
||||
|
||||
} else {
|
||||
// Message d'erreur du serveur
|
||||
toastr.errot(res.message);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
error: function () {
|
||||
toastr.error("Erreur interne (500)");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* =====================================================
|
||||
* SUPPRESSION : OUVERTURE MODAL
|
||||
* ===================================================== */
|
||||
window.deleteRequest = function (id) {
|
||||
$("#delete_id").val(id);
|
||||
$("#deleteModal").modal("show");
|
||||
};
|
||||
|
||||
/* =====================================================
|
||||
* CONFIRMATION SUPPRESSION
|
||||
* ===================================================== */
|
||||
$("#confirmDelete").click(function () {
|
||||
|
||||
const id = $("#delete_id").val();
|
||||
|
||||
$.ajax({
|
||||
url: "<?= base_url('Gestion/delete_request_agency') ?>",
|
||||
method: "POST",
|
||||
data: { id: id },
|
||||
dataType: "json",
|
||||
|
||||
success: function (response) {
|
||||
if (response.success === "ok") {
|
||||
|
||||
$("#deleteModal").modal("hide");
|
||||
toastr.success(response.message);
|
||||
|
||||
setTimeout(() => {
|
||||
location.reload();
|
||||
}, 2600);
|
||||
|
||||
} else {
|
||||
toastr.error(response.message);
|
||||
}
|
||||
},
|
||||
|
||||
error: function () {
|
||||
toastr.error("Erreur serveur. (500)");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
|
@ -190,6 +190,14 @@
|
|||
<i class="fa fa-building"></i> <span><?= $this->lang->line('operators'); ?></span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="<?php if($active=="agency_banking"){echo "active";} ?>">
|
||||
<a href="<?= base_url('Gestion/agency_banking') ?>">
|
||||
<i class="fa fa-university"></i>
|
||||
<span> <span><?= $this->lang->line('agency_banking'); ?></span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="<?php if($active=="aggregators"){echo "active";} ?>">
|
||||
<a href="<?php echo base_url('index.php/Gestion/aggregators') ?>">
|
||||
<i class="ion ion-cash"></i> <span><?php echo $this->lang->line('aggregators'); ?></span>
|
||||
|
|
|
|||
Loading…
Reference in New Issue