Skip to content

Commit

Permalink
changes to items
Browse files Browse the repository at this point in the history
  • Loading branch information
Flatroy committed Jun 17, 2024
1 parent b133b6d commit d659bd1
Showing 1 changed file with 70 additions and 34 deletions.
104 changes: 70 additions & 34 deletions app/Filament/Resources/ItemResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Placeholder;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
Expand Down Expand Up @@ -41,11 +42,6 @@ public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('ulid')
->label('ULID')
->disabled()
->hiddenOn(['create']),

Select::make('location_id')
->relationship(name: 'location', titleAttribute: 'name')
->createOptionForm([
Expand All @@ -57,55 +53,94 @@ public static function form(Form $form): Form
->searchable()
->required(),

TextInput::make('ulid')
->label('Unique ID')
->disabled()
->hiddenOn(['create']),

TextInput::make('name')
->label('Item name')
->columnSpanFull()
->required(),

Textarea::make('description')->columnSpanFull()->rows(3)->autosize(),
Textarea::make('description')
->label('Item description')->columnSpanFull()->rows(5
)->autosize(),

// todo: add tags https://filamentphp.com/plugins/filament-spatie-tags

TextInput::make('import_ref'),
Section::make('Advanced Details')
->schema([

TextInput::make('notes'),
// todo: add attachments https://filamentphp.com/plugins/filament-spatie-media-library

TextInput::make('quantity')
->default(1)
->required()
->integer(),
TextInput::make('import_ref'),

TextInput::make('asset_id')
->integer(),
TextInput::make('notes'),

Checkbox::make('insured'),
TextInput::make('quantity')
->default(1)
->required()
->integer(),

Checkbox::make('archived'),
TextInput::make('asset_id')
->label('Asset ID')
->integer(),

TextInput::make('serial_number'),
Checkbox::make('insured')->label('Insured'),

TextInput::make('model_number'),
Checkbox::make('archived'),

TextInput::make('manufacturer'),
TextInput::make('serial_number'),

Checkbox::make('lifetime_warranty'),
TextInput::make('model_number'),

DatePicker::make('warranty_expires'),
TextInput::make('manufacturer'),
])
->collapsible()->collapsed()->persistCollapsed()
->hiddenOn(['create']),

Textarea::make('warranty_details')->columnSpanFull()->rows(3)->autosize(),

DatePicker::make('purchase_time'),

TextInput::make('purchase_from'),

TextInput::make('purchase_price')
->numeric(),
Section::make('Purchase Details')
->schema([

DatePicker::make('sold_time'),
DatePicker::make('purchase_time'),

TextInput::make('sold_to'),
TextInput::make('purchase_from'),

TextInput::make('sold_price')
->numeric(),
TextInput::make('purchase_price')
->numeric(),

Textarea::make('sold_notes')->columnSpanFull()->rows(3)->autosize(),
])
->collapsible()->collapsed()->persistCollapsed()
->hiddenOn(['create']),
Section::make('Warranty Information')
->schema([
Checkbox::make('lifetime_warranty'),

DatePicker::make('warranty_expires'),

Textarea::make('warranty_details')->columnSpanFull()->rows(3)->autosize(),
])
->collapsible()->collapsed()->persistCollapsed()
->hiddenOn(['create']),

Section::make('Sold Details')
->schema([

DatePicker::make('sold_time'),

TextInput::make('sold_to'),

TextInput::make('sold_price')
->numeric(),

Textarea::make('sold_notes')->columnSpanFull()->rows(3)->autosize(),
])
->collapsible()->collapsed()->persistCollapsed()
->hiddenOn(['create']),

Placeholder::make('created_at')
->label('Created Date')
Expand All @@ -116,6 +151,7 @@ public static function form(Form $form): Form
->label('Last Modified Date')
->content(fn (?Item $record): string => $record?->updated_at?->diffForHumans() ?? '-')
->hiddenOn(['create']),

]);
}

Expand All @@ -125,7 +161,7 @@ public static function table(Table $table): Table
->columns([
// TextColumn::make('ulid'),

TextInputColumn::make('name')
TextColumn::make('name')
->searchable()
->sortable(),

Expand All @@ -135,7 +171,7 @@ public static function table(Table $table): Table

// TextColumn::make('notes')->searchable(),

TextInputColumn::make('quantity')->searchable(),
TextColumn::make('quantity')->searchable(),

CheckboxColumn::make('insured'),

Expand Down Expand Up @@ -202,7 +238,7 @@ public static function getPages(): array
{
return [
'index' => Pages\ListItems::route('/'),
'create' => Pages\CreateItem::route('/create'),
// 'create' => Pages\CreateItem::route('/create'),
'edit' => Pages\EditItem::route('/{record}/edit'),
];
}
Expand Down

0 comments on commit d659bd1

Please sign in to comment.