Compare commits
49 Commits
8689893088
...
ranjith-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a90bc7b82 | ||
|
|
19632fde79 | ||
|
|
f10a95e874 | ||
|
|
172fa16813 | ||
|
|
fa9665e499 | ||
|
|
f46e59ab70 | ||
|
|
37cabbc93d | ||
|
|
bb54180277 | ||
|
|
1162bc81c9 | ||
|
|
6e07f4957b | ||
|
|
34ba329e21 | ||
|
|
9437ee4a4b | ||
|
|
9a3692b06b | ||
|
|
57ed6e40ec | ||
|
|
06b679db40 | ||
|
|
155520a0ad | ||
|
|
778d2ef383 | ||
|
|
f228cb44a2 | ||
|
|
f9b95a136a | ||
|
|
fd5a67899e | ||
|
|
eb25216153 | ||
|
|
0d8db9d336 | ||
|
|
3082903de5 | ||
|
|
56d61e54db | ||
|
|
a4dcbcd771 | ||
|
|
369fbb5245 | ||
|
|
e9c23d0ca6 | ||
|
|
41413c3c2f | ||
|
|
d3aa93ecad | ||
|
|
5fb025ecd9 | ||
|
|
707a3b949c | ||
|
|
0219554eb7 | ||
|
|
fa8d5690db | ||
|
|
9dcec45920 | ||
|
|
fe05be6538 | ||
|
|
b30c19eda0 | ||
|
|
541793613c | ||
|
|
d2b104eaf3 | ||
|
|
6905981e55 | ||
|
|
b933849854 | ||
|
|
cb8740d048 | ||
|
|
5c826e8c3d | ||
|
|
02a435e93d | ||
|
|
ce0bfa72ca | ||
|
|
bc60690872 | ||
|
|
f4d416bea2 | ||
|
|
5279b016d1 | ||
|
|
2fb143c1f2 | ||
|
|
eac712aaac |
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\PanelBoxValidation;
|
||||
use App\Models\PanelGrMaster;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
@@ -35,6 +36,17 @@ class PanelGrMasterExporter extends Exporter
|
||||
->label('INSPECTION LOT NUMBER'),
|
||||
ExportColumn::make('quantity')
|
||||
->label('QUANTITY'),
|
||||
ExportColumn::make('scanned_quantity')
|
||||
->label('SCANNED QUANTITY')
|
||||
->getStateUsing(function ($record) {
|
||||
return PanelBoxValidation::where('plant_id', $record->plant_id)
|
||||
->where('production_order', $record->document_number)
|
||||
->where('inspection_lot_number', $record->inspection_lot_number)
|
||||
->whereHas('stickerMaster', function ($query) use ($record) {
|
||||
$query->where('item_id', $record->item_id);
|
||||
})
|
||||
->count();
|
||||
}),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
|
||||
@@ -22,9 +22,9 @@ class ProductionOrderExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant_id')
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('item_id')
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('quantity')
|
||||
->label('QUANTITY'),
|
||||
|
||||
93
app/Filament/Exports/PumpTestingResultExporter.php
Normal file
93
app/Filament/Exports/PumpTestingResultExporter.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\PumpTestingResult;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class PumpTestingResultExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = PumpTestingResult::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.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('tested_date')
|
||||
->label('TESTED DATE'),
|
||||
ExportColumn::make('tested_type')
|
||||
->label('TESTED TYPE'),
|
||||
ExportColumn::make('pumpTestingMaster.item.code')
|
||||
->label('PUMP CODE'),
|
||||
ExportColumn::make('pumpTestingMaster.item.category')
|
||||
->label('PUMP CATEGORY')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('pumpTestingMaster.item.description')
|
||||
->label('PUMP TYPE'),
|
||||
ExportColumn::make('pumpTestingMaster.item.uom')
|
||||
->label('UNIT OF MEASURE')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('pump_serial_number')
|
||||
->label('PUMP SERIAL NUMBER'),
|
||||
ExportColumn::make('correction_head')
|
||||
->label('CORRECTION HEAD'),
|
||||
ExportColumn::make('sl_no')
|
||||
->label('SL. NO.'),
|
||||
ExportColumn::make('voltage')
|
||||
->label('VOLTAGE'),
|
||||
ExportColumn::make('current')
|
||||
->label('CURRENT'),
|
||||
ExportColumn::make('watt')
|
||||
->label('WATT'),
|
||||
ExportColumn::make('frequency')
|
||||
->label('FREQUENCY'),
|
||||
ExportColumn::make('speed')
|
||||
->label('SPEED'),
|
||||
ExportColumn::make('discharge')
|
||||
->label('DISCHARGE'),
|
||||
ExportColumn::make('head')
|
||||
->label('HEAD'),
|
||||
ExportColumn::make('pump_output')
|
||||
->label('PUMP OUTPUT'),
|
||||
ExportColumn::make('power_p2')
|
||||
->label('PUMP P2'),
|
||||
ExportColumn::make('overall_efficiency')
|
||||
->label('OVERALL EFFICIENCY'),
|
||||
ExportColumn::make('pump_efficiency')
|
||||
->label('PUMP EFFICIENCY'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your pump testing result 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;
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,10 @@ class RequestCharacteristicExporter extends Exporter
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('aufnr')
|
||||
->label('JOB NUMBER'),
|
||||
ExportColumn::make('gernr')
|
||||
->label('SERIAL NUMBER'),
|
||||
ExportColumn::make('model_type')
|
||||
->label('MODEL TYPE'),
|
||||
ExportColumn::make('characteristicApproverMaster.approver_type')
|
||||
->label('APPROVER TYPE'),
|
||||
ExportColumn::make('characteristicApproverMaster.characteristic_field')
|
||||
|
||||
58
app/Filament/Exports/SaleOrderMasterExporter.php
Normal file
58
app/Filament/Exports/SaleOrderMasterExporter.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\SaleOrderMaster;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class SaleOrderMasterExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = SaleOrderMaster::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.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('sale_order_number')
|
||||
->label('SALE ORDER NUMBER'),
|
||||
ExportColumn::make('supplier_name')
|
||||
->label('SUPPLIER NAME'),
|
||||
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 sale order 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;
|
||||
}
|
||||
}
|
||||
68
app/Filament/Exports/SparePackingExporter.php
Normal file
68
app/Filament/Exports/SparePackingExporter.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\SparePacking;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class SparePackingExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = SparePacking::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.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('saleOrder.sale_order_number')
|
||||
->label('SALE ORDER NUMBER'),
|
||||
ExportColumn::make('saleOrder.supplier_name')
|
||||
->label('SUPPLIER NAME'),
|
||||
ExportColumn::make('spare_packing_number')
|
||||
->label('SPARE PACKING NUMBER'),
|
||||
ExportColumn::make('document_number')
|
||||
->label('DOCUMENT NUMBER'),
|
||||
ExportColumn::make('quantity')
|
||||
->label('QUANTITY'),
|
||||
ExportColumn::make('spare_packing_status')
|
||||
->label('SPARE PACKING STATUS'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('scanned_at')
|
||||
->label('SCANNED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('scanned_by')
|
||||
->label('SCANNED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your spare packing 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;
|
||||
}
|
||||
}
|
||||
@@ -22,79 +22,79 @@ class CharacteristicApproverMasterImporter extends Importer
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Code')
|
||||
->examples(['1000', '1000'])
|
||||
->examples(['1000', '1000', '1000'])
|
||||
->label('Plant Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('machine')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Work Center')
|
||||
->examples(['RMGLAS02', 'RMGLAS02'])
|
||||
->examples(['RMGLAS02', 'RMGLAS02', 'RMGLAS02'])
|
||||
->label('Work Center')
|
||||
->relationship(resolveUsing: 'work_center')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('approver_type')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Approver Type')
|
||||
->examples(['Characteristic', 'Quality'])
|
||||
->examples(['Characteristic', 'Quality', 'Stop'])
|
||||
->label('Approver Type'),
|
||||
ImportColumn::make('machine_name')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Machine Name')
|
||||
->examples(['15002635', '17002635'])
|
||||
->examples(['15002635', '16002635', '17002635'])
|
||||
->label('Machine Name'),
|
||||
ImportColumn::make('characteristic_field')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Master Characteristic Field')
|
||||
->examples(['NIL', 'MV SERIES'])
|
||||
->examples(['NIL', 'MV SERIES', 'MVHS SERIES'])
|
||||
->label('Master Characteristic Field'),
|
||||
ImportColumn::make('name1')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Approver Name 1')
|
||||
->examples(['Test 1', 'Test 4'])
|
||||
->examples(['Test 1', 'Test 4', 'Test 7'])
|
||||
->label('Approver Name 1'),
|
||||
ImportColumn::make('mail1')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Mail 1')
|
||||
->examples(['test1@cripumps.com', 'test4@cripumps.com'])
|
||||
->examples(['test1@cripumps.com', 'test4@cripumps.com', 'test7@cripumps.com'])
|
||||
->label('Mail 1'),
|
||||
ImportColumn::make('duration1')
|
||||
->numeric()
|
||||
->requiredMapping()
|
||||
->exampleHeader('Duration 1')
|
||||
->examples(['0.05', '0.30'])
|
||||
->examples(['0.05', '0.30', '0.30'])
|
||||
->label('Duration 1'),
|
||||
ImportColumn::make('name2')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Approver Name 2')
|
||||
->examples(['Test 2', 'Test 5'])
|
||||
->examples(['Test 2', 'Test 5', 'Test 8'])
|
||||
->label('Approver Name 2'),
|
||||
ImportColumn::make('mail2')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Mail 2')
|
||||
->examples(['test2@cripumps.com', 'test5@cripumps.com'])
|
||||
->examples(['test2@cripumps.com', 'test5@cripumps.com', 'test8@cripumps.com'])
|
||||
->label('Mail 2'),
|
||||
ImportColumn::make('duration2')
|
||||
->numeric()
|
||||
->requiredMapping()
|
||||
->exampleHeader('Duration 2')
|
||||
->examples(['0.05', '0.30'])
|
||||
->examples(['0.05', '0.30', '0.30'])
|
||||
->label('Duration 2'),
|
||||
ImportColumn::make('name3')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Approver Name 3')
|
||||
->examples(['Test 3', 'Test 6'])
|
||||
->examples(['Test 3', 'Test 6', 'Test 9'])
|
||||
->label('Approver Name 3'),
|
||||
ImportColumn::make('mail3')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Mail 3')
|
||||
->examples(['test3@cripumps.com', 'test6@cripumps.com'])
|
||||
->examples(['test3@cripumps.com', 'test6@cripumps.com', 'test9@cripumps.com'])
|
||||
->label('Mail 3'),
|
||||
ImportColumn::make('duration3')
|
||||
->numeric()
|
||||
->requiredMapping()
|
||||
->exampleHeader('Duration 3')
|
||||
->examples(['0.05', '0.30'])
|
||||
->examples(['0.05', '0.30', '0.30'])
|
||||
->label('Duration 3'),
|
||||
];
|
||||
}
|
||||
@@ -135,8 +135,8 @@ class CharacteristicApproverMasterImporter extends Importer
|
||||
if ($workCenter == null || $workCenter == '') {
|
||||
$warnMsg[] = "Work center can't be empty!";
|
||||
}
|
||||
if ($apprTyp == '' || $apprTyp == null || ($apprTyp != 'Characteristic' && $apprTyp != 'Quality')) {
|
||||
$warnMsg[] = "Approver type must be either 'Characteristic' or 'Quality'!";
|
||||
if ($apprTyp == '' || $apprTyp == null || ($apprTyp != 'Characteristic' && $apprTyp != 'Quality' && $apprTyp != 'Stop')) {
|
||||
$warnMsg[] = "Approver type must be either 'Characteristic', 'Quality', or 'Stop'!";
|
||||
}
|
||||
if ($machineNam == null || $machineNam == '') {
|
||||
$warnMsg[] = "Machine name can't be empty!";
|
||||
|
||||
@@ -40,9 +40,17 @@ class RequestCharacteristicImporter extends Importer
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('aufnr')
|
||||
->label('AUFNR')
|
||||
->exampleHeader('AUFNR')
|
||||
->label('JOB NUMBER')
|
||||
->exampleHeader('JOB NUMBER')
|
||||
->example('1234567'),
|
||||
ImportColumn::make('gernr')
|
||||
->label('SERIAL NUMBER')
|
||||
->exampleHeader('SERIAL NUMBER')
|
||||
->example('1234567890123'),
|
||||
ImportColumn::make('model_type')
|
||||
->label('MODEL TYPE')
|
||||
->exampleHeader('MODEL TYPE')
|
||||
->example('PUMP'),
|
||||
ImportColumn::make('characteristic_name')
|
||||
->label('CHARACTERISTIC NAME')
|
||||
->exampleHeader('CHARACTERISTIC NAME')
|
||||
@@ -111,10 +119,6 @@ class RequestCharacteristicImporter extends Importer
|
||||
->label('UPDATED BY')
|
||||
->exampleHeader('UPDATED BY')
|
||||
->example('RAW01234'),
|
||||
ImportColumn::make('model_type')
|
||||
->label('MODEL TYPE')
|
||||
->exampleHeader('MODEL TYPE')
|
||||
->example('PUMP'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -125,15 +129,15 @@ class RequestCharacteristicImporter extends Importer
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new RequestCharacteristic();
|
||||
return new RequestCharacteristic;
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your request characteristic import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||
$body = 'Your request characteristic 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.';
|
||||
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
153
app/Filament/Imports/SaleOrderMasterImporter.php
Normal file
153
app/Filament/Imports/SaleOrderMasterImporter.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\Item;
|
||||
use App\Models\Plant;
|
||||
use App\Models\SaleOrderMaster;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Filament\Facades\Filament;
|
||||
use Str;
|
||||
|
||||
class SaleOrderMasterImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = SaleOrderMaster::class;
|
||||
|
||||
protected array $importedSaleOrders = [];
|
||||
|
||||
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('sale_order_number')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Sale Order Number')
|
||||
->example('1JA0029512')
|
||||
->label('Sale Order Number')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('supplier_name')
|
||||
->exampleHeader('Supplier Name')
|
||||
->example('ABC Supplier')
|
||||
->label('Supplier Name'),
|
||||
ImportColumn::make('quantity')
|
||||
->exampleHeader('Quantity')
|
||||
->example('100')
|
||||
->label('Quantity'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?SaleOrderMaster
|
||||
{
|
||||
$warnMsg = [];
|
||||
$plantCod = $this->data['plant'];
|
||||
$plant = null;
|
||||
$item = null;
|
||||
$saleOrder = trim($this->data['sale_order_number']);
|
||||
$supplierName = trim($this->data['supplier_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 (Str::length($this->data['sale_order_number']) < 9) {
|
||||
$warnMsg[] = 'Invalid Sale Order number found';
|
||||
}
|
||||
|
||||
if (empty($this->data['sale_order_number'])) {
|
||||
$warnMsg[] = 'Sale Order Number cannot be empty.';
|
||||
}
|
||||
|
||||
if (empty($this->data['supplier_name'])) {
|
||||
$warnMsg[] = 'Supplier Name cannot be empty.';
|
||||
}
|
||||
|
||||
if (empty($this->data['quantity'])) {
|
||||
$warnMsg[] = 'Quantity cannot be empty.';
|
||||
}
|
||||
|
||||
if (! is_numeric($this->data['quantity'])) {
|
||||
$warnMsg[] = 'Quantity must be a number.';
|
||||
}
|
||||
|
||||
if (isset($this->importedSaleOrders[$saleOrder])) {
|
||||
|
||||
if (strtolower(trim($this->importedSaleOrders[$saleOrder])) != strtolower($supplierName)){
|
||||
$warnMsg[] = "Sale Order '{$saleOrder}' has multiple supplier names in the import file.";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->importedSaleOrders[$saleOrder] = $supplierName;
|
||||
}
|
||||
|
||||
$existingPo = SaleOrderMaster::where('plant_id', $plant->id)->where('sale_order_number', $this->data['sale_order_number'])->first();
|
||||
|
||||
if ($existingPo && trim(strtolower($existingPo->supplier_name)) != trim(strtolower($this->data['supplier_name'])))
|
||||
{
|
||||
$warnMsg[] = "Sale Order '{$this->data['sale_order_number']}' is already mapped to supplier '{$existingPo->supplier_name}'.";
|
||||
}
|
||||
|
||||
$existingPoItem = SaleOrderMaster::where('plant_id', $plant->id)->where('item_id', $item->id)->where('sale_order_number', $this->data['sale_order_number'])->where('supplier_name', $this->data['supplier_name'])->first();
|
||||
|
||||
if ($existingPoItem)
|
||||
{
|
||||
$warnMsg[] = "Sale Order '{$this->data['sale_order_number']}' is already exist with item code '{$this->data['item']}' and supplier name '{$this->data['supplier_name']}'.";
|
||||
}
|
||||
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
$operatorName = $user->name;
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
SaleOrderMaster::updateOrCreate([
|
||||
'plant_id' => $plant->id,
|
||||
'item_id' => $item->id,
|
||||
'sale_order_number' => $this->data['sale_order_number'],
|
||||
'supplier_name' => $this->data['supplier_name'],
|
||||
'quantity' => $this->data['quantity'] ?? null,
|
||||
'created_by' => $operatorName,
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your sale order 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;
|
||||
}
|
||||
}
|
||||
63
app/Filament/Imports/SparePackingImporter.php
Normal file
63
app/Filament/Imports/SparePackingImporter.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\SparePacking;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
|
||||
class SparePackingImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = SparePacking::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('item')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('sale_order_master_id')
|
||||
->requiredMapping()
|
||||
->numeric()
|
||||
->rules(['required', 'integer']),
|
||||
ImportColumn::make('spare_packing_number'),
|
||||
ImportColumn::make('document_number'),
|
||||
ImportColumn::make('batch_number'),
|
||||
ImportColumn::make('quantity'),
|
||||
ImportColumn::make('spare_packing_status'),
|
||||
ImportColumn::make('scanned_at')
|
||||
->requiredMapping()
|
||||
->rules(['required', 'datetime']),
|
||||
ImportColumn::make('created_by'),
|
||||
ImportColumn::make('updated_by'),
|
||||
ImportColumn::make('scanned_by'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?SparePacking
|
||||
{
|
||||
// return SparePacking::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new SparePacking();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your spare packing 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;
|
||||
}
|
||||
}
|
||||
301
app/Filament/Pages/SpareMasterPrint.php
Normal file
301
app/Filament/Pages/SpareMasterPrint.php
Normal file
@@ -0,0 +1,301 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use Filament\Pages\Page;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Filament\Forms\Concerns\InteractsWithForms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Notifications\Notification;
|
||||
use App\Models\SaleOrderMaster;
|
||||
use App\Models\Plant;
|
||||
use App\Models\SparePacking;
|
||||
use Filament\Facades\Filament;
|
||||
|
||||
class SpareMasterPrint extends Page
|
||||
{
|
||||
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||
|
||||
protected static string $view = 'filament.pages.spare-master-print';
|
||||
|
||||
protected static ?string $navigationGroup = 'Spare Packing';
|
||||
|
||||
use InteractsWithForms;
|
||||
|
||||
public $pId, $palletNo, $serialNo;
|
||||
public $snoCount = 0;
|
||||
|
||||
public bool $disableSerialNo = false;
|
||||
public bool $disablePalletNo = false;
|
||||
|
||||
public $locatorNumber;
|
||||
public $state = [];
|
||||
|
||||
public $plantId;
|
||||
|
||||
public $scanLocator;
|
||||
|
||||
public $locators;
|
||||
|
||||
public array $filters = [];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->form->fill([
|
||||
'plant_id'=>$this->plantId,
|
||||
'pallet_quantity' => 0,
|
||||
]);
|
||||
}
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->statePath('filters')
|
||||
->schema([
|
||||
Section::make('')
|
||||
->schema([
|
||||
Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->reactive()
|
||||
// ->options(Plant::pluck('name', 'id'))
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||
})
|
||||
->required(),
|
||||
Select::make('sale_order_master_id')
|
||||
->label('Sale Order Number')
|
||||
->reactive()
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return SaleOrderMaster::where('plant_id', $plantId)->distinct()->pluck('sale_order_number', 'sale_order_number'); //->pluck('customer_po', 'id'); ->distinct()
|
||||
})
|
||||
->required()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('scan_pallet_no', null);
|
||||
}),
|
||||
Select::make('scan_pallet_no')
|
||||
->label('Scan Pallet No')
|
||||
->reactive()
|
||||
->searchable()
|
||||
->options(function ($get) {
|
||||
|
||||
$plantId = $get('plant_id');
|
||||
$saleOrder = $get('sale_order_master_id');
|
||||
|
||||
if (! $plantId || ! $saleOrder)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
$poIds = SaleOrderMaster::where('plant_id', $plantId)->where('sale_order_number', $saleOrder)->pluck('id');
|
||||
$palletNumbers = SparePacking::query()
|
||||
->where('plant_id', $plantId)
|
||||
->whereIn('sale_order_master_id', $poIds)
|
||||
->whereNotNull('spare_packing_number')
|
||||
->groupBy('spare_packing_number')
|
||||
->havingRaw('COUNT(*) = COUNT(spare_packing_status)')
|
||||
->havingRaw("SUM(CASE WHEN TRIM(spare_packing_status) = '' THEN 1 ELSE 0 END) = 0")
|
||||
->orderBy('spare_packing_number')
|
||||
->pluck('spare_packing_number')
|
||||
->toArray();
|
||||
return collect($palletNumbers) ->mapWithKeys(fn ($number) => [$number => $number]) ->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, $get) {
|
||||
$palletNo = $state;
|
||||
$plantId = $get('plant_id');
|
||||
|
||||
$this->dispatch('loadData', $palletNo, $plantId);
|
||||
})
|
||||
->extraAttributes([
|
||||
'wire:keydown.enter' => 'processPalletNo($event.target.value)',
|
||||
]),
|
||||
// TextInput::make('customer_name')
|
||||
// ->label('Customer Name')
|
||||
// ->required()
|
||||
// ->reactive(),
|
||||
])
|
||||
->columns(3)
|
||||
]);
|
||||
}
|
||||
|
||||
public function processPalletNo($palletNo)
|
||||
{
|
||||
$plantId = $this->form->getState()['plant_id'];
|
||||
|
||||
$plantId = trim($plantId) ?? null;
|
||||
|
||||
$palletNo= $this->form->getState()['scan_pallet_no'];
|
||||
|
||||
$palletNo = trim($palletNo) ?? null;
|
||||
|
||||
$operatorName = Filament::auth()->user()->name;
|
||||
|
||||
if ($palletNo == null || $palletNo == '')
|
||||
{
|
||||
Notification::make()
|
||||
->title("Pallet number can't be empty!")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadLocator' ,'',$plantId);
|
||||
$this->form->fill
|
||||
([
|
||||
'plant_id' => $plantId,
|
||||
'scan_serial_no' => null,
|
||||
'scan_pallet_no' => null,
|
||||
'scan_locator_no' => null,
|
||||
'pallet_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
// else if (strlen($palletNo) < 10)
|
||||
// {
|
||||
// Notification::make()
|
||||
// ->title("Pallet number '$palletNo' must be at least 10 digits.")
|
||||
// ->danger()
|
||||
// ->duration(5000)
|
||||
// ->send();
|
||||
|
||||
// $this->dispatch('loadLocator' ,'',$plantId);
|
||||
// $this->form->fill
|
||||
// ([
|
||||
// 'plant_id' => $plantId,
|
||||
// 'scan_serial_no' => null,
|
||||
// 'scan_pallet_no' => null,
|
||||
// 'scan_locator_no' => null,
|
||||
// 'pallet_quantity' => 0,
|
||||
// 'created_by' => $operatorName,
|
||||
// 'scanned_by' => $operatorName,
|
||||
// ]);
|
||||
// return;
|
||||
// }
|
||||
|
||||
$Palletexists = WireMasterPacking::where('wire_packing_number', $palletNo)
|
||||
->where('plant_id', $plantId)->first();
|
||||
if(!$Palletexists)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Pallet number '$palletNo' does not found in wire master packing table.")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData' ,'',$plantId);
|
||||
$this->form->fill
|
||||
([
|
||||
'plant_id' => $plantId,
|
||||
'scan_pallet_no' => null,
|
||||
'pallet_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->snoCount = WireMasterPacking::where('plant_id', $plantId)
|
||||
->where('wire_packing_number', $palletNo)
|
||||
->count();
|
||||
|
||||
$this->dispatch('loadData', $palletNo, $plantId);
|
||||
$this->form->fill
|
||||
([
|
||||
'plant_id' => $plantId,
|
||||
'scan_pallet_no' => $palletNo,
|
||||
'pallet_quantity' => $this->snoCount,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public function saveCustomerPO(){
|
||||
$plantId = $this->form->getState()['plant_id'];
|
||||
|
||||
$plantId = trim($plantId) ?? null;
|
||||
|
||||
$palletNo= $this->form->getState()['scan_pallet_no'];
|
||||
|
||||
$palletNo = trim($palletNo) ?? null;
|
||||
|
||||
$customerPO = $this->form->getState()['customer_po'];
|
||||
|
||||
$customerPO = trim($customerPO) ?? null;
|
||||
|
||||
$customerName = $this->form->getState()['customer_name'];
|
||||
|
||||
$customerName = trim($customerName) ?? null;
|
||||
|
||||
if (!$plantId || !$palletNo) {
|
||||
return; // optional validation
|
||||
}
|
||||
|
||||
$record = WireMasterPacking::where('plant_id', $plantId)
|
||||
->where('wire_packing_number', $palletNo)
|
||||
->update([
|
||||
'customer_po' => $customerPO,
|
||||
'customer_name' => $customerName,
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
if($record){
|
||||
Notification::make()
|
||||
->title("Customer PO updated successfully for the pallet number '$palletNo'")
|
||||
->success()
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Notification::make()
|
||||
->title("Customer PO updation failed for the pallet number '$palletNo'")
|
||||
->success()
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public function printPallet()
|
||||
{
|
||||
$palletNumber = $this->form->getState()['scan_pallet_no'] ?? null;
|
||||
$plantId = $this->form->getState()['plant_id'] ?? null;
|
||||
$customerId = $this->form->getState()['customer_po_master_id'] ?? null;
|
||||
|
||||
$state = $this->form->getState();
|
||||
|
||||
// $customerCode = $state['customer_po'] ?? null;
|
||||
// $customerName = $state['customer_name'] ?? null;
|
||||
|
||||
if (!$palletNumber) {
|
||||
Notification::make()
|
||||
->title("Pallet number cant't be empty!")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->dispatch('open-pdf', url: route('print.sparepallet', [
|
||||
'pallet' => $state['scan_pallet_no'],
|
||||
'plant' => $state['plant_id'],
|
||||
'customer' => $state['sale_order_master_id'],
|
||||
]));
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return Auth::check() && Auth::user()->can('view spare master print page');
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,7 @@ class AlertMailRuleResource extends Resource
|
||||
Forms\Components\Select::make('module')
|
||||
->label('Module')
|
||||
->required()
|
||||
->searchable()
|
||||
->options([
|
||||
'InvoiceValidation' => 'InvoiceValidation',
|
||||
'InvoiceDataReport' => 'InvoiceDataReport',
|
||||
@@ -83,9 +84,12 @@ class AlertMailRuleResource extends Resource
|
||||
'ExportDispatchReport' => 'ExportDispatchReport',
|
||||
'LaserStopAlert' => 'LaserStopAlert',
|
||||
'LaserStopReport' => 'LaserStopReport',
|
||||
'PanelBoxAlert' => 'PanelBoxAlert',
|
||||
'PanelBoxReport' => 'PanelBoxReport',
|
||||
]),
|
||||
Forms\Components\Select::make('rule_name')
|
||||
->label('Rule Name')
|
||||
->searchable()
|
||||
->options([
|
||||
'InvoiceMail' => 'Invoice Mail',
|
||||
'SerialInvoiceMail' => 'Serial Invoice Mail',
|
||||
@@ -98,7 +102,9 @@ class AlertMailRuleResource extends Resource
|
||||
'VehicleReportMail' => 'Vehicle Report Mail',
|
||||
'ExportDispatchReportMail' => 'Export Dispatch Report Mail',
|
||||
'LaserStopAlertMail' => 'Laser Stop Alert Mail',
|
||||
'LaserStopMail' => 'Laser Stop Report Mail'
|
||||
'LaserStopMail' => 'Laser Stop Report Mail',
|
||||
'PanelBoxAlertMail' => 'Panel Box Alert Mail',
|
||||
'PanelBoxNotOkReportMail' => 'Panel Box Not Ok Report Mail'
|
||||
])
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('email')
|
||||
|
||||
@@ -128,6 +128,7 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
return [
|
||||
'Characteristic' => 'Characteristic',
|
||||
'Quality' => 'Quality',
|
||||
'Stop' => 'Stop',
|
||||
];
|
||||
})
|
||||
->default(function () {
|
||||
@@ -452,6 +453,7 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
->options([
|
||||
'Characteristic' => 'Characteristic',
|
||||
'Quality' => 'Quality',
|
||||
'Stop' => 'Stop',
|
||||
])
|
||||
->placeholder('Select Type')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
@@ -467,7 +469,7 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
->placeholder('Enter Characteristic Field'),
|
||||
TextInput::make('name1')
|
||||
->label('Approver Name 1')
|
||||
->placeholder('Enter Approver Name 2')
|
||||
->placeholder('Enter Approver Name 1')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('name2', null);
|
||||
$set('name3', null);
|
||||
@@ -480,7 +482,7 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
}),
|
||||
TextInput::make('name3')
|
||||
->label('Approver Name 3')
|
||||
->placeholder('Enter Approver Name 2'),
|
||||
->placeholder('Enter Approver Name 3'),
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder('Select From DateTime')
|
||||
|
||||
@@ -9,6 +9,7 @@ use App\Models\ProductionCharacteristic;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
@@ -31,6 +32,7 @@ use App\Filament\Exports\PanelBoxValidationExporter;
|
||||
use App\Filament\Imports\PanelBoxValidationImporter;
|
||||
use Filament\Forms\Components\Actions;
|
||||
use Filament\Forms\Components\Actions\Action;
|
||||
use Illuminate\Support\Js;
|
||||
|
||||
class PanelBoxValidationResource extends Resource
|
||||
{
|
||||
@@ -64,6 +66,7 @@ class PanelBoxValidationResource extends Resource
|
||||
$set('item_id', null);
|
||||
$set('line_id', null);
|
||||
$set('production_order', null);
|
||||
$set('inspection_lot_number', null);
|
||||
|
||||
$set('part_validation_type_options', []);
|
||||
$set('part_validation_type', null);
|
||||
@@ -117,6 +120,7 @@ class PanelBoxValidationResource extends Resource
|
||||
->afterStateUpdated(function (callable $set, callable $get, $state) {
|
||||
$set('item_id', null);
|
||||
$set('production_order', null);
|
||||
$set('inspection_lot_number', null);
|
||||
|
||||
$set('line', $state);
|
||||
|
||||
@@ -810,21 +814,21 @@ class PanelBoxValidationResource extends Resource
|
||||
|
||||
$serialExists = PanelBoxValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)->first();
|
||||
|
||||
// if ($serialExists) {
|
||||
// $set('serial_exists', true);
|
||||
// } else {
|
||||
// $set('serial_exists', false);
|
||||
// }
|
||||
|
||||
if ($serialExists && ! $get('id')) {
|
||||
$set('validationError', 'Serial number already exists in panel box validation.');
|
||||
$set('sticker_master_id', null);
|
||||
$set('uom', null);
|
||||
$set('serial_number', null);
|
||||
|
||||
return;
|
||||
if ($serialExists) {
|
||||
$set('serial_exists', true);
|
||||
} else {
|
||||
$set('serial_exists', false);
|
||||
}
|
||||
|
||||
// if ($serialExists && ! $get('id')) {
|
||||
// $set('validationError', 'Serial number already exists in panel box validation.');
|
||||
// $set('sticker_master_id', null);
|
||||
// $set('uom', null);
|
||||
// $set('serial_number', null);
|
||||
|
||||
// return;
|
||||
// }
|
||||
|
||||
$set('validationError', null);
|
||||
|
||||
foreach ($serialFields as $column) {
|
||||
@@ -943,6 +947,7 @@ class PanelBoxValidationResource extends Resource
|
||||
'id' => 'item_id',
|
||||
'onkeydown' => "
|
||||
if (event.key === 'Enter') {
|
||||
|
||||
const serialFields = [
|
||||
'serial_number_motor_qr', 'serial_number_pump_qr', 'pack_slip_motor_qr',
|
||||
'name_plate_motor_qr', 'tube_sticker_motor_qr', 'warranty_card_qr'
|
||||
@@ -962,6 +967,7 @@ class PanelBoxValidationResource extends Resource
|
||||
if (anyVisible) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
event.stopImmediatePropagation();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -969,8 +975,11 @@ class PanelBoxValidationResource extends Resource
|
||||
])
|
||||
->hint(fn ($get) => $get('validationError') ? $get('validationError') : null)
|
||||
->hintColor('danger'),
|
||||
Forms\Components\Hidden::make('serial_exists')
|
||||
->default(false),
|
||||
Forms\Components\Hidden::make('serial_exists')
|
||||
// ->default(false)
|
||||
->live()
|
||||
->dehydrated()
|
||||
->id('serial_exists'),
|
||||
|
||||
Forms\Components\Actions::make([
|
||||
Action::make('rework')
|
||||
@@ -996,9 +1005,9 @@ class PanelBoxValidationResource extends Resource
|
||||
|
||||
if ($alreadyExists) {
|
||||
Notification::make()
|
||||
->title('Invalid Rework')
|
||||
->title('Duplicate Found')
|
||||
->body(
|
||||
'This document number and inspection lot number have already been used for this serial number. Please provide a new document number and inspection lot number for rework..'
|
||||
'This document number and inspection lot number have already been used for this serial number. Please provide a new document number and inspection lot number for rework...'
|
||||
)
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
@@ -74,11 +74,14 @@ class CreatePanelBoxValidation extends CreateRecord {
|
||||
// return $data;
|
||||
// }
|
||||
|
||||
if ($this->checkIfHasCharacteristics($data)) {
|
||||
if(($data['serial_exists']) == true){
|
||||
$this->halt();
|
||||
}
|
||||
if ($this->checkIfHasCharacteristics($data) && ($data['serial_exists']) == false) {
|
||||
$this->showChecklist = true;
|
||||
$this->halt();
|
||||
}
|
||||
else{
|
||||
if(!$this->checkIfHasCharacteristics($data) && ($data['serial_exists']) == false){
|
||||
\Filament\Notifications\Notification::make()
|
||||
->title('Characteristics not found for the scanned item.')
|
||||
->danger()
|
||||
|
||||
@@ -9,6 +9,7 @@ use App\Filament\Resources\PanelGrMasterResource\RelationManagers;
|
||||
use App\Models\Item;
|
||||
use App\Models\PalletValidation;
|
||||
use App\Models\PanelGrMaster;
|
||||
use App\Models\PanelBoxValidation;
|
||||
use App\Models\Plant;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
@@ -26,6 +27,8 @@ use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Closure;
|
||||
use Filament\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class PanelGrMasterResource extends Resource
|
||||
{
|
||||
@@ -99,6 +102,9 @@ class PanelGrMasterResource extends Resource
|
||||
if ((float) $state == 0) {
|
||||
$set('quantity', null);
|
||||
}
|
||||
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
$set('updated_at', now());
|
||||
}),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
@@ -157,6 +163,20 @@ class PanelGrMasterResource extends Resource
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('scanned_quantity')
|
||||
->label('Scanned Quantity')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->getStateUsing(function ($record) {
|
||||
return PanelBoxValidation::where('plant_id', $record->plant_id)
|
||||
->where('production_order', $record->document_number)
|
||||
->where('inspection_lot_number', $record->inspection_lot_number)
|
||||
->whereHas('stickerMaster', function ($query) use ($record) {
|
||||
$query->where('item_id', $record->item_id);
|
||||
})
|
||||
->count();
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
|
||||
@@ -3,13 +3,49 @@
|
||||
namespace App\Filament\Resources\PanelGrMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\PanelGrMasterResource;
|
||||
use App\Models\PanelBoxValidation;
|
||||
use App\Models\StickerMaster;
|
||||
use Filament\Actions;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditPanelGrMaster extends EditRecord
|
||||
{
|
||||
protected static string $resource = PanelGrMasterResource::class;
|
||||
|
||||
protected function mutateFormDataBeforeSave(array $data): array
|
||||
{
|
||||
$record = $this->record;
|
||||
|
||||
$sticker = StickerMaster::where('plant_id', $record->plant_id)->where('item_id', $record->item_id)->first();
|
||||
|
||||
if($sticker)
|
||||
{
|
||||
$scannedQuantity = PanelBoxValidation::where('plant_id', $record->plant_id)
|
||||
->where('production_order', $record->document_number)
|
||||
->where('inspection_lot_number', $record->inspection_lot_number)
|
||||
->where('sticker_master_id', $sticker->id)
|
||||
->count();
|
||||
}
|
||||
|
||||
|
||||
if ((int) $data['quantity'] < $scannedQuantity) {
|
||||
Notification::make()
|
||||
->title('Invalid Quantity')
|
||||
->body("Already scanned quantity is {$scannedQuantity}.<br>Panel GR Master quantity cannot be less than {$scannedQuantity}.")
|
||||
->danger()
|
||||
->send();
|
||||
$this->halt();
|
||||
|
||||
}
|
||||
|
||||
$data['updated_by'] = Filament::auth()->user()?->name;
|
||||
$data['updated_at'] = now();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -464,7 +464,7 @@ class PumpTestingEntryResource extends Resource
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('Item', null);
|
||||
$set('isi_type', null);
|
||||
$set('tested_type', null);
|
||||
$set('created_by', null);
|
||||
$set('updated_by', null);
|
||||
}),
|
||||
@@ -479,7 +479,7 @@ class PumpTestingEntryResource extends Resource
|
||||
->reactive()
|
||||
->native(false),
|
||||
Select::make('tested_type')
|
||||
->label('Tested Type')
|
||||
->label('Search by Tested Type')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
@@ -592,13 +592,13 @@ class PumpTestingEntryResource extends Resource
|
||||
}
|
||||
|
||||
if (! empty($data['Item']) && ! empty($data['Plant'])) {
|
||||
$itemIds = Item::where('id', $data['Item'])
|
||||
$pumpMasterIds = PumpTestingMaster::where('item_id', $data['Item'])
|
||||
->where('plant_id', $data['Plant'])
|
||||
->pluck('id')
|
||||
->toArray();
|
||||
|
||||
if (! empty($itemIds)) {
|
||||
$query->whereIn('item_id', $itemIds);
|
||||
if (! empty($pumpMasterIds)) {
|
||||
$query->whereIn('pump_testing_master_id', $pumpMasterIds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -611,7 +611,14 @@ class PumpTestingEntryResource extends Resource
|
||||
})->pluck('id')->toArray();
|
||||
|
||||
if (! empty($descIds)) {
|
||||
$query->whereIn('item_id', $descIds);
|
||||
$pumpMasterIds = PumpTestingMaster::whereIn('item_id', $descIds)
|
||||
->where('plant_id', $data['Plant'])
|
||||
->pluck('id')
|
||||
->toArray();
|
||||
|
||||
if (! empty($pumpMasterIds)) {
|
||||
$query->whereIn('pump_testing_master_id', $pumpMasterIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
808
app/Filament/Resources/PumpTestingResultResource.php
Normal file
808
app/Filament/Resources/PumpTestingResultResource.php
Normal file
@@ -0,0 +1,808 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\PumpTestingResultExporter;
|
||||
use App\Filament\Resources\PumpTestingResultResource\Pages;
|
||||
use App\Models\Configuration;
|
||||
use App\Models\Item;
|
||||
use App\Models\Plant;
|
||||
use App\Models\PumpTestingMaster;
|
||||
use App\Models\PumpTestingResult;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Forms\Set;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class PumpTestingResultResource extends Resource
|
||||
{
|
||||
protected static ?string $model = PumpTestingResult::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Pump Testing Panel';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Section::make('')
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant Name')
|
||||
->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();
|
||||
})
|
||||
->columnSpan(1) // (['default' => 1, 'sm' => 2])
|
||||
->required()
|
||||
->searchable()
|
||||
->reactive()
|
||||
->default(function () {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
return ($userHas && strlen($userHas) > 0) ? $userHas : optional(PumpTestingResult::latest()->first())->plant_id ?? null;
|
||||
})
|
||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
$set('pump_testing_master_id', null);
|
||||
$set('pump_master_id', null);
|
||||
// $set('pump_type', null);
|
||||
|
||||
if (! $plantId) {
|
||||
$set('pTeError', 'Please select a plant first.');
|
||||
|
||||
return;
|
||||
} else {
|
||||
$set('pTeError', null);
|
||||
}
|
||||
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->extraAttributes(fn ($get) => [
|
||||
'class' => $get('pTeError') ? 'border-red-500' : '',
|
||||
])
|
||||
->hint(fn ($get) => $get('pTeError') ? $get('pTeError') : null)
|
||||
->hintColor('danger'),
|
||||
Forms\Components\Select::make('tested_type')
|
||||
->label('Tested Type')
|
||||
->selectablePlaceholder(false)
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if ($plantId) {
|
||||
return Configuration::where('plant_id', $plantId)
|
||||
->where('c_name', 'PUMP_DISPLAY_TEST_TYPE')
|
||||
->whereNot('c_value', 'Routine Test')
|
||||
->orderBy('created_at')
|
||||
->pluck('c_value', 'c_value')
|
||||
->toArray();
|
||||
} else {
|
||||
return Configuration::where('c_name', 'PUMP_DISPLAY_TEST_TYPE')
|
||||
->whereNot('c_value', 'Routine Test')
|
||||
->orderBy('created_at')
|
||||
->pluck('c_value', 'c_value')
|
||||
->toArray();
|
||||
}
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->columnSpan(1)
|
||||
->required()
|
||||
->default('Pump Performance Test')
|
||||
->reactive(),
|
||||
Forms\Components\DatePicker::make('tested_date')
|
||||
->label('Tested Date')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->columnSpan(1)
|
||||
->default(now())
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('correction_head')
|
||||
->label('Correction Head')
|
||||
->placeholder('Scan the correction head')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->columnSpan(1)
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\Hidden::make('pump_testing_master_id')
|
||||
// ->relationship('pumpTestingMasters', 'id')
|
||||
->required(),
|
||||
Forms\Components\Select::make('pump_master_id')
|
||||
->label('Pump Code')
|
||||
// ->relationship('pumpTestingMasters', 'id')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (! $plantId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Item::where('plant_id', $plantId)->whereHas('pumpTestingMasters')->orderBy('code')->pluck('code', 'code');
|
||||
})
|
||||
->columnSpan(1)
|
||||
->required()
|
||||
->searchable()
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$plantId = $get('plant_id'); // Get selected plant
|
||||
$set('pump_testing_master_id', null);
|
||||
// $set('pump_type', null);
|
||||
if (! $plantId) {
|
||||
$set('pump_master_id', null);
|
||||
} elseif ($state) {
|
||||
// $pumpMaster = PumpTestingMaster::where('plant_id', $plantId)->where('item_id', $state)->first();
|
||||
$pumpMaster = PumpTestingMaster::where('plant_id', $plantId)->whereHas('item', function ($query) use ($state) {
|
||||
$query->where('code', $state);
|
||||
})->first();
|
||||
|
||||
if (! $pumpMaster) {
|
||||
$set('pump_master_id', null);
|
||||
} else {
|
||||
$set('pump_testing_master_id', $pumpMaster->id);
|
||||
// $set('pump_type', $pumpMaster->item->description ?? null);
|
||||
}
|
||||
}
|
||||
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->afterStateHydrated(function ($component, $state, Get $get, Set $set) {
|
||||
if ($get('id')) {
|
||||
$itemId = PumpTestingMaster::where('id', $get('pump_testing_master_id'))->first()?->item_id;
|
||||
if ($itemId) {
|
||||
$item = Item::where('id', $itemId)->first()?->code;
|
||||
if ($item) {
|
||||
$set('pump_master_id', $item);
|
||||
} else {
|
||||
$set('pump_master_id', null);
|
||||
}
|
||||
} else {
|
||||
$set('pump_master_id', null);
|
||||
}
|
||||
}
|
||||
}),
|
||||
// Forms\Components\TextInput::make('pump_type')
|
||||
// ->label('Pump Type]')
|
||||
// ->placeholder('Choose the pump code first')
|
||||
// ->readOnly()
|
||||
// ->afterStateUpdated(function ($state, callable $set) {
|
||||
// $set('updated_by', Filament::auth()->user()?->name);
|
||||
// })
|
||||
// ->columnSpan(1)
|
||||
// ->required()
|
||||
// ->reactive(),
|
||||
Forms\Components\TextInput::make('pump_serial_number')
|
||||
->label('Pump Serial Number')
|
||||
->placeholder('Scan the pump serial number')
|
||||
->rule(function (callable $get) {
|
||||
return Rule::unique('pump_testing_results', 'pump_serial_number')
|
||||
->where('plant_id', $get('plant_id'))
|
||||
->where('pump_testing_master_id', $get('pump_testing_master_id'))
|
||||
->where('tested_type', $get('tested_type'))
|
||||
->where('sl_no', $get('sl_no'))
|
||||
->ignore($get('id'));
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
|
||||
if (strpos($state, '|') != false) {
|
||||
$parts = explode('|', $state);
|
||||
$set('pump_serial_number', $parts[1]);
|
||||
}
|
||||
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->columnSpan(1)
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('sl_no')
|
||||
->label('Sl. No.')
|
||||
->placeholder('Scan the sl. no.')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->columnSpan(1)
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('voltage')
|
||||
->label('Voltage')
|
||||
->placeholder('Scan the voltage')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->columnSpan(1)
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('current')
|
||||
->label('Current')
|
||||
->placeholder('Scan the current')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->columnSpan(1)
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('watt')
|
||||
->label('Watt')
|
||||
->placeholder('Scan the watt')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->columnSpan(1)
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('frequency')
|
||||
->label('Frequency')
|
||||
->placeholder('Scan the frequency')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->columnSpan(1)
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('speed')
|
||||
->label('Speed')
|
||||
->placeholder('Scan the speed')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->columnSpan(1)
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('discharge')
|
||||
->label('Discharge')
|
||||
->placeholder('Scan the discharge')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->columnSpan(1)
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('head')
|
||||
->label('Head')
|
||||
->placeholder('Scan the head')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->columnSpan(1)
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('pump_output')
|
||||
->label('Pump Output')
|
||||
->placeholder('Scan the pump output')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->columnSpan(1)
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('power_p2')
|
||||
->label('Power P2')
|
||||
->placeholder('Scan the power p2')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->columnSpan(1)
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('overall_efficiency')
|
||||
->label('Overall Efficiency')
|
||||
->placeholder('Scan the overall efficiency')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->columnSpan(1)
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('pump_efficiency')
|
||||
->label('Pump Efficiency')
|
||||
->placeholder('Scan the pump efficiency')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->columnSpan(1)
|
||||
->required()
|
||||
->reactive(),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->default(fn () => Filament::auth()->user()?->name)
|
||||
->columnSpan(1)
|
||||
->required(),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->default(fn () => Filament::auth()->user()?->name)
|
||||
->columnSpan(1)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('id')
|
||||
->hidden()
|
||||
->columnSpan(1)
|
||||
->readOnly(),
|
||||
])
|
||||
->columns(['default' => 1, 'sm' => 2]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
// Tables\Columns\TextColumn::make('id')
|
||||
// ->label('ID')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
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('tested_date')
|
||||
->label('Tested Date')
|
||||
->date() // 'F d, Y'
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('tested_type')
|
||||
->label('Tested Type')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('pumpTestingMasters.item.code')
|
||||
->label('Pump Code')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('pumpTestingMasters.item.category')
|
||||
->label('Pump Category')
|
||||
->default('-')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('pumpTestingMasters.item.description')
|
||||
->label('Pump Type')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('pumpTestingMasters.item.uom')
|
||||
->label('Unit Of Measure')
|
||||
->default('-')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('pump_serial_number')
|
||||
->label('Pump Serial Number')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('correction_head')
|
||||
->label('Correction Head')
|
||||
->searchable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sl_no')
|
||||
->label('Sl. No.')
|
||||
->searchable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('voltage')
|
||||
->label('Voltage')
|
||||
->searchable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('current')
|
||||
->label('Current')
|
||||
->searchable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('watt')
|
||||
->label('Watt')
|
||||
->searchable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('frequency')
|
||||
->label('Frequency')
|
||||
->searchable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('speed')
|
||||
->label('Speed')
|
||||
->searchable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('discharge')
|
||||
->label('Discharge')
|
||||
->searchable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('head')
|
||||
->label('Head')
|
||||
->searchable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('pump_output')
|
||||
->label('Pump Output')
|
||||
->searchable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('power_p2')
|
||||
->label('Power P2')
|
||||
->searchable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('overall_efficiency')
|
||||
->label('Overall Efficiency')
|
||||
->searchable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('pump_efficiency')
|
||||
->label('Pump Efficiency')
|
||||
->searchable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('created_by')
|
||||
->label('Created By')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_by')
|
||||
->label('Updated By')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
Filter::make('advanced_filters')
|
||||
->label('Advanced Filters')
|
||||
->form([
|
||||
Select::make('Plant')
|
||||
->label('Search by Plant Name')
|
||||
->nullable()
|
||||
->searchable()
|
||||
// ->options(function () {
|
||||
// return Plant::pluck('name', 'id');
|
||||
// })
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
|
||||
} else {
|
||||
return Plant::whereHas('pumpTestingResults', function ($query) {
|
||||
$query->whereNotNull('id');
|
||||
})->orderBy('code')->pluck('name', 'id');
|
||||
}
|
||||
|
||||
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('Item', null);
|
||||
$set('tested_type', null);
|
||||
$set('created_by', null);
|
||||
$set('updated_by', null);
|
||||
}),
|
||||
DatePicker::make('tested_from')
|
||||
->label('Tested From')
|
||||
->placeholder('Select From Date')
|
||||
->reactive()
|
||||
->native(false),
|
||||
DatePicker::make('tested_to')
|
||||
->label('Tested To')
|
||||
->placeholder('Select To Date')
|
||||
->reactive()
|
||||
->native(false),
|
||||
Select::make('tested_type')
|
||||
->label('Search by Tested Type')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if (! $plantId) {
|
||||
return PumpTestingResult::whereNotNull('tested_type')->select('tested_type')->distinct()->pluck('tested_type', 'tested_type');
|
||||
} else {
|
||||
return PumpTestingResult::where('plant_id', $plantId)->whereNotNull('tested_type')->select('tested_type')->distinct()->pluck('tested_type', 'tested_type');
|
||||
}
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
Select::make('Item')
|
||||
->label('Search by Pump Code')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$pId = $get('Plant');
|
||||
|
||||
if (! $pId) {
|
||||
return [];
|
||||
} else {
|
||||
return Item::whereHas('pumpTestingMasters', function ($query) use ($pId) {
|
||||
if ($pId) {
|
||||
$query->where('plant_id', $pId);
|
||||
}
|
||||
$query->whereHas('pumpTestingResults');
|
||||
})->pluck('code', 'id');
|
||||
}
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
TextInput::make('description')
|
||||
->label('Pump Type')
|
||||
->placeholder('Enter the Pump Type'),
|
||||
TextInput::make('pump_serial_number')
|
||||
->label('Pump Serial Number')
|
||||
->placeholder('Enter the Pump Serial Number'),
|
||||
Select::make('created_by')
|
||||
->label('Search by Created By')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if (! $plantId) {
|
||||
return PumpTestingResult::whereNotNull('created_by')->select('created_by')->distinct()->pluck('created_by', 'created_by');
|
||||
} else {
|
||||
return PumpTestingResult::where('plant_id', $plantId)->whereNotNull('created_by')->select('created_by')->distinct()->pluck('created_by', 'created_by');
|
||||
}
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
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),
|
||||
Select::make('updated_by')
|
||||
->label('Search by Updated By')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if (! $plantId) {
|
||||
return PumpTestingResult::whereNotNull('updated_by')->select('updated_by')->distinct()->pluck('updated_by', 'updated_by');
|
||||
} else {
|
||||
return PumpTestingResult::where('plant_id', $plantId)->whereNotNull('updated_by')->select('updated_by')->distinct()->pluck('updated_by', 'updated_by');
|
||||
}
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
DateTimePicker::make(name: 'updated_from')
|
||||
->label('Updated From')
|
||||
->placeholder(placeholder: 'Select From DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
DateTimePicker::make('updated_to')
|
||||
->label('Updated 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['tested_from']) && empty($data['tested_to']) && empty($data['tested_type']) && empty($data['Item']) && empty($data['description']) && empty($data['pump_serial_number']) && empty($data['created_by']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_by']) && empty($data['updated_from']) && empty($data['updated_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
if (! empty($data['Plant'])) {
|
||||
$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['tested_from'])) {
|
||||
$query->where('tested_date', '>=', $data['tested_from']);
|
||||
}
|
||||
|
||||
if (! empty($data['tested_to'])) {
|
||||
$query->where('tested_date', '<=', $data['tested_to']);
|
||||
}
|
||||
|
||||
if (! empty($data['tested_type'])) {
|
||||
$query->where('tested_type', $data['tested_type']);
|
||||
}
|
||||
|
||||
if (! empty($data['Item']) && ! empty($data['Plant'])) {
|
||||
$pumpMasterIds = PumpTestingMaster::where('item_id', $data['Item'])
|
||||
->where('plant_id', $data['Plant'])
|
||||
->pluck('id')
|
||||
->toArray();
|
||||
|
||||
if (! empty($pumpMasterIds)) {
|
||||
$query->whereIn('pump_testing_master_id', $pumpMasterIds);
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($data['description'])) {
|
||||
$pId = $data['Plant'] ?? null;
|
||||
$descIds = Item::where('description', 'like', '%'.$data['description'].'%')->whereHas('pumpTestingMasters', function ($query) use ($pId) {
|
||||
if ($pId) {
|
||||
$query->where('plant_id', $pId);
|
||||
}
|
||||
})->pluck('id')->toArray();
|
||||
|
||||
if (! empty($descIds)) {
|
||||
$pumpMasterIds = PumpTestingMaster::whereIn('item_id', $descIds)
|
||||
->where('plant_id', $data['Plant'])
|
||||
->pluck('id')
|
||||
->toArray();
|
||||
|
||||
if (! empty($pumpMasterIds)) {
|
||||
$query->whereIn('pump_testing_master_id', $pumpMasterIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($data['pump_serial_number'])) {
|
||||
$query->where('pump_serial_number', 'like', '%'.$data['pump_serial_number'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['created_by'])) {
|
||||
$query->where('created_by', $data['created_by']);
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$query->where('created_at', '>=', $data['created_from']);
|
||||
}
|
||||
|
||||
if (! empty($data['created_to'])) {
|
||||
$query->where('created_at', '<=', $data['created_to']);
|
||||
}
|
||||
|
||||
if (! empty($data['updated_by'])) {
|
||||
$query->where('updated_by', $data['updated_by']);
|
||||
}
|
||||
|
||||
if (! empty($data['updated_from'])) {
|
||||
$query->where('updated_at', '>=', $data['updated_from']);
|
||||
}
|
||||
|
||||
if (! empty($data['updated_to'])) {
|
||||
$query->where('updated_at', '<=', $data['updated_to']);
|
||||
}
|
||||
})
|
||||
->indicateUsing(function (array $data) {
|
||||
$indicators = [];
|
||||
|
||||
if (! empty($data['Plant'])) {
|
||||
$indicators[] = 'Plant Name: '.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['tested_from'])) {
|
||||
$indicators[] = 'Tested From: '.$data['tested_from'];
|
||||
}
|
||||
|
||||
if (! empty($data['tested_to'])) {
|
||||
$indicators[] = 'Tested To: '.$data['tested_to'];
|
||||
}
|
||||
|
||||
if (! empty($data['tested_type'])) {
|
||||
$indicators[] = 'Tested Type: '.$data['tested_type'];
|
||||
}
|
||||
|
||||
if (! empty($data['Item']) && ! empty($data['Plant'])) {
|
||||
$itemCode = Item::find($data['Item'])->code ?? 'Unknown';
|
||||
$indicators[] = 'Pump Code: '.$itemCode;
|
||||
}
|
||||
|
||||
if (! empty($data['description'])) {
|
||||
$indicators[] = 'Pump Type: '.$data['description'];
|
||||
}
|
||||
|
||||
if (! empty($data['pump_serial_number'])) {
|
||||
$indicators[] = 'Pump Serial Number: '.$data['pump_serial_number'];
|
||||
}
|
||||
|
||||
if (! empty($data['created_by'])) {
|
||||
$indicators[] = 'Created By: '.$data['created_by'];
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$indicators[] = 'Created From: '.$data['created_from'];
|
||||
}
|
||||
|
||||
if (! empty($data['created_to'])) {
|
||||
$indicators[] = 'Created To: '.$data['created_to'];
|
||||
}
|
||||
|
||||
if (! empty($data['updated_by'])) {
|
||||
$indicators[] = 'Updated By: '.$data['updated_by'];
|
||||
}
|
||||
|
||||
if (! empty($data['updated_from'])) {
|
||||
$indicators[] = 'Updated From: '.$data['updated_from'];
|
||||
}
|
||||
|
||||
if (! empty($data['updated_to'])) {
|
||||
$indicators[] = 'Updated To: '.$data['updated_to'];
|
||||
}
|
||||
|
||||
return $indicators;
|
||||
}),
|
||||
])
|
||||
->filtersFormMaxHeight('280px')
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->headerActions([
|
||||
ExportAction::make()
|
||||
->label('Export Pump Testing Results')
|
||||
->color('warning')
|
||||
->exporter(PumpTestingResultExporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view export pump testing results');
|
||||
}),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListPumpTestingResults::route('/'),
|
||||
'create' => Pages\CreatePumpTestingResult::route('/create'),
|
||||
'view' => Pages\ViewPumpTestingResult::route('/{record}'),
|
||||
'edit' => Pages\EditPumpTestingResult::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\PumpTestingResultResource\Pages;
|
||||
|
||||
use App\Filament\Resources\PumpTestingResultResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreatePumpTestingResult extends CreateRecord
|
||||
{
|
||||
protected static string $resource = PumpTestingResultResource::class;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\PumpTestingResultResource\Pages;
|
||||
|
||||
use App\Filament\Resources\PumpTestingResultResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditPumpTestingResult extends EditRecord
|
||||
{
|
||||
protected static string $resource = PumpTestingResultResource::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\PumpTestingResultResource\Pages;
|
||||
|
||||
use App\Filament\Resources\PumpTestingResultResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListPumpTestingResults extends ListRecords
|
||||
{
|
||||
protected static string $resource = PumpTestingResultResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\PumpTestingResultResource\Pages;
|
||||
|
||||
use App\Filament\Resources\PumpTestingResultResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewPumpTestingResult extends ViewRecord
|
||||
{
|
||||
protected static string $resource = PumpTestingResultResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ use App\Models\Item;
|
||||
use App\Models\Machine;
|
||||
use App\Models\Plant;
|
||||
use App\Models\RequestCharacteristic;
|
||||
use App\Models\StickerMaster;
|
||||
use Closure;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
@@ -30,7 +29,6 @@ use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
@@ -42,6 +40,8 @@ class RequestCharacteristicResource extends Resource
|
||||
|
||||
protected static ?string $navigationGroup = 'Laser Marking';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@@ -95,6 +95,7 @@ class RequestCharacteristicResource extends Resource
|
||||
$set('machine_id', null);
|
||||
$set('item_id', null);
|
||||
$set('aufnr', null);
|
||||
$set('gernr', null);
|
||||
$set('machine_name', null);
|
||||
$set('characteristic_approver_master_id', null);
|
||||
$set('approver_type', null);
|
||||
@@ -126,6 +127,7 @@ class RequestCharacteristicResource extends Resource
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('item_id', null);
|
||||
$set('aufnr', null);
|
||||
$set('gernr', null);
|
||||
$set('machine_name', null);
|
||||
$set('characteristic_approver_master_id', null);
|
||||
$set('approver_type', null);
|
||||
@@ -133,8 +135,8 @@ class RequestCharacteristicResource extends Resource
|
||||
})
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\Hidden::make('show_validation_image')
|
||||
->reactive()
|
||||
->default(false),
|
||||
->reactive()
|
||||
->default(false),
|
||||
Forms\Components\Hidden::make('validation1_image_url')
|
||||
->reactive(),
|
||||
|
||||
@@ -165,17 +167,19 @@ class RequestCharacteristicResource extends Resource
|
||||
|
||||
if ($currentState == true) {
|
||||
$set('validation1_image_url', null);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$workFlowId = $get('work_flow_id');
|
||||
|
||||
if (!$workFlowId) {
|
||||
if (! $workFlowId) {
|
||||
Notification::make()
|
||||
->title('Missing Workflow ID')
|
||||
->body('Please select a Workflow ID.')
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -211,6 +215,7 @@ class RequestCharacteristicResource extends Resource
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
if (! $state) {
|
||||
$set('aufnr', null);
|
||||
$set('gernr', null);
|
||||
}
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
@@ -235,6 +240,9 @@ class RequestCharacteristicResource extends Resource
|
||||
return false;
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
if (! $state) {
|
||||
$set('gernr', null);
|
||||
}
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->default(function () {
|
||||
@@ -244,6 +252,32 @@ class RequestCharacteristicResource extends Resource
|
||||
})
|
||||
->readOnly(fn ($get) => ($get('item_id') == null))
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\TextInput::make('gernr')
|
||||
->label('Serial Number')
|
||||
->reactive()
|
||||
->minLength(13)
|
||||
->readOnly(fn (callable $get) => (! $get('aufnr')))
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
// ->rules([
|
||||
// function (callable $get) {
|
||||
// return Rule::unique('class_characteristics', 'gernr')
|
||||
// ->where('plant_id', $get('plant_id'))
|
||||
// ->ignore($get('id'));
|
||||
// },
|
||||
// ])
|
||||
// ->validationMessages([
|
||||
// 'unique' => "The 'GERNR' has already been taken.", // The GERNR has already been taken for this plant.
|
||||
// ])
|
||||
->required(function (callable $get) {
|
||||
$appTyp = $get('approver_type');
|
||||
if ($appTyp == 'Stop') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}),
|
||||
Forms\Components\Select::make('machine_name')
|
||||
->label('Machine Name')
|
||||
->reactive()
|
||||
@@ -320,15 +354,20 @@ class RequestCharacteristicResource extends Resource
|
||||
return [
|
||||
'Characteristic' => 'Characteristic',
|
||||
'Quality' => 'Quality',
|
||||
'Stop' => 'Stop',
|
||||
];
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$appTyp = $get('approver_type');
|
||||
$set('characteristic_approver_master_id', null);
|
||||
if ($get('approver_type') != 'Characteristic') {
|
||||
if ($appTyp != 'Characteristic') {
|
||||
$set('characteristic_name', null);
|
||||
$set('current_value', null);
|
||||
$set('update_value', null);
|
||||
}
|
||||
if ($appTyp != 'Stop') {
|
||||
$set('gernr', null);
|
||||
}
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->default(function () {
|
||||
@@ -439,8 +478,9 @@ class RequestCharacteristicResource extends Resource
|
||||
|
||||
$plantId = $get('plant_id');
|
||||
$jobNo = $get('aufnr');
|
||||
$sNo = $get('gernr');
|
||||
$updId = $get('id');
|
||||
$pendingExists = RequestCharacteristic::where('plant_id', $plantId)->where('aufnr', $jobNo)->where('characteristic_name', $value)->latest()->first();
|
||||
$pendingExists = RequestCharacteristic::where('plant_id', $plantId)->where('aufnr', $jobNo)->where('gernr', $sNo)->where('characteristic_name', $value)->latest()->first();
|
||||
|
||||
if ($pendingExists) {
|
||||
if ($updId && $pendingExists->id == $updId) {
|
||||
@@ -962,6 +1002,11 @@ class RequestCharacteristicResource extends Resource
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('gernr')
|
||||
->label('Serial Number')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('characteristicApproverMaster.machine_name')
|
||||
->label('Machine Name')
|
||||
->alignCenter()
|
||||
@@ -1232,8 +1277,11 @@ class RequestCharacteristicResource extends Resource
|
||||
->label('Job Number')
|
||||
->placeholder('Enter Job Number')
|
||||
->numeric()
|
||||
->minlength(7)
|
||||
->maxlength(10),
|
||||
TextInput::make('gernr')
|
||||
->label('Serial Number')
|
||||
->placeholder('Enter Serial Number')
|
||||
->numeric(),
|
||||
TextInput::make('work_flow_id')
|
||||
->label('Work Flow ID')
|
||||
->placeholder('Enter Work Flow ID'),
|
||||
@@ -1245,6 +1293,7 @@ class RequestCharacteristicResource extends Resource
|
||||
->options([
|
||||
'Characteristic' => 'Characteristic',
|
||||
'Quality' => 'Quality',
|
||||
'Stop' => 'Stop',
|
||||
])
|
||||
->placeholder('Select Request Type'),
|
||||
TextInput::make('master_characteristic_field')
|
||||
@@ -1308,7 +1357,7 @@ class RequestCharacteristicResource extends Resource
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['Plant']) && empty($data['machine']) && empty($data['item_id']) && empty($data['aufnr']) && empty($data['model_type']) && empty($data['work_flow_id']) && empty($data['machine_name']) && empty($data['request_type']) && empty($data['master_characteristic_field'])&& empty($data['approver_status1']) && empty($data['approver_status2']) && empty($data['approver_status3']) && empty($data['approver_status']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
if (empty($data['Plant']) && empty($data['machine']) && empty($data['item_id']) && empty($data['aufnr']) && empty($data['gernr']) && empty($data['model_type']) && empty($data['work_flow_id']) && empty($data['machine_name']) && empty($data['request_type']) && empty($data['master_characteristic_field']) && empty($data['approver_status1']) && empty($data['approver_status2']) && empty($data['approver_status3']) && empty($data['approver_status']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
@@ -1334,6 +1383,10 @@ class RequestCharacteristicResource extends Resource
|
||||
$query->where('aufnr', 'like', '%'.$data['aufnr'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['gernr'])) {
|
||||
$query->where('gernr', 'like', '%'.$data['gernr'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['model_type'])) {
|
||||
$query->where('model_type', 'like', '%'.$data['model_type'].'%');
|
||||
}
|
||||
@@ -1342,19 +1395,19 @@ class RequestCharacteristicResource extends Resource
|
||||
$query->where('work_flow_id', 'like', '%'.$data['work_flow_id'].'%');
|
||||
}
|
||||
|
||||
if (!empty($data['machine_name'])) {
|
||||
if (! empty($data['machine_name'])) {
|
||||
$query->whereHas('characteristicApproverMaster', function ($q) use ($data) {
|
||||
$q->where('characteristic_approver_masters.machine_name', '=', (string) $data['machine_name']);
|
||||
});
|
||||
}
|
||||
|
||||
if (!empty($data['request_type'])) {
|
||||
if (! empty($data['request_type'])) {
|
||||
$query->whereHas('characteristicApproverMaster', function ($q) use ($data) {
|
||||
$q->where('characteristic_approver_masters.approver_type', '=', (string) $data['request_type']);
|
||||
});
|
||||
}
|
||||
|
||||
if (!empty($data['master_characteristic_field'])) {
|
||||
if (! empty($data['master_characteristic_field'])) {
|
||||
$query->whereHas('characteristicApproverMaster', function ($q) use ($data) {
|
||||
$q->where('characteristic_approver_masters.characteristic_field', '=', (string) $data['master_characteristic_field']);
|
||||
});
|
||||
@@ -1372,7 +1425,7 @@ class RequestCharacteristicResource extends Resource
|
||||
$query->where('approver_status3', 'like', '%'.$data['approver_status3'].'%');
|
||||
}
|
||||
|
||||
if (!empty($data['approver_status'])) {
|
||||
if (! empty($data['approver_status'])) {
|
||||
|
||||
$status = $data['approver_status'];
|
||||
|
||||
@@ -1431,6 +1484,10 @@ class RequestCharacteristicResource extends Resource
|
||||
$indicators[] = 'Job No: '.$data['aufnr'];
|
||||
}
|
||||
|
||||
if (! empty($data['gernr'])) {
|
||||
$indicators[] = 'Serial No: '.$data['gernr'];
|
||||
}
|
||||
|
||||
if (! empty($data['model_type'])) {
|
||||
$indicators[] = 'Model Type: '.$data['model_type'];
|
||||
}
|
||||
|
||||
193
app/Filament/Resources/SaleOrderMasterResource.php
Normal file
193
app/Filament/Resources/SaleOrderMasterResource.php
Normal file
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\SaleOrderMasterExporter;
|
||||
use App\Filament\Imports\SaleOrderMasterImporter;
|
||||
use App\Filament\Resources\SaleOrderMasterResource\Pages;
|
||||
use App\Filament\Resources\SaleOrderMasterResource\RelationManagers;
|
||||
use App\Models\Item;
|
||||
use App\Models\Plant;
|
||||
use App\Models\SaleOrderMaster;
|
||||
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;
|
||||
|
||||
class SaleOrderMasterResource extends Resource
|
||||
{
|
||||
protected static ?string $model = SaleOrderMaster::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Spare Packing';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->reactive()
|
||||
->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();
|
||||
})
|
||||
->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');
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sale_order_number')
|
||||
->label('Sale Order Number'),
|
||||
Forms\Components\TextInput::make('supplier_name')
|
||||
->label('Supplier Name'),
|
||||
Forms\Components\TextInput::make('quantity')
|
||||
->label('Quantity'),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('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')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('item.code')
|
||||
->label('Item Code')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('sale_order_number')
|
||||
->label('Sale Order Number')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('supplier_name')
|
||||
->label('Supplier Name')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('quantity')
|
||||
->label('Quantity')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_by')
|
||||
->label('Created By')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_by')
|
||||
->label('Updated By')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->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 Sale Order')
|
||||
->color('warning')
|
||||
->importer(SaleOrderMasterImporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view import sale order master');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->label('Export Sale Order')
|
||||
->color('warning')
|
||||
->exporter(SaleOrderMasterExporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view export sale order master');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListSaleOrderMasters::route('/'),
|
||||
'create' => Pages\CreateSaleOrderMaster::route('/create'),
|
||||
'view' => Pages\ViewSaleOrderMaster::route('/{record}'),
|
||||
'edit' => Pages\EditSaleOrderMaster::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SaleOrderMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SaleOrderMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateSaleOrderMaster extends CreateRecord
|
||||
{
|
||||
protected static string $resource = SaleOrderMasterResource::class;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SaleOrderMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SaleOrderMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSaleOrderMaster extends EditRecord
|
||||
{
|
||||
protected static string $resource = SaleOrderMasterResource::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\SaleOrderMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SaleOrderMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListSaleOrderMasters extends ListRecords
|
||||
{
|
||||
protected static string $resource = SaleOrderMasterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SaleOrderMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SaleOrderMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewSaleOrderMaster extends ViewRecord
|
||||
{
|
||||
protected static string $resource = SaleOrderMasterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
340
app/Filament/Resources/SparePackingResource.php
Normal file
340
app/Filament/Resources/SparePackingResource.php
Normal file
@@ -0,0 +1,340 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\SparePackingResource\Pages;
|
||||
use App\Filament\Resources\SparePackingResource\RelationManagers;
|
||||
use App\Models\Plant;
|
||||
use App\Models\SaleOrderMaster;
|
||||
use App\Models\SparePacking;
|
||||
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\Forms\Components\Section;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use App\Filament\Exports\SparePackingExporter;
|
||||
use App\Filament\Imports\SparePackingImporter;
|
||||
|
||||
class SparePackingResource extends Resource
|
||||
{
|
||||
protected static ?string $model = SparePacking::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Spare Packing';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Section::make('')
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->reactive()
|
||||
->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();
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\Select::make('sale_order_master_id')
|
||||
->label('Sale Order Number')
|
||||
->reactive()
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return SaleOrderMaster::where('plant_id', $plantId)->distinct()->pluck('sale_order_number', 'sale_order_number');
|
||||
|
||||
})
|
||||
->required()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('spare_packing_number', null);
|
||||
}),
|
||||
Forms\Components\TextInput::make('spare_packing_number')
|
||||
->label('Scan Spare Packing No')
|
||||
->reactive()
|
||||
->required()
|
||||
->readonly()
|
||||
->extraAttributes([
|
||||
'x-data' => '{ value: "" }',
|
||||
'x-model' => 'value',
|
||||
'x-on:keydown.enter.prevent' => '$wire.processPalletNo()',
|
||||
])
|
||||
->suffixAction(fn ($get, $set) => Forms\Components\Actions\Action::make('addWirePackNo')
|
||||
->label('')
|
||||
->button()
|
||||
->icon('heroicon-o-plus')
|
||||
->color('primary')
|
||||
->extraAttributes([
|
||||
'class' => 'p-1 w-7 h-7',
|
||||
])
|
||||
->action(function ($get, $set, $livewire) {
|
||||
|
||||
$plantId = $get('plant_id');
|
||||
|
||||
session(['pallet_clicked_time' => now()->toDateTimeString()]);
|
||||
session(['pallet_created_by' => Filament::auth()->user()->name]);
|
||||
|
||||
$year = now()->format('y');
|
||||
$month = now()->format('m');
|
||||
$prefix = "SP-{$year}{$month}";
|
||||
|
||||
$lastPallet = SparePacking::where('spare_packing_number', 'like', "{$prefix}%")
|
||||
->orderByDesc('spare_packing_number')
|
||||
->first();
|
||||
|
||||
if ($lastPallet) {
|
||||
$lastNumber = (int) substr(
|
||||
$lastPallet->spare_packing_number,
|
||||
strlen($prefix)
|
||||
);
|
||||
|
||||
$newNumber = $lastNumber + 1;
|
||||
|
||||
$newNumber = $newNumber < 1000
|
||||
? str_pad($newNumber, 3, '0', STR_PAD_LEFT)
|
||||
: (string) $newNumber;
|
||||
} else {
|
||||
$newNumber = '001';
|
||||
}
|
||||
|
||||
$newPalletNumber = "{$prefix}{$newNumber}";
|
||||
|
||||
$set('spare_packing_number', $newPalletNumber);
|
||||
$set('plant_id', $plantId);
|
||||
|
||||
// $livewire->redirectToQrPdf($newPalletNumber);
|
||||
})
|
||||
),
|
||||
Forms\Components\TextInput::make('document_number')
|
||||
->label('Document No')
|
||||
->reactive()
|
||||
->readOnly(fn (callable $get) => ! $get('spare_packing_number'))
|
||||
->extraAttributes([
|
||||
'x-on:keydown.enter.prevent' => '$wire.processDocNo()',
|
||||
]),
|
||||
Forms\Components\TextInput::make('removeDoc_number')
|
||||
->label('Remove Document No')
|
||||
->reactive()
|
||||
->minLength(9)
|
||||
->readOnly(fn (callable $get) => ! $get('spare_packing_number') || $get('document_number'))
|
||||
->extraAttributes([
|
||||
'x-data' => '{ value: "" }',
|
||||
'x-model' => 'value',
|
||||
'x-on:keydown.enter.prevent' => '$wire.processRemoveDocNo()',
|
||||
]),
|
||||
Forms\Components\TextInput::make('Sno_quantity')
|
||||
->label('SNo. Quantity')
|
||||
->readOnly()
|
||||
->default('0'),
|
||||
Forms\Components\Select::make('pending_pallet_list')
|
||||
->label('Pending Pallet List')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('spare_packing_number', $state);
|
||||
$set('pallet_number_locked', false);
|
||||
})
|
||||
->options(function ($get) {
|
||||
|
||||
$plantId = $get('plant_id');
|
||||
$saleOrder = $get('sale_order_master_id');
|
||||
|
||||
if (!$plantId || !$saleOrder) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$saleOrderIds = SaleOrderMaster::where('plant_id', $plantId)
|
||||
->where('sale_order_number', $saleOrder)
|
||||
->pluck('id');
|
||||
|
||||
return SparePacking::query()
|
||||
->where('plant_id', $plantId)
|
||||
->whereIn('sale_order_master_id', $saleOrderIds)
|
||||
->where(function ($query) {
|
||||
$query->whereNull('spare_packing_status')
|
||||
->orWhere('spare_packing_status', '');
|
||||
})
|
||||
->whereNotNull('spare_packing_number')
|
||||
->orderBy('spare_packing_number', 'asc')
|
||||
->pluck('spare_packing_number')
|
||||
->unique()
|
||||
->mapWithKeys(fn ($number) => [$number => $number])
|
||||
->toArray();
|
||||
}),
|
||||
Forms\Components\View::make('forms.components.save-spare-packing-button'),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By'),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By'),
|
||||
])
|
||||
->columns(6),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->alignCenter()
|
||||
->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')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('item.code')
|
||||
->label('Item')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('item.description')
|
||||
->label('Description')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('saleOrder.sale_order_number')
|
||||
->label('Sale Order No')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('saleOrder.supplier_name')
|
||||
->label('Supplier Name')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('spare_packing_number')
|
||||
->label('Spare Packing Number')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('document_number')
|
||||
->label('Document Number')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('quantity')
|
||||
->label('Quantity')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('spare_packing_status')
|
||||
->label('Spare Packing Status')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_by')
|
||||
->label('Created By')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_by')
|
||||
->label('Updated By')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('scanned_at')
|
||||
->label('Scanned At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->alignCenter()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('scanned_by')
|
||||
->label('Scanned By')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable()
|
||||
->alignCenter()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->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 Spare Packing')
|
||||
->color('warning')
|
||||
->importer(SparePackingImporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view import spare packing');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->label('Export Spare Packing')
|
||||
->color('warning')
|
||||
->exporter(SparePackingExporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view export spare packing');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListSparePackings::route('/'),
|
||||
'create' => Pages\CreateSparePacking::route('/create'),
|
||||
'view' => Pages\ViewSparePacking::route('/{record}'),
|
||||
'edit' => Pages\EditSparePacking::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,845 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SparePackingResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SparePackingResource;
|
||||
use App\Models\Item;
|
||||
use App\Models\Plant;
|
||||
use App\Models\SaleOrderMaster;
|
||||
use Filament\Actions;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
use App\Models\SparePacking;
|
||||
|
||||
class CreateSparePacking extends CreateRecord
|
||||
{
|
||||
|
||||
public $docNo;
|
||||
|
||||
public $saleOrder;
|
||||
|
||||
public $plantId;
|
||||
|
||||
public $count = 0;
|
||||
|
||||
public $snoCount = 0;
|
||||
|
||||
public $pendingPallet;
|
||||
|
||||
public array $importedSaleOrderList = [];
|
||||
|
||||
protected static string $resource = SparePackingResource::class;
|
||||
|
||||
protected static string $view = 'filament.resources.spare-packing-resource.create-spare-packing';
|
||||
|
||||
protected $listeners = [
|
||||
'updateSnoQuantity' => 'handleUpdateSnoQuantity',
|
||||
];
|
||||
|
||||
public function handleUpdateSnoQuantity($newValue)
|
||||
{
|
||||
$this->form->fill([
|
||||
'Sno_quantity' => $newValue,
|
||||
]);
|
||||
}
|
||||
|
||||
public function processDocNo(){
|
||||
|
||||
$plantId = $this->form->getState()['plant_id'];
|
||||
|
||||
$plantId = trim($plantId) ?? null;
|
||||
|
||||
$docNo = trim($this->form->getState()['document_number'])?? null;
|
||||
|
||||
$saleOrder = trim($this->form->getState()['sale_order_master_id'])?? null;
|
||||
|
||||
$sparePackNo = trim($this->form->getState()['spare_packing_number'])?? null;
|
||||
|
||||
$sparePackNo = trim($sparePackNo) ?? null;
|
||||
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
$operatorName = $user->name;
|
||||
|
||||
if (empty($docNo) || $docNo == '')
|
||||
{
|
||||
Notification::make()
|
||||
->title("Document Number can't be empty")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $saleOrder,
|
||||
'spare_packing_number' => $sparePackNo,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
// $pattern = '/^([^|]+)\|([^|]+)\|([^|]+)\|(\d+(\.\d+)?)(kg)?$/i';
|
||||
|
||||
// $pattern = '/^([^|]+)\|([^|]+)\|([^|]+)\|(\d+(\.\d+)?)$/i';
|
||||
|
||||
$pattern = '/^([^|]+)\|([^|]+)\|(\d+(\.\d+)?)$/i';
|
||||
|
||||
if (!preg_match($pattern, $docNo, $matches))
|
||||
{
|
||||
Notification::make()
|
||||
->title("Scan Valid Qr code ")
|
||||
->body("Expected Format : (MaterialCode|Document Number|Quantity)")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $saleOrder,
|
||||
'spare_packing_number' => $sparePackNo,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$materialCode = $matches[1];
|
||||
$docNo = $matches[2];
|
||||
$weight = $matches[3];
|
||||
|
||||
$icode = Item::where('code', $materialCode)->first();
|
||||
|
||||
if(!$icode)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Unknown Item Code")
|
||||
->body("Item Code not found '$materialCode'")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $saleOrder,
|
||||
'spare_packing_number' => $sparePackNo,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$icodeAgaPlant = Item::where('code', $materialCode)->where('plant_id', $plantId)->first();
|
||||
|
||||
$plantCode = Plant::where('id', $plantId)->first();
|
||||
|
||||
$plantcode = $plantCode->code;
|
||||
|
||||
$itemId = $icodeAgaPlant->id;
|
||||
|
||||
if(!$icodeAgaPlant)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Unknown Item Code")
|
||||
->body("Item Code not found '$materialCode' against Plant Code '$plantcode'")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $saleOrder,
|
||||
'spare_packing_number' => $sparePackNo,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$icodeAgaCPoPlant = SaleOrderMaster::where('item_id', $itemId)->where('plant_id', $plantId)->first();
|
||||
|
||||
if(!$icodeAgaCPoPlant)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Unknown Item Code in Customer PO")
|
||||
->body("Item Code '$materialCode' not found in any active Customer PO against Plant Code '$plantcode'")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $saleOrder,
|
||||
'spare_packing_number' => $sparePackNo,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$processOrderAgaPlant = SparePacking::where('document_number', $docNo)->where('plant_id', $plantId)->first();
|
||||
|
||||
if($processOrderAgaPlant)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Duplicate Document Number")
|
||||
->body("Duplicate document number found '$docNo' against Plant Code '$plantcode'")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $saleOrder,
|
||||
'spare_packing_number' => $sparePackNo,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$saleOrderRecord = SaleOrderMaster::where('sale_order_number', $saleOrder)
|
||||
->where('plant_id', $plantId)
|
||||
->where('item_id', $itemId)
|
||||
->first();
|
||||
|
||||
if(!$saleOrderRecord)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Sale Order Not Found")
|
||||
->body("Sale Order '$saleOrder' for Item '$materialCode' not found against Plant '$plantcode'")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $saleOrder,
|
||||
'spare_packing_number' => $sparePackNo,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$alreadyScannedQty = SparePacking::where('sale_order_master_id', $saleOrderRecord->id)
|
||||
->where('plant_id', $plantId)
|
||||
->where('item_id', $itemId)
|
||||
->selectRaw('SUM(CAST(quantity AS NUMERIC)) as total_weight')
|
||||
->value('total_weight');
|
||||
|
||||
$totalQty = round((float)$alreadyScannedQty + (float)$weight, 3);
|
||||
|
||||
|
||||
if($totalQty > round((float)$saleOrderRecord->quantity, 3))
|
||||
{
|
||||
|
||||
Notification::make()
|
||||
->title("Scanned Quantity Exceeds Sale Order Quantity")
|
||||
->body("Scanned quantity '$weight' and already scanned quantity '$alreadyScannedQty' exceeds allowed quantity '{$saleOrderRecord->quantity}' for Sale Order '$saleOrderRecord->sale_order_number' and Item '$materialCode'")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $saleOrder,
|
||||
'item_id' => $itemId,
|
||||
'spare_packing_number' => $sparePackNo,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
$existingPallet = SparePacking::where('plant_id', $plantId)
|
||||
->where('spare_packing_number', $sparePackNo)
|
||||
->first();
|
||||
|
||||
$count = SparePacking::where('plant_id', $plantId)
|
||||
->where('spare_packing_number', $sparePackNo)
|
||||
->count('spare_packing_number');
|
||||
|
||||
$createdAt = $existingPallet ? $existingPallet->created_at : $clickedAt ?? now();
|
||||
|
||||
$createdBy = $existingPallet ? $existingPallet->created_by : $clickedBy ?? $operatorName;
|
||||
|
||||
$record = SparePacking::create([
|
||||
'plant_id' => $plantId,
|
||||
'item_id' => $itemId,
|
||||
'spare_packing_number' => $sparePackNo,
|
||||
'document_number' => $docNo,
|
||||
'sale_order_master_id' => $saleOrderRecord->id,
|
||||
'quantity' => $weight,
|
||||
'created_by' => $createdBy,
|
||||
'scanned_by' => $operatorName,
|
||||
'created_at' => $createdAt,
|
||||
'scanned_at' => now(),
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
|
||||
if ($record)
|
||||
{
|
||||
|
||||
$this->snoCount = SparePacking::where('plant_id', $plantId)
|
||||
->where('spare_packing_number', $sparePackNo)
|
||||
->count();
|
||||
|
||||
$this->dispatch('loadData', $sparePackNo, $plantId);
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $saleOrder,
|
||||
'item_id' => $itemId,
|
||||
'spare_packing_number' => $sparePackNo,
|
||||
'document_number' => null,
|
||||
// 'pending_pallet_list' => $pendingPallet,
|
||||
'Sno_quantity' => $this->snoCount,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Notification::make()
|
||||
->title("Failed to insert scanned serial number '$docNo' into wire master table!")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', $sparePackNo, $plantId);
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $saleOrder,
|
||||
'item_id' => $itemId,
|
||||
'spare_packing_number' => $sparePackNo,
|
||||
'document_number' => null,
|
||||
// 'pending_pallet_list' => $pendingPallet,
|
||||
'Sno_quantity' => $count,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
Notification::make()
|
||||
->title('Error: Serial not inserted.')
|
||||
->body("Something went wrong while inserting document number '{$docNo}' into pallet table!\nScan the new document number to proceed...")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', $sparePackNo, $plantId);
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $saleOrder,
|
||||
'spare_packing_number' => $sparePackNo,
|
||||
'document_number' => null,
|
||||
// 'pending_pallet_list' => $pendingPallet,
|
||||
'Sno_quantity' => $count,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->dispatch('loadData', $sparePackNo, $plantId);
|
||||
|
||||
}
|
||||
|
||||
public function markAsComplete()
|
||||
{
|
||||
|
||||
$plantId = $this->form->getState()['plant_id'];
|
||||
|
||||
$plantId = trim($plantId) ?? null;
|
||||
|
||||
$pendingPallet = $this->form->getState()['pending_pallet_list'];
|
||||
|
||||
$palletNumber = trim($this->form->getState()['spare_packing_number'])?? null;
|
||||
|
||||
$palletNumber = trim($palletNumber) ?? null;
|
||||
|
||||
$processOrder = trim($this->form->getState()['document_number'])?? null;
|
||||
|
||||
$processOrder = trim($processOrder) ?? null;
|
||||
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
$operatorName = $user->name;
|
||||
|
||||
$isCompleted = $this->data['is_completed'] ?? false;
|
||||
|
||||
// $this->pendingPallet = $this->form->getState()['pending_pallet_list'];
|
||||
|
||||
if (! ($this->data['is_completed'] ?? false)) {
|
||||
Notification::make()
|
||||
->title('Completion required')
|
||||
->body('Please check the "Is Completed" checkbox to finish master packing.')
|
||||
->warning()
|
||||
->duration(3000)
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$palletExist = SparePacking::where('spare_packing_number', $palletNumber)
|
||||
->where('plant_id', $plantId)
|
||||
->first();
|
||||
|
||||
if (!$palletExist)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Pallet number '$palletNumber' does not have process orders to save!<br>Add the valid process order into pallet number to proceed...")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'spare_packing_number' => $palletNumber,
|
||||
'pending_pallet_list' => $pendingPallet,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$allCompleted = SparePacking::where('plant_id', $plantId)
|
||||
->where('spare_packing_number', $palletNumber)
|
||||
->where('spare_packing_status', '=','Completed')
|
||||
->first();
|
||||
|
||||
if ($allCompleted)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Spare Packing pallet number '$palletNumber' already completed the master packing!<br>Generate the new Spare Packing Pallet number or choose from pending pallet list!")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', '', $plantId);
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'spare_packing_number' => null,
|
||||
'pending_pallet_list' => null,//$pendingPallet
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
// $count = PalletValidation::where('plant_id', $plantId)
|
||||
// ->where('pallet_number', $palletNumber)
|
||||
// ->count('pallet_number');
|
||||
|
||||
if (!$isCompleted)
|
||||
{
|
||||
$updated = SparePacking::where('spare_packing_number', $palletNumber)
|
||||
->where('plant_id', $plantId)
|
||||
->update([
|
||||
'updated_at' => now(),
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
|
||||
if ($updated > 0)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Pallet number '$palletNumber' records saved successfully!")
|
||||
->success()
|
||||
->duration(800)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', '', $plantId);
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'spare_packing_number' => null,//$palletNumber
|
||||
'pending_pallet_list' => null,//$pendingPallet
|
||||
'Sno_quantity' => 0,//$count,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$updated = SparePacking::where('spare_packing_number', $palletNumber)
|
||||
->where('plant_id', $plantId)
|
||||
->update([
|
||||
'spare_packing_status' => 'Completed',
|
||||
'updated_at' => now(),
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
|
||||
if ($updated > 0)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Pallet number '$palletNumber' completed the master packing successfully!")
|
||||
->success()
|
||||
->duration(800)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', '', $plantId);
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'spare_packing_number' => null,//$palletNumber
|
||||
'pending_pallet_list' => null,//$pendingPallet
|
||||
'Sno_quantity' => 0,//$count
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function processPalletNo()
|
||||
{
|
||||
$plantId = $this->form->getState()['plant_id'];
|
||||
|
||||
$plantId = trim($plantId) ?? null;
|
||||
|
||||
$pendingPallet = $this->form->getState()['pending_pallet_list'];
|
||||
|
||||
$palletNumber = trim($this->form->getState()['spare_packing_number']) ?? null;
|
||||
|
||||
$saleOrder = trim($this->form->getState()['sale_order_master_id'])?? null;
|
||||
|
||||
$palletNumber = trim($palletNumber) ?? null;
|
||||
|
||||
$docNo = trim($this->form->getState()['document_number']) ?? null;
|
||||
|
||||
$docNo = trim($docNo) ?? null;
|
||||
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
$operatorName = $user->name;
|
||||
|
||||
//$this->dispatch('loadData', $palletNumber, $plantId);
|
||||
$this->form->fill([
|
||||
'serial_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $saleOrder,
|
||||
'pallet_number' => $palletNumber,
|
||||
'pending_pallet_list' => $pendingPallet,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
|
||||
if (!$palletNumber)
|
||||
{
|
||||
Notification::make()
|
||||
->title('Pallet number is required.')
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', '', $plantId);
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $saleOrder,
|
||||
'spare_packing_number' => $palletNumber,
|
||||
'pending_pallet_list' => $pendingPallet,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strlen($palletNumber) < 10)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Pallet number '$palletNumber' must be at least 10 digits.")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadLocator' ,'',$plantId);
|
||||
$this->form->fill([
|
||||
'serial_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $saleOrder,
|
||||
'spare_packing_number' => $palletNumber,
|
||||
'pending_pallet_list' => $pendingPallet,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$count = SparePacking::where('plant_id', $plantId)
|
||||
->where('spare_packing_number', $palletNumber)
|
||||
->count('spare_packing_number');
|
||||
|
||||
$palletNotCompleted = SparePacking::where('plant_id', $plantId)
|
||||
->where('spare_packing_number', $palletNumber)
|
||||
->where('spare_packing_status', '=','')
|
||||
->orWhere('spare_packing_status', '=',null)
|
||||
->first();
|
||||
|
||||
if (!$palletNotCompleted)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Pallet number not found $palletNumber!")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $saleOrder,
|
||||
'spare_packing_number' => $palletNumber,
|
||||
'pending_pallet_list' => $pendingPallet,
|
||||
'Sno_quantity' => $count,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $saleOrder,
|
||||
'spare_packing_number' => $palletNumber,
|
||||
'pending_pallet_list' => $pendingPallet,
|
||||
'Sno_quantity' => $count,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
|
||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
||||
|
||||
}
|
||||
|
||||
public function processRemoveDocNo()
|
||||
{
|
||||
$plantId = $this->form->getState()['plant_id'];
|
||||
|
||||
$plantId = trim($plantId) ?? null;
|
||||
|
||||
$pendingPallet = $this->form->getState()['pending_pallet_list'];
|
||||
|
||||
$palletNumber = trim($this->form->getState()['spare_packing_number']) ?? null;
|
||||
|
||||
$customerPo = trim($this->form->getState()['sale_order_master_id'])?? null;
|
||||
|
||||
$palletNumber = trim($palletNumber) ?? null;
|
||||
|
||||
$docNo = trim($this->form->getState()['removeDoc_number']) ?? null;
|
||||
|
||||
$docNo = trim($docNo) ?? null;
|
||||
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
$operatorName = $user->name;
|
||||
|
||||
if (!$palletNumber)
|
||||
{
|
||||
Notification::make()
|
||||
->title('Spare Pallet number is required to remove.')
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
$pattern = '/^([^|]+)\|([^|]+)\|(\d+(\.\d+)?)$/i';
|
||||
|
||||
if (!preg_match($pattern, $docNo, $matches))
|
||||
{
|
||||
Notification::make()
|
||||
->title("Scan Valid Qr code ")
|
||||
->body("Expected Format : (MaterialCode|Document Number|Quantity)")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $customerPo,
|
||||
'spare_packing_number' => $palletNumber,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$materialCode = $matches[1];
|
||||
$docNo = $matches[2];
|
||||
$weight = $matches[3];
|
||||
|
||||
$count = SparePacking::where('plant_id', $plantId)
|
||||
->where('spare_packing_number', $palletNumber)
|
||||
->count('spare_packing_number');
|
||||
|
||||
if (!$docNo)
|
||||
{
|
||||
Notification::make()
|
||||
->title('Document number is required to remove.')
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $customerPo,
|
||||
'spare_packing_number' => $palletNumber,
|
||||
'pending_pallet_list' => $pendingPallet,
|
||||
'Sno_quantity' => $count,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$processOrderexist = SparePacking::where('plant_id', $plantId)
|
||||
->where('document_number', $docNo)
|
||||
->first();
|
||||
if (!$processOrderexist)
|
||||
{
|
||||
Notification::make()
|
||||
->title('Document number not exists in pallet table.')
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $customerPo,
|
||||
'spare_packing_number' => $palletNumber,
|
||||
'pending_pallet_list' => $pendingPallet,
|
||||
'Sno_quantity' => $count,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$palletExist = SparePacking::where('plant_id', $plantId)
|
||||
->where('document_number', $docNo)
|
||||
->where('spare_packing_number', '!=', '')
|
||||
->where('spare_packing_number', '!=', null)
|
||||
->first();
|
||||
|
||||
if ($palletExist && $palletExist->spare_packing_number != $palletNumber)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Scanned document number exist in pallet number '$palletExist->spare_packing_number'.<br>Scan the valid exist document number to remove!")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $customerPo,
|
||||
'spare_packing_number' => $palletNumber,
|
||||
'pending_pallet_list' => $pendingPallet,
|
||||
'Sno_quantity' => $count,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$deleted = SparePacking::where('plant_id', $plantId)
|
||||
->where('spare_packing_number', $palletNumber)
|
||||
->where('document_number', $docNo)
|
||||
->forceDelete();
|
||||
|
||||
if ($deleted)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Scanned document number '$docNo' successfully removed from pallet table!<br>Scan the next exist document number to remove...")
|
||||
->success()
|
||||
->duration(600)
|
||||
->send();
|
||||
|
||||
$this->snoCount = SparePacking::where('plant_id', $plantId)
|
||||
->where('spare_packing_number', $palletNumber)
|
||||
->count();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $customerPo,
|
||||
'spare_packing_number' => $palletNumber,
|
||||
'removeDoc_number' => null,
|
||||
'pending_pallet_list' => $this->pendingPallet,
|
||||
'Sno_quantity' => $this->snoCount,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
|
||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
||||
}
|
||||
else
|
||||
{
|
||||
Notification::make()
|
||||
->title("Failed to remove scanned document number '$docNo' from master pallet!")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
||||
$this->form->fill([
|
||||
'document_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
'sale_order_master_id' => $customerPo,
|
||||
'spare_packing_number' => $palletNumber,
|
||||
'pending_pallet_list' => $pendingPallet,
|
||||
'Sno_quantity' => $count,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
}
|
||||
|
||||
//$this->dispatch('removeSno', $serialNumber, $palletNumber, $plantId);
|
||||
}
|
||||
|
||||
public function getFormActions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SparePackingResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SparePackingResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSparePacking extends EditRecord
|
||||
{
|
||||
protected static string $resource = SparePackingResource::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\SparePackingResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SparePackingResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListSparePackings extends ListRecords
|
||||
{
|
||||
protected static string $resource = SparePackingResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SparePackingResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SparePackingResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewSparePacking extends ViewRecord
|
||||
{
|
||||
protected static string $resource = SparePackingResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\CustomerPoMaster;
|
||||
use App\Models\Plant;
|
||||
use App\Models\SaleOrderMaster;
|
||||
use App\Models\SparePacking;
|
||||
use App\Models\WireMasterPacking;
|
||||
use Barryvdh\DomPDF\Facade\Pdf;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -279,9 +281,6 @@ class PalletPrintController extends Controller
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
@@ -310,4 +309,101 @@ class PalletPrintController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function printSpare(Request $request, $pallet, $plant)
|
||||
{
|
||||
|
||||
$customerPoMasterId = SparePacking::where('plant_id', $plant)
|
||||
->where('spare_packing_number', $pallet)
|
||||
->value('sale_order_master_id');
|
||||
|
||||
$masterIds = SparePacking::where('plant_id', $plant)
|
||||
->where('spare_packing_number', $pallet)
|
||||
->pluck('sale_order_master_id');
|
||||
|
||||
$customerPo = SaleOrderMaster::whereIn('id', $masterIds)
|
||||
->value('sale_order_number');
|
||||
|
||||
$customerPoMasterIds = SaleOrderMaster::where('sale_order_number', $customerPo)
|
||||
->pluck('id');
|
||||
|
||||
$items = SparePacking::with('item')
|
||||
->where('plant_id', $plant)
|
||||
->where('spare_packing_number', $pallet)
|
||||
->get()
|
||||
->map(function ($row) {
|
||||
return (object) [
|
||||
'code' => $row->item->code,
|
||||
'description' => $row->item->description,
|
||||
'box_count' => 1, // each row = one box
|
||||
'weight' => $row->quantity,
|
||||
];
|
||||
});
|
||||
|
||||
$customer = SaleOrderMaster::find($customerPoMasterId);
|
||||
|
||||
$customerCode = $customer->sale_order_number ?? '';
|
||||
$customerName = $customer->supplier_name ?? '';
|
||||
|
||||
$totalBoxes = SparePacking::where('plant_id', $plant)
|
||||
->whereIn('sale_order_master_id', $customerPoMasterIds)
|
||||
->select('spare_packing_number')
|
||||
->groupBy('spare_packing_number')
|
||||
->havingRaw(
|
||||
'COUNT(*) = COUNT(CASE WHEN spare_packing_status = ? THEN 1 END)',
|
||||
['Completed']
|
||||
)
|
||||
->count();
|
||||
|
||||
$completedPallets = SparePacking::where('plant_id', $plant)
|
||||
->whereIn('sale_order_master_id', $customerPoMasterIds)
|
||||
->select('spare_packing_number')
|
||||
->groupBy('spare_packing_number')
|
||||
->havingRaw(
|
||||
'COUNT(*) = COUNT(CASE WHEN spare_packing_status = ? THEN 1 END)',
|
||||
['Completed']
|
||||
)
|
||||
->orderBy('spare_packing_number')
|
||||
->pluck('spare_packing_number')
|
||||
->values();
|
||||
|
||||
$index = $completedPallets->search($pallet);
|
||||
|
||||
$currentPalletNo = ($index !== false) ? $index + 1 : 0;
|
||||
|
||||
$boxLabel = $currentPalletNo.'/'.$totalBoxes;
|
||||
|
||||
$grossWeight = $items->sum('weight');
|
||||
$widthPt = 85 * 2.83465; // 85mm → points
|
||||
$heightPt = 100 * 2.83465; // 100mm → points
|
||||
|
||||
$plantName = Plant::where('id', $plant)->value('name');
|
||||
|
||||
$plantAddress = Plant::where('id', $plant)->value('address');
|
||||
|
||||
$scannedAt = SparePacking::where('plant_id', $plant)
|
||||
->where('spare_packing_number', $pallet)
|
||||
->value('scanned_at');
|
||||
|
||||
$pdf = Pdf::loadView('pdf.spare-pallet', [
|
||||
'product' => 'Spare Packing List',
|
||||
'plantName' => $plantName,
|
||||
'plantAddress' => $plantAddress,
|
||||
// 'monthYear' => now()->format('M-y'),
|
||||
'monthYear' => $scannedAt
|
||||
? \Carbon\Carbon::parse($scannedAt)->format('M-y')
|
||||
: '',
|
||||
'branch' => '',
|
||||
'customerCode' => $customerCode,
|
||||
'customerName' => $customerName,
|
||||
'masterBox' => $boxLabel,
|
||||
'items' => $items,
|
||||
'grossWeight' => $grossWeight + 3.050,
|
||||
'netWeight' => $grossWeight,
|
||||
'pallet' => $pallet,
|
||||
])->setPaper([0, 0, $widthPt, $heightPt], 'portrait');
|
||||
|
||||
return $pdf->stream("Pallet-{$pallet}.pdf");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Mail\PanelBoxNotOkAlert;
|
||||
use App\Models\AlertMailRule;
|
||||
use App\Models\Item;
|
||||
use App\Models\Line;
|
||||
@@ -9,6 +10,7 @@ use App\Models\PanelBoxValidation;
|
||||
use App\Models\Plant;
|
||||
use App\Models\ProductCharacteristicsMaster;
|
||||
use App\Models\ProductionCharacteristic;
|
||||
use App\Models\StickerMaster;
|
||||
use Filament\Facades\Filament;
|
||||
use Livewire\Component;
|
||||
use Filament\Notifications\Notification;
|
||||
@@ -177,61 +179,46 @@ public $records = [];
|
||||
}
|
||||
}
|
||||
|
||||
// $latestReworkRecord = PanelBoxValidation::where('plant_id', $this->data['plant_id'] ?? null)->where('serial_number', $this->data['serial_number'] ?? null)->latest()->first();
|
||||
$latestReworkRecord = PanelBoxValidation::where('plant_id', $this->data['plant_id'] ?? null)->where('serial_number', $this->data['serial_number'] ?? null)->latest()->first();
|
||||
|
||||
// if($latestReworkRecord){
|
||||
// $qualityValidation = PanelBoxValidation::create([
|
||||
// 'plant_id' => $this->data['plant_id'] ?? null,
|
||||
// 'line_id' => $this->data['line_id'] ?? null,
|
||||
// 'sticker_master_id' => $this->data['sticker_master_id'] ?? null,
|
||||
// 'production_order' => $this->data['production_order'] ?? null,
|
||||
// 'serial_number' => $this->data['serial_number'] ?? null,
|
||||
// 'serial_number_panel' => $this->data['serial_number_panel'] ?? null,
|
||||
// 'pack_slip_panel' => $this->data['pack_slip_panel'] ?? null,
|
||||
// 'name_plate_panel' => $this->data['name_plate_panel'] ?? null,
|
||||
// 'tube_sticker_panel' => $this->data['tube_sticker_panel'] ?? null,
|
||||
// 'warranty_card_panel' => $this->data['warranty_card_panel'] ?? null,
|
||||
// 'part_validation1' => $this->data['part_validation1'] ?? null,
|
||||
// 'part_validation2' => $this->data['part_validation2'] ?? null,
|
||||
// 'part_validation3' => $this->data['part_validation3'] ?? null,
|
||||
// 'part_validation4' => $this->data['part_validation4'] ?? null,
|
||||
// 'part_validation5' => $this->data['part_validation5'] ?? null,
|
||||
// 'panel_box_supplier' => $this->data['panel_box_supplier'] ?? null,
|
||||
// 'panel_box_serial_number' => $this->data['panel_box_serial_number'] ?? null,
|
||||
// 'panel_box_code' => $this->data['panel_box_code'] ?? null,
|
||||
// 'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
||||
// 'rework_count' => $latestReworkRecord ? ((int) $latestReworkRecord->rework_count + 1) : 0,
|
||||
// 'created_by' => $this->data['created_by'] ?? null,
|
||||
// 'updated_by' => $this->data['updated_by'] ?? null,
|
||||
// ]);
|
||||
// }
|
||||
// else{
|
||||
// $qualityValidation = PanelBoxValidation::create([
|
||||
// 'plant_id' => $this->data['plant_id'] ?? null,
|
||||
// 'line_id' => $this->data['line_id'] ?? null,
|
||||
// 'sticker_master_id' => $this->data['sticker_master_id'] ?? null,
|
||||
// 'production_order' => $this->data['production_order'] ?? null,
|
||||
// 'serial_number' => $this->data['serial_number'] ?? null,
|
||||
// 'serial_number_panel' => $this->data['serial_number_panel'] ?? null,
|
||||
// 'pack_slip_panel' => $this->data['pack_slip_panel'] ?? null,
|
||||
// 'name_plate_panel' => $this->data['name_plate_panel'] ?? null,
|
||||
// 'tube_sticker_panel' => $this->data['tube_sticker_panel'] ?? null,
|
||||
// 'warranty_card_panel' => $this->data['warranty_card_panel'] ?? null,
|
||||
// 'part_validation1' => $this->data['part_validation1'] ?? null,
|
||||
// 'part_validation2' => $this->data['part_validation2'] ?? null,
|
||||
// 'part_validation3' => $this->data['part_validation3'] ?? null,
|
||||
// 'part_validation4' => $this->data['part_validation4'] ?? null,
|
||||
// 'part_validation5' => $this->data['part_validation5'] ?? null,
|
||||
// 'panel_box_supplier' => $this->data['panel_box_supplier'] ?? null,
|
||||
// 'panel_box_serial_number' => $this->data['panel_box_serial_number'] ?? null,
|
||||
// 'panel_box_code' => $this->data['panel_box_code'] ?? null,
|
||||
// 'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
||||
// 'created_by' => $this->data['created_by'] ?? null,
|
||||
// 'updated_by' => $this->data['updated_by'] ?? null,
|
||||
// ]);
|
||||
// }
|
||||
|
||||
$qualityValidation = PanelBoxValidation::create([
|
||||
if($latestReworkRecord){
|
||||
try{
|
||||
$qualityValidation = PanelBoxValidation::create([
|
||||
'plant_id' => $this->data['plant_id'] ?? null,
|
||||
'line_id' => $this->data['line_id'] ?? null,
|
||||
'sticker_master_id' => $this->data['sticker_master_id'] ?? null,
|
||||
'production_order' => $this->data['production_order'] ?? null,
|
||||
'serial_number' => $this->data['serial_number'] ?? null,
|
||||
'serial_number_panel' => $this->data['serial_number_panel'] ?? null,
|
||||
'pack_slip_panel' => $this->data['pack_slip_panel'] ?? null,
|
||||
'name_plate_panel' => $this->data['name_plate_panel'] ?? null,
|
||||
'tube_sticker_panel' => $this->data['tube_sticker_panel'] ?? null,
|
||||
'warranty_card_panel' => $this->data['warranty_card_panel'] ?? null,
|
||||
'part_validation1' => $this->data['part_validation1'] ?? null,
|
||||
'part_validation2' => $this->data['part_validation2'] ?? null,
|
||||
'part_validation3' => $this->data['part_validation3'] ?? null,
|
||||
'part_validation4' => $this->data['part_validation4'] ?? null,
|
||||
'part_validation5' => $this->data['part_validation5'] ?? null,
|
||||
'panel_box_supplier' => $this->data['panel_box_supplier'] ?? null,
|
||||
'panel_box_serial_number' => $this->data['panel_box_serial_number'] ?? null,
|
||||
'panel_box_code' => $this->data['panel_box_code'] ?? null,
|
||||
'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
||||
'rework_count' => $latestReworkRecord ? ((int) $latestReworkRecord->rework_count + 1) : 0,
|
||||
'created_by' => $this->data['created_by'] ?? null,
|
||||
'updated_by' => $this->data['updated_by'] ?? null,
|
||||
]);
|
||||
}
|
||||
catch (\Illuminate\Database\QueryException $e) {
|
||||
Notification::make()
|
||||
->title('Duplicate Record')
|
||||
->body("Duplicate serial number found against doc number '{$this->data['production_order'] }' and inspection lot number '{$this->data['inspection_lot_number']}'.")
|
||||
->danger()
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$qualityValidation = PanelBoxValidation::create([
|
||||
'plant_id' => $this->data['plant_id'] ?? null,
|
||||
'line_id' => $this->data['line_id'] ?? null,
|
||||
'sticker_master_id' => $this->data['sticker_master_id'] ?? null,
|
||||
@@ -253,7 +240,33 @@ public $records = [];
|
||||
'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
||||
'created_by' => $this->data['created_by'] ?? null,
|
||||
'updated_by' => $this->data['updated_by'] ?? null,
|
||||
]);
|
||||
]);
|
||||
}
|
||||
|
||||
// $qualityValidation = PanelBoxValidation::create([
|
||||
// 'plant_id' => $this->data['plant_id'] ?? null,
|
||||
// 'line_id' => $this->data['line_id'] ?? null,
|
||||
// 'sticker_master_id' => $this->data['sticker_master_id'] ?? null,
|
||||
// 'production_order' => $this->data['production_order'] ?? null,
|
||||
// 'serial_number' => $this->data['serial_number'] ?? null,
|
||||
// 'serial_number_panel' => $this->data['serial_number_panel'] ?? null,
|
||||
// 'pack_slip_panel' => $this->data['pack_slip_panel'] ?? null,
|
||||
// 'name_plate_panel' => $this->data['name_plate_panel'] ?? null,
|
||||
// 'tube_sticker_panel' => $this->data['tube_sticker_panel'] ?? null,
|
||||
// 'warranty_card_panel' => $this->data['warranty_card_panel'] ?? null,
|
||||
// 'part_validation1' => $this->data['part_validation1'] ?? null,
|
||||
// 'part_validation2' => $this->data['part_validation2'] ?? null,
|
||||
// 'part_validation3' => $this->data['part_validation3'] ?? null,
|
||||
// 'part_validation4' => $this->data['part_validation4'] ?? null,
|
||||
// 'part_validation5' => $this->data['part_validation5'] ?? null,
|
||||
// 'panel_box_supplier' => $this->data['panel_box_supplier'] ?? null,
|
||||
// 'panel_box_serial_number' => $this->data['panel_box_serial_number'] ?? null,
|
||||
// 'panel_box_code' => $this->data['panel_box_code'] ?? null,
|
||||
// 'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
||||
// 'created_by' => $this->data['created_by'] ?? null,
|
||||
// 'updated_by' => $this->data['updated_by'] ?? null,
|
||||
// ]);
|
||||
|
||||
|
||||
if (! $qualityValidation || ! $qualityValidation->exists) {
|
||||
Notification::make()
|
||||
@@ -261,7 +274,6 @@ public $records = [];
|
||||
->body('Something went wrong while inserting data.')
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -312,6 +324,8 @@ public $records = [];
|
||||
|
||||
if($this->selectForNotOk){
|
||||
|
||||
$notOkCharacteristics = [];
|
||||
|
||||
foreach ($this->records as $record) {
|
||||
|
||||
$characteristicId = $record['id'];
|
||||
@@ -326,6 +340,13 @@ public $records = [];
|
||||
->where('item_id', $itemId)
|
||||
->first();
|
||||
|
||||
$specVal = ProductCharacteristicsMaster::where('plant_id', $this->data['plant_id'])
|
||||
->where('item_id', $itemId)
|
||||
->where('line_id', $this->data['line_id'])
|
||||
->where('machine_id', $characteristic?->machine_id)
|
||||
->where('name', $characteristic?->name)
|
||||
->first();
|
||||
|
||||
if (($itemCharacteristic?->inspection_type ?? null) === 'Value') {
|
||||
if ($value == null || $value == '') {
|
||||
$status = null;
|
||||
@@ -356,6 +377,47 @@ public $records = [];
|
||||
'created_by' => $this->data['created_by'] ?? null,
|
||||
'updated_by' => $this->data['updated_by'] ?? null,
|
||||
]);
|
||||
|
||||
$notOkCharacteristics[] = [
|
||||
'characteristic_name' => $characteristic?->name ?? null,
|
||||
'observed_value' => $value ?? null,
|
||||
'lower' => $specVal?->lower,
|
||||
'upper' => $specVal?->upper,
|
||||
'status' => $status,
|
||||
];
|
||||
}
|
||||
|
||||
$plant = Plant::find($this->data['plant_id']);
|
||||
|
||||
$plantName = $plant?->name;
|
||||
|
||||
$code = $itemAgaPlant->code;
|
||||
|
||||
$mailRule = AlertMailRule::where('plant', $plant->id)->where('module', 'PanelBoxAlert')
|
||||
->where('rule_name', 'PanelBoxAlertMail')
|
||||
->where(fn ($q) => $q->whereNull('schedule_type')->orWhere('schedule_type', ''))
|
||||
->first();
|
||||
|
||||
if ($mailRule && !empty($mailRule->email)) {
|
||||
|
||||
$mail = Mail::to($mailRule->email);
|
||||
|
||||
|
||||
if (!empty($mailRule->cc_emails)) {
|
||||
$ccEmails = array_filter(
|
||||
array_map('trim', explode(',', $mailRule->cc_emails))
|
||||
);
|
||||
|
||||
$mail->cc($ccEmails);
|
||||
}
|
||||
|
||||
$mail->send(new PanelBoxNotOkAlert(
|
||||
$plantName,
|
||||
$code ?? null,
|
||||
$this->data['serial_number'] ?? null,
|
||||
$this->data['panel_box_supplier'] ?? null,
|
||||
$notOkCharacteristics
|
||||
));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -363,7 +425,6 @@ public $records = [];
|
||||
//All validations Passed
|
||||
foreach ($this->checklist as $characteristicId => $value) {
|
||||
|
||||
|
||||
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
||||
|
||||
$itemCharacteristic = ProductCharacteristicsMaster::where('plant_id', $this->data['plant_id'])
|
||||
|
||||
55
app/Livewire/SparePackData.php
Normal file
55
app/Livewire/SparePackData.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\SparePacking;
|
||||
use Livewire\Component;
|
||||
|
||||
class SparePackData extends Component
|
||||
{
|
||||
|
||||
public $plantId;
|
||||
|
||||
public $sparePackNo;
|
||||
|
||||
public $snoCount = 0;
|
||||
|
||||
public $records = [];
|
||||
|
||||
protected $listeners = [
|
||||
'loadData' => 'loadSparePackingData',
|
||||
];
|
||||
|
||||
public function loadSparePackingData($sparePackNo, $plantId)
|
||||
{
|
||||
$this->plantId = $plantId;
|
||||
$this->sparePackNo = $sparePackNo;
|
||||
$this->records = [];
|
||||
|
||||
$this->records = SparePacking::query()
|
||||
->where('plant_id', $this->plantId)
|
||||
->where('spare_packing_number', $this->sparePackNo)
|
||||
->orderBy('scanned_at')
|
||||
->get()
|
||||
->map(function ($record) {
|
||||
return [
|
||||
'created_at' => $record->created_at,
|
||||
'created_by' => $record->created_by ?? '',
|
||||
'spare_packing_number' => $record->spare_packing_number,
|
||||
'item_code' => $record->item?->code ?? '',
|
||||
'item_description' => $record->item?->description ?? '',
|
||||
'document_number' => $record->document_number,
|
||||
'quantity' => $record->quantity,
|
||||
'scanned_at' => $record->scanned_at,
|
||||
'scanned_by' => $record->scanned_by ?? '',
|
||||
];
|
||||
})
|
||||
->toArray();
|
||||
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.spare-pack-data');
|
||||
}
|
||||
}
|
||||
70
app/Mail/PanelBoxNotOkAlert.php
Normal file
70
app/Mail/PanelBoxNotOkAlert.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class PanelBoxNotOkAlert extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $plant;
|
||||
public $itemCode;
|
||||
public $serialNumber;
|
||||
public $characteristics;
|
||||
|
||||
public $supplier;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($plant,$itemCode,$serialNumber,$supplier, $characteristics)
|
||||
{
|
||||
$this->plant = $plant;
|
||||
$this->itemCode = $itemCode;
|
||||
$this->serialNumber = $serialNumber;
|
||||
$this->supplier = $supplier;
|
||||
$this->characteristics = $characteristics;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Panel Box Not Ok Alert',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
$greeting = '<b>Dear Sir</b>';
|
||||
return new Content(
|
||||
view: 'mail.panel-box-not-ok-alert',
|
||||
with: [
|
||||
'company' => 'CRI Digital Manufacturing Solutions',
|
||||
'greeting' => $greeting,
|
||||
'wishes' => 'Thanks & Regards,<br>CRI Digital Manufacturing Solutions',
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -31,4 +31,9 @@ class PanelGrMaster extends Model
|
||||
{
|
||||
return $this->belongsTo(Item::class);
|
||||
}
|
||||
|
||||
public function stickerMaster()
|
||||
{
|
||||
return $this->belongsTo(StickerMaster::class, 'sticker_master_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +94,11 @@ class Plant extends Model
|
||||
return $this->hasMany(PumpTestingEntry::class, 'plant_id', 'id');
|
||||
}
|
||||
|
||||
public function pumpTestingResults()
|
||||
{
|
||||
return $this->hasMany(PumpTestingResult::class, 'plant_id', 'id');
|
||||
}
|
||||
|
||||
public function guardNames()
|
||||
{
|
||||
return $this->hasMany(GuardName::class, 'plant_id', 'id');
|
||||
|
||||
@@ -59,4 +59,9 @@ class PumpTestingMaster extends Model
|
||||
{
|
||||
return $this->hasMany(PumpTestingEntry::class, 'pump_testing_master_id', 'id');
|
||||
}
|
||||
|
||||
public function pumpTestingResults()
|
||||
{
|
||||
return $this->hasMany(PumpTestingResult::class, 'pump_testing_master_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
47
app/Models/PumpTestingResult.php
Normal file
47
app/Models/PumpTestingResult.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class PumpTestingResult extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'pump_testing_master_id',
|
||||
'tested_date',
|
||||
'tested_type',
|
||||
'pump_serial_number',
|
||||
'correction_head',
|
||||
'sl_no',
|
||||
'voltage',
|
||||
'current',
|
||||
'watt',
|
||||
'frequency',
|
||||
'speed',
|
||||
'discharge',
|
||||
'head',
|
||||
'pump_output',
|
||||
'power_p2',
|
||||
'overall_efficiency',
|
||||
'pump_efficiency',
|
||||
'created_at',
|
||||
'created_by',
|
||||
'updated_at',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function pumpTestingMasters(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PumpTestingMaster::class, 'pump_testing_master_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ class RequestCharacteristic extends Model
|
||||
'item_id',
|
||||
'characteristic_approver_master_id',
|
||||
'aufnr',
|
||||
'gernr',
|
||||
'characteristic_name',
|
||||
'current_value',
|
||||
'update_value',
|
||||
|
||||
32
app/Models/SaleOrderMaster.php
Normal file
32
app/Models/SaleOrderMaster.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class SaleOrderMaster extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'item_id',
|
||||
'sale_order_number',
|
||||
'supplier_name',
|
||||
'quantity',
|
||||
'created_by',
|
||||
'updated_by'
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function item(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Item::class);
|
||||
}
|
||||
}
|
||||
44
app/Models/SparePacking.php
Normal file
44
app/Models/SparePacking.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class SparePacking extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'item_id',
|
||||
'sale_order_master_id',
|
||||
'spare_packing_number',
|
||||
'document_number',
|
||||
'batch_number',
|
||||
'quantity',
|
||||
'spare_packing_status',
|
||||
'created_at',
|
||||
'created_by',
|
||||
'updated_at',
|
||||
'updated_by',
|
||||
'scanned_at',
|
||||
'scanned_by',
|
||||
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
public function item(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Item::class, 'item_id');
|
||||
}
|
||||
|
||||
public function saleOrder(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(SaleOrderMaster::class, 'sale_order_master_id');
|
||||
}
|
||||
}
|
||||
105
app/Policies/PumpTestingResultPolicy.php
Normal file
105
app/Policies/PumpTestingResultPolicy.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\PumpTestingResult;
|
||||
use App\Models\User;
|
||||
|
||||
class PumpTestingResultPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any PumpTestingResult');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, PumpTestingResult $pumptestingresult): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view PumpTestingResult');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create PumpTestingResult');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, PumpTestingResult $pumptestingresult): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update PumpTestingResult');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, PumpTestingResult $pumptestingresult): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete PumpTestingResult');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any PumpTestingResult');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, PumpTestingResult $pumptestingresult): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore PumpTestingResult');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any PumpTestingResult');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, PumpTestingResult $pumptestingresult): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate PumpTestingResult');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder PumpTestingResult');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, PumpTestingResult $pumptestingresult): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete PumpTestingResult');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any PumpTestingResult');
|
||||
}
|
||||
}
|
||||
106
app/Policies/SaleOrderMasterPolicy.php
Normal file
106
app/Policies/SaleOrderMasterPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\SaleOrderMaster;
|
||||
use App\Models\User;
|
||||
|
||||
class SaleOrderMasterPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any SaleOrderMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, SaleOrderMaster $saleordermaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view SaleOrderMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create SaleOrderMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, SaleOrderMaster $saleordermaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update SaleOrderMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, SaleOrderMaster $saleordermaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete SaleOrderMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any SaleOrderMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, SaleOrderMaster $saleordermaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore SaleOrderMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any SaleOrderMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, SaleOrderMaster $saleordermaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate SaleOrderMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder SaleOrderMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, SaleOrderMaster $saleordermaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete SaleOrderMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any SaleOrderMaster');
|
||||
}
|
||||
}
|
||||
105
app/Policies/SparePackingPolicy.php
Normal file
105
app/Policies/SparePackingPolicy.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\SparePacking;
|
||||
use App\Models\User;
|
||||
|
||||
class SparePackingPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any SparePacking');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, SparePacking $sparepacking): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view SparePacking');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create SparePacking');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, SparePacking $sparepacking): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update SparePacking');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, SparePacking $sparepacking): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete SparePacking');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any SparePacking');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, SparePacking $sparepacking): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore SparePacking');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any SparePacking');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, SparePacking $sparepacking): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate SparePacking');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder SparePacking');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, SparePacking $sparepacking): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete SparePacking');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any SparePacking');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE pump_testing_results (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
pump_testing_master_id BIGINT NOT NULL,
|
||||
|
||||
tested_date DATE NOT NULL DEFAULT CURRENT_DATE,
|
||||
tested_type TEXT DEFAULT NULL,
|
||||
pump_serial_number TEXT DEFAULT NULL,
|
||||
correction_head TEXT DEFAULT NULL,
|
||||
sl_no TEXT DEFAULT NULL,
|
||||
voltage TEXT DEFAULT NULL,
|
||||
current TEXT DEFAULT NULL,
|
||||
watt TEXT DEFAULT NULL,
|
||||
frequency TEXT DEFAULT NULL,
|
||||
speed TEXT DEFAULT NULL,
|
||||
discharge TEXT DEFAULT NULL,
|
||||
head TEXT DEFAULT NULL,
|
||||
pump_output TEXT DEFAULT NULL,
|
||||
power_p2 TEXT DEFAULT NULL,
|
||||
overall_efficiency TEXT DEFAULT NULL,
|
||||
pump_efficiency TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT NOT NULL,
|
||||
updated_by TEXT NOT NULL,
|
||||
|
||||
UNIQUE (plant_id, pump_testing_master_id, tested_type, pump_serial_number, sl_no),
|
||||
|
||||
FOREIGN KEY (pump_testing_master_id) REFERENCES pump_testing_masters (id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('pump_testing_results');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?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 sale_order_masters (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
item_id BIGINT NOT NULL,
|
||||
sale_order_number TEXT DEFAULT NULL,
|
||||
supplier_name TEXT DEFAULT NULL,
|
||||
quantity TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
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('sale_order_masters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
<?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 spare_packings (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
item_id BIGINT NOT NULL,
|
||||
sale_order_master_id BIGINT NOT NULL,
|
||||
spare_packing_number TEXT DEFAULT NULL,
|
||||
document_number TEXT DEFAULT NULL,
|
||||
batch_number TEXT DEFAULT NULL,
|
||||
|
||||
quantity TEXT DEFAULT NULL,
|
||||
spare_packing_status TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
scanned_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
scanned_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants(id),
|
||||
FOREIGN KEY (sale_order_master_id) REFERENCES sale_order_masters(id),
|
||||
FOREIGN KEY (item_id) REFERENCES items(id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('spare_packings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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 request_characteristics
|
||||
ADD COLUMN gernr TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('request_characteristics', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
36
resources/views/filament/pages/spare-master-print.blade.php
Normal file
36
resources/views/filament/pages/spare-master-print.blade.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<x-filament-panels::page>
|
||||
|
||||
<div class="space-y-4">
|
||||
{{-- Render the Select form fields --}}
|
||||
<div class="space-y-4">
|
||||
{{ $this->form }}
|
||||
</div>
|
||||
|
||||
{{-- Add Pallet and Remove Pallet buttons --}}
|
||||
<div class="flex flex-row gap-2 mt-4">
|
||||
<button
|
||||
type="button"
|
||||
wire:click="printPallet"
|
||||
class="px-3 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||
>
|
||||
Print Pallet
|
||||
</button>
|
||||
{{-- <button
|
||||
type="button"
|
||||
wire:click="saveCustomerPO"
|
||||
class="px-3 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||
>
|
||||
Save PO
|
||||
</button> --}}
|
||||
</div>
|
||||
<div class="bg-white shadow rounded-xl p-4 mt-6">
|
||||
<livewire:spare-pack-data />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.addEventListener('open-pdf', event => {
|
||||
window.open(event.detail.url, '_blank');
|
||||
});
|
||||
</script>
|
||||
</x-filament-panels::page>
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
<x-filament::page>
|
||||
|
||||
<div class="filament-form space-y-6">
|
||||
{{ $this->form }}
|
||||
</div>
|
||||
|
||||
<div class="bg-white shadow rounded-xl p-4">
|
||||
<livewire:spare-pack-data />
|
||||
</div>
|
||||
|
||||
<div class="filament-actions mt-6">
|
||||
<x-filament::actions>
|
||||
@foreach ($this->getFormActions() as $action)
|
||||
{{ $action }}
|
||||
@endforeach
|
||||
</x-filament::actions>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
window.addEventListener('open-pdf', event => {
|
||||
const url = event.detail.url;
|
||||
const win = window.open(url, '_blank');
|
||||
if (!win || win.closed || typeof win.closed == 'undefined') {
|
||||
alert('Popup blocked. Please allow popups for this site.');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
</x-filament::page>
|
||||
@@ -0,0 +1,19 @@
|
||||
<div class="flex flex-col items-start space-y-1">
|
||||
<div class="flex items-center">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="is_completed"
|
||||
wire:model.defer="data.is_completed"
|
||||
class="focus:outline-none focus:ring-0 focus:border-transparent border-gray-300"
|
||||
>
|
||||
<label for="is_completed" style="margin-left:2mm;" class="whitespace-nowrap mb-0">
|
||||
Is Completed!
|
||||
</label>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
wire:click="markAsComplete"
|
||||
class="px-2 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||
>
|
||||
Save Pallet
|
||||
</button>
|
||||
47
resources/views/livewire/spare-pack-data.blade.php
Normal file
47
resources/views/livewire/spare-pack-data.blade.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<div class="p-4">
|
||||
<h2 class="text-lg font-bold mb-4 text-gray-700 uppercase tracking-wider">
|
||||
SPARE PACKING DATA TABLE:
|
||||
</h2>
|
||||
<div class="overflow-x-auto rounded-lg shadow">
|
||||
<table class="w-full divide-y divide-gray-200 text-sm text-center">
|
||||
<thead class="bg-gray-100 text-s font-semibold uppercase text-gray-700">
|
||||
<tr>
|
||||
<th class="border px-4 py-2">No</th>
|
||||
<th class="border px-4 py-2">Created Datetime</th>
|
||||
<th class="border px-4 py-2 whitespace-nowrap">Created By</th>
|
||||
<th class="border px-4 py-2 whitespace-nowrap">S PACKING No</th>
|
||||
<th class="border px-4 py-2 whitespace-nowrap">Item Code</th>
|
||||
<th class="border px-4 py-2">Description</th>
|
||||
<th class="border px-4 py-2">Doc No</th>
|
||||
<th class="border px-4 py-2">Quantity</th>
|
||||
<th class="border px-4 py-2">Scanned Datetime</th>
|
||||
<th class="border px-4 py-2 whitespace-nowrap">Scanned By</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-100">
|
||||
@forelse ($records as $index => $record)
|
||||
<tr class="hover:bg-gray-50">
|
||||
<td class="border px-4 py-2">{{ $index + 1 }}</td>
|
||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['created_at'] ?? '-' }}</td>
|
||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['created_by'] ?? '-' }}</td>
|
||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['spare_packing_number'] ?? '-' }}</td>
|
||||
<td class="border px-4 py-2">{{ $record['item_code'] ?? '-' }}</td>
|
||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['item_description'] ?? '-' }}</td>
|
||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['document_number'] ?? '-' }}</td>
|
||||
<td class="border px-4 py-2">{{ $record['quantity'] ?? '-' }}</td>
|
||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['scanned_at'] ?? '-' }}</td>
|
||||
<td class="border px-4 py-2">{{ $record['scanned_by'] ?? '-' }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="10" class="px-4 py-4 text-center text-gray-500">
|
||||
No spare packing records found.
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
310
resources/views/mail/panel-box-not-ok-alert.blade.php
Normal file
310
resources/views/mail/panel-box-not-ok-alert.blade.php
Normal file
@@ -0,0 +1,310 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<title>Panel Box Not OK Alert</title>
|
||||
|
||||
</head>
|
||||
|
||||
<body style="margin:0; padding:0; background-color:#f4f6f8; font-family:Arial, Helvetica, sans-serif;">
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0"
|
||||
style="background-color:#f4f6f8; padding:30px 0;">
|
||||
|
||||
<tr>
|
||||
<td align="center">
|
||||
|
||||
<!-- Main Container -->
|
||||
<table width="700" cellpadding="0" cellspacing="0" border="0"
|
||||
style="background-color:#ffffff; border-radius:8px; overflow:hidden;">
|
||||
|
||||
<!-- Header -->
|
||||
<tr>
|
||||
<td style="background-color:#b42318; padding:22px 30px;">
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<div style="font-size:24px; font-weight:bold; color:#ffffff;">
|
||||
Panel Box Inspection Alert
|
||||
</div>
|
||||
|
||||
<div style="font-size:14px; color:#ffe4e1; margin-top:6px;">
|
||||
Inspection result: NOT OK
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td align="right" style="font-size:28px; color:#ffffff;">
|
||||
⚠
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<!-- Introduction -->
|
||||
<tr>
|
||||
<td style="padding:25px 30px 10px 30px;">
|
||||
|
||||
<div style="font-size:16px; color:#333333; line-height:1.6;">
|
||||
A panel box inspection has been marked as
|
||||
<strong style="color:#b42318;">Not OK</strong>.
|
||||
Please review the inspection details below.
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<!-- Basic Information -->
|
||||
<tr>
|
||||
<td style="padding:15px 30px;">
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0"
|
||||
style="border:1px solid #e1e5e9; border-radius:6px;">
|
||||
|
||||
<tr>
|
||||
<td colspan="2"
|
||||
style="background-color:#f8f9fa; padding:12px 15px;
|
||||
font-size:16px; font-weight:bold; color:#333333;
|
||||
border-bottom:1px solid #e1e5e9;">
|
||||
Inspection Details
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="35%"
|
||||
style="padding:12px 15px; font-size:14px;
|
||||
color:#666666; border-bottom:1px solid #eeeeee;">
|
||||
Plant
|
||||
</td>
|
||||
|
||||
<td
|
||||
style="padding:12px 15px; font-size:14px;
|
||||
font-weight:bold; color:#222222;
|
||||
border-bottom:1px solid #eeeeee;">
|
||||
{{ $plant }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td
|
||||
style="padding:12px 15px; font-size:14px;
|
||||
color:#666666; border-bottom:1px solid #eeeeee;">
|
||||
Panel Box Code
|
||||
</td>
|
||||
|
||||
<td
|
||||
style="padding:12px 15px; font-size:14px;
|
||||
font-weight:bold; color:#222222;
|
||||
border-bottom:1px solid #eeeeee;">
|
||||
{{ $itemCode }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td
|
||||
style="padding:12px 15px; font-size:14px;
|
||||
color:#666666;">
|
||||
Serial Number
|
||||
</td>
|
||||
|
||||
<td
|
||||
style="padding:12px 15px; font-size:14px;
|
||||
font-weight:bold; color:#222222;">
|
||||
{{ $serialNumber }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td
|
||||
style="padding:12px 15px; font-size:14px;
|
||||
color:#666666;">
|
||||
Supplier Number
|
||||
</td>
|
||||
|
||||
<td
|
||||
style="padding:12px 15px; font-size:14px;
|
||||
font-weight:bold; color:#222222;">
|
||||
{{ $supplier }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<!-- Failed Characteristics -->
|
||||
<tr>
|
||||
<td style="padding:15px 30px 25px 30px;">
|
||||
|
||||
<div style="font-size:16px; font-weight:bold;
|
||||
color:#333333; margin-bottom:12px;">
|
||||
Characteristics
|
||||
</div>
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0"
|
||||
style="border-collapse:collapse;">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="left"
|
||||
style="background-color:#f8f9fa;
|
||||
border:1px solid #e1e5e9;
|
||||
padding:12px;
|
||||
font-size:13px;
|
||||
color:#555555;">
|
||||
S.No
|
||||
</th>
|
||||
|
||||
<th align="left"
|
||||
style="background-color:#f8f9fa;
|
||||
border:1px solid #e1e5e9;
|
||||
padding:12px;
|
||||
font-size:13px;
|
||||
color:#555555;">
|
||||
Characteristic Name
|
||||
</th>
|
||||
|
||||
<th align="left"
|
||||
style="background-color:#f8f9fa;
|
||||
border:1px solid #e1e5e9;
|
||||
padding:12px;
|
||||
font-size:13px;
|
||||
color:#555555;">
|
||||
Spec Value
|
||||
</th>
|
||||
|
||||
<th align="left"
|
||||
style="background-color:#f8f9fa;
|
||||
border:1px solid #e1e5e9;
|
||||
padding:12px;
|
||||
font-size:13px;
|
||||
color:#555555;">
|
||||
Observed Value
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
@foreach(($characteristics ?? []) as $index => $characteristic)
|
||||
<tr>
|
||||
|
||||
<td
|
||||
style="border:1px solid #e1e5e9;
|
||||
padding:12px;
|
||||
font-size:14px;
|
||||
color:#333333;">
|
||||
{{ $index + 1 }}
|
||||
</td>
|
||||
|
||||
<td
|
||||
style="border:1px solid #e1e5e9;
|
||||
padding:12px;
|
||||
font-size:14px;
|
||||
font-weight:bold;
|
||||
color:#333333;">
|
||||
{{ $characteristic['characteristic_name'] }}
|
||||
</td>
|
||||
|
||||
<td style="border:1px solid #e1e5e9;
|
||||
padding:12px;
|
||||
font-size:14px;
|
||||
color:#333333;
|
||||
white-space:nowrap;">
|
||||
{{ $characteristic['lower'] }}
|
||||
-
|
||||
{{ $characteristic['upper'] }}
|
||||
</td>
|
||||
|
||||
<td style="border:1px solid #e1e5e9;
|
||||
padding:12px;
|
||||
font-size:14px;
|
||||
font-weight:bold;
|
||||
white-space:nowrap;
|
||||
color:
|
||||
@if($characteristic['status'] == 'Ok')
|
||||
#008000
|
||||
@elseif($characteristic['status'] == 'NotOk')
|
||||
#b42318
|
||||
@else
|
||||
#333333
|
||||
@endif
|
||||
;">
|
||||
{{ $characteristic['observed_value'] }}
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
@endforeach
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<!-- Alert Message -->
|
||||
<tr>
|
||||
<td style="padding:0 30px 25px 30px;">
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0"
|
||||
style="background-color:#fff4f2;
|
||||
border-left:4px solid #b42318;">
|
||||
|
||||
<tr>
|
||||
<td style="padding:14px 16px;
|
||||
font-size:14px;
|
||||
color:#7a271a;
|
||||
line-height:1.5;">
|
||||
|
||||
<strong>Action Required:</strong>
|
||||
Please review the above inspection results
|
||||
and take the necessary corrective action.
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<!-- Footer -->
|
||||
<tr>
|
||||
<td style="background-color:#f8f9fa;
|
||||
padding:18px 30px;
|
||||
border-top:1px solid #e1e5e9;
|
||||
text-align:center;">
|
||||
|
||||
<div style="font-size:12px; color:#777777;">
|
||||
This is an automated notification from the
|
||||
Panel Box Inspection System.
|
||||
</div>
|
||||
|
||||
<div style="font-size:12px; color:#999999; margin-top:5px;">
|
||||
Please do not reply to this email.
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
458
resources/views/pdf/spare-pallet.blade.php
Normal file
458
resources/views/pdf/spare-pallet.blade.php
Normal file
@@ -0,0 +1,458 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>SpareLabel</title>
|
||||
|
||||
@php
|
||||
|
||||
$pageHeightMm = 292;
|
||||
$pageWidthMm = 100;
|
||||
$paddingMm = 1.3;
|
||||
|
||||
$headerRows = [
|
||||
'MFG. MONTH & YEAR' => $monthYear,
|
||||
'SALE ORDER NO' => $customerCode,
|
||||
'SUPPLIER NAME' => $customerName,
|
||||
'MASTER BOX NO.' => $masterBox,
|
||||
];
|
||||
|
||||
|
||||
$titleHeight = 10;
|
||||
$headerRowHeight = 5;
|
||||
$itemHeaderHeight = 14;
|
||||
|
||||
// FOOTER SECTION
|
||||
$grossWeightHeight = 5;
|
||||
$netWeightHeight = 5;
|
||||
$licenseHeight = 5;
|
||||
$companyInfoHeight = 6.9;
|
||||
|
||||
$logoHeight = $titleHeight * 0.8;
|
||||
$logoMaxWidth = 20;
|
||||
|
||||
$isilogoHeight = $titleHeight * 0.9;
|
||||
$isilogoMaxWidth = 11;
|
||||
|
||||
$availableHeight = $pageHeightMm - (2 * $paddingMm);
|
||||
|
||||
$itemPages = collect($items)->chunk(40);
|
||||
|
||||
if ($itemPages->isEmpty()) {
|
||||
$itemPages = collect([
|
||||
collect()
|
||||
]);
|
||||
}
|
||||
|
||||
$qrBase64 = 'data:image/png;base64,' . base64_encode(
|
||||
QrCode::format('png')
|
||||
->size(120)
|
||||
->margin(0)
|
||||
->generate($pallet)
|
||||
);
|
||||
|
||||
@endphp
|
||||
|
||||
<style>
|
||||
|
||||
@page {
|
||||
size: 100mm 292mm;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: <?php echo $paddingMm; ?>mm;
|
||||
font-family: DejaVu Sans, sans-serif;
|
||||
font-size: 7px;
|
||||
color: #000;
|
||||
width: <?php echo $pageWidthMm - (2 * $paddingMm); ?>mm;
|
||||
height: <?php echo $availableHeight; ?>mm;
|
||||
line-height: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.page {
|
||||
width: <?php echo $pageWidthMm - (2 * $paddingMm); ?>mm;
|
||||
height: <?php echo $availableHeight; ?>mm;
|
||||
page-break-after: always;
|
||||
break-after: page;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.page:last-child {
|
||||
page-break-after: auto;
|
||||
break-after: auto;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
td,
|
||||
th {
|
||||
border: 0.3px solid #000 !important;
|
||||
vertical-align: middle;
|
||||
line-height: 1 !important;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.title-row td {
|
||||
height: <?php echo $titleHeight - 0.6; ?>mm !important;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
position: relative;
|
||||
padding: 0 !important;
|
||||
font-size: 8.5px;
|
||||
}
|
||||
|
||||
.logo {
|
||||
position: absolute;
|
||||
left: 2mm;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
height: <?php echo min(8, ($titleHeight - 0.6) * 0.6); ?>mm;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.vertical-line {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
border-left: 0.3px solid #000;
|
||||
}
|
||||
|
||||
.vertical-line.left {
|
||||
left: 12mm;
|
||||
}
|
||||
|
||||
.vertical-line.right {
|
||||
right: 12mm;
|
||||
}
|
||||
|
||||
.header-row td {
|
||||
height: <?php echo $headerRowHeight - 0.6; ?>mm !important;
|
||||
padding: 0.2mm 0.5mm !important;
|
||||
}
|
||||
|
||||
.header-row .label {
|
||||
width: 40%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.items-header-row td {
|
||||
height: <?php echo $itemHeaderHeight - 0.6; ?>mm !important;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
font-size: 6.5px;
|
||||
padding: 0.2mm 0.5mm !important;
|
||||
}
|
||||
|
||||
.item-row td {
|
||||
height: <?php echo 4; ?>mm !important;
|
||||
font-size: 6.5px !important;
|
||||
padding: 0.1mm 0.4mm !important;
|
||||
line-height: 1 !important;
|
||||
}
|
||||
|
||||
.gross-weight-row td {
|
||||
height: <?php echo $grossWeightHeight - 0.6; ?>mm !important;
|
||||
text-align: center;
|
||||
font-size: 6.5px;
|
||||
padding: 0.2mm 0.5mm !important;
|
||||
}
|
||||
|
||||
.net-weight-row td {
|
||||
height: <?php echo $netWeightHeight - 0.6; ?>mm !important;
|
||||
text-align: center;
|
||||
font-size: 6.5px;
|
||||
padding: 0.2mm 0.5mm !important;
|
||||
}
|
||||
|
||||
.license-row td {
|
||||
height: <?php echo $licenseHeight - 0.6; ?>mm !important;
|
||||
text-align: center;
|
||||
font-size: 6.5px;
|
||||
padding: 0.2mm 0.5mm !important;
|
||||
}
|
||||
|
||||
.company-info-row td {
|
||||
height: <?php echo $companyInfoHeight - 0.6; ?>mm !important;
|
||||
font-size: 5.5px;
|
||||
line-height: 0.9 !important;
|
||||
padding: 0.1mm 0.5mm !important;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-weight: bold;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.col-1 {
|
||||
width: 18%;
|
||||
}
|
||||
|
||||
.col-2 {
|
||||
width: 55%;
|
||||
}
|
||||
|
||||
.col-3 {
|
||||
width: 14%;
|
||||
}
|
||||
|
||||
.col-4 {
|
||||
width: 13%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
|
||||
@foreach ($itemPages as $pageItems)
|
||||
|
||||
@php
|
||||
|
||||
$numItems = count($pageItems) ?: 1;
|
||||
|
||||
$fixedSpace = $titleHeight + (4 * $headerRowHeight) + $itemHeaderHeight + $netWeightHeight + $licenseHeight + $companyInfoHeight;
|
||||
|
||||
$fixedRowCount = 1 /* title */
|
||||
+ 4 /* header rows */
|
||||
+ 1 /* items header */
|
||||
+ 1 /* net weight */
|
||||
+ 1 /* license */
|
||||
+ 1; /* company info */
|
||||
|
||||
$desiredBottomGap = 5;
|
||||
|
||||
$spaceForItemsOnly = $availableHeight - $fixedSpace + ($fixedRowCount * 0.6) - $desiredBottomGap;
|
||||
|
||||
$itemRowHeight = ($spaceForItemsOnly / $numItems) + 0.6;
|
||||
|
||||
$maxItemRowHeight = 5;
|
||||
|
||||
if ($itemRowHeight > $maxItemRowHeight) {
|
||||
$itemRowHeight = $maxItemRowHeight;
|
||||
}
|
||||
|
||||
$itemRowHeight = floor($itemRowHeight * 10) / 10;
|
||||
|
||||
if ($itemRowHeight < 3) {
|
||||
|
||||
$itemFontSize = '5.5px';
|
||||
|
||||
$itemPadding = '0.1mm 0.3mm';
|
||||
|
||||
} elseif ($itemRowHeight < 3.5) {
|
||||
|
||||
$itemFontSize = '6px';
|
||||
|
||||
$itemPadding = '0.1mm 0.4mm';
|
||||
|
||||
} elseif ($itemRowHeight < 4) {
|
||||
|
||||
$itemFontSize = '6.5px';
|
||||
|
||||
$itemPadding = '0.1mm 0.5mm';
|
||||
|
||||
} else {
|
||||
|
||||
$itemFontSize = '7px';
|
||||
|
||||
$itemPadding = '0.2mm 0.5mm';
|
||||
}
|
||||
|
||||
$compensatedItemHeight = $itemRowHeight - 0.6;
|
||||
|
||||
$pageTotalQuantity = $pageItems->sum('weight');
|
||||
|
||||
@endphp
|
||||
|
||||
<div class="page">
|
||||
|
||||
<style>
|
||||
|
||||
.page .item-row{
|
||||
height: <?php echo $compensatedItemHeight; ?>mm !important;
|
||||
font-size: <?php echo $itemFontSize; ?> !important;
|
||||
padding: <?php echo $itemPadding; ?> !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<table>
|
||||
|
||||
<tr class="title-row">
|
||||
|
||||
<td colspan="4">
|
||||
|
||||
<div class="vertical-line left"></div>
|
||||
|
||||
<img
|
||||
src="<?php echo public_path('images/crilogo1.png'); ?>"
|
||||
class="logo"
|
||||
alt="CRI Logo"
|
||||
|
||||
style="
|
||||
height: <?php echo $logoHeight; ?>mm;
|
||||
max-width: <?php echo $logoMaxWidth; ?>mm;
|
||||
width: auto;
|
||||
"
|
||||
>
|
||||
Master Packing Slip
|
||||
<div class="vertical-line right"></div>
|
||||
<img
|
||||
src="{{ $qrBase64 }}"
|
||||
style="
|
||||
position: absolute;
|
||||
bottom: 0.8mm;
|
||||
right: 2mm;
|
||||
width: 8mm;
|
||||
height: 7.8mm;
|
||||
"
|
||||
>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php foreach ($headerRows as $label => $value): ?>
|
||||
|
||||
<tr class="header-row">
|
||||
|
||||
<td class="label">
|
||||
<?php echo $label; ?>
|
||||
</td>
|
||||
|
||||
<td colspan="3">
|
||||
<?php echo $value; ?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
<tr class="items-header-row">
|
||||
<td class="col-1 center">MATERIAL CODE</td>
|
||||
<td class="col-2 center">DESCRIPTION</td>
|
||||
<td class="col-3 center">QTY in kg</td>
|
||||
<td class="col-4 center">NO. OF BOXES</td>
|
||||
</tr>
|
||||
|
||||
@if ($pageItems->count() > 0)
|
||||
|
||||
@foreach ($pageItems as $item)
|
||||
|
||||
<tr class="item-row">
|
||||
|
||||
<td class="col-1 center">
|
||||
<?php echo $item->code; ?>
|
||||
</td>
|
||||
|
||||
<td class="col-2" style="white-space: nowrap;">
|
||||
<?php echo $item->description; ?>
|
||||
</td>
|
||||
|
||||
<td class="col-3 right">
|
||||
<?php echo number_format($item->weight, 3); ?>
|
||||
</td>
|
||||
|
||||
<td class="col-4 center">
|
||||
<?php echo $item->box_count; ?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
@endforeach
|
||||
|
||||
@else
|
||||
|
||||
<tr class="item-row">
|
||||
|
||||
<td colspan="4" class="center">
|
||||
No items available
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
@endif
|
||||
|
||||
<tr class="net-weight-row">
|
||||
|
||||
<td colspan="2" class="label center">
|
||||
TOTAL QUANTITY
|
||||
</td>
|
||||
|
||||
<td colspan="2" class="center">
|
||||
<?php echo number_format($pageTotalQuantity, 3); ?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr class="license-row">
|
||||
|
||||
<td colspan="4" class="center">
|
||||
|
||||
MANUFACTURERS
|
||||
|
||||
|
||||
MADE IN INDIA
|
||||
|
||||
|
||||
*Under License
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr class="company-info-row">
|
||||
|
||||
<td colspan="4" class="center">
|
||||
C.R.I. PUMPS PRIVATE LIMITED
|
||||
<br>
|
||||
|
||||
(Unit of {{ $plantName }})
|
||||
<br>
|
||||
|
||||
{{ $plantAddress }}
|
||||
<br>
|
||||
|
||||
India Regd.Office :
|
||||
7/46-1, Keeranatham Road,
|
||||
Saravanampatti,
|
||||
Coimbatore- 641 035
|
||||
<br>
|
||||
|
||||
For Feedback/Complaint:
|
||||
C.R.I. Customer care cell
|
||||
Toll-Free: 1800 121 1243
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
@endforeach
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -158,8 +158,12 @@ Route::get('testing/pump-master/get', [TestingPanelController::class, 'get_pump_
|
||||
|
||||
Route::get('testing/pump-entry/get', [TestingPanelController::class, 'get_pump_entry']);
|
||||
|
||||
Route::post('testing/pump-entry/store-data', [TestingPanelController::class, 'storePumpEntry']);
|
||||
|
||||
Route::get('testing/pump-result/get', [TestingPanelController::class, 'get_pump_result']);
|
||||
|
||||
Route::post('testing/pump-result/store-data', [TestingPanelController::class, 'storePumpResult']);
|
||||
|
||||
// Testing panel Controller
|
||||
|
||||
Route::get('testing/user/get-data', [UserController::class, 'get_user_data']);
|
||||
@@ -188,6 +192,10 @@ Route::get('get-pdf', [PdfController::class, 'getPdf']); // processorder/get-pdf
|
||||
|
||||
Route::get('laser/item/get-quality-master-data', [StickerMasterController::class, 'get_quality_master']);
|
||||
|
||||
// ..Model Master - Laser
|
||||
|
||||
// Route::get('laser/model-master/get', [StickerMasterController::class, 'get_master']);
|
||||
|
||||
// ..Part Validation
|
||||
|
||||
Route::get('laser/item/get-master-data', [StickerMasterController::class, 'get_master']);
|
||||
@@ -260,8 +268,12 @@ 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-spare-pallet/{pallet}/{plant}', [PalletPrintController::class, 'printSpare'])->name('print.sparepallet');
|
||||
|
||||
Route::post('vehicle/entry', [VehicleController::class, 'storeVehicleEntry']);
|
||||
|
||||
// Item Code
|
||||
|
||||
Route::get('item-code', [PlantController::class, 'getItemCode']);
|
||||
|
||||
// Route::post('laser-stop-report', [SapFileController::class, 'laserStopReport']);
|
||||
|
||||
Reference in New Issue
Block a user