165 lines
4.5 KiB
PHP
165 lines
4.5 KiB
PHP
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<title>Stock Sync Queues</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
padding: 20px;
|
|
background: #f9fafb;
|
|
}
|
|
|
|
.alert {
|
|
padding: 10px 14px;
|
|
margin-bottom: 12px;
|
|
border-radius: 6px;
|
|
}
|
|
|
|
.success {
|
|
background: #dcfce7;
|
|
color: #166534;
|
|
}
|
|
|
|
.error {
|
|
background: #fee2e2;
|
|
color: #991b1b;
|
|
}
|
|
|
|
.btn {
|
|
display: inline-block;
|
|
padding: 8px 12px;
|
|
background: #2563eb;
|
|
color: white;
|
|
text-decoration: none;
|
|
border-radius: 6px;
|
|
margin-right: 6px;
|
|
margin-bottom: 14px;
|
|
}
|
|
|
|
table {
|
|
border-collapse: collapse;
|
|
width: 100%;
|
|
background: white;
|
|
font-size: 14px;
|
|
}
|
|
|
|
th,
|
|
td {
|
|
border: 1px solid #e5e7eb;
|
|
padding: 8px;
|
|
}
|
|
|
|
th {
|
|
background: #f3f4f6;
|
|
text-align: left;
|
|
}
|
|
|
|
.badge {
|
|
padding: 3px 8px;
|
|
border-radius: 4px;
|
|
font-size: 12px;
|
|
}
|
|
|
|
.pending {
|
|
background: #fef3c7;
|
|
color: #92400e;
|
|
}
|
|
|
|
.processing {
|
|
background: #dbeafe;
|
|
color: #1e40af;
|
|
}
|
|
|
|
.success-badge {
|
|
background: #dcfce7;
|
|
color: #166534;
|
|
}
|
|
|
|
.failed {
|
|
background: #fee2e2;
|
|
color: #991b1b;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h2>Stock Sync Queues</h2>
|
|
|
|
<?php if ($this->session->flashdata('success')): ?>
|
|
<div class="alert success">
|
|
<?= html_escape($this->session->flashdata('success')) ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($this->session->flashdata('error')): ?>
|
|
<div class="alert error">
|
|
<?= html_escape($this->session->flashdata('error')) ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<a class="btn" href="<?= site_url('marketplace/products') ?>">Kembali ke Produk</a>
|
|
<a class="btn" href="<?= site_url('marketplace/process_stock_queue') ?>">Proses Queue via Laravel</a>
|
|
<a class="btn" href="<?= site_url('marketplace/stock_logs') ?>">Lihat Log</a>
|
|
<a class="btn" href="<?= site_url('marketplace/retry_failed_queue') ?>">
|
|
Retry Queue Failed
|
|
</a>
|
|
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Marketplace</th>
|
|
<th>Kode Barang</th>
|
|
<th>SKU</th>
|
|
<th>Nama Produk</th>
|
|
<th>Local Stock</th>
|
|
<th>Stock MP Before</th>
|
|
<th>Target MP</th>
|
|
<th>Status</th>
|
|
<th>Retry</th>
|
|
<th>Processed At</th>
|
|
<th>Error</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php $queues = $queues ?? []; ?>
|
|
<?php if (empty($queues)): ?>
|
|
<tr>
|
|
<td colspan="12">Belum ada queue.</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
|
|
<?php foreach ($queues as $row): ?>
|
|
<?php
|
|
$class = 'pending';
|
|
if ($row->status == 'processing') $class = 'processing';
|
|
if ($row->status == 'success') $class = 'success-badge';
|
|
if ($row->status == 'failed') $class = 'failed';
|
|
?>
|
|
<tr>
|
|
<td><?= html_escape($row->id) ?></td>
|
|
<td><?= html_escape($row->marketplace) ?></td>
|
|
<td><?= html_escape($row->kode_barang) ?></td>
|
|
<td><?= html_escape($row->sku) ?></td>
|
|
<td><?= html_escape($row->product_name) ?></td>
|
|
<td><?= html_escape($row->local_stock) ?></td>
|
|
<td><?= html_escape($row->marketplace_stock_before) ?></td>
|
|
<td><?= html_escape($row->marketplace_stock_target) ?></td>
|
|
<td>
|
|
<span class="badge <?= $class ?>">
|
|
<?= html_escape($row->status) ?>
|
|
</span>
|
|
</td>
|
|
<td><?= html_escape($row->retry_count) ?> / <?= html_escape($row->max_retry) ?></td>
|
|
<td><?= html_escape($row->processed_at) ?></td>
|
|
<td><?= html_escape($row->error_message) ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
|
|
</body>
|
|
|
|
</html>
|