<?php

namespace App\Filament\Resources\Manage\Orders\Pages;

use App\Filament\Actions\Cheerful\CreateAction;
use App\Filament\Resources\Manage\Orders\OrderResource;
use Filament\Resources\Pages\ManageRecords;
use Filament\Support\Enums\Width;

class ManageOrders extends ManageRecords
{
    protected static string $resource = OrderResource::class;

    protected static ?string $title = 'Pesanan';

    protected function getHeaderActions(): array
    {
        return [
            CreateAction::make()
                ->label('Tambah')
                ->modalHeading('Tambah Pesanan')
                ->modalSubmitActionLabel('Simpan')
                ->modalCancelActionLabel('Batal')
                ->extraModalFooterActions(fn (CreateAction $action): array => [
                    $action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
                        ->label('Simpan dan Tambah Lagi'),
                ])
                ->modalWidth(Width::FourExtraLarge),
        ];
    }
}
