From 7e4a129bb7b5bb3b5b931dc2aa1bcf11ec5051c4 Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Thu, 16 Oct 2025 21:00:56 +0700 Subject: [PATCH] refactor(perfume): update concentration labels for consistency and enhance form placeholders for clarity --- app/Enums/Concentration.php | 6 +++--- .../Datatable/Studio/Catalog/PerfumesTable.php | 9 ++------- .../Forms/Studio/Catalog/PerfumeForm.php | 6 +++--- app/Livewire/Studio/Catalog/Perfume/Create.php | 2 -- app/Livewire/Studio/Catalog/Perfume/Edit.php | 2 -- .../studio/catalog/perfume/form.blade.php | 16 ++++++++-------- 6 files changed, 16 insertions(+), 25 deletions(-) diff --git a/app/Enums/Concentration.php b/app/Enums/Concentration.php index a030299..b817445 100644 --- a/app/Enums/Concentration.php +++ b/app/Enums/Concentration.php @@ -17,10 +17,10 @@ enum Concentration: int public function label() { return match ($this) { - self::EXTRAIT_DE_PERFUME => 'Extrait de parfum', - self::EAU_DE_PERFUME => 'Eau de parfum', + self::EXTRAIT_DE_PERFUME => 'Extrait de Parfum', + self::EAU_DE_PERFUME => 'Eau de Parfum', self::EAU_DE_COLOGNE => 'Eau de Cologne', - self::EAU_DE_TOILETTE => 'Eau de toilette', + self::EAU_DE_TOILETTE => 'Eau de Toilette', }; } diff --git a/app/Livewire/Datatable/Studio/Catalog/PerfumesTable.php b/app/Livewire/Datatable/Studio/Catalog/PerfumesTable.php index cfcc6f8..7e3c47a 100644 --- a/app/Livewire/Datatable/Studio/Catalog/PerfumesTable.php +++ b/app/Livewire/Datatable/Studio/Catalog/PerfumesTable.php @@ -8,6 +8,7 @@ use App\Traits\Datatable\WithPrependColumn; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Facades\Blade; +use Illuminate\Support\Str; use Rappasoft\LaravelLivewireTables\DataTableComponent; use Rappasoft\LaravelLivewireTables\Views\Column; use Rappasoft\LaravelLivewireTables\Views\Columns\ArrayColumn; @@ -48,7 +49,7 @@ public function columns(): array ->html(), Column::make('Harga Beli', 'cost_price') - ->label(fn ($row, $column) => currency($row->cost_price, 'Rp')) + ->label(fn ($row, $column) => Str::mask(currency($row->cost_price, 'Rp'), '*', 2)) ->searchable() ->sortable(), @@ -57,12 +58,6 @@ public function columns(): array ->searchable() ->sortable(), - Column::make('Base Notes', 'base_notes')->searchable()->sortable(), - - Column::make('Middle Notes', 'middle_notes')->searchable()->sortable(), - - Column::make('Top Notes', 'top_notes')->searchable()->sortable(), - ArrayColumn::make('Outlet') ->data( fn ($value, $row) => $row->outlets->map(fn ($outlet) => [ diff --git a/app/Livewire/Forms/Studio/Catalog/PerfumeForm.php b/app/Livewire/Forms/Studio/Catalog/PerfumeForm.php index 29c29e8..43d115b 100644 --- a/app/Livewire/Forms/Studio/Catalog/PerfumeForm.php +++ b/app/Livewire/Forms/Studio/Catalog/PerfumeForm.php @@ -34,7 +34,7 @@ class PerfumeForm extends Form public ?string $description = null; - public string $concentration = ''; + public string $concentration = '2'; public array $category_ids = []; @@ -143,8 +143,8 @@ private function prepareSavedData() return [ 'name' => $this->name, 'sku' => $this->sku, - 'cost_price' => $this->cost_price, - 'sale_price' => $this->sale_price, + 'cost_price' => replaceCurrency($this->cost_price), + 'sale_price' => replaceCurrency($this->sale_price), 'base_notes' => $this->base_notes, 'middle_notes' => $this->middle_notes, 'top_notes' => $this->top_notes, diff --git a/app/Livewire/Studio/Catalog/Perfume/Create.php b/app/Livewire/Studio/Catalog/Perfume/Create.php index 697b37c..87673a8 100644 --- a/app/Livewire/Studio/Catalog/Perfume/Create.php +++ b/app/Livewire/Studio/Catalog/Perfume/Create.php @@ -42,8 +42,6 @@ public function save() $this->form->store(); - $this->dispatch('refreshDatatable'); - $this->toast('Parfum berhasil ditambahkan.'); $this->redirectRoute('studio.catalog.perfume.index', navigate: true); diff --git a/app/Livewire/Studio/Catalog/Perfume/Edit.php b/app/Livewire/Studio/Catalog/Perfume/Edit.php index a940e8d..fdc35e1 100644 --- a/app/Livewire/Studio/Catalog/Perfume/Edit.php +++ b/app/Livewire/Studio/Catalog/Perfume/Edit.php @@ -45,8 +45,6 @@ public function save() $this->form->update(); - $this->dispatch('refreshDatatable'); - $this->toast('Parfum berhasil diperbarui.'); $this->redirectRoute('studio.catalog.perfume.index', navigate: true); diff --git a/resources/views/livewire/studio/catalog/perfume/form.blade.php b/resources/views/livewire/studio/catalog/perfume/form.blade.php index d743a18..1297c74 100644 --- a/resources/views/livewire/studio/catalog/perfume/form.blade.php +++ b/resources/views/livewire/studio/catalog/perfume/form.blade.php @@ -20,15 +20,15 @@
Nama * - SKU * - + @@ -71,24 +71,24 @@
-
-
-
+ placeholder="Blue Emotion adalah parfum pria dengan aroma segar dan sedikit pedas, memadukan citrus, rempah, dan sentuhan kayu, cocok untuk penggunaan sehari-hari maupun acara formal." + auotocomplete="off" class="**:data-[slot=content]:min-h-[100px]!" />