feat: add config of "User - Retrait de carte vers autre wallet" in hypervisor wallet dashboard and aggregator rate config in admin dashboard

This commit is contained in:
Djery-Tom 2023-07-13 09:34:23 +01:00
parent c3c26f4852
commit ca208a0daf
11 changed files with 1121 additions and 57 deletions

View File

@ -1590,6 +1590,16 @@ class Gestion extends CI_Controller
// $this->insertPalier($plr_bank_user_cart_cash_international, "bank_user_cart_cash_international", $idConfig ,'paliers_commissions_wallet');
$this->insertPalier($plr_bank_user_cart_cash_national, "bank_user_cart_cash_national", $idConfig,'paliers_commissions_wallet');
break;
case 'user_cart_autre_wallet':
$plr_user_cart_autre_wallet_national = $_POST['plr_user_cart_autre_wallet_national'] ?? null;
$plr_bank_user_cart_autre_wallet_national = $_POST['plr_bank_user_cart_autre_wallet_national'] ?? null;
$plr_user_cart_autre_wallet_international = $_POST['plr_user_cart_autre_wallet_international'] ?? null;
$plr_bank_user_cart_autre_wallet_international = $_POST['plr_bank_user_cart_autre_wallet_international'] ?? null;
$this->insertPalier($plr_user_cart_autre_wallet_national, "user_cart_autre_wallet_national", $idConfig,'paliers_commissions_wallet');
$this->insertPalier($plr_bank_user_cart_autre_wallet_national, "bank_user_cart_autre_wallet_national", $idConfig ,'paliers_commissions_wallet');
$this->insertPalier($plr_user_cart_autre_wallet_international, "user_cart_autre_wallet_international", $idConfig,'paliers_commissions_wallet');
$this->insertPalier($plr_bank_user_cart_autre_wallet_international, "bank_user_cart_autre_wallet_international", $idConfig ,'paliers_commissions_wallet');
break;
case 'agent_remove_cash':
$plr_agent_wallet_cash_national = $_POST['plr_agent_wallet_cash_national'] ?? null;
@ -1922,8 +1932,6 @@ class Gestion extends CI_Controller
$string = file_get_contents("https://openexchangerates.org/api/latest.json?app_id=$api");
$json = json_decode($string, true);
$res = false;
foreach ($json['rates'] as $key => $value) {
if ($this->wallet_model->getExchangeRate($key))
$this->wallet_model->updateExchangeRate($key, $value);
@ -1932,9 +1940,9 @@ class Gestion extends CI_Controller
}
$res = true;
if ($res) {
echo json_encode("200");
echo json_encode(200);
} else {
echo json_encode("500");
echo json_encode(500);
}
@ -2484,7 +2492,10 @@ class Gestion extends CI_Controller
if ($this->isLogged()) {
$data['active'] = "aggregators";
$data['alert'] = "";
$data['aggregators'] = $this->db->get_where('payment_aggregators');
$data['aggregators'] = $this->db->get_where('payment_aggregators')->result() ?? [];
foreach ($data['aggregators'] as $i => $aggregator){
$data['aggregators'][$i]->rates = $this->db->get_where('payment_aggregator_rates',['aggregator_id' => $aggregator->id])->result();
}
// $data['pays'] = $this->user_model->getAllPays();
$data['game_pays'] = $this->user_model->getGameCountry();
$this->load->view('header_gestion', $data);

View File

@ -1447,6 +1447,16 @@ class Hyperviseur_dash extends CI_Controller
$this->load->view('header_hyp', $data);
$this->load->view('config_wallet_ilink_hyp/user_carte_wallet');
break;
case 'user_cart_autre_wallet':
$data['plr_user_cart_autre_wallet_national'] = $this->wallet_model->getPalierCommissionsWallet("user_cart_autre_wallet_national", $data['idConfig']);
$data['plr_user_cart_autre_wallet_international'] = $this->wallet_model->getPalierCommissionsWallet("user_cart_autre_wallet_international", $data['idConfig']);
$data['plr_bank_user_cart_autre_wallet_national'] = $this->wallet_model->getPalierCommissionsWallet("bank_user_cart_autre_wallet_national", $data['idConfig']);
$data['plr_bank_user_cart_autre_wallet_international'] = $this->wallet_model->getPalierCommissionsWallet("bank_user_cart_autre_wallet_international", $data['idConfig']);
$this->load->view('header_hyp', $data);
$this->load->view('config_wallet_ilink_hyp/user_carte_autre_wallet');
break;
case 'agent_remove_cash':
$data['plr_agent_wallet_cash_national'] = $this->wallet_model->getPalierCommissionsWallet("agent_wallet_cash_national", $data['idConfig']);
$data['plr_agent_wallet_cash_international'] = $this->wallet_model->getPalierCommissionsWallet("agent_wallet_cash_international", $data['idConfig']);
@ -2168,7 +2178,7 @@ class Hyperviseur_dash extends CI_Controller
$data = array_map(function ($document) use($id){
$row = [];
$row['name'] = $document[0];
$row['description'] = $document[0];
$row['description'] = $document[1];
$row['account_type_id'] = $id;
return $row;
},$documents);
@ -2190,6 +2200,7 @@ class Hyperviseur_dash extends CI_Controller
if($this->isLogged()) {
if (isset($_POST)) {
$this->db->delete('customer_account_types', ['id' => $_POST['id']]);
$this->db->delete('customer_account_type_documents', ['account_type_id' => $_POST['id']]);
echo json_encode(['code' => 200]);
}
}

View File

@ -7,35 +7,51 @@ class PaymentController extends CI_Controller
parent::__construct();
}
public function createPaymentAggregator()
{
public function storePaymentAggregator(){
if($this->isLogged()) {
if (isset($_POST)) {
$emailExist = $this->db->get_where('payment_aggregators', ['email' => $_POST['email']]);
if ($emailExist->num_rows() == 0) {
$id = $_POST['id'] ?? null ;
$exist = $this->db->get_where('payment_aggregators', ['id !=' => $id , 'name' => $_POST['name']]);
if ($exist->num_rows() == 0) {
foreach ($_POST as $key => $value){
if(empty($value)){
$_POST[$key] = null;
}
}
$_POST['created_at'] = (new DateTime())->format('Y-m-d H:i:s');
$_POST['updated_at'] = (new DateTime())->format('Y-m-d H:i:s');
$this->db->insert('payment_aggregators', $_POST);
if(!empty($id)){
$rates = $_POST['rates'] ?? [] ;
unset($_POST['rates']);
$this->db->where('id',$id);
$this->db->update('payment_aggregators',$_POST);
$this->db->delete('payment_aggregator_rates',['aggregator_id' => $id]);
if(sizeof($rates) > 0){
$data = array_map(function ($rate) use($id){
$row = [];
$row['country'] = $rate[0];
$row['type'] = $rate[1];
$row['method'] = $rate[2];
$row['channel'] = $rate[3];
$row['rate'] = $rate[4];
$row['fixed_fees'] = $rate[5];
$row['fixed_fees_currency'] = $rate[6];
$row['aggregator_id'] = $id;
$row['created_at'] = (new DateTime())->format('Y-m-d H:i:s');
$row['updated_at'] = (new DateTime())->format('Y-m-d H:i:s');
return $row;
},$rates);
$this->db->insert_batch('payment_aggregator_rates',$data);
}
}else{
$this->db->insert('payment_aggregators',$_POST);
}
echo json_encode(['code' => 200]);
} else {
echo json_encode(['code'=> 419 , 'message' => $this->lang->line("L'email entré est déjà utilisé")]);
}
}
}
}
public function updatePaymentAggregator()
{
if($this->isLogged()) {
if (isset($_POST)) {
$emailExist = $this->db->get_where('payment_aggregators', ['id !=' => $_POST['id'], 'email' => $_POST['email']]);
if ($emailExist->num_rows() == 0) {
$_POST['updated_at'] = (new DateTime())->format('Y-m-d H:i:s');
$this->db->where('id',$_POST['id']);
$this->db->update('payment_aggregators',$_POST);
echo json_encode(['code' => 200]);
}else{
echo json_encode(['code'=> 419 , 'message' => $this->lang->line("L'email entré est déjà utilisé")]);
echo json_encode(['code'=> 419 , 'message' => $this->lang->line("name_already_used")]);
}
}
}
@ -45,6 +61,7 @@ class PaymentController extends CI_Controller
if($this->isLogged()) {
if (isset($_POST)) {
$this->db->delete('payment_aggregators', ['id' => $_POST['id']]);
$this->db->delete('payment_aggregator_rates', ['aggregator_id' => $_POST['id']]);
echo json_encode(['code' => 200]);
}
}

View File

@ -363,7 +363,12 @@ $lang['rate_com_hyp_send_wallet_cart_ilink_national'] = "Hypervisor commission r
$lang['rate_com_hyp_send_wallet_cart_ilink_international'] = "Hypervisor commission rate on wallet-to-card transaction for iLink international user";
$lang['rate_com_bq_send_wallet_cart_ilink_national'] = "Bank commission rate on wallet-to-card transaction for national iLink user";
$lang['rate_com_bq_send_wallet_cart_ilink_international'] = "Bank commission rate on wallet-to-card transaction for iLink international user";
$lang['rate_com_user_cart_autre_wallet_national'] = "Customer commission rate for sending a card to another national wallet";
$lang['config_ilink_user_cart_autre_wallet'] = 'Card withdrawal to another wallet';
$lang['rate_com_user_cart_autre_wallet_international'] = 'Customer commission rate on international money withdrawal operation';
$lang['rate_com_user_cart_autre_wallet_national'] = "Customer commission rate for national money withdrawal operations";
$lang['rate_com_bank_user_cart_autre_wallet_international'] = "Bank commission rate for international money withdrawal operations";
$lang['rate_com_bank_user_cart_autre_wallet_national'] = "Bank commission rate for national money withdrawal operations";
// Currency management
$lang ['currency'] = 'Currency';
@ -1052,5 +1057,9 @@ $lang['opening_account_request_more_information'] = "The request to open an acco
$lang['payment_period_days'] = "Payment period (in days)";
$lang['required_payment_period_days'] = "Payment period is required";
$lang['ACCEPTED_UNPAID'] = "Accepted unpaid";
$lang['ACCEPTED_PAID'] = "Accepted paid"
$lang['ACCEPTED_PAID'] = "Accepted paid";
$lang['fixed_fees'] = "Fixed expenses";
$lang['fixed_fees_currency'] = "Fixed fee currency";
$lang['add_rate'] = "Add a rate";
$lang['channel'] = "Channel/Réseau";
?>

View File

@ -375,7 +375,12 @@
$lang['rate_com_hyp_send_wallet_cart_ilink_international'] = "Taux de commission hyperviseur sur operation d'envoi de wallet vers carte pour utilisateur iLink international";
$lang['rate_com_bq_send_wallet_cart_ilink_national'] = "Taux de commission banque sur operation d'envoi de wallet vers carte pour utilisateur iLink national";
$lang['rate_com_bq_send_wallet_cart_ilink_international'] = "Taux de commission banque sur operation d'envoi de wallet vers carte pour utilisateur iLink international";
$lang['rate_com_user_cart_autre_wallet_national'] = "Taux de commission du client sur opération d'envoi de carte à un autre wallet national";
$lang['config_ilink_user_cart_autre_wallet'] = 'Retrait de carte vers autre wallet';
$lang['rate_com_user_cart_autre_wallet_international'] = "Taux de commission du client sur operation de retrait d'argent international";
$lang['rate_com_user_cart_autre_wallet_national'] = "Taux de commission du client sur operation de retrait d'argent national";
$lang['rate_com_bank_user_cart_autre_wallet_international'] = "Taux de commission de la banque sur operation de retrait d'argent international";
$lang['rate_com_bank_user_cart_autre_wallet_national'] = "Taux de commission de la banque sur operation de retrait d'argent national";
// Gestion de la monnaie
$lang['currency'] = 'Monnaie';
$lang['currency_code'] = 'Code de la monnaie';
@ -1060,5 +1065,9 @@ $lang['opening_account_request_more_information'] = "La demande d'ouverture de c
$lang['payment_period_days'] = "Délai de paiement (en jours)";
$lang['required_payment_period_days'] = "Délai de paiement est obligatoire";
$lang['ACCEPTED_UNPAID'] = "Accepté Non payé";
$lang['ACCEPTED_PAID'] = "Acceptée payé"
$lang['ACCEPTED_PAID'] = "Acceptée payé";
$lang['fixed_fees'] = "Frais fixes";
$lang['fixed_fees_currency'] = "Monnaie des frais fixes";
$lang['add_rate'] = "Ajouter un taux";
$lang['channel'] = "Cannal/Réseau";
?>

View File

@ -262,22 +262,19 @@ class Wallet_model extends CI_Model
return $query->num_rows() > 0 ? $query : false ;
}
public function insertExchangeRate($currency ,$rate){
$sql = "INSERT INTO `exchange_rate` (`target_currency`, `exchange_rate`) VALUES ( ?, ?);";
$query = $this->db->query($sql , array($currency,$rate));
return $query;
public function insertExchangeRate($currency,$rate){
return $this->db->insert('exchange_rate',['target_currency' => $currency, 'exchange_rate' => $rate]);
}
public function getExchangeRate($currency){
$sql = "SELECT * FROM `exchange_rate` WHERE `target_currency` = ?;";
$query = $this->db->query($sql , array($currency));
$this->db->where('target_currency',$currency);
$query = $this->db->get('exchange_rate');
return $query->num_rows() > 0 ? $query : false ;
}
public function updateExchangeRate($currency,$rate){
$sql = "UPDATE `exchange_rate` SET `exchange_rate` = ? WHERE (`target_currency` = ?);";
$query = $this->db->query($sql , array($currency,$rate));
return $query;
$this->db->where('target_currency',$currency);
$this->db->update('exchange_rate',['target_currency' => $currency, 'exchange_rate' => $rate]);
}
//Liste des pays dont un wallet est actif

View File

@ -47,7 +47,7 @@
<td><?= empty($row->opening_amount) ? '' : Money::of(round($row->opening_amount, 2), $currency_code ?? 'XAF', $context)->formatTo('fr_FR')?></td>
<td><?= $row->opening_amount_payment_period_days?></td>
<td>
<button class="btn btn-success edit" data-id="<?=$row->id?>" data-name="<?=$row->name?>" data-description="<?=$row->description?>"
<button class="btn btn-success edit-doc" data-id="<?=$row->id?>" data-name="<?=$row->name?>" data-description="<?=$row->description?>"
data-parent_id="<?=$row->parent_id?>" data-opening_amount="<?=$row->opening_amount?>" data-opening_amount_payment_period_days="<?=$row->opening_amount_payment_period_days?>">
<i class="fa fa-edit"></i>
</button>
@ -280,7 +280,7 @@
var selectedId = null
var types = <?= json_encode($types ?? []) ?>;
$(document).on("click", ".edit", function () {
$(document).on("click", ".edit-doc", function () {
selectedId = $(this).data('id');
$("#update-form input[name='name']").val($(this).data('name'));
$("#update-form textarea[name='description']").val($(this).data('description'));

View File

@ -0,0 +1,856 @@
<link rel="stylesheet"
href="<?= base_url('bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css') ?>">
<link rel="stylesheet" href="<?= base_url('bower_components/bootstrap-daterangepicker/daterangepicker.css') ?>">
<link rel="stylesheet"
href="<?= base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
<link rel="stylesheet" href="<?= base_url('bower_components/toastr/toastr.css') ?>">
<link rel="stylesheet" href="<?= base_url('bower_components/google-material-icons/google-material-icons.min.css') ?>">
<link rel="stylesheet" href="<?= base_url('dist/css/custom/levels-table.css') ?>">
<?php
use Brick\Money\Context\CustomContext;
use Brick\Money\Money;
$context = new \Brick\Money\Context\AutoContext();
$fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
?>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?= $this->lang->line('config_user').' - '.$this->lang->line('config_ilink_user_cart_autre_wallet'); ?>
</h1>
<?php
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>
<?= $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>
<?= $message; ?>
</div>
<?php
}
}
?>
</section>
<section class="content">
<div class="row">
<div class="col-lg-12">
<div class="margin">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal-update"
style="width: 100%"><?= $this->lang->line('Modifier la configuration') ?></button>
</div>
</div>
</div>
<div class="callout callout-info">
<p>Note</p>
<h4><?= $this->lang->line('config_ilink_note') ?></h4>
</div>
<div class="row">
<div class="col-lg-6 col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?= $this->lang->line('rate_com_user_cart_autre_wallet_international'); ?></h3>
</div>
<!-- /.box-header -->
<div class="box-body table-responsive" style="overflow-x:auto;">
<table class="table table-hover">
<tbody>
<tr>
<th>Min</th>
<th>Max</th>
<th>Taux (%)</th>
<th><?= $this->lang->line('ceiling')?></th>
</tr>
<?php
if ($plr_user_cart_autre_wallet_international) {
foreach ($plr_user_cart_autre_wallet_international->result() as $row) {
echo "<tr>
<td>" . $fmt->format($row->min) . "</td>
<td>" . $fmt->format($row->max) . "</td>
<td>" . $row->taux . "</td>
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
</tr>';
}
}
?>
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title"><?= $this->lang->line('rate_com_user_cart_autre_wallet_national'); ?></h3>
</div>
<!-- /.box-header -->
<div class="box-body table-responsive" style="overflow-x:auto;">
<table class="table table-hover">
<tbody>
<tr>
<th>Min</th>
<th>Max</th>
<th>Taux (%)</th>
<th><?= $this->lang->line('ceiling')?></th>
</tr>
<?php
if ($plr_user_cart_autre_wallet_national) {
foreach ($plr_user_cart_autre_wallet_national->result() as $row) {
echo "<tr>
<td>" . $fmt->format($row->min) . "</td>
<td>" . $fmt->format($row->max) . "</td>
<td>" . $row->taux . "</td>
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
</tr>';
}
}
?>
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
</div>
<div class="col-lg-6 col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?= $this->lang->line('rate_com_bank_user_cart_autre_wallet_international'); ?></h3>
</div>
<!-- /.box-header -->
<div class="box-body table-responsive" style="overflow-x:auto;">
<table class="table table-hover">
<tbody>
<tr>
<th>Min</th>
<th>Max</th>
<th>Taux (%)</th>
<th><?= $this->lang->line('ceiling')?></th>
</tr>
<?php
if ($plr_bank_user_cart_autre_wallet_international) {
foreach ($plr_bank_user_cart_autre_wallet_international->result() as $row) {
echo "<tr>
<td>" . $fmt->format($row->min) . "</td>
<td>" . $fmt->format($row->max) . "</td>
<td>" . $row->taux . "</td>
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
</tr>';
}
}
?>
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title"><?= $this->lang->line('rate_com_bank_user_cart_autre_wallet_national'); ?></h3>
</div>
<!-- /.box-header -->
<div class="box-body table-responsive" style="overflow-x:auto;">
<table class="table table-hover">
<tbody>
<tr>
<th>Min</th>
<th>Max</th>
<th>Taux (%)</th>
<th><?= $this->lang->line('ceiling')?></th>
</tr>
<?php
if ($plr_bank_user_cart_autre_wallet_national) {
foreach ($plr_bank_user_cart_autre_wallet_national->result() as $row) {
echo "<tr>
<td>" . $fmt->format($row->min) . "</td>
<td>" . $fmt->format($row->max) . "</td>
<td>" . $row->taux . "</td>
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
</tr>';
}
}
?>
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
</div>
</div>
<div class="modal fade" id="modal-update">
<div class="modal-dialog" style="max-width: 1300px; width: 100%;">
<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>
<h3 class="modal-title"><?= $this->lang->line('Configuration du wallet'); ?></h3>
</div>
<div class="modal-body">
<form id="walletForm">
<div class="row">
<div class="col-lg-6">
<div class="form-group" style="overflow-x:auto;">
<div class="table-title">
<div class="row">
<div class="col-sm-8">
<label for="nom"
class="col-form-label"><?= $this->lang->line('rate_com_user_cart_autre_wallet_international'); ?></label>
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-info add-new new42"><i
class="fa fa-plus"></i> <?= $this->lang->line('new_level'); ?>
</button>
</div>
</div>
</div>
<table id="user_cart_autre_wallet_international" class="table table-bordered">
<thead>
<tr>
<th>Min</th>
<th>Max</th>
<th><?= $this->lang->line('rate'); ?> (%)</th>
<th><?= $this->lang->line('ceiling')?></th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
if ($plr_user_cart_autre_wallet_international) {
foreach ($plr_user_cart_autre_wallet_international->result() as $row) {
echo "<tr>
<td>" . $row->min . "</td>
<td>" . $row->max . "</td>
<td>" . $row->taux . "</td>
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
<td>
<a class="add add42" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>
<a class="edit edit42" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE254;</i></a>
<a class="delete delete42" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE872;</i></a>
</td>
</tr>';
}
}
?>
</tbody>
</table>
</div>
<div class="form-group" style="overflow-x:auto;">
<div class="table-title">
<div class="row">
<div class="col-sm-8">
<label for="nom"
class="col-form-label"><?= $this->lang->line('rate_com_user_cart_autre_wallet_national'); ?></label>
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-info add-new new4"><i
class="fa fa-plus"></i> <?= $this->lang->line('new_level'); ?>
</button>
</div>
</div>
</div>
<table id="user_cart_autre_wallet_national" class="table table-bordered">
<thead>
<tr>
<th>Min</th>
<th>Max</th>
<th><?= $this->lang->line('rate'); ?> (%)</th>
<th><?= $this->lang->line('ceiling')?></th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
if ($plr_user_cart_autre_wallet_national) {
foreach ($plr_user_cart_autre_wallet_national->result() as $row) {
echo "<tr>
<td>" . $row->min . "</td>
<td>" . $row->max . "</td>
<td>" . $row->taux . "</td>
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
<td>
<a class="add add4" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>
<a class="edit edit4" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE254;</i></a>
<a class="delete delete4" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE872;</i></a>
</td>
</tr>';
}
}
?>
</tbody>
</table>
</div>
</div>
<div class="col-lg-6">
<div class="form-group" style="overflow-x:auto;">
<div class="table-title">
<div class="row">
<div class="col-sm-8">
<label for="nom"
class="col-form-label"><?= $this->lang->line('rate_com_bank_user_cart_autre_wallet_international'); ?></label>
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-info add-new new12"><i
class="fa fa-plus"></i> <?= $this->lang->line('new_level'); ?>
</button>
</div>
</div>
</div>
<table id="bank_user_cart_autre_wallet_international" class="table table-bordered">
<thead>
<tr>
<th>Min</th>
<th>Max</th>
<th><?= $this->lang->line('rate'); ?> (%)</th>
<th><?= $this->lang->line('ceiling')?></th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
if ($plr_bank_user_cart_autre_wallet_international) {
foreach ($plr_bank_user_cart_autre_wallet_international->result() as $row) {
echo "<tr>
<td>" . $row->min . "</td>
<td>" . $row->max . "</td>
<td>" . $row->taux . "</td>
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
<td>
<a class="add add12" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>
<a class="edit edit12" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE254;</i></a>
<a class="delete delete12" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE872;</i></a>
</td>
</tr>';
}
}
?>
</tbody>
</table>
</div>
<div class="form-group" style="overflow-x:auto;">
<div class="table-title">
<div class="row">
<div class="col-sm-8">
<label for="nom"
class="col-form-label"><?= $this->lang->line('rate_com_bank_user_cart_autre_wallet_national'); ?></label>
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-info add-new new1"><i
class="fa fa-plus"></i> <?= $this->lang->line('new_level'); ?>
</button>
</div>
</div>
</div>
<table id="bank_user_cart_autre_wallet_national" class="table table-bordered">
<thead>
<tr>
<th>Min</th>
<th>Max</th>
<th><?= $this->lang->line('rate'); ?> (%)</th>
<th><?= $this->lang->line('ceiling')?></th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
if ($plr_bank_user_cart_autre_wallet_national) {
foreach ($plr_bank_user_cart_autre_wallet_national->result() as $row) {
echo "<tr>
<td>" . $row->min . "</td>
<td>" . $row->max . "</td>
<td>" . $row->taux . "</td>
<td>" . (isset($row->plafond) ? floatval($row->plafond) : '') . "</td>" . '
<td>
<a class="add add1" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>
<a class="edit edit1" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE254;</i></a>
<a class="delete delete1" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE872;</i></a>
</td>
</tr>';
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left"
data-dismiss="modal"><?= $this->lang->line('Fermer'); ?></button>
<button type="button" id="updateWallet" data-network-id="<?= $network_id ?>"
data-id-config="<?= $idConfig ?>"
class="btn btn-primary"><?= $this->lang->line('save'); ?></button>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- jQuery 3 -->
<script src="<?= base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
<!-- Bootstrap 3.3.7 -->
<script src="<?= base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
<!-- DataTables -->
<script src="<?= base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
<script src="<?= base_url('bower_components/datatables.net-bs/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="<?= base_url('bower_components/moment/min/moment.min.js') ?>"></script>
<script src="<?= base_url('bower_components/bootstrap-daterangepicker/daterangepicker.js') ?>"></script>
<script src="<?= base_url('bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js') ?>"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
<script src="<?= base_url('bower_components/toastr/toastr.js') ?>"></script>
<script src="<?= base_url('dist/js/sweetalert2.js') ?>"></script>
<script src="<?= base_url('dist/js/helpers.js') ?>"></script>
<script>
toastr.options.closeButton = true;
toastr.options.closeMethod = 'fadeOut';
toastr.options.closeDuration = 5000;
toastr.options.closeEasing = 'swing';
$('#updateWallet').click(function () {
const network_id = $(this).data('network-id');
const id_config = $(this).data('id-config');
if ($('#walletForm')[0].checkValidity()) {
// Paliers
let plr_user_cart_autre_wallet_national = getPaliersTable('user_cart_autre_wallet_national');
let plr_bank_user_cart_autre_wallet_national = getPaliersTable('bank_user_cart_autre_wallet_national');
let plr_user_cart_autre_wallet_international = getPaliersTable('user_cart_autre_wallet_international');
let plr_bank_user_cart_autre_wallet_international = getPaliersTable('bank_user_cart_autre_wallet_international');
$.ajax({
url: '<?= base_url('Gestion/config_wallet/update')?>',
type: 'POST',
dataType: 'json',
data: {
"type": "ilink",
"config": "user_cart_autre_wallet",
"network_id": network_id, "id_config": id_config,
"plr_user_cart_autre_wallet_national": plr_user_cart_autre_wallet_national,
"plr_bank_user_cart_autre_wallet_national": plr_bank_user_cart_autre_wallet_national,
"plr_user_cart_autre_wallet_international": plr_user_cart_autre_wallet_international,
"plr_bank_user_cart_autre_wallet_international": plr_bank_user_cart_autre_wallet_international,
},
success: function (data) {
if (data == '200') {
Swal.fire({
icon: 'success',
title: "<?= $this->lang->line('wallet_update')?>",
text: "<?= $this->lang->line('informations_updated')?>",
timer: 3000
}).then(() => {
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" :
} else {
toastr.error("<?= $this->lang->line('error_message')?>", "<?= $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')?>");
}
});
} else {
$('#walletForm')[0].reportValidity();
}
});
</script>
<script type="text/javascript">
// Paliers scripts
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
/**
NATIONAUX
*/
// Table 4
var actions4 = $("#user_cart_autre_wallet_national td:last-child").html();
// Append table with add row form on add new button click
$(".new4").click(function () {
if (!actions4) {
actions4 = '<a class="add add4" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>\n' +
' <a class="edit edit4" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE254;</i></a>\n' +
' <a class="delete delete4" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE872;</i></a>';
}
$(this).attr("disabled", "disabled");
var index = $("#user_cart_autre_wallet_national tbody tr:last-child").index();
var row = '<tr>' +
'<td><input type="number" required min="0" class="form-control" name="min" id="min"></td>' +
'<td><input type="number" required class="form-control" name="max" id="max"></td>' +
'<td><input type="number" required step="any" class="form-control" name="taux" id="taux"></td>' +
'<td><input type="number" min="1" class="form-control" name="plafond" id="plafond"></td>' +
'<td> ' + actions4 + '</td>' +
'</tr>';
$("#user_cart_autre_wallet_national").append(row);
$("#user_cart_autre_wallet_national tbody tr").eq(index + 1).find(".add4, .edit4").toggle();
$('[data-toggle="tooltip"]').tooltip();
});
// Add row on add button click
$(document).on("click", ".add4", function () {
var empty = false;
var input = $(this).parents("tr").find('input[type="number"]');
var min = parseFloat($(this).parents("tr").find('input[id="min"]').first().val());
var max = parseFloat($(this).parents("tr").find('input[id="max"]').first().val());
input.each(function () {
if ($(this).attr('id') == 'min') {
if (min >= max) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
} else if ($(this).attr('id') == 'max') {
if (max <= min) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
} else {
if (!$(this)[0].checkValidity()) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
}
});
$(this).parents("tr").find(".error").first().focus();
if (!empty) {
input.each(function () {
$(this).parent("td").html($(this).val());
});
$(this).parents("tr").find(".add4, .edit4").toggle();
$(".new4").removeAttr("disabled");
}
});
// Edit row on edit button click
$(document).on("click", ".edit4", function () {
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
if (index == 0)
$(this).html('<input type="number" required class="form-control" min="0" id="min" value="' + $(this).text() + '">');
if (index == 1)
$(this).html('<input type="number" required class="form-control" id="max" value="' + $(this).text() + '">');
if (index == 2)
$(this).html('<input type="number" required class="form-control" step="any" min="0" value="' + $(this).text() + '">');
if (index == 3)
$(this).html('<input type="number" class="form-control" min="1" value="' + $(this).text() + '">');
});
$(this).parents("tr").find(".add4, .edit4").toggle();
$(".new4").attr("disabled", "disabled");
});
// Delete row on delete button click
$(document).on("click", ".delete4", function () {
$(this).parents("tr").remove();
$(".new4").removeAttr("disabled");
});
//Table 1
var actions1 = $("#bank_user_cart_autre_wallet_national td:last-child").html();
// Append table with add row form on add new button click
$(".new1").click(function () {
if (!actions1) {
actions1 = '<a class="add add1" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>\n' +
' <a class="edit edit1" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE254;</i></a>\n' +
' <a class="delete delete1" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE872;</i></a>';
}
$(this).attr("disabled", "disabled");
var index = $("#bank_user_cart_autre_wallet_national tbody tr:last-child").index();
var row = '<tr>' +
'<td><input type="number" required min="0" class="form-control" name="min" id="min"></td>' +
'<td><input type="number" required class="form-control" name="max" id="max"></td>' +
'<td><input type="number" required class="form-control" min="0" step="any" name="taux" id="taux"></td>' +
'<td><input type="number" min="1" class="form-control" name="plafond" id="plafond"></td>' +
'<td> ' + actions1 + '</td>' +
'</tr>';
$("#bank_user_cart_autre_wallet_national").append(row);
$("#bank_user_cart_autre_wallet_national tbody tr").eq(index + 1).find(".add1, .edit1").toggle();
$('[data-toggle="tooltip"]').tooltip();
});
// Add row on add button click
$(document).on("click", ".add1", function () {
var empty = false;
var input = $(this).parents("tr").find('input[type="number"]');
var min = parseFloat($(this).parents("tr").find('input[id="min"]').first().val());
var max = parseFloat($(this).parents("tr").find('input[id="max"]').first().val());
input.each(function () {
if ($(this).attr('id') == 'min') {
if (min >= max) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
} else if ($(this).attr('id') == 'max') {
if (max <= min) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
} else {
if (!$(this)[0].checkValidity()) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
}
});
$(this).parents("tr").find(".error").first().focus();
if (!empty) {
input.each(function () {
$(this).parent("td").html($(this).val());
});
$(this).parents("tr").find(".add1, .edit1").toggle();
$(".new1").removeAttr("disabled");
}
});
// Edit row on edit button click
$(document).on("click", ".edit1", function () {
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
if (index == 0)
$(this).html('<input type="number" required class="form-control" min="0" id="min" value="' + $(this).text() + '">');
if (index == 1)
$(this).html('<input type="number" required class="form-control" id="max" value="' + $(this).text() + '">');
if (index == 2)
$(this).html('<input type="number" required class="form-control" step="any" min="0" value="' + $(this).text() + '">');
if (index == 3)
$(this).html('<input type="number" class="form-control" min="1" value="' + $(this).text() + '">');
});
$(this).parents("tr").find(".add1, .edit1").toggle();
$(".new1").attr("disabled", "disabled");
});
// Delete row on delete button click
$(document).on("click", ".delete1", function () {
$(this).parents("tr").remove();
$(".new1").removeAttr("disabled");
});
// Paliers nationaux
/**
* INTERNATIONAUX
*/
// Table 4
var actions42 = $("#user_cart_autre_wallet_international td:last-child").html();
// Append table with add row form on add new button click
$(".new42").click(function () {
if (!actions42) {
actions42 = '<a class="add add42" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>\n' +
' <a class="edit edit42" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE254;</i></a>\n' +
' <a class="delete delete42" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE872;</i></a>';
}
$(this).attr("disabled", "disabled");
var index = $("#user_cart_autre_wallet_international tbody tr:last-child").index();
var row = '<tr>' +
'<td><input type="number" required min="0" class="form-control" name="min" id="min"></td>' +
'<td><input type="number" required class="form-control" name="max" id="max"></td>' +
'<td><input type="number" required step="any" class="form-control" name="taux" id="taux"></td>' +
'<td><input type="number" min="1" class="form-control" name="plafond" id="plafond"></td>' +
'<td> ' + actions42 + '</td>' +
'</tr>';
$("#user_cart_autre_wallet_international").append(row);
$("#user_cart_autre_wallet_international tbody tr").eq(index + 1).find(".add42, .edit42").toggle();
$('[data-toggle="tooltip"]').tooltip();
});
// Add row on add button click
$(document).on("click", ".add42", function () {
var empty = false;
var input = $(this).parents("tr").find('input[type="number"]');
var min = parseFloat($(this).parents("tr").find('input[id="min"]').first().val());
var max = parseFloat($(this).parents("tr").find('input[id="max"]').first().val());
input.each(function () {
if ($(this).attr('id') == 'min') {
if (min >= max) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
} else if ($(this).attr('id') == 'max') {
if (max <= min) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
} else {
if (!$(this)[0].checkValidity()) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
}
});
$(this).parents("tr").find(".error").first().focus();
if (!empty) {
input.each(function () {
$(this).parent("td").html($(this).val());
});
$(this).parents("tr").find(".add42, .edit42").toggle();
$(".new42").removeAttr("disabled");
}
});
// Edit row on edit button click
$(document).on("click", ".edit42", function () {
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
if (index == 0)
$(this).html('<input type="number" required class="form-control" min="0" id="min" value="' + $(this).text() + '">');
if (index == 1)
$(this).html('<input type="number" required class="form-control" id="max" value="' + $(this).text() + '">');
if (index == 2)
$(this).html('<input type="number" required class="form-control" step="any" min="0" value="' + $(this).text() + '">');
if (index == 3)
$(this).html('<input type="number" class="form-control" min="1" value="' + $(this).text() + '">');
});
$(this).parents("tr").find(".add42, .edit42").toggle();
$(".new42").attr("disabled", "disabled");
});
// Delete row on delete button click
$(document).on("click", ".delete42", function () {
$(this).parents("tr").remove();
$(".new42").removeAttr("disabled");
});
//Table 1
var actions12 = $("#bank_user_cart_autre_wallet_international td:last-child").html();
// Append table with add row form on add new button click
$(".new12").click(function () {
if (!actions12) {
actions12 = '<a class="add add12" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>\n' +
' <a class="edit edit12" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE254;</i></a>\n' +
' <a class="delete delete12" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE872;</i></a>';
}
$(this).attr("disabled", "disabled");
var index = $("#bank_user_cart_autre_wallet_international tbody tr:last-child").index();
var row = '<tr>' +
'<td><input type="number" required min="0" class="form-control" name="min" id="min"></td>' +
'<td><input type="number" required class="form-control" name="max" id="max"></td>' +
'<td><input type="number" required class="form-control" min="0" step="any" name="taux" id="taux"></td>' +
'<td><input type="number" min="1" class="form-control" name="plafond" id="plafond"></td>' +
'<td> ' + actions12 + '</td>' +
'</tr>';
$("#bank_user_cart_autre_wallet_international").append(row);
$("#bank_user_cart_autre_wallet_international tbody tr").eq(index + 1).find(".add12, .edit12").toggle();
$('[data-toggle="tooltip"]').tooltip();
});
// Add row on add button click
$(document).on("click", ".add12", function () {
var empty = false;
var input = $(this).parents("tr").find('input[type="number"]');
var min = parseFloat($(this).parents("tr").find('input[id="min"]').first().val());
var max = parseFloat($(this).parents("tr").find('input[id="max"]').first().val());
input.each(function () {
if ($(this).attr('id') == 'min') {
if (min >= max) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
} else if ($(this).attr('id') == 'max') {
if (max <= min) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
} else {
if (!$(this)[0].checkValidity()) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else {
$(this).removeClass("error");
}
}
});
$(this).parents("tr").find(".error").first().focus();
if (!empty) {
input.each(function () {
$(this).parent("td").html($(this).val());
});
$(this).parents("tr").find(".add12, .edit12").toggle();
$(".new12").removeAttr("disabled");
}
});
// Edit row on edit button click
$(document).on("click", ".edit12", function () {
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
if (index == 0)
$(this).html('<input type="number" required class="form-control" min="0" id="min" value="' + $(this).text() + '">');
if (index == 1)
$(this).html('<input type="number" required class="form-control" id="max" value="' + $(this).text() + '">');
if (index == 2)
$(this).html('<input type="number" required class="form-control" step="any" min="0" value="' + $(this).text() + '">');
if (index == 3)
$(this).html('<input type="number" class="form-control" min="1" value="' + $(this).text() + '">');
});
$(this).parents("tr").find(".add12, .edit12").toggle();
$(".new12").attr("disabled", "disabled");
});
// Delete row on delete button click
$(document).on("click", ".delete12", function () {
$(this).parents("tr").remove();
$(".new12").removeAttr("disabled");
});
});
</script>

