them log, chinh upload
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Filament\Resources\Products\RelationManagers;
|
||||
use App\Enums\ContractStatus;
|
||||
use App\Enums\ContractType;
|
||||
use App\Filament\Resources\Contracts\ContractResource;
|
||||
use App\Models\Feedback;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filter;
|
||||
@@ -15,7 +16,10 @@ class ContractsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'contracts';
|
||||
|
||||
protected static ?string $title = 'app.contracts';
|
||||
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
|
||||
{
|
||||
return __('app.contracts');
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
|
||||
@@ -12,7 +12,10 @@ class HandoversRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'handovers';
|
||||
|
||||
protected static ?string $title = 'app.handovers';
|
||||
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
|
||||
{
|
||||
return __('app.handovers');
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
|
||||
@@ -3,7 +3,14 @@
|
||||
namespace App\Filament\Resources\Products\RelationManagers;
|
||||
|
||||
use App\Enums\ServiceType;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
@@ -12,7 +19,39 @@ class ProductServicesRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'productServices';
|
||||
|
||||
protected static ?string $title = 'app.services';
|
||||
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
|
||||
{
|
||||
return __('app.services');
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('service_type')
|
||||
->label(__('enums.service_type'))
|
||||
->options(ServiceType::options())
|
||||
->required(),
|
||||
|
||||
Select::make('status')
|
||||
->label(__('enums.status'))
|
||||
->options([
|
||||
'active' => __('app.status_active'),
|
||||
'pending' => __('app.status_pending'),
|
||||
'completed' => __('app.status_completed'),
|
||||
'cancelled' => __('app.status_cancelled'),
|
||||
])
|
||||
->default('active')
|
||||
->required(),
|
||||
|
||||
DatePicker::make('actual_collection_date')
|
||||
->label(__('app.collection_date')),
|
||||
|
||||
Textarea::make('remark')
|
||||
->label(__('app.remark'))
|
||||
->rows(3),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
@@ -20,15 +59,12 @@ class ProductServicesRelationManager extends RelationManager
|
||||
->recordTitleAttribute('service_type')
|
||||
->columns([
|
||||
TextColumn::make('service_type')
|
||||
->label(__('enums.service_type'))
|
||||
->badge()
|
||||
->color(fn (string $state): string => match ($state) {
|
||||
'management_fee' => 'info',
|
||||
'gratitude' => 'success',
|
||||
'self_business' => 'warning',
|
||||
default => 'gray',
|
||||
})
|
||||
->color(fn (string $state): string => ServiceType::from($state)->color())
|
||||
->formatStateUsing(fn (string $state): string => ServiceType::from($state)->label()),
|
||||
TextColumn::make('status')
|
||||
->label(__('enums.status'))
|
||||
->badge()
|
||||
->color(fn (string $state): string => match ($state) {
|
||||
'active' => 'success',
|
||||
@@ -52,8 +88,10 @@ class ProductServicesRelationManager extends RelationManager
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('service_type')
|
||||
->options(ServiceType::MANAGEMENT_FEE->options()),
|
||||
->label(__('enums.service_type'))
|
||||
->options(ServiceType::options()),
|
||||
SelectFilter::make('status')
|
||||
->label(__('enums.status'))
|
||||
->options([
|
||||
'active' => __('app.status_active'),
|
||||
'pending' => __('app.status_pending'),
|
||||
@@ -62,7 +100,12 @@ class ProductServicesRelationManager extends RelationManager
|
||||
]),
|
||||
])
|
||||
->defaultSort('created_at', 'desc')
|
||||
->headerActions([])
|
||||
->recordActions([]);
|
||||
->headerActions([
|
||||
CreateAction::make(),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user