schema([ Forms\Components\TextInput::make('machine_id') ->label('Machine ID'), Forms\Components\DateTimePicker::make('ts') ->label('TS'), Forms\Components\TextInput::make('state') ->label('State'), Forms\Components\TextInput::make('mode') ->label('Mode'), Forms\Components\TextInput::make('run_status') ->label('Run Status'), Forms\Components\TextInput::make('state_duration_s') ->label('Status Duration S'), Forms\Components\TextInput::make('program') ->label('Program'), Forms\Components\TextInput::make('feed_rate') ->label('Feed Rate'), Forms\Components\TextInput::make('feed_override') ->label('Feed OverRide'), Forms\Components\TextInput::make('spindle_speed') ->label('Spindle Speed'), Forms\Components\TextInput::make('spindle_override') ->label('Spindle OverRide'), Forms\Components\TextInput::make('spindle_load') ->label('Spindle Load'), Forms\Components\TextInput::make('axis_load_x') ->label('Axis Load X'), Forms\Components\TextInput::make('axis_load_z') ->label('Axis Load Z'), Forms\Components\TextInput::make('tool_no') ->label('Tool No'), Forms\Components\TextInput::make('tool_offset_no') ->label('Tool Offset No'), Forms\Components\TextInput::make('wear_x') ->label('Wear X') ->default(null), Forms\Components\TextInput::make('wear_z') ->label('Wear Z') ->default(null), Forms\Components\TextInput::make('geom_x') ->label('Geom X') ->default(null), Forms\Components\TextInput::make('geom_z') ->label('Geom Z') ->default(null), Forms\Components\TextInput::make('cycle_time_s') ->label('Cycle Time S'), Forms\Components\TextInput::make('last_cycle_time_s') ->label('Last Cycle Time S'), Forms\Components\TextInput::make('part_count') ->label('Part Count'), Forms\Components\TextInput::make('alarm_no') ->label('Alaram No'), Forms\Components\TextInput::make('alarm_msg') ->label('Alaram Msg'), Forms\Components\TextInput::make('total_run_s') ->label('Total Run S'), Forms\Components\TextInput::make('total_idle_s') ->label('Total Idle S'), Forms\Components\TextInput::make('total_alarm_s') ->label('Total Alaram S'), Forms\Components\Hidden::make('created_by') ->label('Created By') ->default(Filament::auth()->user()->name), Forms\Components\Hidden::make('updated_by') ->label('Updated By') ->default(Filament::auth()->user()->name), ]); } public static function table(Table $table): Table { return $table ->columns([ Tables\Columns\TextColumn::make('No.') ->label('No.') ->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('ts') ->label('TS') ->dateTime() ->sortable(), Tables\Columns\TextColumn::make('state') ->label('State') ->alignCenter() ->sortable(), Tables\Columns\TextColumn::make('mode') ->label('Mode') ->alignCenter() ->sortable(), Tables\Columns\TextColumn::make('run_status') ->label('Run Status') ->alignCenter() ->sortable(), Tables\Columns\TextColumn::make('state_duration_s') ->label('State Duration S') ->alignCenter() ->sortable(), Tables\Columns\TextColumn::make('program') ->label('Program') ->alignCenter() ->sortable(), Tables\Columns\TextColumn::make('feed_rate') ->label('Feed Rate') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('feed_override') ->label('Feed OverRide') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('spindle_speed') ->label('Spindle Speed') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('spindle_override') ->label('Spindle OverRide') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('spindle_load') ->label('Spindle Load') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('axis_load_x') ->label('Axis Load X') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('axis_load_z') ->label('Axis Load Z') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('tool_no') ->label('Tool No') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('tool_offset_no') ->label('Tool OffSet No') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('wear_x') ->label('Wear X') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('wear_z') ->label('Wear Z') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('geom_x') ->label('Geom X') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('geom_z') ->label('Geom Z') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('cycle_time_s') ->label('Cycle Time S') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('last_cycle_time_s') ->label('Last Cycle Time S') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('part_count') ->label('Part Count') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('total_run_s') ->label('Total Run S') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('total_idle_s') ->label('Total Idle S') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('total_alarm_s') ->label('Total Alaram S') ->alignCenter() ->numeric() ->sortable(), Tables\Columns\TextColumn::make('created_at') ->label('Created At') ->alignCenter() ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), Tables\Columns\TextColumn::make('created_by') ->label('Created By') ->alignCenter() ->sortable() ->toggleable(isToggledHiddenByDefault: true), Tables\Columns\TextColumn::make('updated_at') ->label('Updated At') ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), Tables\Columns\TextColumn::make('updated_by') ->label('Updated By') ->alignCenter() ->sortable() ->toggleable(isToggledHiddenByDefault: true), Tables\Columns\TextColumn::make('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(), ]), ]); } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => Pages\ListCncMonitorData::route('/'), 'create' => Pages\CreateCncMonitorData::route('/create'), 'view' => Pages\ViewCncMonitorData::route('/{record}'), 'edit' => Pages\EditCncMonitorData::route('/{record}/edit'), ]; } public static function getEloquentQuery(): Builder { return parent::getEloquentQuery() ->withoutGlobalScopes([ SoftDeletingScope::class, ]); } }