Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2023
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.46 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Dashed\DashedEcommerceCore\Livewire\Orders;
  4.  
  5. use Filament\Actions\Action;
  6. use Filament\Actions\Concerns\InteractsWithActions;
  7. use Filament\Actions\Contracts\HasActions;
  8. use Filament\Forms\Concerns\InteractsWithForms;
  9. use Filament\Forms\Contracts\HasForms;
  10. use Livewire\Component;
  11. use Dashed\DashedEcommerceCore\Models\Order;
  12.  
  13. class ChangeOrderFulfillmentStatus extends Component implements HasForms, HasActions
  14. {
  15.     use InteractsWithForms;
  16.     use InteractsWithActions;
  17.  
  18.     public $order;
  19.     public $fulfillmentStatus;
  20.  
  21.     public function mount(Order $order)
  22.     {
  23.         $this->order = $order;
  24.         $this->form->fill([
  25.             'fulfillmentStatus' => $order->fulfillment_status,
  26.         ]);
  27.     }
  28.  
  29.     public function render()
  30.     {
  31.         return view('dashed-ecommerce-core::orders.components.change-fulfillment-status');
  32.     }
  33.  
  34.     public function changeStatusAction(): Action
  35.     {
  36.         return Action::make('change')
  37.             ->label('Verander fulfillment status')
  38.             ->color('primary')
  39.             ->form([
  40.                 Select::make('fulfillmentStatus')
  41.                     ->label('Verander fulfilment status')
  42.                     ->options(Orders::getFulfillmentStatusses())
  43.                     ->required(),
  44.             ])
  45.             ->requiresConfirmation()
  46.             ->action(function ($data) {
  47.                 dd($data, $this->order);
  48.             })
  49.             ->slideOver();
  50.     }
  51. }
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement