+ Management of banks

This commit is contained in:
Djery-Tom 2020-10-27 11:50:41 +01:00
parent 6f22d1cc1d
commit cac703c271
10 changed files with 960 additions and 3 deletions

View File

@ -265,7 +265,7 @@ class Gestion extends CI_Controller
$hyper = $this->session->userdata('current_hyper'); $hyper = $this->session->userdata('current_hyper');
$pays = $this->session->userdata('current_pays'); $pays = $this->session->userdata('current_pays');
$data['list_villes'] = $this->user_model->getAllVilles(); // $data['list_villes'] = $this->user_model->getAllVilles();
$data['pays'] = $this->user_model->getAllCountries(); $data['pays'] = $this->user_model->getAllCountries();
$data['game_pays'] = $this->user_model->getGameCountry(); $data['game_pays'] = $this->user_model->getGameCountry();
$data['alert'] = ""; $data['alert'] = "";
@ -2286,5 +2286,149 @@ class Gestion extends CI_Controller
} }
} }
public function banks()
{
if ($this->isLogged()) {
$data['banks'] = $this->wallet_model->getAllBanksCountries();
$data['pays'] = $this->user_model->getAllPays();
$data['game_pays'] = $this->user_model->getGameCountry();
$data['alert'] = "";
$data['active'] = "banks";
$data['distinct_banks'] = $this->wallet_model->getAllBanks();
$this->load->view('header_gestion', $data);
$this->load->view('gestion_banques_admin');
$this->load->view('footer');
}
}
public function add_bank()
{
if ($this->isLogged()) {
if (isset($_POST)) {
$data = array(
'nom' => $this->input->post('name'),
);
$query = $this->db->insert('banks', $data);
if ($query) {
echo json_encode("completed");
} else {
echo json_encode("error");
}
}
}
}
public function delete_bank()
{
if ($this->isLogged()) {
if (isset($_POST)) {
$id_bank = $this->input->post('id_bank');
$id_country = $this->input->post('id_country');
$query = $this->wallet_model->deleteBankCountry($id_bank, $id_country);
if ($query) {
echo json_encode("completed");
} else {
echo json_encode("error");
}
}
}
}
public function assign_bank()
{
if ($this->isLogged()) {
if (isset($_POST)) {
$id_bank = $this->input->post('id_bank');
$existe = 0;
$this->db->trans_begin();
foreach ($_POST['id_country'] AS $country) {
$res = $this->wallet_model->checkIfBankAssignationExist($country, $id_bank);
if ($res == false) {
$data = array('id_country' => $country , 'id_bank' => $id_bank);
$this->db->insert('banks_countries', $data);
} else {
$existe = $existe + 1;
}
}
if ($this->db->trans_status() === FALSE) {
$this->db->trans_rollback();
echo json_encode("error");
} elseif ($existe > 0) {
$this->db->trans_commit();
echo json_encode("existe");
} else {
$this->db->trans_commit();
echo json_encode("completed");
}
}
}
}
public function update_bank()
{
if ($this->isLogged()) {
if (isset($_POST)) {
$id_bank = $this->input->post('id_bank');
$id_country = $this->input->post('id_country');
$name = $this->input->post('name');
$address = $this->input->post('address');
$res = $this->wallet_model->updateBank($id_bank, $id_country ,$name , $address);
if ($res == true) {
echo json_encode("completed");
} else {
echo json_encode("error");
}
}
}
}
public function change_bank_status()
{
if ($this->isLogged()) {
if (isset($_POST)) {
$activations = $this->input->post('activations');
$desactivation = $this->input->post('desactivations');
$this->db->trans_begin();
if (!empty($_POST['activations'])) {
foreach ($_POST['activations'] AS $row) {
$data = array('status' => 1);
$this->db->where('id_bank', $row['id_bank']);
$this->db->where('id_country', $row['id_country']);
$this->db->update('banks_countries', $data);
}
}
if (!empty($_POST['desactivations'])) {
foreach ($_POST['desactivations'] AS $row) {
$data = array('status' => 0);
$this->db->where('id_bank', $row['id_bank']);
$this->db->where('id_country', $row['id_country']);
$this->db->update('banks_countries', $data);
}
}
if ($this->db->trans_status() === FALSE) {
$this->db->trans_rollback();
echo json_encode("error");
} else {
$this->db->trans_commit();
echo json_encode("completed");
}
}
}
}
} }

