112 lines
5.4 KiB
PHP
112 lines
5.4 KiB
PHP
<flux:main>
|
|
<div class="flex justify-between items-center">
|
|
<div>
|
|
<flux:heading size="xl">{{ $pageTitle }}</flux:heading>
|
|
</div>
|
|
@can('create formula')
|
|
<div>
|
|
<flux:modal.trigger name="form-modal">
|
|
<flux:button variant="primary" class="text-sm"
|
|
wire:click="$dispatch('modal:open', {method: 'create', 'modalTitle': 'Tambah Rumus'})">Tambah
|
|
</flux:button>
|
|
</flux:modal.trigger>
|
|
</div>
|
|
@endcan
|
|
</div>
|
|
|
|
<div class="mt-6">
|
|
@if (!empty($formulas))
|
|
<div class="mt-6 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
|
|
@foreach ($formulas as $key => $formula)
|
|
<flux:card class="space-y-2">
|
|
<div class="mb-4 pb-3 border-b border-gray-200">
|
|
<flux:heading size="xl" class="flex items-center gap-2">
|
|
<flux:badge color="blue" size="lg">{{ $key }} ml</flux:badge>
|
|
</flux:heading>
|
|
</div>
|
|
@foreach ($formula as $item)
|
|
<flux:callout variant="secondary" inline>
|
|
<div class="flex items-center space-x-1">
|
|
<flux:callout.heading>{{ $item['quality'] }}</flux:callout.heading>
|
|
<flux:text class="text-xs text-gray-400">({{ $item['volume'] }} ml)</flux:text>
|
|
</div>
|
|
|
|
<x-slot name="actions">
|
|
<flux:modal.trigger name="form-modal">
|
|
<flux:tooltip content="Ubah">
|
|
<flux:button variant="primary" color="yellow" icon="pencil-square"
|
|
size="sm"
|
|
wire:click="$dispatch('modal:open', {method: 'update', 'modalTitle': 'Ubah Rumus', 'id': '{{ $item['hash'] }}'})">
|
|
</flux:button>
|
|
</flux:tooltip>
|
|
</flux:modal.trigger>
|
|
<flux:modal.trigger name="delete">
|
|
<flux:tooltip content="Hapus">
|
|
<flux:button variant="danger" icon="trash" size="sm"
|
|
wire:click="$dispatch('fn:confirmAction', {id: '{{ $item['hash'] }}'})">
|
|
</flux:button>
|
|
</flux:tooltip>
|
|
</flux:modal.trigger>
|
|
</x-slot>
|
|
</flux:callout>
|
|
@endforeach
|
|
</flux:card>
|
|
@endforeach
|
|
</div>
|
|
@else
|
|
@include('components.lottie.not-found')
|
|
@endif
|
|
</div>
|
|
|
|
@include('components.confirmation.delete')
|
|
<flux:modal name="form-modal" class="w-[95%] max-w-sm md:max-w-xl mx-auto" @close="closeModal('form-modal')">
|
|
<div class="p-4 space-y-6">
|
|
<flux:heading size="lg">{{ $modalTitle }}</flux:heading>
|
|
|
|
<flux:field>
|
|
<flux:label>Kualitas <span class="text-red-500 ms-1">*</span></flux:label>
|
|
<flux:select variant="listbox" searchable placeholder="Pilih Kualitas"
|
|
wire:model.live.debounce.500ms="form.quality">
|
|
@foreach ($qualities as $key => $value)
|
|
<flux:select.option value="{{ $value }}">{{ $value }}
|
|
</flux:select.option>
|
|
@endforeach
|
|
</flux:select>
|
|
<flux:error name="form.quality" />
|
|
</flux:field>
|
|
|
|
<flux:field>
|
|
<flux:label>Ukuran <span class="text-red-500 ms-1">*</span></flux:label>
|
|
<flux:select variant="listbox" searchable placeholder="Pilih Ukuran"
|
|
wire:model.live.debounce.500ms="form.size">
|
|
@foreach ($sizes as $key => $value)
|
|
<flux:select.option value="{{ $value }}">{{ $value }} ml
|
|
</flux:select.option>
|
|
@endforeach
|
|
</flux:select>
|
|
<flux:error name="form.size" />
|
|
</flux:field>
|
|
|
|
<flux:field>
|
|
<flux:label>Volume <span class="text-red-500 ms-1">*</span></flux:label>
|
|
<flux:input.group>
|
|
<flux:input placeholder="20" x-mask:dynamic="$money($input, ',')"
|
|
wire:model.live.debounce.500ms="form.volume" autocomplete="off" />
|
|
<flux:input.group.suffix>ml</flux:input.group.suffix>
|
|
</flux:input.group>
|
|
<flux:error name="form.volume" />
|
|
</flux:field>
|
|
|
|
<div class="flex">
|
|
<flux:spacer />
|
|
<flux:button variant="primary" class="sm:w-auto cursor-pointer" wire:click="{{ $method }}">
|
|
Simpan
|
|
</flux:button>
|
|
</div>
|
|
</div>
|
|
</flux:modal>
|
|
</flux:main>
|
|
@assets
|
|
<script src="https://unpkg.com/@lottiefiles/dotlottie-wc@0.8.5/dist/dotlottie-wc.js" type="module"></script>
|
|
@endassets
|