feat: Make voucher tier IDs required, update its form UI, and simplify outlet display in the vouchers table.
This commit is contained in:
parent
0800503453
commit
a2042c918d
@ -84,15 +84,9 @@ public function columns(): array
|
|||||||
|
|
||||||
ArrayColumn::make('Outlet')
|
ArrayColumn::make('Outlet')
|
||||||
->data(
|
->data(
|
||||||
fn ($value, $row) => $row->outlets->map(fn ($outlet) => [
|
fn ($value, $row) => $row->outlets->pluck('name')->toArray()
|
||||||
'name' => $outlet->name,
|
|
||||||
'stock' => formatCurrencyNumber($outlet->pivot->stock, ''),
|
|
||||||
])->toArray()
|
|
||||||
)
|
)
|
||||||
->outputFormat(fn ($index, $value) => Blade::render('
|
->outputFormat(fn ($index, $value) => Blade::render('<span class="text-xs text-gray-400 border border-gray-400 rounded px-1">'.$value.'</span>'))
|
||||||
<div class="flex items-center space-x-2 bg-gray-50 border border-gray-200 rounded-lg px-2 py-1 text-xs">
|
|
||||||
<span class="font-medium text-gray-700">{{ $value["name"] }}</span>
|
|
||||||
</div>', ['value' => $value]))
|
|
||||||
->flexRow(['class' => 'gap-2 flex-wrap']),
|
->flexRow(['class' => 'gap-2 flex-wrap']),
|
||||||
|
|
||||||
Column::make('Visibilitas', 'is_show')
|
Column::make('Visibilitas', 'is_show')
|
||||||
|
|||||||
@ -78,7 +78,7 @@ public function rules(): array
|
|||||||
'summary' => ['required', 'string', 'max:200'],
|
'summary' => ['required', 'string', 'max:200'],
|
||||||
'start_date' => ['required', 'date', 'after:yesterday'],
|
'start_date' => ['required', 'date', 'after:yesterday'],
|
||||||
'end_date' => ['nullable', 'date', 'after_or_equal:start_date'],
|
'end_date' => ['nullable', 'date', 'after_or_equal:start_date'],
|
||||||
'tier_ids' => ['nullable', 'array'],
|
'tier_ids' => ['required', 'array', 'min:1'],
|
||||||
'tier_ids.*' => Rule::exists('tiers', 'id'),
|
'tier_ids.*' => Rule::exists('tiers', 'id'),
|
||||||
'outlet_ids' => ['required', 'array', 'min:1'],
|
'outlet_ids' => ['required', 'array', 'min:1'],
|
||||||
'outlet_ids.*' => Rule::exists('outlets', 'id'),
|
'outlet_ids.*' => Rule::exists('outlets', 'id'),
|
||||||
|
|||||||
@ -41,22 +41,22 @@
|
|||||||
</flux:field>
|
</flux:field>
|
||||||
|
|
||||||
<flux:field>
|
<flux:field>
|
||||||
<flux:label>Min. Belanja</flux:label>
|
<flux:label>Min. Belanja</flux:label>
|
||||||
<flux:input.group>
|
<flux:input.group>
|
||||||
<flux:input.group.prefix>Rp</flux:input.group.prefix>
|
<flux:input.group.prefix>Rp</flux:input.group.prefix>
|
||||||
<flux:input placeholder="10.000"
|
<flux:input placeholder="10.000"
|
||||||
x-mask:dynamic="$money($input, ',')"
|
x-mask:dynamic="$money($input, ',')"
|
||||||
wire:model="form.min_purchase" autocomplete="off" />
|
wire:model="form.min_purchase" autocomplete="off" />
|
||||||
</flux:input.group>
|
</flux:input.group>
|
||||||
<flux:error name="form.min_purchase" />
|
<flux:error name="form.min_purchase" />
|
||||||
</flux:field>
|
</flux:field>
|
||||||
|
|
||||||
<flux:input label="Kuota" placeholder="100" wire:model="form.quota"
|
<flux:input label="Kuota" placeholder="100" wire:model="form.quota"
|
||||||
x-mask:dynamic="$money($input, ',')" autocomplete="off" />
|
x-mask:dynamic="$money($input, ',')" autocomplete="off" />
|
||||||
|
|
||||||
<flux:input label="Batas Per Customer" placeholder="1"
|
<flux:input label="Batas Per Customer" placeholder="1"
|
||||||
wire:model="form.limit_per_user" x-mask:dynamic="$money($input, ',')"
|
wire:model="form.limit_per_user" x-mask:dynamic="$money($input, ',')"
|
||||||
autocomplete="off" />
|
autocomplete="off" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -144,11 +144,12 @@
|
|||||||
</flux:field>
|
</flux:field>
|
||||||
|
|
||||||
<flux:field>
|
<flux:field>
|
||||||
<flux:label>Tier</flux:label>
|
<flux:label>Tier <span class="text-red-500 ms-1">*</span></flux:label>
|
||||||
<flux:description>Jika tidak memilih, maka voucher berlaku tanpa membatasi tier.</flux:description>
|
<flux:select placeholder="Pilih Tier" wire:model="form.tier_ids" multiple searchable
|
||||||
<flux:select placeholder="Pilih Tier" wire:model="form.tier_ids" multiple searchable variant="listbox">
|
variant="listbox">
|
||||||
@foreach ($tiers as $key => $value)
|
@foreach ($tiers as $key => $value)
|
||||||
<flux:select.option value="{{ $key }}">{{ $value }}</flux:select.option>
|
<flux:select.option value="{{ $key }}">{{ $value }}
|
||||||
|
</flux:select.option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</flux:select>
|
</flux:select>
|
||||||
<flux:error name="form.tier_ids" />
|
<flux:error name="form.tier_ids" />
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user