View File

@ -1539,6 +1539,72 @@ class Hyperviseur_dash extends CI_Controller
} }
} }
} }
public function banks()
{
if ($this->isLogged()) {
$data['active'] = "banks";
$data['alert'] = "";
$data['firstname'] = $this->session->userdata('firstname');
$data['lastname'] = $this->session->userdata('lastname');
$data['email'] = $this->session->userdata('email');
$data['network'] = $this->session->userdata('network');
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
$data['networks'] = $this->user_model->getActiveNetwork();
$data['currency_code'] = $this->session->userdata('currency_code');
$data['category'] = $this->session->userdata('category');
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
$data['banks'] = $this->wallet_model->getBanksForNetwork($this->session->userdata('network_id'));
$this->load->view('header_hyp', $data);
$this->load->view('gestion_banques_hyp');
$this->load->view('footer');
}
}
public function active_bank()
{
if ($this->isLogged()) {
if (isset($_POST)) {
$data = array(
'id_bank_country' => $this->input->post('id_bank_country'),
'id_network' => $this->input->post('id_network')
);
$query = $this->db->insert('networks_banks', $data);
if ($query) {
echo json_encode("200");
} else {
echo json_encode("500");
}
}
}
}
public function deactive_bank()
{
if ($this->isLogged()) {
if (isset($_POST)) {
$data = array(
'id_bank_country' => $this->input->post('id_bank_country'),
'id_network' => $this->input->post('id_network')
);
$query = $this->db->delete('networks_banks', $data);
if ($query) {
echo json_encode("200");
} else {
echo json_encode("500");
}
}
}
}
} }
class Operation class Operation

View File

@ -515,4 +515,19 @@ $lang['id_identity_document'] = "Identity document number";
$lang['expiry_date_document'] = "Document expiration date"; $lang['expiry_date_document'] = "Document expiration date";
$lang['user_image'] = "Profile picture"; $lang['user_image'] = "Profile picture";
$lang['users_found'] = 'users found'; $lang['users_found'] = 'users found';
$lang['status_with_paying_network'] = "Status with the paying network";
$lang['banks'] = 'Banks';
$lang['bank'] = 'Bank';
$lang['management_banks'] = "Management of banks";
$lang['add_bank'] = "Add a bank";
$lang['no_bank'] = "No bank";
$lang['bank_added'] = "The bank has been added";
$lang['bank_assigned'] = "The bank has been assigned";
$lang['bank_modified'] = "The bank has been modified";
$lang['bank_deleted'] = "The bank has been deleted";
$lang['bank_activated'] = "The bank has been activated";
$lang['bank_deactivated'] = "The bank has been deactivated";
$lang['bank_deactivation'] = "Deactivation of the bank";
$lang['modify_bank'] = "Modify the bank";
$lang['assign_bank_to_country'] = "Assign a bank to a country";
?> ?>

View File

@ -527,4 +527,20 @@ $lang['id_identity_document'] = "Numero de la pièce d'identité";
$lang['expiry_date_document'] = "Date d'expiration du document"; $lang['expiry_date_document'] = "Date d'expiration du document";
$lang['user_image'] = "Photo de profil"; $lang['user_image'] = "Photo de profil";
$lang['users_found'] = 'utilisateurs trouvés'; $lang['users_found'] = 'utilisateurs trouvés';
$lang['status_with_paying_network'] = "Statut chez le réseau payeur";
$lang['banks'] = 'Banques';
$lang['bank'] = 'Banque';
$lang['management_banks'] = "Gestion des banques";
$lang['add_bank'] = "Ajouter une banque";
$lang['no_bank'] = "Aucune banque";
$lang['bank_added'] = "La banque a été ajoutée";
$lang['bank_assigned'] = "La banque a été assignée";
$lang['bank_modified'] = "La banque a été modifiée";
$lang['bank_deleted'] = "La banque a été supprimée";
$lang['bank_activated'] = "La banque a été activée";
$lang['bank_deactivated'] = "La banque a été désactivée";
$lang['bank_deactivation'] = "Désactivation de la banque";
$lang['modify_bank'] = "Modifier la banque";
$lang['assign_bank_to_country'] = "Assigner une banque à un pays";
?> ?>

