A free open source IT asset/license management system
Merge branch 'develop' into Label_customization
Godfrey M7de9c21f1540
diff --cc app/View/Label.phpindex 9520a7eadc,717efae189..9823ba5b94--- a/app/View/Label.php+++ b/app/View/Label.php@@@ -2,9 -2,7 +2,10 @@@namespace App\View;+ use App\Helpers\StorageHelper;+use App\Models\Labels\CustomLabels\PreviewSheetLabel;+use App\Models\Labels\CustomLabels\PreviewTapeLabel;+use App\Models\Labels\CustomUserLabel;use App\Models\Labels\Field;use App\Models\Labels\Label as LabelModel;use App\Models\Labels\Sheet;@@@ -93,10 -62,6 +93,10 @@@ class Label implements Vie$template->validate();+ $labelGap = method_exists($template, 'getLabelGap')+ ? (float)$template->getLabelGap()+ : 0.0;-++$pdf = new TCPDF($template->getOrientation(),$template->getUnit(),diff --cc resources/assets/js/snipeit.jsindex ded0350d3b,036b908086..dd9f453257--- a/resources/assets/js/snipeit.js+++ b/resources/assets/js/snipeit.js@@@ -149,8 -149,139 +149,139 @@@ $(function ()$('#completeMaintenanceModal').modal('show');});+ // Adjust-quantity modal (plus-minus button on accessory/consumable/+ // component list and view pages). Sets the modal form's action from+ // the trigger's data-adjust-url and populates the header + current+ // quantity display from the trigger's data attributes. Clears the+ // signed amount + note + order every open so nothing bleeds between+ // clicks.+ $el.on('click', '.adjust-quantity', function () {+ var $btn = $(this);+ var $modal = $('#adjustQuantityModal');+ var $amount = $modal.find('#adjustQuantityAmount');++ // data-available is the trigger's authoritative floor for a decrement+ // (available = qty - currentlyInUseCount). A delta smaller than+ // -available would decrement the on-hand qty below what's already+ // checked out, and AdjustsQuantity::adjustQuantity throws+ // DomainException. Mirror that server-side floor on the input's min+ // attribute so the browser stepper refuses to go below and the+ // constraint-validation message surfaces before submit.+ var available = parseInt($btn.data('available'), 10);++ $('#adjustQuantityForm').attr('action', $btn.data('adjust-url'));+ $modal.find('.adjust-quantity-item-name').text($btn.data('item-name') || '');+ $modal.find('.adjust-quantity-available').text(!isNaN(available) ? available : '');++ if (!isNaN(available)) {+ $amount.attr('min', -available);+ } else {+ $amount.removeAttr('min');+ }++ $amount.val('');+ $modal.find('#adjustQuantityOrder').val('');+ // Reset the acquisition-metadata fields between opens so an+ // order left half-filled by one operator doesn't bleed into the+ // next click. Supplier is a select2, so use .val('').trigger('change')+ // rather than setting the raw <select>; currency reverts to+ // whatever the modal was originally rendered with (its DOM value+ // attribute, i.e. the system default_currency).+ $modal.find('#adjustQuantitySupplier').val('').trigger('change');+ // Reset purchase_date to today on every open (server-rendered+ // default is today too). Prevents an operator's earlier+ // backdate from bleeding into the next event.+ var todayIso = new Date().toISOString().slice(0, 10);+ $modal.find('#adjustQuantityPurchaseDate').val(todayIso);++ // Pre-populate unit_cost + currency from the trigger's data-last-*+ // attrs (server-rendered from the item's most recent OrderItem).+ // When both are present the "pre-populated from last order" hint+ // shows underneath the row; the hint gets hidden as soon as the+ // operator edits either field so it disappears the moment they+ // override the pre-fill.+ var lastUnitCost = $btn.data('last-unit-cost');+ var lastCurrency = $btn.data('last-currency');+ var $unitCost = $modal.find('#adjustQuantityUnitCost');+ var $currency = $modal.find('#adjustQuantityCurrency');+ var $costHint = $modal.find('#adjustQuantityCostHint');++ $unitCost.val(lastUnitCost !== undefined && lastUnitCost !== '' ? lastUnitCost : '');+ $currency.val(lastCurrency !== undefined && lastCurrency !== '' ? lastCurrency : ($currency.prop('defaultValue') || ''));++ if ((lastUnitCost !== undefined && lastUnitCost !== '') || (lastCurrency !== undefined && lastCurrency !== '')) {+ $costHint.show();+ } else {+ $costHint.hide();+ }++ // Rebind on every open so multiple modal opens don't stack listeners.+ $unitCost.off('input.adjustCostHint').on('input.adjustCostHint', function () { $costHint.hide(); });+ $currency.off('input.adjustCostHint').on('input.adjustCostHint', function () { $costHint.hide(); });++ $modal.find('#adjustQuantityNote').val('');+ $modal.find('#adjustQuantityFile').val('');+ // js-uploadFile paints selected filenames into #{id}-info; clear it too+ // so stale filenames from a previous open don't linger in the new modal.+ $modal.find('#adjustQuantityFile-info').empty();++ // Acquisition-metadata fields (order number, supplier, unit cost,+ // currency) only make sense when the qty change is a positive+ // addition (a purchase). Zero or negative amounts represent+ // corrections / consumption / losses, not acquisitions, so hide+ // those fields — and blank their values so a submit from that+ // state doesn't ship stale purchase metadata alongside the log+ // entry. Show them again the moment the operator types a+ // positive number. The date label swaps to a generic "Date"+ // when the event isn't a purchase.+ //+ // On modal open the amount is empty ("we don't know yet"), so+ // stay in the default acquisition-visible state — prefilled+ // supplier / cost / currency from the last order are preserved+ // and the hint stays visible if it was shown. We only clear+ // when the operator actually commits to a 0/negative value.+ var $acquisitionFields = $modal.find('#adjustQuantityAcquisitionFields');+ var $costRow = $modal.find('#adjustQuantityCostRow');+ var $dateLabel = $modal.find('#adjustQuantityPurchaseDateLabel');+ var purchaseLabel = $dateLabel.data('label-purchase');+ var genericLabel = $dateLabel.data('label-generic');+ var syncAcquisitionFieldsVisibility = function () {+ var raw = $amount.val();+ // Treat "no value yet" as still-a-purchase for the visibility+ // toggle: prefilled acquisition metadata stays intact until+ // the operator explicitly types a non-positive number.+ if (raw === '' || raw === null || raw === undefined) {+ $acquisitionFields.show();+ $costRow.show();+ $dateLabel.text(purchaseLabel);+ return;+ }+ var num = parseFloat(raw);+ var isPurchase = !isNaN(num) && num > 0;+ $acquisitionFields.toggle(isPurchase);+ $costRow.toggle(isPurchase);+ $costHint.toggle(isPurchase && $costHint.data('has-prefill') === true);+ $dateLabel.text(isPurchase ? purchaseLabel : genericLabel);+ if (!isPurchase) {+ $modal.find('#adjustQuantityOrder').val('');+ $modal.find('#adjustQuantitySupplier').val('').trigger('change');+ $modal.find('#adjustQuantityUnitCost').val('');+ $modal.find('#adjustQuantityCurrency').val('');+ }+ };+ // Track the prefill state on the hint so the visibility toggle+ // can restore it correctly when qty flips positive again.+ $costHint.data('has-prefill', $costHint.is(':visible'));+ $amount.off('input.adjustAcquisition').on('input.adjustAcquisition', syncAcquisitionFieldsVisibility);+ // Initial call keeps everything in the default "purchase" state+ // (empty amount) so the prefill logic above stays authoritative.+ syncAcquisitionFieldsVisibility();++ $modal.modal('show');+ });+// confirm delete modal- $el.on('click', '.delete-asset', function (evnt) {+ $el.on('click', '.delete-asset, .delete-custom-label', function (evnt) {var $context = $(this);var $dataConfirmModal = $('#dataConfirmModal');// Anchors keep the URL in href; buttons keep it in data-hrefdiff --cc resources/views/partials/bootstrap-table.blade.phpindex 368fdff103,91ee7596fa..622b9e3a81--- a/resources/views/partials/bootstrap-table.blade.php+++ b/resources/views/partials/bootstrap-table.blade.php@@@ -2312,8 -2346,21 +2372,21 @@@}}+ // Plus-minus button opens the shared adjust-quantity modal.+ // Only rendered when the row's transformer set+ // available_actions.adjust_quantity (accessories, consumables,+ // components). The click handler in snipeit.js reads the+ // data-* attrs and shows blade/modals/adjust-quantity.+ if ((row.available_actions) && (row.available_actions.adjust_quantity === true)) {+ actions += '<button type="button" class="actions btn btn-sm btn-primary hidden-print adjust-quantity" data-tooltip="true" title="{{ trans('general.adjust_quantity') }}"'+ + ' data-adjust-url="{{ config('app.url') }}/' + dest + '/' + row.id + '/adjust-quantity"'+ + ' data-item-name="' + (row.name || '') + '"'+ + ' data-available="' + (row.remaining != null ? row.remaining : '') + '">'+ + '<x-icon type="plus-minus" class="fa-fw" /><span class="sr-only">{{ trans('general.adjust_quantity') }}</span></button> ';+ }+if ((row.available_actions) && (row.available_actions.delete === true)) {-+ actions += '<a href="{{ config('app.url') }}/' + dest + '/' + row.id + '/edit" class="actions btn btn-sm btn-warning hidden-print" data-tooltip="true" title="{{ trans('general.update') }}"><x-icon type="edit" class="fa-fw" /><span class="sr-only">{{ trans('general.update') }}</span></a> ';// use the asset tag if no name is providedif (row.name) {