@php
$po = $purchaseOrder ?? null;
$deliveryDefault = ($po && !empty($po->expected_delivery_date))
? \Carbon\Carbon::parse($po->expected_delivery_date)->format('Y-m-d')
: '';
if (old('discount_amount') !== null) {
$hdrDiscInput = old('discount_amount');
} elseif ($po && ($po->discount_type ?? 'fixed') === 'percentage') {
$pre = (float) ($po->subtotal ?? 0) + (float) ($po->discount_amount ?? 0);
$hdrDiscInput = $pre > 0 ? round(100 * (float) ($po->discount_amount ?? 0) / $pre, 4) : 0;
} else {
$hdrDiscInput = old('discount_amount', $po?->discount_amount ?? 0);
}
@endphp
Status
Supplier (vendor)
@if(!empty($warehouseCtx['warehouses']) && count($warehouseCtx['warehouses']))
@include('garage.partials.warehouse-location-fields', [
'fieldPrefix' => 'poWh',
'warehouses' => $warehouseCtx['warehouses'],
'sectionsByWarehouse' => $warehouseCtx['sectionsByWarehouse'],
'defaultWarehouseId' => $warehouseCtx['defaultWarehouseId'] ?? null,
'defaultSectionId' => $warehouseCtx['defaultSectionId'] ?? null,
'applyDefaults' => $warehouseCtx['applyDefaults'] ?? false,
'useBootstrap' => true,
'gridClass' => 'row g-2 mb-1 grg-wh-location gs-ro-fields-row',
'colClass' => 'col-12 col-sm-6 col-lg-3',
'labelClass' => 'gpo-lbl',
'selectClass' => 'gpo-sel js-chosen js-chosen-compact',
])
@endif