View File

@ -861,4 +861,47 @@ INNER JOIN countries_currencies cc ON n.country_id= cc.id INNER JOIN configWalle
$query = $this->db->query($sql , array($max_day_national,$max_week_national,$max_month_national,$max_day_international,$max_week_international,$max_month_international,$id_country)); $query = $this->db->query($sql , array($max_day_national,$max_week_national,$max_month_national,$max_day_international,$max_week_international,$max_month_international,$id_country));
return $query; return $query;
} }
// Banques
public function getAllBanksCountries(){
$query = $this->db->query("SELECT b.id, b.nom as bank_name , bc.adresse as bank_address , bc.status, c.name as country , c.id as country_id FROM banks_countries bc INNER JOIN banks b ON b.id = bc.id_bank INNER JOIN countries c ON c.id = bc.id_country");
return $query->num_rows() > 0 ? $query : false ;
}
public function getAllBanks(){
$query = $this->db->query("SELECT * FROM banks");
return $query->num_rows() > 0 ? $query : false ;
}
public function checkIfBankAssignationExist($id_country,$id_bank){
$query = $this->db->query("SELECT * FROM banks_countries WHERE id_country ='".$id_country."' AND id_bank='".$id_bank."'");
return $query->num_rows() > 0 ? $query : false ;
}
public function getBank($id_bank){
$query = $this->db->query("SELECT * FROM banks WHERE id='".$id_bank."'");
return $query->num_rows() > 0 ? $query : false ;
}
public function updateBank($id_bank,$id_country, $name , $address){
$sql = "UPDATE `banks` SET `nom` = ? WHERE (`id` = ?);";
$this->db->query($sql , array($name,$id_bank));
$sql = "UPDATE `banks_countries` SET `adresse` = ? WHERE (`id_bank` = ? AND `id_country` = ?);";
return $this->db->query($sql , array($address,$id_bank,$id_country));
}
public function deleteBankCountry($id_bank, $id_country){
$sql = "DELETE FROM `banks_countries` WHERE `id_bank` = ? AND `id_country` = ?";
$query = $this->db->query($sql, array($id_bank,$id_country));
return $query;
}
public function getBanksForNetwork($id_network){
$sql = "SELECT bc.id, b.nom as bank_name , bc.adresse as bank_address, c.name as country , c.id as country_id , nb.id_network FROM networks n
CROSS JOIN banks_countries bc INNER JOIN banks b ON b.id = bc.id_bank INNER JOIN countries c ON c.id = bc.id_country
LEFT JOIn networks_banks nb ON nb.id_bank_country = bc.id AND nb.id_network = n.id WHERE bc.status = 1 AND n.id = ?";
$query = $this->db->query($sql , array($id_network));
return $query->num_rows() > 0 ? $query : false ;
}
} }

View File

