mirror of
https://github.com/Cybrarist/Discount-Bandit.git
synced 2026-11-24 19:49:54 +01:00
- sqlite support (default database). - add custom theme color option. - sidebar can be collapsed to use the full screen. - option to switch navigation to top bar instead of sidebar. - option to remove top bar completely. - option to add breadcrumbs - option to enable single page application mode (website feels like an app instead of loading page ) - add highest and lowest price (for the plugin mainly) - new settings for NTFY_CHANNEL_ID instead of passing whole link. - removed name field from create operation, with url autofocused, so you can paste the links faster. - custom settings are shared across the stores. - new filters in products. - removed dashboard page. - RSS feed added - notifications will have tags to know why you have been notified, along with highest and lowest price. Fixes: - Fetch works properly and live, please note it will fetch all the stores related, won't use queue anymore. (overusing it might block you) Removed: - groups. Technical Changes: - update money cast to round values. - remove update product details, since it's only used in one place. - remove is_store methods, easier to scale with new stores - created proper ntfy channel - all stores will go with key pivot value, instead of each store having its own column in database.
95 lines
2.8 KiB
PHP
95 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
use App\Enums\StatusEnum;
|
|
use App\Filament\Resources\StoreResource\Pages;
|
|
use App\Filament\Resources\StoreResource\RelationManagers;
|
|
use App\Models\Store;
|
|
use Filament\Forms;
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Forms\Form;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Columns\ImageColumn;
|
|
use Filament\Tables\Columns\SelectColumn;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Columns\ToggleColumn;
|
|
use Filament\Tables\Table;
|
|
|
|
class StoreResource extends Resource
|
|
{
|
|
protected static ?string $model = Store::class;
|
|
|
|
protected static ?string $navigationIcon = 'heroicon-o-building-storefront';
|
|
|
|
protected static ?int $navigationSort=4;
|
|
|
|
public static function form(Form $form): Form
|
|
{
|
|
|
|
|
|
return $form
|
|
->schema([
|
|
TextInput::make('name'),
|
|
|
|
Select::make('status')
|
|
->label('Status')
|
|
->hint('This will effect ALL the products that are related to this service')
|
|
->options(StatusEnum::class)
|
|
->preload(),
|
|
|
|
Forms\Components\Section::make('settings')
|
|
->columns(4)
|
|
->schema([
|
|
Forms\Components\Toggle::make('tabs')
|
|
->inline(false)
|
|
->label('Display As Tab on Products'),
|
|
]),
|
|
|
|
]);
|
|
}
|
|
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
ImageColumn::make('image')->disk('store')->height(50),
|
|
TextColumn::make('name')->searchable()->sortable(),
|
|
TextColumn::make('status')
|
|
->badge()
|
|
->color(fn ($state): string => StatusEnum::get_badge($state)),
|
|
ToggleColumn::make('tabs'),
|
|
TextColumn::make("products_count")->counts('products')->label("Total Products")
|
|
])
|
|
->filters([
|
|
Tables\Filters\SelectFilter::make('status')
|
|
->options(StatusEnum::to_array())
|
|
->label('Status')
|
|
->native(false),
|
|
])
|
|
->actions([
|
|
Tables\Actions\EditAction::make(),
|
|
]);
|
|
}
|
|
|
|
public static function getRelations(): array
|
|
{
|
|
return [
|
|
RelationManagers\ProductsRelationManager::class,
|
|
];
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => Pages\ListStores::route('/'),
|
|
'create' => Pages\CreateStore::route('/create'),
|
|
'edit' => Pages\EditStore::route('/{record}/edit'),
|
|
];
|
|
}
|
|
|
|
}
|