Enable nano health in admin panel
This commit is contained in:
parent
5dd093a8af
commit
9d8cf04e4a
|
@ -11,6 +11,8 @@ class Gestion extends CI_Controller
|
|||
parent::__construct();
|
||||
$this->load->model('wallet_model');
|
||||
$this->load->model('nano_credit_model');
|
||||
$this->load->model('nano_health_model');
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
|
@ -2210,6 +2212,81 @@ class Gestion extends CI_Controller
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public function nano_health(){
|
||||
if ($this->isLogged()) {
|
||||
$data['active'] = "nano_health";
|
||||
$data['alert'] = "";
|
||||
$data['game_pays'] = $this->user_model->getGameCountry();
|
||||
|
||||
if ($this->input->get('id')) {
|
||||
$data['network_id'] = $this->input->get('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('group')) {
|
||||
$this->users_group_details($data['network_id'],$this->input->get('group'));
|
||||
} else {
|
||||
$data['groups'] = $this->nano_credit_model->getUsersGroups($data['network_id']);
|
||||
$data['configWallet'] = $this->wallet_model->getConfigWallet($data['network_id'])->first_row();
|
||||
$networkDetails = $this->user_model->getNetworkDetails($data['network_id']);
|
||||
if ($networkDetails) {
|
||||
$data['network'] = $networkDetails->first_row()->network;
|
||||
$data['country'] = $networkDetails->first_row()->country;
|
||||
$data['currency_code'] = $networkDetails->first_row()->currency_code;
|
||||
}
|
||||
|
||||
$data['rates_nano_credit'] = $this->nano_credit_model->getNanoCreditRates($data['configWallet']->id);
|
||||
$data['taxes_nano_credit'] = $this->wallet_model->getTaxes($data['configWallet']->id, 'nano_credit');
|
||||
|
||||
$data['rates_epargne'] = $this->nano_credit_model->getNanoCreditRates($data['configWallet']->id, 'epargne');
|
||||
$data['taxes_epargne'] = $this->wallet_model->getTaxes($data['configWallet']->id, 'epargne');
|
||||
$this->load->view('header_gestion', $data);
|
||||
$this->load->view('nano_credit/gestion_nano_credit_admin');
|
||||
$this->load->view('footer');
|
||||
}
|
||||
} else {
|
||||
$data['networks'] = $this->nano_health_model->getAllIlinkWorldNetworks();
|
||||
$this->load->view('header_gestion', $data);
|
||||
$this->load->view('nano_health/gestion_nano_health');
|
||||
$this->load->view('footer');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function activate_nano_health()
|
||||
{
|
||||
if ($this->isLogged()) {
|
||||
if (isset($_POST)) {
|
||||
$data = array('has_nano_health' => 1);
|
||||
$this->db->where('id_network', $_POST['id_network']);
|
||||
$res = $this->db->update('configWallet', $data);
|
||||
if ($res) {
|
||||
echo json_encode("200");
|
||||
} else {
|
||||
echo json_encode("500");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function deactivate_nano_health()
|
||||
{
|
||||
if ($this->isLogged()) {
|
||||
if (isset($_POST)) {
|
||||
$data = array('has_nano_health' => 0);
|
||||
$this->db->where('id_network', $_POST['id_network']);
|
||||
$res = $this->db->update('configWallet', $data);
|
||||
if ($res) {
|
||||
echo json_encode("200");
|
||||
} else {
|
||||
echo json_encode("500");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function regulations()
|
||||
{
|
||||
|
||||
|
|
|
@ -604,5 +604,11 @@ $lang['delete_transaction'] = "Delete a transaction";
|
|||
$lang['are_you_sure'] = "Are you sure what you are doing?";
|
||||
$lang['deleted_transactions'] = "Deleted Transactions";
|
||||
$lang['deletion_date'] = "Date of deletion";
|
||||
$lang['wallet_transaction_deleted_message'] = "Transaction number %s made by agent %s has been deleted"
|
||||
$lang['wallet_transaction_deleted_message'] = "Transaction number %s made by agent %s has been deleted";
|
||||
//Nano Santé
|
||||
$lang['nano_health'] = "Nano health";
|
||||
$lang['nano_health_management'] = 'Nano health management';
|
||||
$lang['nano_health_removal'] = 'Removal of nano health';
|
||||
$lang['activate_nano_health'] = 'Activate nano health';
|
||||
$lang['nano_health_deleted'] = 'Nano health deleted';
|
||||
?>
|
||||
|
|
|
@ -616,5 +616,11 @@ $lang['delete_transaction'] = "Supprimer une transaction";
|
|||
$lang['are_you_sure'] = "Êtes vous sûr de ce que vous faites ?";
|
||||
$lang['deleted_transactions'] = "Transactions supprimées";
|
||||
$lang['deletion_date'] = "Date de suppression";
|
||||
$lang['wallet_transaction_deleted_message'] = "La transaction numéro %s faites par l'agent %s a été supprimée"
|
||||
$lang['wallet_transaction_deleted_message'] = "La transaction numéro %s faites par l'agent %s a été supprimée";
|
||||
//Nano santé
|
||||
$lang['nano_health'] = "Nano santé";
|
||||
$lang['nano_health_management'] = 'Gestion du nano santé';
|
||||
$lang['nano_health_removal'] = 'Suppression du nano santé';
|
||||
$lang['activate_nano_health'] = 'Activation du nano santé';
|
||||
$lang['nano_health_deleted'] = 'Nano santé supprimé';
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: capp
|
||||
* Date: 29/05/2018
|
||||
* Time: 15:49
|
||||
*/
|
||||
|
||||
|
||||
class Nano_health_model extends CI_Model
|
||||
{
|
||||
// Nano sante
|
||||
public function getAllIlinkWorldNetworks()
|
||||
{
|
||||
$query = $this->db->query("SELECT networks.name AS network,networks.status AS status,networks.id,cc.name AS country,networks.country_id , configWallet.id_network , configWallet.type,cc.currency_code,
|
||||
configWallet.has_nano_health FROM `networks`
|
||||
INNER JOIN countries_currencies cc ON networks.country_id=cc.id LEFT JOIN configWallet ON configWallet.id_network = networks.id WHERE status = 1 AND configWallet.type = 'ilink'");
|
||||
if ($query->num_rows() > 0) {
|
||||
return $query;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -158,6 +158,12 @@
|
|||
<i class="glyphicon glyphicon-credit-card"></i> <span>Nano credit</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="<?php if ($active == "nano_health") {echo "active";} ?>">
|
||||
<a href="<?php echo base_url('index.php/Gestion/nano_health') ?>">
|
||||
<i class="glyphicon glyphicon-heart"></i> <span><?php echo $this->lang->line('nano_health'); ?></span>
|
||||
</a>
|
||||
</li>
|
||||
<!-- <li class="--><?php ////if($active=="map"){echo "active";} ?><!--">-->
|
||||
<!-- <a href="--><?php ////echo base_url('index.php/Gestion/map') ?><!--">-->
|
||||
<!-- <i class="glyphicon glyphicon-map-marker"></i> <span>Carte</span>-->
|
||||
|
|
|
@ -0,0 +1,249 @@
|
|||
<link rel="stylesheet"
|
||||
href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
|
||||
<link rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/css/bootstrap-multiselect.css">
|
||||
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
|
||||
<h1>
|
||||
<?php echo $this->lang->line('nano_health_management'); ?>
|
||||
</h1>
|
||||
<?php
|
||||
|
||||
use Brick\Money\Money;
|
||||
|
||||
$context = new \Brick\Money\Context\AutoContext();
|
||||
$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-xs-12">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?php echo $this->lang->line('ilink_world_networks'); ?></h3>
|
||||
</div>
|
||||
<div class="box-body" style="overflow-x:auto;">
|
||||
|
||||
<?php
|
||||
|
||||
$sql2 = $networks;
|
||||
if ($sql2 != false) {
|
||||
$numrows = $sql2->num_rows();
|
||||
$num = 0;
|
||||
if ($numrows > 0) {
|
||||
?>
|
||||
<table id="validated" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align='center'>N°</th>
|
||||
<th><?php echo $this->lang->line('Reseau'); ?></th>
|
||||
<th><?php echo $this->lang->line('Pays'); ?></th>
|
||||
<th align='center'><?php echo $this->lang->line('nano_health'); ?></th>
|
||||
<th align='center'> Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($sql2->result() as $row) {
|
||||
$num++;
|
||||
//$member_code = randomString1(10);
|
||||
echo "<tr>
|
||||
<td align='center'>$num</td>
|
||||
<td >$row->network</td>
|
||||
<td>$row->country</td>";
|
||||
?>
|
||||
<?php
|
||||
if ($row->has_nano_health) {
|
||||
?>
|
||||
<td>
|
||||
<button type="button" data-toggle="modal" data-target="#disableWallet"
|
||||
data-network-id="<?php echo $row->id ?>"
|
||||
class="btn btn-danger openModal"><?php echo $this->lang->line('Désactiver'); ?></button>
|
||||
</td>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<td>
|
||||
<button type="button" data-network-id="<?php echo $row->id ?>"
|
||||
class="btn btn-primary activateNanoCredit"><?php echo $this->lang->line('Activer'); ?></button>
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<td>
|
||||
<a href="<?php echo current_url() ?>"
|
||||
class="btn btn-primary btn-block" <?php /*if (!$row->has_nano_health)*/ echo "disabled" ?> >
|
||||
<b><?php echo $this->lang->line('Voir plus...'); ?></b>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
|
||||
} else {
|
||||
echo $this->lang->line('Aucun réseau');
|
||||
}
|
||||
} else {
|
||||
echo $this->lang->line('Aucun réseau');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="disableWallet" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title"><?php echo $this->lang->line('nano_health_removal'); ?></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h4> Etes vous certain de vouloir ?</h4>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary"
|
||||
data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
|
||||
<button type="button" class="btn btn-primary"
|
||||
id="deleteWallet"> <?php echo $this->lang->line('Valider'); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="alert alert-info alert-dismissible" aria-hidden="true">-->
|
||||
<!-- <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>-->
|
||||
<!-- <h4><i class="icon fa fa-info"></i>Info!</h4>-->
|
||||
<!-- Data is Saved-->
|
||||
<!-- </div>-->
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- jQuery 3 -->
|
||||
<script src="<?php echo base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
|
||||
<!-- Bootstrap 3.3.7 -->
|
||||
<script src="<?php echo base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
|
||||
<!-- DataTables -->
|
||||
<script src="<?php echo base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
|
||||
<script src="<?php echo base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?>"></script>
|
||||
<!-- Slimscroll -->
|
||||
<script src="<?php echo base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
|
||||
<!-- FastClick -->
|
||||
<script src="<?php echo base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
|
||||
<!-- AdminLTE App -->
|
||||
<script src="<?php echo base_url('dist/js/adminlte.min.js') ?>"></script>
|
||||
<!-- AdminLTE for demo purposes -->
|
||||
<script src="<?php echo base_url('dist/js/demo.js') ?>"></script>
|
||||
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/js/bootstrap-multiselect.js"></script>
|
||||
<script src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('#validated').DataTable();
|
||||
})
|
||||
</script>
|
||||
|
||||
<script>
|
||||
toastr.options.closeButton = true;
|
||||
toastr.options.closeMethod = 'fadeOut';
|
||||
toastr.options.closeDuration = 5000;
|
||||
toastr.options.closeEasing = 'swing';
|
||||
|
||||
var network_id = null;
|
||||
|
||||
$(document).on("click", ".openModal", function () {
|
||||
network_id = $(this).data('network-id');
|
||||
})
|
||||
|
||||
|
||||
$('.activateNanoCredit').click(function () {
|
||||
const id_network = $(this).data('network-id');
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('index.php/Gestion/activate_nano_health')?>',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {"id_network": id_network},
|
||||
success: function (data, statut) {
|
||||
if (data == '200') {
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?php echo $this->lang->line('activate_nano_health')?>",
|
||||
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')?>");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#deleteWallet').click(function () {
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('index.php/Gestion/deactivate_nano_health')?>',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {"id_network": network_id},
|
||||
success: function (data, statut) {
|
||||
if (data == '200') {
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?php echo $this->lang->line('nano_health_deleted')?>",
|
||||
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