diff --git a/app/Filament/Resources/ProductionLineStopResource.php b/app/Filament/Resources/ProductionLineStopResource.php index 129fbb3..a868abe 100644 --- a/app/Filament/Resources/ProductionLineStopResource.php +++ b/app/Filament/Resources/ProductionLineStopResource.php @@ -236,7 +236,7 @@ class ProductionLineStopResource extends Resource // ) ->placeholder('Scan the valid code') ->autofocus(true) - ->options(fn () => \App\Models\LineStop::pluck('code', 'id')) + ->options(fn () => LineStop::pluck('code', 'id')) ->required() // ->nullable() // ->reactive() @@ -254,7 +254,7 @@ class ProductionLineStopResource extends Resource } // Check if item exists for the selected plant - $lineStop = \App\Models\LineStop::where('id', $lineStopId) + $lineStop = LineStop::where('id', $lineStopId) ->where('id', $lineStopId) ->first(); @@ -349,61 +349,75 @@ class ProductionLineStopResource extends Resource return $table ->query(ProductionLineStop::query()) ->columns([ - Tables\Columns\TextColumn::make('id') - ->label('ID') - ->numeric() - ->sortable(), + // 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('linestop.code') - ->label('Code') + ->label('Line Stop Code') + ->alignCenter() ->sortable(), Tables\Columns\TextColumn::make('linestop.reason') - ->label('Reason') + ->label('Line Stop Reason') + ->alignCenter() ->sortable(), Tables\Columns\TextColumn::make('from_datetime') ->label('From DateTime') ->dateTime() - ->sortable(), + ->alignCenter(), Tables\Columns\TextColumn::make('to_datetime') ->label('To DateTime') ->dateTime() - ->sortable(), + ->alignCenter(), Tables\Columns\TextColumn::make('stop_hour') ->label('Stop Hour') ->alignCenter() - ->numeric() - ->sortable(), + ->numeric(), Tables\Columns\TextColumn::make('stop_min') ->label('Stop Minute') ->alignCenter() - ->numeric() - ->sortable(), + ->numeric(), Tables\Columns\TextColumn::make('line.name') ->label('Line') + ->alignCenter() ->sortable(), Tables\Columns\TextColumn::make('shift.name') ->label('Shift') + ->alignCenter() ->sortable(), Tables\Columns\TextColumn::make('plant.name') ->label('Plant') - ->sortable(), - Tables\Columns\TextColumn::make('operator_id') - ->label('Operator ID') + ->alignCenter() ->sortable(), Tables\Columns\TextColumn::make('created_at') ->label('Created At') ->dateTime() - ->sortable() - ->toggleable(isToggledHiddenByDefault: true), + ->alignCenter() + ->sortable(), Tables\Columns\TextColumn::make('updated_at') ->label('Updated At') ->dateTime() + ->alignCenter() ->sortable() ->toggleable(isToggledHiddenByDefault: true), Tables\Columns\TextColumn::make('deleted_at') ->label('Deleted At') ->dateTime() + ->alignCenter() ->sortable() ->toggleable(isToggledHiddenByDefault: true), + Tables\Columns\TextColumn::make('operator_id') + ->label('Operator ID') + ->alignCenter() + ->sortable(), ]) ->filters([