@include('stock.nav')
@if(($tab ?? 'stock') === 'expiry')
@if(!auth()->user()->hasPermission('pos.manage'))
You don't have permission to view expiry management.
@elseif(empty($locationId))
Select a location to view expiry batches.
@else
@include('pos.expiry._panel', [
'expiryIndexUrl' => route('expiry.index'),
])
@endif
@elseif(($tab ?? 'stock') === 'offpos')
@php
$perPageRaw = $perPageRaw ?? request()->query('per_page', 20);
$allowedPerPage = $allowedPerPage ?? [20, 50, 100, 500, 'all'];
if (!in_array($perPageRaw, $allowedPerPage, true)) {
$perPageRaw = 20;
}
@endphp
Unresolved Off-POS sales recorded from Expiry → Assign.
@if(!empty($locationId))
(Filtered to current location)
@endif
@if(auth()->user()->hasPermission('pos.manage'))
@endif
@if(isset($offposHasTable) && !$offposHasTable)
Off-POS sales table is not available. Please run migrations.
@else
| Date |
Product |
Barcode |
Qty |
Location |
By |
@php
$rows = $offposSales ?? [];
@endphp
@forelse($rows as $row)
@php
$p = isset($offposProductsById) ? ($offposProductsById[$row->product_id] ?? null) : null;
$displayName = $p ? (string) (($p->name_local ?? $p->name_si ?? $p->name) ?? '') : '';
$englishName = $p ? (string) (($p->name ?? '') ?? '') : '';
$barcode = $p ? (string) (($p->barcode ?? '') ?? '') : (string) (($row->product_barcode ?? '') ?? '');
$loc = isset($offposLocationsById) ? ($offposLocationsById[$row->location_id] ?? null) : null;
$user = isset($offposUsersById) ? ($offposUsersById[$row->created_by] ?? null) : null;
@endphp
| {{ !empty($row->created_at) ? \Illuminate\Support\Carbon::parse($row->created_at)->format('Y-m-d h:i A') : '-' }} |
{{ $displayName !== '' ? $displayName : ($englishName !== '' ? $englishName : '-') }}
@if($displayName !== '' && $englishName !== '' && $displayName !== $englishName)
{{ $englishName }}
@endif
|
{{ $barcode !== '' ? $barcode : '-' }} |
{{ number_format((float) ($row->qty ?? 0), 3) }} |
{{ $loc ? ($loc->name ?? ('#' . $row->location_id)) : ('#' . $row->location_id) }} |
{{ $user ? ($user->name ?? '-') : '-' }} |
@empty
| No unresolved Off-POS sales found. |
@endforelse
@if(isset($offposSales) && method_exists($offposSales, 'links'))
{{ $offposSales->appends(request()->except('page'))->links() }}
@endif
@endif
@if(auth()->user()->hasPermission('pos.manage'))
Add Off-POS Sales
Deducts stock from unbatched first, then earliest EXP batches.
@endif
@else
@php
$perPageRaw = $perPageRaw ?? request()->query('per_page', 20);
$allowedPerPage = $allowedPerPage ?? [20, 50, 100, 500, 'all'];
if (!in_array($perPageRaw, $allowedPerPage, true)) {
$perPageRaw = 20;
}
$linkedProductsCount = $linkedProductsCount ?? null;
@endphp
@if($linkedProductsCount !== null)
Linked (Affect Another Product’s Stock) products: {{ number_format((int) $linkedProductsCount) }}
@endif
| ID |
Product |
Linked To |
On-hand |
Actions |
@foreach($products as $product)
@php
$name = (string) ($product->name ?? $product->product_code ?? '');
$localName = (string) ($product->name_local ?? $product->name_si ?? '');
$barcode = (string) ($product->barcode ?? '');
$sku = (string) ($product->sku ?? '');
$searchBlob = strtolower(trim(implode(' ', array_filter([
$name,
$localName,
$barcode,
$sku,
(string) $product->id,
]))));
$isLinked = (bool) ($product->linkedRelationship);
$linkedToName = $isLinked ? (string) ($product->linkedRelationship->linkedProduct->name ?? ('Product #' . $product->linkedRelationship->linked_product_id)) : '';
$linkedQty = $isLinked ? (float) ($product->linkedRelationship->quantity ?? 1) : 1;
$linkedToBarcode = $isLinked ? (string) ($product->linkedRelationship->linkedProduct->barcode ?? '') : '';
@endphp
| {{ $product->id }} |
{{ $localName !== '' ? $localName : ($name !== '' ? $name : '-') }}
@if($isLinked)
Linked
@endif
@if($localName !== '' && $name !== '' && $localName !== $name)
{{ $name }}
@endif
@if($barcode !== '' || $sku !== '')
{{ $barcode }}
@if($sku !== '')
•SKU: {{ $sku }}
@endif
@endif
|
@if($product->linkedRelationship)
{{ (float) $product->linkedRelationship->quantity }}x {{ $linkedToName }}
@if($linkedToBarcode !== '')
{{ $linkedToBarcode }}
@endif
@else
-
@endif
|
@php
$total = $product->getActualStock();
@endphp
{{ number_format($total, 2) }}
|
History
|
@endforeach
@if(isset($products) && method_exists($products, 'links'))
{{ $products->appends(request()->except('page'))->links() }}
@endif
Adjust Stock
Moves stock from your current location into the selected location.
Stock Movement History
| Date |
Type |
Quantity |
Note |
User |
@endif