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>
|
||||
<tbody>
|
||||
<?php foreach ($data['items'] as $item): ?>
|
||||
<?php
|
||||
$itemBarcodePrice = number_format((float)$item['sale_price'] * (1 + (float)($item['vat_rate'] ?? 0) / 100), 3);
|
||||
?>
|
||||
<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>
|
||||
<?php if ($item['image_path']): ?>
|
||||
<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-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-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?')">
|
||||
<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>
|
||||
@ -7328,7 +7331,7 @@ runtime_debug_mark('page:rendering', ['page' => (string)$page]);
|
||||
|
||||
<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-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>
|
||||
</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">
|
||||
</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 class="modal-footer">
|
||||
<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>
|
||||
<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="datedBarcodeLabelPrice" class="fw-bold small mt-2" style="display: none;"></div>
|
||||
</div>
|
||||
<div class="row g-2 mb-3 text-start">
|
||||
<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">
|
||||
</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 class="modal-footer">
|
||||
<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 nameContainer = document.getElementById('datedBarcodeLabelName');
|
||||
const datesContainer = document.getElementById('datedBarcodeLabelDates');
|
||||
const priceContainer = document.getElementById('datedBarcodeLabelPrice');
|
||||
const previewContainer = document.getElementById('datedBarcodeContainer');
|
||||
const svg = document.getElementById('datedBarcodeSvg');
|
||||
const productionInput = document.getElementById('datedBarcodeProductionDate');
|
||||
@ -391,6 +392,10 @@
|
||||
productionInput ? productionInput.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.maxWidth = '100%';
|
||||
previewContainer.style.padding = height <= 30 ? '10px 12px' : '12px 14px';
|
||||
@ -420,7 +425,7 @@
|
||||
|
||||
initDatedBarcodePreviewControls();
|
||||
|
||||
window.printItemBarcodeWithDates = function(sku, nameAr, nameEn, defaultExpiryDate) {
|
||||
window.printItemBarcodeWithDates = function(sku, nameAr, nameEn, price, defaultExpiryDate) {
|
||||
if (!sku) {
|
||||
Swal.fire('Error', 'This item has no SKU/Barcode assigned.', 'error');
|
||||
return;
|
||||
@ -429,7 +434,8 @@
|
||||
window.currentDatedBarcodeLabel = {
|
||||
sku: String(sku),
|
||||
nameAr: nameAr || '',
|
||||
nameEn: nameEn || ''
|
||||
nameEn: nameEn || '',
|
||||
price: price || ''
|
||||
};
|
||||
|
||||
const productionInput = document.getElementById('datedBarcodeProductionDate');
|
||||
@ -472,6 +478,7 @@
|
||||
|
||||
const nameHtml = buildSingleBarcodeNameHtml(label.nameAr, label.nameEn);
|
||||
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 compactClass = width <= 40 || height <= 30 ? 'label-compact' : '';
|
||||
|
||||
@ -491,6 +498,7 @@
|
||||
${nameHtml ? `<div class="label-name">${nameHtml}</div>` : ''}
|
||||
<div class="barcode-wrap">${svg}</div>
|
||||
<div class="label-dates">${dateHtml}</div>
|
||||
${priceHtml}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
@ -555,6 +563,12 @@
|
||||
.label-date-key {
|
||||
font-weight: 700;
|
||||
}
|
||||
.label-price {
|
||||
font-size: 9px;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.label-compact {
|
||||
padding: 0.9mm 1.4mm;
|
||||
gap: 0.45mm;
|
||||
@ -562,6 +576,7 @@
|
||||
.label-compact .label-name-ar { font-size: 9px; }
|
||||
.label-compact .label-name-en { font-size: 7px; }
|
||||
.label-compact .label-dates { font-size: 7px; }
|
||||
.label-compact .label-price { font-size: 8px; }
|
||||
.barcode-wrap {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user