update sticker dates
This commit is contained in:
parent
d52dfbe9df
commit
9975e0a5db
14
index.php
14
index.php
@ -7243,8 +7243,11 @@ runtime_debug_mark('page:rendering', ['page' => (string)$page]);
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($data['items'] as $item): ?>
|
<?php foreach ($data['items'] as $item): ?>
|
||||||
|
<?php
|
||||||
|
$itemBarcodePrice = number_format((float)$item['sale_price'] * (1 + (float)($item['vat_rate'] ?? 0) / 100), 3);
|
||||||
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><input type="checkbox" class="form-check-input item-checkbox" data-id="<?= $item['id'] ?>" data-sku="<?= htmlspecialchars($item['sku']) ?>" data-name-ar="<?= htmlspecialchars($item['name_ar']) ?>" data-name-en="<?= htmlspecialchars($item['name_en']) ?>" data-name="<?= htmlspecialchars($item['name_en'] . ' - ' . $item['name_ar']) ?>" data-price="<?= number_format((float)$item['sale_price'] * (1 + (float)($item['vat_rate'] ?? 0) / 100), 3) ?>"></td>
|
<td><input type="checkbox" class="form-check-input item-checkbox" data-id="<?= $item['id'] ?>" data-sku="<?= htmlspecialchars($item['sku']) ?>" data-name-ar="<?= htmlspecialchars($item['name_ar']) ?>" data-name-en="<?= htmlspecialchars($item['name_en']) ?>" data-name="<?= htmlspecialchars($item['name_en'] . ' - ' . $item['name_ar']) ?>" data-price="<?= htmlspecialchars((string)$itemBarcodePrice, ENT_QUOTES, 'UTF-8') ?>"></td>
|
||||||
<td>
|
<td>
|
||||||
<?php if ($item['image_path']): ?>
|
<?php if ($item['image_path']): ?>
|
||||||
<img src="<?= htmlspecialchars($item['image_path']) ?>" alt="item" style="width: 40px; height: 40px; object-fit: cover;" class="rounded">
|
<img src="<?= htmlspecialchars($item['image_path']) ?>" alt="item" style="width: 40px; height: 40px; object-fit: cover;" class="rounded">
|
||||||
@ -7290,7 +7293,7 @@ runtime_debug_mark('page:rendering', ['page' => (string)$page]);
|
|||||||
<button class="btn btn-outline-info" title="View" data-bs-toggle="modal" data-bs-target="#viewItemModal<?= $item['id'] ?>"><i class="bi bi-eye"></i></button>
|
<button class="btn btn-outline-info" title="View" data-bs-toggle="modal" data-bs-target="#viewItemModal<?= $item['id'] ?>"><i class="bi bi-eye"></i></button>
|
||||||
<button class="btn btn-outline-primary" title="Edit" data-bs-toggle="modal" data-bs-target="#editItemModal<?= $item['id'] ?>"><i class="bi bi-pencil"></i></button>
|
<button class="btn btn-outline-primary" title="Edit" data-bs-toggle="modal" data-bs-target="#editItemModal<?= $item['id'] ?>"><i class="bi bi-pencil"></i></button>
|
||||||
<button class="btn btn-outline-dark" title="Barcode" onclick="printItemBarcode(<?= $itemSkuJs ?>, <?= $itemNameArJs ?>, <?= $itemNameEnJs ?>, <?= $itemBarcodePriceJs ?>)"><i class="bi bi-upc"></i></button>
|
<button class="btn btn-outline-dark" title="Barcode" onclick="printItemBarcode(<?= $itemSkuJs ?>, <?= $itemNameArJs ?>, <?= $itemNameEnJs ?>, <?= $itemBarcodePriceJs ?>)"><i class="bi bi-upc"></i></button>
|
||||||
<button class="btn btn-outline-secondary" title="Barcode + Dates" onclick="printItemBarcodeWithDates(<?= $itemSkuJs ?>, <?= $itemNameArJs ?>, <?= $itemNameEnJs ?>, <?= $itemExpiryDateJs ?>)"><i class="bi bi-calendar-date"></i></button>
|
<button class="btn btn-outline-secondary" title="Barcode + Dates" onclick="printItemBarcodeWithDates(<?= $itemSkuJs ?>, <?= $itemNameArJs ?>, <?= $itemNameEnJs ?>, <?= $itemBarcodePriceJs ?>, <?= $itemExpiryDateJs ?>)"><i class="bi bi-calendar-date"></i></button>
|
||||||
<form method="POST" class="d-inline" onsubmit="return confirm('Are you sure?')">
|
<form method="POST" class="d-inline" onsubmit="return confirm('Are you sure?')">
|
||||||
<input type="hidden" name="id" value="<?= $item['id'] ?>">
|
<input type="hidden" name="id" value="<?= $item['id'] ?>">
|
||||||
<button type="submit" name="delete_item" class="btn btn-outline-danger" title="Delete"><i class="bi bi-trash"></i></button>
|
<button type="submit" name="delete_item" class="btn btn-outline-danger" title="Delete"><i class="bi bi-trash"></i></button>
|
||||||
@ -7328,7 +7331,7 @@ runtime_debug_mark('page:rendering', ['page' => (string)$page]);
|
|||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button class="btn btn-outline-dark" onclick="printItemBarcode(<?= $itemSkuJs ?>, <?= $itemNameArJs ?>, <?= $itemNameEnJs ?>, <?= $itemBarcodePriceJs ?>)"><i class="bi bi-printer"></i> Print Barcode</button>
|
<button class="btn btn-outline-dark" onclick="printItemBarcode(<?= $itemSkuJs ?>, <?= $itemNameArJs ?>, <?= $itemNameEnJs ?>, <?= $itemBarcodePriceJs ?>)"><i class="bi bi-printer"></i> Print Barcode</button>
|
||||||
<button class="btn btn-outline-secondary" onclick="printItemBarcodeWithDates(<?= $itemSkuJs ?>, <?= $itemNameArJs ?>, <?= $itemNameEnJs ?>, <?= $itemExpiryDateJs ?>)"><i class="bi bi-calendar-date"></i> Barcode + Dates</button>
|
<button class="btn btn-outline-secondary" onclick="printItemBarcodeWithDates(<?= $itemSkuJs ?>, <?= $itemNameArJs ?>, <?= $itemNameEnJs ?>, <?= $itemBarcodePriceJs ?>, <?= $itemExpiryDateJs ?>)"><i class="bi bi-calendar-date"></i> Barcode + Dates</button>
|
||||||
<button type="button" class="btn btn-light" data-bs-dismiss="modal" data-en="Close" data-ar="إغلاق">Close</button>
|
<button type="button" class="btn btn-light" data-bs-dismiss="modal" data-en="Close" data-ar="إغلاق">Close</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -12223,7 +12226,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
<input type="number" id="barcodeHeight" class="form-control form-control-sm" value="30" min="10">
|
<input type="number" id="barcodeHeight" class="form-control form-control-sm" value="30" min="10">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-text text-center mb-1">For best scanner reliability, start at 50 × 30 mm or larger.</div>
|
<div class="form-text text-center mb-1">For best scanner reliability, start at 50 × 30 mm or larger. Printed price includes VAT.</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-light" data-bs-dismiss="modal" data-en="Close" data-ar="إغلاق">Close</button>
|
<button type="button" class="btn btn-light" data-bs-dismiss="modal" data-en="Close" data-ar="إغلاق">Close</button>
|
||||||
@ -12246,6 +12249,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
<div id="datedBarcodeLabelName" class="fw-bold small mb-1"></div>
|
<div id="datedBarcodeLabelName" class="fw-bold small mb-1"></div>
|
||||||
<svg id="datedBarcodeSvg" style="max-width: 100%; height: auto;"></svg>
|
<svg id="datedBarcodeSvg" style="max-width: 100%; height: auto;"></svg>
|
||||||
<div id="datedBarcodeLabelDates" class="small mt-2 text-start mx-auto" style="width: fit-content; min-width: 145px;"></div>
|
<div id="datedBarcodeLabelDates" class="small mt-2 text-start mx-auto" style="width: fit-content; min-width: 145px;"></div>
|
||||||
|
<div id="datedBarcodeLabelPrice" class="fw-bold small mt-2" style="display: none;"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row g-2 mb-3 text-start">
|
<div class="row g-2 mb-3 text-start">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
@ -12271,7 +12275,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
<input type="number" id="datedBarcodeHeight" class="form-control form-control-sm" value="35" min="10">
|
<input type="number" id="datedBarcodeHeight" class="form-control form-control-sm" value="35" min="10">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-text text-center mb-1">For barcode labels with P / E dates, 50 × 35 mm or larger is recommended.</div>
|
<div class="form-text text-center mb-1">For barcode labels with P / E dates, 50 × 35 mm or larger is recommended. Printed price includes VAT.</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-light" data-bs-dismiss="modal" data-en="Close" data-ar="إغلاق">Close</button>
|
<button type="button" class="btn btn-light" data-bs-dismiss="modal" data-en="Close" data-ar="إغلاق">Close</button>
|
||||||
|
|||||||
@ -377,6 +377,7 @@
|
|||||||
const scale = getDatedBarcodeScale(width, height);
|
const scale = getDatedBarcodeScale(width, height);
|
||||||
const nameContainer = document.getElementById('datedBarcodeLabelName');
|
const nameContainer = document.getElementById('datedBarcodeLabelName');
|
||||||
const datesContainer = document.getElementById('datedBarcodeLabelDates');
|
const datesContainer = document.getElementById('datedBarcodeLabelDates');
|
||||||
|
const priceContainer = document.getElementById('datedBarcodeLabelPrice');
|
||||||
const previewContainer = document.getElementById('datedBarcodeContainer');
|
const previewContainer = document.getElementById('datedBarcodeContainer');
|
||||||
const svg = document.getElementById('datedBarcodeSvg');
|
const svg = document.getElementById('datedBarcodeSvg');
|
||||||
const productionInput = document.getElementById('datedBarcodeProductionDate');
|
const productionInput = document.getElementById('datedBarcodeProductionDate');
|
||||||
@ -391,6 +392,10 @@
|
|||||||
productionInput ? productionInput.value : '',
|
productionInput ? productionInput.value : '',
|
||||||
expiryInput ? expiryInput.value : ''
|
expiryInput ? expiryInput.value : ''
|
||||||
);
|
);
|
||||||
|
if (priceContainer) {
|
||||||
|
priceContainer.textContent = label.price ? 'OMR ' + label.price : '';
|
||||||
|
priceContainer.style.display = label.price ? 'block' : 'none';
|
||||||
|
}
|
||||||
previewContainer.style.width = Math.min(Math.max(width * 3.8, 180), 300) + 'px';
|
previewContainer.style.width = Math.min(Math.max(width * 3.8, 180), 300) + 'px';
|
||||||
previewContainer.style.maxWidth = '100%';
|
previewContainer.style.maxWidth = '100%';
|
||||||
previewContainer.style.padding = height <= 30 ? '10px 12px' : '12px 14px';
|
previewContainer.style.padding = height <= 30 ? '10px 12px' : '12px 14px';
|
||||||
@ -420,7 +425,7 @@
|
|||||||
|
|
||||||
initDatedBarcodePreviewControls();
|
initDatedBarcodePreviewControls();
|
||||||
|
|
||||||
window.printItemBarcodeWithDates = function(sku, nameAr, nameEn, defaultExpiryDate) {
|
window.printItemBarcodeWithDates = function(sku, nameAr, nameEn, price, defaultExpiryDate) {
|
||||||
if (!sku) {
|
if (!sku) {
|
||||||
Swal.fire('Error', 'This item has no SKU/Barcode assigned.', 'error');
|
Swal.fire('Error', 'This item has no SKU/Barcode assigned.', 'error');
|
||||||
return;
|
return;
|
||||||
@ -429,7 +434,8 @@
|
|||||||
window.currentDatedBarcodeLabel = {
|
window.currentDatedBarcodeLabel = {
|
||||||
sku: String(sku),
|
sku: String(sku),
|
||||||
nameAr: nameAr || '',
|
nameAr: nameAr || '',
|
||||||
nameEn: nameEn || ''
|
nameEn: nameEn || '',
|
||||||
|
price: price || ''
|
||||||
};
|
};
|
||||||
|
|
||||||
const productionInput = document.getElementById('datedBarcodeProductionDate');
|
const productionInput = document.getElementById('datedBarcodeProductionDate');
|
||||||
@ -472,6 +478,7 @@
|
|||||||
|
|
||||||
const nameHtml = buildSingleBarcodeNameHtml(label.nameAr, label.nameEn);
|
const nameHtml = buildSingleBarcodeNameHtml(label.nameAr, label.nameEn);
|
||||||
const dateHtml = buildDatedBarcodeDateRowsHtml(productionDate, expiryDate);
|
const dateHtml = buildDatedBarcodeDateRowsHtml(productionDate, expiryDate);
|
||||||
|
const priceHtml = label.price ? `<div class="label-price">OMR ${escapeBarcodeLabelHtml(label.price)}</div>` : '';
|
||||||
const svg = buildDatedBarcodeSvgMarkup(label.sku, width, height);
|
const svg = buildDatedBarcodeSvgMarkup(label.sku, width, height);
|
||||||
const compactClass = width <= 40 || height <= 30 ? 'label-compact' : '';
|
const compactClass = width <= 40 || height <= 30 ? 'label-compact' : '';
|
||||||
|
|
||||||
@ -491,6 +498,7 @@
|
|||||||
${nameHtml ? `<div class="label-name">${nameHtml}</div>` : ''}
|
${nameHtml ? `<div class="label-name">${nameHtml}</div>` : ''}
|
||||||
<div class="barcode-wrap">${svg}</div>
|
<div class="barcode-wrap">${svg}</div>
|
||||||
<div class="label-dates">${dateHtml}</div>
|
<div class="label-dates">${dateHtml}</div>
|
||||||
|
${priceHtml}
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@ -555,6 +563,12 @@
|
|||||||
.label-date-key {
|
.label-date-key {
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
.label-price {
|
||||||
|
font-size: 9px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
.label-compact {
|
.label-compact {
|
||||||
padding: 0.9mm 1.4mm;
|
padding: 0.9mm 1.4mm;
|
||||||
gap: 0.45mm;
|
gap: 0.45mm;
|
||||||
@ -562,6 +576,7 @@
|
|||||||
.label-compact .label-name-ar { font-size: 9px; }
|
.label-compact .label-name-ar { font-size: 9px; }
|
||||||
.label-compact .label-name-en { font-size: 7px; }
|
.label-compact .label-name-en { font-size: 7px; }
|
||||||
.label-compact .label-dates { font-size: 7px; }
|
.label-compact .label-dates { font-size: 7px; }
|
||||||
|
.label-compact .label-price { font-size: 8px; }
|
||||||
.barcode-wrap {
|
.barcode-wrap {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user