diff --git a/app/Filament/Exports/ClassCharacteristicExporter.php b/app/Filament/Exports/ClassCharacteristicExporter.php index 77645be..e45105e 100644 --- a/app/Filament/Exports/ClassCharacteristicExporter.php +++ b/app/Filament/Exports/ClassCharacteristicExporter.php @@ -311,13 +311,13 @@ class ClassCharacteristicExporter extends Exporter ->label('ZMM OPERATING TEMPERATURE'), ExportColumn::make('zmm_axial_force') ->label('ZMM AXIAL FORCE'), - ExportColumn::make('is_stopped') - ->label('IS STOPPED') - ->formatStateUsing(fn ($state) => ($state == '0') ? 'No' : ($state == '1' ? 'Yes' : 'Yes (Alert Pending)')), - ExportColumn::make('stopped_datetime') - ->label('STOPPED DATETIME'), - ExportColumn::make('stopped_by') - ->label('STOPPED BY'), + // ExportColumn::make('is_stopped') + // ->label('IS STOPPED') + // ->formatStateUsing(fn ($state) => ($state == '0') ? 'No' : ($state == '1' ? 'Yes' : 'Yes (Alert Pending)')), + // ExportColumn::make('stopped_datetime') + // ->label('STOPPED DATETIME'), + // ExportColumn::make('stopped_by') + // ->label('STOPPED BY'), ExportColumn::make('mark_status') ->label('MARKED STATUS'), ExportColumn::make('marked_physical_count') @@ -363,7 +363,14 @@ class ClassCharacteristicExporter extends Exporter ExportColumn::make('name_plate_marked_by') ->label('NAME PLATE MARKED BY'), ExportColumn::make('motor_pump_pumpset_status') - ->label('MOTOR PUMP PUMPSET STATUS'), + ->label('MOTOR PUMP PUMPSET STATUS') + ->formatStateUsing(fn ($state): string => match ((string) $state) { + '1' => 'Motor', + '2' => 'Pump', + '3' => 'PumpSet', + '4' => 'Name Plate', + default => 'NIL', + }), ExportColumn::make('winded_serial_number') ->label('WINDED SERIAL NUMBER'), ExportColumn::make('winded_rework_status') @@ -386,6 +393,36 @@ class ClassCharacteristicExporter extends Exporter ->label('PENDING RELEASED STATUS'), ExportColumn::make('has_work_flow_id') ->label('HAS WORK FLOW ID'), + ExportColumn::make('motor_stop_flow_id') + ->label('MOTOR STOP FLOW ID') + ->formatStateUsing(fn ($state): string => match ((string) $state) { + '5' => 'NIL', + '4' => 'Has Master', + '3' => 'Make Alert', + '2' => 'Alert Pending', + '1' => 'Alert Approved', + default => '-', + }), + ExportColumn::make('pump_stop_flow_id') + ->label('PUMP STOP FLOW ID') + ->formatStateUsing(fn ($state): string => match ((string) $state) { + '5' => 'NIL', + '4' => 'Has Master', + '3' => 'Make Alert', + '2' => 'Alert Pending', + '1' => 'Alert Approved', + default => '-', + }), + ExportColumn::make('name_plate_stop_flow_id') + ->label('NAME PLATE STOP FLOW ID') + ->formatStateUsing(fn ($state): string => match ((string) $state) { + '5' => 'NIL', + '4' => 'Has Master', + '3' => 'Make Alert', + '2' => 'Alert Pending', + '1' => 'Alert Approved', + default => '-', + }), ExportColumn::make('created_at') ->label('CREATED AT'), ExportColumn::make('created_by') diff --git a/app/Filament/Imports/ClassCharacteristicImporter.php b/app/Filament/Imports/ClassCharacteristicImporter.php index d42b1fd..e62289c 100644 --- a/app/Filament/Imports/ClassCharacteristicImporter.php +++ b/app/Filament/Imports/ClassCharacteristicImporter.php @@ -583,18 +583,6 @@ class ClassCharacteristicImporter extends Importer ->label('ZMM AXIAL FORCE') ->exampleHeader('ZMM AXIAL FORCE') ->example(''), - ImportColumn::make('is_stopped') - ->label('IS STOPPED') - ->exampleHeader('IS STOPPED') - ->example('0'), - ImportColumn::make('stopped_datetime') - ->label('STOPPED DATETIME') - ->exampleHeader('STOPPED DATETIME') - ->example('01-01-2026 00:08:00'), - ImportColumn::make('stopped_by') - ->label('STOPPED BY') - ->exampleHeader('STOPPED BY') - ->example(''), ImportColumn::make('mark_status') ->label('MARKED STATUS') ->exampleHeader('MARKED STATUS') @@ -731,6 +719,18 @@ class ClassCharacteristicImporter extends Importer ->label('HAS WORK FLOW ID') ->exampleHeader('HAS WORK FLOW ID') ->example('0'), + ImportColumn::make('motor_stop_flow_id') + ->label('MOTOR STOP FLOW ID') + ->exampleHeader('MOTOR STOP FLOW ID') + ->example('5'), + ImportColumn::make('pump_stop_flow_id') + ->label('PUMP STOP FLOW ID') + ->exampleHeader('PUMP STOP FLOW ID') + ->example('5'), + ImportColumn::make('name_plate_stop_flow_id') + ->label('NAME PLATE STOP FLOW ID') + ->exampleHeader('NAME PLATE STOP FLOW ID') + ->example('5'), ImportColumn::make('created_at') ->label('CREATED AT') ->exampleHeader('CREATED AT') diff --git a/app/Filament/Resources/ClassCharacteristicResource.php b/app/Filament/Resources/ClassCharacteristicResource.php index c8ebbc2..16ed4e4 100644 --- a/app/Filament/Resources/ClassCharacteristicResource.php +++ b/app/Filament/Resources/ClassCharacteristicResource.php @@ -875,7 +875,7 @@ class ClassCharacteristicResource extends Resource $set('updated_by', Filament::auth()->user()?->name); }), Forms\Components\TextInput::make('zmm_performance_factor') - ->label('ZMM PERFORMANCE_FACTOR') + ->label('ZMM PERFORMANCE FACTOR') ->reactive() ->afterStateUpdated(function (callable $set) { $set('updated_by', Filament::auth()->user()?->name); @@ -982,45 +982,37 @@ class ClassCharacteristicResource extends Resource ->afterStateUpdated(function (callable $set) { $set('updated_by', Filament::auth()->user()?->name); }), - Forms\Components\Select::make('is_stopped') - ->label('IS STOPPED') - // ->nullable() - ->selectablePlaceholder(false) - ->options(function () { - return [ - '0' => 'No', - '1' => 'Yes', - '2' => 'Yes (Alert Pending)', - ]; - }) - ->default('0') - ->reactive() - ->afterStateUpdated(function (callable $set) { - $set('updated_by', Filament::auth()->user()?->name); - }) - ->required(), - Forms\Components\DateTimePicker::make('stopped_datetime') - ->label('STOPPED DATETIME') - ->reactive() - ->placeholder('Select Stopped DateTime') - ->afterStateUpdated(function (callable $set) { - $set('updated_by', Filament::auth()->user()?->name); - }), - Forms\Components\TextInput::make('stopped_by') - ->label('STOPPED BY') - ->reactive() - ->readOnly(fn (callable $get) => ! $get('id')) - ->afterStateUpdated(function (callable $set) { - $set('updated_by', Filament::auth()->user()?->name); - }), - // Forms\Components\TextInput::make('is_stopped') + // Forms\Components\Select::make('is_stopped') // ->label('IS STOPPED') + // // ->nullable() + // ->selectablePlaceholder(false) + // ->options(function () { + // return [ + // '0' => 'No', + // '1' => 'Yes', + // '2' => 'Yes (Alert Pending)', + // ]; + // }) + // ->default('0') // ->reactive() // ->afterStateUpdated(function (callable $set) { // $set('updated_by', Filament::auth()->user()?->name); // }) - // ->default(0) // ->required(), + // Forms\Components\DateTimePicker::make('stopped_datetime') + // ->label('STOPPED DATETIME') + // ->reactive() + // ->placeholder('Select Stopped DateTime') + // ->afterStateUpdated(function (callable $set) { + // $set('updated_by', Filament::auth()->user()?->name); + // }), + // Forms\Components\TextInput::make('stopped_by') + // ->label('STOPPED BY') + // ->reactive() + // ->readOnly(fn (callable $get) => ! $get('id')) + // ->afterStateUpdated(function (callable $set) { + // $set('updated_by', Filament::auth()->user()?->name); + // }), Forms\Components\TextInput::make('mark_status') ->label('MARKED STATUS') ->reactive() @@ -1318,6 +1310,74 @@ class ClassCharacteristicResource extends Resource }) ->default(0) ->required(), + Forms\Components\Select::make('motor_stop_flow_id') + ->label('MOTOR STOP FLOW ID') + // ->nullable() + ->selectablePlaceholder(false) + ->options(function () { + return [ + '5' => 'NIL', + '4' => 'Has Master', + '3' => 'Make Alert', + '2' => 'Alert Pending', + '1' => 'Alert Approved', + ]; + }) + ->default('5') + ->reactive() + ->afterStateUpdated(function (callable $set) { + $set('updated_by', Filament::auth()->user()?->name); + }) + ->required(), + // Forms\Components\TextInput::make('motor_stop_flow_id') + // ->label('MOTOR STOP FLOW ID') + // ->reactive() + // ->minValue(1) + // ->integer() + // ->maxValue(5) + // ->afterStateUpdated(function (callable $set) { + // $set('updated_by', Filament::auth()->user()?->name); + // }) + // ->default(5) + // ->required(), + Forms\Components\Select::make('pump_stop_flow_id') + ->label('PUMP STOP FLOW ID') + // ->nullable() + ->selectablePlaceholder(false) + ->options(function () { + return [ + '5' => 'NIL', + '4' => 'Has Master', + '3' => 'Make Alert', + '2' => 'Alert Pending', + '1' => 'Alert Approved', + ]; + }) + ->default('5') + ->reactive() + ->afterStateUpdated(function (callable $set) { + $set('updated_by', Filament::auth()->user()?->name); + }) + ->required(), + Forms\Components\Select::make('name_plate_stop_flow_id') + ->label('NAME PLATE STOP FLOW ID') + // ->nullable() + ->selectablePlaceholder(false) + ->options(function () { + return [ + '5' => 'NIL', + '4' => 'Has Master', + '3' => 'Make Alert', + '2' => 'Alert Pending', + '1' => 'Alert Approved', + ]; + }) + ->default('5') + ->reactive() + ->afterStateUpdated(function (callable $set) { + $set('updated_by', Filament::auth()->user()?->name); + }) + ->required(), Forms\Components\Hidden::make('created_by') ->label('Created By') ->default(Filament::auth()->user()?->name), @@ -1931,19 +1991,19 @@ class ClassCharacteristicResource extends Resource ->label('ZMM AXIAL FORCE') ->alignCenter() ->sortable(), - Tables\Columns\TextColumn::make('is_stopped') - ->label('IS STOPPED') - ->alignCenter() - ->formatStateUsing(fn ($state) => ($state == '0') ? 'No' : ($state == '1' ? 'Yes' : 'Yes (Alert Pending)')) - ->sortable(), - Tables\Columns\TextColumn::make('stopped_datetime') - ->label('STOPPED DATETIME') - ->alignCenter() - ->sortable(), - Tables\Columns\TextColumn::make('stopped_by') - ->label('STOPPED BY') - ->alignCenter() - ->sortable(), + // Tables\Columns\TextColumn::make('is_stopped') + // ->label('IS STOPPED') + // ->alignCenter() + // ->formatStateUsing(fn ($state) => ($state == '0') ? 'No' : ($state == '1' ? 'Yes' : 'Yes (Alert Pending)')) + // ->sortable(), + // Tables\Columns\TextColumn::make('stopped_datetime') + // ->label('STOPPED DATETIME') + // ->alignCenter() + // ->sortable(), + // Tables\Columns\TextColumn::make('stopped_by') + // ->label('STOPPED BY') + // ->alignCenter() + // ->sortable(), Tables\Columns\TextColumn::make('mark_status') ->label('MARKED STATUS') ->alignCenter() @@ -2035,6 +2095,13 @@ class ClassCharacteristicResource extends Resource Tables\Columns\TextColumn::make('motor_pump_pumpset_status') ->label('MOTOR PUMP PUMPSET STATUS') ->alignCenter() + ->formatStateUsing(fn ($state): string => match ((string) $state) { + '1' => 'Motor', + '2' => 'Pump', + '3' => 'PumpSet', + '4' => 'Name Plate', + default => 'NIL', + }) ->sortable(), Tables\Columns\TextColumn::make('winded_serial_number') ->label('WINDED SERIAL NUMBER') @@ -2080,6 +2147,46 @@ class ClassCharacteristicResource extends Resource ->label('HAS WORK FLOW ID') ->alignCenter() ->sortable(), + Tables\Columns\TextColumn::make('motor_stop_flow_id') + ->label('MOTOR STOP FLOW ID') + ->alignCenter() + // ->formatStateUsing(fn ($state) => ($state == '5') ? 'NIL' : ($state == '4' ? 'Has Master' : ($state == '3' ? 'Make Alert' : ($state == '2' ? 'Alert Pending' : ($state == '1' ? 'Alert Approved' : '-'))))) + ->formatStateUsing(fn ($state): string => match ((string) $state) { + '5' => 'NIL', + '4' => 'Has Master', + '3' => 'Make Alert', + '2' => 'Alert Pending', + '1' => 'Alert Approved', + default => '-', + }) + ->badge() + ->sortable(), + Tables\Columns\TextColumn::make('pump_stop_flow_id') + ->label('PUMP STOP FLOW ID') + ->alignCenter() + ->formatStateUsing(fn ($state): string => match ((string) $state) { + '5' => 'NIL', + '4' => 'Has Master', + '3' => 'Make Alert', + '2' => 'Alert Pending', + '1' => 'Alert Approved', + default => '-', + }) + ->badge() + ->sortable(), + Tables\Columns\TextColumn::make('name_plate_stop_flow_id') + ->label('NAME PLATE STOP FLOW ID') + ->alignCenter() + ->formatStateUsing(fn ($state): string => match ((string) $state) { + '5' => 'NIL', + '4' => 'Has Master', + '3' => 'Make Alert', + '2' => 'Alert Pending', + '1' => 'Alert Approved', + default => '-', + }) + ->badge() + ->sortable(), Tables\Columns\TextColumn::make('created_at') ->label('CREATED AT') ->alignCenter() diff --git a/app/Models/ClassCharacteristic.php b/app/Models/ClassCharacteristic.php index 2dd2ebb..00f9ea4 100644 --- a/app/Models/ClassCharacteristic.php +++ b/app/Models/ClassCharacteristic.php @@ -154,9 +154,6 @@ class ClassCharacteristic extends Model 'zqmm_qty', 'zmm_operating_temperature', 'zmm_axial_force', - 'is_stopped', - 'stopped_datetime', - 'stopped_by', 'mark_status', 'marked_physical_count', 'marked_expected_time', @@ -181,6 +178,7 @@ class ClassCharacteristic extends Model 'name_plate_marked_by', 'motor_pump_pumpset_status', 'winded_serial_number', + 'winded_rework_status', 'motor_machine_name', 'pump_machine_name', 'name_plate_machine_name', @@ -189,7 +187,9 @@ class ClassCharacteristic extends Model 'samlight_logged_name', 'pending_released_status', 'has_work_flow_id', - 'winded_rework_status', + 'motor_stop_flow_id', + 'pump_stop_flow_id', + 'name_plate_stop_flow_id', 'created_at', 'updated_at', 'created_by', diff --git a/database/migrations/2026_09_09_180717_add_stop_flow_id_columns_and_remove_stopped_columns_from_class_characteristics_table.php b/database/migrations/2026_09_09_180717_add_stop_flow_id_columns_and_remove_stopped_columns_from_class_characteristics_table.php new file mode 100644 index 0000000..7fc11e7 --- /dev/null +++ b/database/migrations/2026_09_09_180717_add_stop_flow_id_columns_and_remove_stopped_columns_from_class_characteristics_table.php @@ -0,0 +1,67 @@ +