feat(trait): membuat trait untuk toast agar reusable
-mengubah cara menulis toast diubah menjadi memanggil toast yang ada
This commit is contained in:
parent
42df909c3f
commit
700aa8f260
@ -3,8 +3,8 @@
|
||||
namespace App\Livewire\Auth;
|
||||
|
||||
use App\Enums\UserStatus;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Attributes\Validate;
|
||||
use Livewire\Component;
|
||||
@ -14,7 +14,7 @@
|
||||
])]
|
||||
class Login extends Component
|
||||
{
|
||||
use WithUpdatedData;
|
||||
use WithToast, WithUpdatedData;
|
||||
|
||||
#[Validate(['required', 'string'], attribute: 'nama pengguna atau alamat surel')]
|
||||
public string $login = '';
|
||||
@ -31,13 +31,7 @@ public function auth()
|
||||
if (! auth()->attempt(
|
||||
[$identifier => $this->login, 'password' => $this->password],
|
||||
)) {
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Gagal',
|
||||
text: 'Nama pengguna, email atau kata sandi salah.',
|
||||
variant: 'danger',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Nama pengguna, email atau kata sandi salah.', 'Gagal', 'danger');
|
||||
|
||||
return;
|
||||
}
|
||||
@ -48,14 +42,10 @@ public function auth()
|
||||
return;
|
||||
}
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Selamat datang, '.auth()->user()?->employee?->full_name.'. Semoga harimu menyenangkan.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Selamat datang, '.auth()->user()?->employee?->full_name.'. Semoga harimu menyenangkan.');
|
||||
|
||||
session()->regenerate();
|
||||
|
||||
$this->redirectIntended('/studio/dashboard/overview', navigate: true);
|
||||
}
|
||||
|
||||
|
||||
@ -2,8 +2,9 @@
|
||||
|
||||
namespace App\Livewire\Auth;
|
||||
|
||||
use App\Livewire\Forms\RegisterForm;
|
||||
use Flux\Flux;
|
||||
use App\Livewire\Forms\Auth\RegisterForm;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Illuminate\Support\Str;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Component;
|
||||
@ -13,6 +14,8 @@
|
||||
])]
|
||||
class Register extends Component
|
||||
{
|
||||
use WithToast, WithUpdatedData;
|
||||
|
||||
public RegisterForm $form;
|
||||
|
||||
public array $steps = [];
|
||||
@ -75,12 +78,7 @@ public function register()
|
||||
{
|
||||
$this->form->auth();
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Selamat, akun Anda berhasil didaftarkan. Silakan cek email Anda untuk melakukan verifikasi.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Selamat, akun Anda berhasil didaftarkan. Silakan cek email Anda untuk melakukan verifikasi.');
|
||||
|
||||
$this->redirectIntended('/customer/dashboard/overview', navigate: true);
|
||||
}
|
||||
|
||||
@ -5,15 +5,15 @@
|
||||
use App\Livewire\Forms\Studio\Catalog\BottleForm;
|
||||
use App\Models\Outlet;
|
||||
use App\Traits\WithOutletSelector;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Title('Tambah Botol')]
|
||||
class Create extends Component
|
||||
{
|
||||
use WithOutletSelector, WithUpdatedData;
|
||||
use WithOutletSelector, WithToast, WithUpdatedData;
|
||||
|
||||
public BottleForm $form;
|
||||
|
||||
@ -30,12 +30,7 @@ public function save()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Botol berhasil ditambahkan.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Botol berhasil ditambahkan.');
|
||||
|
||||
$this->redirectRoute('studio.catalog.bottle.index', navigate: true);
|
||||
}
|
||||
|
||||
@ -6,15 +6,15 @@
|
||||
use App\Models\Bottle;
|
||||
use App\Models\Outlet;
|
||||
use App\Traits\WithOutletSelector;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Title('Ubah Botol')]
|
||||
class Edit extends Component
|
||||
{
|
||||
use WithOutletSelector, WithUpdatedData;
|
||||
use WithOutletSelector, WithToast, WithUpdatedData;
|
||||
|
||||
public BottleForm $form;
|
||||
|
||||
@ -33,12 +33,7 @@ public function save()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Botol berhasil diperbarui.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Botol berhasil diperbarui.');
|
||||
|
||||
$this->redirectRoute('studio.catalog.bottle.index', navigate: true);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
use App\Models\Bottle;
|
||||
use App\Traits\WithConfirmation;
|
||||
use App\Traits\WithToast;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
@ -11,7 +12,7 @@
|
||||
#[Title('Botol')]
|
||||
class Index extends Component
|
||||
{
|
||||
use WithConfirmation;
|
||||
use WithConfirmation, WithToast;
|
||||
|
||||
public function delete(Bottle $bottle)
|
||||
{
|
||||
@ -19,11 +20,7 @@ public function delete(Bottle $bottle)
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Botol berhasil dihapus.',
|
||||
variant: 'success',
|
||||
);
|
||||
$this->toast('Botol berhasil dihapus.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
use App\Models\Brand as BrandModel;
|
||||
use App\Traits\WithCloseModal;
|
||||
use App\Traits\WithConfirmation;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\On;
|
||||
@ -15,7 +16,7 @@
|
||||
#[Title('Merek')]
|
||||
class Brand extends Component
|
||||
{
|
||||
use WithCloseModal, WithConfirmation, WithUpdatedData;
|
||||
use WithCloseModal, WithConfirmation, WithToast, WithUpdatedData;
|
||||
|
||||
public BrandForm $form;
|
||||
|
||||
@ -43,12 +44,7 @@ public function create()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Merek berhasil ditambahkan.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Merek berhasil ditambahkan.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
@ -59,12 +55,7 @@ public function update()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Merek berhasil diperbarui.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Merek berhasil diperbarui.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
@ -77,11 +68,7 @@ public function delete(BrandModel $brand)
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Merek berhasil dihapus.',
|
||||
variant: 'success',
|
||||
);
|
||||
$this->toast('Merek berhasil dihapus.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
use App\Models\Category as CategoryModel;
|
||||
use App\Traits\WithCloseModal;
|
||||
use App\Traits\WithConfirmation;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\On;
|
||||
@ -15,7 +16,7 @@
|
||||
#[Title('Kategori')]
|
||||
class Category extends Component
|
||||
{
|
||||
use WithCloseModal, WithConfirmation, WithUpdatedData;
|
||||
use WithCloseModal, WithConfirmation, WithToast, WithUpdatedData;
|
||||
|
||||
public CategoryForm $form;
|
||||
|
||||
@ -43,12 +44,7 @@ public function create()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Kategori berhasil ditambahkan.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Kategori berhasil ditambahkan.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
@ -59,12 +55,7 @@ public function update()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Kategori berhasil diperbarui.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Kategori berhasil diperbarui.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
@ -77,11 +68,7 @@ public function delete(CategoryModel $category)
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Kategori berhasil dihapus.',
|
||||
variant: 'success',
|
||||
);
|
||||
$this->toast('Kategori berhasil dihapus.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
|
||||
@ -8,15 +8,15 @@
|
||||
use App\Models\Outlet;
|
||||
use App\Traits\WithCategorySelector;
|
||||
use App\Traits\WithOutletSelector;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Title('Tambah Parfum')]
|
||||
class Create extends Component
|
||||
{
|
||||
use WithCategorySelector, WithOutletSelector, WithUpdatedData;
|
||||
use WithCategorySelector, WithOutletSelector, WithToast, WithUpdatedData;
|
||||
|
||||
public PerfumeForm $form;
|
||||
|
||||
@ -41,12 +41,7 @@ public function save()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Parfum berhasil ditambahkan.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Parfum berhasil ditambahkan.');
|
||||
|
||||
$this->redirectRoute('studio.catalog.perfume.index', navigate: true);
|
||||
}
|
||||
|
||||
@ -9,15 +9,15 @@
|
||||
use App\Models\Perfume;
|
||||
use App\Traits\WithCategorySelector;
|
||||
use App\Traits\WithOutletSelector;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Title('Ubah Parfum')]
|
||||
class Edit extends Component
|
||||
{
|
||||
use WithCategorySelector, WithOutletSelector, WithUpdatedData;
|
||||
use WithCategorySelector, WithOutletSelector, WithToast, WithUpdatedData;
|
||||
|
||||
public PerfumeForm $form;
|
||||
|
||||
@ -44,12 +44,7 @@ public function save()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Parfum berhasil diperbarui.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Parfum berhasil diperbarui.');
|
||||
|
||||
$this->redirectRoute('studio.catalog.perfume.index', navigate: true);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
use App\Models\Perfume;
|
||||
use App\Traits\WithConfirmation;
|
||||
use App\Traits\WithToast;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
@ -11,7 +12,7 @@
|
||||
#[Title('Parfum')]
|
||||
class Index extends Component
|
||||
{
|
||||
use WithConfirmation;
|
||||
use WithConfirmation, WithToast;
|
||||
|
||||
public function delete(Perfume $perfume)
|
||||
{
|
||||
@ -19,11 +20,7 @@ public function delete(Perfume $perfume)
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Parfum berhasil dihapus.',
|
||||
variant: 'success',
|
||||
);
|
||||
$this->toast('Parfum berhasil dihapus.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
|
||||
@ -5,15 +5,15 @@
|
||||
use App\Livewire\Forms\Studio\Catalog\ProductForm;
|
||||
use App\Models\Outlet;
|
||||
use App\Traits\WithOutletSelector;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Title('Tambah Produk')]
|
||||
class Create extends Component
|
||||
{
|
||||
use WithOutletSelector, WithUpdatedData;
|
||||
use WithOutletSelector, WithToast, WithUpdatedData;
|
||||
|
||||
public ProductForm $form;
|
||||
|
||||
@ -30,12 +30,7 @@ public function save()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Produk berhasil ditambahkan.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Produk berhasil ditambahkan.');
|
||||
|
||||
$this->redirectRoute('studio.catalog.product.index', navigate: true);
|
||||
}
|
||||
|
||||
@ -6,15 +6,15 @@
|
||||
use App\Models\Outlet;
|
||||
use App\Models\Product;
|
||||
use App\Traits\WithOutletSelector;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Title('Ubah Produk')]
|
||||
class Edit extends Component
|
||||
{
|
||||
use WithOutletSelector, WithUpdatedData;
|
||||
use WithOutletSelector, WithToast, WithUpdatedData;
|
||||
|
||||
public ProductForm $form;
|
||||
|
||||
@ -33,12 +33,7 @@ public function save()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Produk berhasil diperbarui.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Produk berhasil diperbarui.');
|
||||
|
||||
$this->redirectRoute('studio.catalog.product.index', navigate: true);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
use App\Models\Product;
|
||||
use App\Traits\WithConfirmation;
|
||||
use App\Traits\WithToast;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
@ -11,7 +12,7 @@
|
||||
#[Title('Produk')]
|
||||
class Index extends Component
|
||||
{
|
||||
use WithConfirmation;
|
||||
use WithConfirmation, WithToast;
|
||||
|
||||
public function delete(Product $product)
|
||||
{
|
||||
@ -19,11 +20,7 @@ public function delete(Product $product)
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Produk berhasil dihapus.',
|
||||
variant: 'success',
|
||||
);
|
||||
$this->toast('Produk berhasil dihapus.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
use App\Models\Expense as ExpenseModel;
|
||||
use App\Traits\WithCloseModal;
|
||||
use App\Traits\WithConfirmation;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\On;
|
||||
@ -15,7 +16,7 @@
|
||||
#[Title('Pengeluaran')]
|
||||
class Expense extends Component
|
||||
{
|
||||
use WithCloseModal, WithConfirmation, WithUpdatedData;
|
||||
use WithCloseModal, WithConfirmation, WithToast, WithUpdatedData;
|
||||
|
||||
public ExpenseForm $form;
|
||||
|
||||
@ -43,12 +44,7 @@ public function create()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Pengeluaran berhasil ditambahkan.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Pengeluaran berhasil ditambahkan.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
@ -59,12 +55,7 @@ public function update()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Pengeluaran berhasil diperbarui.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Pengeluaran berhasil diperbarui.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
@ -75,11 +66,7 @@ public function delete(ExpenseModel $expense)
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Pengeluaran berhasil dihapus.',
|
||||
variant: 'success',
|
||||
);
|
||||
$this->toast('Pengeluaran berhasil dihapus.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
use App\Models\Customer as CustomerModel;
|
||||
use App\Traits\WithCloseModal;
|
||||
use App\Traits\WithConfirmation;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\On;
|
||||
@ -15,7 +16,7 @@
|
||||
#[Title('Customer')]
|
||||
class Customer extends Component
|
||||
{
|
||||
use WithCloseModal, WithConfirmation, WithUpdatedData;
|
||||
use WithCloseModal, WithConfirmation, WithToast, WithUpdatedData;
|
||||
|
||||
public CustomerForm $form;
|
||||
|
||||
@ -43,12 +44,7 @@ public function create()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Customer berhasil ditambahkan.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Customer berhasil ditambahkan.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
@ -59,12 +55,7 @@ public function update()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Customer berhasil diperbarui.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Customer berhasil diperbarui.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
@ -75,11 +66,7 @@ public function delete(CustomerModel $customer)
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Customer berhasil dihapus.',
|
||||
variant: 'success',
|
||||
);
|
||||
$this->toast('Customer berhasil dihapus.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
use App\Models\Tier as TierModel;
|
||||
use App\Traits\WithCloseModal;
|
||||
use App\Traits\WithConfirmation;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\On;
|
||||
@ -15,7 +16,7 @@
|
||||
#[Title('Tier')]
|
||||
class Tier extends Component
|
||||
{
|
||||
use WithCloseModal, WithConfirmation, WithUpdatedData;
|
||||
use WithCloseModal, WithConfirmation, WithToast, WithUpdatedData;
|
||||
|
||||
public TierForm $form;
|
||||
|
||||
@ -43,12 +44,7 @@ public function create()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Tier berhasil ditambahkan.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Tier berhasil ditambahkan.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
@ -59,12 +55,7 @@ public function update()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Tier berhasil diperbarui.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Tier berhasil diperbarui.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
@ -75,11 +66,7 @@ public function delete(TierModel $tier)
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Tier berhasil dihapus.',
|
||||
variant: 'success',
|
||||
);
|
||||
$this->toast('Tier berhasil dihapus.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
|
||||
@ -5,15 +5,15 @@
|
||||
use App\Livewire\Forms\Studio\Loyalty\VoucherForm;
|
||||
use App\Models\Outlet;
|
||||
use App\Traits\WithOutletSelector;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Title('Tambah Voucher')]
|
||||
class Create extends Component
|
||||
{
|
||||
use WithOutletSelector, WithUpdatedData;
|
||||
use WithOutletSelector, WithToast, WithUpdatedData;
|
||||
|
||||
public VoucherForm $form;
|
||||
|
||||
@ -30,12 +30,7 @@ public function save()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Voucher berhasil ditambahkan.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Voucher berhasil ditambahkan.');
|
||||
|
||||
$this->redirectRoute('studio.loyalty.voucher.index', navigate: true);
|
||||
}
|
||||
|
||||
@ -6,15 +6,15 @@
|
||||
use App\Models\Outlet;
|
||||
use App\Models\Voucher;
|
||||
use App\Traits\WithOutletSelector;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Title('Ubah Voucher')]
|
||||
class Edit extends Component
|
||||
{
|
||||
use WithOutletSelector, WithUpdatedData;
|
||||
use WithOutletSelector, WithToast, WithUpdatedData;
|
||||
|
||||
public VoucherForm $form;
|
||||
|
||||
@ -33,12 +33,7 @@ public function save()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Voucher berhasil diperbarui.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Voucher berhasil diperbarui.');
|
||||
|
||||
$this->redirectRoute('studio.loyalty.voucher.index', navigate: true);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
use App\Models\Voucher;
|
||||
use App\Traits\WithConfirmation;
|
||||
use App\Traits\WithToast;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
@ -11,7 +12,7 @@
|
||||
#[Title('Voucher')]
|
||||
class Index extends Component
|
||||
{
|
||||
use WithConfirmation;
|
||||
use WithConfirmation, WithToast;
|
||||
|
||||
public function delete(Voucher $voucher)
|
||||
{
|
||||
@ -19,11 +20,7 @@ public function delete(Voucher $voucher)
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Voucher berhasil dihapus.',
|
||||
variant: 'success',
|
||||
);
|
||||
$this->toast('Voucher berhasil dihapus.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
|
||||
@ -5,15 +5,15 @@
|
||||
use App\Enums\Day;
|
||||
use App\Livewire\Forms\Studio\Master\OutletForm;
|
||||
use App\Traits\Outlet\WithFacilityHandler;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Title('Tambah Outlet')]
|
||||
class Create extends Component
|
||||
{
|
||||
use WithFacilityHandler, WithUpdatedData;
|
||||
use WithFacilityHandler, WithToast, WithUpdatedData;
|
||||
|
||||
public OutletForm $form;
|
||||
|
||||
@ -35,12 +35,7 @@ public function save()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Outlet berhasil ditambahkan.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Outlet berhasil ditambahkan.');
|
||||
|
||||
$this->redirectRoute('studio.master.outlet.index', navigate: true);
|
||||
}
|
||||
|
||||
@ -6,15 +6,15 @@
|
||||
use App\Livewire\Forms\Studio\Master\OutletForm;
|
||||
use App\Models\Outlet;
|
||||
use App\Traits\Outlet\WithFacilityHandler;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Title('Ubah Outlet')]
|
||||
class Edit extends Component
|
||||
{
|
||||
use WithFacilityHandler, WithUpdatedData;
|
||||
use WithFacilityHandler, WithToast, WithUpdatedData;
|
||||
|
||||
public OutletForm $form;
|
||||
|
||||
@ -33,12 +33,7 @@ public function save()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Outlet berhasil diperbarui.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Outlet berhasil diperbarui.');
|
||||
|
||||
$this->redirectRoute('studio.master.outlet.index', navigate: true);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
use App\Models\Outlet;
|
||||
use App\Traits\WithConfirmation;
|
||||
use App\Traits\WithToast;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
@ -11,7 +12,7 @@
|
||||
#[Title('Outlet')]
|
||||
class Index extends Component
|
||||
{
|
||||
use WithConfirmation;
|
||||
use WithConfirmation, WithToast;
|
||||
|
||||
public function delete(Outlet $outlet)
|
||||
{
|
||||
@ -19,11 +20,7 @@ public function delete(Outlet $outlet)
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Outlet berhasil dihapus.',
|
||||
variant: 'success',
|
||||
);
|
||||
$this->toast('Outlet berhasil dihapus.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
|
||||
@ -3,15 +3,15 @@
|
||||
namespace App\Livewire\Studio\Master\User;
|
||||
|
||||
use App\Livewire\Forms\Studio\Master\UserForm;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Title('Tambah Pegawai')]
|
||||
class Create extends Component
|
||||
{
|
||||
use WithUpdatedData;
|
||||
use WithToast, WithUpdatedData;
|
||||
|
||||
public UserForm $form;
|
||||
|
||||
@ -21,12 +21,7 @@ public function save()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Pegawai berhasil ditambahkan.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Pegawai berhasil ditambahkan.');
|
||||
|
||||
$this->redirectRoute('studio.master.user.index', navigate: true);
|
||||
}
|
||||
|
||||
@ -4,15 +4,15 @@
|
||||
|
||||
use App\Livewire\Forms\Studio\Master\UserForm;
|
||||
use App\Models\User;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Title('Ubah Pegawai')]
|
||||
class Edit extends Component
|
||||
{
|
||||
use WithUpdatedData;
|
||||
use WithToast, WithUpdatedData;
|
||||
|
||||
public UserForm $form;
|
||||
|
||||
@ -27,12 +27,7 @@ public function save()
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Pegawai berhasil diperbarui.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Pegawai berhasil diperbarui.');
|
||||
|
||||
$this->redirectRoute('studio.master.user.index', navigate: true);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
use App\Models\User;
|
||||
use App\Traits\WithConfirmation;
|
||||
use App\Traits\WithToast;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
@ -11,7 +12,7 @@
|
||||
#[Title('Pegawai')]
|
||||
class Index extends Component
|
||||
{
|
||||
use WithConfirmation;
|
||||
use WithConfirmation, WithToast;
|
||||
|
||||
public function delete(User $user)
|
||||
{
|
||||
@ -19,11 +20,7 @@ public function delete(User $user)
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Pegawai berhasil dihapus.',
|
||||
variant: 'success',
|
||||
);
|
||||
$this->toast('Pegawai berhasil dihapus.');
|
||||
|
||||
Flux::modals()->close();
|
||||
}
|
||||
|
||||
@ -4,15 +4,15 @@
|
||||
|
||||
use App\Livewire\Forms\Studio\Setting\AccountForm;
|
||||
use App\Models\User;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Title('Akun')]
|
||||
class Account extends Component
|
||||
{
|
||||
use WithUpdatedData;
|
||||
use WithToast, WithUpdatedData;
|
||||
|
||||
public AccountForm $form;
|
||||
|
||||
@ -25,12 +25,7 @@ public function update()
|
||||
{
|
||||
$this->form->update();
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Akun berhasil diperbarui.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Akun berhasil diperbarui.');
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
|
||||
use App\Livewire\Forms\Studio\Setting\PasswordForm;
|
||||
use App\Models\User;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
@ -13,7 +13,7 @@
|
||||
#[Title('Kata Sandi')]
|
||||
class Password extends Component
|
||||
{
|
||||
use WithUpdatedData;
|
||||
use WithToast, WithUpdatedData;
|
||||
|
||||
public PasswordForm $form;
|
||||
|
||||
@ -25,12 +25,7 @@ public function mount(User $user)
|
||||
public function update()
|
||||
{
|
||||
if (! Hash::check($this->form->current_password, $this->form->user->password)) {
|
||||
Flux::toast(
|
||||
heading: 'Gagal',
|
||||
text: 'Kata sandi yang Anda masukkan tidak sesuai dengan kata sandi saat ini.',
|
||||
variant: 'danger',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Kata sandi yang Anda masukkan tidak sesuai dengan kata sandi saat ini.', 'Gagal', 'danger');
|
||||
|
||||
return;
|
||||
}
|
||||
@ -43,12 +38,7 @@ public function update()
|
||||
session()->invalidate();
|
||||
session()->regenerateToken();
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Kata sandi berhasil diperbarui.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Kata sandi berhasil diperbarui.');
|
||||
|
||||
$this->redirectRoute('login', navigate: true);
|
||||
}
|
||||
|
||||
@ -4,15 +4,15 @@
|
||||
|
||||
use App\Livewire\Forms\Studio\Setting\ProfileForm;
|
||||
use App\Models\Employee;
|
||||
use App\Traits\WithToast;
|
||||
use App\Traits\WithUpdatedData;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Title('Profil')]
|
||||
class Profile extends Component
|
||||
{
|
||||
use WithUpdatedData;
|
||||
use WithToast, WithUpdatedData;
|
||||
|
||||
public ProfileForm $form;
|
||||
|
||||
@ -25,12 +25,7 @@ public function update()
|
||||
{
|
||||
$this->form->update();
|
||||
|
||||
Flux::toast(
|
||||
heading: 'Berhasil',
|
||||
text: 'Profil berhasil diperbarui.',
|
||||
variant: 'success',
|
||||
duration: 3000
|
||||
);
|
||||
$this->toast('Profil berhasil diperbarui.');
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
||||
18
app/Traits/WithToast.php
Normal file
18
app/Traits/WithToast.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use Flux\Flux;
|
||||
|
||||
trait WithToast
|
||||
{
|
||||
public function toast(string $text, string $heading = 'Berhasil', string $variant = 'success', int $duration = 5000)
|
||||
{
|
||||
Flux::toast(
|
||||
heading: $heading,
|
||||
text: $text,
|
||||
variant: $variant,
|
||||
duration: $duration
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user