354 lines
11 KiB
PHP
Executable File
354 lines
11 KiB
PHP
Executable File
<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/toastr/toastr.css') ?>">
|
||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round|Open+Sans">
|
||
<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">
|
||
<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>
|
||
<div class="content-wrapper">
|
||
<!-- Content Header (Page header) -->
|
||
<section class="content-header">
|
||
|
||
<h1>
|
||
<?php echo $this->lang->line('currency_management'). ' '. $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 centered">
|
||
<div class="col-lg-2 col-xs-6">
|
||
<div class="small-box bg-red-active">
|
||
<div class="inner">
|
||
<h4><strong> <?php echo $currency_code.' - '.$currency_name_fr; ?> </strong></h4>
|
||
<p><?php echo $this->lang->line('currency') ?></p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="table-wrapper">
|
||
<div class="table-title">
|
||
<div class="row">
|
||
<div class="col-sm-8">
|
||
<label for="nom"
|
||
class="col-form-label"><?php echo $this->lang->line('conversion_rate') ; ?></label>
|
||
</div>
|
||
<div class="col-sm-4">
|
||
<button type="button" class="btn btn-info add-new new1"><i class="fa fa-plus"></i> <?php echo $this->lang->line('new_rate') ; ?></button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<table id="taux_conversion" class="table table-bordered">
|
||
<thead>
|
||
<tr>
|
||
<th><?php echo $this->lang->line('currency') ; ?> </th>
|
||
<th><?php echo $this->lang->line('rate') ; ?> (%) </th>
|
||
<th>Actions</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<!-- --><?php
|
||
// if($plr_user_wallet_wallet!=false){
|
||
// foreach($plr_user_wallet_wallet->result() as $row) {
|
||
// echo "<tr>
|
||
// <td>".$row->min."</td>
|
||
// <td>".$row->max."</td>
|
||
// <td>".$row->taux."</td>".'
|
||
// <td>
|
||
// <a class="add add1" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||
// <a class="edit edit1" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||
// <a class="delete delete1" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||
// </td>
|
||
// </tr>';
|
||
// }
|
||
// }
|
||
// ?>
|
||
</tbody>
|
||
</table>
|
||
<button type="button" id="save" class="btn btn-primary btn-block" >
|
||
<b><?php echo $this->lang->line('save'); ?></b>
|
||
</button>
|
||
</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>
|
||
<!-- 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('dist/js/sweetalert2.js') ?>"></script>
|
||
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
|
||
|
||
|
||
<script>
|
||
toastr.options.closeButton = true;
|
||
toastr.options.closeMethod = 'fadeOut';
|
||
toastr.options.closeDuration = 5000;
|
||
toastr.options.closeEasing = 'swing';
|
||
|
||
$('#save').click(function () {
|
||
// const network_id = $(this).data('network-id');
|
||
// const id_config = $(this).data('id-config');
|
||
|
||
var taux_conversion = [];
|
||
|
||
$('#taux_conversion tr').has('td').each(function() {
|
||
var arrayItem = {};
|
||
$('td', $(this)).each(function(index, item) {
|
||
if(index < 3)
|
||
arrayItem[index] = $(item).html();
|
||
});
|
||
taux_conversion.push(arrayItem);
|
||
});
|
||
|
||
console.log(taux_conversion)
|
||
|
||
//$.ajax({
|
||
// url: '<?php //echo base_url('index.php/Gestion/taux_converison')?>//',
|
||
// type: 'POST',
|
||
// dataType: 'json',
|
||
// data: {
|
||
// "type" : "ilink",
|
||
// "network_id": network_id,"id_config" : id_config,
|
||
// "taux_conversion" :taux_conversion
|
||
// },
|
||
// success: function (data) {
|
||
// if(data=='200'){
|
||
// Swal.fire({
|
||
// icon: 'success',
|
||
// title: "<?php //echo $this->lang->line('wallet_update')?>//",
|
||
// text:"<?php //echo $this->lang->line('informations_updated')?>//",
|
||
// timer: 3000
|
||
// }).then(()=>{
|
||
// location.reload();
|
||
// });
|
||
// // alert("Les informations ont été mises à jour.") ? "" :
|
||
// }else{
|
||
// toastr.error("<?php //echo $this->lang->line('error_message')?>//" , "<?php //echo $this->lang->line('request_error')?>//");
|
||
// }
|
||
// },
|
||
//
|
||
// error: function (resultat, statut, error) {
|
||
// console.log(resultat + " " + error);
|
||
// toastr.error("<?php //echo $this->lang->line('error_message')?>//" , "<?php //echo $this->lang->line('request_error')?>//");
|
||
// }
|
||
//});
|
||
|
||
|
||
});
|
||
</script>
|
||
|
||
<script>
|
||
// Paliers scripts
|
||
$(document).ready(function() {
|
||
$('[data-toggle="tooltip"]').tooltip();
|
||
var actions1 = $("#taux_conversion td:last-child").html();
|
||
// Append table with add row form on add new button click
|
||
$(".new1").click(function(){
|
||
if(!actions1){
|
||
actions1 = '<a class="add add1" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
||
' <a class="edit edit1" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
||
' <a class="delete delete1" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>';
|
||
}
|
||
$(this).attr("disabled", "disabled");
|
||
var index = $("#taux_conversion tbody tr:last-child").index();
|
||
var row = "<tr> <td>"+
|
||
<?php
|
||
$result=$currencies;
|
||
|
||
$numrows=$result->num_rows();
|
||
if ($numrows > 0) {
|
||
echo '"<select class='.'form-control input-lg'.' id='.'currency'.' required>';
|
||
foreach($result->result() as $row) {
|
||
echo "<option value=".$row->code.">".$row->code.' - '.$row->name_fr."</option>";
|
||
}
|
||
echo '</select>"';
|
||
}
|
||
?>
|
||
+"</td>" +
|
||
"<td><input type='number' required class='form-control' min='0' name='taux' id='taux'></td>" +
|
||
"<td>" + actions1 + "</td>" +
|
||
"</tr>";
|
||
$("#taux_conversion").append(row);
|
||
$("#taux_conversion tbody tr").eq(index + 1).find(".add, .edit").toggle();
|
||
$('[data-toggle="tooltip"]').tooltip();
|
||
});
|
||
// Add row on add button click
|
||
$(document).on("click", ".add1", function(){
|
||
var empty = false;
|
||
var input = $(this).parents("tr").find('input[type="number"]');
|
||
var select = $(this).parents("tr").find('select[id="currency"]');
|
||
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();
|
||
$(".new1").removeAttr("disabled");
|
||
}
|
||
});
|
||
// Edit row on edit button click
|
||
$(document).on("click", ".edit1", function(){
|
||
$(this).parents("tr").find("td:not(:last-child)").each(function(index){
|
||
if(index == 0)
|
||
$(this).html("<?php
|
||
$result=$currencies;
|
||
$numrows=$result->num_rows();
|
||
if ($numrows > 0) {
|
||
echo "<select class='form-control' id='currency' value='".'EUR'."' required>";
|
||
foreach($result->result() as $row) {
|
||
echo "<option value=".$row->code.">".$row->code.' - '.$row->name_fr."</option>";
|
||
}
|
||
echo '</select>';
|
||
}
|
||
?>");
|
||
if(index == 1)
|
||
$(this).html('<input type="number" required class="form-control" min="0" value="' + $(this).text() + '">');
|
||
});
|
||
$(this).parents("tr").find(".add, .edit").toggle();
|
||
$(".new1").attr("disabled", "disabled");
|
||
});
|
||
// Delete row on delete button click
|
||
$(document).on("click", ".delete1", function(){
|
||
$(this).parents("tr").remove();
|
||
$(".new1").removeAttr("disabled");
|
||
});
|
||
});
|
||
</script>
|
||
|
||
<!-- Page script -->
|
||
<script src="<?php echo base_url('dist/js/custom.js') ?>"></script>
|