fixed supplier mescole
This commit is contained in:
parent
d39e997beb
commit
248ae63875
@ -13,6 +13,7 @@ $pdo = $db->getConnection();
|
|||||||
|
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
msl.id,
|
msl.id,
|
||||||
|
msl.idsupplier AS idsupplier,
|
||||||
s.supplier_name,
|
s.supplier_name,
|
||||||
msl.supplier_mix_name,
|
msl.supplier_mix_name,
|
||||||
msl.lot_code,
|
msl.lot_code,
|
||||||
|
|||||||
@ -650,6 +650,22 @@
|
|||||||
$("#afCancelEdit").hide();
|
$("#afCancelEdit").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function afSetSupplierValue(supplierId) {
|
||||||
|
const sel = $("#afIdSupplier");
|
||||||
|
const normalizedId = String(supplierId || "").trim();
|
||||||
|
|
||||||
|
if (normalizedId === "") {
|
||||||
|
sel.val("").trigger("change");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sel.find('option[value="' + normalizedId + '"]').length > 0) {
|
||||||
|
sel.val(normalizedId).trigger("change");
|
||||||
|
} else {
|
||||||
|
sel.val("").trigger("change");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function afLoadSuppliers(selectedId = "") {
|
function afLoadSuppliers(selectedId = "") {
|
||||||
return fetch("get_suppliers.php")
|
return fetch("get_suppliers.php")
|
||||||
.then(r => r.json())
|
.then(r => r.json())
|
||||||
@ -688,6 +704,8 @@
|
|||||||
fetch("get_mescola_supplier_lots.php?id=" + encodeURIComponent(idMescola))
|
fetch("get_mescola_supplier_lots.php?id=" + encodeURIComponent(idMescola))
|
||||||
.then(r => r.json())
|
.then(r => r.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
console.log("ROWS LOTTI:", data);
|
||||||
|
|
||||||
const tbody = $("#afTable tbody");
|
const tbody = $("#afTable tbody");
|
||||||
tbody.empty();
|
tbody.empty();
|
||||||
|
|
||||||
@ -706,7 +724,7 @@
|
|||||||
|
|
||||||
data.rows.forEach(row => {
|
data.rows.forEach(row => {
|
||||||
const exp = row.expiry_date ? row.expiry_date : "";
|
const exp = row.expiry_date ? row.expiry_date : "";
|
||||||
const supplierId = String(row.idsupplier ?? "");
|
const supplierId = String(row.idsupplier ?? row.id_supplier ?? row.supplier_id ?? row.supplierId ?? "");
|
||||||
tbody.append(`
|
tbody.append(`
|
||||||
<tr>
|
<tr>
|
||||||
<td>${row.id}</td>
|
<td>${row.id}</td>
|
||||||
@ -760,7 +778,7 @@
|
|||||||
const qty = $(this).attr("data-qty");
|
const qty = $(this).attr("data-qty");
|
||||||
|
|
||||||
$("#afEditId").val(editId);
|
$("#afEditId").val(editId);
|
||||||
$("#afIdSupplier").val(String(supplierId)).trigger("change");
|
afSetSupplierValue(supplierId);
|
||||||
$("#afSupplierMixName").val(mix);
|
$("#afSupplierMixName").val(mix);
|
||||||
$("#afLotCode").val(lot);
|
$("#afLotCode").val(lot);
|
||||||
$("#afExpiryDate").val(exp);
|
$("#afExpiryDate").val(exp);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user