feat: enhance task assignment form with date pickers, numeric input, and textarea for improved user input
This commit is contained in:
parent
b85323e5b2
commit
a08a23ae25
@ -11,6 +11,9 @@
|
|||||||
use App\Filament\Support\CheerfulNotification;
|
use App\Filament\Support\CheerfulNotification;
|
||||||
use Filament\Actions\BulkActionGroup;
|
use Filament\Actions\BulkActionGroup;
|
||||||
use Filament\Actions\DeleteBulkAction;
|
use Filament\Actions\DeleteBulkAction;
|
||||||
|
use Filament\Forms\Components\DatePicker;
|
||||||
|
use Filament\Forms\Components\Textarea;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Resources\RelationManagers\RelationManager;
|
use Filament\Resources\RelationManagers\RelationManager;
|
||||||
use Filament\Support\Icons\Heroicon;
|
use Filament\Support\Icons\Heroicon;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
@ -25,6 +28,11 @@ class TaskAssignmentRelationManager extends RelationManager
|
|||||||
|
|
||||||
protected static bool $shouldSkipAuthorization = true;
|
protected static bool $shouldSkipAuthorization = true;
|
||||||
|
|
||||||
|
public function isReadOnly(): bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static function canViewForRecord(Model $ownerRecord, string $pageClass): bool
|
public static function canViewForRecord(Model $ownerRecord, string $pageClass): bool
|
||||||
{
|
{
|
||||||
if (auth()->user()->hasRole(RoleEnum::PERUSAHAAN->value)) {
|
if (auth()->user()->hasRole(RoleEnum::PERUSAHAAN->value)) {
|
||||||
@ -64,6 +72,35 @@ public function table(Table $table): Table
|
|||||||
->headerActions([
|
->headerActions([
|
||||||
CreateAction::make()
|
CreateAction::make()
|
||||||
->label('Buat Media Order')
|
->label('Buat Media Order')
|
||||||
|
->modalWidth('md')
|
||||||
|
->schema([
|
||||||
|
DatePicker::make('start_date')
|
||||||
|
->label('Tanggal Mulai')
|
||||||
|
->native(false)
|
||||||
|
->displayFormat('l, d F Y')
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
DatePicker::make('end_date')
|
||||||
|
->label('Tanggal Selesai')
|
||||||
|
->native(false)
|
||||||
|
->displayFormat('l, d F Y')
|
||||||
|
->required()
|
||||||
|
->afterOrEqual('start_date'),
|
||||||
|
|
||||||
|
TextInput::make('report_amount')
|
||||||
|
->label('Jumlah Bukti Tayang')
|
||||||
|
->numeric()
|
||||||
|
->minValue(1)
|
||||||
|
->required()
|
||||||
|
->autocomplete(false),
|
||||||
|
|
||||||
|
Textarea::make('task_description')
|
||||||
|
->label('Deskripsi Tugas')
|
||||||
|
->required()
|
||||||
|
->rows(4)
|
||||||
|
->placeholder('...')
|
||||||
|
->autocomplete(false),
|
||||||
|
])
|
||||||
->visible(function (): bool {
|
->visible(function (): bool {
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
@ -93,6 +130,35 @@ public function table(Table $table): Table
|
|||||||
])
|
])
|
||||||
->recordActions([
|
->recordActions([
|
||||||
EditAction::make()
|
EditAction::make()
|
||||||
|
->modalWidth('md')
|
||||||
|
->schema([
|
||||||
|
DatePicker::make('start_date')
|
||||||
|
->label('Tanggal Mulai')
|
||||||
|
->native(false)
|
||||||
|
->displayFormat('l, d F Y')
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
DatePicker::make('end_date')
|
||||||
|
->label('Tanggal Selesai')
|
||||||
|
->native(false)
|
||||||
|
->displayFormat('l, d F Y')
|
||||||
|
->required()
|
||||||
|
->afterOrEqual('start_date'),
|
||||||
|
|
||||||
|
TextInput::make('report_amount')
|
||||||
|
->label('Jumlah Bukti Tayang')
|
||||||
|
->numeric()
|
||||||
|
->minValue(1)
|
||||||
|
->required()
|
||||||
|
->autocomplete(false),
|
||||||
|
|
||||||
|
Textarea::make('task_description')
|
||||||
|
->label('Deskripsi Tugas')
|
||||||
|
->required()
|
||||||
|
->rows(4)
|
||||||
|
->placeholder('...')
|
||||||
|
->autocomplete(false),
|
||||||
|
])
|
||||||
->successNotification(
|
->successNotification(
|
||||||
fn () => CheerfulNotification::success(
|
fn () => CheerfulNotification::success(
|
||||||
CheerfulNotification::getByKey('cooperation.assignment_updated'),
|
CheerfulNotification::getByKey('cooperation.assignment_updated'),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user