refactor(product): update cost and sale price handling in form and mask cost price display
This commit is contained in:
parent
2219534a73
commit
afa7323002
@ -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;
|
||||
@ -37,7 +38,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(),
|
||||
|
||||
|
||||
@ -111,8 +111,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),
|
||||
'description' => $this->description,
|
||||
'outlet_ids' => $this->outlet_ids,
|
||||
'image' => $this->image,
|
||||
|
||||
@ -20,15 +20,15 @@
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<flux:field>
|
||||
<flux:label>Nama <span class="text-red-500 ms-1">*</span></flux:label>
|
||||
<flux:input placeholder="Masukkan nama produk"
|
||||
<flux:input placeholder="Contoh: Air Zam Zam"
|
||||
wire:model.live.debounce.500ms="form.name" autofocus autocomplete="off" />
|
||||
<flux:error name="form.name" />
|
||||
</flux:field>
|
||||
|
||||
<flux:field>
|
||||
<flux:label>SKU <span class="text-red-500 ms-1">*</span></flux:label>
|
||||
<flux:input placeholder="Masukkan stock keeping unit"
|
||||
wire:model.live.debounce.500ms="form.sku" autocomplete="off" copyable />
|
||||
<flux:input placeholder="Contoh: 001" wire:model.live.debounce.500ms="form.sku"
|
||||
autocomplete="off" copyable />
|
||||
<flux:error name="form.sku" />
|
||||
</flux:field>
|
||||
|
||||
@ -56,8 +56,8 @@
|
||||
|
||||
<div class="md:col-span-2">
|
||||
<flux:editor label="Deskripsi" wire:model="form.description"
|
||||
placeholder="Masukkan deskripsi" auotocomplete="off"
|
||||
class="**:data-[slot=content]:min-h-[100px]!" />
|
||||
placeholder="Air Zamzam adalah air suci yang berasal dari sumur Zamzam di Masjidil Haram, Makkah, Arab Saudi"
|
||||
auotocomplete="off" class="**:data-[slot=content]:min-h-[100px]!" />
|
||||
</div>
|
||||
</div>
|
||||
</flux:card>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user