backoffice/application/views/wallet_password.php

219 lines
7.8 KiB
PHP
Raw Normal View History

2020-05-04 13:18:44 +00:00
<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('header_wallet_password'); ?>
<input type="button" class="btn btn-primary pull-right" id="Bactiver" value="Activer/Désactiver le(s) réseau(x)" style="display: none;" />
</h1>
<?php
$site_url = base_url();
if($alert=="ok") {
if(!$success=="ok"){
?>
<div class='alert alert-danger alert-dismissible col-xs-6'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<h4><i class='icon fa fa-ban'></i> Erreur!</h4>
<?php echo $message; ?>
</div>
<?php
} else {
?>
<div class="alert alert-success alert-dismissible col-xs-6">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h4><i class="icon fa fa-check"></i> Success!</h4>
<?php echo $message; ?>
</div>
<?php
}
}
?>
</section>
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php echo $this->lang->line('activated_wallets'); ?></h3>
</div>
<div class="box-body">
<?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'></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('mot de passe'); ?> </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->wallet_password){
?>
<td><span class="label label-success"><?php echo $this->lang->line('generated'); ?></span></td>
<td><button type="button" data-toggle="modal" data-target="#generatePassword" data-country="<?php echo $row->country ?>" data-network="<?php echo $row->network ?>" data-wallet_password_id="<?php echo $row->wallet_password ?>" class="btn btn-warning btn-block openModal"><?php echo $this->lang->line('reset'); ?></button></td>
<?php
}else{
?>
<td><span class="label label-danger"><?php echo $this->lang->line('not_generated'); ?></span></td>
<td><button type="button" data-toggle="modal" data-target="#generatePassword" data-country="<?php echo $row->country ?>" data-network="<?php echo $row->network ?>" data-network-id="<?php echo $row->id ?>" class="btn btn-primary btn-block openModal"><?php echo $this->lang->line('generate'); ?></button></td>
<?php
}
?>
<?php
}
?>
</tbody>
</table>
<?php
}
else {
echo $this->lang->line('no_wallet');
}
}else {
echo $this->lang->line('no_wallet');
}
?>
</div>
</div>
</div>
</div>
<div class="modal fade" id="generatePassword" 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('generate_password'); ?></h3>
</div>
<div class="modal-body">
<form id="walletPasswordForm">
<div class="form-group">
<label for="email" class="col-form-label"><?php echo $this->lang->line('email') ?></label>
<input type="email" min="0" required class="form-control" id="email" name="email" >
</div>
<!-- <div class="form-group">-->
<!-- <label for="size" class="col-form-label">Nombre de caracteres</label>-->
<!-- <input type="number" min="1" required class="form-control" name="size" id="size">-->
<!-- </div>-->
</form>
</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="addWalletPassword" > <?php echo $this->lang->line('generate'); ?></button>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- jQuery 3 -->
<script src="<?php echo base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
<!-- Bootstrap 3.3.7 -->
<script src="<?php echo base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
<!-- DataTables -->
<script src="<?php echo base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
<script src="<?php echo base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?>"></script>
<!-- Slimscroll -->
<script src="<?php echo base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
<!-- FastClick -->
<script src="<?php echo base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
<!-- AdminLTE App -->
<script src="<?php echo base_url('dist/js/adminlte.min.js') ?>"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?php echo base_url('dist/js/demo.js') ?>"></script>
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
<script src="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;
var wallet_password_id = null;
var network = null;
var country = null;
$(document).on("click", ".openModal", function () {
network_id = $(this).data('network-id');
wallet_password_id = $(this).data('wallet_password_id');
network = $(this).data('network');
country = $(this).data('country');
});
$('#addWalletPassword').click(function(){
if($('#walletPasswordForm')[0].checkValidity()) {
const email = $('#email').val();
// const size = parseInt($('#size').val());
$.ajax({
url : '<?php echo base_url('index.php/Gestion/generate_wallet_password')?>',
type : 'POST',
dataType : 'json',
data: {"network_id": network_id ,"email": email, "wallet_password_id" : wallet_password_id , "network" : network , "country" : country },
success : function(data){
if(data=='200'){
Swal.fire({
icon: 'success',
title: '<?php echo $this->lang->line('password_generated')?>',
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 );
}
});
}else {
$('#walletPasswordForm')[0].reportValidity();
}
});
</script>