feat: show last 3 barcode digits in finished-product banner title
This commit is contained in:
+2
-1
@@ -1167,7 +1167,7 @@ function deleteInventory(PDO $db): void {
|
||||
*/
|
||||
function getFinishedItems(PDO $db): void {
|
||||
$rows = $db->query("
|
||||
SELECT p.id AS product_id, p.name, p.brand, p.unit, p.default_quantity, p.package_unit, p.image_url,
|
||||
SELECT p.id AS product_id, p.name, p.brand, p.unit, p.default_quantity, p.package_unit, p.image_url, p.barcode,
|
||||
MIN(i.location) AS location,
|
||||
MAX(i.updated_at) AS updated_at,
|
||||
COALESCE(SUM(CASE WHEN t.type = 'in' AND t.undone = 0 THEN t.quantity ELSE 0 END), 0) AS total_in,
|
||||
@@ -1200,6 +1200,7 @@ function getFinishedItems(PDO $db): void {
|
||||
'default_quantity' => $r['default_quantity'],
|
||||
'package_unit' => $r['package_unit'],
|
||||
'image_url' => $r['image_url'],
|
||||
'barcode' => $r['barcode'],
|
||||
'location' => $r['location'],
|
||||
'updated_at' => $r['updated_at'],
|
||||
'expected_qty' => round($expected, 3),
|
||||
|
||||
+2
-1
@@ -2556,7 +2556,8 @@ function renderBannerItem() {
|
||||
const fin = entry.data;
|
||||
banner.className = 'alert-banner banner-finished';
|
||||
iconEl.textContent = '📦';
|
||||
titleEl.textContent = `${fin.name}${fin.brand ? ' (' + fin.brand + ')' : ''} — ${t('dashboard.banner_finished_title')}`;
|
||||
const barcodeSuffix = fin.barcode && fin.barcode.length >= 3 ? ' …' + fin.barcode.slice(-3) : '';
|
||||
titleEl.textContent = `${fin.name}${fin.brand ? ' (' + fin.brand + ')' : ''}${barcodeSuffix} — ${t('dashboard.banner_finished_title')}`;
|
||||
const expectedText = fin.expected_qty ? ` Secondo le registrazioni dovresti averne ancora <strong>${fin.expected_qty} ${fin.unit}</strong>.` : '';
|
||||
detailEl.innerHTML = `L'inventario segna zero, ma i movimenti registrati dicono che non dovrebbe essere finito.${expectedText} Puoi controllare?`;
|
||||
let btns = `<button class="btn-banner btn-banner-ok" onclick="confirmBannerFinished()">${t('dashboard.banner_finished_action_yes')}</button>`;
|
||||
|
||||
Reference in New Issue
Block a user