Compare commits
90 Commits
2f84b269a1
...
renovate/a
| Author | SHA1 | Date | |
|---|---|---|---|
| 961c281c02 | |||
| 62e577a87f | |||
|
|
dbd7c2860f | ||
| 651f25b8de | |||
|
|
8bf3bfc3f8 | ||
| 7106d2aa13 | |||
|
|
0561a2443e | ||
| ad35a64869 | |||
|
|
6d4ed2a384 | ||
| 4b06a32893 | |||
|
|
692a114f4b | ||
|
|
b6ea3b87ca | ||
| 02c3a9aff0 | |||
|
|
8009117456 | ||
| 8bba768cb3 | |||
|
|
d1eaa86fe1 | ||
| 5ddf314503 | |||
|
|
fb8016d374 | ||
| c8638db7a6 | |||
|
|
3f697d67f5 | ||
|
|
cd1c8ff957 | ||
|
|
4916d622bd | ||
|
|
118ca4d7a9 | ||
|
|
c1f9534465 | ||
| 631c2f4095 | |||
|
|
edbbe138a3 | ||
| 38a6395530 | |||
|
|
6f9b19289a | ||
| 10092bef65 | |||
|
|
d467543e67 | ||
| 414e51b4bf | |||
|
|
aa4a9f68fa | ||
| 3c8fd7b3d6 | |||
|
|
d6a683b9c1 | ||
| a41756f819 | |||
|
|
1d3411e033 | ||
| 73616984b3 | |||
|
|
59eae005eb | ||
| 906b6c2a83 | |||
|
|
f6179a0143 | ||
| 32b213a464 | |||
|
|
aea402cd4c | ||
| 7fbeead3dd | |||
|
|
a6b29e07bb | ||
|
|
8f32671db6 | ||
| b39c298fb4 | |||
|
|
fe5630e7b0 | ||
| cb12cec5af | |||
|
|
107d356745 | ||
| dca11f0349 | |||
|
|
dd56cd7aae | ||
| 835a928ff3 | |||
|
|
d275fb9407 | ||
| 7aee42cc5d | |||
|
|
1f1b690515 | ||
| 0de8916f02 | |||
|
|
56ae97d2a3 | ||
| 105295350b | |||
|
|
41d31fcf3d | ||
| ac1ca537ef | |||
|
|
5e86a51fa5 | ||
| 207527491e | |||
|
|
188cfdac4d | ||
| 7aa244886b | |||
|
|
8f3dfbc290 | ||
| 5189ece56b | |||
|
|
a294ca3ef0 | ||
| bbecb86dc3 | |||
|
|
fdc0aed31c | ||
| a3cec9db06 | |||
|
|
947aacb074 | ||
| 0c6331282e | |||
|
|
b7b5db068b | ||
| 7d8b2d8632 | |||
|
|
d42ae70e46 | ||
|
|
be2e7b00d7 | ||
| 7276765aa4 | |||
|
|
1ce7995105 | ||
| 164a1becac | |||
|
|
d5cd1437fe | ||
| 6ad91c8c96 | |||
|
|
d4d101c5c9 | ||
| a6496b59c1 | |||
|
|
b8cb0aa237 | ||
| 027bacbce8 | |||
|
|
eef42d9736 | ||
| 6a87067387 | |||
|
|
3316c11036 | ||
| 4ac1e9f7c7 | |||
|
|
bf22ef5af0 |
68
app/Exports/SerialExport.php
Normal file
68
app/Exports/SerialExport.php
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Exports;
|
||||||
|
|
||||||
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Cell\Cell;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Cell\DataType;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithCustomValueBinder;
|
||||||
|
|
||||||
|
class SerialExport extends DefaultValueBinder implements FromCollection, WithHeadings, WithCustomValueBinder
|
||||||
|
, WithColumnFormatting
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Support\Collection
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected $itemCode;
|
||||||
|
protected $fromSerial;
|
||||||
|
protected $toSerial;
|
||||||
|
|
||||||
|
public function __construct($itemCode, $fromSerial, $toSerial)
|
||||||
|
{
|
||||||
|
$this->itemCode = $itemCode;
|
||||||
|
$this->fromSerial = $fromSerial;
|
||||||
|
$this->toSerial = $toSerial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bindValue(Cell $cell, $value)
|
||||||
|
{
|
||||||
|
$cell->setValueExplicit((string) $value, DataType::TYPE_STRING);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function collection()
|
||||||
|
{
|
||||||
|
$rows = [];
|
||||||
|
|
||||||
|
for ($i = $this->fromSerial; $i <= $this->toSerial; $i++) {
|
||||||
|
$rows[] = [
|
||||||
|
'item_code' => $this->itemCode,
|
||||||
|
'serial_number' => str_pad($i, 6, '0', STR_PAD_LEFT),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Collection($rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function columnFormats(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'B' => NumberFormat::FORMAT_TEXT,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function headings(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'Item Code',
|
||||||
|
'Serial Number',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
60
app/Filament/Exports/PanelGrMasterExporter.php
Normal file
60
app/Filament/Exports/PanelGrMasterExporter.php
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Exports;
|
||||||
|
|
||||||
|
use App\Models\PanelGrMaster;
|
||||||
|
use Filament\Actions\Exports\ExportColumn;
|
||||||
|
use Filament\Actions\Exports\Exporter;
|
||||||
|
use Filament\Actions\Exports\Models\Export;
|
||||||
|
|
||||||
|
class PanelGrMasterExporter extends Exporter
|
||||||
|
{
|
||||||
|
protected static ?string $model = PanelGrMaster::class;
|
||||||
|
|
||||||
|
public static function getColumns(): array
|
||||||
|
{
|
||||||
|
static $rowNumber = 0;
|
||||||
|
return [
|
||||||
|
ExportColumn::make('no')
|
||||||
|
->label('NO')
|
||||||
|
->state(function ($record) use (&$rowNumber) {
|
||||||
|
// Increment and return the row number
|
||||||
|
return ++$rowNumber;
|
||||||
|
}),
|
||||||
|
ExportColumn::make('plant.name')
|
||||||
|
->label('PLANT NAME'),
|
||||||
|
ExportColumn::make('item.code')
|
||||||
|
->label('ITEM CODE'),
|
||||||
|
ExportColumn::make('document_number')
|
||||||
|
->label('DOCUMENT NUMBER'),
|
||||||
|
ExportColumn::make('invoice_number')
|
||||||
|
->label('INVOICE NUMBER'),
|
||||||
|
ExportColumn::make('supplier_number')
|
||||||
|
->label('SUPPLIER NUMBER'),
|
||||||
|
ExportColumn::make('quantity')
|
||||||
|
->label('QUANTITY'),
|
||||||
|
ExportColumn::make('created_at')
|
||||||
|
->label('CREATED AT'),
|
||||||
|
ExportColumn::make('updated_at')
|
||||||
|
->label('UPDATED AT'),
|
||||||
|
ExportColumn::make('created_by')
|
||||||
|
->label('CREATED BY'),
|
||||||
|
ExportColumn::make('updated_by')
|
||||||
|
->label('UPDATED BY'),
|
||||||
|
ExportColumn::make('deleted_at')
|
||||||
|
->label('DELETED AT')
|
||||||
|
->enabledByDefault(false),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCompletedNotificationBody(Export $export): string
|
||||||
|
{
|
||||||
|
$body = 'Your panel gr master export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||||
|
|
||||||
|
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||||
|
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $body;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,8 +39,6 @@ class ProductionCharacteristicExporter extends Exporter
|
|||||||
->label('OBSERVED VALUE'),
|
->label('OBSERVED VALUE'),
|
||||||
ExportColumn::make('status')
|
ExportColumn::make('status')
|
||||||
->label('STATUS'),
|
->label('STATUS'),
|
||||||
ExportColumn::make('inspection_status')
|
|
||||||
->label('INSPECTION STATUS'),
|
|
||||||
ExportColumn::make('remark')
|
ExportColumn::make('remark')
|
||||||
->label('REMARK'),
|
->label('REMARK'),
|
||||||
ExportColumn::make('created_at')
|
ExportColumn::make('created_at')
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class WeightValidationExporter extends Exporter
|
|||||||
ExportColumn::make('item.code')
|
ExportColumn::make('item.code')
|
||||||
->label('ITEM CODE'),
|
->label('ITEM CODE'),
|
||||||
ExportColumn::make('obd_number')
|
ExportColumn::make('obd_number')
|
||||||
->label('OBD NUMBER'),
|
->label('OBD / GR NUMBER'),
|
||||||
ExportColumn::make('line_number')
|
ExportColumn::make('line_number')
|
||||||
->label('LINE NUMBER'),
|
->label('LINE NUMBER'),
|
||||||
ExportColumn::make('batch_number')
|
ExportColumn::make('batch_number')
|
||||||
@@ -41,7 +41,7 @@ class WeightValidationExporter extends Exporter
|
|||||||
ExportColumn::make('vehicle_number')
|
ExportColumn::make('vehicle_number')
|
||||||
->label('VEHICLE NUMBER'),
|
->label('VEHICLE NUMBER'),
|
||||||
ExportColumn::make('bundle_number')
|
ExportColumn::make('bundle_number')
|
||||||
->label('BUNDLE NUMBER'),
|
->label('BUNDLE / COIL NUMBER'),
|
||||||
ExportColumn::make('picked_weight')
|
ExportColumn::make('picked_weight')
|
||||||
->label('PICKED WEIGHT'),
|
->label('PICKED WEIGHT'),
|
||||||
ExportColumn::make('scanned_by')
|
ExportColumn::make('scanned_by')
|
||||||
|
|||||||
146
app/Filament/Imports/PanelGrMasterImporter.php
Normal file
146
app/Filament/Imports/PanelGrMasterImporter.php
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Imports;
|
||||||
|
|
||||||
|
use App\Models\Item;
|
||||||
|
use App\Models\PanelGrMaster;
|
||||||
|
use App\Models\Plant;
|
||||||
|
use Filament\Actions\Imports\ImportColumn;
|
||||||
|
use Filament\Actions\Imports\Importer;
|
||||||
|
use Filament\Actions\Imports\Models\Import;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
|
use Str;
|
||||||
|
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||||
|
|
||||||
|
class PanelGrMasterImporter extends Importer
|
||||||
|
{
|
||||||
|
protected static ?string $model = PanelGrMaster::class;
|
||||||
|
|
||||||
|
public static function getColumns(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
ImportColumn::make('plant')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Plant Code')
|
||||||
|
->example('1000')
|
||||||
|
->label('Plant Code')
|
||||||
|
->relationship(resolveUsing: 'code')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('item')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Item Code')
|
||||||
|
->example('630214')
|
||||||
|
->label('Item Code')
|
||||||
|
->relationship(resolveUsing: 'code')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('document_number')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Document Number')
|
||||||
|
->example('11023567')
|
||||||
|
->label('Document Number')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('invoice_number')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Invoice Number')
|
||||||
|
->example('3RAW0012345')
|
||||||
|
->label('Invoice Number')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('supplier_number')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Supplier Number')
|
||||||
|
->example('154564564')
|
||||||
|
->label('Supplier Number')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('quantity')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Quantity')
|
||||||
|
->example('10')
|
||||||
|
->label('Quantity')
|
||||||
|
->rules(['required']),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resolveRecord(): ?PanelGrMaster
|
||||||
|
{
|
||||||
|
$warnMsg = [];
|
||||||
|
$plantCod = $this->data['plant'];
|
||||||
|
$plant = null;
|
||||||
|
$item = null;
|
||||||
|
$userName = Filament::auth()->user()?->name;
|
||||||
|
|
||||||
|
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
||||||
|
$warnMsg[] = 'Invalid plant code found';
|
||||||
|
} else {
|
||||||
|
$plant = Plant::where('code', $plantCod)->first();
|
||||||
|
if (! $plant) {
|
||||||
|
$warnMsg[] = 'Plant not found';
|
||||||
|
} else {
|
||||||
|
$item = Item::where('code', $this->data['item'])->where('plant_id', $plant->id)->first();
|
||||||
|
}
|
||||||
|
if (! $item) {
|
||||||
|
$warnMsg[] = 'Item not found';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->data['document_number'])) {
|
||||||
|
$warnMsg[] = 'Document Number cannot be empty.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Str::length($this->data['invoice_number']) < 7 || ! ctype_alnum($this->data['invoice_number'])) {
|
||||||
|
$warnMsg[] = 'Invalid invoice number found';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->data['supplier_number'])) {
|
||||||
|
$warnMsg[] = 'Supplier Number cannot be empty.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->data['quantity'])) {
|
||||||
|
$warnMsg[] = 'Quantity cannot be empty.';
|
||||||
|
}
|
||||||
|
elseif (!is_numeric($this->data['quantity'])) {
|
||||||
|
$warnMsg[] = 'Quantity must be a valid number.';
|
||||||
|
} elseif ((float) $this->data['quantity'] <= 0) {
|
||||||
|
$warnMsg[] = 'Quantity must be greater than 0.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$existingRecord = PanelGrMaster::where('document_number', $this->data['document_number'])->where('plant_id', $this->data['plant'])->first();
|
||||||
|
|
||||||
|
if ($existingRecord && $existingRecord->invoice_number != $this->data['invoice_number'])
|
||||||
|
{
|
||||||
|
$warnMsg[] = "Document Number '{$this->data['document_number']}' is already associated with Invoice Number '{$existingRecord->invoice_number}'.";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($warnMsg)) {
|
||||||
|
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||||
|
}
|
||||||
|
|
||||||
|
PanelGrMaster::updateOrCreate(
|
||||||
|
[
|
||||||
|
'plant_id' => $plant->id,
|
||||||
|
'item_id' => $item->id,
|
||||||
|
'document_number' => $this->data['document_number'],
|
||||||
|
'invoice_number' => $this->data['invoice_number'],
|
||||||
|
'supplier_number' => $this->data['supplier_number'] ?? null,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'quantity' => $this->data['quantity'] ?? null,
|
||||||
|
'updated_by' => $userName,
|
||||||
|
'created_by' => $userName, // Only used when creating
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
// return new PanelGrMaster();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCompletedNotificationBody(Import $import): string
|
||||||
|
{
|
||||||
|
$body = 'Your panel gr master import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||||
|
|
||||||
|
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||||
|
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $body;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -128,7 +128,8 @@ class CycleCount extends Page
|
|||||||
$operatorName = $user->name;
|
$operatorName = $user->name;
|
||||||
|
|
||||||
$pattern1 = '/^[^#]*#[^#]*#[^#]*#[^#]*#$/';
|
$pattern1 = '/^[^#]*#[^#]*#[^#]*#[^#]*#$/';
|
||||||
$pattern2 = '/^[^|]*\|[^|]*\|[^|]*$/';
|
// $pattern2 = '/^[^|]*\|[^|]*\|[^|]*$/';
|
||||||
|
$pattern2 = '/^[^|]+\|[^|]+(?:\|[^|]*)?$/';
|
||||||
$pattern3 = '/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPp])?\|?$/';
|
$pattern3 = '/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPp])?\|?$/';
|
||||||
|
|
||||||
// $pattern2 = '/^[^|]+\|[^|]+\|[^|]+\|?$/'; Optional Pipeline at end
|
// $pattern2 = '/^[^|]+\|[^|]+\|[^|]+\|?$/'; Optional Pipeline at end
|
||||||
@@ -678,7 +679,7 @@ class CycleCount extends Page
|
|||||||
$stock->update([
|
$stock->update([
|
||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
// 'doc_no' =>$this->docNo,
|
'doc_no' =>$this->docNo,
|
||||||
'scanned_quantity' => $newScannedQty,
|
'scanned_quantity' => $newScannedQty,
|
||||||
'scanned_status' => $status,
|
'scanned_status' => $status,
|
||||||
]);
|
]);
|
||||||
@@ -721,13 +722,28 @@ class CycleCount extends Page
|
|||||||
$parts = explode('|', $value);
|
$parts = explode('|', $value);
|
||||||
|
|
||||||
$this->itemCode = $parts[0] ?? null;
|
$this->itemCode = $parts[0] ?? null;
|
||||||
if (strlen($parts[1]) > strlen($parts[2])) {
|
|
||||||
|
if (count($parts) == 2) {
|
||||||
|
// Format: itemcode|serialnumber
|
||||||
$this->sNo = $parts[1];
|
$this->sNo = $parts[1];
|
||||||
$this->batch = $parts[2];
|
$this->batch = null;
|
||||||
} else {
|
} else {
|
||||||
$this->batch = $parts[1];
|
// Format: itemcode|value1|value2
|
||||||
$this->sNo = $parts[2];
|
if (strlen($parts[1]) > strlen($parts[2])) {
|
||||||
|
$this->sNo = $parts[1];
|
||||||
|
$this->batch = $parts[2];
|
||||||
|
} else {
|
||||||
|
$this->batch = $parts[1];
|
||||||
|
$this->sNo = $parts[2];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// if (strlen($parts[1]) > strlen($parts[2])) {
|
||||||
|
// $this->sNo = $parts[1];
|
||||||
|
// $this->batch = $parts[2];
|
||||||
|
// } else {
|
||||||
|
// $this->batch = $parts[1];
|
||||||
|
// $this->sNo = $parts[2];
|
||||||
|
// }
|
||||||
|
|
||||||
if (strlen($this->itemCode) < 6) {
|
if (strlen($this->itemCode) < 6) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
@@ -759,7 +775,7 @@ class CycleCount extends Page
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} elseif (strlen($this->batch) < 5) {
|
} elseif (count($parts) !== 2 && strlen($this->batch) < 5) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Unknown Batch')
|
->title('Unknown Batch')
|
||||||
->body("Batch should contain minimum 5 digits '$this->batch'")
|
->body("Batch should contain minimum 5 digits '$this->batch'")
|
||||||
@@ -927,7 +943,7 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'serial_number' => $this->sNo,
|
'serial_number' => $this->sNo,
|
||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch ?? null,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity,
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
@@ -1240,7 +1256,7 @@ class CycleCount extends Page
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($serialAgaPlant->batch != '' || $serialAgaPlant->batch != null) {
|
if (count($parts) !== 2 && ($serialAgaPlant->batch != '' || $serialAgaPlant->batch != null)){
|
||||||
|
|
||||||
if ($serialAgaPlant->batch != $this->batch) {
|
if ($serialAgaPlant->batch != $this->batch) {
|
||||||
|
|
||||||
@@ -1396,7 +1412,7 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'serial_number' => $this->sNo,
|
'serial_number' => $this->sNo,
|
||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch ?? null,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity,
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
@@ -1415,8 +1431,8 @@ class CycleCount extends Page
|
|||||||
|
|
||||||
$serial->update([
|
$serial->update([
|
||||||
'bin' => $bin ?? null,
|
'bin' => $bin ?? null,
|
||||||
'batch' => $this->batch ?? null,
|
'batch' => count($parts) !== 2 ? $this->batch : $serial->batch,
|
||||||
'doc_no' => $this->docNo ?? null,
|
// 'doc_no' => $this->docNo ?? null,
|
||||||
'scanned_status' => 'Scanned',
|
'scanned_status' => 'Scanned',
|
||||||
'scanned_quantity' => '1',
|
'scanned_quantity' => '1',
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
@@ -2132,6 +2148,7 @@ class CycleCount extends Page
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
protected function getHeaderActions(): array
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ use Filament\Facades\Filament;
|
|||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
use Filament\Forms\Components\Actions\Action;
|
use Filament\Forms\Components\Actions\Action;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Forms\Get;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
@@ -39,18 +40,32 @@ class EquipmentMasterResource extends Resource
|
|||||||
return $form
|
return $form
|
||||||
->schema([
|
->schema([
|
||||||
Forms\Components\Select::make('plant_id')
|
Forms\Components\Select::make('plant_id')
|
||||||
->label('Plant')
|
->label('Plant Name')
|
||||||
->reactive()
|
|
||||||
->relationship('plant', 'name')
|
->relationship('plant', 'name')
|
||||||
|
->required()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->required(),
|
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$set('machine_id', null);
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
})
|
||||||
|
->default(function () {
|
||||||
|
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? $userHas : optional(EquipmentMaster::latest()->first())->plant_id;
|
||||||
|
}),
|
||||||
Forms\Components\Select::make('machine_id')
|
Forms\Components\Select::make('machine_id')
|
||||||
// ->relationship('machine', 'name')
|
// ->relationship('machine', 'name')
|
||||||
->label('Work Center')
|
->label('Work Center')
|
||||||
|
->required()
|
||||||
|
->searchable()
|
||||||
->reactive()
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
@@ -60,15 +75,30 @@ class EquipmentMasterResource extends Resource
|
|||||||
|
|
||||||
return \App\Models\Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
return \App\Models\Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||||
})
|
})
|
||||||
->required(),
|
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
Forms\Components\TextInput::make('name')
|
Forms\Components\TextInput::make('name')
|
||||||
->label('Name'),
|
->label('Name')
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
Forms\Components\TextInput::make('description')
|
Forms\Components\TextInput::make('description')
|
||||||
->label('Description'),
|
->label('Description')
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
Forms\Components\TextInput::make('make')
|
Forms\Components\TextInput::make('make')
|
||||||
->label('Make'),
|
->label('Make')
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
Forms\Components\TextInput::make('model')
|
Forms\Components\TextInput::make('model')
|
||||||
->label('Model'),
|
->label('Model')
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
Forms\Components\TextInput::make('equipment_number')
|
Forms\Components\TextInput::make('equipment_number')
|
||||||
->label('Equipment Number')
|
->label('Equipment Number')
|
||||||
->reactive()
|
->reactive()
|
||||||
@@ -82,6 +112,8 @@ class EquipmentMasterResource extends Resource
|
|||||||
];
|
];
|
||||||
})
|
})
|
||||||
->afterStateUpdated(function ($state, callable $set) {
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
|
||||||
if (! $state) {
|
if (! $state) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -108,7 +140,10 @@ class EquipmentMasterResource extends Resource
|
|||||||
// }
|
// }
|
||||||
// }),
|
// }),
|
||||||
Forms\Components\TextInput::make('instrument_serial_number')
|
Forms\Components\TextInput::make('instrument_serial_number')
|
||||||
->label('Instrument Serial Number'),
|
->label('Instrument Serial Number')
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
// Forms\Components\DateTimePicker::make('calibrated_on')
|
// Forms\Components\DateTimePicker::make('calibrated_on')
|
||||||
// ->label('Calibrated On')
|
// ->label('Calibrated On')
|
||||||
// ->required(),
|
// ->required(),
|
||||||
@@ -128,6 +163,7 @@ class EquipmentMasterResource extends Resource
|
|||||||
$frequency = $get('frequency') ?? '1';
|
$frequency = $get('frequency') ?? '1';
|
||||||
$nextDate = self::calculateNextCalibrationDate($state, $frequency);
|
$nextDate = self::calculateNextCalibrationDate($state, $frequency);
|
||||||
$set('next_calibration_date', $nextDate);
|
$set('next_calibration_date', $nextDate);
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
// ->afterStateUpdated(function ($state, callable $get, callable $set) {
|
// ->afterStateUpdated(function ($state, callable $get, callable $set) {
|
||||||
// $frequency = (int) $get('frequency');
|
// $frequency = (int) $get('frequency');
|
||||||
@@ -152,6 +188,7 @@ class EquipmentMasterResource extends Resource
|
|||||||
$calibratedOn = $get('calibrated_on');
|
$calibratedOn = $get('calibrated_on');
|
||||||
$nextDate = self::calculateNextCalibrationDate($calibratedOn, $state);
|
$nextDate = self::calculateNextCalibrationDate($calibratedOn, $state);
|
||||||
$set('next_calibration_date', $nextDate);
|
$set('next_calibration_date', $nextDate);
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
// ->afterStateUpdated(function ($state, callable $get, callable $set) {
|
// ->afterStateUpdated(function ($state, callable $get, callable $set) {
|
||||||
// $calibratedOn = $get('calibrated_on');
|
// $calibratedOn = $get('calibrated_on');
|
||||||
@@ -171,12 +208,21 @@ class EquipmentMasterResource extends Resource
|
|||||||
Forms\Components\DateTimePicker::make('next_calibration_date')
|
Forms\Components\DateTimePicker::make('next_calibration_date')
|
||||||
->label('Next Calibration Date')
|
->label('Next Calibration Date')
|
||||||
->readOnly()
|
->readOnly()
|
||||||
->required(),
|
->required()
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('calibrated_by')
|
Forms\Components\TextInput::make('calibrated_by')
|
||||||
->label('Calibrated By'),
|
->label('Calibrated By')
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
Forms\Components\Textarea::make('calibration_certificate')
|
Forms\Components\Textarea::make('calibration_certificate')
|
||||||
->label('Calibration Certificate'),
|
->label('Calibration Certificate')
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
|
|
||||||
Forms\Components\FileUpload::make('attachment')
|
Forms\Components\FileUpload::make('attachment')
|
||||||
->label('PDF Upload')
|
->label('PDF Upload')
|
||||||
@@ -185,7 +231,10 @@ class EquipmentMasterResource extends Resource
|
|||||||
->disk('local')
|
->disk('local')
|
||||||
->directory('uploads/temp')
|
->directory('uploads/temp')
|
||||||
->preserveFilenames()
|
->preserveFilenames()
|
||||||
->reactive(),
|
->reactive()
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
|
|
||||||
// Forms\Components\Actions::make([
|
// Forms\Components\Actions::make([
|
||||||
// Action::make('uploadNow')
|
// Action::make('uploadNow')
|
||||||
@@ -341,7 +390,11 @@ class EquipmentMasterResource extends Resource
|
|||||||
->label('Created By')
|
->label('Created By')
|
||||||
->default(Filament::auth()->user()?->name),
|
->default(Filament::auth()->user()?->name),
|
||||||
Forms\Components\Hidden::make('updated_by')
|
Forms\Components\Hidden::make('updated_by')
|
||||||
->label('Updated By'),
|
->label('Updated By')
|
||||||
|
->default(Filament::auth()->user()?->name),
|
||||||
|
Forms\Components\TextInput::make('id')
|
||||||
|
->hidden()
|
||||||
|
->readOnly(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,7 +412,7 @@ class EquipmentMasterResource extends Resource
|
|||||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||||
}),
|
}),
|
||||||
Tables\Columns\TextColumn::make('plant.name')
|
Tables\Columns\TextColumn::make('plant.name')
|
||||||
->label('Plant')
|
->label('Plant Name')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('machine.work_center')
|
Tables\Columns\TextColumn::make('machine.work_center')
|
||||||
@@ -413,24 +466,30 @@ class EquipmentMasterResource extends Resource
|
|||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('created_by')
|
Tables\Columns\TextColumn::make('created_by')
|
||||||
->label('Created Bys')
|
->label('Created By')
|
||||||
->alignCenter()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('updated_by')
|
|
||||||
->label('Updated By')
|
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('created_at')
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
->label('Created At')
|
->label('Created At')
|
||||||
->dateTime()
|
->dateTime()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('updated_by')
|
||||||
|
->label('Updated By')
|
||||||
|
->alignCenter()
|
||||||
->sortable()
|
->sortable()
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
->toggleable(isToggledHiddenByDefault: false),
|
||||||
Tables\Columns\TextColumn::make('updated_at')
|
Tables\Columns\TextColumn::make('updated_at')
|
||||||
->label('Updated At')
|
->label('Updated At')
|
||||||
->dateTime()
|
->dateTime()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable()
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: false),
|
||||||
|
Tables\Columns\TextColumn::make('deleted_at')
|
||||||
|
->label('Deleted At')
|
||||||
|
->dateTime()
|
||||||
|
->alignCenter()
|
||||||
|
->sortable()
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ class GuardPatrolEntryResource extends Resource
|
|||||||
Forms\Components\TextInput::make('check_point_name')
|
Forms\Components\TextInput::make('check_point_name')
|
||||||
->label('Check Point Name')
|
->label('Check Point Name')
|
||||||
->required()
|
->required()
|
||||||
|
->autofocus()
|
||||||
->reactive()
|
->reactive()
|
||||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
@@ -202,7 +203,7 @@ class GuardPatrolEntryResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
$set('check_point_name_id', $checkPoint->id);
|
$set('check_point_name_id', $checkPoint->id);
|
||||||
$set('patrol_time', now()->format('Y-m-d H:i:s'));
|
$set('patrol_time', now());
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
$set('gPeCheckPointNameError', null);
|
$set('gPeCheckPointNameError', null);
|
||||||
})
|
})
|
||||||
@@ -221,11 +222,11 @@ class GuardPatrolEntryResource extends Resource
|
|||||||
}
|
}
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\DateTimePicker::make('patrol_time')
|
Forms\Components\Hidden::make('patrol_time')
|
||||||
->label('Patrol Time')
|
->label('Patrol Time')
|
||||||
->reactive()
|
->reactive()
|
||||||
->default(fn () => now())
|
->default(fn () => now())
|
||||||
->readOnly(fn (Get $get) => ! $get('id'))
|
// ->readOnly(fn (Get $get) => ! $get('id'))
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ use App\Models\Item;
|
|||||||
use App\Models\Line;
|
use App\Models\Line;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use App\Models\StickerMaster;
|
use App\Models\StickerMaster;
|
||||||
|
use App\Models\PanelGrMaster;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use App\Mail\InvalidQualityMail;
|
use App\Mail\InvalidQualityMail;
|
||||||
@@ -134,6 +135,7 @@ class PanelBoxValidationResource extends Resource
|
|||||||
// ->relationship('stickerMaster', 'id')
|
// ->relationship('stickerMaster', 'id')
|
||||||
->required(),
|
->required(),
|
||||||
Forms\Components\TextInput::make('production_order')
|
Forms\Components\TextInput::make('production_order')
|
||||||
|
->label('Production Order\Doc No')
|
||||||
->placeholder('Scan the valid Production Order')
|
->placeholder('Scan the valid Production Order')
|
||||||
->minLength(7)
|
->minLength(7)
|
||||||
->maxLength(14)
|
->maxLength(14)
|
||||||
@@ -142,7 +144,7 @@ class PanelBoxValidationResource extends Resource
|
|||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
if (! is_numeric($get('production_order')) || ! preg_match('/^[1-9][0-9]{6,13}$/', $get('production_order'))) {
|
if (! is_numeric($get('production_order')) || ! preg_match('/^[1-9][0-9]{6,13}$/', $get('production_order'))) {
|
||||||
$set('prodOrdError', 'Must be a numeric value with 7 to 14 digits.');
|
$set('prodOrdError', 'Must be a numeric value with 7 to 14 digits.');
|
||||||
$set('production_order', null);
|
// $set('production_order', null);
|
||||||
$set('item_id', null);
|
$set('item_id', null);
|
||||||
$set('sticker_master_id', null);
|
$set('sticker_master_id', null);
|
||||||
$set('uom', null);
|
$set('uom', null);
|
||||||
@@ -185,6 +187,7 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$set('validation1_image_url', null);
|
$set('validation1_image_url', null);
|
||||||
$set('serialPanelConfirmed', false);
|
$set('serialPanelConfirmed', false);
|
||||||
|
|
||||||
|
|
||||||
if (! $pId) {
|
if (! $pId) {
|
||||||
$set('pqLineError', 'Please select a line.');
|
$set('pqLineError', 'Please select a line.');
|
||||||
} else {
|
} else {
|
||||||
@@ -227,7 +230,6 @@ class PanelBoxValidationResource extends Resource
|
|||||||
// Proceed with validation logic for new scanned QR code
|
// Proceed with validation logic for new scanned QR code
|
||||||
if (! $state || trim($state) == '') {
|
if (! $state || trim($state) == '') {
|
||||||
$set('validationError', null);
|
$set('validationError', null);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,48 +277,105 @@ class PanelBoxValidationResource extends Resource
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
|
$existInMasterPo = PanelGrMaster::where('document_number', $pOrder)->where('plant_id', $plantId)->first();
|
||||||
|
|
||||||
|
if(!$existInMasterPo){
|
||||||
|
Notification::make()
|
||||||
|
->title('Panel GR Record')
|
||||||
|
->body("Production Order (Or) Doc No'{$pOrder}' not found against plant code '{$plaCode}' in Panel Gr master.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$iId = Item::where('code', $iCode)->where('plant_id', $plantId)->first();
|
||||||
|
|
||||||
|
if(!$iId){
|
||||||
|
Notification::make()
|
||||||
|
->title('Item not found')
|
||||||
|
->body("Item code'{$iCode}' not found against plant code '{$plaCode}' in item master.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$existInMaster = PanelGrMaster::where('document_number', $pOrder)->where('item_id', $iId->id)->where('plant_id', $plantId)->first();
|
||||||
|
|
||||||
|
if(!$existInMaster){
|
||||||
|
Notification::make()
|
||||||
|
->title('Panel GR Record Not Found')
|
||||||
|
->body("No Panel GR record found for Production Order (Or) Doc No'{$pOrder}' and for Item '{$iCode}'.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if($existInMaster->supplier_number == '' || $existInMaster->supplier_number == null){
|
||||||
|
Notification::make()
|
||||||
|
->title('Panel GR Found')
|
||||||
|
->body("Supplier Number cannot be empty Panel GR record found for Production Order '{$pOrder}' and Item '{$iCode}'.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// else if($existInMaster->supplier_number != $supplier){
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Panel GR Found')
|
||||||
|
// ->body("Supplier code not match for Production Order (Or) Doc No'{$pOrder}' and Item '{$iCode}'.")
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
// $set('item_id', null);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
else if($existInMaster->quantity == '' || $existInMaster->quantity == null){
|
||||||
|
Notification::make()
|
||||||
|
->title('Panel GR Found')
|
||||||
|
->body("Quantity cannot be empty Panel GR record found for Production Order '{$pOrder}' and Item '{$iCode}'.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if($existInMaster->invoice_number == '' || $existInMaster->invoice_number == null){
|
||||||
|
Notification::make()
|
||||||
|
->title('Panel GR Found')
|
||||||
|
->body("Invoice Number cannot be empty Panel GR record found for Production Order '{$pOrder}' and Item '{$iCode}'.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sticker = StickerMaster::where('plant_id', $plantId)->where('item_id', $iId->id)->first();
|
||||||
|
|
||||||
|
if(!$sticker){
|
||||||
|
Notification::make()
|
||||||
|
->title('Unknown Item Code')
|
||||||
|
->body("Item code not found '{$iId->code}' in sticker master.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
}
|
||||||
|
|
||||||
|
$existQuanInPanel = PanelBoxValidation::where('plant_id', $plantId)->where('production_order', $pOrder)->where('sticker_master_id', $sticker->id)->count();
|
||||||
|
|
||||||
|
if ($existQuanInPanel >= (int) $existInMaster->quantity) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Quantity Completed')
|
||||||
|
->body("Panel box quantity '{$existQuanInPanel}' exceeds the available quantity '{$existInMaster->quantity}' in Panel GR Master for Production Order '{$pOrder}' and Item '{$iCode}'.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$set('validationError', null);
|
$set('validationError', null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if ($state && str_contains($state, '|')) {
|
|
||||||
|
|
||||||
// $parts = explode('|', $state);
|
|
||||||
|
|
||||||
// $itemCode = trim($parts[0]); // Extract item code // 123456|123456789
|
|
||||||
|
|
||||||
// $serialNumber = trim($parts[1]);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// // $parts = explode('/', $state);
|
|
||||||
|
|
||||||
// // $itemCode = trim($parts[1] ?? ''); // item code
|
|
||||||
// // $serialNumber = trim($parts[2] ?? ''); // serial number
|
|
||||||
|
|
||||||
// $parts = array_map('trim', explode('/', $state));
|
|
||||||
|
|
||||||
// // Expected format: 121245/165467/2606/1002634
|
|
||||||
// if (count($parts) != 4) {
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('Invalid QR Format')
|
|
||||||
// ->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
|
||||||
// ->danger()
|
|
||||||
// ->send();
|
|
||||||
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $serialNumber = end($parts); // last part
|
|
||||||
|
|
||||||
// $itemCode = $parts[1] ?? '';
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Store serial number before resetting fields
|
|
||||||
|
|
||||||
|
|
||||||
if (str_contains($state, '|')) {
|
if (str_contains($state, '|')) {
|
||||||
|
|
||||||
$parts = array_map('trim', explode('|', $state));
|
$parts = array_map('trim', explode('|', $state));
|
||||||
@@ -350,6 +409,101 @@ class PanelBoxValidationResource extends Resource
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$existInMasterPo = PanelGrMaster::where('document_number', $pOrder)->where('plant_id', $plantId)->first();
|
||||||
|
|
||||||
|
if(!$existInMasterPo){
|
||||||
|
Notification::make()
|
||||||
|
->title('Panel GR Record')
|
||||||
|
->body("Production Order (Or) Doc No'{$pOrder}' not found against plant code '{$plaCode}' in Panel Gr master.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$iId = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
|
||||||
|
|
||||||
|
if(!$iId){
|
||||||
|
Notification::make()
|
||||||
|
->title('Item not found')
|
||||||
|
->body("Item code'{$itemCode}' not found against plant code '{$plaCode}' in item master.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$existInMaster = PanelGrMaster::where('document_number', $pOrder)->where('item_id', $iId->id)->where('plant_id', $plantId)->first();
|
||||||
|
|
||||||
|
if(!$existInMaster){
|
||||||
|
Notification::make()
|
||||||
|
->title('Panel GR Record Not Found')
|
||||||
|
->body("No Panel GR record found for Production Order (Or) Doc No'{$pOrder}' and for Item '{$itemCode}'.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if($existInMaster->supplier_number == '' || $existInMaster->supplier_number == null){
|
||||||
|
Notification::make()
|
||||||
|
->title('Panel GR Found')
|
||||||
|
->body("Supplier Number cannot be empty Panel GR record found for Production Order '{$pOrder}' and Item '{$itemCode}'.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// else if($existInMaster->supplier_number != $supplier){
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Panel GR Found')
|
||||||
|
// ->body("Supplier code not match for Production Order (Or) Doc No'{$pOrder}' and Item '{$iCode}'.")
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
// $set('item_id', null);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
else if($existInMaster->quantity == '' || $existInMaster->quantity == null){
|
||||||
|
Notification::make()
|
||||||
|
->title('Panel GR Found')
|
||||||
|
->body("Quantity cannot be empty Panel GR record found for Production Order '{$pOrder}' and Item '{$itemCode}'.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if($existInMaster->invoice_number == '' || $existInMaster->invoice_number == null){
|
||||||
|
Notification::make()
|
||||||
|
->title('Panel GR Found')
|
||||||
|
->body("Invoice Number cannot be empty Panel GR record found for Production Order '{$pOrder}' and Item '{$itemCode}'.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sticker = StickerMaster::where('plant_id', $plantId)->where('item_id', $iId->id)->first();
|
||||||
|
|
||||||
|
if(!$sticker){
|
||||||
|
Notification::make()
|
||||||
|
->title('Unknown Item Code')
|
||||||
|
->body("Item code not found '{$iId->code}' in sticker master.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
}
|
||||||
|
|
||||||
|
$existQuanInPanel = PanelBoxValidation::where('plant_id', $plantId)->where('production_order', $pOrder)->where('sticker_master_id', $sticker->id)->count();
|
||||||
|
|
||||||
|
if ($existQuanInPanel >= (int) $existInMaster->quantity) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Quantity Completed')
|
||||||
|
->body("Panel box quantity '{$existQuanInPanel}' exceeds the available quantity '{$existInMaster->quantity}' in Panel GR Master for Production Order '{$pOrder}' and Item '{$itemCode}'.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
elseif (str_contains($state, '/'))
|
elseif (str_contains($state, '/'))
|
||||||
{
|
{
|
||||||
@@ -371,6 +525,12 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$yearMonth = $parts[2];
|
$yearMonth = $parts[2];
|
||||||
$serialNumber = $parts[3];
|
$serialNumber = $parts[3];
|
||||||
|
|
||||||
|
$supplier = $parts[0];
|
||||||
|
$panelBoxCode = $parts[1];
|
||||||
|
$yearMonth = $parts[2];
|
||||||
|
$serialNumber = $parts[3];
|
||||||
|
$panelBoxSerialNo = $parts[2] . $parts[3];
|
||||||
|
|
||||||
if($serialNumber == '' || $serialNumber == null){
|
if($serialNumber == '' || $serialNumber == null){
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Unknown Serial number')
|
->title('Unknown Serial number')
|
||||||
@@ -381,20 +541,110 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$set('item_id', null);
|
$set('item_id', null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elseif (! ctype_alnum($serialNumber)) {
|
if (! ctype_alnum($serialNumber)) {
|
||||||
$set('validationError', 'Serial Number should contain alpha-numeric values.');
|
$set('validationError', 'Serial Number should contain alpha-numeric values.');
|
||||||
$set('item_id', null);
|
$set('item_id', null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if($plantCode != $plaCode){
|
|
||||||
|
$existInMasterPo = PanelGrMaster::where('document_number', $pOrder)->where('plant_id', $plantId)->first();
|
||||||
|
|
||||||
|
if(!$existInMasterPo){
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid Plant Code')
|
->title('Panel GR Record')
|
||||||
->body("Scanned plant code doesn't match the selected plant.")
|
->body("Production Order (Or) Doc No'{$pOrder}' not found against plant code '{$plaCode}' in Panel Gr master.")
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
$set('item_id', null);
|
$set('item_id', null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$iId = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
|
||||||
|
|
||||||
|
if(!$iId){
|
||||||
|
Notification::make()
|
||||||
|
->title('Item not found')
|
||||||
|
->body("Item code'{$itemCode}' not found against plant code '{$plaCode}' in item master.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$existInMaster = PanelGrMaster::where('document_number', $pOrder)->where('item_id', $iId->id)->where('plant_id', $plantId)->first();
|
||||||
|
|
||||||
|
if(!$existInMaster){
|
||||||
|
Notification::make()
|
||||||
|
->title('Panel GR Record Not Found')
|
||||||
|
->body("No Panel GR record found for Production Order (Or) Doc No'{$pOrder}' and for Item '{$itemCode}'.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if($existInMaster->supplier_number == '' || $existInMaster->supplier_number == null){
|
||||||
|
Notification::make()
|
||||||
|
->title('Panel GR Found')
|
||||||
|
->body("Supplier Number cannot be empty Panel GR record found for Production Order '{$pOrder}' and Item '{$itemCode}'.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if($existInMaster->supplier_number != $supplier){
|
||||||
|
Notification::make()
|
||||||
|
->title('Panel GR Found')
|
||||||
|
->body("Supplier code not match for Production Order (Or) Doc No'{$pOrder}' and Item '{$itemCode}'.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if($existInMaster->quantity == '' || $existInMaster->quantity == null){
|
||||||
|
Notification::make()
|
||||||
|
->title('Panel GR Found')
|
||||||
|
->body("Quantity cannot be empty Panel GR record found for Production Order '{$pOrder}' and Item '{$itemCode}'.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if($existInMaster->invoice_number == '' || $existInMaster->invoice_number == null){
|
||||||
|
Notification::make()
|
||||||
|
->title('Panel GR Found')
|
||||||
|
->body("Invoice Number cannot be empty Panel GR record found for Production Order '{$pOrder}' and Item '{$itemCode}'.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sticker = StickerMaster::where('plant_id', $plantId)->where('item_id', $iId->id)->first();
|
||||||
|
|
||||||
|
if(!$sticker){
|
||||||
|
Notification::make()
|
||||||
|
->title('Unknown Item Code')
|
||||||
|
->body("Item code not found '{$iId->code}' in sticker master.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
}
|
||||||
|
|
||||||
|
$existQuanInPanel = PanelBoxValidation::where('plant_id', $plantId)->where('production_order', $pOrder)->where('sticker_master_id', $sticker->id)->count();
|
||||||
|
|
||||||
|
if ($existQuanInPanel >= (int) $existInMaster->quantity) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Quantity Completed')
|
||||||
|
->body("Panel box quantity '{$existQuanInPanel}' exceeds the available quantity '{$existInMaster->quantity}' in Panel GR Master for Production Order '{$pOrder}' and Item '{$itemCode}'.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$set('panel_box_supplier', $supplier);
|
||||||
|
$set('panel_box_serial_number', $panelBoxSerialNo);
|
||||||
|
$set('panel_box_code', $panelBoxCode);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
@@ -430,9 +680,6 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$set('validationError', null);
|
$set('validationError', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$plantId = $get('plant_id'); // Get selected plant
|
|
||||||
|
|
||||||
if (! $plantId) {
|
if (! $plantId) {
|
||||||
$set('validationError', 'Please select a plant first.');
|
$set('validationError', 'Please select a plant first.');
|
||||||
$set('item_id', null);
|
$set('item_id', null);
|
||||||
@@ -592,6 +839,7 @@ class PanelBoxValidationResource extends Resource
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
$set('serial_number', $serialNumber);
|
$set('serial_number', $serialNumber);
|
||||||
|
|
||||||
// Find item based on scanned code
|
// Find item based on scanned code
|
||||||
$item = Item::where('code', $itemCode)
|
$item = Item::where('code', $itemCode)
|
||||||
->where('plant_id', $plantId)->first();
|
->where('plant_id', $plantId)->first();
|
||||||
@@ -676,6 +924,12 @@ class PanelBoxValidationResource extends Resource
|
|||||||
->reactive(),
|
->reactive(),
|
||||||
Forms\Components\Hidden::make('serial_number')
|
Forms\Components\Hidden::make('serial_number')
|
||||||
->reactive(),
|
->reactive(),
|
||||||
|
Forms\Components\Hidden::make('panel_box_supplier')
|
||||||
|
->reactive(),
|
||||||
|
Forms\Components\Hidden::make('panel_box_serial_number')
|
||||||
|
->reactive(),
|
||||||
|
Forms\Components\Hidden::make('panel_box_code')
|
||||||
|
->reactive(),
|
||||||
Forms\Components\TextInput::make('serial_number_motor_qr')
|
Forms\Components\TextInput::make('serial_number_motor_qr')
|
||||||
->label('Serial Number')
|
->label('Serial Number')
|
||||||
->reactive()
|
->reactive()
|
||||||
@@ -721,6 +975,29 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$set('serialPanelError', null);
|
$set('serialPanelError', null);
|
||||||
$set('serial_number_panel_qr', $extracted);
|
$set('serial_number_panel_qr', $extracted);
|
||||||
$set('serial_number_panel', '1');
|
$set('serial_number_panel', '1');
|
||||||
|
|
||||||
|
$panelParts = array_map('trim', explode('/', $state));
|
||||||
|
|
||||||
|
if (count($panelParts) != 4) {
|
||||||
|
|
||||||
|
Notification::make()
|
||||||
|
->title('Invalid QR Format')
|
||||||
|
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$supplier = $panelParts[0];
|
||||||
|
$panelBoxCode = $panelParts[1];
|
||||||
|
$yearMonth = $panelParts[2];
|
||||||
|
$serialNumber = $panelParts[3];
|
||||||
|
$panelBoxSerialNo = $yearMonth . $serialNumber;
|
||||||
|
|
||||||
|
$set('panel_box_supplier', $supplier);
|
||||||
|
$set('panel_box_serial_number', $panelBoxSerialNo);
|
||||||
|
$set('panel_box_code', $panelBoxCode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -773,6 +1050,28 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$set('packSlipPanelError', null);
|
$set('packSlipPanelError', null);
|
||||||
$set('pack_slip_panel_qr', $extracted);
|
$set('pack_slip_panel_qr', $extracted);
|
||||||
$set('pack_slip_panel', '1');
|
$set('pack_slip_panel', '1');
|
||||||
|
$panelParts = array_map('trim', explode('/', $state));
|
||||||
|
|
||||||
|
if (count($panelParts) != 4) {
|
||||||
|
|
||||||
|
Notification::make()
|
||||||
|
->title('Invalid QR Format')
|
||||||
|
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$supplier = $panelParts[0];
|
||||||
|
$panelBoxCode = $panelParts[1];
|
||||||
|
$yearMonth = $panelParts[2];
|
||||||
|
$serialNumber = $panelParts[3];
|
||||||
|
$panelBoxSerialNo = $yearMonth . $serialNumber;
|
||||||
|
|
||||||
|
$set('panel_box_supplier', $supplier);
|
||||||
|
$set('panel_box_serial_number', $panelBoxSerialNo);
|
||||||
|
$set('panel_box_code', $panelBoxCode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -826,6 +1125,28 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$set('namePlatePanelError', null);
|
$set('namePlatePanelError', null);
|
||||||
$set('name_plate_panel_qr', $extracted);
|
$set('name_plate_panel_qr', $extracted);
|
||||||
$set('name_plate_panel', '1');
|
$set('name_plate_panel', '1');
|
||||||
|
$panelParts = array_map('trim', explode('/', $state));
|
||||||
|
|
||||||
|
if (count($panelParts) != 4) {
|
||||||
|
|
||||||
|
Notification::make()
|
||||||
|
->title('Invalid QR Format')
|
||||||
|
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$supplier = $panelParts[0];
|
||||||
|
$panelBoxCode = $panelParts[1];
|
||||||
|
$yearMonth = $panelParts[2];
|
||||||
|
$serialNumber = $panelParts[3];
|
||||||
|
$panelBoxSerialNo = $yearMonth . $serialNumber;
|
||||||
|
|
||||||
|
$set('panel_box_supplier', $supplier);
|
||||||
|
$set('panel_box_serial_number', $panelBoxSerialNo);
|
||||||
|
$set('panel_box_code', $panelBoxCode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -879,6 +1200,28 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$set('tubeStickerPanelError', null);
|
$set('tubeStickerPanelError', null);
|
||||||
$set('tube_sticker_panel_qr', $extracted);
|
$set('tube_sticker_panel_qr', $extracted);
|
||||||
$set('tube_sticker_panel', '1');
|
$set('tube_sticker_panel', '1');
|
||||||
|
$panelParts = array_map('trim', explode('/', $state));
|
||||||
|
|
||||||
|
if (count($panelParts) != 4) {
|
||||||
|
|
||||||
|
Notification::make()
|
||||||
|
->title('Invalid QR Format')
|
||||||
|
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$supplier = $panelParts[0];
|
||||||
|
$panelBoxCode = $panelParts[1];
|
||||||
|
$yearMonth = $panelParts[2];
|
||||||
|
$serialNumber = $panelParts[3];
|
||||||
|
$panelBoxSerialNo = $yearMonth . $serialNumber;
|
||||||
|
|
||||||
|
$set('panel_box_supplier', $supplier);
|
||||||
|
$set('panel_box_serial_number', $panelBoxSerialNo);
|
||||||
|
$set('panel_box_code', $panelBoxCode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -933,6 +1276,28 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$set('warrantyCardPanelError', null);
|
$set('warrantyCardPanelError', null);
|
||||||
$set('warranty_card_qr', $extracted);
|
$set('warranty_card_qr', $extracted);
|
||||||
$set('warranty_card_panel', '1');
|
$set('warranty_card_panel', '1');
|
||||||
|
$panelParts = array_map('trim', explode('/', $state));
|
||||||
|
|
||||||
|
if (count($panelParts) != 4) {
|
||||||
|
|
||||||
|
Notification::make()
|
||||||
|
->title('Invalid QR Format')
|
||||||
|
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
$set('item_id', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$supplier = $panelParts[0];
|
||||||
|
$panelBoxCode = $panelParts[1];
|
||||||
|
$yearMonth = $panelParts[2];
|
||||||
|
$serialNumber = $panelParts[3];
|
||||||
|
$panelBoxSerialNo = $yearMonth . $serialNumber;
|
||||||
|
|
||||||
|
$set('panel_box_supplier', $supplier);
|
||||||
|
$set('panel_box_serial_number', $panelBoxSerialNo);
|
||||||
|
$set('panel_box_code', $panelBoxCode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -1265,6 +1630,11 @@ class PanelBoxValidationResource extends Resource
|
|||||||
->alignCenter()
|
->alignCenter()
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('production_order')
|
||||||
|
->label('Production Order/Doc No')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('serial_number')
|
Tables\Columns\TextColumn::make('serial_number')
|
||||||
->label('Serial Number')
|
->label('Serial Number')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
@@ -1320,6 +1690,21 @@ class PanelBoxValidationResource extends Resource
|
|||||||
->alignCenter()
|
->alignCenter()
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('panel_box_supplier')
|
||||||
|
->label('Panel Box Supplier')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('panel_box_serial_number')
|
||||||
|
->label('Panel Box Serial Number')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('panel_box_code')
|
||||||
|
->label('Panel Box Code')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('created_at')
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
->label('Created At')
|
->label('Created At')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
|
|||||||
363
app/Filament/Resources/PanelGrMasterResource.php
Normal file
363
app/Filament/Resources/PanelGrMasterResource.php
Normal file
@@ -0,0 +1,363 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Exports\PanelGrMasterExporter;
|
||||||
|
use App\Filament\Imports\PanelGrMasterImporter;
|
||||||
|
use App\Filament\Resources\PanelGrMasterResource\Pages;
|
||||||
|
use App\Filament\Resources\PanelGrMasterResource\RelationManagers;
|
||||||
|
use App\Models\Item;
|
||||||
|
use App\Models\PalletValidation;
|
||||||
|
use App\Models\PanelGrMaster;
|
||||||
|
use App\Models\Plant;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
|
use Filament\Forms;
|
||||||
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Tables;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
|
use Filament\Tables\Actions\ExportAction;
|
||||||
|
use Filament\Tables\Actions\ImportAction;
|
||||||
|
use Filament\Tables\Filters\Filter;
|
||||||
|
use Filament\Forms\Components\DateTimePicker;
|
||||||
|
use Filament\Forms\Components\Section;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Closure;
|
||||||
|
|
||||||
|
class PanelGrMasterResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = PanelGrMaster::class;
|
||||||
|
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'Panel Box';
|
||||||
|
|
||||||
|
public static function form(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form
|
||||||
|
->schema([
|
||||||
|
Forms\Components\Select::make('plant_id')
|
||||||
|
->label('Plant')
|
||||||
|
->reactive()
|
||||||
|
->searchable()
|
||||||
|
->relationship('plant', 'name')
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||||
|
})
|
||||||
|
->afterStateUpdated(function (callable $set) {
|
||||||
|
$set('item_id', null);
|
||||||
|
$set('document_number', null);
|
||||||
|
$set('invoice_number', null);
|
||||||
|
$set('supplier_number', null);
|
||||||
|
$set('quantity', '1');
|
||||||
|
})
|
||||||
|
->required(),
|
||||||
|
Forms\Components\Select::make('item_id')
|
||||||
|
->label('Item Code')
|
||||||
|
->reactive()
|
||||||
|
->searchable()
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$plantId = $get('plant_id');
|
||||||
|
if (empty($plantId)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return Item::where('plant_id', $plantId)->pluck('code', 'id');
|
||||||
|
})
|
||||||
|
->afterStateUpdated(function (callable $set) {
|
||||||
|
$set('document_number', null);
|
||||||
|
$set('invoice_number', null);
|
||||||
|
$set('supplier_number', null);
|
||||||
|
$set('quantity', '1');
|
||||||
|
})
|
||||||
|
->required(),
|
||||||
|
Forms\Components\TextInput::make('document_number')
|
||||||
|
->label('Document Number')
|
||||||
|
->required(),
|
||||||
|
Forms\Components\TextInput::make('invoice_number')
|
||||||
|
->label('Invoice Number')
|
||||||
|
->required(),
|
||||||
|
Forms\Components\TextInput::make('supplier_number')
|
||||||
|
->label('Supplier Number')
|
||||||
|
->required(),
|
||||||
|
Forms\Components\TextInput::make('quantity')
|
||||||
|
->label('Quantity')
|
||||||
|
->numeric()
|
||||||
|
->default(1)
|
||||||
|
->minValue(1)
|
||||||
|
->reactive()
|
||||||
|
->required()
|
||||||
|
->afterStateUpdated(function (callable $set, $state) {
|
||||||
|
if ((float) $state == 0) {
|
||||||
|
$set('quantity', null);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
Forms\Components\Hidden::make('created_by')
|
||||||
|
->label('Created By')
|
||||||
|
->default(Filament::auth()->user()?->name),
|
||||||
|
Forms\Components\Hidden::make('updated_by')
|
||||||
|
->label('Updated By')
|
||||||
|
->default(Filament::auth()->user()?->name),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
Tables\Columns\TextColumn::make('No.')
|
||||||
|
->label('No.')
|
||||||
|
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||||
|
$paginator = $livewire->getTableRecords();
|
||||||
|
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||||
|
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||||
|
|
||||||
|
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||||
|
}),
|
||||||
|
Tables\Columns\TextColumn::make('plant.name')
|
||||||
|
->label('Plant Name')
|
||||||
|
->searchable()
|
||||||
|
->alignCenter()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('item.code')
|
||||||
|
->label('Item Code')
|
||||||
|
->searchable()
|
||||||
|
->alignCenter()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('document_number')
|
||||||
|
->label('Document Number')
|
||||||
|
->searchable()
|
||||||
|
->alignCenter()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('invoice_number')
|
||||||
|
->label('Invoice Number')
|
||||||
|
->searchable()
|
||||||
|
->alignCenter()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('supplier_number')
|
||||||
|
->label('Supplier Number')
|
||||||
|
->searchable()
|
||||||
|
->alignCenter()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('quantity')
|
||||||
|
->label('Quantity')
|
||||||
|
->searchable()
|
||||||
|
->alignCenter()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
|
->dateTime()
|
||||||
|
->alignCenter()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
Tables\Columns\TextColumn::make('updated_at')
|
||||||
|
->dateTime()
|
||||||
|
->alignCenter()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
Tables\Columns\TextColumn::make('deleted_at')
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
Tables\Filters\TrashedFilter::make(),
|
||||||
|
Filter::make('advanced_filters')
|
||||||
|
->label('Advanced Filters')
|
||||||
|
->form([
|
||||||
|
Select::make('Plant')
|
||||||
|
->label('Select Plant')
|
||||||
|
->nullable()
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||||
|
})
|
||||||
|
->reactive()
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
||||||
|
$set('scanned_by', null);
|
||||||
|
}),
|
||||||
|
Select::make('item')
|
||||||
|
->label('Search by Item Code')
|
||||||
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$plantId = $get('Plant');
|
||||||
|
|
||||||
|
if (empty($plantId)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return Item::whereHas('panelGrMasters', function ($query) use ($plantId) {
|
||||||
|
if ($plantId) {
|
||||||
|
$query->where('plant_id', $plantId);
|
||||||
|
}
|
||||||
|
})->pluck('code', 'id');
|
||||||
|
})
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$set('process_order', null);
|
||||||
|
}),
|
||||||
|
TextInput::make('document_number')
|
||||||
|
->label('Document Number')
|
||||||
|
->reactive()
|
||||||
|
->placeholder('Enter Document Number')
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$set('Rework', null);
|
||||||
|
}),
|
||||||
|
TextInput::make('invoice_number')
|
||||||
|
->label('Invoice Number')
|
||||||
|
->reactive()
|
||||||
|
->placeholder('Enter Invoice Number')
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$set('Rework', null);
|
||||||
|
}),
|
||||||
|
TextInput::make('supplier_number')
|
||||||
|
->label('Supplier Number')
|
||||||
|
->reactive()
|
||||||
|
->placeholder('Enter Supplier Number')
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$set('Rework', null);
|
||||||
|
}),
|
||||||
|
DateTimePicker::make(name: 'created_from')
|
||||||
|
->label('Created From')
|
||||||
|
->placeholder(placeholder: 'Select From DateTime')
|
||||||
|
->reactive()
|
||||||
|
->native(false),
|
||||||
|
DateTimePicker::make('created_to')
|
||||||
|
->label('Created To')
|
||||||
|
->placeholder(placeholder: 'Select To DateTime')
|
||||||
|
->reactive()
|
||||||
|
->native(false),
|
||||||
|
])
|
||||||
|
->query(function ($query, array $data) {
|
||||||
|
// Hide all records initially if no filters are applied
|
||||||
|
if (empty($data['Plant']) && empty($data['document_number']) && empty($data['invoice_number']) && empty($data['supplier_number']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['created_by'])) {
|
||||||
|
return $query->whereRaw('1 = 0');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['Plant'])) { // $plant = $data['Plant'] ?? null
|
||||||
|
$query->where('plant_id', $data['Plant']);
|
||||||
|
} else {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
if ($userHas && strlen($userHas) > 0) {
|
||||||
|
return $query->whereRaw('1 = 0');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['document_number'])) {
|
||||||
|
$query->where('document_number', 'like', '%' . $data['document_number'] . '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['invoice_number'])) {
|
||||||
|
$query->where('invoice_number', 'like', '%' . $data['invoice_number'] . '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['supplier_number'])) {
|
||||||
|
$query->where('supplier_number', 'like', '%' . $data['supplier_number'] . '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['created_from'])) {
|
||||||
|
$query->where('created_at', '>=', $data['created_from']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['created_to'])) {
|
||||||
|
$query->where('created_at', '<=', $data['created_to']);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->indicateUsing(function (array $data) {
|
||||||
|
$indicators = [];
|
||||||
|
|
||||||
|
if (! empty($data['Plant'])) {
|
||||||
|
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
|
||||||
|
} else {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
if ($userHas && strlen($userHas) > 0) {
|
||||||
|
return 'Plant: Choose plant to filter records.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['document_number'])) {
|
||||||
|
$indicators[] = 'Doc No: '.$data['document_number'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['invoice_number'])) {
|
||||||
|
$indicators[] = 'Invoice No: '.$data['invoice_number'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['supplier_number'])) {
|
||||||
|
$indicators[] = 'Supplier No: '.$data['supplier_number'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['created_from'])) {
|
||||||
|
$indicators[] = 'From: '.$data['created_from'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['created_to'])) {
|
||||||
|
$indicators[] = 'To: '.$data['created_to'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $indicators;
|
||||||
|
}),
|
||||||
|
])
|
||||||
|
->filtersFormMaxHeight('280px')
|
||||||
|
->actions([
|
||||||
|
Tables\Actions\ViewAction::make(),
|
||||||
|
Tables\Actions\EditAction::make(),
|
||||||
|
])
|
||||||
|
->bulkActions([
|
||||||
|
Tables\Actions\BulkActionGroup::make([
|
||||||
|
Tables\Actions\DeleteBulkAction::make(),
|
||||||
|
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||||
|
Tables\Actions\RestoreBulkAction::make(),
|
||||||
|
]),
|
||||||
|
])
|
||||||
|
->headerActions([
|
||||||
|
ImportAction::make()
|
||||||
|
->label('Import Panel GR Masters')
|
||||||
|
->color('warning')
|
||||||
|
->importer(PanelGrMasterImporter::class)
|
||||||
|
->visible(function () {
|
||||||
|
return Filament::auth()->user()->can('view import panel gr master');
|
||||||
|
}),
|
||||||
|
ExportAction::make()
|
||||||
|
->label('Export Panel GR Masters')
|
||||||
|
->color('warning')
|
||||||
|
->exporter(PanelGrMasterExporter::class)
|
||||||
|
->visible(function () {
|
||||||
|
return Filament::auth()->user()->can('view export panel gr master');
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRelations(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => Pages\ListPanelGrMasters::route('/'),
|
||||||
|
'create' => Pages\CreatePanelGrMaster::route('/create'),
|
||||||
|
'view' => Pages\ViewPanelGrMaster::route('/{record}'),
|
||||||
|
'edit' => Pages\EditPanelGrMaster::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getEloquentQuery(): Builder
|
||||||
|
{
|
||||||
|
return parent::getEloquentQuery()
|
||||||
|
->withoutGlobalScopes([
|
||||||
|
SoftDeletingScope::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\PanelGrMasterResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\PanelGrMasterResource;
|
||||||
|
use App\Models\PanelGrMaster;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
|
||||||
|
class CreatePanelGrMaster extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = PanelGrMasterResource::class;
|
||||||
|
|
||||||
|
protected function mutateFormDataBeforeCreate(array $data): array
|
||||||
|
{
|
||||||
|
$exists = PanelGrMaster::where('plant_id', $data['plant_id'])
|
||||||
|
->where('item_id', $data['item_id'])
|
||||||
|
->where('document_number', $data['document_number'])
|
||||||
|
->where('invoice_number', $data['invoice_number'])
|
||||||
|
->where('supplier_number', $data['supplier_number'])
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if ($exists) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Duplicate Record')
|
||||||
|
->body('This combination already exists in Master.')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'item_id' => 'This combination already exists in Master.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\PanelGrMasterResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\PanelGrMasterResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditPanelGrMaster extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = PanelGrMasterResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\ViewAction::make(),
|
||||||
|
Actions\DeleteAction::make(),
|
||||||
|
Actions\ForceDeleteAction::make(),
|
||||||
|
Actions\RestoreAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\PanelGrMasterResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\PanelGrMasterResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListPanelGrMasters extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = PanelGrMasterResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\PanelGrMasterResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\PanelGrMasterResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ViewRecord;
|
||||||
|
|
||||||
|
class ViewPanelGrMaster extends ViewRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = PanelGrMasterResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\EditAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Filament\Resources\ProductionOrderResource\Pages;
|
namespace App\Filament\Resources\ProductionOrderResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\ProductionOrderResource;
|
use App\Filament\Resources\ProductionOrderResource;
|
||||||
|
use App\Models\Item;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use App\Models\ProductionOrder;
|
use App\Models\ProductionOrder;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
@@ -282,6 +283,64 @@ class CreateProductionOrder extends CreateRecord
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function exportSerialNo(){
|
||||||
|
$pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$plantId = trim($this->form->getState()['plant_id'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$itemId = trim($this->form->getState()['item_id'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$fromSerNo = trim($this->form->getState()['from_serial_number'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$toSerNo = trim($this->form->getState()['to_serial_number'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$plantCode = Plant::where('id', $plantId)->value('code');
|
||||||
|
|
||||||
|
// $itemCode = Item::where('id', $itemId)->value('code');
|
||||||
|
|
||||||
|
if (empty($plantId)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Plant name cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
return;
|
||||||
|
} elseif (empty($pOrder)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Production order cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
elseif (empty($fromSerNo)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('From serial number cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
elseif (empty($toSerNo)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('To serial number cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pOrderExists = ProductionOrder::where('plant_id', $plantId)->where('production_order', $pOrder)->first();
|
||||||
|
|
||||||
|
if (! $pOrderExists) {
|
||||||
|
Notification::make()
|
||||||
|
->title("Production Order '{$pOrder}' does not exist to get print!")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
return redirect()->route('production-orders.exportSerial', ['production_order' => $pOrder, 'plant_code' => $plantCode, 'from_serial_no' => $fromSerNo, 'to_serial_no' => $toSerNo]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function getFormActions(): array
|
protected function getFormActions(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
@@ -157,6 +157,64 @@ class EditProductionOrder extends EditRecord
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function exportSerialNo(){
|
||||||
|
$pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$plantId = trim($this->form->getState()['plant_id'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$itemId = trim($this->form->getState()['item_id'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$fromSerNo = trim($this->form->getState()['from_serial_number'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$toSerNo = trim($this->form->getState()['to_serial_number'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$plantCode = Plant::where('id', $plantId)->value('code');
|
||||||
|
|
||||||
|
// $itemCode = Item::where('id', $itemId)->value('code');
|
||||||
|
|
||||||
|
if (empty($plantId)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Plant name cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
return;
|
||||||
|
} elseif (empty($pOrder)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Production order cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
elseif (empty($fromSerNo)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('From serial number cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
elseif (empty($toSerNo)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('To serial number cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pOrderExists = ProductionOrder::where('plant_id', $plantId)->where('production_order', $pOrder)->first();
|
||||||
|
|
||||||
|
if (! $pOrderExists) {
|
||||||
|
Notification::make()
|
||||||
|
->title("Production Order '{$pOrder}' does not exist to get print!")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
return redirect()->route('production-orders.exportSerial', ['production_order' => $pOrder, 'plant_code' => $plantCode, 'from_serial_no' => $fromSerNo, 'to_serial_no' => $toSerNo]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
protected function getHeaderActions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Filament\Resources\ProductionOrderResource\Pages;
|
namespace App\Filament\Resources\ProductionOrderResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\ProductionOrderResource;
|
use App\Filament\Resources\ProductionOrderResource;
|
||||||
|
use App\Models\Item;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use App\Models\ProductionOrder;
|
use App\Models\ProductionOrder;
|
||||||
use Filament\Actions;
|
use Filament\Actions;
|
||||||
@@ -159,6 +160,64 @@ class ViewProductionOrder extends ViewRecord
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function exportSerialNo(){
|
||||||
|
$pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$plantId = trim($this->form->getState()['plant_id'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$itemId = trim($this->form->getState()['item_id'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$fromSerNo = trim($this->form->getState()['from_serial_number'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$toSerNo = trim($this->form->getState()['to_serial_number'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$plantCode = Plant::where('id', $plantId)->value('code');
|
||||||
|
|
||||||
|
// $itemCode = Item::where('id', $itemId)->value('code');
|
||||||
|
|
||||||
|
if (empty($plantId)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Plant name cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
return;
|
||||||
|
} elseif (empty($pOrder)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Production order cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
elseif (empty($fromSerNo)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('From serial number cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
elseif (empty($toSerNo)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('To serial number cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pOrderExists = ProductionOrder::where('plant_id', $plantId)->where('production_order', $pOrder)->first();
|
||||||
|
|
||||||
|
if (! $pOrderExists) {
|
||||||
|
Notification::make()
|
||||||
|
->title("Production Order '{$pOrder}' does not exist to get print!")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
return redirect()->route('production-orders.exportSerial', ['production_order' => $pOrder, 'plant_code' => $plantCode, 'from_serial_no' => $fromSerNo, 'to_serial_no' => $toSerNo]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
protected function getHeaderActions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use App\Filament\Resources\VisitorEntryResource\Pages;
|
|||||||
use App\Filament\Resources\VisitorEntryResource\RelationManagers;
|
use App\Filament\Resources\VisitorEntryResource\RelationManagers;
|
||||||
use App\Models\VisitorEntry;
|
use App\Models\VisitorEntry;
|
||||||
use App\Models\EmployeeMaster;
|
use App\Models\EmployeeMaster;
|
||||||
|
use App\Models\Plant;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
@@ -63,6 +64,53 @@ class VisitorEntryResource extends Resource
|
|||||||
return $prefix . $nextNumber;
|
return $prefix . $nextNumber;
|
||||||
})
|
})
|
||||||
->readOnly(),
|
->readOnly(),
|
||||||
|
Forms\Components\Select::make('inter_unit')
|
||||||
|
->label('Inter Unit Staff Code')
|
||||||
|
->options(
|
||||||
|
EmployeeMaster::distinct()
|
||||||
|
->orderBy('code')
|
||||||
|
->get(['code', 'name'])
|
||||||
|
->mapWithKeys(function ($employee) {
|
||||||
|
return [
|
||||||
|
$employee->code => "{$employee->code} ({$employee->name})"
|
||||||
|
];
|
||||||
|
})
|
||||||
|
// ->pluck('code', 'code')
|
||||||
|
)
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
|
->afterStateUpdated(function (callable $set, callable $get, $state) {
|
||||||
|
|
||||||
|
$code = $get('inter_unit');
|
||||||
|
|
||||||
|
if($code){
|
||||||
|
$employeeExist = EmployeeMaster::where('code', $code)->first();
|
||||||
|
|
||||||
|
$plantId = $employeeExist->plant_id;
|
||||||
|
|
||||||
|
$plant = Plant::find($plantId);
|
||||||
|
|
||||||
|
if ($employeeExist) {
|
||||||
|
$set('name', $employeeExist->name);
|
||||||
|
$set('mobile_number', $employeeExist->mobile_number);
|
||||||
|
$set('company', $plant->name);
|
||||||
|
$set('type', 'InterUnitStaff');
|
||||||
|
} else {
|
||||||
|
$set('name', null);
|
||||||
|
$set('mobile_number', null);
|
||||||
|
$set('company', null);
|
||||||
|
$set('type', null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$set('name', null);
|
||||||
|
$set('mobile_number', null);
|
||||||
|
$set('company', null);
|
||||||
|
$set('type', null);
|
||||||
|
|
||||||
|
}
|
||||||
|
}),
|
||||||
Forms\Components\TextInput::make('mobile_number')
|
Forms\Components\TextInput::make('mobile_number')
|
||||||
->label('Mobile Number')
|
->label('Mobile Number')
|
||||||
->length(10)
|
->length(10)
|
||||||
@@ -72,6 +120,7 @@ class VisitorEntryResource extends Resource
|
|||||||
'maxlength' => 10,
|
'maxlength' => 10,
|
||||||
])
|
])
|
||||||
->required()
|
->required()
|
||||||
|
->readOnly(fn (callable $get) => filled($get('inter_unit')))
|
||||||
->extraAttributes([
|
->extraAttributes([
|
||||||
'id' => 'mobile_number_input',
|
'id' => 'mobile_number_input',
|
||||||
'x-data' => '{ value: "" }',
|
'x-data' => '{ value: "" }',
|
||||||
@@ -82,9 +131,14 @@ class VisitorEntryResource extends Resource
|
|||||||
->label('Name')
|
->label('Name')
|
||||||
->required()
|
->required()
|
||||||
->reactive()
|
->reactive()
|
||||||
|
->readOnly(fn (callable $get) => filled($get('inter_unit')))
|
||||||
->extraInputAttributes([
|
->extraInputAttributes([
|
||||||
'oninput' => 'this.value = this.value.replace(/[^a-zA-Z\s]/g, "")',
|
'oninput' => 'this.value = this.value.replace(/[^a-zA-Z\s]/g, "")',
|
||||||
]),
|
]),
|
||||||
|
Forms\Components\TextInput::make('company')
|
||||||
|
->label('Company')
|
||||||
|
->readOnly(fn (callable $get) => filled($get('inter_unit')))
|
||||||
|
->required(),
|
||||||
Forms\Components\Select::make('type')
|
Forms\Components\Select::make('type')
|
||||||
->label('Type')
|
->label('Type')
|
||||||
->reactive()
|
->reactive()
|
||||||
@@ -92,6 +146,7 @@ class VisitorEntryResource extends Resource
|
|||||||
'Student' => 'Student',
|
'Student' => 'Student',
|
||||||
'Consultant' => 'Consultant',
|
'Consultant' => 'Consultant',
|
||||||
'Supplier' => 'Supplier',
|
'Supplier' => 'Supplier',
|
||||||
|
'InterUnitStaff' => 'Inter Unit Staff',
|
||||||
'InterviewCandidates' => 'Interview Candidates',
|
'InterviewCandidates' => 'Interview Candidates',
|
||||||
'Customers/Dealers' => 'Customers/Dealers',
|
'Customers/Dealers' => 'Customers/Dealers',
|
||||||
'Bankers' => 'Bankers',
|
'Bankers' => 'Bankers',
|
||||||
@@ -104,6 +159,17 @@ class VisitorEntryResource extends Resource
|
|||||||
return $state == 'Other'
|
return $state == 'Other'
|
||||||
? $get('other_type')
|
? $get('other_type')
|
||||||
: $state;
|
: $state;
|
||||||
|
})
|
||||||
|
->afterStateUpdated(function (callable $set, callable $get, $state) {
|
||||||
|
|
||||||
|
$code = $get('inter_unit');
|
||||||
|
|
||||||
|
if($code){
|
||||||
|
$set('inter_unit', null);
|
||||||
|
$set('name', null);
|
||||||
|
$set('mobile_number', null);
|
||||||
|
$set('company', null);
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('other_type')
|
Forms\Components\TextInput::make('other_type')
|
||||||
->label('Specify Type')
|
->label('Specify Type')
|
||||||
@@ -111,9 +177,6 @@ class VisitorEntryResource extends Resource
|
|||||||
->visible(fn (callable $get) => $get('type') == 'Other')
|
->visible(fn (callable $get) => $get('type') == 'Other')
|
||||||
->required(fn (callable $get) => $get('type') == 'Other')
|
->required(fn (callable $get) => $get('type') == 'Other')
|
||||||
->dehydrated(false),
|
->dehydrated(false),
|
||||||
Forms\Components\TextInput::make('company')
|
|
||||||
->label('Company')
|
|
||||||
->required(),
|
|
||||||
Forms\Components\Select::make('department')
|
Forms\Components\Select::make('department')
|
||||||
->label('Employee Department')
|
->label('Employee Department')
|
||||||
->options(
|
->options(
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ class WeightValidationResource extends Resource
|
|||||||
->columnSpan(1)
|
->columnSpan(1)
|
||||||
->required(),
|
->required(),
|
||||||
Forms\Components\TextInput::make('obd_number')
|
Forms\Components\TextInput::make('obd_number')
|
||||||
->label('OBD Number')
|
->label('OBD / GR Number')
|
||||||
->minLength(8)
|
->minLength(8)
|
||||||
->placeholder('Scan the valid OBD Number')
|
->placeholder('Scan the valid OBD / GR Number')
|
||||||
->columnSpan(1)
|
->columnSpan(1)
|
||||||
->required(),
|
->required(),
|
||||||
Forms\Components\TextInput::make('line_number')
|
Forms\Components\TextInput::make('line_number')
|
||||||
@@ -99,11 +99,11 @@ class WeightValidationResource extends Resource
|
|||||||
->columnSpan(1)
|
->columnSpan(1)
|
||||||
->placeholder('Scan the valid Heat Number'),
|
->placeholder('Scan the valid Heat Number'),
|
||||||
Forms\Components\TextInput::make('bundle_number')
|
Forms\Components\TextInput::make('bundle_number')
|
||||||
->label('Bundle Number')
|
->label('Bundle / Coil Number')
|
||||||
->minLength(1)
|
->minLength(1)
|
||||||
->numeric()
|
->numeric()
|
||||||
->columnSpan(1)
|
->columnSpan(1)
|
||||||
->placeholder('Scan the valid Bundle Number'),
|
->placeholder('Scan the valid Bundle / Coil Number'),
|
||||||
Forms\Components\TextInput::make('picked_weight')
|
Forms\Components\TextInput::make('picked_weight')
|
||||||
->label('Picked Weight')
|
->label('Picked Weight')
|
||||||
->minLength(1)
|
->minLength(1)
|
||||||
@@ -588,7 +588,7 @@ class WeightValidationResource extends Resource
|
|||||||
} else {
|
} else {
|
||||||
$lineNumbers[] = $lineNumber;
|
$lineNumbers[] = $lineNumber;
|
||||||
}
|
}
|
||||||
if (Str::length($batchNumber) < 8 || ! is_numeric($batchNumber)) {// ctype_alnum
|
if (Str::length($batchNumber) < 1 || ! is_numeric($batchNumber)) {// ctype_alnum
|
||||||
$validData = false;
|
$validData = false;
|
||||||
$invalidBatch[] = $materialCode;
|
$invalidBatch[] = $materialCode;
|
||||||
}
|
}
|
||||||
@@ -663,7 +663,7 @@ class WeightValidationResource extends Resource
|
|||||||
if (! empty($uniqueInvalidBatch)) {
|
if (! empty($uniqueInvalidBatch)) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid: Batch Numbers')
|
->title('Invalid: Batch Numbers')
|
||||||
->body('Batch number should contain minimum 8 digit numeric values!<br>Following item codes has invalid batch number:<br>'.implode(', ', $uniqueInvalidBatch))
|
->body('Batch number should contain minimum 1 digit numeric values!<br>Following item codes has invalid batch number:<br>'.implode(', ', $uniqueInvalidBatch))
|
||||||
->danger()
|
->danger()
|
||||||
->seconds(2)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
|
|||||||
@@ -401,11 +401,15 @@ class WireMasterPackingResource extends Resource
|
|||||||
|
|
||||||
if (!empty($data['customer_po_master_id'])) {
|
if (!empty($data['customer_po_master_id'])) {
|
||||||
|
|
||||||
$customerPoId = CustomerPoMaster::where('customer_po', $data['customer_po_master_id'])
|
// $customerPoId = CustomerPoMaster::where('customer_po', $data['customer_po_master_id'])
|
||||||
->where('plant_id', $data['Plant'])
|
// ->where('plant_id', $data['Plant'])
|
||||||
->value('id');
|
// ->value('id');
|
||||||
|
$customerPoIds = CustomerPoMaster::where('customer_po', $data['customer_po_master_id'])
|
||||||
|
->where('plant_id', $data['Plant'])
|
||||||
|
->pluck('id');
|
||||||
|
|
||||||
$query->where('customer_po_master_id', $customerPoId);
|
// $query->where('customer_po_master_id', $customerPoId);
|
||||||
|
$query->whereIn('customer_po_master_id', $customerPoIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['wire_packing_status'])) {
|
if (! empty($data['wire_packing_status'])) {
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ class CreateWireMasterPacking extends CreateRecord
|
|||||||
{
|
{
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("PO Not Found")
|
->title("PO Not Found")
|
||||||
->body("Customer PO '$customerPoRecord->customer_po' for Item '$materialCode' not found against Plant '$plantcode'")
|
->body("Customer PO '$customerPo' for Item '$materialCode' not found against Plant '$plantcode'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
->send();
|
->send();
|
||||||
@@ -250,10 +250,12 @@ class CreateWireMasterPacking extends CreateRecord
|
|||||||
->selectRaw('SUM(CAST(weight AS NUMERIC)) as total_weight')
|
->selectRaw('SUM(CAST(weight AS NUMERIC)) as total_weight')
|
||||||
->value('total_weight');
|
->value('total_weight');
|
||||||
|
|
||||||
$totalQty = (float)$alreadyScannedQty + (float)$weight;
|
$totalQty = round((float)$alreadyScannedQty + (float)$weight, 3);
|
||||||
|
|
||||||
if($totalQty > (float)$customerPoRecord->quantity)
|
|
||||||
|
if($totalQty > round((float)$customerPoRecord->quantity, 3))
|
||||||
{
|
{
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Scanned Weight Exceeds PO Quantity")
|
->title("Scanned Weight Exceeds PO Quantity")
|
||||||
->body("Scanned weight '$weight' and already scanned weight '$alreadyScannedQty' exceeds allowed quantity '{$customerPoRecord->quantity}' for PO '$customerPoRecord->customer_po' and Item '$materialCode'")
|
->body("Scanned weight '$weight' and already scanned weight '$alreadyScannedQty' exceeds allowed quantity '{$customerPoRecord->quantity}' for PO '$customerPoRecord->customer_po' and Item '$materialCode'")
|
||||||
|
|||||||
@@ -167,6 +167,16 @@ class PalletPrintController extends Controller
|
|||||||
->where('wire_packing_number', $pallet)
|
->where('wire_packing_number', $pallet)
|
||||||
->value('customer_po_master_id');
|
->value('customer_po_master_id');
|
||||||
|
|
||||||
|
$masterIds = WireMasterPacking::where('plant_id', $plant)
|
||||||
|
->where('wire_packing_number', $pallet)
|
||||||
|
->pluck('customer_po_master_id');
|
||||||
|
|
||||||
|
$customerPo = CustomerPoMaster::whereIn('id', $masterIds)
|
||||||
|
->value('customer_po');
|
||||||
|
|
||||||
|
$customerPoMasterIds = CustomerPoMaster::where('customer_po', $customerPo)
|
||||||
|
->pluck('id');
|
||||||
|
|
||||||
$items = WireMasterPacking::with('item')
|
$items = WireMasterPacking::with('item')
|
||||||
->where('plant_id', $plant)
|
->where('plant_id', $plant)
|
||||||
->where('wire_packing_number', $pallet)
|
->where('wire_packing_number', $pallet)
|
||||||
@@ -185,8 +195,18 @@ class PalletPrintController extends Controller
|
|||||||
$customerCode = $customer->customer_po ?? '';
|
$customerCode = $customer->customer_po ?? '';
|
||||||
$customerName = $customer->customer_name ?? '';
|
$customerName = $customer->customer_name ?? '';
|
||||||
|
|
||||||
|
// $totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
||||||
|
// ->where('customer_po_master_id', $customerPoMasterId)
|
||||||
|
// ->select('wire_packing_number')
|
||||||
|
// ->groupBy('wire_packing_number')
|
||||||
|
// ->havingRaw(
|
||||||
|
// 'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
|
||||||
|
// ['Completed']
|
||||||
|
// )
|
||||||
|
// ->count();
|
||||||
|
|
||||||
$totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
$totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
||||||
->where('customer_po_master_id', $customerPoMasterId)
|
->whereIn('customer_po_master_id', $customerPoMasterIds)
|
||||||
->select('wire_packing_number')
|
->select('wire_packing_number')
|
||||||
->groupBy('wire_packing_number')
|
->groupBy('wire_packing_number')
|
||||||
->havingRaw(
|
->havingRaw(
|
||||||
@@ -195,17 +215,29 @@ class PalletPrintController extends Controller
|
|||||||
)
|
)
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
|
// $completedPallets = WireMasterPacking::where('plant_id', $plant)
|
||||||
|
// ->where('customer_po_master_id', $customerPoMasterId)
|
||||||
|
// ->select('wire_packing_number')
|
||||||
|
// ->groupBy('wire_packing_number')
|
||||||
|
// ->havingRaw(
|
||||||
|
// 'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
|
||||||
|
// ['Completed']
|
||||||
|
// )
|
||||||
|
// ->orderBy('wire_packing_number')
|
||||||
|
// ->pluck('wire_packing_number')
|
||||||
|
// ->values();
|
||||||
|
|
||||||
$completedPallets = WireMasterPacking::where('plant_id', $plant)
|
$completedPallets = WireMasterPacking::where('plant_id', $plant)
|
||||||
->where('customer_po_master_id', $customerPoMasterId)
|
->whereIn('customer_po_master_id', $customerPoMasterIds)
|
||||||
->select('wire_packing_number')
|
->select('wire_packing_number')
|
||||||
->groupBy('wire_packing_number')
|
->groupBy('wire_packing_number')
|
||||||
->havingRaw(
|
->havingRaw(
|
||||||
'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
|
'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
|
||||||
['Completed']
|
['Completed']
|
||||||
)
|
)
|
||||||
->orderBy('wire_packing_number')
|
->orderBy('wire_packing_number')
|
||||||
->pluck('wire_packing_number')
|
->pluck('wire_packing_number')
|
||||||
->values();
|
->values();
|
||||||
|
|
||||||
$index = $completedPallets->search($pallet);
|
$index = $completedPallets->search($pallet);
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Item;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@@ -56,6 +57,78 @@ class PlantController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getItemCode(Request $request){
|
||||||
|
$expectedUser = env('API_AUTH_USER');
|
||||||
|
$expectedPw = env('API_AUTH_PW');
|
||||||
|
$header_auth = $request->header('Authorization');
|
||||||
|
$expectedToken = $expectedUser.':'.$expectedPw;
|
||||||
|
|
||||||
|
if ('Bearer '.$expectedToken != $header_auth) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => 'Invalid authorization token!',
|
||||||
|
], 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
$plantCode = $request->header('plant-code');
|
||||||
|
|
||||||
|
$itemCode = $request->header('item-code');
|
||||||
|
|
||||||
|
if (! $plantCode) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Plant Code value can't be empty",
|
||||||
|
], 404);
|
||||||
|
} elseif (! $itemCode) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => 'Item code cannot be empty!',
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$plant = Plant::where('code', $plantCode)->first();
|
||||||
|
$plantId = $plant->id;
|
||||||
|
|
||||||
|
if (! $plant) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Plant Code '{$plantCode}' not found!",
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$itemCodeExist = Item::where('code', $itemCode)->first();
|
||||||
|
|
||||||
|
if (! $itemCodeExist) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => 'Item code not found',
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$itemCodePlantExist = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
|
||||||
|
|
||||||
|
if (! $itemCodePlantExist) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Item code not found against plant code '$plantCode'",
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty(trim($itemCodePlantExist->description ?? ''))) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Description is empty in Item Master against item code '$itemCode'.",
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'SUCCESS',
|
||||||
|
'status_description' => [
|
||||||
|
'description' => $itemCodePlantExist->description,
|
||||||
|
],
|
||||||
|
], 200);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the specified resource in storage.
|
* Update the specified resource in storage.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ use Illuminate\Support\Facades\Log;
|
|||||||
use Mpdf\QrCode\QrCode;
|
use Mpdf\QrCode\QrCode;
|
||||||
use Mpdf\QrCode\Output;
|
use Mpdf\QrCode\Output;
|
||||||
use Barryvdh\DomPDF\Facade\Pdf;
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
|
use App\Exports\SerialExport;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
|
||||||
class ProductionOrderController extends Controller
|
class ProductionOrderController extends Controller
|
||||||
{
|
{
|
||||||
@@ -62,6 +64,7 @@ class ProductionOrderController extends Controller
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$pdf = Pdf::loadView('production-orders.print', compact('stickers'))
|
$pdf = Pdf::loadView('production-orders.print', compact('stickers'))
|
||||||
->setPaper([0, 0, 170, 40]);
|
->setPaper([0, 0, 170, 40]);
|
||||||
|
|
||||||
@@ -214,6 +217,24 @@ class ProductionOrderController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function exportSerial($production_order, $plantCode, $fromSerialNo, $toSerialNo){
|
||||||
|
$order = ProductionOrder::where('production_order', $production_order)->first();
|
||||||
|
|
||||||
|
if (!$order) {
|
||||||
|
abort(404, 'Production Order not found');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return Excel::download(
|
||||||
|
new SerialExport(
|
||||||
|
$order->item->code,
|
||||||
|
$fromSerialNo,
|
||||||
|
$toSerialNo
|
||||||
|
),
|
||||||
|
'serial_numbers.xlsx'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store a newly created resource in storage.
|
* Store a newly created resource in storage.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -29,7 +29,10 @@ class VisitorMail extends Mailable
|
|||||||
public function envelope(): Envelope
|
public function envelope(): Envelope
|
||||||
{
|
{
|
||||||
return new Envelope(
|
return new Envelope(
|
||||||
subject: 'Visitor Arrival Notification',
|
// subject: 'Visitor Arrival Notification',
|
||||||
|
subject: $this->visitor->type === 'InterUnitStaff'
|
||||||
|
? 'Employee Arrival Notification'
|
||||||
|
: 'Visitor Arrival Notification',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,10 @@ class VisitorOutMail extends Mailable
|
|||||||
public function envelope(): Envelope
|
public function envelope(): Envelope
|
||||||
{
|
{
|
||||||
return new Envelope(
|
return new Envelope(
|
||||||
subject: 'Visitor Out Notification',
|
// subject: 'Visitor Out Notification',
|
||||||
|
subject: $this->entry->type === 'InterUnitStaff'
|
||||||
|
? 'Employee Out Notification'
|
||||||
|
: 'Visitor Out Notification',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,11 +91,22 @@ class Item extends Model
|
|||||||
|
|
||||||
public function tempClassCharacteristics()
|
public function tempClassCharacteristics()
|
||||||
{
|
{
|
||||||
return $this->hasMany(TempClassCharacteristic::class, 'plant_id', 'id');
|
return $this->hasMany(TempClassCharacteristic::class, 'item_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function weightValidations()
|
public function weightValidations()
|
||||||
{
|
{
|
||||||
return $this->hasMany(WeightValidation::class);
|
return $this->hasMany(WeightValidation::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function locatorValidations()
|
||||||
|
{
|
||||||
|
return $this->hasMany(LocatorValidation::class, 'item_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function panelGrMasters()
|
||||||
|
{
|
||||||
|
return $this->hasMany(PanelGrMaster::class, 'item_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ class PanelBoxValidation extends Model
|
|||||||
'part_validation3',
|
'part_validation3',
|
||||||
'part_validation4',
|
'part_validation4',
|
||||||
'part_validation5',
|
'part_validation5',
|
||||||
|
'panel_box_supplier',
|
||||||
|
'panel_box_serial_number',
|
||||||
|
'batch_number',
|
||||||
|
'panel_box_code',
|
||||||
'created_by',
|
'created_by',
|
||||||
'updated_by'
|
'updated_by'
|
||||||
];
|
];
|
||||||
|
|||||||
33
app/Models/PanelGrMaster.php
Normal file
33
app/Models/PanelGrMaster.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
class PanelGrMaster extends Model
|
||||||
|
{
|
||||||
|
use SoftDeletes;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'plant_id',
|
||||||
|
'item_id',
|
||||||
|
'document_number',
|
||||||
|
'invoice_number',
|
||||||
|
'supplier_number',
|
||||||
|
'quantity',
|
||||||
|
'created_by',
|
||||||
|
'updated_by'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function plant(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Plant::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function item(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Item::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
106
app/Policies/PanelGrMasterPolicy.php
Normal file
106
app/Policies/PanelGrMasterPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Policies;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Access\Response;
|
||||||
|
use App\Models\PanelGrMaster;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class PanelGrMasterPolicy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine whether the user can view any models.
|
||||||
|
*/
|
||||||
|
public function viewAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('view-any PanelGrMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can view the model.
|
||||||
|
*/
|
||||||
|
public function view(User $user, PanelGrMaster $panelgrmaster): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('view PanelGrMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can create models.
|
||||||
|
*/
|
||||||
|
public function create(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('create PanelGrMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can update the model.
|
||||||
|
*/
|
||||||
|
public function update(User $user, PanelGrMaster $panelgrmaster): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('update PanelGrMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can delete the model.
|
||||||
|
*/
|
||||||
|
public function delete(User $user, PanelGrMaster $panelgrmaster): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('delete PanelGrMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can delete any models.
|
||||||
|
*/
|
||||||
|
public function deleteAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('delete-any PanelGrMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can restore the model.
|
||||||
|
*/
|
||||||
|
public function restore(User $user, PanelGrMaster $panelgrmaster): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('restore PanelGrMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can restore any models.
|
||||||
|
*/
|
||||||
|
public function restoreAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('restore-any PanelGrMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can replicate the model.
|
||||||
|
*/
|
||||||
|
public function replicate(User $user, PanelGrMaster $panelgrmaster): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('replicate PanelGrMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can reorder the models.
|
||||||
|
*/
|
||||||
|
public function reorder(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('reorder PanelGrMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can permanently delete the model.
|
||||||
|
*/
|
||||||
|
public function forceDelete(User $user, PanelGrMaster $panelgrmaster): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('force-delete PanelGrMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can permanently delete any models.
|
||||||
|
*/
|
||||||
|
public function forceDeleteAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('force-delete-any PanelGrMaster');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": "^8.2",
|
"php": "^8.2",
|
||||||
"alperenersoy/filament-export": "^3.0",
|
"alperenersoy/filament-export": "^3.0",
|
||||||
"althinect/filament-spatie-roles-permissions": "^2.3",
|
"althinect/filament-spatie-roles-permissions": "^4.0",
|
||||||
"diogogpinto/filament-auth-ui-enhancer": "^1.0",
|
"diogogpinto/filament-auth-ui-enhancer": "^1.0",
|
||||||
"erag/laravel-pwa": "^1.9",
|
"erag/laravel-pwa": "^1.9",
|
||||||
"filament/filament": "^3.3",
|
"filament/filament": "^3.3",
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$sql1 = <<<'SQL'
|
||||||
|
ALTER TABLE panel_box_validations
|
||||||
|
ADD COLUMN panel_box_supplier TEXT DEFAULT NULL
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
DB::statement($sql1);
|
||||||
|
|
||||||
|
$sql2 = <<<'SQL'
|
||||||
|
ALTER TABLE panel_box_validations
|
||||||
|
ADD COLUMN panel_box_serial_number TEXT DEFAULT NULL
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
DB::statement($sql2);
|
||||||
|
|
||||||
|
$sql3 = <<<'SQL'
|
||||||
|
ALTER TABLE panel_box_validations
|
||||||
|
ADD COLUMN panel_box_code TEXT DEFAULT NULL
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
DB::statement($sql3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('panel_box_validations', function (Blueprint $table) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$sql = <<<'SQL'
|
||||||
|
CREATE TABLE panel_gr_masters (
|
||||||
|
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||||
|
|
||||||
|
plant_id BIGINT NOT NULL,
|
||||||
|
item_id BIGINT NOT NULL,
|
||||||
|
|
||||||
|
document_number TEXT DEFAULT NULL,
|
||||||
|
invoice_number TEXT DEFAULT NULL,
|
||||||
|
supplier_number TEXT DEFAULT NULL,
|
||||||
|
quantity TEXT DEFAULT NULL,
|
||||||
|
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||||
|
updated_at TIMESTAMP,
|
||||||
|
deleted_at TIMESTAMP,
|
||||||
|
|
||||||
|
created_by TEXT NULL,
|
||||||
|
updated_by TEXT NULL,
|
||||||
|
|
||||||
|
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||||
|
FOREIGN KEY (item_id) REFERENCES items (id)
|
||||||
|
);
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
DB::statement($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('panel_gr_masters');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -239,5 +239,10 @@ class PermissionSeeder extends Seeder
|
|||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import locator validation']);
|
Permission::updateOrCreate(['name' => 'view import locator validation']);
|
||||||
Permission::updateOrCreate(['name' => 'view export locator validation']);
|
Permission::updateOrCreate(['name' => 'view export locator validation']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import panel gr master']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export panel gr master']);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,5 +36,14 @@ class="px-2 py-1 border border-primary-500 text-primary-600 rounded hover:bg-pri
|
|||||||
Print Item
|
Print Item
|
||||||
</button>
|
</button>
|
||||||
@endcan
|
@endcan
|
||||||
|
@can('view export serial number button')
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
wire:click="exportSerialNo"
|
||||||
|
class="px-2 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||||
|
>
|
||||||
|
Export Serial Number
|
||||||
|
</button>
|
||||||
|
@endcan
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -7,14 +7,6 @@
|
|||||||
</head>
|
</head>
|
||||||
<body style="margin:0;padding:0;background:#f4f6f9;font-family:Arial,Helvetica,sans-serif;">
|
<body style="margin:0;padding:0;background:#f4f6f9;font-family:Arial,Helvetica,sans-serif;">
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>Visitor Arrival Notification</title>
|
|
||||||
</head>
|
|
||||||
<body style="margin:0;padding:0;background:#ffffff;font-family:Arial,Helvetica,sans-serif;">
|
|
||||||
|
|
||||||
<table width="100%" cellpadding="0" cellspacing="0" style="background:#ffffff;">
|
<table width="100%" cellpadding="0" cellspacing="0" style="background:#ffffff;">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -25,8 +17,14 @@
|
|||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<tr>
|
<tr>
|
||||||
<td style="background:#0f766e;padding:20px;text-align:center;">
|
<td style="background:#0f766e;padding:20px;text-align:center;">
|
||||||
<h2 style="margin:0;color:#ffffff;">
|
{{-- <h2 style="margin:0;color:#ffffff;">
|
||||||
Visitor Arrival Notification
|
Visitor Arrival Notification
|
||||||
|
</h2> --}}
|
||||||
|
<h2 style="margin:0;color:#ffffff;">
|
||||||
|
{{ $visitor->type === 'InterUnitStaff'
|
||||||
|
? 'Employee Arrival Notification'
|
||||||
|
: 'Visitor Arrival Notification'
|
||||||
|
}}
|
||||||
</h2>
|
</h2>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -40,7 +38,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
A visitor has arrived and is waiting to meet you.
|
A {{ $visitor->type === 'InterUnitStaff' ? 'Employee' : 'Visitor' }} has arrived and is waiting to meet you.
|
||||||
Please find the details below:
|
Please find the details below:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@@ -48,8 +46,11 @@
|
|||||||
style="border-collapse:collapse;margin-top:15px;">
|
style="border-collapse:collapse;margin-top:15px;">
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border:1px solid #d1d5db;width:30%;font-weight:bold;">
|
{{-- <td style="border:1px solid #d1d5db;width:30%;font-weight:bold;">
|
||||||
Visitor Name
|
Visitor Name
|
||||||
|
</td> --}}
|
||||||
|
<td style="border:1px solid #d1d5db;width:30%;font-weight:bold;">
|
||||||
|
{{ $visitor->type === 'InterUnitStaff' ? 'Employee Name' : 'Visitor Name' }}
|
||||||
</td>
|
</td>
|
||||||
<td style="border:1px solid #d1d5db;">
|
<td style="border:1px solid #d1d5db;">
|
||||||
{{ $visitor->name }}
|
{{ $visitor->name }}
|
||||||
@@ -67,7 +68,7 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border:1px solid #d1d5db;font-weight:bold;">
|
<td style="border:1px solid #d1d5db;font-weight:bold;">
|
||||||
Company
|
{{ $visitor->type === 'InterUnitStaff' ? 'Unit' : 'Company' }}
|
||||||
</td>
|
</td>
|
||||||
<td style="border:1px solid #d1d5db;">
|
<td style="border:1px solid #d1d5db;">
|
||||||
{{ $visitor->company }}
|
{{ $visitor->company }}
|
||||||
@@ -83,6 +84,15 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td style="border:1px solid #d1d5db;font-weight:bold;">
|
||||||
|
No of Person
|
||||||
|
</td>
|
||||||
|
<td style="border:1px solid #d1d5db;">
|
||||||
|
{{ $visitor->number_of_person }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border:1px solid #d1d5db;font-weight:bold;">
|
<td style="border:1px solid #d1d5db;font-weight:bold;">
|
||||||
Visit Time
|
Visit Time
|
||||||
|
|||||||
@@ -15,8 +15,14 @@
|
|||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<tr>
|
<tr>
|
||||||
<td style="background:#0f766e;padding:20px;text-align:center;">
|
<td style="background:#0f766e;padding:20px;text-align:center;">
|
||||||
<h2 style="margin:0;color:#ffffff;">
|
{{-- <h2 style="margin:0;color:#ffffff;">
|
||||||
Visitor Out Notification
|
Visitor Out Notification
|
||||||
|
</h2> --}}
|
||||||
|
<h2 style="margin:0;color:#ffffff;">
|
||||||
|
{{ $entry->type === 'InterUnitStaff'
|
||||||
|
? 'Employee Out Notification'
|
||||||
|
: 'Visitor Out Notification'
|
||||||
|
}}
|
||||||
</h2>
|
</h2>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -30,15 +36,18 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
A visitor has checked out. Please find the details below:
|
A {{ $entry->type === 'InterUnitStaff' ? 'Employee' : 'Visitor' }} has checked out. Please find the details below:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<table width="100%" cellpadding="10" cellspacing="0"
|
<table width="100%" cellpadding="10" cellspacing="0"
|
||||||
style="border-collapse:collapse;margin-top:15px;">
|
style="border-collapse:collapse;margin-top:15px;">
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border:1px solid #d1d5db;width:30%;font-weight:bold;">
|
{{-- <td style="border:1px solid #d1d5db;width:30%;font-weight:bold;">
|
||||||
Visitor Name
|
Visitor Name
|
||||||
|
</td> --}}
|
||||||
|
<td style="border:1px solid #d1d5db;width:30%;font-weight:bold;">
|
||||||
|
{{ $entry->type === 'InterUnitStaff' ? 'Employee Name' : 'Visitor Name' }}
|
||||||
</td>
|
</td>
|
||||||
<td style="border:1px solid #d1d5db;">
|
<td style="border:1px solid #d1d5db;">
|
||||||
{{ $entry?->name ?? '-' }}
|
{{ $entry?->name ?? '-' }}
|
||||||
@@ -55,8 +64,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border:1px solid #d1d5db;font-weight:bold;">
|
{{-- <td style="border:1px solid #d1d5db;font-weight:bold;">
|
||||||
Company
|
Company
|
||||||
|
</td> --}}
|
||||||
|
<td style="border:1px solid #d1d5db;font-weight:bold;">
|
||||||
|
{{ $entry->type === 'InterUnitStaff' ? 'Unit' : 'Company' }}
|
||||||
</td>
|
</td>
|
||||||
<td style="border:1px solid #d1d5db;">
|
<td style="border:1px solid #d1d5db;">
|
||||||
{{ $entry?->company ?? '-' }}
|
{{ $entry?->company ?? '-' }}
|
||||||
|
|||||||
@@ -307,7 +307,7 @@
|
|||||||
max-width: <?php echo $isilogoMaxWidth; ?>mm;
|
max-width: <?php echo $isilogoMaxWidth; ?>mm;
|
||||||
left: 71mm;"> --}}
|
left: 71mm;"> --}}
|
||||||
<img src="{{ $qrBase64 }}"
|
<img src="{{ $qrBase64 }}"
|
||||||
style="position: absolute; bottom: 1.2mm; right: 2mm; width: 8mm; height: 7.2mm;">
|
style="position: absolute; bottom: 0.8mm; right: 2mm; width: 8mm; height: 7.8mm;">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,17 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
right: 5pt;
|
right: 5pt;
|
||||||
top: 8pt;
|
top: 8pt;
|
||||||
|
/* width: 69pt; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.po-long {
|
||||||
|
font-size: 8pt;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: left !important;
|
||||||
|
position: absolute;
|
||||||
|
right: 5pt;
|
||||||
|
top: 8pt;
|
||||||
|
width: 69pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* .desc {
|
/* .desc {
|
||||||
@@ -108,7 +119,10 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="text">
|
<td class="text">
|
||||||
<div class="serial">{{ $sticker['serial'] }}</div>
|
<div class="serial">{{ $sticker['serial'] }}</div>
|
||||||
<div class="po">{{ $sticker['production_order'] }}</div>
|
{{-- <div class="po">{{ $sticker['production_order'] }}</div> --}}
|
||||||
|
<div class="{{ strlen($sticker['serial']) > 14 ? 'po-long' : 'po' }}">
|
||||||
|
{{ $sticker['production_order'] }}
|
||||||
|
</div>
|
||||||
<div class="desc">{{ $sticker['description'] }}</div>
|
<div class="desc">{{ $sticker['description'] }}</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -79,6 +79,16 @@
|
|||||||
top: 8pt;
|
top: 8pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.po-long {
|
||||||
|
font-size: 8pt;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: left !important;
|
||||||
|
position: absolute;
|
||||||
|
right: 5pt;
|
||||||
|
top: 8pt;
|
||||||
|
width: 45pt;
|
||||||
|
}
|
||||||
|
|
||||||
/* .desc {
|
/* .desc {
|
||||||
font-size: 6pt;
|
font-size: 6pt;
|
||||||
margin-left: -5pt;
|
margin-left: -5pt;
|
||||||
@@ -108,7 +118,10 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="text">
|
<td class="text">
|
||||||
<div class="serial">{{ $sticker['serial'] }}</div>
|
<div class="serial">{{ $sticker['serial'] }}</div>
|
||||||
<div class="po">{{ $sticker['production_order'] }}</div>
|
{{-- <div class="po">{{ $sticker['production_order'] }}</div> --}}
|
||||||
|
<div class="{{ strlen($sticker['serial']) > 14 ? 'po-long' : 'po' }}">
|
||||||
|
{{ $sticker['production_order'] }}
|
||||||
|
</div>
|
||||||
<div class="desc">{{ $sticker['description'] }}</div>
|
<div class="desc">{{ $sticker['description'] }}</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -234,3 +234,7 @@ Route::post('file/store', [SapFileController::class, 'store'])->name('file.store
|
|||||||
Route::get('/print-pallet/{pallet}/{plant}', [PalletPrintController::class, 'print'])->name('print.pallet');
|
Route::get('/print-pallet/{pallet}/{plant}', [PalletPrintController::class, 'print'])->name('print.pallet');
|
||||||
|
|
||||||
Route::post('vehicle/entry', [VehicleController::class, 'storeVehicleEntry']);
|
Route::post('vehicle/entry', [VehicleController::class, 'storeVehicleEntry']);
|
||||||
|
|
||||||
|
//..Item Code
|
||||||
|
|
||||||
|
Route::get('item-code', [PlantController::class, 'getItemCode']);
|
||||||
|
|||||||
@@ -66,6 +66,10 @@ Route::get('production-orders/{production_order}/{plant_code}/printItemSerial',
|
|||||||
[ProductionOrderController::class, 'printItemSerial']
|
[ProductionOrderController::class, 'printItemSerial']
|
||||||
)->name('production-orders.printItemSerial');
|
)->name('production-orders.printItemSerial');
|
||||||
|
|
||||||
|
Route::get('production-orders/{production_order}/{plant_code}/{from_serial_no}/{to_serial_no}/exportSerial',
|
||||||
|
[ProductionOrderController::class, 'exportSerial']
|
||||||
|
)->name('production-orders.exportSerial');
|
||||||
|
|
||||||
Route::get('/visitor-badge/{id}', [VisitorBadgeController::class, 'show'])
|
Route::get('/visitor-badge/{id}', [VisitorBadgeController::class, 'show'])
|
||||||
->name('visitor.badge');
|
->name('visitor.badge');
|
||||||
// Route::get('/characteristic/approve', [CharacteristicApprovalController::class, 'approve'])
|
// Route::get('/characteristic/approve', [CharacteristicApprovalController::class, 'approve'])
|
||||||
|
|||||||
Reference in New Issue
Block a user