refactor(perfume): update concentration labels for consistency and enhance form placeholders for clarity
This commit is contained in:
parent
8cb5d7e7cf
commit
7e4a129bb7
@ -17,10 +17,10 @@ enum Concentration: int
|
|||||||
public function label()
|
public function label()
|
||||||
{
|
{
|
||||||
return match ($this) {
|
return match ($this) {
|
||||||
self::EXTRAIT_DE_PERFUME => 'Extrait de parfum',
|
self::EXTRAIT_DE_PERFUME => 'Extrait de Parfum',
|
||||||
self::EAU_DE_PERFUME => 'Eau de parfum',
|
self::EAU_DE_PERFUME => 'Eau de Parfum',
|
||||||
self::EAU_DE_COLOGNE => 'Eau de Cologne',
|
self::EAU_DE_COLOGNE => 'Eau de Cologne',
|
||||||
self::EAU_DE_TOILETTE => 'Eau de toilette',
|
self::EAU_DE_TOILETTE => 'Eau de Toilette',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
use App\Traits\Datatable\WithPrependColumn;
|
use App\Traits\Datatable\WithPrependColumn;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Support\Facades\Blade;
|
use Illuminate\Support\Facades\Blade;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
use Rappasoft\LaravelLivewireTables\DataTableComponent;
|
use Rappasoft\LaravelLivewireTables\DataTableComponent;
|
||||||
use Rappasoft\LaravelLivewireTables\Views\Column;
|
use Rappasoft\LaravelLivewireTables\Views\Column;
|
||||||
use Rappasoft\LaravelLivewireTables\Views\Columns\ArrayColumn;
|
use Rappasoft\LaravelLivewireTables\Views\Columns\ArrayColumn;
|
||||||
@ -48,7 +49,7 @@ public function columns(): array
|
|||||||
->html(),
|
->html(),
|
||||||
|
|
||||||
Column::make('Harga Beli', 'cost_price')
|
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()
|
->searchable()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
|
||||||
@ -57,12 +58,6 @@ public function columns(): array
|
|||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->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')
|
ArrayColumn::make('Outlet')
|
||||||
->data(
|
->data(
|
||||||
fn ($value, $row) => $row->outlets->map(fn ($outlet) => [
|
fn ($value, $row) => $row->outlets->map(fn ($outlet) => [
|
||||||
|
|||||||
@ -34,7 +34,7 @@ class PerfumeForm extends Form
|
|||||||
|
|
||||||
public ?string $description = null;
|
public ?string $description = null;
|
||||||
|
|
||||||
public string $concentration = '';
|
public string $concentration = '2';
|
||||||
|
|
||||||
public array $category_ids = [];
|
public array $category_ids = [];
|
||||||
|
|
||||||
@ -143,8 +143,8 @@ private function prepareSavedData()
|
|||||||
return [
|
return [
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
'sku' => $this->sku,
|
'sku' => $this->sku,
|
||||||
'cost_price' => $this->cost_price,
|
'cost_price' => replaceCurrency($this->cost_price),
|
||||||
'sale_price' => $this->sale_price,
|
'sale_price' => replaceCurrency($this->sale_price),
|
||||||
'base_notes' => $this->base_notes,
|
'base_notes' => $this->base_notes,
|
||||||
'middle_notes' => $this->middle_notes,
|
'middle_notes' => $this->middle_notes,
|
||||||
'top_notes' => $this->top_notes,
|
'top_notes' => $this->top_notes,
|
||||||
|
|||||||
@ -42,8 +42,6 @@ public function save()
|
|||||||
|
|
||||||
$this->form->store();
|
$this->form->store();
|
||||||
|
|
||||||
$this->dispatch('refreshDatatable');
|
|
||||||
|
|
||||||
$this->toast('Parfum berhasil ditambahkan.');
|
$this->toast('Parfum berhasil ditambahkan.');
|
||||||
|
|
||||||
$this->redirectRoute('studio.catalog.perfume.index', navigate: true);
|
$this->redirectRoute('studio.catalog.perfume.index', navigate: true);
|
||||||
|
|||||||
@ -45,8 +45,6 @@ public function save()
|
|||||||
|
|
||||||
$this->form->update();
|
$this->form->update();
|
||||||
|
|
||||||
$this->dispatch('refreshDatatable');
|
|
||||||
|
|
||||||
$this->toast('Parfum berhasil diperbarui.');
|
$this->toast('Parfum berhasil diperbarui.');
|
||||||
|
|
||||||
$this->redirectRoute('studio.catalog.perfume.index', navigate: true);
|
$this->redirectRoute('studio.catalog.perfume.index', navigate: true);
|
||||||
|
|||||||
@ -20,15 +20,15 @@
|
|||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||||
<flux:field>
|
<flux:field>
|
||||||
<flux:label>Nama <span class="text-red-500 ms-1">*</span></flux:label>
|
<flux:label>Nama <span class="text-red-500 ms-1">*</span></flux:label>
|
||||||
<flux:input placeholder="Masukkan nama parfum"
|
<flux:input placeholder="Contoh: Blue Emotion"
|
||||||
wire:model.live.debounce.500ms="form.name" autofocus autocomplete="off" />
|
wire:model.live.debounce.500ms="form.name" autofocus autocomplete="off" />
|
||||||
<flux:error name="form.name" />
|
<flux:error name="form.name" />
|
||||||
</flux:field>
|
</flux:field>
|
||||||
|
|
||||||
<flux:field>
|
<flux:field>
|
||||||
<flux:label>SKU <span class="text-red-500 ms-1">*</span></flux:label>
|
<flux:label>SKU <span class="text-red-500 ms-1">*</span></flux:label>
|
||||||
<flux:input placeholder="Masukkan stock keeping unit"
|
<flux:input placeholder="Contoh: 001" wire:model.live.debounce.500ms="form.sku"
|
||||||
wire:model.live.debounce.500ms="form.sku" autocomplete="off" copyable />
|
autocomplete="off" copyable />
|
||||||
<flux:error name="form.sku" />
|
<flux:error name="form.sku" />
|
||||||
</flux:field>
|
</flux:field>
|
||||||
|
|
||||||
@ -71,24 +71,24 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="md:col-span-2">
|
<div class="md:col-span-2">
|
||||||
<flux:input label="Base Notes" placeholder="Masukkan base notes"
|
<flux:input label="Base Notes" placeholder="Contoh : A, B, C"
|
||||||
wire:model.live.debounce.500ms="form.base_notes" autocomplete="off" />
|
wire:model.live.debounce.500ms="form.base_notes" autocomplete="off" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="md:col-span-2">
|
<div class="md:col-span-2">
|
||||||
<flux:input label="Middle Notes" placeholder="Masukkan middle notes"
|
<flux:input label="Middle Notes" placeholder="Contoh : A, B, C"
|
||||||
wire:model.live.debounce.500ms="form.middle_notes" autocomplete="off" />
|
wire:model.live.debounce.500ms="form.middle_notes" autocomplete="off" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="md:col-span-2">
|
<div class="md:col-span-2">
|
||||||
<flux:input label="Top Notes" placeholder="Masukkan top notes"
|
<flux:input label="Top Notes" placeholder="Contoh : A, B, C"
|
||||||
wire:model.live.debounce.500ms="form.top_notes" autocomplete="off" />
|
wire:model.live.debounce.500ms="form.top_notes" autocomplete="off" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="md:col-span-2">
|
<div class="md:col-span-2">
|
||||||
<flux:editor label="Deskripsi" wire:model="form.description"
|
<flux:editor label="Deskripsi" wire:model="form.description"
|
||||||
placeholder="Masukkan deskripsi" auotocomplete="off"
|
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."
|
||||||
class="**:data-[slot=content]:min-h-[100px]!" />
|
auotocomplete="off" class="**:data-[slot=content]:min-h-[100px]!" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</flux:card>
|
</flux:card>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user