@ -0,0 +1,425 @@
<link rel="stylesheet" href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/css/bootstrap-multiselect.css">
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?php echo $this->lang->line('management_banks'); ?>
<input type="button" class="btn btn-primary pull-right" id="Bactiver" value="Activer/Désactiver le(s) banque(s)" style="display: none;" />
</h1>
<?php
$site_url = base_url();
if($alert=="ok") {
if(!$success=="ok"){
?>
<div class='alert alert-danger alert-dismissible col-xs-6'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<h4><i class='icon fa fa-ban'></i> Erreur!</h4>
<?php echo $message; ?>
</div>
<?php
} else {
?>
<div class="alert alert-success alert-dismissible col-xs-6">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h4><i class="icon fa fa-check"></i> Success!</h4>
<?php echo $message; ?>
</div>
<?php
}
}
?>
</section>
<section class="content">
<div class="row">
<div class="col-lg-8">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php echo $this->lang->line('banks'); ?></h3>
</div>
<div class="box-body" style="overflow-x:auto;">
<?php
$sql2 = $banks;
if($sql2!=false){
$numrows=$sql2->num_rows();
$num = 0;
if ($numrows > 0) {
?>
<table id="validated" class="table table-bordered table-striped">
<thead>
<tr>
<th align='center'></th>
<th><?php echo $this->lang->line('Pays'); ?></th>
<th><?php echo $this->lang->line('Nom'); ?></th>
<th><?php echo $this->lang->line('Adresse'); ?></th>
<th align='center'><?php echo $this->lang->line('Statut'); ?></th>
<th align='center'><?php echo $this->lang->line('Activer/Désactiver'); ?></th>
<th align='center'><?php echo $this->lang->line('Modifier'); ?></th>
<th align="center"><?php echo $this->lang->line('Supprimer'); ?></th>
</tr>
</thead>
<tbody>
<?php
foreach($sql2->result() as $row) {
$num ++;
//$member_code = randomString1(10);
$libelle_status = $this->lang->line('Actif');
if($row->status==0){
$libelle_status = $this->lang->line('Inactif');
}
echo "<tr>
<td align='center'>$num</td>
<td>$row->country</td>
<td >$row->bank_name</td>
<td >$row->bank_address</td>
<td align='center'>$libelle_status</td>";
if($row->status==0){
echo "<td align='center'><label>
<input type='checkbox' name='activer' class='minimal' data-id-bank='".$row->id."' data-id-country='".$row->country_id."' >
</label>
<label>
<input type='checkbox' name='desactiver' class='minimal-red' disabled data-id-bank='".$row->id."' data-id-country='".$row->country_id."'>
</label></td>";
}else{
echo "<td align='center'><label>
<input type='checkbox' name='activer' class='minimal' disabled data-id-bank='".$row->id."' data-id-country='".$row->country_id."'>
</label>
<label>
<input type='checkbox' name='desactiver' class='minimal-red' data-id-bank='".$row->id."' data-id-country='".$row->country_id."'>
</label></td>";
}
echo "<td id='edition' align='center'>
<button data-toggle='modal' data-id-bank='$row->id' data-name-bank='$row->bank_name' data-address-bank='$row->bank_address'
data-country='$row->country' data-id-country='$row->country_id' class='open-modal btn btn-success' data-target='#editModal'><i class='fa fa-edit'></i></button>
</td>
<td id='suppression' align='center'>
<button data-toggle='modal' data-id-bank='$row->id' data-id-country='$row->country_id' class='delete-bank btn btn-danger' ><i class='fa fa-trash'></i></button>
</td>
</tr>";
}
?>
</tbody>
</table>
<?php
}
else {
echo $this->lang->line('no_bank');
}
}else {
echo $this->lang->line('no_bank');
}
?>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php echo $this->lang->line('add_bank'); ?></h3>
</div>
<div class="box-body">
<form id="add-bank" method="post" class="bottom-75 center-block">
<div class="form-group">
<label for="name"><?php echo $this->lang->line('Nom'); ?></label>
<input type="text" class="form-control input-lg" name="name" required id="name">
</div>
<div class="form-group">
<input id="btn-add" type="submit" value="<?php echo $this->lang->line('Ajouter'); ?>" class="btn btn-primary">
</div>
</form>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php echo $this->lang->line('assign_bank_to_country'); ?></h3>
</div>
<div class="box-body">
<form id="assign-form" method="post" class="bottom-75 center-block">
<div class="form-group">
<label for="pays"><?php echo $this->lang->line('Pays'); ?></label>
<?php
$result=$pays;
$numrows=$result->num_rows();
if ($numrows > 0) { ?>
<select class="form-control input-lg" name="pays" required id="pays" multiple="multiple" >
<?php foreach($result->result() as $row) {
echo "<option value='".$row->id."' id='".$row->code_country."'>".$row->name."</option>";
} ?>
</select>
<?php }else{
echo $this->lang->line("Aucun pays");
}
?>
</div>
<div class="form-group">
<label for="ville"><?php echo $this->lang->line('banks'); ?></label>
<?php
$result=$distinct_banks;
if($result!=false) {
$numrows = $result->num_rows();
if ($numrows > 0) { ?>
<select class="form-control input-lg" name="bank" required id="bank">
<?php foreach ($result->result() as $row) {
echo "<option value='" . $row->id. "'>" . $row->nom . "</option>";
} ?>
</select>
<?php } else {
echo $this->lang->line("no_bank");
}
}else{
echo $this->lang->line("no_bank");
}
?>
</div>
<div class="form-group">
<input id="btn-add" type="submit" value="<?php echo $this->lang->line('Ajouter'); ?>" class="btn btn-primary">
</div>
</form>
</div>
</div>
</div>
</div>
<div class="modal fade" id="editModal">
<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"><?php echo $this->lang->line('modify_bank'); ?></h4>
</div>
<div class="modal-body">
<form id="update-form" method="post" class="bottom-75 center-block">
<div class="form-group">
<label for="modal-pays"><?php echo $this->lang->line('Pays'); ?></label>
<input type="text" class="form-control input-lg" name="pays" required id="modal-pays" readonly="readonly">
</div>
<div class="form-group">
<label for="name"><?php echo $this->lang->line('Nom'); ?></label>
<input type="text" class="form-control input-lg" name="name" required id="name">
</div>
<div class="form-group">
<label for="address"><?php echo $this->lang->line('Adresse'); ?></label>
<input type="text" class="form-control input-lg" name="address" required id="address">
</div>
<div class="form-group">
<input id="btn-add" type="submit" value="Confirmer" class="btn btn-primary">
<button type="button" class="btn btn-default pull-right" data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- jQuery 3 -->
<script src="<?php echo base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
<!-- Bootstrap 3.3.7 -->
<script src="<?php echo base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
<!-- DataTables -->
<script src="<?php echo base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
<script src="<?php echo base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?>"></script>
<!-- Slimscroll -->
<script src="<?php echo base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
<!-- FastClick -->
<script src="<?php echo base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
<!-- AdminLTE App -->
<script src="<?php echo base_url('dist/js/adminlte.min.js') ?>"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?php echo 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>
$(document).ready(function() {
var checkboxes = $("td input[type='checkbox']");
checkboxes.click(function() {
if ($("td input:checkbox:checked").length > 0)
{
$("#Bactiver").css("display", "block");
}else{
$("#Bactiver").css("display", "none");
}
});
var Bactiver = $("#Bactiver");
Bactiver.click(function(){
var activation = [];
var desactivation = [];
$.each($("input[name='activer']:checked"), function(){
activation.push({"id_bank" : $(this).data('id-bank'),"id_country": $(this).data('id-country')});
});
$.each($("input[name='desactiver']:checked"), function(){
desactivation.push({"id_bank" : $(this).data('id-bank'),"id_country": $(this).data('id-country')});
});
// console.log('act' , activation)
// console.log('desact' , desactivation)
$.ajax({
url:'<?php echo base_url('index.php/Gestion/change_bank_status')?>',
type: 'post',
data: {activations: activation,desactivations:desactivation},
dataType: 'json',
success: function(data){
if(data==='completed'){
alert('Banques(s) activée(s)/désactivée(s)');
location.reload(true);
}else{
alert(data);
//alert("<?= $this->lang->line('error_message') ?>");
location.reload(true);
}
}
});
});
});
</script>
<script>
$(function() {
$('#unvalidated').DataTable();
$('#validated').DataTable();
})
</script>
<script>
$(function() {
$('#pays').multiselect({
includeSelectAllOption: true
});
});
</script>
<script>
var id_bank = null;
var name_network = null;
var id_country = null;
var country = null;
$(document).on("click", ".open-modal", function () {
id_bank = $(this).data('id-bank');
const bank_name = $(this).data('name-bank');
const bank_address = $(this).data('address-bank');
id_country = $(this).data('id-country');
country = $(this).data('country');
$(".modal-body #modal-pays").val(country);
$(".modal-body #name").val( bank_name );
$(".modal-body #address").val( bank_address );
});
$(document).on("click", ".delete-bank", function (event) {
id_bank = $(this).data('id-bank');
id_country = $(this).data('id-country');
$.ajax({
url:'<?php echo base_url('index.php/Gestion/delete_bank')?>',
type: 'post',
data: {id_bank: id_bank , id_country : id_country},
dataType: 'json',
success: function(data){
if(data==='completed'){
alert("<?= $this->lang->line('bank_deleted') ?>");
location.reload(true);
}else{
alert("<?= $this->lang->line('error_message') ?>");
location.reload(true);
}
}
});
event.preventDefault();
});
$("#assign-form").submit(function(event){
var id_bank = $("#assign-form #bank").val();
var selectedValues = $('#assign-form #pays').val();
$.ajax({
url:'<?php echo base_url('index.php/Gestion/assign_bank')?>',
type: 'post',
data: {id_country: selectedValues,id_bank:id_bank},
dataType: 'json',
success: function(data){
if(data==='completed'){
alert("<?= $this->lang->line('bank_assigned') ?>");
location.reload(true);
}else if(data==='existe'){
alert('Ce réseau a déjà été assigné à certains des pays sélectionnés');
location.reload(true);
}else{
alert("<?= $this->lang->line('error_message') ?>");
location.reload(true);
alert(data);
}
}
});
event.preventDefault();
});
$("#add-bank").submit(function(event){
var name = $("#add-bank #name").val();
$.ajax({
url:'<?php echo base_url('index.php/Gestion/add_bank')?>',
type: 'post',
data: {name: name},
dataType: 'json',
success: function(data){
if(data==='completed'){
alert("<?= $this->lang->line('bank_added') ?>");
location.reload(true);
}else{
alert("<?= $this->lang->line('error_message') ?>");
location.reload(true);
}
}
});
event.preventDefault();
});
$("#update-form").submit(function(event){
const name = $("#update-form #name").val();
const address = $("#update-form #address").val();
$.ajax({
url:'<?php echo base_url('index.php/Gestion/update_bank')?>',
type: 'post',
data: {id_bank: id_bank ,name:name , address :address , id_country : id_country},
dataType: 'json',
success: function(data){
if(data==='completed'){
alert("<?= $this->lang->line('bank_modified') ?>");
location.reload(true);
}else{
alert("<?= $this->lang->line('error_message') ?>");
location.reload(true);
}
}
});
event.preventDefault();
});
</script>

