Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
danharrin committed Jun 15, 2024
1 parent 04c41de commit e901881
Show file tree
Hide file tree
Showing 59 changed files with 1,585 additions and 1,115 deletions.
2 changes: 1 addition & 1 deletion app/Filament/App/Pages/RegisterTeam.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static function getLabel(): string
return 'New team';
}

public function form(Form $form): Form
public function form(\Filament\Schema\Schema $form): \Filament\Schema\Schema
{
return $form
->schema([
Expand Down
14 changes: 7 additions & 7 deletions app/Filament/Clusters/Products/Resources/BrandResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ class BrandResource extends Resource

protected static ?int $navigationSort = 2;

public static function form(Form $form): Form
public static function form(\Filament\Schema\Schema $form): \Filament\Schema\Schema
{
return $form
->schema([
Forms\Components\Section::make()
\Filament\Schema\Components\Section::make()
->schema([
Forms\Components\Grid::make()
\Filament\Schema\Components\Grid::make()
->schema([
Forms\Components\TextInput::make('name')
->required()
->maxLength(255)
->live(onBlur: true)
->afterStateUpdated(fn (string $operation, $state, Forms\Set $set) => $operation === 'create' ? $set('slug', Str::slug($state)) : null),
->afterStateUpdated(fn (string $operation, $state, \Filament\Schema\Components\Utilities\Set $set) => $operation === 'create' ? $set('slug', Str::slug($state)) : null),

Forms\Components\TextInput::make('slug')
->disabled()
Expand All @@ -60,7 +60,7 @@ public static function form(Form $form): Form
->label('Description'),
])
->columnSpan(['lg' => fn (?Brand $record) => $record === null ? 3 : 2]),
Forms\Components\Section::make()
\Filament\Schema\Components\Section::make()
->schema([
Forms\Components\Placeholder::make('created_at')
->label('Created at')
Expand Down Expand Up @@ -100,10 +100,10 @@ public static function table(Table $table): Table
//
])
->actions([
Tables\Actions\EditAction::make(),
\Filament\Actions\EditAction::make(),
])
->groupedBulkActions([
Tables\Actions\DeleteBulkAction::make()
\Filament\Actions\DeleteBulkAction::make()
->action(function () {
Notification::make()
->title('Now, now, don\'t be cheeky, leave some records for others to play with!')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AddressesRelationManager extends RelationManager

protected static ?string $recordTitleAttribute = 'full_address';

public function form(Form $form): Form
public function form(\Filament\Schema\Schema $form): \Filament\Schema\Schema
{
return $form
->schema([
Expand Down Expand Up @@ -51,17 +51,17 @@ public function table(Table $table): Table
//
])
->headerActions([
Tables\Actions\AttachAction::make(),
Tables\Actions\CreateAction::make(),
\Filament\Actions\AttachAction::make(),
\Filament\Actions\CreateAction::make(),
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DetachAction::make(),
Tables\Actions\DeleteAction::make(),
\Filament\Actions\EditAction::make(),
\Filament\Actions\DetachAction::make(),
\Filament\Actions\DeleteAction::make(),
])
->groupedBulkActions([
Tables\Actions\DetachBulkAction::make(),
Tables\Actions\DeleteBulkAction::make(),
\Filament\Actions\DetachBulkAction::make(),
\Filament\Actions\DeleteBulkAction::make(),
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ProductsRelationManager extends RelationManager

protected static ?string $recordTitleAttribute = 'name';

public function form(Form $form): Form
public function form(\Filament\Schema\Schema $form): \Filament\Schema\Schema
{
return ProductResource::form($form);
}
Expand All @@ -23,13 +23,13 @@ public function table(Table $table): Table
{
return ProductResource::table($table)
->headerActions([
Tables\Actions\CreateAction::make(),
\Filament\Actions\CreateAction::make(),
])
->actions([
Tables\Actions\DeleteAction::make(),
\Filament\Actions\DeleteAction::make(),
])
->groupedBulkActions([
Tables\Actions\DeleteBulkAction::make(),
\Filament\Actions\DeleteBulkAction::make(),
]);
}
}
14 changes: 7 additions & 7 deletions app/Filament/Clusters/Products/Resources/CategoryResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ class CategoryResource extends Resource

protected static ?int $navigationSort = 1;

public static function form(Form $form): Form
public static function form(\Filament\Schema\Schema $form): \Filament\Schema\Schema
{
return $form
->schema([
Forms\Components\Section::make()
\Filament\Schema\Components\Section::make()
->schema([
Forms\Components\Grid::make()
\Filament\Schema\Components\Grid::make()
->schema([
Forms\Components\TextInput::make('name')
->required()
->maxLength(255)
->live(onBlur: true)
->afterStateUpdated(fn (string $operation, $state, Forms\Set $set) => $operation === 'create' ? $set('slug', Str::slug($state)) : null),
->afterStateUpdated(fn (string $operation, $state, \Filament\Schema\Components\Utilities\Set $set) => $operation === 'create' ? $set('slug', Str::slug($state)) : null),

Forms\Components\TextInput::make('slug')
->disabled()
Expand All @@ -63,7 +63,7 @@ public static function form(Form $form): Form
->label('Description'),
])
->columnSpan(['lg' => fn (?Category $record) => $record === null ? 3 : 2]),
Forms\Components\Section::make()
\Filament\Schema\Components\Section::make()
->schema([
Forms\Components\Placeholder::make('created_at')
->label('Created at')
Expand Down Expand Up @@ -103,10 +103,10 @@ public static function table(Table $table): Table
//
])
->actions([
Tables\Actions\EditAction::make(),
\Filament\Actions\EditAction::make(),
])
->groupedBulkActions([
Tables\Actions\DeleteBulkAction::make()
\Filament\Actions\DeleteBulkAction::make()
->action(function () {
Notification::make()
->title('Now, now, don\'t be cheeky, leave some records for others to play with!')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ProductsRelationManager extends RelationManager

protected static ?string $recordTitleAttribute = 'name';

public function form(Form $form): Form
public function form(\Filament\Schema\Schema $form): \Filament\Schema\Schema
{
return ProductResource::form($form);
}
Expand All @@ -23,13 +23,13 @@ public function table(Table $table): Table
{
return ProductResource::table($table)
->headerActions([
Tables\Actions\CreateAction::make(),
\Filament\Actions\CreateAction::make(),
])
->actions([
Tables\Actions\DeleteAction::make(),
\Filament\Actions\DeleteAction::make(),
])
->groupedBulkActions([
Tables\Actions\DeleteBulkAction::make(),
\Filament\Actions\DeleteBulkAction::make(),
]);
}
}
28 changes: 13 additions & 15 deletions app/Filament/Clusters/Products/Resources/ProductResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ class ProductResource extends Resource

protected static ?int $navigationSort = 0;

public static function form(Form $form): Form
public static function form(\Filament\Schema\Schema $form): \Filament\Schema\Schema
{
return $form
->schema([
Forms\Components\Group::make()
\Filament\Schema\Components\Group::make()
->schema([
Forms\Components\Section::make()
\Filament\Schema\Components\Section::make()
->schema([
Forms\Components\TextInput::make('name')
->required()
->maxLength(255)
->live(onBlur: true)
->afterStateUpdated(function (string $operation, $state, Forms\Set $set) {
->afterStateUpdated(function (string $operation, $state, \Filament\Schema\Components\Utilities\Set $set) {
if ($operation !== 'create') {
return;
}
Expand All @@ -68,7 +68,7 @@ public static function form(Form $form): Form
])
->columns(2),

Forms\Components\Section::make('Images')
\Filament\Schema\Components\Section::make('Images')
->schema([
SpatieMediaLibraryFileUpload::make('media')
->collection('product-images')
Expand All @@ -78,7 +78,7 @@ public static function form(Form $form): Form
])
->collapsible(),

Forms\Components\Section::make('Pricing')
\Filament\Schema\Components\Section::make('Pricing')
->schema([
Forms\Components\TextInput::make('price')
->numeric()
Expand All @@ -99,7 +99,7 @@ public static function form(Form $form): Form
->required(),
])
->columns(2),
Forms\Components\Section::make('Inventory')
\Filament\Schema\Components\Section::make('Inventory')
->schema([
Forms\Components\TextInput::make('sku')
->label('SKU (Stock Keeping Unit)')
Expand Down Expand Up @@ -127,7 +127,7 @@ public static function form(Form $form): Form
])
->columns(2),

Forms\Components\Section::make('Shipping')
\Filament\Schema\Components\Section::make('Shipping')
->schema([
Forms\Components\Checkbox::make('backorder')
->label('This product can be returned'),
Expand All @@ -139,9 +139,9 @@ public static function form(Form $form): Form
])
->columnSpan(['lg' => 2]),

Forms\Components\Group::make()
\Filament\Schema\Components\Group::make()
->schema([
Forms\Components\Section::make('Status')
\Filament\Schema\Components\Section::make('Status')
->schema([
Forms\Components\Toggle::make('is_visible')
->label('Visible')
Expand All @@ -154,7 +154,7 @@ public static function form(Form $form): Form
->required(),
]),

Forms\Components\Section::make('Associations')
\Filament\Schema\Components\Section::make('Associations')
->schema([
Forms\Components\Select::make('shop_brand_id')
->relationship('brand', 'name')
Expand All @@ -181,7 +181,6 @@ public static function table(Table $table): Table
->collection('product-images'),

Tables\Columns\TextColumn::make('name')
->label('Name')
->searchable()
->sortable(),

Expand All @@ -196,7 +195,6 @@ public static function table(Table $table): Table
->toggleable(),

Tables\Columns\TextColumn::make('price')
->label('Price')
->searchable()
->sortable(),

Expand Down Expand Up @@ -258,10 +256,10 @@ public static function table(Table $table): Table
], layout: Tables\Enums\FiltersLayout::AboveContentCollapsible)
->deferFilters()
->actions([
Tables\Actions\EditAction::make(),
\Filament\Actions\EditAction::make(),
])
->groupedBulkActions([
Tables\Actions\DeleteBulkAction::make()
\Filament\Actions\DeleteBulkAction::make()
->action(function () {
Notification::make()
->title('Now, now, don\'t be cheeky, leave some records for others to play with!')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class ListProducts extends ListRecords
protected function getActions(): array
{
return [
Actions\Action::make('refresh')
->dispatch('refresh-sidebar'),
Actions\CreateAction::make(),
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CommentsRelationManager extends RelationManager

protected static ?string $recordTitleAttribute = 'title';

public function form(Form $form): Form
public function form(\Filament\Schema\Schema $form): \Filament\Schema\Schema
{
return $form
->columns(1)
Expand All @@ -42,7 +42,7 @@ public function form(Form $form): Form
]);
}

public function infolist(Infolist $infolist): Infolist
public function infolist(\Filament\Schema\Schema $infolist): \Filament\Schema\Schema
{
return $infolist
->columns(1)
Expand Down Expand Up @@ -78,7 +78,7 @@ public function table(Table $table): Table
//
])
->headerActions([
Tables\Actions\CreateAction::make()
\Filament\Actions\CreateAction::make()
->after(function ($record) {
/** @var User $user */
$user = auth()->user();
Expand All @@ -91,12 +91,12 @@ public function table(Table $table): Table
}),
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
\Filament\Actions\ViewAction::make(),
\Filament\Actions\EditAction::make(),
\Filament\Actions\DeleteAction::make(),
])
->groupedBulkActions([
Tables\Actions\DeleteBulkAction::make(),
\Filament\Actions\DeleteBulkAction::make(),
]);
}
}
4 changes: 2 additions & 2 deletions app/Filament/Imports/Blog/CategoryImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static function getColumns(): array
ImportColumn::make('name')
->requiredMapping()
->rules(['required', 'max:255'])
->example('Category A'),
->example(['Category A', 'Category B']),
ImportColumn::make('slug')
->requiredMapping()
->rules(['required', 'max:255'])
Expand All @@ -29,7 +29,7 @@ public static function getColumns(): array
->requiredMapping()
->boolean()
->rules(['required', 'boolean'])
->example('yes'),
->examples(['yes', 'no']),
ImportColumn::make('seo_title')
->label('SEO title')
->rules(['max:60'])
Expand Down
8 changes: 4 additions & 4 deletions app/Filament/Pages/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ class Dashboard extends BaseDashboard
{
use BaseDashboard\Concerns\HasFiltersForm;

public function filtersForm(Form $form): Form
public function filtersForm(\Filament\Schema\Schema $form): \Filament\Schema\Schema
{
return $form
->schema([
Section::make()
\Filament\Schema\Components\Section::make()
->schema([
Select::make('businessCustomersOnly')
->boolean(),
DatePicker::make('startDate')
->maxDate(fn (Get $get) => $get('endDate') ?: now()),
->maxDate(fn (\Filament\Schema\Components\Utilities\Get $get) => $get('endDate') ?: now()),
DatePicker::make('endDate')
->minDate(fn (Get $get) => $get('startDate') ?: now())
->minDate(fn (\Filament\Schema\Components\Utilities\Get $get) => $get('startDate') ?: now())
->maxDate(now()),
])
->columns(3),
Expand Down
Loading

0 comments on commit e901881

Please sign in to comment.