accounting workflows
This commit is contained in:
+18
-24
@@ -134,6 +134,7 @@
|
||||
<?php require "../include_ending.php";?>
|
||||
|
||||
<script>
|
||||
// custom.js globals: set_select_value(), load_location_config(), init_lot_search_inputs()
|
||||
|
||||
var advanced = false;
|
||||
var label_rack = 'Location';
|
||||
@@ -142,22 +143,6 @@
|
||||
var scan_sku_ready = false;
|
||||
var scan_location_ready = false;
|
||||
|
||||
function load_location_config(callback) {
|
||||
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';
|
||||
if (callback) callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function apply_location_labels() {
|
||||
if (advanced) {
|
||||
@@ -177,14 +162,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
function set_select_value(selector, value, label) {
|
||||
if (!value) return;
|
||||
var $select = $(selector);
|
||||
if (!$select.find(`option[value="${value}"]`).length) {
|
||||
$select.append(`<option value="${value}">${label || value}</option>`);
|
||||
}
|
||||
$select.val(value);
|
||||
}
|
||||
|
||||
function apply_sku_label_scan(data) {
|
||||
$('#product_sku').val(data.sku).attr('secondary', data.sku);
|
||||
@@ -593,6 +570,23 @@
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('lot:selected', '#lot_number', function(e, lot) {
|
||||
if (expiryPicker) {
|
||||
expiryPicker.setDate(lot.expiry_date || '', true, 'Y-m-d');
|
||||
if (expiryPicker.altInput) expiryPicker.altInput.disabled = true;
|
||||
}
|
||||
$('#expiry_date').prop('disabled', true)
|
||||
.attr('title', 'Expiry date is locked for existing lots');
|
||||
});
|
||||
|
||||
$(document).on('lot:cleared', '#lot_number', function() {
|
||||
$('#expiry_date').prop('disabled', false).removeAttr('title');
|
||||
if (expiryPicker) {
|
||||
expiryPicker.clear();
|
||||
if (expiryPicker.altInput) expiryPicker.altInput.disabled = false;
|
||||
}
|
||||
});
|
||||
|
||||
// ── Flatpickr: display dd/mm/yyyy, send yyyy-mm-dd to API ──────────
|
||||
var expiryPicker = flatpickr("#expiry_date", {
|
||||
dateFormat: "Y-m-d", // actual value stored in input (sent to API)
|
||||
|
||||
Reference in New Issue
Block a user