Viewing file: rent_numbers.php (2.36 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?= $this->extend(currentTheme() . '/layout'); ?>
<?= $this->section('content'); ?>
<div class="row justify-content-center">
<div class="col-8">
<div class="card">
<div class="card-body">
<table class="table datatable">
<thead>
<tr>
<th class="text-center">#</th>
<th>Numara</th>
<th>Servis</th>
<th>Mesajlar</th>
<th class="text-right">Kalan Süre</th>
<th class="text-right">İşlem</th>
</tr>
</thead>
<tbody>
<?php foreach ($numbers as $number) : ?>
<tr>
<td class="text-center"><?= $number['id']; ?></td>
<td><?= $number['phone']; ?></td>
<td><?= $number['service']; ?></td>
<td><button class="btn btn-dark" onclick="readMessages(<?= $number['id']; ?>);">Mesajları Göster</button></td>
<td class="text-right"><?= $number['status'] == '0' ? date('h:i:s', strtotime($number['end_date'])) : 'Aktif Değil'; ?></td>
<td class="td-actions text-right">
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?= $this->endSection('content'); ?>
<?= $this->section('js'); ?>
<script>
function readMessages(id) {
Swal.showLoading();
$.get('<?= base_url('api/readRentMessages'); ?>/' + id, function(response) {
Swal.fire({
title: 'Mesajlar',
html: `<ul class="list-group" style="color:black;">${Array.isArray(response) ? response.map(res => `<li class="list-group-item" style="color:black;"><h5>${res.phoneFrom}</h5><p style="color:black;">${res.text}</p></li>`) : '<li class="list-group-item" style="color:black;">Mesaj bulunamadı.</li>'}</ul>`
});
});
}
setInterval(() => window.location.reload(), 8000);
</script>
<?= $this->endSection('js'); ?>
|