+ Add History of nano credit
This commit is contained in:
parent
7afc3c28fd
commit
4481c93ced
|
@ -433,7 +433,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
|
|
||||||
private function historique($network_id, $startDate, $endDate, $type)
|
private function historique($network_id, $startDate, $endDate, $type)
|
||||||
{
|
{
|
||||||
$data['configWallet'] = $this->user_model->getConfigWallet($network_id);
|
// $data['configWallet'] = $this->user_model->getConfigWallet($network_id);
|
||||||
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
|
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
|
||||||
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null;
|
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null;
|
||||||
$data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null;
|
$data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null;
|
||||||
|
@ -445,7 +445,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$data['currency_name_fr'] = $networkDetails->first_row()->currency_name_fr;
|
$data['currency_name_fr'] = $networkDetails->first_row()->currency_name_fr;
|
||||||
$data['currency_name_en'] = $networkDetails->first_row()->currency_name_en;
|
$data['currency_name_en'] = $networkDetails->first_row()->currency_name_en;
|
||||||
$data['transactions'] = $this->user_model->getIlinkTransactions($startDate, $endDate, $network_id);
|
$data['transactions'] = $this->user_model->getIlinkTransactions($startDate, $endDate, $network_id);
|
||||||
|
var_dump($data['transactions']);
|
||||||
} else if ($type == 'commission_transfer')
|
} else if ($type == 'commission_transfer')
|
||||||
$data['transactions'] = $this->user_model->getCommissionTransfers($startDate, $endDate, $this->session->userdata('member_code'));
|
$data['transactions'] = $this->user_model->getCommissionTransfers($startDate, $endDate, $this->session->userdata('member_code'));
|
||||||
else if ($type == 'balance_statement')
|
else if ($type == 'balance_statement')
|
||||||
|
@ -455,7 +455,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
else
|
else
|
||||||
$data['transactions'] = $this->user_model->getRecharges($startDate, $endDate, $network_id);
|
$data['transactions'] = $this->user_model->getRecharges($startDate, $endDate, $network_id);
|
||||||
|
|
||||||
$data['active'] = "wallet";
|
$data['active'] = "wallet_wallet";
|
||||||
$data['alert'] = "";
|
$data['alert'] = "";
|
||||||
$data['firstname'] = $this->session->userdata('firstname');
|
$data['firstname'] = $this->session->userdata('firstname');
|
||||||
$data['lastname'] = $this->session->userdata('lastname');
|
$data['lastname'] = $this->session->userdata('lastname');
|
||||||
|
@ -1011,7 +1011,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
private function config_wallet($config , $country)
|
private function config_wallet($config , $country)
|
||||||
{
|
{
|
||||||
// $data['configWallet'] = $this->user_model->getConfigWallet($network_id);
|
// $data['configWallet'] = $this->user_model->getConfigWallet($network_id);
|
||||||
$data['active'] = "wallet";
|
$data['active'] = "wallet_wallet";
|
||||||
$data['alert'] = "";
|
$data['alert'] = "";
|
||||||
$data['firstname'] = $this->session->userdata('firstname');
|
$data['firstname'] = $this->session->userdata('firstname');
|
||||||
$data['lastname'] = $this->session->userdata('lastname');
|
$data['lastname'] = $this->session->userdata('lastname');
|
||||||
|
@ -1147,7 +1147,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
private function show_config_infos($type)
|
private function show_config_infos($type)
|
||||||
{
|
{
|
||||||
|
|
||||||
$data['active'] = "wallet";
|
$data['active'] = "wallet_wallet";
|
||||||
$data['alert'] = "";
|
$data['alert'] = "";
|
||||||
$data['firstname'] = $this->session->userdata('firstname');
|
$data['firstname'] = $this->session->userdata('firstname');
|
||||||
$data['lastname'] = $this->session->userdata('lastname');
|
$data['lastname'] = $this->session->userdata('lastname');
|
||||||
|
@ -1190,6 +1190,12 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
public function nano_credit()
|
public function nano_credit()
|
||||||
{
|
{
|
||||||
if ($this->isLogged()) {
|
if ($this->isLogged()) {
|
||||||
|
$data['network_id'] = $this->session->userdata('network_id');
|
||||||
|
if ($this->input->get('history')) {
|
||||||
|
$this->historique_nano_credit($data['network_id'], $this->input->get('d'), $this->input->get('f'), $this->input->get('history'));
|
||||||
|
} elseif ($this->input->get('config')) {
|
||||||
|
$this->config_nano_credit($this->input->get('config'));
|
||||||
|
} else {
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$data['groups'] = $this->user_model->getUsersGroups($this->session->userdata('network_id'));
|
$data['groups'] = $this->user_model->getUsersGroups($this->session->userdata('network_id'));
|
||||||
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
||||||
|
@ -1200,7 +1206,6 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$data['game_pays'] = $this->user_model->getGameCountry();
|
$data['game_pays'] = $this->user_model->getGameCountry();
|
||||||
$data['network'] = $this->session->userdata('network');
|
$data['network'] = $this->session->userdata('network');
|
||||||
$data['country'] = $this->session->userdata('current_pays');
|
$data['country'] = $this->session->userdata('current_pays');
|
||||||
$data['network_id'] = $this->session->userdata('network_id');
|
|
||||||
$data['firstname'] = $this->session->userdata('firstname');
|
$data['firstname'] = $this->session->userdata('firstname');
|
||||||
$data['lastname'] = $this->session->userdata('lastname');
|
$data['lastname'] = $this->session->userdata('lastname');
|
||||||
$data['currency_code'] = $this->session->userdata('currency_code');
|
$data['currency_code'] = $this->session->userdata('currency_code');
|
||||||
|
@ -1211,9 +1216,79 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$this->load->view('header_hyp', $data);
|
$this->load->view('header_hyp', $data);
|
||||||
$this->load->view('nano_credit/gestion_nano_credit_hyp');
|
$this->load->view('nano_credit/gestion_nano_credit_hyp');
|
||||||
$this->load->view('footer');
|
$this->load->view('footer');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function config_nano_credit($config)
|
||||||
|
{
|
||||||
|
// $data['configWallet'] = $this->user_model->getConfigWallet($network_id);
|
||||||
|
$data['active'] = "nano_credit";
|
||||||
|
$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['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
|
$data['country'] = $this->session->userdata('current_pays');
|
||||||
|
$data['category'] = $this->session->userdata('category');
|
||||||
|
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
||||||
|
$data['network_id'] = $this->session->userdata('network_id');
|
||||||
|
|
||||||
|
switch ($config) {
|
||||||
|
case 'nano_credit':
|
||||||
|
$data['rates'] = $this->user_model->getNanoCreditRates($data['idConfig']);
|
||||||
|
$data['taxes'] = $this->user_model->getTaxes($data['idConfig'], 'nano_credit');
|
||||||
|
$this->load->view('header_hyp', $data);
|
||||||
|
$this->load->view('nano_credit/config_nano_credit');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'epargne':
|
||||||
|
$data['rates'] = $this->user_model->getNanoCreditRates($data['idConfig'], 'epargne');
|
||||||
|
$data['taxes'] = $this->user_model->getTaxes($data['idConfig'], 'epargne');
|
||||||
|
$this->load->view('header_hyp', $data);
|
||||||
|
$this->load->view('nano_credit/config_savings');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$this->load->view('footer');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function historique_nano_credit($network_id, $startDate, $endDate, $type)
|
||||||
|
{
|
||||||
|
$data['configWallet'] = $this->user_model->getConfigWallet($network_id);
|
||||||
|
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
|
||||||
|
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null;
|
||||||
|
$data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null;
|
||||||
|
$endDate = Date('Y-m-d', strtotime($endDate . "+1 day"));
|
||||||
|
$data['currency_code'] = $this->session->userdata('currency_code');
|
||||||
|
|
||||||
|
if ($type == 'nano_credit') {
|
||||||
|
$data['transactions'] = $this->user_model->getUserDemandesCredit($startDate, $endDate, $network_id);
|
||||||
|
|
||||||
|
} else if ($type == 'transaction_ilink') {
|
||||||
|
$data['transactions'] = $this->user_model->getIlinkTransactions($startDate, $endDate, $network_id);
|
||||||
|
}
|
||||||
|
$data['active'] = "nano_credit";
|
||||||
|
$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['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
||||||
|
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
|
$data['country'] = $this->session->userdata('current_pays');
|
||||||
|
$data['category'] = $this->session->userdata('category');
|
||||||
|
|
||||||
|
$this->load->view('header_hyp', $data);
|
||||||
|
if ($type == 'epargne')
|
||||||
|
$this->load->view('nano_credit/historique_savings');
|
||||||
|
else
|
||||||
|
$this->load->view('nano_credit/historique_nano_credit');
|
||||||
|
$this->load->view('footer');
|
||||||
|
}
|
||||||
|
|
||||||
public function saveCreditLimit()
|
public function saveCreditLimit()
|
||||||
{
|
{
|
||||||
|
@ -1241,7 +1316,9 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
if (isset($_POST)) {
|
if (isset($_POST)) {
|
||||||
$idConfig = $_POST['id_config'];
|
$idConfig = $_POST['id_config'];
|
||||||
$rates = isset($_POST['rates']) ? $_POST['rates'] : null;
|
$rates = isset($_POST['rates']) ? $_POST['rates'] : null;
|
||||||
$this->insertNanoCreditRates($rates, $idConfig);
|
$type = isset($_POST['type']) ? $_POST['type'] : 'nano_credit';
|
||||||
|
|
||||||
|
$this->insertNanoCreditRates($rates, $idConfig, $type);
|
||||||
$res = true;
|
$res = true;
|
||||||
|
|
||||||
if ($res) {
|
if ($res) {
|
||||||
|
@ -1253,12 +1330,12 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function insertNanoCreditRates($palier, $idConfig)
|
private function insertNanoCreditRates($palier, $idConfig, $type)
|
||||||
{
|
{
|
||||||
|
|
||||||
$exist = $this->user_model->getNanoCreditRates($idConfig);
|
$exist = $this->user_model->getNanoCreditRates($idConfig, $type);
|
||||||
if ($exist) {
|
if ($exist) {
|
||||||
$this->user_model->deleteNanoCreditRates($idConfig);
|
$this->user_model->deleteNanoCreditRates($idConfig, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($palier) {
|
if ($palier) {
|
||||||
|
@ -1268,7 +1345,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
foreach ($array as $key => $value) {
|
foreach ($array as $key => $value) {
|
||||||
$row[] = $value;
|
$row[] = $value;
|
||||||
}
|
}
|
||||||
$this->user_model->addNanoCreditRates($idConfig, $row[0], $row[1]);
|
$this->user_model->addNanoCreditRates($idConfig, $row[0], $row[1], $type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ class InsertGeolocated extends CI_Controller
|
||||||
//close connection
|
//close connection
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
var_dump($fields_string);
|
//var_dump($fields_string);
|
||||||
|
|
||||||
//echo json_encode($fields) . "<br />\n";
|
//echo json_encode($fields) . "<br />\n";
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ class Transfere extends CI_Controller
|
||||||
//close connection
|
//close connection
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
var_dump($fields_string);
|
//var_dump($fields_string);
|
||||||
|
|
||||||
//echo json_encode($fields) . "<br />\n";
|
//echo json_encode($fields) . "<br />\n";
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ class Transfere extends CI_Controller
|
||||||
//close connection
|
//close connection
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
var_dump($fields_string);
|
//var_dump($fields_string);
|
||||||
|
|
||||||
//echo json_encode($fields) . "<br />\n";
|
//echo json_encode($fields) . "<br />\n";
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ class Transfere extends CI_Controller
|
||||||
foreach ($network->result() AS $row){
|
foreach ($network->result() AS $row){
|
||||||
|
|
||||||
$code_hyper = $this->user_model->getCodeHyper(77);
|
$code_hyper = $this->user_model->getCodeHyper(77);
|
||||||
var_dump($code_hyper);
|
// var_dump($code_hyper);
|
||||||
|
|
||||||
if($code_hyper!=false){
|
if($code_hyper!=false){
|
||||||
$nom = $this->input->post('nom');
|
$nom = $this->input->post('nom');
|
||||||
|
|
|
@ -480,4 +480,6 @@ $lang['interest_rates'] = 'Taux d\'intérêts';
|
||||||
$lang['interest_rates_period'] = 'Période (en mois)';
|
$lang['interest_rates_period'] = 'Période (en mois)';
|
||||||
$lang['nano_credit_update'] = 'Mise à jour du nano crédit';
|
$lang['nano_credit_update'] = 'Mise à jour du nano crédit';
|
||||||
$lang['transaction_nano_credit'] = 'Taxes sur le nano crédit';
|
$lang['transaction_nano_credit'] = 'Taxes sur le nano crédit';
|
||||||
|
$lang['edit_nano_credit'] = 'Configuration du nano credit';
|
||||||
|
$lang['edit_savings'] = 'Configuration de l\'épargne'
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -2580,6 +2580,7 @@ class User_model extends CI_Model
|
||||||
$query = $this->db->query("SELECT *
|
$query = $this->db->query("SELECT *
|
||||||
FROM infos_ilink_transaction
|
FROM infos_ilink_transaction
|
||||||
WHERE `network_emetteur`=" . $id_network . $chain);
|
WHERE `network_emetteur`=" . $id_network . $chain);
|
||||||
|
var_dump($query->result_array());
|
||||||
if ($query->num_rows() > 0) {
|
if ($query->num_rows() > 0) {
|
||||||
return $query;
|
return $query;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2703,10 +2704,10 @@ class User_model extends CI_Model
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNanoCreditRates($idConfig)
|
public function getNanoCreditRates($idConfig, $type = 'nano_credit')
|
||||||
{
|
{
|
||||||
$sql = "SELECT * FROM `paliersConfigNanoCredit` WHERE (`idConfig` = ? );";
|
$sql = "SELECT * FROM `paliersConfigNanoCredit` WHERE (`idConfig` = ? AND `type` = ? );";
|
||||||
$query = $this->db->query($sql, array($idConfig));
|
$query = $this->db->query($sql, array($idConfig, $type));
|
||||||
if ($query->num_rows() > 0) {
|
if ($query->num_rows() > 0) {
|
||||||
return $query;
|
return $query;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2714,17 +2715,30 @@ class User_model extends CI_Model
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteNanoCreditRates($idConfig)
|
public function deleteNanoCreditRates($idConfig, $type = 'nano_credit')
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM `paliersConfigNanoCredit` WHERE (`idConfig` = ? );";
|
$sql = "DELETE FROM `paliersConfigNanoCredit` WHERE (`idConfig` = ? AND `type` = ? );";
|
||||||
$query = $this->db->query($sql, array($idConfig));
|
$query = $this->db->query($sql, array($idConfig, $type));
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addNanoCreditRates($idConfig, $duree, $valeur)
|
public function addNanoCreditRates($idConfig, $duree, $valeur, $type = 'nano_credit')
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO `paliersConfigNanoCredit` (`duree_mois`, `taux`, `idConfig`) VALUES (?,?,?);";
|
$sql = "INSERT INTO `paliersConfigNanoCredit` (`duree_mois`, `taux`, `idConfig` ,`type`) VALUES (?,?,?,?);";
|
||||||
$query = $this->db->query($sql, array($duree, $valeur, $idConfig));
|
$query = $this->db->query($sql, array($duree, $valeur, $idConfig, $type));
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getUserDemandesCredit($debut, $fin, $id_network)
|
||||||
|
{
|
||||||
|
$chain = $debut ? " AND date_creation BETWEEN '" . $debut . "' AND '" . $fin . "'" : "";
|
||||||
|
$query = $this->db->query("SELECT *
|
||||||
|
FROM infos_users_demandes_credits
|
||||||
|
WHERE `id_network`='" . $id_network . "'" . $chain);
|
||||||
|
if ($query->num_rows() > 0) {
|
||||||
|
return $query;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,8 @@
|
||||||
echo "active ";
|
echo "active ";
|
||||||
} ?>">
|
} ?>">
|
||||||
<a href="<?php echo base_url('index.php/Hyperviseur_dash/getDemandesAd') ?>">
|
<a href="<?php echo base_url('index.php/Hyperviseur_dash/getDemandesAd') ?>">
|
||||||
<i class="fa fa-users"></i> <span><?php echo $this->lang->line('Demandes adhésion'); ?></span>
|
<i class="fa fa-user-secret"></i>
|
||||||
|
<span><?php echo $this->lang->line('Demandes adhésion'); ?></span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php if ($hasWallet) {
|
<?php if ($hasWallet) {
|
||||||
|
@ -154,7 +155,7 @@
|
||||||
<li class="<?= "treeview " . ((strpos($active, "wallet_") !== false) ? "active menu-open" : "") ?>"
|
<li class="<?= "treeview " . ((strpos($active, "wallet_") !== false) ? "active menu-open" : "") ?>"
|
||||||
style="height: auto;">
|
style="height: auto;">
|
||||||
<a href="#">
|
<a href="#">
|
||||||
<i class="fa fa-users"></i>
|
<i class="fa fa-credit-card-alt"></i>
|
||||||
<span><?php echo $this->lang->line('wallet_management'); ?></span>
|
<span><?php echo $this->lang->line('wallet_management'); ?></span>
|
||||||
<span class="pull-right-container">
|
<span class="pull-right-container">
|
||||||
<i class="fa fa-angle-left pull-right"></i>
|
<i class="fa fa-angle-left pull-right"></i>
|
||||||
|
@ -197,7 +198,7 @@
|
||||||
echo "active";
|
echo "active";
|
||||||
} ?>">
|
} ?>">
|
||||||
<a href="<?php echo base_url('index.php/Hyperviseur_dash/nano_credit') ?>">
|
<a href="<?php echo base_url('index.php/Hyperviseur_dash/nano_credit') ?>">
|
||||||
<i class="glyphicon glyphicon-credit-card"></i> <span>Nano credit</span>
|
<i class="fa fa-money"></i> <span>Nano credit</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php }?>
|
<?php }?>
|
||||||
|
|
|
@ -161,18 +161,12 @@ use Brick\Money\Money;
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$config = $configWallet->first_row();
|
|
||||||
foreach ($transactions->result() as $row) {
|
foreach ($transactions->result() as $row) {
|
||||||
$num++;
|
$num++;
|
||||||
|
|
||||||
$net = 0;
|
$net = 0;
|
||||||
$banque = 0;
|
$banque = 0;
|
||||||
// if($row->type_transaction == 'depot'){
|
|
||||||
// $net = $row->montant_depot;
|
|
||||||
// $banque = $row->montant * (1 - ($config->taux_com_client_depot / 100));
|
|
||||||
// }else{
|
|
||||||
// $net = $row->montant_retrait ;
|
|
||||||
// }
|
|
||||||
$moneyNetInit = Money::of(round($row->montant_net ,2), $row->init_currency,$context);
|
$moneyNetInit = Money::of(round($row->montant_net ,2), $row->init_currency,$context);
|
||||||
if($row->destinataire_phone){
|
if($row->destinataire_phone){
|
||||||
$destinataire = $row->destinataire_phone.' | '.$row->destinataire_name;
|
$destinataire = $row->destinataire_phone.' | '.$row->destinataire_name;
|
||||||
|
|
|
@ -0,0 +1,664 @@
|
||||||
|
<link rel="stylesheet" href="<?php echo base_url('bower_components/jvectormap/jquery-jvectormap.css') ?>">
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="<?php echo base_url('bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css') ?>">
|
||||||
|
<link rel="stylesheet" href="<?php echo base_url('bower_components/bootstrap-daterangepicker/daterangepicker.css') ?>">
|
||||||
|
<link rel="stylesheet" href="<?php echo base_url('plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css') ?>">
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
|
||||||
|
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||||||
|
<style type="text/css">
|
||||||
|
.table-wrapper {
|
||||||
|
width: 700px;
|
||||||
|
margin: 30px auto;
|
||||||
|
background: #fff;
|
||||||
|
padding: 20px;
|
||||||
|
box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-title {
|
||||||
|
padding-bottom: 10px;
|
||||||
|
margin: 0 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-title h2 {
|
||||||
|
margin: 6px 0 0;
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-title .add-new {
|
||||||
|
float: right;
|
||||||
|
height: 30px;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 12px;
|
||||||
|
text-shadow: none;
|
||||||
|
min-width: 100px;
|
||||||
|
border-radius: 50px;
|
||||||
|
line-height: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-title .add-new i {
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table {
|
||||||
|
table-layout: fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table tr th, table.table tr td {
|
||||||
|
border-color: #e9e9e9;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table th i {
|
||||||
|
font-size: 13px;
|
||||||
|
margin: 0 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table th:last-child {
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table td a {
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 5px;
|
||||||
|
min-width: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table td a.add {
|
||||||
|
color: #27C46B;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table td a.edit {
|
||||||
|
color: #FFC107;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table td a.delete {
|
||||||
|
color: #E34724;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table td i {
|
||||||
|
font-size: 19px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table td a.add i {
|
||||||
|
font-size: 24px;
|
||||||
|
margin-right: -1px;
|
||||||
|
position: relative;
|
||||||
|
top: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table .form-control {
|
||||||
|
height: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
box-shadow: none;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*table.table .form-control.error {*/
|
||||||
|
/* border-color: #f50000;*/
|
||||||
|
/*}*/
|
||||||
|
.error {
|
||||||
|
border-color: #f50000;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table td .add {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Brick\Money\Money;
|
||||||
|
|
||||||
|
$context = new \Brick\Money\Context\AutoContext();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<!-- Content Header (Page header) -->
|
||||||
|
<section class="content-header">
|
||||||
|
|
||||||
|
<h1>
|
||||||
|
<?php echo $this->lang->line('edit_nano_credit') . ' - ' . $network . ' - ' . $country; ?>
|
||||||
|
</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">×</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-6">
|
||||||
|
<div class="margin">
|
||||||
|
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#modal-rates"
|
||||||
|
style="width: 100%"><?php echo $this->lang->line('change_interest_rates') ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="margin">
|
||||||
|
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#modal-tax"
|
||||||
|
style="width: 100%"><?php echo $this->lang->line('edit_tax') ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row centered">
|
||||||
|
<div class="col-lg-3 col-lg-offset-2 col-xs-12">
|
||||||
|
<div class="box">
|
||||||
|
<div class="box-header">
|
||||||
|
<h3 class="box-title"><?php echo $this->lang->line('interest_rates'); ?></h3>
|
||||||
|
</div>
|
||||||
|
<div class="box-body table-responsive" style="overflow-x:auto;">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo $this->lang->line('interest_rates_period'); ?> </th>
|
||||||
|
<th><?php echo $this->lang->line('rate'); ?> </th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
if ($rates != false) {
|
||||||
|
foreach ($rates->result() as $row) {
|
||||||
|
echo "<tr>
|
||||||
|
<td>" . $row->duree_mois . "</td>
|
||||||
|
<td>" . $row->taux . "</td>" . '
|
||||||
|
</tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-xs-12">
|
||||||
|
<div class="box">
|
||||||
|
<div class="box-header">
|
||||||
|
<h3 class="box-title"><?php echo $this->lang->line('transaction_nano_credit'); ?></h3>
|
||||||
|
</div>
|
||||||
|
<div class="box-body table-responsive" style="overflow-x:auto;">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo $this->lang->line('Nom'); ?> </th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Valeur</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
if ($taxes != false) {
|
||||||
|
foreach ($taxes->result() as $row) {
|
||||||
|
echo "<tr>
|
||||||
|
<td>" . $row->nom . "</td>
|
||||||
|
<td>" . $row->type . "</td>
|
||||||
|
<td>" . $row->valeur . "</td>" . '
|
||||||
|
</tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal fade" id="modal-rates">
|
||||||
|
<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">×</span>
|
||||||
|
</button>
|
||||||
|
<h3 class="modal-title"><?php echo $this->lang->line('change_interest_rates'); ?></h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="ratesForm">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="table-title">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<label for="nom"
|
||||||
|
class="col-form-label"><?php echo $this->lang->line('interest_rates'); ?></label>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<button type="button" class="btn btn-info add-new new5"><i
|
||||||
|
class="fa fa-plus"></i> <?php echo $this->lang->line('new_rate'); ?>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table id="rates" class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo $this->lang->line('interest_rates_period'); ?></th>
|
||||||
|
<th><?php echo $this->lang->line('rate'); ?></th>
|
||||||
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
if ($rates != false) {
|
||||||
|
foreach ($rates->result() as $row) {
|
||||||
|
echo "<tr>
|
||||||
|
<td>" . $row->duree_mois . "</td>
|
||||||
|
<td>" . $row->taux . "</td>" . '
|
||||||
|
<td>
|
||||||
|
<a class="add add5" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||||
|
<a class="edit edit5" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||||
|
<a class="delete delete5" title="Delete" data-toggle="tooltip"><i class="material-icons"></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"><?php echo $this->lang->line('Fermer'); ?></button>
|
||||||
|
<button type="button" id="saveRates" data-network-id="<?= $network_id ?>"
|
||||||
|
data-id-config="<?= $idConfig ?>"
|
||||||
|
class="btn btn-primary"><?php echo $this->lang->line('Continuer'); ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal fade" id="modal-tax">
|
||||||
|
<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">×</span>
|
||||||
|
</button>
|
||||||
|
<h3 class="modal-title"><?php echo $this->lang->line('edit_tax'); ?></h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="taxForm">
|
||||||
|
<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"><?php echo $this->lang->line('transaction_nano_credit'); ?></label>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<button type="button" class="btn btn-info add-new new51"><i
|
||||||
|
class="fa fa-plus"></i> <?php echo $this->lang->line('new_tax'); ?>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table id="nano_credit_taxes" class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo $this->lang->line('Nom'); ?> </th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Valeur</th>
|
||||||
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
if ($taxes != false) {
|
||||||
|
foreach ($taxes->result() as $row) {
|
||||||
|
echo "<tr>
|
||||||
|
<td>" . $row->nom . "</td>
|
||||||
|
<td>" . $row->type . "</td>
|
||||||
|
<td>" . $row->valeur . "</td>" . '
|
||||||
|
<td>
|
||||||
|
<a class="add add51" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||||
|
<a class="edit edit51" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||||
|
<a class="delete delete51" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||||
|
</td>
|
||||||
|
</tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default pull-left"
|
||||||
|
data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
|
||||||
|
<button type="button" id="saveTaxes" data-network-id="<?= $network_id ?>"
|
||||||
|
data-id-config="<?= $idConfig ?>"
|
||||||
|
class="btn btn-primary"><?php echo $this->lang->line('Continuer'); ?></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/moment/min/moment.min.js') ?>"></script>
|
||||||
|
<script src="<?php echo base_url('bower_components/bootstrap-daterangepicker/daterangepicker.js') ?>"></script>
|
||||||
|
<script src="<?php echo 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>
|
||||||
|
<!-- ChartJS -->
|
||||||
|
<script src="<?php echo base_url('bower_components/chart.js/Chart.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 type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment-with-locales.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.20/dataRender/datetime.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/dataTables.buttons.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.html5.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.print.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.colVis.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
toastr.options.closeButton = true;
|
||||||
|
toastr.options.closeMethod = 'fadeOut';
|
||||||
|
toastr.options.closeDuration = 5000;
|
||||||
|
toastr.options.closeEasing = 'swing';
|
||||||
|
|
||||||
|
|
||||||
|
$('#saveRates').click(function () {
|
||||||
|
const network_id = $(this).data('network-id');
|
||||||
|
const id_config = $(this).data('id-config');
|
||||||
|
// Paliers
|
||||||
|
var rates = [];
|
||||||
|
|
||||||
|
$('#rates tr').has('td').each(function () {
|
||||||
|
var arrayItem = {};
|
||||||
|
$('td', $(this)).each(function (index, item) {
|
||||||
|
if (index < 2) {
|
||||||
|
if (index == 1)
|
||||||
|
arrayItem[index] = parseFloat($(item).html());
|
||||||
|
arrayItem[index] = parseInt($(item).html());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
rates.push(arrayItem);
|
||||||
|
});
|
||||||
|
|
||||||
|
if ($('#ratesForm')[0].checkValidity()) {
|
||||||
|
|
||||||
|
console.log(rates)
|
||||||
|
$.ajax({
|
||||||
|
url: '<?php echo base_url('index.php/Hyperviseur_dash/saveNanoCreditRates')?>',
|
||||||
|
type: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
"id_config": id_config,
|
||||||
|
"rates": rates,
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
if (data == '200') {
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'success',
|
||||||
|
title: "<?php echo $this->lang->line('nano_credit_update')?>",
|
||||||
|
text: "<?php echo $this->lang->line('informations_updated')?>",
|
||||||
|
timer: 3000
|
||||||
|
}).then(() => {
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
|
||||||
|
} 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')?>");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#ratesForm')[0].reportValidity();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#saveTaxes').click(function () {
|
||||||
|
const network_id = $(this).data('network-id');
|
||||||
|
const id_config = $(this).data('id-config');
|
||||||
|
// Paliers
|
||||||
|
var taxes = [];
|
||||||
|
|
||||||
|
$('#nano_credit_taxes tr').has('td').each(function () {
|
||||||
|
var arrayItem = {};
|
||||||
|
$('td', $(this)).each(function (index, item) {
|
||||||
|
if (index < 3) {
|
||||||
|
if (index == 2)
|
||||||
|
arrayItem[index] = parseFloat($(item).html());
|
||||||
|
arrayItem[index] = $(item).html();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
taxes.push(arrayItem);
|
||||||
|
});
|
||||||
|
|
||||||
|
if ($('#taxForm')[0].checkValidity()) {
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '<?php echo base_url('index.php/Gestion/saveTaxes')?>',
|
||||||
|
type: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
"categorie": 'nano_credit', "id_config": id_config,
|
||||||
|
"taxes": taxes,
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
if (data == '200') {
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'success',
|
||||||
|
title: "<?php echo $this->lang->line('nano_credit_update')?>",
|
||||||
|
text: "<?php echo $this->lang->line('informations_updated')?>",
|
||||||
|
timer: 3000
|
||||||
|
}).then(() => {
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
|
||||||
|
} 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')?>");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#taxForm')[0].reportValidity();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
// Interets nano credits
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
var actions5 = $("#rates td:last-child").html();
|
||||||
|
// Append table with add row form on add new button click
|
||||||
|
$(".new5").click(function () {
|
||||||
|
if (!actions5) {
|
||||||
|
actions5 = '<a class="add add5" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
||||||
|
' <a class="edit edit5" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
||||||
|
' <a class="delete delete5" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>';
|
||||||
|
}
|
||||||
|
$(this).attr("disabled", "disabled");
|
||||||
|
var index = $("#rates tbody tr:last-child").index();
|
||||||
|
var row = "<tr> <td><input type='number' min='1' required class='form-control' name='time' id='time'></td> " +
|
||||||
|
"<td><input type='number' required class='form-control' name='rate' id='rate'></td>" +
|
||||||
|
"<td>" + actions5 + "</td>" +
|
||||||
|
"</tr>";
|
||||||
|
$("#rates").append(row);
|
||||||
|
$("#rates tbody tr").eq(index + 1).find(".add, .edit").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="number" required class="form-control" value="' + $(this).text() + '">');
|
||||||
|
if (index == 1)
|
||||||
|
$(this).html('<input type="number" required 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>
|
||||||
|
// Taxes nano credit
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
var actions51 = $("#nano_credit_taxes td:last-child").html();
|
||||||
|
// Append table with add row form on add new button click
|
||||||
|
$(".new51").click(function () {
|
||||||
|
if (!actions51) {
|
||||||
|
actions51 = '<a class="add add51" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
||||||
|
' <a class="edit edit51" title="Edit" data-toggle="tooltip"><i class="material-icons">󢔔</i></a>\n' +
|
||||||
|
' <a class="delete delete51" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>';
|
||||||
|
}
|
||||||
|
$(this).attr("disabled", "disabled");
|
||||||
|
var index = $("#nano_credit_taxes tbody tr:last-child").index();
|
||||||
|
var row = "<tr> <td><input type='text' required class='form-control' name='nom' id='nom'></td> " +
|
||||||
|
"<td> <select class='form-control' id='type' required> <option value='%'> % </option> <option value='fixe'> fixe </option> </select> </td> " +
|
||||||
|
"<td><input type='number' required class='form-control' min='0' name='valeur' id='valeur'></td>" +
|
||||||
|
"<td>" + actions51 + "</td>" +
|
||||||
|
"</tr>";
|
||||||
|
$("#nano_credit_taxes").append(row);
|
||||||
|
$("#nano_credit_taxes tbody tr").eq(index + 1).find(".add, .edit").toggle();
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
});
|
||||||
|
// Add row on add button click
|
||||||
|
$(document).on("click", ".add51", 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();
|
||||||
|
$(".new51").removeAttr("disabled");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Edit row on edit button click
|
||||||
|
$(document).on("click", ".edit51", 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("<select class='form-control' id='type' required> <option value='%' > % </option> <option value='fixe'> fixe </option> </select>");
|
||||||
|
if (index == 2)
|
||||||
|
$(this).html('<input type="number" required class="form-control" min="0" value="' + $(this).text() + '">');
|
||||||
|
});
|
||||||
|
$(this).parents("tr").find(".add, .edit").toggle();
|
||||||
|
$(".new51").attr("disabled", "disabled");
|
||||||
|
});
|
||||||
|
// Delete row on delete button click
|
||||||
|
$(document).on("click", ".delete51", function () {
|
||||||
|
$(this).parents("tr").remove();
|
||||||
|
$(".new51").removeAttr("disabled");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<!-- Page script -->
|
||||||
|
<!--<script src="--><?php //echo base_url('dist/js/custom.js') ?><!--"></script>-->
|
|
@ -0,0 +1,666 @@
|
||||||
|
<link rel="stylesheet" href="<?php echo base_url('bower_components/jvectormap/jquery-jvectormap.css') ?>">
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="<?php echo base_url('bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css') ?>">
|
||||||
|
<link rel="stylesheet" href="<?php echo base_url('bower_components/bootstrap-daterangepicker/daterangepicker.css') ?>">
|
||||||
|
<link rel="stylesheet" href="<?php echo base_url('plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css') ?>">
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
|
||||||
|
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||||||
|
<style type="text/css">
|
||||||
|
.table-wrapper {
|
||||||
|
width: 700px;
|
||||||
|
margin: 30px auto;
|
||||||
|
background: #fff;
|
||||||
|
padding: 20px;
|
||||||
|
box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-title {
|
||||||
|
padding-bottom: 10px;
|
||||||
|
margin: 0 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-title h2 {
|
||||||
|
margin: 6px 0 0;
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-title .add-new {
|
||||||
|
float: right;
|
||||||
|
height: 30px;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 12px;
|
||||||
|
text-shadow: none;
|
||||||
|
min-width: 100px;
|
||||||
|
border-radius: 50px;
|
||||||
|
line-height: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-title .add-new i {
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table {
|
||||||
|
table-layout: fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table tr th, table.table tr td {
|
||||||
|
border-color: #e9e9e9;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table th i {
|
||||||
|
font-size: 13px;
|
||||||
|
margin: 0 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table th:last-child {
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table td a {
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 5px;
|
||||||
|
min-width: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table td a.add {
|
||||||
|
color: #27C46B;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table td a.edit {
|
||||||
|
color: #FFC107;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table td a.delete {
|
||||||
|
color: #E34724;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table td i {
|
||||||
|
font-size: 19px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table td a.add i {
|
||||||
|
font-size: 24px;
|
||||||
|
margin-right: -1px;
|
||||||
|
position: relative;
|
||||||
|
top: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table .form-control {
|
||||||
|
height: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
box-shadow: none;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*table.table .form-control.error {*/
|
||||||
|
/* border-color: #f50000;*/
|
||||||
|
/*}*/
|
||||||
|
.error {
|
||||||
|
border-color: #f50000;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table td .add {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Brick\Money\Money;
|
||||||
|
|
||||||
|
$context = new \Brick\Money\Context\AutoContext();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<!-- Content Header (Page header) -->
|
||||||
|
<section class="content-header">
|
||||||
|
|
||||||
|
<h1>
|
||||||
|
<?php echo $this->lang->line('edit_savings') . ' - ' . $network . ' - ' . $country; ?>
|
||||||
|
</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">×</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-6">
|
||||||
|
<div class="margin">
|
||||||
|
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#modal-rates"
|
||||||
|
style="width: 100%"><?php echo $this->lang->line('change_interest_rates') ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="margin">
|
||||||
|
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#modal-tax"
|
||||||
|
style="width: 100%"><?php echo $this->lang->line('edit_tax') ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row centered">
|
||||||
|
<div class="col-lg-3 col-lg-offset-2 col-xs-12">
|
||||||
|
<div class="box">
|
||||||
|
<div class="box-header">
|
||||||
|
<h3 class="box-title"><?php echo $this->lang->line('interest_rates'); ?></h3>
|
||||||
|
</div>
|
||||||
|
<div class="box-body table-responsive" style="overflow-x:auto;">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo $this->lang->line('interest_rates_period'); ?> </th>
|
||||||
|
<th><?php echo $this->lang->line('rate'); ?> </th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
if ($rates != false) {
|
||||||
|
foreach ($rates->result() as $row) {
|
||||||
|
echo "<tr>
|
||||||
|
<td>" . $row->duree_mois . "</td>
|
||||||
|
<td>" . $row->taux . "</td>" . '
|
||||||
|
</tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-xs-12">
|
||||||
|
<div class="box">
|
||||||
|
<div class="box-header">
|
||||||
|
<h3 class="box-title"><?php echo $this->lang->line('transaction_nano_credit'); ?></h3>
|
||||||
|
</div>
|
||||||
|
<div class="box-body table-responsive" style="overflow-x:auto;">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo $this->lang->line('Nom'); ?> </th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Valeur</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
if ($taxes != false) {
|
||||||
|
foreach ($taxes->result() as $row) {
|
||||||
|
echo "<tr>
|
||||||
|
<td>" . $row->nom . "</td>
|
||||||
|
<td>" . $row->type . "</td>
|
||||||
|
<td>" . $row->valeur . "</td>" . '
|
||||||
|
</tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal fade" id="modal-rates">
|
||||||
|
<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">×</span>
|
||||||
|
</button>
|
||||||
|
<h3 class="modal-title"><?php echo $this->lang->line('change_interest_rates'); ?></h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="ratesForm">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="table-title">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<label for="nom"
|
||||||
|
class="col-form-label"><?php echo $this->lang->line('interest_rates'); ?></label>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<button type="button" class="btn btn-info add-new new5"><i
|
||||||
|
class="fa fa-plus"></i> <?php echo $this->lang->line('new_rate'); ?>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table id="rates" class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo $this->lang->line('interest_rates_period'); ?></th>
|
||||||
|
<th><?php echo $this->lang->line('rate'); ?></th>
|
||||||
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
if ($rates != false) {
|
||||||
|
foreach ($rates->result() as $row) {
|
||||||
|
echo "<tr>
|
||||||
|
<td>" . $row->duree_mois . "</td>
|
||||||
|
<td>" . $row->taux . "</td>" . '
|
||||||
|
<td>
|
||||||
|
<a class="add add5" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||||
|
<a class="edit edit5" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||||
|
<a class="delete delete5" title="Delete" data-toggle="tooltip"><i class="material-icons"></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"><?php echo $this->lang->line('Fermer'); ?></button>
|
||||||
|
<button type="button" id="saveRates" data-network-id="<?= $network_id ?>"
|
||||||
|
data-id-config="<?= $idConfig ?>"
|
||||||
|
class="btn btn-primary"><?php echo $this->lang->line('Continuer'); ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal fade" id="modal-tax">
|
||||||
|
<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">×</span>
|
||||||
|
</button>
|
||||||
|
<h3 class="modal-title"><?php echo $this->lang->line('edit_tax'); ?></h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="taxForm">
|
||||||
|
<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"><?php echo $this->lang->line('transaction_nano_credit'); ?></label>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<button type="button" class="btn btn-info add-new new51"><i
|
||||||
|
class="fa fa-plus"></i> <?php echo $this->lang->line('new_tax'); ?>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table id="nano_credit_taxes" class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo $this->lang->line('Nom'); ?> </th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Valeur</th>
|
||||||
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
if ($taxes != false) {
|
||||||
|
foreach ($taxes->result() as $row) {
|
||||||
|
echo "<tr>
|
||||||
|
<td>" . $row->nom . "</td>
|
||||||
|
<td>" . $row->type . "</td>
|
||||||
|
<td>" . $row->valeur . "</td>" . '
|
||||||
|
<td>
|
||||||
|
<a class="add add51" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||||
|
<a class="edit edit51" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||||
|
<a class="delete delete51" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||||
|
</td>
|
||||||
|
</tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default pull-left"
|
||||||
|
data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
|
||||||
|
<button type="button" id="saveTaxes" data-network-id="<?= $network_id ?>"
|
||||||
|
data-id-config="<?= $idConfig ?>"
|
||||||
|
class="btn btn-primary"><?php echo $this->lang->line('Continuer'); ?></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/moment/min/moment.min.js') ?>"></script>
|
||||||
|
<script src="<?php echo base_url('bower_components/bootstrap-daterangepicker/daterangepicker.js') ?>"></script>
|
||||||
|
<script src="<?php echo 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>
|
||||||
|
<!-- ChartJS -->
|
||||||
|
<script src="<?php echo base_url('bower_components/chart.js/Chart.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 type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment-with-locales.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.20/dataRender/datetime.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/dataTables.buttons.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.html5.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.print.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.colVis.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
toastr.options.closeButton = true;
|
||||||
|
toastr.options.closeMethod = 'fadeOut';
|
||||||
|
toastr.options.closeDuration = 5000;
|
||||||
|
toastr.options.closeEasing = 'swing';
|
||||||
|
|
||||||
|
|
||||||
|
$('#saveRates').click(function () {
|
||||||
|
const network_id = $(this).data('network-id');
|
||||||
|
const id_config = $(this).data('id-config');
|
||||||
|
console.log('save epa')
|
||||||
|
// Paliers
|
||||||
|
var rates = [];
|
||||||
|
|
||||||
|
$('#rates tr').has('td').each(function () {
|
||||||
|
var arrayItem = {};
|
||||||
|
$('td', $(this)).each(function (index, item) {
|
||||||
|
if (index < 2) {
|
||||||
|
if (index == 1)
|
||||||
|
arrayItem[index] = parseFloat($(item).html());
|
||||||
|
arrayItem[index] = parseInt($(item).html());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
rates.push(arrayItem);
|
||||||
|
});
|
||||||
|
|
||||||
|
if ($('#ratesForm')[0].checkValidity()) {
|
||||||
|
|
||||||
|
console.log(rates)
|
||||||
|
$.ajax({
|
||||||
|
url: '<?php echo base_url('index.php/Hyperviseur_dash/saveNanoCreditRates')?>',
|
||||||
|
type: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
"id_config": id_config,
|
||||||
|
"type": "epargne",
|
||||||
|
"rates": rates,
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
if (data == '200') {
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'success',
|
||||||
|
title: "<?php echo $this->lang->line('nano_credit_update')?>",
|
||||||
|
text: "<?php echo $this->lang->line('informations_updated')?>",
|
||||||
|
timer: 3000
|
||||||
|
}).then(() => {
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
|
||||||
|
} 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')?>");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#ratesForm')[0].reportValidity();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#saveTaxes').click(function () {
|
||||||
|
const network_id = $(this).data('network-id');
|
||||||
|
const id_config = $(this).data('id-config');
|
||||||
|
// Paliers
|
||||||
|
var taxes = [];
|
||||||
|
|
||||||
|
$('#nano_credit_taxes tr').has('td').each(function () {
|
||||||
|
var arrayItem = {};
|
||||||
|
$('td', $(this)).each(function (index, item) {
|
||||||
|
if (index < 3) {
|
||||||
|
if (index == 2)
|
||||||
|
arrayItem[index] = parseFloat($(item).html());
|
||||||
|
arrayItem[index] = $(item).html();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
taxes.push(arrayItem);
|
||||||
|
});
|
||||||
|
|
||||||
|
if ($('#taxForm')[0].checkValidity()) {
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '<?php echo base_url('index.php/Gestion/saveTaxes')?>',
|
||||||
|
type: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
"categorie": 'epargne', "id_config": id_config,
|
||||||
|
"taxes": taxes,
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
if (data == '200') {
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'success',
|
||||||
|
title: "<?php echo $this->lang->line('nano_credit_update')?>",
|
||||||
|
text: "<?php echo $this->lang->line('informations_updated')?>",
|
||||||
|
timer: 3000
|
||||||
|
}).then(() => {
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
|
||||||
|
} 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')?>");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#taxForm')[0].reportValidity();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
// Interets nano credits
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
var actions5 = $("#rates td:last-child").html();
|
||||||
|
// Append table with add row form on add new button click
|
||||||
|
$(".new5").click(function () {
|
||||||
|
if (!actions5) {
|
||||||
|
actions5 = '<a class="add add5" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
||||||
|
' <a class="edit edit5" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
||||||
|
' <a class="delete delete5" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>';
|
||||||
|
}
|
||||||
|
$(this).attr("disabled", "disabled");
|
||||||
|
var index = $("#rates tbody tr:last-child").index();
|
||||||
|
var row = "<tr> <td><input type='number' min='1' required class='form-control' name='time' id='time'></td> " +
|
||||||
|
"<td><input type='number' required class='form-control' name='rate' id='rate'></td>" +
|
||||||
|
"<td>" + actions5 + "</td>" +
|
||||||
|
"</tr>";
|
||||||
|
$("#rates").append(row);
|
||||||
|
$("#rates tbody tr").eq(index + 1).find(".add, .edit").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="number" required class="form-control" value="' + $(this).text() + '">');
|
||||||
|
if (index == 1)
|
||||||
|
$(this).html('<input type="number" required 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>
|
||||||
|
// Taxes nano credit
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
var actions51 = $("#nano_credit_taxes td:last-child").html();
|
||||||
|
// Append table with add row form on add new button click
|
||||||
|
$(".new51").click(function () {
|
||||||
|
if (!actions51) {
|
||||||
|
actions51 = '<a class="add add51" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
||||||
|
' <a class="edit edit51" title="Edit" data-toggle="tooltip"><i class="material-icons">󢔔</i></a>\n' +
|
||||||
|
' <a class="delete delete51" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>';
|
||||||
|
}
|
||||||
|
$(this).attr("disabled", "disabled");
|
||||||
|
var index = $("#nano_credit_taxes tbody tr:last-child").index();
|
||||||
|
var row = "<tr> <td><input type='text' required class='form-control' name='nom' id='nom'></td> " +
|
||||||
|
"<td> <select class='form-control' id='type' required> <option value='%'> % </option> <option value='fixe'> fixe </option> </select> </td> " +
|
||||||
|
"<td><input type='number' required class='form-control' min='0' name='valeur' id='valeur'></td>" +
|
||||||
|
"<td>" + actions51 + "</td>" +
|
||||||
|
"</tr>";
|
||||||
|
$("#nano_credit_taxes").append(row);
|
||||||
|
$("#nano_credit_taxes tbody tr").eq(index + 1).find(".add, .edit").toggle();
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
});
|
||||||
|
// Add row on add button click
|
||||||
|
$(document).on("click", ".add51", 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();
|
||||||
|
$(".new51").removeAttr("disabled");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Edit row on edit button click
|
||||||
|
$(document).on("click", ".edit51", 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("<select class='form-control' id='type' required> <option value='%' > % </option> <option value='fixe'> fixe </option> </select>");
|
||||||
|
if (index == 2)
|
||||||
|
$(this).html('<input type="number" required class="form-control" min="0" value="' + $(this).text() + '">');
|
||||||
|
});
|
||||||
|
$(this).parents("tr").find(".add, .edit").toggle();
|
||||||
|
$(".new51").attr("disabled", "disabled");
|
||||||
|
});
|
||||||
|
// Delete row on delete button click
|
||||||
|
$(document).on("click", ".delete51", function () {
|
||||||
|
$(this).parents("tr").remove();
|
||||||
|
$(".new51").removeAttr("disabled");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<!-- Page script -->
|
||||||
|
<!--<script src="--><?php //echo base_url('dist/js/custom.js') ?><!--"></script>-->
|
|
@ -9,106 +9,6 @@
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||||||
<style type="text/css">
|
|
||||||
.table-wrapper {
|
|
||||||
width: 700px;
|
|
||||||
margin: 30px auto;
|
|
||||||
background: #fff;
|
|
||||||
padding: 20px;
|
|
||||||
box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.table-title {
|
|
||||||
padding-bottom: 10px;
|
|
||||||
margin: 0 0 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table-title h2 {
|
|
||||||
margin: 6px 0 0;
|
|
||||||
font-size: 22px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table-title .add-new {
|
|
||||||
float: right;
|
|
||||||
height: 30px;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 12px;
|
|
||||||
text-shadow: none;
|
|
||||||
min-width: 100px;
|
|
||||||
border-radius: 50px;
|
|
||||||
line-height: 13px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table-title .add-new i {
|
|
||||||
margin-right: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.table {
|
|
||||||
table-layout: fixed;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.table tr th, table.table tr td {
|
|
||||||
border-color: #e9e9e9;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.table th i {
|
|
||||||
font-size: 13px;
|
|
||||||
margin: 0 5px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.table th:last-child {
|
|
||||||
width: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.table td a {
|
|
||||||
cursor: pointer;
|
|
||||||
display: inline-block;
|
|
||||||
margin: 0 5px;
|
|
||||||
min-width: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.table td a.add {
|
|
||||||
color: #27C46B;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.table td a.edit {
|
|
||||||
color: #FFC107;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.table td a.delete {
|
|
||||||
color: #E34724;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.table td i {
|
|
||||||
font-size: 19px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.table td a.add i {
|
|
||||||
font-size: 24px;
|
|
||||||
margin-right: -1px;
|
|
||||||
position: relative;
|
|
||||||
top: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.table .form-control {
|
|
||||||
height: 32px;
|
|
||||||
line-height: 32px;
|
|
||||||
box-shadow: none;
|
|
||||||
border-radius: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*table.table .form-control.error {*/
|
|
||||||
/* border-color: #f50000;*/
|
|
||||||
/*}*/
|
|
||||||
.error {
|
|
||||||
border-color: #f50000;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.table td .add {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Brick\Money\Money;
|
use Brick\Money\Money;
|
||||||
|
@ -188,77 +88,16 @@ $context = new \Brick\Money\Context\AutoContext();
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
<div class="margin">
|
<div class="margin">
|
||||||
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#modal-rates"
|
<a class="btn btn-info"
|
||||||
style="width: 100%"><?php echo $this->lang->line('change_interest_rates') ?></button>
|
href="<?php echo current_url() . ($network_id ? '?config=nano_credit' : '') ?>"
|
||||||
|
style="width: 100%"><?php echo $this->lang->line('edit_nano_credit') ?></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
<div class="margin">
|
<div class="margin">
|
||||||
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#modal-tax"
|
<a href="<?php echo current_url() . ($network_id ? '?config=epargne' : '') ?>"
|
||||||
style="width: 100%"><?php echo $this->lang->line('edit_tax') ?></button>
|
class="btn btn-success"
|
||||||
</div>
|
style="width: 100%"><?php echo $this->lang->line('edit_savings') ?></a>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row centered">
|
|
||||||
<div class="col-lg-3 col-lg-offset-2 col-xs-12">
|
|
||||||
<div class="box">
|
|
||||||
<div class="box-header">
|
|
||||||
<h3 class="box-title"><?php echo $this->lang->line('interest_rates'); ?></h3>
|
|
||||||
</div>
|
|
||||||
<div class="box-body table-responsive" style="overflow-x:auto;">
|
|
||||||
<table class="table table-hover">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th><?php echo $this->lang->line('interest_rates_period'); ?> </th>
|
|
||||||
<th><?php echo $this->lang->line('rate'); ?> </th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
if ($rates != false) {
|
|
||||||
foreach ($rates->result() as $row) {
|
|
||||||
echo "<tr>
|
|
||||||
<td>" . $row->duree_mois . "</td>
|
|
||||||
<td>" . $row->taux . "</td>" . '
|
|
||||||
</tr>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-4 col-xs-12">
|
|
||||||
<div class="box">
|
|
||||||
<div class="box-header">
|
|
||||||
<h3 class="box-title"><?php echo $this->lang->line('transaction_nano_credit'); ?></h3>
|
|
||||||
</div>
|
|
||||||
<div class="box-body table-responsive" style="overflow-x:auto;">
|
|
||||||
<table class="table table-hover">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th><?php echo $this->lang->line('Nom'); ?> </th>
|
|
||||||
<th>Type</th>
|
|
||||||
<th>Valeur</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
if ($taxes != false) {
|
|
||||||
foreach ($taxes->result() as $row) {
|
|
||||||
echo "<tr>
|
|
||||||
<td>" . $row->nom . "</td>
|
|
||||||
<td>" . $row->type . "</td>
|
|
||||||
<td>" . $row->valeur . "</td>" . '
|
|
||||||
</tr>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -375,140 +214,6 @@ $context = new \Brick\Money\Context\AutoContext();
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal fade" id="modal-rates">
|
|
||||||
<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">×</span>
|
|
||||||
</button>
|
|
||||||
<h3 class="modal-title"><?php echo $this->lang->line('change_interest_rates'); ?></h3>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<form id="ratesForm">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="table-title">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<label for="nom"
|
|
||||||
class="col-form-label"><?php echo $this->lang->line('interest_rates'); ?></label>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-4">
|
|
||||||
<button type="button" class="btn btn-info add-new new5"><i
|
|
||||||
class="fa fa-plus"></i> <?php echo $this->lang->line('new_rate'); ?>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<table id="rates" class="table table-bordered">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th><?php echo $this->lang->line('interest_rates_period'); ?></th>
|
|
||||||
<th><?php echo $this->lang->line('rate'); ?></th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
if ($rates != false) {
|
|
||||||
foreach ($rates->result() as $row) {
|
|
||||||
echo "<tr>
|
|
||||||
<td>" . $row->duree_mois . "</td>
|
|
||||||
<td>" . $row->taux . "</td>" . '
|
|
||||||
<td>
|
|
||||||
<a class="add add5" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>
|
|
||||||
<a class="edit edit5" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>
|
|
||||||
<a class="delete delete5" title="Delete" data-toggle="tooltip"><i class="material-icons"></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"><?php echo $this->lang->line('Fermer'); ?></button>
|
|
||||||
<button type="button" id="saveRates" data-network-id="<?= $network_id ?>"
|
|
||||||
data-id-config="<?= $idConfig ?>"
|
|
||||||
class="btn btn-primary"><?php echo $this->lang->line('Continuer'); ?></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal fade" id="modal-tax">
|
|
||||||
<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">×</span>
|
|
||||||
</button>
|
|
||||||
<h3 class="modal-title"><?php echo $this->lang->line('edit_tax'); ?></h3>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<form id="taxForm">
|
|
||||||
<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"><?php echo $this->lang->line('transaction_nano_credit'); ?></label>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-4">
|
|
||||||
<button type="button" class="btn btn-info add-new new51"><i
|
|
||||||
class="fa fa-plus"></i> <?php echo $this->lang->line('new_tax'); ?>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<table id="nano_credit_taxes" class="table table-bordered">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th><?php echo $this->lang->line('Nom'); ?> </th>
|
|
||||||
<th>Type</th>
|
|
||||||
<th>Valeur</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
if ($taxes != false) {
|
|
||||||
foreach ($taxes->result() as $row) {
|
|
||||||
echo "<tr>
|
|
||||||
<td>" . $row->nom . "</td>
|
|
||||||
<td>" . $row->type . "</td>
|
|
||||||
<td>" . $row->valeur . "</td>" . '
|
|
||||||
<td>
|
|
||||||
<a class="add add51" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>
|
|
||||||
<a class="edit edit51" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>
|
|
||||||
<a class="delete delete51" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>
|
|
||||||
</td>
|
|
||||||
</tr>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default pull-left"
|
|
||||||
data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
|
|
||||||
<button type="button" id="saveTaxes" data-network-id="<?= $network_id ?>"
|
|
||||||
data-id-config="<?= $idConfig ?>"
|
|
||||||
class="btn btn-primary"><?php echo $this->lang->line('Continuer'); ?></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
<!-- jQuery 3 -->
|
<!-- jQuery 3 -->
|
||||||
|
@ -617,257 +322,6 @@ $context = new \Brick\Money\Context\AutoContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#saveRates').click(function () {
|
|
||||||
const network_id = $(this).data('network-id');
|
|
||||||
const id_config = $(this).data('id-config');
|
|
||||||
// Paliers
|
|
||||||
var rates = [];
|
|
||||||
|
|
||||||
$('#rates tr').has('td').each(function () {
|
|
||||||
var arrayItem = {};
|
|
||||||
$('td', $(this)).each(function (index, item) {
|
|
||||||
if (index < 2) {
|
|
||||||
if (index == 1)
|
|
||||||
arrayItem[index] = parseFloat($(item).html());
|
|
||||||
arrayItem[index] = parseInt($(item).html());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
rates.push(arrayItem);
|
|
||||||
});
|
|
||||||
|
|
||||||
if ($('#ratesForm')[0].checkValidity()) {
|
|
||||||
|
|
||||||
console.log(rates)
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo base_url('index.php/Hyperviseur_dash/saveNanoCreditRates')?>',
|
|
||||||
type: 'POST',
|
|
||||||
dataType: 'json',
|
|
||||||
data: {
|
|
||||||
"id_config": id_config,
|
|
||||||
"rates": rates,
|
|
||||||
},
|
|
||||||
success: function (data) {
|
|
||||||
if (data == '200') {
|
|
||||||
Swal.fire({
|
|
||||||
icon: 'success',
|
|
||||||
title: "<?php echo $this->lang->line('nano_credit_update')?>",
|
|
||||||
text: "<?php echo $this->lang->line('informations_updated')?>",
|
|
||||||
timer: 3000
|
|
||||||
}).then(() => {
|
|
||||||
location.reload();
|
|
||||||
});
|
|
||||||
|
|
||||||
} 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')?>");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$('#ratesForm')[0].reportValidity();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#saveTaxes').click(function () {
|
|
||||||
const network_id = $(this).data('network-id');
|
|
||||||
const id_config = $(this).data('id-config');
|
|
||||||
// Paliers
|
|
||||||
var taxes = [];
|
|
||||||
|
|
||||||
$('#nano_credit_taxes tr').has('td').each(function () {
|
|
||||||
var arrayItem = {};
|
|
||||||
$('td', $(this)).each(function (index, item) {
|
|
||||||
if (index < 3) {
|
|
||||||
if (index == 2)
|
|
||||||
arrayItem[index] = parseFloat($(item).html());
|
|
||||||
arrayItem[index] = $(item).html();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
taxes.push(arrayItem);
|
|
||||||
});
|
|
||||||
|
|
||||||
if ($('#taxForm')[0].checkValidity()) {
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo base_url('index.php/Gestion/saveTaxes')?>',
|
|
||||||
type: 'POST',
|
|
||||||
dataType: 'json',
|
|
||||||
data: {
|
|
||||||
"categorie": 'nano_credit', "id_config": id_config,
|
|
||||||
"taxes": taxes,
|
|
||||||
},
|
|
||||||
success: function (data) {
|
|
||||||
if (data == '200') {
|
|
||||||
Swal.fire({
|
|
||||||
icon: 'success',
|
|
||||||
title: "<?php echo $this->lang->line('nano_credit_update')?>",
|
|
||||||
text: "<?php echo $this->lang->line('informations_updated')?>",
|
|
||||||
timer: 3000
|
|
||||||
}).then(() => {
|
|
||||||
location.reload();
|
|
||||||
});
|
|
||||||
|
|
||||||
} 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')?>");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$('#taxForm')[0].reportValidity();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
// Interets nano credits
|
|
||||||
$(document).ready(function () {
|
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
|
||||||
var actions5 = $("#rates td:last-child").html();
|
|
||||||
// Append table with add row form on add new button click
|
|
||||||
$(".new5").click(function () {
|
|
||||||
if (!actions5) {
|
|
||||||
actions5 = '<a class="add add5" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
|
||||||
' <a class="edit edit5" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
|
||||||
' <a class="delete delete5" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>';
|
|
||||||
}
|
|
||||||
$(this).attr("disabled", "disabled");
|
|
||||||
var index = $("#rates tbody tr:last-child").index();
|
|
||||||
var row = "<tr> <td><input type='number' min='1' required class='form-control' name='time' id='time'></td> " +
|
|
||||||
"<td><input type='number' required class='form-control' name='rate' id='rate'></td>" +
|
|
||||||
"<td>" + actions5 + "</td>" +
|
|
||||||
"</tr>";
|
|
||||||
$("#rates").append(row);
|
|
||||||
$("#rates tbody tr").eq(index + 1).find(".add, .edit").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="number" required class="form-control" value="' + $(this).text() + '">');
|
|
||||||
if (index == 1)
|
|
||||||
$(this).html('<input type="number" required 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>
|
|
||||||
// Taxes nano credit
|
|
||||||
$(document).ready(function () {
|
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
|
||||||
var actions51 = $("#nano_credit_taxes td:last-child").html();
|
|
||||||
// Append table with add row form on add new button click
|
|
||||||
$(".new51").click(function () {
|
|
||||||
if (!actions51) {
|
|
||||||
actions51 = '<a class="add add51" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
|
||||||
' <a class="edit edit51" title="Edit" data-toggle="tooltip"><i class="material-icons">󢔔</i></a>\n' +
|
|
||||||
' <a class="delete delete51" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>';
|
|
||||||
}
|
|
||||||
$(this).attr("disabled", "disabled");
|
|
||||||
var index = $("#nano_credit_taxes tbody tr:last-child").index();
|
|
||||||
var row = "<tr> <td><input type='text' required class='form-control' name='nom' id='nom'></td> " +
|
|
||||||
"<td> <select class='form-control' id='type' required> <option value='%'> % </option> <option value='fixe'> fixe </option> </select> </td> " +
|
|
||||||
"<td><input type='number' required class='form-control' min='0' name='valeur' id='valeur'></td>" +
|
|
||||||
"<td>" + actions51 + "</td>" +
|
|
||||||
"</tr>";
|
|
||||||
$("#nano_credit_taxes").append(row);
|
|
||||||
$("#nano_credit_taxes tbody tr").eq(index + 1).find(".add, .edit").toggle();
|
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
|
||||||
});
|
|
||||||
// Add row on add button click
|
|
||||||
$(document).on("click", ".add51", 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();
|
|
||||||
$(".new51").removeAttr("disabled");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// Edit row on edit button click
|
|
||||||
$(document).on("click", ".edit51", 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("<select class='form-control' id='type' required> <option value='%' > % </option> <option value='fixe'> fixe </option> </select>");
|
|
||||||
if (index == 2)
|
|
||||||
$(this).html('<input type="number" required class="form-control" min="0" value="' + $(this).text() + '">');
|
|
||||||
});
|
|
||||||
$(this).parents("tr").find(".add, .edit").toggle();
|
|
||||||
$(".new51").attr("disabled", "disabled");
|
|
||||||
});
|
|
||||||
// Delete row on delete button click
|
|
||||||
$(document).on("click", ".delete51", function () {
|
|
||||||
$(this).parents("tr").remove();
|
|
||||||
$(".new51").removeAttr("disabled");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
<!-- Page script -->
|
<!-- Page script -->
|
||||||
<!--<script src="--><?php //echo base_url('dist/js/custom.js') ?><!--"></script>-->
|
<!--<script src="--><?php //echo base_url('dist/js/custom.js') ?><!--"></script>-->
|
||||||
|
|
|
@ -0,0 +1,351 @@
|
||||||
|
<!-- DataTables -->
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
|
||||||
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.6.2/css/buttons.dataTables.min.css">
|
||||||
|
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Brick\Money\Context\AutoContext;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Brick\Money\CurrencyConverter;
|
||||||
|
use Brick\Money\ExchangeRateProvider\PDOProvider;
|
||||||
|
use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration;
|
||||||
|
use Brick\Money\ExchangeRateProvider\BaseCurrencyProvider;
|
||||||
|
use Brick\Math\RoundingMode;
|
||||||
|
use Brick\Money\Money;
|
||||||
|
|
||||||
|
function toLocateDate($date, $timezone)
|
||||||
|
{
|
||||||
|
if ($date) {
|
||||||
|
$carbon = Carbon::createFromFormat('Y-m-d H:i:s', $date, 'UTC');
|
||||||
|
$carbon->setTimezone($timezone);
|
||||||
|
return $carbon->toDateTimeString();
|
||||||
|
}
|
||||||
|
return $date;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!-- Content Header (Page header) -->
|
||||||
|
<section class="content-header">
|
||||||
|
|
||||||
|
<h1>
|
||||||
|
<?php echo isset($category) ? 'Nano credit' : $this->lang->line('Gestion des wallets');
|
||||||
|
echo ' ' . $network . ' - ' . $country
|
||||||
|
. ' :: ' . $this->lang->line('Historique des transactions'); ?>
|
||||||
|
<!-- <input type="button" class="btn btn-primary pull-right" id="Bactiver"-->
|
||||||
|
<!-- value="Activer/Désactiver le(s) réseau(x)" />-->
|
||||||
|
</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">×</button>
|
||||||
|
<h4><i class="icon fa fa-check"></i> Success!</h4>
|
||||||
|
<?php echo $message; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// set to whatever your rates are relative to
|
||||||
|
$baseCurrency = 'USD';
|
||||||
|
|
||||||
|
// use your own credentials, or re-use your existing PDO connection
|
||||||
|
$pdo = new PDO('mysql:host=' . $this->db->hostname . ';dbname=' . $this->db->database, $this->db->username, $this->db->password);
|
||||||
|
|
||||||
|
$configuration = new PDOProviderConfiguration();
|
||||||
|
|
||||||
|
$configuration->tableName = 'exchange_rate';
|
||||||
|
$configuration->exchangeRateColumnName = 'exchange_rate';
|
||||||
|
$configuration->targetCurrencyColumnName = 'target_currency';
|
||||||
|
$configuration->sourceCurrencyCode = $baseCurrency;
|
||||||
|
|
||||||
|
// this provider loads exchange rates from your database
|
||||||
|
$provider = new PDOProvider($pdo, $configuration);
|
||||||
|
|
||||||
|
// this provider calculates exchange rates relative to the base currency
|
||||||
|
$provider = new BaseCurrencyProvider($provider, $baseCurrency);
|
||||||
|
|
||||||
|
// this currency converter can now handle any currency pair
|
||||||
|
$converter = new CurrencyConverter($provider);
|
||||||
|
$context = new AutoContext();
|
||||||
|
?>
|
||||||
|
</section>
|
||||||
|
<section class="content">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4 col-sm-6 col-xs-12">
|
||||||
|
<div class="info-box">
|
||||||
|
<span class="info-box-icon bg-aqua"><i class="ion ion-android-time"></i></span>
|
||||||
|
<div class="info-box-content">
|
||||||
|
<span class="info-box-text"><?php echo $this->lang->line('Période') ?> </span>
|
||||||
|
<span class="info-box-number">
|
||||||
|
<input id="picker"
|
||||||
|
style="background: #fff; cursor: pointer; padding: 1px 1px; border: 1px solid #ccc; width: 100%"
|
||||||
|
data-category="<?php echo isset($category) ? $category : null ?>"
|
||||||
|
type="text" name="daterange"
|
||||||
|
data-lang="<?php echo $this->session->userdata('site_lang') ?>"
|
||||||
|
value="<?php echo ($startDate != null & $endDate != null) ? $startDate . ' - ' . $endDate : '' ?>"/>
|
||||||
|
|
||||||
|
</span>
|
||||||
|
<span> Format : <?php echo $this->session->userdata('site_lang') === 'french' ? 'Jour - Mois - Année ' : 'Year - Month - Day' ?> </span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="box">
|
||||||
|
<div class="box-header">
|
||||||
|
<h3 class="box-title"><?php echo $this->lang->line('export_transaction_history') ?></h3>
|
||||||
|
</div>
|
||||||
|
<div class="box-body" style="overflow-x:auto;">
|
||||||
|
<?php
|
||||||
|
if ($transactions){
|
||||||
|
$numrows = $transactions->num_rows();
|
||||||
|
$num = 0;
|
||||||
|
if ($numrows > 0) {
|
||||||
|
$fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<table id="transactions" class="table table-bordered table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th align='center'>ID</th>
|
||||||
|
<th align='center'>Etat</th>
|
||||||
|
<th align='center'>Caution</th>
|
||||||
|
<th align='center'>Duree (en mois)</th>
|
||||||
|
<th><?php echo $this->lang->line('Montant') ?></th>
|
||||||
|
<th><?php echo $this->lang->line('fees') ?></th>
|
||||||
|
<th><?php echo $this->lang->line('tax') ?></th>
|
||||||
|
<th><?php echo $this->lang->line('agent_name') ?></th>
|
||||||
|
<th><?php echo $this->lang->line('issuer_id') ?></th>
|
||||||
|
<th>Retrait en cash</th>
|
||||||
|
<th>Date de la demande</th>
|
||||||
|
<th>Date de remboursement</th>
|
||||||
|
<th align='center'>Date</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
foreach ($transactions->result() as $row) {
|
||||||
|
$num++;
|
||||||
|
if ($row->user_phone) {
|
||||||
|
$emetteur = $row->user_phone . ' | ' . $row->user;
|
||||||
|
} else {
|
||||||
|
$emetteur = ($row->nom_emetteur ? $row->nom_emetteur : '') . (' ' . $row->prenom_emetteur ? $row->prenom_emetteur : '');
|
||||||
|
}
|
||||||
|
$moneyNet = Money::of(round($row->montant, 2), $currency_code, $context);
|
||||||
|
if ($row->type_caution == 'individuel')
|
||||||
|
$retrait = $row->retrait_cash ? 'OUI' : 'NON';
|
||||||
|
else
|
||||||
|
$retrait = "";
|
||||||
|
echo "<tr>
|
||||||
|
<td align='center' >$row->id_demande</td>
|
||||||
|
<td>" . strtoupper($row->etat) . "</td>
|
||||||
|
<td>" . strtoupper($row->type_caution) . "</td>
|
||||||
|
<td>" . strtoupper($row->duree_mois) . "</td>
|
||||||
|
<td>" . $moneyNet->formatTo('fr_FR') . "</td>
|
||||||
|
<td>" . Money::of(round($row->frais, 2), $currency_code, $context)->formatTo('fr_FR') . "</td>
|
||||||
|
<td>" . Money::of(round($row->taxe, 2), $currency_code, $context)->formatTo('fr_FR') . "</td>
|
||||||
|
<td>" . $row->agent . "</td>
|
||||||
|
<td>" . $emetteur . "</td>
|
||||||
|
<td>" . $retrait . "</td>
|
||||||
|
<td>" . toLocateDate($row->date_demande, $this->session->userdata('timezone')) . "</td>
|
||||||
|
<td>" . toLocateDate($row->date_remboursement, $this->session->userdata('timezone')) . "</td>
|
||||||
|
<td>" . toLocateDate($row->date_creation, $this->session->userdata('timezone')) . "</td>";
|
||||||
|
?>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
echo $this->lang->line('Aucune demande');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo $this->lang->line('Aucune demande');
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</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 type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment-with-locales.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.20/dataRender/datetime.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/dataTables.buttons.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.html5.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.print.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.colVis.min.js"></script>
|
||||||
|
<script src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
|
||||||
|
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
const lang = $('#picker').data('lang');
|
||||||
|
const format = lang === 'french' ? 'fr' : 'en';
|
||||||
|
moment.updateLocale(moment.locale(format), {invalidDate: ""}); // Blank text when is invalid date
|
||||||
|
var table = $('#transactions').DataTable({
|
||||||
|
"aaSorting": [[12, "desc"]],
|
||||||
|
"columnDefs": [{
|
||||||
|
targets: [10, 11, 12],
|
||||||
|
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
|
||||||
|
}],
|
||||||
|
dom: 'Bfrtip',
|
||||||
|
"buttons": [
|
||||||
|
'pageLength',
|
||||||
|
{
|
||||||
|
extend: 'excelHtml5',
|
||||||
|
title: 'Histrotique des demandes de credit',
|
||||||
|
customizeData: function (data) {
|
||||||
|
for (var i = 0; i < data.body.length; i++) {
|
||||||
|
for (var j = 0; j < data.body[i].length; j++) {
|
||||||
|
// data.body[i][j] = '\u200C' + data.body[i][j];
|
||||||
|
if ([4, 5, 6].includes(j)) {
|
||||||
|
// Get the value and strip the non numeric characters
|
||||||
|
// var value = $(this).text();
|
||||||
|
value = data.body[i][j].replace(',', ".")
|
||||||
|
data.body[i][j] = Number(value.replace(/[^0-9\.-]+/g, ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
trim: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extend: 'csvHtml5',
|
||||||
|
title: 'Histrotique des demandes de credit',
|
||||||
|
trim: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extend: 'pdfHtml5',
|
||||||
|
orientation: 'landscape',
|
||||||
|
pageSize: 'LEGAL',
|
||||||
|
title: 'Histrotique des demandes de credit',
|
||||||
|
trim: false
|
||||||
|
},
|
||||||
|
// 'colvis'
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
table.buttons().container()
|
||||||
|
.appendTo('#example_wrapper .col-sm-6:eq(0)');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var startDate;
|
||||||
|
var endDate;
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
const lang = $('#picker').data('lang');
|
||||||
|
const category = $('#picker').data('category');
|
||||||
|
$('input[name="daterange"]').daterangepicker({
|
||||||
|
opens: 'left',
|
||||||
|
autoUpdateInput: false,
|
||||||
|
locale: {
|
||||||
|
format: lang === 'french' ? 'DD-MM-YYYY' : 'YYYY-MM-DD',
|
||||||
|
cancelLabel: 'Clear'
|
||||||
|
}
|
||||||
|
}, function (start, end, label) {
|
||||||
|
const debut = start.format('YYYY-MM-DD');
|
||||||
|
const fin = end.format('YYYY-MM-DD');
|
||||||
|
if (category)
|
||||||
|
window.location = "<?php echo current_url()?>" + "?history=nano_credit" + "&d=" + debut + "&f=" + fin;
|
||||||
|
else
|
||||||
|
window.location = "<?php echo current_url()?>" + "?id=118&history=nano_credit" + "&d=" + debut + "&f=" + fin;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$('input[name="daterange"]').on('cancel.daterangepicker', function (ev, picker) {
|
||||||
|
//do something, like clearing an input
|
||||||
|
$('#daterange').val('');
|
||||||
|
if (category)
|
||||||
|
window.location = "<?php echo current_url()?>" + "?history=nano_credit";
|
||||||
|
else
|
||||||
|
window.location = "<?php echo current_url()?>" + "?id=118&history=nano_credit";
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
$(document).on("click", "#cancel", function () {
|
||||||
|
const id_transaction = $(this).data('id-transaction');
|
||||||
|
$.ajax({
|
||||||
|
url: '<?php echo base_url('index.php/Gestion/cancelIlinkTransation')?>',
|
||||||
|
type: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {"id_transaction": id_transaction},
|
||||||
|
async: true,
|
||||||
|
success: function (data) {
|
||||||
|
if (data) {
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'success',
|
||||||
|
title: "<?php echo $this->lang->line('canceled_transaction')?>",
|
||||||
|
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>
|
Loading…
Reference in New Issue