parfum/resources/views/livewire/studio/loyalty/voucher/form.blade.php

157 lines
9.2 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 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:field>
<flux:label>Nama <span class="text-red-500 ms-1">*</span></flux:label>
<flux:input placeholder="SELAMAT DATANG" wire:model="form.name" autofocus
autocomplete="off" />
<flux:error name="form.name" />
</flux:field>
<flux:field>
<flux:label>Kode <span class="text-red-500 ms-1">*</span></flux:label>
<flux:input placeholder="WELCOME" wire:model="form.code" autocomplete="off"
copyable oninput="this.value = this.value.toUpperCase()" />
<flux:error name="form.code" />
</flux:field>
<div class="lg:col-span-2">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<flux:field>
<flux:label>Tags <span class="text-red-500 ms-1">*</span></flux:label>
<flux:input placeholder="Member Baru" wire:model="form.tags"
autocomplete="off" />
<flux:error name="form.tags" />
</flux:field>
<flux:field>
<flux:label>Min. Belanja</flux:label>
<flux:input.group>
<flux:input.group.prefix>Rp</flux:input.group.prefix>
<flux:input placeholder="10.000"
x-mask:dynamic="$money($input, ',')"
wire:model="form.min_purchase" autocomplete="off" />
</flux:input.group>
<flux:error name="form.min_purchase" />
</flux:field>
<flux:input label="Kuota" placeholder="100" wire:model="form.quota"
x-mask:dynamic="$money($input, ',')" autocomplete="off" />
<flux:input label="Batas Per Customer" placeholder="1"
wire:model="form.limit_per_user" x-mask:dynamic="$money($input, ',')"
autocomplete="off" />
</div>
</div>
<div class="md:col-span-2">
<flux:field>
<flux:label>Ringkasan <span class="text-red-500 ms-1">*</span></flux:label>
<flux:input placeholder="Diskon 10% untuk member baru"
wire:model="form.summary" autofocus autocomplete="off" />
<flux:error name="form.summary" />
</flux:field>
</div>
<flux:field>
<flux:label>Tanggal Mulai <span class="text-red-500 ms-1">*</span></flux:label>
<flux:date-picker with-today wire:model="form.start_date"
placeholder="Pilih Tanggal" autocomplete="off" locale="id-ID" />
<flux:error name="form.start_date" />
</flux:field>
<flux:date-picker with-today label="Tanggal Selesai" wire:model="form.end_date"
placeholder="Pilih Tanggal" autocomplete="off" locale="id-ID" />
</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:field>
<flux:label>Jumlah Diskon <span class="text-red-500 ms-1">*</span></flux:label>
<flux:radio.group wire:model="form.type" variant="buttons" class="w-full *:flex-1">
@foreach (\App\Enums\VoucherType::cases() as $item)
<flux:radio value="{{ $item->value }}">
{{ $item->label() }}
</flux:radio>
@endforeach
</flux:radio.group>
<flux:error name="form.type" />
</flux:field>
<flux:field>
<flux:label>Jumlah Diskon <span class="text-red-500 ms-1">*</span></flux:label>
<flux:input.group>
@if ($form->type == \App\Enums\VoucherType::FIXED->value)
<flux:input.group.prefix>Rp</flux:input.group.prefix>
<flux:input placeholder="10.000" x-mask:dynamic="$money($input, ',')"
wire:model="form.discount_amount" autocomplete="off" />
@else
<flux:input placeholder="5" wire:model="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 <span class="text-red-500 ms-1">*</span></flux:label>
<flux:input.group>
<flux:input.group.prefix>Rp</flux:input.group.prefix>
<flux:input placeholder="10.000" x-mask:dynamic="$money($input, ',')"
wire:model="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:field>
<flux:label>Outlet <span class="text-red-500 ms-1">*</span></flux:label>
<flux:select variant="listbox" multiple searchable placeholder="Pilih Outlet"
wire:model="form.outlet_ids">
<flux:select.option wire:click="selectAllOutlets" wire:ignore>Pilih Semua
</flux:select.option>
<flux:select.option wire:click="deselectAllOutlets" wire:ignore>Hapus Semua
</flux:select.option>
@foreach ($outlets as $key => $value)
<flux:select.option value="{{ $key }}">{{ $value }}
</flux:select.option>
@endforeach
</flux:select>
<flux:error name="form.outlet_ids" />
</flux:field>
</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>