Added rework locator invoice validation livewire page and table
This commit is contained in:
82
app/Livewire/InvoiceReworkDataTable.php
Normal file
82
app/Livewire/InvoiceReworkDataTable.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\LocatorInvoiceValidation;
|
||||
use App\Models\PalletValidation;
|
||||
use Livewire\Component;
|
||||
|
||||
class InvoiceReworkDataTable extends Component
|
||||
{
|
||||
public $plantId;
|
||||
|
||||
public $invoiceNumber;
|
||||
|
||||
public $palletNumber;
|
||||
|
||||
public $reworkTyp;
|
||||
|
||||
public bool $isOpen = false;
|
||||
|
||||
public $records = [];
|
||||
|
||||
public $showConfirmationModal = false;
|
||||
|
||||
public $invoiceNo;
|
||||
|
||||
protected $listeners =
|
||||
[
|
||||
'loadData' => 'loadlocatorInvoiceData',
|
||||
];
|
||||
|
||||
public function loadlocatorInvoiceData($invoiceNumber, $palletNumber, $plantId, $reworkType)
|
||||
{
|
||||
$this->invoiceNumber = $invoiceNumber;
|
||||
$this->palletNumber = $palletNumber;
|
||||
$this->plantId = $plantId;
|
||||
$this->reworkTyp = $reworkType;
|
||||
|
||||
if ($reworkType == 'invoice')
|
||||
{
|
||||
$this->records = LocatorInvoiceValidation::query()->where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->orderBy('created_at', 'asc')->get()// ->orderByDesc('created_at')
|
||||
->map(function ($record) {
|
||||
return [
|
||||
'created_at' => $record->created_at ?? '',
|
||||
'created_by' => $record->created_by ?? '',
|
||||
'serial_number' => $record->serial_number ?? '',
|
||||
'pallet_number' => $record->pallet_number ?? '',
|
||||
'locator_number' => $record->locator_number ?? '',
|
||||
'scanned_status' => $record->scanned_status ?? '',
|
||||
'scanned_at' => $record->scanned_at ?? '',
|
||||
'scanned_by' => $record->scanned_by ?? '',
|
||||
];
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
else if ($reworkType == 'pallet')
|
||||
{
|
||||
$this->records = PalletValidation::query()->where('plant_id', $plantId)->where('pallet_number', $palletNumber)->orderBy('scanned_at', 'asc')->get()
|
||||
->map(function ($record) {
|
||||
return [
|
||||
'created_at' => $record->created_at ?? '',
|
||||
'created_by' => $record->created_by ?? '',
|
||||
'serial_number' => $record->serial_number ?? '',
|
||||
// 'pallet_number' => $record->pallet_number,
|
||||
// 'locator_number' => $record->locator_number,
|
||||
// 'scanned_status' => $record->scanned_status,
|
||||
'scanned_at' => $record->scanned_at ?? '',
|
||||
'scanned_by' => $record->scanned_by ?? '',
|
||||
];
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->records = [];
|
||||
}
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.invoice-rework-data-table');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<x-filament::page>
|
||||
|
||||
<form wire:submit.prevent="create" class="space-y-6">
|
||||
{{-- Form Section --}}
|
||||
<div class="filament-form space-y-6">
|
||||
{{ $this->form }}
|
||||
</div>
|
||||
|
||||
{{-- Livewire Component (Invoice Table) --}}
|
||||
<div class="bg-white shadow rounded-xl p-4">
|
||||
<livewire:invoice-rework-data-table />
|
||||
</div>
|
||||
|
||||
|
||||
{{-- Heading after Livewire component (optional) --}}
|
||||
{{-- <h2>hello</h2> --}}
|
||||
|
||||
{{-- Actions --}}
|
||||
<div class="filament-actions mt-6">
|
||||
<x-filament::actions>
|
||||
@foreach ($this->getFormActions() as $action)
|
||||
{{ $action }}
|
||||
@endforeach
|
||||
</x-filament::actions>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</x-filament::page>
|
||||
86
resources/views/livewire/invoice-rework-data-table.blade.php
Normal file
86
resources/views/livewire/invoice-rework-data-table.blade.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<div class="p-4">
|
||||
@if ($reworkTyp == null || $reworkTyp == '')
|
||||
<h2 class="text-lg text-center font-bold mb-4 uppercase tracking-wider" style="padding-top: 10px">
|
||||
Choose 'Plant and Rework Type' then scan valid 'Invoice or Pallet' number to proceed..!
|
||||
</h2>
|
||||
@elseif ($reworkTyp == 'invoice')
|
||||
{{-- No data available for the selected plant and production order! --}}
|
||||
<h2 class="text-lg font-bold mb-4 text-gray-700 uppercase tracking-wider">
|
||||
REWORK INVOICE 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">Serial Number</th>
|
||||
<th class="border px-4 py-2">Pallet Number</th>
|
||||
<th class="border px-4 py-2">Locator Number</th>
|
||||
<th class="border px-4 py-2">Scanned Status</th>
|
||||
<th class="border px-4 py-2">Scanned Datetime</th>
|
||||
<th class="border px-4 py-2">Scanned By</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-100">
|
||||
@forelse ($records as $index => $record)
|
||||
<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">{{ $record['created_at'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $record['created_by'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $record['serial_number'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $record['pallet_number'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['locator_number'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $record['scanned_status'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['scanned_at'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $record['scanned_by'] ?? '' }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="9" class="px-4 py-4 text-center text-gray-500">
|
||||
No records found.
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@elseif ($reworkTyp == 'pallet')
|
||||
<h2 class="text-lg font-bold mb-4 text-gray-700 uppercase tracking-wider">
|
||||
REWORK PALLET 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">Serial Number</th>
|
||||
<th class="border px-4 py-2">Scanned Datetime</th>
|
||||
<th class="border px-4 py-2">Scanned By</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-100">
|
||||
@forelse ($records as $index => $record)
|
||||
<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">{{ $record['created_at'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $record['created_by'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $record['serial_number'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['scanned_at'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $record['scanned_by'] ?? '' }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="9" class="px-4 py-4 text-center text-gray-500">
|
||||
No records found.
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
Reference in New Issue
Block a user