View File

@ -0,0 +1,234 @@
<link rel="stylesheet" href="<?php echo base_url('bower_components/datatables.net-bs/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="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?php echo $this->lang->line('management_banks'); ?>
</h1>
<?php
$site_url = base_url();
if($alert=="ok") {
if(!$success=="ok"){
?>
<div class='alert alert-danger alert-dismissible col-xs-6'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<h4><i class='icon fa fa-ban'></i> Erreur!</h4>
<?php echo $message; ?>
</div>
<?php
} else {
?>
<div class="alert alert-success alert-dismissible col-xs-6">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h4><i class="icon fa fa-check"></i> Success!</h4>
<?php echo $message; ?>
</div>
<?php
}
}
?>
</section>
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php echo $this->lang->line('banks'); ?></h3>
</div>
<div class="box-body" style="overflow-x:auto;">
<?php
$sql2 = $banks;
if($sql2!=false){
$numrows=$sql2->num_rows();
$num = 0;
if ($numrows > 0) {
?>
<table id="validated" class="table table-bordered table-striped">
<thead>
<tr>
<th align='center'></th>
<th><?php echo $this->lang->line('Pays'); ?></th>
<th><?php echo $this->lang->line('Nom'); ?></th>
<th align='center'><?php echo $this->lang->line('Adresse'); ?></th>
<th align='center'><?php echo $this->lang->line('Statut'); ?></th>
<th align='center'><?php echo $this->lang->line('Activer/Désactiver'); ?></th>
<!-- <th align='center'> Action </th>-->
</tr>
</thead>
<tbody>
<?php
foreach($sql2->result() as $row) {
$num ++;
//$member_code = randomString1(10);
echo "<tr>
<td align='center'>$num</td>
<td >$row->country</td>
<td >$row->bank_name</td>
<td>$row->bank_address</td>";
?>
<?php
if($row->id_network){
?>
<td><span class="label label-success"><?= $this->lang->line('Actif'); ?></span></td>
<td><button type="button" data-toggle="modal" data-target="#disableBank" data-id-bank-country="<?=$row->id ?>" data-id-network="<?= $row->id_network ?>" class="btn btn-danger openModal"><?= $this->lang->line('Désactiver'); ?></button></td>
<?php
}else{
?>
<td><span class="label label-danger"><?= $this->lang->line('Inactif'); ?></span></td>
<td><button type="button" data-id-bank-country="<?= $row->id ?>" data-id-network="<?= $this->session->userdata('network_id') ?>" class="btn btn-primary activeBank" ><?php echo $this->lang->line('Activer'); ?></button></td>
<?php
}
?>
<!-- <td>-->
<!-- <a href="--><?php //echo current_url().($row->id_network ? '?id='.$row->id_network : '')?><!--" class="btn btn-primary btn-block" --><?php //if(!$row->id_network) echo "disabled"?><!-- >-->
<!-- <b>--><?php //echo $this->lang->line('Voir plus...'); ?><!--</b>-->
<!-- </a>-->
<!-- </td>-->
<?php
}
?>
</tbody>
</table>
<?php
}
else {
echo $this->lang->line('no_bank');
}
}else {
echo $this->lang->line('no_bank');
}
?>
</div>
</div>
</div>
</div>
<div class="modal fade" id="disableBank" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title"><?php echo $this->lang->line('bank_deactivation'); ?></h3>
</div>
<div class="modal-body">
<h4> Etes vous certain de vouloir ?</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
<button type="button" class="btn btn-primary" id="deleteWallet" > <?php echo $this->lang->line('Valider'); ?></button>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- jQuery 3 -->
<script src="<?php echo base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
<!-- Bootstrap 3.3.7 -->
<script src="<?php echo base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
<!-- DataTables -->
<script src="<?php echo base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
<script src="<?php echo base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?>"></script>
<!-- Slimscroll -->
<script src="<?php echo base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
<!-- FastClick -->
<script src="<?php echo base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
<!-- AdminLTE App -->
<script src="<?php echo base_url('dist/js/adminlte.min.js') ?>"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?php echo base_url('dist/js/demo.js') ?>"></script>
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
<script src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
<script>
$(function() {
$('#validated').DataTable();
})
</script>
<script>
toastr.options.closeButton = true;
toastr.options.closeMethod = 'fadeOut';
toastr.options.closeDuration = 5000;
toastr.options.closeEasing = 'swing';
var id_bank_country = null;
$(document).on("click", ".openModal", function () {
id_bank_country = $(this).data('id-bank-country');
id_network = $(this).data('id-network');
})
$(document).on("click", ".activeBank", function () {
const id_bank_country = $(this).data('id-bank-country');
const id_network = $(this).data('id-network');
$.ajax({
url : '<?php echo base_url('index.php/Hyperviseur_dash/active_bank')?>',
type : 'POST',
dataType : 'json',
data: {"id_bank_country": id_bank_country , "id_network" : id_network},
success : function(data){
if(data=='200'){
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('bank_activated')?>",
text: "<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" :
}else{
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?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')?>");
}
})
});
$('#deleteWallet').click(function(){
$.ajax({
url : '<?php echo base_url('index.php/Hyperviseur_dash/deactive_bank')?>',
type : 'POST',
dataType : 'json',
data: {"id_bank_country": id_bank_country , "id_network" : id_network},
success : function(data){
if(data=='200'){
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('bank_deactivated')?>",
text: "<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" : location.reload();
}else{
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
},
error : function(resultat, statut, erreur){
console.log(resultat+" "+erreur);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
});
});
</script>

View File

@ -175,7 +175,13 @@
echo "active"; echo "active";
} ?>"> } ?>">
<a href="<?php echo base_url('index.php/Gestion/regulations') ?>"> <a href="<?php echo base_url('index.php/Gestion/regulations') ?>">
<i class="fa fa-bank"></i> <span><?php echo $this->lang->line('regulations'); ?></span> <i class="fa fa-registered"></i> <span><?php echo $this->lang->line('regulations'); ?></span>
</a>
</li>
<li class="<?php if($active=="banks"){echo "active";} ?>">
<a href="<?php echo base_url('index.php/Gestion/banks') ?>">
<i class="fa fa-bank"></i> <span><?php echo $this->lang->line('banks'); ?></span>
</a> </a>
</li> </li>
</ul> </ul>

View File

@ -202,6 +202,12 @@
</a> </a>
</li> </li>
<?php }?> <?php }?>
<li class="<?php if($active=="banks"){echo "active";} ?>">
<a href="<?php echo base_url('index.php/Hyperviseur_dash/banks') ?>">
<i class="fa fa-bank"></i> <span><?php echo $this->lang->line('banks'); ?></span>
</a>
</li>
<?php } ?> <?php } ?>
<li class="<?php if($active=="recherche"){echo "active";} ?>"> <li class="<?php if($active=="recherche"){echo "active";} ?>">

