warehouse layers [switchable]
This commit is contained in:
@@ -134,7 +134,7 @@
|
||||
<th>Type</th>
|
||||
<th>SKU</th>
|
||||
<th>Lot</th>
|
||||
<th>Location</th>
|
||||
<th id="th_location">Location</th>
|
||||
<th>Contact</th>
|
||||
<th class="text-end">Stock In</th>
|
||||
<th class="text-end">Stock Out</th>
|
||||
@@ -170,15 +170,54 @@
|
||||
<script>
|
||||
// ── State ─────────────────────────────────────────────────────────────
|
||||
var sku_queue = []; // ordered list of SKUs returned by summary call
|
||||
var sku_index = 0; // next SKU to load
|
||||
var is_loading = false;
|
||||
var search_params = {}; // warehouse_id, from_month, to_month — fixed per search
|
||||
|
||||
var type_badge = {
|
||||
var sku_index = 0; // next SKU to load
|
||||
var is_loading = false;
|
||||
var search_params = {}; // warehouse_id, from_month, to_month — fixed per search
|
||||
var advanced = false;
|
||||
var label_rack = 'Location';
|
||||
var label_zone = 'Zone';
|
||||
var label_aisle = 'Aisle';
|
||||
|
||||
var type_badge = {
|
||||
'in': '<span class="badge bg-success">In</span>',
|
||||
'out': '<span class="badge bg-danger">Out</span>',
|
||||
'transfer': '<span class="badge bg-info text-dark">Transfer</span>',
|
||||
};
|
||||
};
|
||||
|
||||
function apply_location_labels() {
|
||||
$('#th_location').text(advanced
|
||||
? label_zone + ' / ' + label_aisle + ' / ' + label_rack
|
||||
: label_rack
|
||||
);
|
||||
}
|
||||
|
||||
function format_location(row) {
|
||||
if (advanced) {
|
||||
return [row.zone, row.aisle, row.rack].filter(Boolean).join('-');
|
||||
}
|
||||
return row.rack || '';
|
||||
}
|
||||
|
||||
function display_location(row) {
|
||||
return format_location(row) || '<span class="text-muted">—</span>';
|
||||
}
|
||||
|
||||
function load_company_setting() {
|
||||
return ajax_request({
|
||||
url: server_url + 'setting/api/engine/company_setting.php',
|
||||
autoPrepare: true,
|
||||
checkRequired: 0,
|
||||
action: 'read',
|
||||
onSuccess: function(res) {
|
||||
var s = res.output || {};
|
||||
advanced = s.advanced_location == 1;
|
||||
label_rack = s.location_label_rack || (advanced ? 'Rack' : 'Location');
|
||||
label_zone = s.location_label_zone || 'Zone';
|
||||
label_aisle = s.location_label_aisle || 'Aisle';
|
||||
apply_location_labels();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ── Default months ────────────────────────────────────────────────────
|
||||
(function() {
|
||||
@@ -339,7 +378,7 @@
|
||||
date: row.date,
|
||||
type: row.type,
|
||||
lot: row.lot_number || '',
|
||||
location: row.zone + '-' + row.aisle + '-' + row.rack,
|
||||
location: format_location(row),
|
||||
contact: row.contact_name || '',
|
||||
stock_in: row.stock_in > 0 ? row.stock_in : '',
|
||||
stock_out: row.stock_out > 0 ? row.stock_out : '',
|
||||
@@ -382,7 +421,7 @@
|
||||
<td class="py-2">${type_badge[row.type] || row.type}</td>
|
||||
<td class="py-2"><code>${row.product_sku}</code></td>
|
||||
<td class="py-2">${row.lot_number || '<span class="text-muted">—</span>'}</td>
|
||||
<td class="py-2">${row.zone}-${row.aisle}-${row.rack}</td>
|
||||
<td class="py-2">${display_location(row)}</td>
|
||||
<td class="py-2">${row.contact_name || '<span class="text-muted">—</span>'}</td>
|
||||
<td class="py-2 text-end text-success">${in_val}</td>
|
||||
<td class="py-2 text-end text-danger">${out_val}</td>
|
||||
@@ -473,9 +512,12 @@
|
||||
|
||||
|
||||
|
||||
$(async function() {
|
||||
try { await retrieve_warehouse(); } catch(e) { console.log(e); }
|
||||
});
|
||||
$(async function() {
|
||||
try {
|
||||
await load_company_setting();
|
||||
await retrieve_warehouse();
|
||||
} catch(e) { console.log(e); }
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- SheetJS — required by AlaSQL for Excel (.xlsx) export -->
|
||||
@@ -486,4 +528,4 @@
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.8.2/jspdf.plugin.autotable.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user