<?php

namespace App\Livewire\Studio\Catalog\Perfume;

use App\Models\Perfume;
use App\Traits\WithConfirmation;
use App\Traits\WithShowPrice;
use App\Traits\WithToast;
use Flux\Flux;
use Livewire\Attributes\Title;
use Livewire\Component;

#[Title('Parfum')]
class Index extends Component
{
    use WithConfirmation, WithShowPrice, WithToast;

    public function delete(Perfume $perfume)
    {
        $perfume->delete();

        $this->dispatch('refreshDatatable');

        $this->toast('Parfum berhasil dihapus.');

        Flux::modals()->close();
    }

    public function render()
    {
        return view('livewire.studio.catalog.perfume.index', [
            'pageTitle' => 'Parfum',
        ]);
    }
}
