backoffice/application/views/historique_remboursement.php

235 lines
8.0 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- DataTables -->
<link rel="stylesheet"
href="<?= 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"/>
<div class="content-wrapper">
<?php
use Brick\Money\Context\AutoContext;
use Brick\Money\CurrencyConverter;
use Brick\Money\ExchangeRateProvider\BaseCurrencyProvider;
use Brick\Money\ExchangeRateProvider\PDOProvider;
use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration;
use Brick\Money\Money;
// 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();
?>
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?= isset($category) ? $this->lang->line('refund_history') : $this->lang->line('Gestion des wallets');
echo ' ' . $network . ' - ' . $country; ?>
<!-- <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>
<?= $message; ?>
</div>
<?php
} else {
?>
<div class="alert alert-success alert-dismissible col-xs-6">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h4><i class="icon fa fa-check"></i> Success!</h4>
<?= $message; ?>
</div>
<?php
}
}
?>
</section>
<section class="content">
<div class="row">
<div class="col-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"><?= $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="<?= isset($category) ? $category : null ?>"
type="text" name="daterange"
data-lang="<?= $this->session->userdata('site_lang') ?>"
value="<?= ($startDate != null & $endDate != null) ? $startDate . ' - ' . $endDate : '' ?>"/>
</span>
<span> Format : <?= $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"><?= $this->lang->line('refund_history'); ?></h3>
</div>
<div class="box-body" style="overflow-x:auto;">
<?php
if ($refunds){
$numrows = $refunds->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'>N°</th>
<th><?= $this->lang->line('Montant') ?></th>
<th><?= $this->lang->line('remaining_amount') ?></th>
<th><?= $this->lang->line('Reseau') ?></th>
<th><?= $this->lang->line('Pays') ?></th>
<th align='center'>Date</th>
</tr>
</thead>
<tbody>
<?php
foreach ($refunds->result() as $row) {
$num++;
echo "<tr>
<td align='center' >$num</td>
<td>" . Money::of(round($row->montant, 2), $row->currency_code, $context)->formatTo('fr_FR') . "</td>
<td>" . Money::of(round($row->montant_restant, 2), $row->currency_code, $context)->formatTo('fr_FR') . "</td>
<td>" . $row->network . "</td>
<td>" . $row->country . "</td>
<td>" . $row->date . "</td>
</tr>";
}
?>
</tbody>
<?php
} else {
echo $this->lang->line('no_refund');
}
} else {
echo $this->lang->line('no_refund');
}
?>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- jQuery 3 -->
<script src="<?= base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
<!-- Bootstrap 3.3.7 -->
<script src="<?= base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
<!-- DataTables -->
<script src="<?= base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
<script src="<?= base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?>"></script>
<!-- SlimScroll -->
<script src="<?= base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
<!-- FastClick -->
<script src="<?= base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
<!-- AdminLTE App -->
<script src="<?= base_url('dist/js/adminlte.min.js') ?>"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?= base_url('dist/js/demo.js') ?>"></script>
<script 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>
$(function () {
const lang = $('#picker').data('lang');
const format = lang === 'french' ? 'fr' : 'en';
moment.updateLocale(moment.locale(format), {invalidDate: ""}); // Blank text when is invalid date
$('#transactions').DataTable({
"aaSorting": [[5, "desc"]],
"columnDefs": [{
targets: 5,
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
}]
});
});
</script>
<script type="text/javascript">
var startDate;
var endDate;
$(function () {
const lang = $('#picker').data('lang');
const category = $('#picker').data('category');
const id_network = "<?= $id_network?>";
$('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 = "<?= current_url()?>" + "?history=refund_history" + "&d=" + debut + "&f=" + fin;
else
window.location = "<?= current_url()?>" + "?id="+id_network+"&history=refund_history" + "&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 = "<?= current_url()?>" + "?history=refund_history";
else
window.location = "<?= current_url()?>" + "?id="+id_network+"&history=refund_history";
});
});
</script>