parfum/resources/views/livewire/studio/master/outlet/form.blade.php
2025-11-09 19:30:11 +07:00

214 lines
13 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.master.outlet.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:field>
<flux:label>Nama
<span class="text-red-500 ms-1">*</span>
</flux:label>
<flux:input placeholder="Toko 1" wire:model.live.debounce.500ms="form.name"
autofocus autocomplete="off" />
<flux:error name="form.name" />
</flux:field>
<flux:field>
<flux:label>Nomor Telepon
<span class="text-red-500 ms-1">*</span>
</flux:label>
<flux:input placeholder="0821 xxxx xxxx" mask="9999 9999 99999"
wire:model.live.debounce.500ms="form.phone_number" autocomplete="off" />
<flux:error name="form.phone_number" />
</flux:field>
<div class="md:col-span-2">
<flux:field>
<flux:label>Alamat
<span class="text-red-500 ms-1">*</span>
</flux:label>
<flux:textarea
placeholder="Jl. Taman Pahlawan No.41, Nagri Kaler, Kec. Purwakarta, Kabupaten Purwakarta, Jawa Barat 41119"
wire:model.live.debounce.500ms="form.address" autocomplete="off"
rows="2" />
<flux:error name="form.address" />
</flux:field>
</div>
<flux:field>
<flux:label>Patokan
<span class="text-red-500 ms-1">*</span>
</flux:label>
<flux:input placeholder="Samping Gacoan"
wire:model.live.debounce.500ms="form.landmark" autocomplete="off" />
<flux:error name="form.landmark" />
</flux:field>
<flux:input label="Titik Maps"
placeholder="https://maps.app.goo.gl/n1u88DfvpuNJmfCJ7"
wire:model.live.debounce.500ms="form.maps_url" autocomplete="off" />
<flux:field>
<flux:label>Tanggal Buka
<span class="text-red-500 ms-1">*</span>
</flux:label>
<flux:date-picker with-today wire:model.live.debounce.500ms="form.opened_date"
placeholder="Pilih Tanggal" autocomplete="off" locale="id-ID" />
<flux:error name="form.opened_date" />
</flux:field>
<flux:field>
<flux:label>Status
<span class="text-red-500 ms-1">*</span>
</flux:label>
<flux:radio.group wire:model.live="form.status" variant="buttons"
class="w-full *:flex-1">
@foreach (\App\Enums\OutletStatus::cases() as $status)
<flux:radio value="{{ $status->value }}">
{{ $status->label() }}
</flux:radio>
@endforeach
</flux:radio.group>
<flux:error name="form.status" />
</flux:field>
</div>
</flux:card>
</div>
<flux:card class="space-y-6 p-6">
<div class="space-y-3">
<h3 class="text-sm font-medium">Gambar Utama <span class="text-red-500 ms-1">*</span>
</h3>
<div class="dropzone-wrapper">
<livewire:dropzone wire:model="form.featured_image" :rules="['image', 'mimes:png,jpeg', 'max:10420']"
:max-files="1" :key="'featured_image'" :files="$form->featured_image" />
@error('form.featured_image')
<div role="alert" aria-live="polite" aria-atomic="true"
class="mt-3 text-sm font-medium text-red-500 dark:text-red-400">
<svg class="shrink-0 [:where(&amp;)]:size-5 inline" data-flux-icon=""
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"
aria-hidden="true" data-slot="icon">
<path fill-rule="evenodd"
d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"
clip-rule="evenodd"></path>
</svg>
{{ $message }}
</div>
@enderror
</div>
</div>
</flux:card>
<flux:card class="space-y-6 p-6">
<div class="space-y-3">
<h3 class="text-sm font-medium">Gambar <span class="text-red-500 ms-1">*</span></h3>
<div class="dropzone-wrapper">
<livewire:dropzone wire:model="form.images" :rules="['image', 'mimes:png,jpeg', 'max:10420']" :max-files="5"
:key="'images'" :multiple="true" :files="$form->images" />
@error('form.images')
<div role="alert" aria-live="polite" aria-atomic="true"
class="mt-3 text-sm font-medium text-red-500 dark:text-red-400">
<svg class="shrink-0 [:where(&amp;)]:size-5 inline" data-flux-icon=""
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"
aria-hidden="true" data-slot="icon">
<path fill-rule="evenodd"
d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"
clip-rule="evenodd"></path>
</svg>
{{ $message }}
</div>
@enderror
</div>
</div>
</flux:card>
</div>
</div>
<div class="w-full lg:w-1/3 space-y-4">
<flux:card class="space-y-6 p-6">
<flux:field class="space-y-2">
<flux:label>Jam Operasional</flux:label>
<flux:description>Kosongkan jika outlet tidak beroperasi.</flux:description>
@foreach ($days as $day)
<div class="grid grid-cols-1 md:grid-cols-3 gap-2 items-center">
<span class="text-sm">{{ $day->label() }}</span>
<flux:input type="time"
wire:model.live.debounce.500ms="form.opening_hours.{{ $day->value }}.open_time" />
<flux:input type="time"
wire:model.live.debounce.500ms="form.opening_hours.{{ $day->value }}.close_time" />
</div>
@endforeach
</flux:field>
</flux:card>
<flux:card class="space-y-6 p-6">
<div class="space-y-2">
<h3 class="text-sm font-medium">Fasilitas</h3>
@foreach ($form->facilities as $index => $facility)
<div class="flex gap-2 items-center">
<flux:input wire:model.live.debounce.500ms="form.facilities.{{ $index }}"
placeholder="Parkir" class="flex-1" autocomplete="off" />
@if ($index != 0)
<flux:button variant="danger" icon="trash"
wire:click="removeFacility({{ $index }})"
class="cursor-pointer" />
@endif
</div>
@error("form.facilities.$index")
<flux:error name="form.facilities.{{ $index }}" />
@enderror
@endforeach
@error('form.facilities')
<div role="alert" aria-live="polite" aria-atomic="true"
class="mt-3 text-sm font-medium text-red-500 dark:text-red-400" data-flux-error="">
<svg class="shrink-0 [:where(&amp;)]:size-5 inline" data-flux-icon=""
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"
aria-hidden="true" data-slot="icon">
<path fill-rule="evenodd"
d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"
clip-rule="evenodd"></path>
</svg>
{{ $message }}
</div>
@enderror
<flux:button variant="primary" size="sm" wire:click="addFacility"
class="sm:w-auto cursor-pointer">
+ Tambah Fasilitas
</flux:button>
</div>
</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>