View File

@ -1,6 +1,8 @@
<link rel="stylesheet"
href="<?= base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
<link rel="stylesheet" href="<?= base_url('bower_components/toastr/toastr.css') ?>">
<link rel="stylesheet" href="<?= base_url('bower_components/google-material-icons/google-material-icons.min.css') ?>">
<link rel="stylesheet" href="<?= base_url('dist/css/custom/levels-table.css') ?>">
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
@ -22,7 +24,6 @@
<tr>
<th align='center'>#</th>
<th><?= $this->lang->line('Nom'); ?></th>
<th align='center'><?= $this->lang->line('Email'); ?></th>
<th align='center'><?= $this->lang->line('Adresse'); ?></th>
<th align='center'><?= $this->lang->line('Contact'); ?></th>
<th align='center'><?= $this->lang->line('Statut'); ?></th>
@ -33,12 +34,11 @@
<tbody>
<?php
if(isset($aggregators)){
foreach ($aggregators->result() as $i => $row) {
foreach ($aggregators as $i => $row) {
?>
<tr>
<td align='center'><?= $i+1?></td>
<td><?= $row->name ?></td>
<td align='center'><?=$row->email?></td>
<td align='center'><?=$row->address?></td>
<td align='center'><?=$row->phone?></td>
<td align='center'><?= $this->lang->line($row->status ? 'Active' : 'Inactive'); ?></td>
@ -46,11 +46,11 @@
<input type='checkbox' value='<?=$row->id?>' <?= $row->status ? 'checked' : '' ?>>
</td>
<td>
<button class='btn btn-success edit' data-id="<?=$row->id?>" data-address="<?=$row->address?>" data-name="<?=$row->name?>"
<button class='btn btn-success edit-row' data-id="<?=$row->id?>" data-address="<?=$row->address?>" data-name="<?=$row->name?>"
data-email="<?=$row->email?>" data-phone="<?=$row->phone?>" >
<i class='fa fa-edit'></i>
</button>
<button data-toggle='modal' class='btn btn-danger delete' data-id="<?=$row->id?>">
<button data-toggle='modal' class='btn btn-danger delete-row' data-id="<?=$row->id?>">
<i class='fa fa-trash'></i>
</button>
</td>
@ -99,7 +99,7 @@
</div>
</div>
<div class="modal fade" id="editModal">
<div class="modal-dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
@ -126,6 +126,35 @@
<label><?= $this->lang->line('Contact'); ?></label>
<input type="text" class="form-control input-lg" name="phone">
</div>
<div class="form-group" style="overflow-x:auto;">
<div class="table-title">
<div class="row">
<div class="col-sm-8">
<label for="nom"
class="col-form-label"><?=$this->lang->line('rate')?></label>
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-info add-new new5"><i class="fa fa-plus"></i> <?= $this->lang->line('add_rate') ; ?></button>
</div>
</div>
</div>
<table id="rates_list" class="table table-bordered">
<thead>
<tr>
<th><?= $this->lang->line('Pays')?> </th>
<th>Type</th>
<th>Methode</th>
<th><?=$this->lang->line('channel')?></th>
<th><?=$this->lang->line('rate')?></th>
<th><?=$this->lang->line('fixed_fees')?></th>
<th><?=$this->lang->line('fixed_fees_currency')?></th>
<th>Actions</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="form-group">
<input id="btn-update" type="submit"
value="<?= $this->lang->line('save'); ?>" class="btn btn-primary">
@ -159,6 +188,88 @@
<script src="<?= base_url('bower_components/toastr/toastr.js') ?>"></script>
<script src="<?= base_url('dist/js/sweetalert2.js') ?>"></script>
<script>
// Taxes
const actions5 = '<a class="add add5" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>\n' +
' <a class="edit edit5" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE254;</i></a>\n' +
' <a class="delete delete5" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE872;</i></a>';
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
// Append table with add row form on add new button click
$(".new5").click(function(){
$(this).attr("disabled", "disabled");
var index = $("#rates_list tbody tr:last-child").index();
var row = "<tr> <td><input type='text' required class='form-control' name='country'></td> " +
"<td><input type='text' required class='form-control' name='type'></td>" +
"<td><input type='text' required class='form-control' name='method'></td>" +
"<td><input type='text' class='form-control' name='channel'></td>" +
"<td><input type='number' required class='form-control' min='0' value='0' step='.1' name='rate'></td>" +
"<td><input type='number' class='form-control' min='0' step='.1' name='fixed_fees'></td>" +
"<td><input type='text' class='form-control' name='fixed_fees_currency'></td>" +
"<td>" + actions5 + "</td>" +
"</tr>";
$("#rates_list").append(row);
$("#rates_list tbody tr").eq(index + 1).find(".add5, .edit5").toggle();
$('[data-toggle="tooltip"]').tooltip();
});
// Add row on add button click
$(document).on("click", ".add5", function(){
var empty = false;
var input = $(this).parents("tr").find('input');
var select = $(this).parents("tr").find('select');
input.each(function(){
if(!$(this)[0].checkValidity()){
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
} else{
$(this).removeClass("error");
}
});
$(this).parents("tr").find(".error").first().focus();
if(!empty){
select.each(function(){
$(this).parent("td").html($(this).val());
});
input.each(function(){
$(this).parent("td").html($(this).val());
});
$(this).parents("tr").find(".add, .edit").toggle();
$(".new5").removeAttr("disabled");
}
});
// Edit row on edit button click
$(document).on("click", ".edit5", function(){
$(this).parents("tr").find("td:not(:last-child)").each(function(index){
if(index == 0)
$(this).html('<input type="text" required class="form-control" value="' + $(this).text() + '">');
if(index == 1)
$(this).html('<input type="text" required class="form-control" value="' + $(this).text() + '">');
if(index == 2)
$(this).html('<input type="text" required class="form-control" value="' + $(this).text() + '">');
if(index == 3)
$(this).html('<input type="text" class="form-control" value="' + $(this).text() + '">');
if(index == 4)
$(this).html('<input type="number" min="0" required class="form-control" step=".1" value="' + $(this).text() + '">');
if(index == 5)
$(this).html('<input type="number" min="0" class="form-control" step=".1" value="' + $(this).text() + '">');
if(index == 6)
$(this).html('<input type="text" class="form-control" value="' + $(this).text() + '">');
});
$(this).parents("tr").find(".add, .edit").toggle();
$(".new5").attr("disabled", "disabled");
});
// Delete row on delete button click
$(document).on("click", ".delete5", function(){
$(this).parents("tr").remove();
$(".new5").removeAttr("disabled");
});
});
</script>
<script>
toastr.options.closeButton = true;
@ -168,6 +279,7 @@
var selectedId = null
var checkedId = null
var aggregators = <?= json_encode($aggregators ?? []) ?>;
function showEnableButton() {
if($("#aggregators input:checked").length){
@ -196,32 +308,67 @@
$(document).on("click", ".edit", function () {
$(document).on("click", ".edit-row", function () {
selectedId = $(this).data('id');
$("#update-form input[name='name']").val($(this).data('name'));
$("#update-form input[name='address']").val($(this).data('address'));
$("#update-form input[name='email']").val($(this).data('email'));
$("#update-form input[name='phone']").val($(this).data('phone'));
// Load rates
$("#rates_list tbody").children().remove();
$.each(aggregators, function (j, it) {
if(it.id == selectedId){
$.each(aggregators[j].rates, function (j, r) {
$('#rates_list').append('<tr>' +
'<td>' + (r.country || '') + '</td>' +
'<td>' + (r.type || '') + '</td>' +
'<td>' + (r.method || '') + '</td>' +
'<td>' + (r.channel || '') + '</td>' +
'<td>' + (r.rate || 0) + '</td>' +
'<td>' + (r.fixed_fees || '') + '</td>' +
'<td>' + (r.fixed_fees_currency || '') + '</td>' +
'<td>' + actions5 + '</td>' +
'</tr>')
});
}
});
$('#editModal').modal('show');
});
$(document).on("click", ".delete", function () {
$(document).on("click", ".delete-row", function () {
selectedId = $(this).data('id');
$('#delete-modal').modal('show');
});
$("#update-form").submit(function () {
// Paliers
var rates = [];
$('#rates_list tr').has('td').each(function() {
var arrayItem = {};
$('td', $(this)).each(function(index, item) {
if(index < 7){
arrayItem[index] = $(item).html();
}
});
rates.push(arrayItem);
});
$.ajax({
url: '<?= base_url('PaymentController/updatePaymentAggregator')?>',
url: '<?= base_url('PaymentController/storePaymentAggregator')?>',
type: 'post',
data: {
id: selectedId,
name: $("input[name=name]",this).val(),
address: $("input[name=address]",this).val(),
email: $("input[name=email]",this).val(),
phone: $("input[name=phone]",this).val()
phone: $("input[name=phone]",this).val(),
rates: rates
},
dataType: 'json',
success: function (data) {
@ -250,7 +397,7 @@
$("#create-aggregator-form").submit(function (event) {
$.ajax({
url: '<?= base_url('PaymentController/createPaymentAggregator')?>',
url: '<?= base_url('PaymentController/storePaymentAggregator')?>',
type: 'post',
data: {
name: $("input[name=name]",this).val(),

View File

@ -246,7 +246,7 @@ $converter = new CurrencyConverter($provider);
type: 'GET',
dataType: 'json',
success: function (data) {
if(data=='200'){
if(data===200){
Swal.fire({
icon: 'success',
title: "<?= $this->lang->line('rates_update')?>",

View File

@ -317,8 +317,15 @@ $context = new \Brick\Money\Context\AutoContext();
</div>
</a>
</div>
</div>
<div class="row">
<div class="col-lg-3 col-xs-6">
<a class="small-box bg-yellow-active"
href="<?= current_url() . ($network_id ? '?config=user_cart_autre_wallet' : '') ?>">
<div class="inner">
<h5><?= $this->lang->line('config_user')?></h5>
<h4><?= $this->lang->line('config_ilink_user_cart_autre_wallet') ?></h4>
</div>
</a>
</div>
<div class="col-lg-3 col-xs-6">
<a class="small-box bg-blue-active"
href="<?= current_url() . ($network_id ? '?config=agent_remove_cash' : '') ?>">