Compare commits
12 Commits
8697f72e15
...
renovate/t
| Author | SHA1 | Date | |
|---|---|---|---|
| d778628877 | |||
| 3bbf6d9e2f | |||
|
|
337d16f120 | ||
| ed17645a6e | |||
|
|
4de4f35220 | ||
|
|
688674aa40 | ||
| 5383bc5d15 | |||
|
|
aafdfe3148 | ||
|
|
4fe5793c1b | ||
| b94fed9f51 | |||
|
|
9b10ff0069 | ||
|
|
6bc14a347a |
@@ -30,9 +30,9 @@ class MotorTestingMasterImporter extends Importer
|
||||
->rules(['required']),
|
||||
ImportColumn::make('subassembly_code')
|
||||
->requiredMapping()
|
||||
->exampleHeader('SubAssembly Code')
|
||||
->exampleHeader('Subassembly Code')
|
||||
->example(['123456'])
|
||||
->label('SubAssembly Code')
|
||||
->label('Subassembly Code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('isi_model')
|
||||
->requiredMapping()
|
||||
@@ -274,7 +274,7 @@ class MotorTestingMasterImporter extends Importer
|
||||
$warnMsg[] = 'Invalid plant code found';
|
||||
} elseif (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
|
||||
$warnMsg[] = 'Invalid item code found';
|
||||
} elseif (Str::length($sCode) < 6 || ! ctype_alnum($sCode)) {
|
||||
} elseif (Str::length($sCode) > 0 && (Str::length($sCode) < 6 || ! ctype_alnum($sCode))) {
|
||||
$warnMsg[] = 'Invalid sub-assembly code found';
|
||||
} else {
|
||||
$plant = Plant::where('code', $plantCod)->first();
|
||||
|
||||
@@ -119,7 +119,7 @@ class MotorTestingMasterResource extends Resource
|
||||
Forms\Components\TextInput::make('subassembly_code')
|
||||
->label('Subassembly Code')
|
||||
// ->required()
|
||||
->placeholder('Scan the valid code')
|
||||
->placeholder('Scan the subassembly code')
|
||||
->reactive()
|
||||
->alphaNum()
|
||||
->minLength(6)
|
||||
@@ -195,42 +195,49 @@ class MotorTestingMasterResource extends Resource
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('hp')
|
||||
->label('HP')
|
||||
->placeholder('Scan the HP')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('kw')
|
||||
->label('KW')
|
||||
->placeholder('Scan the KW')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('volt')
|
||||
->label('Volt')
|
||||
->placeholder('Scan the volt')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('current')
|
||||
->label('Current')
|
||||
->placeholder('Scan the current')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('rpm')
|
||||
->label('RPM')
|
||||
->placeholder('Scan the RPM')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('torque')
|
||||
->label('Torque')
|
||||
->placeholder('Scan the torque')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('frequency')
|
||||
->label('Frequency')
|
||||
->placeholder('Scan the frequency')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
@@ -265,12 +272,14 @@ class MotorTestingMasterResource extends Resource
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('ins_res_limit')
|
||||
->label('Insulation Resistance Limit')
|
||||
->placeholder('Scan the insulation resistance limit')
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\Select::make('ins_res_type')
|
||||
->label('Insulation Resistance Type')
|
||||
->placeholder('Scan the insulation resistance type')
|
||||
->default('O')
|
||||
->selectablePlaceholder(false)
|
||||
->options(function (callable $get) {
|
||||
@@ -294,96 +303,112 @@ class MotorTestingMasterResource extends Resource
|
||||
}),
|
||||
Forms\Components\TextInput::make('res_ry_ll')
|
||||
->label('Resistance RY LL')
|
||||
->placeholder('Scan the resistance RY LL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('res_ry_ul')
|
||||
->label('Resistance RY UL')
|
||||
->placeholder('Scan the resistance RY UL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('res_yb_ll')
|
||||
->label('Resistance YB LL')
|
||||
->placeholder('Scan the resistance YB LL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('res_yb_ul')
|
||||
->label('Resistance YB UL')
|
||||
->placeholder('Scan the resistance YB UL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('res_br_ll')
|
||||
->label('Resistance BR LL')
|
||||
->placeholder('Scan the resistance BR LL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('res_br_ul')
|
||||
->label('Resistance BR UL')
|
||||
->placeholder('Scan the resistance BR UL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('lock_volt_limit')
|
||||
->label('Lock Volt Limit')
|
||||
->placeholder('Scan the lock volt limit')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('leak_cur_limit')
|
||||
->label('Leakage Current Limit')
|
||||
->placeholder('Scan the leakage current limit')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('lock_cur_ll')
|
||||
->label('Lock Current LL')
|
||||
->placeholder('Scan the lock current LL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('lock_cur_ul')
|
||||
->label('Lock Current UL')
|
||||
->placeholder('Scan the lock current UL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('noload_cur_ll')
|
||||
->label('No Load Current LL')
|
||||
->placeholder('Scan the no load current LL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('noload_cur_ul')
|
||||
->label('No Load Current UL')
|
||||
->placeholder('Scan the no load current UL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('noload_pow_ll')
|
||||
->label('No Load Power LL')
|
||||
->placeholder('Scan the no load power LL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('noload_pow_ul')
|
||||
->label('No Load Power UL')
|
||||
->placeholder('Scan the no load power UL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('noload_spd_ll')
|
||||
->label('No Load Speed LL')
|
||||
->placeholder('Scan the no load speed LL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('noload_spd_ul')
|
||||
->label('No Load Speed UL')
|
||||
->placeholder('Scan the no load speed UL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
@@ -420,6 +445,7 @@ class MotorTestingMasterResource extends Resource
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('item.category')
|
||||
->label('Category')
|
||||
->default('-')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
@@ -430,6 +456,7 @@ class MotorTestingMasterResource extends Resource
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('subassembly_code')
|
||||
->label('Subassembly Code')
|
||||
->default('-')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
@@ -593,17 +620,34 @@ class MotorTestingMasterResource extends Resource
|
||||
->options(function (callable $get) {
|
||||
$pId = $get('Plant');
|
||||
|
||||
if (! $pId) {
|
||||
return [];
|
||||
} else {
|
||||
return Item::whereHas('motorTestingMasters', function ($query) use ($pId) {
|
||||
if ($pId) {
|
||||
$query->where('plant_id', $pId);
|
||||
}
|
||||
})->pluck('code', 'id');
|
||||
}
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
Select::make('subassembly_code')
|
||||
->label('Search by Subassembly Code')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if (! $plantId) {
|
||||
return [];
|
||||
} else {
|
||||
return MotorTestingMaster::where('plant_id', $plantId)->whereNotNull('subassembly_code')->select('subassembly_code')->distinct()->pluck('subassembly_code', 'subassembly_code');
|
||||
}
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
TextInput::make('description')
|
||||
->label('Description')
|
||||
->placeholder('Enter Description'),
|
||||
->label('Model')
|
||||
->placeholder('Enter Model'),
|
||||
Radio::make('isi_type')
|
||||
->label('ISI Model ?')
|
||||
->boolean()
|
||||
@@ -714,7 +758,7 @@ class MotorTestingMasterResource extends Resource
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['Plant']) && empty($data['Item']) && empty($data['description']) && empty($data['isi_type']) && empty($data['phase_type']) && empty($data['connection_type']) && empty($data['created_by']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_by']) && empty($data['updated_from']) && empty($data['updated_to'])) {// || $data['isi_type'] == 'All')
|
||||
if (empty($data['Plant']) && empty($data['Item']) && empty($data['subassembly_code']) && empty($data['description']) && empty($data['isi_type']) && empty($data['phase_type']) && empty($data['connection_type']) && empty($data['created_by']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_by']) && empty($data['updated_from']) && empty($data['updated_to'])) {// || $data['isi_type'] == 'All')
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
@@ -738,6 +782,10 @@ class MotorTestingMasterResource extends Resource
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($data['subassembly_code'])) {
|
||||
$query->where('subassembly_code', $data['subassembly_code']);
|
||||
}
|
||||
|
||||
if (! empty($data['description'])) {
|
||||
$pId = $data['Plant'] ?? null;
|
||||
$descIds = Item::where('description', 'like', '%'.$data['description'].'%')->whereHas('motorTestingMasters', function ($query) use ($pId) {
|
||||
@@ -807,8 +855,12 @@ class MotorTestingMasterResource extends Resource
|
||||
$indicators[] = 'Item Codes: '.$itemCode;
|
||||
}
|
||||
|
||||
if (! empty($data['subassembly_code'])) {
|
||||
$indicators[] = 'Subassembly Code: '.$data['subassembly_code'];
|
||||
}
|
||||
|
||||
if (! empty($data['description'])) {
|
||||
$indicators[] = 'Description: '.$data['description'];
|
||||
$indicators[] = 'Model: '.$data['description'];
|
||||
}
|
||||
|
||||
if ($data['isi_type'] == 'Y') {
|
||||
|
||||
@@ -14,6 +14,7 @@ use App\Models\MotorTestingMaster;
|
||||
use App\Models\Plant;
|
||||
use App\Models\TestingPanelReading;
|
||||
use Barryvdh\DomPDF\Facade\Pdf;
|
||||
use Closure;
|
||||
// use Barryvdh\Reflection\DocBlock\Type\Collection;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
@@ -36,6 +37,7 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
// use Barryvdh\Snappy\Facades\SnappyPdf as PDF;
|
||||
use Illuminate\Support\Str;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
// use App\Exports\TestingPanelReadingExport;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory; // For loading Excel file
|
||||
@@ -95,7 +97,7 @@ class TestingPanelReadingResource extends Resource
|
||||
->hintColor('danger'),
|
||||
Forms\Components\Select::make('line_id')
|
||||
->label('Line Name')
|
||||
->relationship('line', 'name')
|
||||
// ->relationship('line', 'name')
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
@@ -115,11 +117,12 @@ class TestingPanelReadingResource extends Resource
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('motor_testing_master_id', null);
|
||||
$set('machine_id', null);
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\Select::make('machine_id')
|
||||
->label('Work Center')
|
||||
->relationship('machine', 'work_center')
|
||||
// ->relationship('machine', 'work_center')
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$lineId = $get('line_id');
|
||||
@@ -183,17 +186,92 @@ class TestingPanelReadingResource extends Resource
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->rule(function (callable $get) {
|
||||
return function (string $attribute, $value, Closure $fail) use ($get) {
|
||||
|
||||
$plantId = $get('plant_id');
|
||||
$lineId = $get('line_id');
|
||||
$machineId = $get('machine_id');
|
||||
$itemId = $get('motor_testing_master_id');
|
||||
$output = trim($value);
|
||||
// $currentId = $get('id'); // current editing record id
|
||||
|
||||
if (! $plantId || ! $lineId || ! $machineId || ! $itemId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($output == null || $output == '' || ! $output) {
|
||||
$fail("Output can't be empty!"); // Output1 - Output99
|
||||
} elseif (Str::length($output) < 7) {
|
||||
$fail('Output must be at least 7 characters long!');
|
||||
} elseif (Str::length($output) > 8) {
|
||||
$fail('Output must be at most 8 characters long!');
|
||||
} elseif (! ctype_alnum($output)) {
|
||||
$fail('Output should contain only alpha-numeric values!');
|
||||
} elseif (! preg_match('/^Output([1-9]|[1-9][0-9])$/', $output)) {
|
||||
$fail("Output should be between 'Output1' and 'Output99'!");
|
||||
}
|
||||
};
|
||||
}),
|
||||
Forms\Components\TextInput::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->rule(function (callable $get) {
|
||||
return function (string $attribute, $value, Closure $fail) use ($get) {
|
||||
|
||||
$plantId = $get('plant_id');
|
||||
$lineId = $get('line_id');
|
||||
$machineId = $get('machine_id');
|
||||
$itemId = $get('motor_testing_master_id');
|
||||
$serialNumber = trim($value);
|
||||
// $currentId = $get('id'); // current editing record id
|
||||
|
||||
if (! $plantId || ! $lineId || ! $machineId || ! $itemId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($serialNumber == null || $serialNumber == '' || ! $serialNumber) {
|
||||
$fail("Serial number can't be empty!");
|
||||
} elseif (Str::length($serialNumber) < 9) {
|
||||
$fail('Serial number should contain minimum 9 digits!');
|
||||
} elseif (! ctype_alnum($serialNumber)) {
|
||||
$fail('Serial number should contain only alpha-numeric values!');
|
||||
} elseif (! preg_match('/^[1-9][a-zA-Z0-9]{8,}$/', $serialNumber)) {
|
||||
$fail("Serial number should not begin with '0' or letter!");
|
||||
}
|
||||
};
|
||||
}),
|
||||
Forms\Components\TextInput::make('winded_serial_number')
|
||||
->label('Winded Serial Number')
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->rule(function (callable $get) {
|
||||
return function (string $attribute, $value, Closure $fail) use ($get) {
|
||||
|
||||
$plantId = $get('plant_id');
|
||||
$lineId = $get('line_id');
|
||||
$machineId = $get('machine_id');
|
||||
$itemId = $get('motor_testing_master_id');
|
||||
$serialNumber = trim($value);
|
||||
// $currentId = $get('id'); // current editing record id
|
||||
|
||||
if (! $plantId || ! $lineId || ! $machineId || ! $itemId || ! $serialNumber) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Str::length($serialNumber) > 0 && Str::length($serialNumber) < 9) {
|
||||
$fail('Winded serial number should contain minimum 9 digits!');
|
||||
} elseif (! ctype_alnum($serialNumber)) {
|
||||
$fail('Winded serial number should contain only alpha-numeric values!');
|
||||
} elseif (! preg_match('/^[1-9][a-zA-Z0-9]{8,}$/', $serialNumber)) {
|
||||
$fail("Winded serial number should not begin with '0' or letter!");
|
||||
}
|
||||
};
|
||||
}),
|
||||
Forms\Components\TextInput::make('before_fr_volt')
|
||||
->label('Before FR Volt')
|
||||
@@ -350,24 +428,40 @@ class TestingPanelReadingResource extends Resource
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('hv_test')
|
||||
Forms\Components\Select::make('hv_test')
|
||||
->label('High Voltage Test')
|
||||
->options([
|
||||
'With Stood' => 'With Stood',
|
||||
'Not With Stood' => 'Not With Stood',
|
||||
])
|
||||
->selectablePlaceholder(false)
|
||||
->default('Not With Stood')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('batch_number')
|
||||
->label('Batch Number')
|
||||
->readOnly(fn (callable $get) => ! $get('id'))
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('batch_count')
|
||||
->label('Batch Count')
|
||||
->default('0')
|
||||
->readOnly(fn (callable $get) => ! $get('id'))
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('result')
|
||||
Forms\Components\Select::make('result')
|
||||
->label('Result')
|
||||
->options([
|
||||
'PASS' => 'PASS', // Not With Stood
|
||||
'FAIL' => 'FAIL',
|
||||
])
|
||||
->selectablePlaceholder(false)
|
||||
->default('FAIL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
@@ -379,27 +473,28 @@ class TestingPanelReadingResource extends Resource
|
||||
Forms\Components\TextInput::make('rework_count')
|
||||
->label('Rework Count')
|
||||
->default('0')
|
||||
->readOnly(fn (callable $get) => ! $get('id'))
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('update_count')
|
||||
->label('Update Count')
|
||||
->default('0')
|
||||
->readOnly(fn (callable $get) => ! $get('id'))
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('output_flag')
|
||||
->label('Output Flag')
|
||||
->default('0')
|
||||
->readOnly(fn (callable $get) => ! $get('id'))
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('tested_by')
|
||||
->label('Tested By')
|
||||
Forms\Components\Hidden::make('tested_by')
|
||||
->default(fn () => Filament::auth()->user()?->name)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('updated_by')
|
||||
->label('Updated By')
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->default(fn () => Filament::auth()->user()?->name)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('id')
|
||||
@@ -665,6 +760,24 @@ class TestingPanelReadingResource extends Resource
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('item_code', null);
|
||||
}),
|
||||
Select::make('machine_name')
|
||||
->label('Search by Work Center')
|
||||
->searchable()
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
$lineId = $get('Line');
|
||||
|
||||
if (! $plantId || ! $lineId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Machine::where('plant_id', $plantId)
|
||||
->where('line_id', $lineId)
|
||||
->pluck('work_center', 'id')
|
||||
->toArray();
|
||||
})
|
||||
->reactive(),
|
||||
Select::make('item_code')
|
||||
->label('Search by Item Code')
|
||||
->searchable()
|
||||
@@ -687,30 +800,37 @@ class TestingPanelReadingResource extends Resource
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('item_description', null);
|
||||
}),
|
||||
Select::make('machine_name')
|
||||
->label('Search by Work Center')
|
||||
->searchable()
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
$lineId = $get('Line');
|
||||
|
||||
if (! $plantId || ! $lineId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Machine::where('plant_id', $plantId)
|
||||
->where('line_id', $lineId)
|
||||
->pluck('work_center', 'id')
|
||||
->toArray();
|
||||
})
|
||||
->reactive(),
|
||||
TextInput::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->reactive()
|
||||
->placeholder('Enter Serial Number'),
|
||||
Select::make('subassembly_code')
|
||||
->label('Search by Subassembly Code')
|
||||
->searchable()
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if ($plantId) {
|
||||
return MotorTestingMaster::whereHas('testingPanelReadings', function ($query) {
|
||||
$query->whereNotNull('id');
|
||||
})->orderBy('subassembly_code')->pluck('subassembly_code', 'id');
|
||||
} else {
|
||||
return [];
|
||||
// return Item::whereHas('motorTestingMasters')
|
||||
// ->pluck('code', 'id')
|
||||
// ->toArray();
|
||||
}
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('item_description', null);
|
||||
}),
|
||||
TextInput::make('winded_serial_number')
|
||||
->label('Winded Serial Number')
|
||||
->reactive()
|
||||
->placeholder('Enter Winded Serial Number'),
|
||||
Select::make('item_description')
|
||||
->label('Model')
|
||||
->label('Search by Model')
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
@@ -739,13 +859,12 @@ class TestingPanelReadingResource extends Resource
|
||||
$set('item_code', null);
|
||||
}),
|
||||
Select::make('output')
|
||||
->label('Output')
|
||||
->label('Search by Output')
|
||||
->searchable()
|
||||
->options(function () {
|
||||
return TestingPanelReading::query()
|
||||
return TestingPanelReading::whereNotNull('output')
|
||||
->select('output')
|
||||
->distinct()
|
||||
->whereNotNull('output')
|
||||
->orderBy('output')
|
||||
->pluck('output', 'output') // key and label are both the output value
|
||||
->toArray();
|
||||
@@ -781,6 +900,7 @@ class TestingPanelReadingResource extends Resource
|
||||
// })
|
||||
// ->reactive(),
|
||||
// ...
|
||||
|
||||
Select::make('connection')
|
||||
->label('Connection')
|
||||
->required()
|
||||
@@ -805,13 +925,14 @@ class TestingPanelReadingResource extends Resource
|
||||
// ..
|
||||
TextInput::make('remark')
|
||||
->label('Remark')
|
||||
->reactive(),
|
||||
->reactive()
|
||||
->placeholder(placeholder: 'Enter Remark'),
|
||||
TextInput::make('batch_number')
|
||||
->label('Batch Number')
|
||||
->reactive()
|
||||
->placeholder(placeholder: 'Enter Batch Number'),
|
||||
Select::make('result')
|
||||
->label('Result')
|
||||
->label('Search by Result')
|
||||
->searchable()
|
||||
->options(function () {
|
||||
return TestingPanelReading::query()
|
||||
@@ -823,7 +944,19 @@ class TestingPanelReadingResource extends Resource
|
||||
->toArray();
|
||||
})
|
||||
->reactive(),
|
||||
|
||||
Select::make('tested_by')
|
||||
->label('Tested By')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if (! $plantId) {
|
||||
return TestingPanelReading::whereNotNull('tested_by')->select('tested_by')->distinct()->pluck('tested_by', 'tested_by');
|
||||
} else {
|
||||
return TestingPanelReading::where('plant_id', $plantId)->whereNotNull('tested_by')->select('tested_by')->distinct()->pluck('tested_by', 'tested_by');
|
||||
}
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder(placeholder: 'Select From DateTime')
|
||||
@@ -834,12 +967,35 @@ class TestingPanelReadingResource extends Resource
|
||||
->placeholder(placeholder: 'Select To DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
Select::make('updated_by')
|
||||
->label('Updated By')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if (! $plantId) {
|
||||
return TestingPanelReading::whereNotNull('updated_by')->select('updated_by')->distinct()->pluck('updated_by', 'updated_by');
|
||||
} else {
|
||||
return TestingPanelReading::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) {
|
||||
|
||||
// dd($data);
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['Plant']) && empty($data['Line']) && empty($data['item_code']) && empty($data['machine_name']) && empty($data['item_description']) && empty($data['serial_number']) && empty($data['output']) && empty($data['phase']) && empty($data['connection']) && empty($data['remark']) && empty($data['batch_no']) && empty($data['result']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
if (empty($data['Plant']) && empty($data['Line']) && empty($data['item_code']) && empty($data['subassembly_code']) && empty($data['machine_name']) && empty($data['item_description']) && empty($data['serial_number']) && empty($data['winded_serial_number']) && empty($data['output']) && empty($data['phase']) && empty($data['connection']) && empty($data['remark']) && empty($data['batch_no']) && empty($data['result']) && empty($data['tested_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');
|
||||
}
|
||||
|
||||
@@ -868,12 +1024,20 @@ class TestingPanelReadingResource extends Resource
|
||||
});
|
||||
}
|
||||
|
||||
if (! empty($data['subassembly_code'])) {
|
||||
$query->where('motor_testing_master_id', $data['subassembly_code']);
|
||||
}
|
||||
|
||||
if (! empty($data['machine_name'])) {
|
||||
$query->where('machine_id', $data['machine_name']);
|
||||
}
|
||||
|
||||
if (! empty($data['serial_number'])) {
|
||||
$query->where('serial_number', $data['serial_number']);
|
||||
$query->where('serial_number', 'like', '%'.$data['serial_number'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['winded_serial_number'])) {
|
||||
$query->where('winded_serial_number', 'like', '%'.$data['winded_serial_number'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['item_description'])) {
|
||||
@@ -919,11 +1083,11 @@ class TestingPanelReadingResource extends Resource
|
||||
}
|
||||
|
||||
if (! empty($data['remark'])) {
|
||||
$query->where('remark', $data['remark']);
|
||||
$query->where('remark', 'like', '%'.$data['remark'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['batch_number'])) {
|
||||
$query->where('batch_number', $data['batch_number']);
|
||||
$query->where('batch_number', 'like', '%'.$data['batch_number'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['result'])) {
|
||||
@@ -937,6 +1101,22 @@ class TestingPanelReadingResource extends Resource
|
||||
if (! empty($data['created_to'])) {
|
||||
$query->where('created_at', '<=', $data['created_to']);
|
||||
}
|
||||
|
||||
if (! empty($data['tested_by'])) {
|
||||
$query->where('tested_by', $data['tested_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']);
|
||||
}
|
||||
|
||||
if (! empty($data['updated_by'])) {
|
||||
$query->where('updated_by', $data['updated_by']);
|
||||
}
|
||||
})
|
||||
->indicateUsing(function (array $data) {
|
||||
$indicators = [];
|
||||
@@ -953,11 +1133,14 @@ class TestingPanelReadingResource extends Resource
|
||||
if (! empty($data['Line'])) {
|
||||
$indicators[] = 'Line Name: '.Line::where('id', $data['Line'])->value('name');
|
||||
}
|
||||
if (! empty($data['machine_name'])) {
|
||||
$indicators[] = 'Work Center: '.Machine::where('id', $data['machine_name'])->value('work_center');
|
||||
}
|
||||
if (! empty($data['item_code'])) {
|
||||
$indicators[] = 'Item Code: '.Item::where('id', $data['item_code'])->value('code');
|
||||
}
|
||||
if (! empty($data['machine_name'])) {
|
||||
$indicators[] = 'Work Center: '.Machine::where('id', $data['machine_name'])->value('work_center');
|
||||
if (! empty($data['subassembly_code'])) {
|
||||
$indicators[] = 'Subassembly Code: '.MotorTestingMaster::where('id', $data['subassembly_code'])->value('subassembly_code');
|
||||
}
|
||||
if (! empty($data['output'])) {
|
||||
$indicators[] = 'Output: '.$data['output'];
|
||||
@@ -986,6 +1169,10 @@ class TestingPanelReadingResource extends Resource
|
||||
$indicators[] = 'Serial Number: '.$data['serial_number'];
|
||||
}
|
||||
|
||||
if (! empty($data['tested_by'])) {
|
||||
$indicators[] = 'Tested By: '.$data['tested_by'];
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$indicators[] = 'From: '.$data['created_from'];
|
||||
}
|
||||
@@ -994,6 +1181,18 @@ class TestingPanelReadingResource extends Resource
|
||||
$indicators[] = '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;
|
||||
}),
|
||||
])
|
||||
|
||||
@@ -118,8 +118,10 @@ class VisitorEntryResource extends Resource
|
||||
->label('Employee Department')
|
||||
->options(
|
||||
EmployeeMaster::distinct()
|
||||
->orderBy('department')
|
||||
->pluck('department', 'department')
|
||||
)
|
||||
->searchable()
|
||||
->required()
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
@@ -156,6 +158,11 @@ class VisitorEntryResource extends Resource
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$department = $get('department');
|
||||
|
||||
if (!$department) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Always load ALL employees, filter by department if set
|
||||
if ($department) {
|
||||
return EmployeeMaster::where('department', $department)
|
||||
@@ -319,7 +326,7 @@ class VisitorEntryResource extends Resource
|
||||
->reactive()
|
||||
->placeholder('Enter Register ID')
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('Rework', null);
|
||||
$set('type', null);
|
||||
}),
|
||||
Select::make('type')
|
||||
->label('Type')
|
||||
@@ -356,7 +363,24 @@ class VisitorEntryResource extends Resource
|
||||
->reactive()
|
||||
->placeholder('Enter Visitor Company')
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('Rework', null);
|
||||
$set('employee_master_id', null);
|
||||
}),
|
||||
Select::make('employee_department')
|
||||
->label('Employee Department')
|
||||
->options(function () {
|
||||
return EmployeeMaster::query()
|
||||
->whereNotNull('department')
|
||||
->distinct()
|
||||
->orderBy('department')
|
||||
->pluck('department', 'department')
|
||||
->toArray();
|
||||
})
|
||||
->searchable()
|
||||
->preload()
|
||||
->reactive()
|
||||
->placeholder('Select Department')
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('employee_master_id', null);
|
||||
}),
|
||||
Select::make('employee_master_id')
|
||||
->label('Employee Name')
|
||||
@@ -407,6 +431,10 @@ class VisitorEntryResource extends Resource
|
||||
$query->where('company', 'like', '%'.$data['company'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['employee_department'])) {
|
||||
$query->where('department', $data['employee_department']);
|
||||
}
|
||||
|
||||
if (! empty($data['employee_master_id'])) {
|
||||
$query->where('employee_master_id', $data['employee_master_id']);
|
||||
}
|
||||
@@ -443,6 +471,10 @@ class VisitorEntryResource extends Resource
|
||||
$indicators[] = 'Company: '.$data['company'];
|
||||
}
|
||||
|
||||
if (! empty($data['employee_department'])) {
|
||||
$indicators[] = 'Employee Department: '.$data['employee_department'];
|
||||
}
|
||||
|
||||
if (! empty($data['employee_master_id'])) {
|
||||
$indicators[] = 'Employee Name: '.EmployeeMaster::where('id', $data['employee_master_id'])->value('name');
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
"smalot/pdfparser": "^2.12",
|
||||
"tecnickcom/tcpdf": "^6.10",
|
||||
"thiagoalessio/tesseract_ocr": "^2.13",
|
||||
"tpetry/laravel-postgresql-enhanced": "^2.3"
|
||||
"tpetry/laravel-postgresql-enhanced": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.15",
|
||||
|
||||
@@ -64,30 +64,17 @@
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>CRI RFQ Number</th>
|
||||
<th>Mail Received Date</th>
|
||||
<th>Pricol Ref Number</th>
|
||||
<th>Ref Number</th>
|
||||
<th>Requestor</th>
|
||||
<th>Shipper</th>
|
||||
<th>Shipper Location</th>
|
||||
<th>Shipper Invoice</th>
|
||||
<th>Shipper Invoice Date</th>
|
||||
<th>Custom Agent Name</th>
|
||||
<th>ETA Date</th>
|
||||
<th>ETA</th>
|
||||
<th>Status</th>
|
||||
<th>Delivery Location</th>
|
||||
<th>ETD Date</th>
|
||||
<th>Mode</th>
|
||||
<th>Inco Terms</th>
|
||||
<th>Port Of Loading</th>
|
||||
<th>Port Of Discharge</th>
|
||||
<th>Delivery City</th>
|
||||
<th>Packages</th>
|
||||
<th>Type of package</th>
|
||||
<th>Gross Weight</th>
|
||||
<th>Volume</th>
|
||||
<th>Bill Number</th>
|
||||
<th>Bill Received Date</th>
|
||||
<th>Vessel Number</th>
|
||||
<th>Remark</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -97,7 +84,7 @@
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td>{{ $row['cri_rfq_number'] }}</td>
|
||||
{{-- <td>{{ $row['mail_received_date'] }}</td> --}}
|
||||
<td>{{ \Carbon\Carbon::parse($row['mail_received_date'])->format('Y-m-d') }}</td>
|
||||
{{-- <td>{{ \Carbon\Carbon::parse($row['mail_received_date'])->format('Y-m-d') }}</td> --}}
|
||||
<td>{{ $row['pricol_ref_number'] }}</td>
|
||||
<td>{{ $row['requester'] }}</td>
|
||||
<td>{{ $row['shipper'] }}</td>
|
||||
@@ -106,12 +93,13 @@
|
||||
{{-- <td>{{ $row['shipper_invoice_date'] }}</td> --}}
|
||||
<td>{{ \Carbon\Carbon::parse($row['shipper_invoice_date'])->format('Y-m-d') }}</td>
|
||||
<td>{{ $row['customs_agent_name'] }}</td>
|
||||
<td>{{ $row['eta_date'] }}</td>
|
||||
{{-- <td>{{ $row['eta_date'] }}</td> --}}
|
||||
<td>{{ \Carbon\Carbon::parse($row['eta_date'])->format('Y-m-d') }}</td>
|
||||
<td>{{ $row['status'] }}</td>
|
||||
<td>{{ $row['delivery_location'] }}</td>
|
||||
{{-- <td>{{ $row['etd_date'] }}</td> --}}
|
||||
<td>{{ \Carbon\Carbon::parse($row['etd_date'])->format('Y-m-d') }}</td>
|
||||
<td>{{ $row['mode'] }}</td>
|
||||
{{-- <td>{{ $row['mode'] }}</td>
|
||||
<td>{{ $row['inco_terms'] }}</td>
|
||||
<td>{{ $row['port_of_loading'] }}</td>
|
||||
<td>{{ $row['port_of_discharge'] }}</td>
|
||||
@@ -120,10 +108,10 @@
|
||||
<td>{{ $row['type_of_package'] }}</td>
|
||||
<td>{{ $row['gross_weight'] }}</td>
|
||||
<td>{{ $row['volume'] }}</td>
|
||||
<td>{{ $row['bill_number'] }}</td>
|
||||
<td>{{ $row['bill_number'] }}</td> --}}
|
||||
{{-- <td>{{ $row['bill_received_date'] }}</td> --}}
|
||||
<td>{{ \Carbon\Carbon::parse($row['bill_received_date'])->format('Y-m-d') }}</td>
|
||||
<td>{{ $row['vessel_number'] }}</td>
|
||||
{{-- <td>{{ \Carbon\Carbon::parse($row['bill_received_date'])->format('Y-m-d') }}</td>
|
||||
<td>{{ $row['vessel_number'] }}</td> --}}
|
||||
<td>{{ $row['remark'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
Reference in New Issue
Block a user