feat(notification): Implement URL-based toast notifications for bottle, perfume, and product creation and updates, enhancing user feedback and navigation.
This commit is contained in:
parent
3916ef436e
commit
8aa25b662a
@ -32,11 +32,9 @@ public function save(): void
|
||||
|
||||
$this->form->store();
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
$this->toast('Botol berhasil ditambahkan.');
|
||||
|
||||
$this->redirectRoute('studio.catalog.bottle.index');
|
||||
$this->redirectRoute('studio.catalog.bottle.index', [
|
||||
'notification' => 'Botol berhasil ditambahkan.',
|
||||
], navigate: true);
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
|
||||
@ -35,11 +35,9 @@ public function save(): void
|
||||
|
||||
$this->form->update();
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
$this->toast('Botol berhasil diperbarui.');
|
||||
|
||||
$this->redirectRoute('studio.catalog.bottle.index');
|
||||
$this->redirectRoute('studio.catalog.bottle.index', [
|
||||
'notification' => 'Botol berhasil diperbarui.',
|
||||
], navigate: true);
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
|
||||
@ -18,6 +18,21 @@ class Index extends Component
|
||||
{
|
||||
use WithAuthorization, WithConfirmation, WithShowPrice, WithSubscribeNotification, WithToast;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$hasNotification = request()->get('notification');
|
||||
|
||||
if ($hasNotification) {
|
||||
$this->js(<<<'JS'
|
||||
const url = new URL(window.location);
|
||||
url.search = '';
|
||||
window.history.replaceState({}, '', url);
|
||||
JS);
|
||||
|
||||
$this->toast($hasNotification);
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(Bottle $bottle): void
|
||||
{
|
||||
$this->canOrAbort('delete bottle');
|
||||
|
||||
@ -53,11 +53,9 @@ public function save(): void
|
||||
],
|
||||
);
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
$this->toast('Parfum berhasil ditambahkan.');
|
||||
|
||||
$this->redirectRoute('studio.catalog.perfume.index');
|
||||
$this->redirectRoute('studio.catalog.perfume.index', [
|
||||
'notification' => 'Parfum berhasil ditambahkan.',
|
||||
], navigate: true);
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
|
||||
@ -46,11 +46,9 @@ public function save(): void
|
||||
|
||||
$this->form->update();
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
$this->toast('Parfum berhasil diperbarui.');
|
||||
|
||||
$this->redirectRoute('studio.catalog.perfume.index');
|
||||
$this->redirectRoute('studio.catalog.perfume.index', [
|
||||
'notification' => 'Parfum berhasil diperbarui.',
|
||||
], navigate: true);
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
|
||||
@ -17,6 +17,21 @@ class Index extends Component
|
||||
{
|
||||
use WithAuthorization, WithConfirmation, WithShowPrice, WithSubscribeNotification, WithToast;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$hasNotification = request()->get('notification');
|
||||
|
||||
if ($hasNotification) {
|
||||
$this->js(<<<'JS'
|
||||
const url = new URL(window.location);
|
||||
url.search = '';
|
||||
window.history.replaceState({}, '', url);
|
||||
JS);
|
||||
|
||||
$this->toast($hasNotification);
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(Perfume $perfume)
|
||||
{
|
||||
$this->canOrAbort('delete perfume');
|
||||
|
||||
@ -32,11 +32,9 @@ public function save(): void
|
||||
|
||||
$this->form->store();
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
$this->toast('Produk berhasil ditambahkan.');
|
||||
|
||||
$this->redirectRoute('studio.catalog.product.index');
|
||||
$this->redirectRoute('studio.catalog.product.index', [
|
||||
'notification' => 'Produk berhasil ditambahkan.',
|
||||
], navigate: true);
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
|
||||
@ -35,11 +35,9 @@ public function save(): void
|
||||
|
||||
$this->form->update();
|
||||
|
||||
$this->dispatch('refreshDatatable');
|
||||
|
||||
$this->toast('Produk berhasil diperbarui.');
|
||||
|
||||
$this->redirectRoute('studio.catalog.product.index');
|
||||
$this->redirectRoute('studio.catalog.product.index', [
|
||||
'notification' => 'Produk berhasil diperbarui.',
|
||||
], navigate: true);
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
|
||||
@ -18,6 +18,21 @@ class Index extends Component
|
||||
{
|
||||
use WithAuthorization, WithConfirmation, WithShowPrice, WithSubscribeNotification, WithToast;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$hasNotification = request()->get('notification');
|
||||
|
||||
if ($hasNotification) {
|
||||
$this->js(<<<'JS'
|
||||
const url = new URL(window.location);
|
||||
url.search = '';
|
||||
window.history.replaceState({}, '', url);
|
||||
JS);
|
||||
|
||||
$this->toast($hasNotification);
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(Product $product): void
|
||||
{
|
||||
$this->canOrAbort('delete product');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user