value; protected static ?string $navigationGroup = 'Production'; protected static ?int $navigationSort = 1; public static function form(Form $form): Form { return $form ->schema([ Grid::make(3) ->schema([ Section::make([ Select::make('customer_id') ->required() ->label('Customer') ->options(Customer::all()->pluck('company_name', 'id')) ->reactive() ->searchable() ->columnSpan(1), DatePicker::make('date') ->default(today()) ->required(), TextArea::make('notes') ->rows(3) ->columnSpan(2), ]) ->columns(2) ->columnSpan(fn (?Quote $record) => $record === null ? 3 : 2) ->extraAttributes(['class' => 'h-full']), Section::make() ->schema([ Placeholder::make('Id') ->label('ID') ->content(fn (Quote $record): ?string => $record->id), Placeholder::make('created_at') ->content(fn (Quote $record): ?string => $record->created_at?->diffForHumans().' at '.$record->created_at->format('Y-m-d')), Placeholder::make('updated_at') ->content(fn (Quote $record): ?string => $record->updated_at?->diffForHumans().' at '.$record->updated_at->format('Y-m-d')), ]) ->columnSpan(1) ->hidden(fn (?Quote $record) => $record === null) ->extraAttributes(['class' => 'h-full']), ]), TableRepeater::make('embroideryEntries') ->relationship('embroideryEntries') ->schema([ TextInput::make('logo') ->label('Logo name'), TextInput::make('placement'), TextInput::make('quantity') ->prefix('#') ->rules('numeric'), TextInput::make('width') ->suffix('inch') ->rules('numeric'), TextInput::make('height') ->suffix('inch') ->rules('numeric'), TextInput::make('stitch_count'), TextInput::make('digitizing_cost') ->prefix('$') ->rules('numeric'), TextInput::make('run_charge') ->prefix('$') ->rules('numeric'), ]) ->addActionLabel('Add Embroidery Entry') ->reorderable() ->defaultItems(0) ->colStyles([ 'logo' => 'width: 15%', 'placement' => 'width: 15%', 'quantity' => 'width: 10%', 'width' => 'width: 11%', 'height' => 'width: 11%', 'stitch_count' => 'width: 16%', 'digitizing_cost' => 'width: 11%', 'run_charge' => 'width: 11%', ]), TableRepeater::make('screenPrintEntries') ->relationship('screenPrintEntries') ->schema([ TextInput::make('logo') ->label('Logo name') ->columnSpan(2), TextInput::make('placement'), TextInput::make('quantity') ->rules(['numeric']) ->label('Qty'), TextInput::make('width') ->rules('numeric'), TextInput::make('height') ->rules('numeric'), TextInput::make('setup_amount') ->label('Setup qty') ->rules('numeric'), TextInput::make('color_amount') ->label('Color qty') ->rules('numeric'), TextInput::make('color_match') ->rules('numeric'), TextInput::make('color_change') ->rules('numeric'), TextInput::make('flash') ->rules(['numeric']), TextInput::make('fleece') ->rules('numeric'), TextInput::make('poly_ink') ->rules('numeric'), TextInput::make('run_charge') ->rules('numeric'), TextInput::make('artwork_fee') ->label('Artwork fee') ->rules('numeric'), TextInput::make('repacking_fee') ->label('Repack. fee') ->rules('numeric'), ]) ->addActionLabel('Add Screen Print Entry') ->defaultItems(0) ->reorderable() ->colStyles([ 'logo' => 'width: 11%', 'placement' => 'width: 11%', 'quantity' => 'width: 5%', 'width' => 'width: 6%', 'height' => 'width: 6%', 'setup_amount' => 'width: 5%', 'color_amount' => 'width: 5%', 'color_match' => 'width: 6%', 'color_change' => 'width: 5%', 'flash' => 'width: 6%', 'fleece' => 'width: 6%', 'poly_ink' => 'width: 6%', 'run_charge' => 'width: 6%', 'artwork_fee' => 'width: 6%', 'repacking_fee' => 'width: 6%', ]), TableRepeater::make('heatTransferEntries') ->relationship('heatTransferEntries') ->schema([ TextInput::make('logo') ->label('Logo name'), TextInput::make('placement'), TextInput::make('quantity') ->prefix('#') ->rules('numeric'), TextInput::make('width') ->suffix('inch') ->rules('numeric'), TextInput::make('height') ->rules('numeric') ->suffix('inch'), TextInput::make('price') ->rules('numeric') ->prefix('$'), ]) ->addActionLabel('Add Heat Transfer Entry') ->defaultItems(0) ->reorderable() ->colStyles([ 'logo' => 'width: 25%', 'placement' => 'width: 25%', 'quantity' => 'width: 10%', 'width' => 'width: 11%', 'height' => 'width: 11%', 'price' => 'width: 15%', ]), ])->columns(1); } public static function table(Table $table): Table { return $table ->columns([ TextColumn::make('id') ->color('primary') ->searchable(), TextColumn::make('date') ->date('Y-m-d') ->sortable() ->searchable(), TextColumn::make('customer.company_name') ->sortable() ->searchable(), TextColumn::make('notes') ->searchable() ->extraHeaderAttributes(['class' => 'w-full']), TextColumn::make('total') ->money(), ]) ->defaultSort('created_at', 'desc') ->groups([ 'customer.company_name', ]) ->filters([ ]) ->actions([ Tables\Actions\EditAction::make(), ]) ->bulkActions([ ]); } public static function canAccess(): bool { return auth()->user()->is_admin ?? false; } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => \App\Filament\Admin\Resources\QuoteResource\Pages\ListQuotes::route('/'), 'create' => \App\Filament\Admin\Resources\QuoteResource\Pages\CreateQuote::route('/create'), 'edit' => \App\Filament\Admin\Resources\QuoteResource\Pages\EditQuote::route('/{record}/edit'), ]; } }