Added Upload serial locator pages and livewire
This commit is contained in:
1757
app/Filament/Pages/UploadSerialLocator.php
Normal file
1757
app/Filament/Pages/UploadSerialLocator.php
Normal file
File diff suppressed because it is too large
Load Diff
94
app/Livewire/SerialLocatorDataTable.php
Normal file
94
app/Livewire/SerialLocatorDataTable.php
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Livewire;
|
||||||
|
|
||||||
|
use App\Models\PalletValidation;
|
||||||
|
use Livewire\Component;
|
||||||
|
|
||||||
|
class SerialLocatorDataTable extends Component
|
||||||
|
{
|
||||||
|
|
||||||
|
public $plantId;
|
||||||
|
|
||||||
|
public $locatorNumber;
|
||||||
|
|
||||||
|
public $serialNumber;
|
||||||
|
|
||||||
|
public $hasSearched = false;
|
||||||
|
|
||||||
|
public $locatorNo;
|
||||||
|
|
||||||
|
|
||||||
|
public $locators = [];
|
||||||
|
|
||||||
|
protected $listeners =
|
||||||
|
[
|
||||||
|
'loadData' => 'loadLocatorData',
|
||||||
|
'open-confirm-modal' => 'openConfirmModal',
|
||||||
|
'open-confirm-serial' => 'openConfirmSerial',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function openConfirmModal($locatorNo, $plantId)
|
||||||
|
{
|
||||||
|
$this->locatorNo = $locatorNo;
|
||||||
|
$this->plantId = $plantId;
|
||||||
|
|
||||||
|
$this->dispatch('open-modal', id: 'confirm-process-modal');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function openConfirmSerial($locatorNo, $plantId)
|
||||||
|
{
|
||||||
|
$this->locatorNo = $locatorNo;
|
||||||
|
$this->plantId = $plantId;
|
||||||
|
|
||||||
|
$this->dispatch('open-modal', id: 'confirm-process-serial');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadLocatorData($scanLocator, $scanSno, $plantId)
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->hasSearched = true;
|
||||||
|
$this->locatorNumber = $scanLocator;
|
||||||
|
$this->serialNumber = $scanSno;
|
||||||
|
$this->plantId = $plantId;
|
||||||
|
$this->locators = [];
|
||||||
|
|
||||||
|
// $query = PalletValidation::query()->where('plant_id', $plantId)
|
||||||
|
// ->whereNull('pallet_number')
|
||||||
|
// ->orWhere('pallet_number', '=','');
|
||||||
|
$query = PalletValidation::query()
|
||||||
|
->where('plant_id', $plantId)
|
||||||
|
->where(function($q) {
|
||||||
|
$q->whereNull('pallet_number')
|
||||||
|
->orWhere('pallet_number', '=', '');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($scanLocator && $scanSno)
|
||||||
|
{
|
||||||
|
$query->where('locator_number', $scanLocator)
|
||||||
|
->where('serial_number', $scanSno);
|
||||||
|
}
|
||||||
|
elseif ($scanLocator)
|
||||||
|
{
|
||||||
|
$query->where('locator_number', $scanLocator);
|
||||||
|
}
|
||||||
|
elseif ($scanSno)
|
||||||
|
{
|
||||||
|
$query->where('serial_number', $scanSno);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->locators = collect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->locators = $query->orderByDesc('created_at')->get();
|
||||||
|
|
||||||
|
//dd($this->locators);
|
||||||
|
}
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('livewire.serial-locator-data-table');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<x-filament-panels::page>
|
||||||
|
|
||||||
|
<div class="space-y-4">
|
||||||
|
{{-- Render the Select form fields --}}
|
||||||
|
<div class="space-y-4">
|
||||||
|
{{ $this->form }}
|
||||||
|
</div>
|
||||||
|
<div class="flex-row gap-2 mt-4">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
wire:click="masterFileUpload"
|
||||||
|
class="px-3 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||||
|
>
|
||||||
|
Master File Upload
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
wire:click="addLocator"
|
||||||
|
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
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
wire:click="viewLocator"
|
||||||
|
class="px-3 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||||
|
>
|
||||||
|
View
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
wire:click="deleteLocator"
|
||||||
|
class="px-3 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||||
|
>
|
||||||
|
Delete
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bg-white shadow rounded-xl p-4 mt-6">
|
||||||
|
<livewire:serial-locator-data-table />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<x-filament::modal id="confirm-process-modal">
|
||||||
|
<x-slot name="heading">
|
||||||
|
UPLOAD: CONFIRMATION
|
||||||
|
</x-slot>
|
||||||
|
<p>Some locator numbers does not have space?<br>Do you want to skip these locators?<br>Press Yes to continue!<br>Press No to Cancel!</p>
|
||||||
|
<x-slot name="footer">
|
||||||
|
<x-filament::button wire:click="skipLocatorsQuestion" x-on:click="isOpen = false" color="success">
|
||||||
|
Yes
|
||||||
|
</x-filament::button>
|
||||||
|
{{-- <x-filament::button x-on:click="isOpen = false" color="danger"> --}}
|
||||||
|
<x-filament::button wire:click="cancelLocatorsQuestion" x-on:click="isOpen = false" color="danger">
|
||||||
|
No
|
||||||
|
</x-filament::button>
|
||||||
|
</x-slot>
|
||||||
|
</x-filament::modal>
|
||||||
|
|
||||||
|
|
||||||
|
<x-filament::modal id="confirm-process-serial">
|
||||||
|
<x-slot name="heading">
|
||||||
|
UPLOAD: CONFIRMATION
|
||||||
|
</x-slot>
|
||||||
|
<p>Some Serial numbers are already exists in pallet table?<br>Do you want to skip the duplicate serial numbers?<br>Press Yes to continue!<br>Press No to Cancel!</p>
|
||||||
|
<x-slot name="footer">
|
||||||
|
<x-filament::button wire:click="skipSerialQuestion" x-on:click="isOpen = false" color="success">
|
||||||
|
Yes
|
||||||
|
</x-filament::button>
|
||||||
|
{{-- <x-filament::button x-on:click="isOpen = false" color="danger"> --}}
|
||||||
|
<x-filament::button wire:click="cancelSerialQuestion" x-on:click="isOpen = false" color="danger">
|
||||||
|
No
|
||||||
|
</x-filament::button>
|
||||||
|
</x-slot>
|
||||||
|
</x-filament::modal>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</x-filament-panels::page>
|
||||||
59
resources/views/livewire/serial-locator-data-table.blade.php
Normal file
59
resources/views/livewire/serial-locator-data-table.blade.php
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<div class="p-4">
|
||||||
|
<h2 class="text-lg font-bold mb-4 text-gray-700 uppercase tracking-wider">
|
||||||
|
SERIAL 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">{{ $locator->pallet_number ?? '' }}</td>
|
||||||
|
<td class="border px-4 py-2">{{ $locator->serial_number ?? '' }}</td>
|
||||||
|
<td class="border px-4 py-2">{{ $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 records found.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@if ($hasSearched)
|
||||||
|
<tr>
|
||||||
|
<td colspan="9" class="px-4 py-4 text-center text-red-600 font-semibold">
|
||||||
|
@if ($locatorNumber && $serialNumber)
|
||||||
|
Serial Number "{{ $serialNumber }}" and Locator Number "{{ $locatorNumber }}" not found.
|
||||||
|
@elseif ($locatorNumber)
|
||||||
|
Locator Number "{{ $locatorNumber }}" not found.
|
||||||
|
@elseif ($serialNumber)
|
||||||
|
Serial Number "{{ $serialNumber }}" not found.
|
||||||
|
@else
|
||||||
|
No records found.
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
@endforelse
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
Reference in New Issue
Block a user