View File

@ -140,6 +140,7 @@ function toLocateDate($date , $timezone){
<th><?php echo $this->lang->line('customer_net_amount_init') ?></th> <th><?php echo $this->lang->line('customer_net_amount_init') ?></th>
<th><?php echo $this->lang->line('customer_net_amount_final') ?></th> <th><?php echo $this->lang->line('customer_net_amount_final') ?></th>
<th><?php echo $this->lang->line('commission_paying_network') ?></th> <th><?php echo $this->lang->line('commission_paying_network') ?></th>
<th><?php echo $this->lang->line('status_with_paying_network') ?></th>
<th><?php echo $this->lang->line('final_currency') ?></th> <th><?php echo $this->lang->line('final_currency') ?></th>
<th><?php echo $this->lang->line('departure_country') ?></th> <th><?php echo $this->lang->line('departure_country') ?></th>
<th><?php echo $this->lang->line('country_of_destination') ?></th> <th><?php echo $this->lang->line('country_of_destination') ?></th>
@ -183,11 +184,12 @@ function toLocateDate($date , $timezone){
$moneyNetFinal =Money::of(round($row->montant_net_final_country,2),$row->final_currency ? $row->final_currency : 'XAF',$context); $moneyNetFinal =Money::of(round($row->montant_net_final_country,2),$row->final_currency ? $row->final_currency : 'XAF',$context);
echo "<tr> echo "<tr>
<td align='center' >$row->id_transaction</td> <td align='center' >$row->id_transaction</td>
<td>" . strtoupper($row->acteur) . ' - ' . $row->operation . "</td> <td>" . strtoupper($row->acteur) . ' - ' .($this->session->userdata('site_lang') === 'french' ? $row->operation_fr : $row->operation_en). "</td>
<td>" . join(" ", str_split($row->numero_carte, 4)) . "</td> <td>" . join(" ", str_split($row->numero_carte, 4)) . "</td>
<td>" . $moneyNetInit->formatTo('fr_FR') . "</td> <td>" . $moneyNetInit->formatTo('fr_FR') . "</td>
<td>" . $moneyNetFinal->formatTo('fr_FR') . "</td> <td>" . $moneyNetFinal->formatTo('fr_FR') . "</td>
<td>" . Money::of(round($row->part_reseau_payeur_final_country ? $row->part_reseau_payeur_final_country : 0, 2), $row->final_currency ? $row->final_currency : 'XAF', $context)->formatTo('fr_FR') . "</td> <td>" . Money::of(round($row->part_reseau_payeur_final_country ? $row->part_reseau_payeur_final_country : 0, 2), $row->final_currency ? $row->final_currency : 'XAF', $context)->formatTo('fr_FR') . "</td>
<td>" . str_replace('_',' ',$row->status_reseau_payeur). "</td>
<td>" . $row->final_currency . "</td> <td>" . $row->final_currency . "</td>
<td>".$row->pays_init."</td> <td>".$row->pays_init."</td>
<td>".$row->pays_final."</td> <td>".$row->pays_final."</td>