-menambahkan enum untuk tipe diskon persentase atau fixed -membuat tabel, form, migrasi, model dll sesuai dengan kebutuhan fitur
139 lines
7.5 KiB
PHP
139 lines
7.5 KiB
PHP
<flux:main>
|
|
<div class="flex justify-between items-center">
|
|
<div>
|
|
<flux:heading size="xl">{{ $pageTitle }}</flux:heading>
|
|
</div>
|
|
<div>
|
|
<flux:button href="{{ route('studio.loyalty.voucher.index') }}" wire:navigate.hover class="text-sm">
|
|
Kembali
|
|
</flux:button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-6">
|
|
<div class="flex flex-col gap-4">
|
|
<div class="flex flex-col lg:flex-row gap-4">
|
|
<div class="w-full lg:w-3/4 space-y-4">
|
|
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2 items-start">
|
|
<div class="col-span-1 lg:col-span-2">
|
|
<flux:card class="space-y-6 p-6">
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<flux:input label="Nama" placeholder="Masukkan nama voucher"
|
|
wire:model.live.debounce.500ms="form.name" autofocus autocomplete="off" />
|
|
|
|
<flux:input label="Kode" placeholder="Masukkan kode voucher"
|
|
wire:model.live.debounce.500ms="form.code" autofocus autocomplete="off"
|
|
copyable />
|
|
|
|
<div class="lg:col-span-2">
|
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
|
<flux:field>
|
|
<flux:label>Min. Belanja</flux:label>
|
|
<flux:input.group>
|
|
<flux:input.group.prefix>Rp</flux:input.group.prefix>
|
|
<flux:input placeholder="Masukkan minimal belanja"
|
|
x-mask:dynamic="$money($input, ',')"
|
|
wire:model.live.debounce.500ms="form.min_purchase"
|
|
autocomplete="off" />
|
|
</flux:input.group>
|
|
<flux:error name="form.min_purchase" />
|
|
</flux:field>
|
|
|
|
<flux:input label="Kuota" placeholder="Masukkan kuota"
|
|
wire:model.live.debounce.500ms="form.quota"
|
|
x-mask:dynamic="$money($input, ',')" autocomplete="off" />
|
|
|
|
<flux:input label="Batas Per Pembeli"
|
|
placeholder="Masukkan batas per pembeli"
|
|
wire:model.live.debounce.500ms="form.limit_per_user"
|
|
x-mask:dynamic="$money($input, ',')" autocomplete="off" />
|
|
</div>
|
|
</div>
|
|
|
|
<flux:date-picker label="Tanggal Mulai" with-today
|
|
wire:model.live.debounce.500ms="form.start_date" autocomplete="off"
|
|
locale="id-ID" />
|
|
|
|
<flux:date-picker label="Tanggal Selesai"
|
|
wire:model.live.debounce.500ms="form.end_date" autocomplete="off"
|
|
locale="id-ID" />
|
|
|
|
<div class="md:col-span-2">
|
|
<flux:editor label="Syarat dan Ketentuan" wire:model="form.terms_conditions"
|
|
placeholder="Masukkan syarat dan ketentuan" auotocomplete="off"
|
|
class="**:data-[slot=content]:min-h-[100px]!" />
|
|
</div>
|
|
</div>
|
|
</flux:card>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="w-full lg:w-1/3 space-y-4">
|
|
<flux:card class="space-y-2 p-6">
|
|
<flux:radio.group wire:model.live="form.type" variant="buttons" class="w-full *:flex-1"
|
|
label="Jumlah Diskon">
|
|
@foreach (\App\Enums\VoucherType::cases() as $item)
|
|
<flux:radio value="{{ $item->value }}" icon="{{ $item->icon() }}">
|
|
{{ $item->label() }}
|
|
</flux:radio>
|
|
@endforeach
|
|
</flux:radio.group>
|
|
|
|
<flux:field>
|
|
<flux:input.group>
|
|
@if ($form->type == \App\Enums\VoucherType::FIXED->value)
|
|
<flux:input.group.prefix>Rp</flux:input.group.prefix>
|
|
|
|
<flux:input placeholder="Masukkan Jumlah Diskon"
|
|
x-mask:dynamic="$money($input, ',')"
|
|
wire:model.live.debounce.500ms="form.discount_amount" autocomplete="off" />
|
|
@else
|
|
<flux:input placeholder="Masukkan Jumlah Diskon"
|
|
wire:model.live.debounce.500ms="form.discount_amount" autocomplete="off" />
|
|
|
|
<flux:input.group.suffix>%</flux:input.group.suffix>
|
|
@endif
|
|
</flux:input.group>
|
|
|
|
<flux:error name="form.discount_amount" />
|
|
</flux:field>
|
|
|
|
@if ($form->type == \App\Enums\VoucherType::PERCENTAGE->value)
|
|
<flux:field>
|
|
<flux:label>Maks. Diskon</flux:label>
|
|
<flux:input.group>
|
|
<flux:input.group.prefix>Rp</flux:input.group.prefix>
|
|
|
|
<flux:input placeholder="Masukkan maksimal diskon"
|
|
x-mask:dynamic="$money($input, ',')"
|
|
wire:model.live.debounce.500ms="form.max_discount" autocomplete="off" />
|
|
</flux:input.group>
|
|
|
|
<flux:error name="form.max_discount" />
|
|
</flux:field>
|
|
@endif
|
|
</flux:card>
|
|
|
|
<flux:card class="space-y-6 p-6">
|
|
<flux:radio.group wire:model.live="form.is_active" variant="buttons" class="w-full *:flex-1"
|
|
label="Aktif?">
|
|
@foreach (\App\Enums\IsActive::cases() as $item)
|
|
<flux:radio value="{{ $item->value }}" icon="{{ $item->icon() }}">
|
|
{{ $item->label() }}
|
|
</flux:radio>
|
|
@endforeach
|
|
</flux:radio.group>
|
|
</flux:card>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex justify-start">
|
|
<flux:button variant="primary" class="sm:w-auto cursor-pointer" wire:click="save">
|
|
Simpan
|
|
</flux:button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</flux:main>
|