<?php

namespace App\Livewire\Studio\Catalog\Bottle;

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

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

    public function delete(Bottle $bottle)
    {
        $bottle->delete();

        $this->dispatch('refreshDatatable');

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

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

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