diff --git a/app/Filament/Resources/WeightValidationResource.php b/app/Filament/Resources/WeightValidationResource.php new file mode 100644 index 000000000..efcf10b40 --- /dev/null +++ b/app/Filament/Resources/WeightValidationResource.php @@ -0,0 +1,129 @@ +schema([ + Forms\Components\Select::make('plant_id') + ->relationship('plant', 'name') + ->required(), + Forms\Components\Select::make('item_id') + ->relationship('item', 'code') + ->label('Item Code') + ->searchable() + ->required(), + Forms\Components\TextInput::make('obd_number') + ->label('OBD Number') + ->required(), + Forms\Components\TextInput::make('line_number') + ->label('Line Number') + ->required(), + Forms\Components\TextInput::make('batch_number') + ->label('Batch Number') + ->required(), + Forms\Components\TextInput::make('heat_number') + ->label('Heat Number') + ->required(), + Forms\Components\TextInput::make('obd_weight') + ->label('OBD Weight') + ->required(), + Forms\Components\TextInput::make('vehicle_number') + ->label('Vehicle Number'), + Forms\Components\TextInput::make('bundle_number') + ->label('Bundle Number'), + Forms\Components\TextInput::make('picked_weight') + ->label('Picked Weight'), + Forms\Components\TextInput::make('scanned_by') + ->label('Scanned By') + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + Tables\Columns\TextColumn::make('id') + ->label('ID') + ->numeric() + ->sortable(), + Tables\Columns\TextColumn::make('item.id') + ->numeric() + ->sortable(), + Tables\Columns\TextColumn::make('plant.name') + ->numeric() + ->sortable(), + Tables\Columns\TextColumn::make('created_at') + ->dateTime() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + Tables\Columns\TextColumn::make('updated_at') + ->dateTime() + ->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\ListWeightValidations::route('/'), + 'create' => Pages\CreateWeightValidation::route('/create'), + 'view' => Pages\ViewWeightValidation::route('/{record}'), + 'edit' => Pages\EditWeightValidation::route('/{record}/edit'), + ]; + } + + public static function getEloquentQuery(): Builder + { + return parent::getEloquentQuery() + ->withoutGlobalScopes([ + SoftDeletingScope::class, + ]); + } +} diff --git a/app/Models/WeightValidation.php b/app/Models/WeightValidation.php new file mode 100644 index 000000000..3ae09e01c --- /dev/null +++ b/app/Models/WeightValidation.php @@ -0,0 +1,36 @@ +belongsTo(Plant::class); + } + + public function item(): BelongsTo + { + return $this->belongsTo(Item::class); + } +}