Added locator validation page and locator data table
This commit is contained in:
1801
app/Filament/Pages/LocatorValidation.php
Normal file
1801
app/Filament/Pages/LocatorValidation.php
Normal file
File diff suppressed because it is too large
Load Diff
132
app/Livewire/LocatorDataTable.php
Normal file
132
app/Livewire/LocatorDataTable.php
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Livewire;
|
||||||
|
|
||||||
|
use App\Models\PalletValidation;
|
||||||
|
use Livewire\Component;
|
||||||
|
|
||||||
|
class LocatorDataTable extends Component
|
||||||
|
{
|
||||||
|
public $plantId;
|
||||||
|
|
||||||
|
public $palletNumber, $serialNumber;
|
||||||
|
|
||||||
|
public $locatorNumber;
|
||||||
|
|
||||||
|
public $locators = [];
|
||||||
|
|
||||||
|
public $locators1 = [];
|
||||||
|
|
||||||
|
public $serials = [];
|
||||||
|
|
||||||
|
protected $listeners = [
|
||||||
|
'loadData' => 'loadPalletData',
|
||||||
|
'loadLocator' => 'loadLocatorData',
|
||||||
|
'loadserialNo' => 'loadserialNodata',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function loadserialNodata($serialNo, $plantId)
|
||||||
|
{
|
||||||
|
$this->plantId = $plantId;
|
||||||
|
$this->serialNumber = $serialNo;
|
||||||
|
$this->locators = [];
|
||||||
|
|
||||||
|
$record = PalletValidation::where('plant_id', $plantId)
|
||||||
|
->where('serial_number', $serialNo)
|
||||||
|
->whereNotNull('locator_number')
|
||||||
|
->where('locator_number', '!=', '')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (!$record)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$locatorNumber = $record->locator_number;
|
||||||
|
|
||||||
|
$this->locators = PalletValidation::where('plant_id', $plantId)
|
||||||
|
->where('locator_number', $locatorNumber)
|
||||||
|
->whereNotNull('locator_number')
|
||||||
|
->where('locator_number', '!=', '')
|
||||||
|
->get()
|
||||||
|
->map(function ($record) {
|
||||||
|
return [
|
||||||
|
'created_at' => $record->created_at ?? '',
|
||||||
|
'created_by' => $record->created_by ?? '',
|
||||||
|
'pallet_number' => $record->pallet_number ?? '',
|
||||||
|
'serial_number' => $record->serial_number ?? '',
|
||||||
|
'locator_number' => $record->locator_number ?? '',
|
||||||
|
'locator_quantity' => $record->locator_quantity ?? '',
|
||||||
|
'updated_at' => $record->updated_at ?? '',
|
||||||
|
'updated_by' => $record->updated_by ?? '',
|
||||||
|
];
|
||||||
|
})
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadPalletData($palletNumber,$locatorNumber,$plantId)
|
||||||
|
{
|
||||||
|
$this->plantId = $plantId;
|
||||||
|
$this->palletNumber = $palletNumber;
|
||||||
|
$this->locators = [];
|
||||||
|
|
||||||
|
$this->locators = PalletValidation::query()
|
||||||
|
->where('plant_id', $plantId)
|
||||||
|
->where(function ($query) use ($palletNumber, $locatorNumber) {
|
||||||
|
$query->where(function ($q) use ($palletNumber) {
|
||||||
|
$q->where('pallet_number', $palletNumber)
|
||||||
|
->whereNotNull('locator_number')
|
||||||
|
->where('locator_number', '!=', '');
|
||||||
|
})
|
||||||
|
->orWhere(function ($q) use ($locatorNumber) {
|
||||||
|
$q->where('locator_number', $locatorNumber)
|
||||||
|
->whereNotNull('locator_number')
|
||||||
|
->where('locator_number', '!=', '');
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->get()
|
||||||
|
->map(function ($record) {
|
||||||
|
return [
|
||||||
|
'created_at' => $record->created_at ?? '',
|
||||||
|
'created_by' => $record->created_by ?? '',
|
||||||
|
'pallet_number' => $record->pallet_number ?? '',
|
||||||
|
'serial_number' => $record->serial_number ?? '',
|
||||||
|
'locator_number' => $record->locator_number ?? '',
|
||||||
|
'locator_quantity' => $record->locator_quantity ?? '',
|
||||||
|
'updated_at' => $record->updated_at ?? '',
|
||||||
|
'updated_by' => $record->updated_by ?? '',
|
||||||
|
];
|
||||||
|
})
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadLocatorData($scanLocator, $plantId)
|
||||||
|
{
|
||||||
|
$this->plantId = $plantId;
|
||||||
|
$this->locatorNumber = $scanLocator;
|
||||||
|
$this->locators = [];
|
||||||
|
|
||||||
|
$this->locators = PalletValidation::query()
|
||||||
|
->where('plant_id', $plantId)
|
||||||
|
->where('locator_number', $scanLocator)
|
||||||
|
->get()
|
||||||
|
->map(function ($record) {
|
||||||
|
return [
|
||||||
|
'created_at' => $record->created_at ?? '',
|
||||||
|
'created_by' => $record->created_by ?? '',
|
||||||
|
'pallet_number' => $record->pallet_number ?? '',
|
||||||
|
'serial_number' => $record->serial_number ?? '',
|
||||||
|
'locator_number' => $record->locator_number ?? '',
|
||||||
|
'locator_quantity' => $record->locator_quantity ?? '',
|
||||||
|
'updated_at' => $record->updated_at ?? '',
|
||||||
|
'updated_by' => $record->updated_by ?? '',
|
||||||
|
];
|
||||||
|
})
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('livewire.locator-data-table');
|
||||||
|
}
|
||||||
|
}
|
||||||
77
resources/views/filament/pages/locator-validation.blade.php
Normal file
77
resources/views/filament/pages/locator-validation.blade.php
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
{{-- <x-filament-panels::page>
|
||||||
|
|
||||||
|
<div class="space-y-4">
|
||||||
|
<div class="space-y-4">
|
||||||
|
{{ $this->form }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bg-white shadow rounded-xl p-4 mt-6">
|
||||||
|
<livewire:locator-data-table />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
window.addEventListener('focus-scan-locator-no', () => {
|
||||||
|
const wrapper = document.getElementById('scan_locator_no');
|
||||||
|
const input = wrapper?.querySelector('input,textarea');
|
||||||
|
if (input) {
|
||||||
|
input.focus();
|
||||||
|
input.select();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</x-filament-panels::page> --}}
|
||||||
|
|
||||||
|
<x-filament-panels::page>
|
||||||
|
|
||||||
|
<div class="space-y-4">
|
||||||
|
{{-- Render the Select form fields --}}
|
||||||
|
<div class="space-y-4">
|
||||||
|
{{ $this->form }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Add Pallet and Remove Pallet buttons --}}
|
||||||
|
<div class="flex flex-row gap-2 mt-4">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
wire:click="addPallet"
|
||||||
|
class="px-3 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||||
|
>
|
||||||
|
Add Pallet /<br>Serial Number
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
wire:click="removePallet"
|
||||||
|
class="px-3 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||||
|
>
|
||||||
|
Remove Pallet /<br>Serial Number
|
||||||
|
</button>
|
||||||
|
{{-- <button
|
||||||
|
type="button"
|
||||||
|
wire:click="print"
|
||||||
|
class="px-3 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||||
|
>
|
||||||
|
Print
|
||||||
|
</button> --}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bg-white shadow rounded-xl p-4 mt-6">
|
||||||
|
<livewire:locator-data-table />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
window.addEventListener('focus-scan-locator-no', () => {
|
||||||
|
const wrapper = document.getElementById('scan_locator_no');
|
||||||
|
const input = wrapper?.querySelector('input,textarea');
|
||||||
|
if (input) {
|
||||||
|
input.focus();
|
||||||
|
input.select();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</x-filament-panels::page>
|
||||||
|
|
||||||
44
resources/views/livewire/locator-data-table.blade.php
Normal file
44
resources/views/livewire/locator-data-table.blade.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<div class="p-4">
|
||||||
|
<h2 class="text-lg font-bold mb-4 text-gray-700 uppercase tracking-wider">
|
||||||
|
LOCATOR DATA TABLE:
|
||||||
|
</h2>
|
||||||
|
<div class="overflow-x-auto rounded-lg shadow">
|
||||||
|
<table class="w-full divide-y divide-gray-200 text-sm text-center">
|
||||||
|
<thead class="bg-gray-100 text-s font-semibold uppercase text-gray-700">
|
||||||
|
<tr>
|
||||||
|
<th class="border px-4 py-2">No</th>
|
||||||
|
<th class="border px-4 py-2">Created Datetime</th>
|
||||||
|
<th class="border px-4 py-2">Created By</th>
|
||||||
|
<th class="border px-4 py-2">Pallet Number</th>
|
||||||
|
<th class="border px-4 py-2">Serial Number</th>
|
||||||
|
<th class="border px-4 py-2">Locator Number</th>
|
||||||
|
<th class="border px-4 py-2">Locator Quantity</th>
|
||||||
|
<th class="border px-4 py-2">Updated Datetime</th>
|
||||||
|
<th class="border px-4 py-2">Updated By</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="divide-y divide-gray-100">
|
||||||
|
@forelse ($locators as $index => $locator)
|
||||||
|
<tr class="hover:bg-gray-50">
|
||||||
|
<td class="border px-4 py-2">{{ $index + 1 }}</td>
|
||||||
|
<td class="border px-4 py-2 whitespace-nowrap">{{ $locator['created_at']?->format('Y-m-d H:i:s') ?? '-' }}</td>
|
||||||
|
<td class="border px-4 py-2">{{ $locator['created_by'] ?? '-' }}</td>
|
||||||
|
<td class="border px-4 py-2 whitespace-nowrap">{{ $locator['pallet_number'] ?? '-' }}</td>
|
||||||
|
<td class="border px-4 py-2">{{ $locator['serial_number'] ?? '-' }}</td>
|
||||||
|
<td class="border px-4 py-2 whitespace-nowrap">{{ $locator['locator_number'] ?? '-' }}</td>
|
||||||
|
<td class="border px-4 py-2">{{ $locator['locator_quantity'] ?? '-' }}</td>
|
||||||
|
<td class="border px-4 py-2 whitespace-nowrap">{{ $locator['updated_at']?->format('Y-m-d H:i:s') ?? '-' }}</td>
|
||||||
|
<td class="border px-4 py-2">{{ $locator['updated_by'] ?? '-' }}</td>
|
||||||
|
</tr>
|
||||||
|
@empty
|
||||||
|
<tr>
|
||||||
|
<td colspan="9" class="px-4 py-4 text-center text-gray-500">
|
||||||
|
No locator records found.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforelse
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user