copy dari repo om Irfan
This commit is contained in:
@@ -0,0 +1,141 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
/** @var \App\Models\Product $product */
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Mapping Produk Marketplace</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
padding: 20px;
|
||||
background: #f9fafb;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: white;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
max-width: 800px;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-top: 12px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input,
|
||||
select {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
margin-top: 6px;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
width: auto;
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: inline-block;
|
||||
padding: 9px 14px;
|
||||
border-radius: 6px;
|
||||
text-decoration: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: #2563eb;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background: #e5e7eb;
|
||||
color: #111827;
|
||||
}
|
||||
|
||||
.info {
|
||||
background: #f3f4f6;
|
||||
padding: 12px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h2>Mapping Produk Marketplace</h2>
|
||||
|
||||
<div class="card">
|
||||
|
||||
<div class="info">
|
||||
|
||||
<strong>Produk Marketplace:</strong><br>
|
||||
Marketplace: <?= html_escape($product->marketplace) ?><br>
|
||||
SKU: <?= html_escape($product->sku) ?><br>
|
||||
Nama Produk: <?= html_escape($product->product_name) ?><br>
|
||||
Variant: <?= html_escape($product->variant_name) ?><br>
|
||||
Stock MP: <?= html_escape($product->stock) ?>
|
||||
</div>
|
||||
|
||||
<form method="post" action="<?= site_url('marketplace/save_mapping') ?>">
|
||||
<input type="hidden" name="marketplace_product_id" value="<?= html_escape($product->id) ?>">
|
||||
|
||||
<label>Barang Lokal</label>
|
||||
<select name="kode_barang" required>
|
||||
<option value="">-- Pilih Barang Lokal --</option>
|
||||
|
||||
<?php foreach ((array)($barang ?? []) as $b): ?>
|
||||
<option value="<?= html_escape($b->KODE_BARANG) ?>"
|
||||
<?= !empty($mapping) && $mapping->kode_barang == $b->KODE_BARANG ? 'selected' : '' ?>>
|
||||
<?= html_escape($b->KODE_BARANG) ?> - <?= html_escape($b->NAMA_BARANG) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
<label>Qty Multiplier</label>
|
||||
<input
|
||||
type="number"
|
||||
step="0.01"
|
||||
name="qty_multiplier"
|
||||
value="<?= !empty($mapping) ? html_escape($mapping->qty_multiplier) : '1.00' ?>"
|
||||
required>
|
||||
|
||||
<label>
|
||||
<input
|
||||
class="checkbox"
|
||||
type="checkbox"
|
||||
name="sync_stock"
|
||||
value="1"
|
||||
<?= empty($mapping) || !empty($mapping->sync_stock) ? 'checked' : '' ?>>
|
||||
Sinkron stok
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input
|
||||
class="checkbox"
|
||||
type="checkbox"
|
||||
name="sync_price"
|
||||
value="1"
|
||||
<?= !empty($mapping) && !empty($mapping->sync_price) ? 'checked' : '' ?>>
|
||||
Sinkron harga
|
||||
</label>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Simpan Mapping</button>
|
||||
<a href="<?= site_url('marketplace/products') ?>" class="btn btn-secondary">Kembali</a>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,158 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Marketplace Products</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
padding: 20px;
|
||||
background: #f9fafb;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.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-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;
|
||||
}
|
||||
|
||||
.mapped {
|
||||
background: #dcfce7;
|
||||
color: #166534;
|
||||
}
|
||||
|
||||
.unmapped {
|
||||
background: #fee2e2;
|
||||
color: #991b1b;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<h2>Marketplace Products</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/sync_products/1') ?>">
|
||||
Sync Produk Dummy
|
||||
</a>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Marketplace</th>
|
||||
<th>SKU</th>
|
||||
<th>Nama Produk</th>
|
||||
<th>Variant</th>
|
||||
<th>Stock MP</th>
|
||||
<th>Harga</th>
|
||||
<th>Kode Barang</th>
|
||||
<th>Status Mapping</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $products = $products ?? []; ?>
|
||||
<?php if (empty($products)): ?>
|
||||
<tr>
|
||||
<td colspan="10">Belum ada produk marketplace.</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($products as $row): ?>
|
||||
<tr>
|
||||
<td><?= html_escape($row->id) ?></td>
|
||||
<td><?= html_escape($row->marketplace) ?></td>
|
||||
<td><?= html_escape($row->sku) ?></td>
|
||||
<td><?= html_escape($row->product_name) ?></td>
|
||||
<td><?= html_escape($row->variant_name) ?></td>
|
||||
<td><?= html_escape($row->stock) ?></td>
|
||||
<td><?= number_format((float) $row->price, 0, ',', '.') ?></td>
|
||||
<td><?= html_escape($row->kode_barang ?? '-') ?></td>
|
||||
<td>
|
||||
<?php if (!empty($row->kode_barang)): ?>
|
||||
<span class="badge mapped">Mapped</span>
|
||||
<?php else: ?>
|
||||
<span class="badge unmapped">Belum Mapping</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn" href="<?= site_url('marketplace/mapping/' . $row->id) ?>">
|
||||
Mapping
|
||||
</a>
|
||||
<?php if (!empty($row->kode_barang)): ?>
|
||||
<a class="btn" href="<?= site_url('marketplace/create_stock_queue/' . $row->id) ?>">
|
||||
Buat Queue Stok
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,116 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Stock Sync Logs</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
padding: 20px;
|
||||
background: #f9fafb;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: inline-block;
|
||||
padding: 8px 12px;
|
||||
background: #2563eb;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
background: white;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
border: 1px solid #e5e7eb;
|
||||
padding: 8px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
th {
|
||||
background: #f3f4f6;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.success {
|
||||
color: #166534;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.failed {
|
||||
color: #991b1b;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
max-width: 360px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h2>Stock Sync Logs</h2>
|
||||
|
||||
<a class="btn" href="<?= site_url('marketplace/stock_queues') ?>">Kembali ke Queue</a>
|
||||
<a class="btn" href="<?= site_url('marketplace/products') ?>">Produk Marketplace</a>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Marketplace</th>
|
||||
<th>Kode Barang</th>
|
||||
<th>SKU</th>
|
||||
<th>Nama Produk</th>
|
||||
<th>Stock MP Lama</th>
|
||||
<th>Stock MP Baru</th>
|
||||
<th>Status</th>
|
||||
<th>Error</th>
|
||||
<th>Waktu</th>
|
||||
<th>Response</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $logs = $logs ?? []; ?>
|
||||
<?php if (empty($logs)): ?>
|
||||
<tr>
|
||||
<td colspan="11">Belum ada log.</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($logs as $row): ?>
|
||||
<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->old_marketplace_stock) ?></td>
|
||||
<td><?= html_escape($row->new_marketplace_stock) ?></td>
|
||||
<td>
|
||||
<span class="<?= $row->status == 'success' ? 'success' : 'failed' ?>">
|
||||
<?= html_escape($row->status) ?>
|
||||
</span>
|
||||
</td>
|
||||
<td><?= html_escape($row->error_message) ?></td>
|
||||
<td><?= html_escape($row->created_at) ?></td>
|
||||
<td>
|
||||
<pre><?= html_escape($row->response_payload) ?></pre>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
/** @var \App\Models\Product $product */
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Buat Queue Sinkron Stok</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
padding: 20px;
|
||||
background: #f9fafb;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: white;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
max-width: 700px;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-top: 12px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
margin-top: 6px;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: inline-block;
|
||||
padding: 9px 14px;
|
||||
border-radius: 6px;
|
||||
text-decoration: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: #2563eb;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background: #e5e7eb;
|
||||
color: #111827;
|
||||
}
|
||||
|
||||
.info {
|
||||
background: #f3f4f6;
|
||||
padding: 12px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h2>Buat Queue Sinkron Stok</h2>
|
||||
|
||||
<div class="card">
|
||||
<div class="info">
|
||||
<strong>Produk Marketplace</strong><br>
|
||||
Marketplace: <?= html_escape($product->marketplace) ?><br>
|
||||
SKU: <?= html_escape($product->sku) ?><br>
|
||||
Nama Produk: <?= html_escape($product->product_name) ?><br>
|
||||
Stok Marketplace Saat Ini: <?= html_escape($product->stock) ?><br>
|
||||
<br>
|
||||
|
||||
<strong>Mapping Lokal</strong><br>
|
||||
Kode Barang: <?= html_escape($product->kode_barang) ?><br>
|
||||
Nama Barang:
|
||||
<?= !empty($barang) ? html_escape($barang->NAMA_BARANG) : '-' ?><br>
|
||||
Qty Multiplier: <?= html_escape($product->qty_multiplier) ?>
|
||||
</div>
|
||||
|
||||
<form method="post" action="<?= site_url('marketplace/save_stock_queue') ?>">
|
||||
<input type="hidden" name="marketplace_product_id" value="<?= html_escape($product->id) ?>">
|
||||
|
||||
<div class="info">
|
||||
<strong>Stok Otomatis dari Database Lokal</strong><br>
|
||||
Stok Lokal: <?= html_escape($local_stock ?? 0) ?><br>
|
||||
Qty Multiplier: <?= html_escape($product->qty_multiplier) ?><br>
|
||||
Target Stok Marketplace: <?= html_escape($marketplace_stock_target ?? 0) ?><br>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Buat Queue dari Stok Lokal</button>
|
||||
<a href="<?= site_url('marketplace/products') ?>" class="btn btn-secondary">Kembali</a>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,165 @@
|
||||
<!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>
|
||||
Reference in New Issue
Block a user