- Added detailed notifications for users and admins upon acceptance, rejection, and submission of proposals, verifications, and reports. - Improved user experience with personalized messages and actionable links in notifications. - Refactored notification logic across various actions to ensure consistent messaging and clarity. - Introduced new notification titles and bodies to better reflect the status of actions taken.
124 lines
3.9 KiB
PHP
124 lines
3.9 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Manage\Cooperations\RelationManagers;
|
|
|
|
use App\Enums\ApprovalStatus;
|
|
use Filament\Actions\BulkActionGroup;
|
|
use Filament\Actions\CreateAction;
|
|
use Filament\Actions\DeleteAction;
|
|
use Filament\Actions\DeleteBulkAction;
|
|
use Filament\Actions\EditAction;
|
|
use Filament\Forms\Components\DatePicker;
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Forms\Components\Textarea;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Resources\RelationManagers\RelationManager;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Table;
|
|
|
|
class TaskAssignmentRelationManager extends RelationManager
|
|
{
|
|
protected static string $relationship = 'taskAssignments';
|
|
|
|
protected static ?string $title = 'Penugasan';
|
|
|
|
public function form(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->components([
|
|
DatePicker::make('start_date')
|
|
->label('Tanggal Mulai')
|
|
->required()
|
|
->native(false)
|
|
->autocomplete(false)
|
|
->autofocus(),
|
|
|
|
DatePicker::make('end_date')
|
|
->label('Tanggal Selesai')
|
|
->required()
|
|
->native(false)
|
|
->after('start_date')
|
|
->autocomplete(false),
|
|
|
|
Textarea::make('task_description')
|
|
->label('Deskripsi Tugas')
|
|
->required()
|
|
->rows(4)
|
|
->maxLength(65535)
|
|
->autocomplete(false),
|
|
|
|
TextInput::make('report_amount')
|
|
->label('Jumlah Laporan')
|
|
->numeric()
|
|
->required()
|
|
->minValue(1)
|
|
->default(1)
|
|
->autocomplete(false),
|
|
|
|
Select::make('partner_media_ids')
|
|
->label('Media yang Ditugaskan')
|
|
->relationship('partnerMedia', 'name')
|
|
->multiple()
|
|
->preload()
|
|
->required()
|
|
->autocomplete(false),
|
|
|
|
Select::make('status')
|
|
->options(ApprovalStatus::options())
|
|
->required()
|
|
->default(ApprovalStatus::PENDING),
|
|
|
|
Textarea::make('rejection_reason')
|
|
->label('Alasan Penolakan')
|
|
->rows(3)
|
|
->columnSpanFull()
|
|
->autocomplete(false),
|
|
]);
|
|
}
|
|
|
|
public function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->recordTitleAttribute('task_description')
|
|
->columns([
|
|
TextColumn::make('start_date')
|
|
->label('Mulai')
|
|
->date('l, d F Y'),
|
|
|
|
TextColumn::make('end_date')
|
|
->label('Selesai')
|
|
->date('l, d F Y'),
|
|
|
|
TextColumn::make('task_description')
|
|
->label('Deskripsi Tugas')
|
|
->limit(50),
|
|
|
|
TextColumn::make('report_amount')
|
|
->label('Jumlah Laporan'),
|
|
])
|
|
->filters([
|
|
//
|
|
])
|
|
->headerActions([
|
|
CreateAction::make()
|
|
->label('Buat Penugasan')
|
|
->visible(function (): bool {
|
|
$cooperation = $this->getOwnerRecord();
|
|
|
|
return $cooperation->proposals()->accepted()->exists();
|
|
}),
|
|
])
|
|
->recordActions([
|
|
EditAction::make(),
|
|
|
|
DeleteAction::make(),
|
|
])
|
|
->toolbarActions([
|
|
BulkActionGroup::make([
|
|
DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
}
|