fix
This commit is contained in:
38
resources/views/components/forms/button.blade.php
Normal file
38
resources/views/components/forms/button.blade.php
Normal file
@@ -0,0 +1,38 @@
|
||||
@props([
|
||||
'type' => $attributes->get('type') ?? 'button',
|
||||
'disabled' => null,
|
||||
'confirm' => null,
|
||||
'confirmAction' => null,
|
||||
'tooltip' => null,
|
||||
])
|
||||
@isset($tooltip)
|
||||
<div class="tooltip tooltip-warning" data-tip="{{ $tooltip }}">
|
||||
@endisset
|
||||
@if ($type === 'submit')
|
||||
<button {{ $attributes }} type="submit" @if ($disabled !== null) disabled @endif wire:target="submit"
|
||||
wire:loading.delay.shorter.class="loading"
|
||||
@isset($confirm)
|
||||
x-on:click="toggleConfirmModal('{{ $confirm }}', '{{ explode('(', $confirmAction)[0] }}')"
|
||||
@endisset
|
||||
@isset($confirmAction)
|
||||
x-on:{{ explode('(', $confirmAction)[0] }}.window="$wire.{{ explode('(', $confirmAction)[0] }}"
|
||||
@endisset>
|
||||
{{ $slot }}
|
||||
</button>
|
||||
@elseif($type === 'button')
|
||||
<button {{ $attributes }} @if ($disabled !== null) disabled @endif type="button"
|
||||
wire:target="{{ explode('(', $attributes->whereStartsWith('wire:click')->first())[0] }}"
|
||||
wire:loading.delay.shorter.class="loading"
|
||||
@isset($confirm)
|
||||
x-on:click="toggleConfirmModal('{{ $confirm }}', '{{ explode('(', $confirmAction)[0] }}')"
|
||||
@endisset
|
||||
@isset($confirmAction)
|
||||
x-on:{{ explode('(', $confirmAction)[0] }}.window="$wire.{{ explode('(', $confirmAction)[0] }}"
|
||||
@endisset>
|
||||
{{ $slot }}
|
||||
</button>
|
||||
@endif
|
||||
|
||||
@isset($tooltip)
|
||||
</div>
|
||||
@endisset
|
||||
40
resources/views/components/forms/checkbox.blade.php
Normal file
40
resources/views/components/forms/checkbox.blade.php
Normal file
@@ -0,0 +1,40 @@
|
||||
@props([
|
||||
'id' => $attributes->has('id') || $attributes->has('label'),
|
||||
'required' => $attributes->has('required'),
|
||||
'label' => $attributes->has('label'),
|
||||
'helper' => $attributes->has('helper'),
|
||||
'instantSave' => $attributes->has('instantSave'),
|
||||
'noLabel' => $attributes->has('noLabel'),
|
||||
'noDirty' => $attributes->has('noDirty'),
|
||||
'disabled' => null,
|
||||
])
|
||||
<label {{ $attributes->merge(['class' => 'flex cursor-pointer w-64 label']) }}>
|
||||
<div class="label-text">
|
||||
@if ($label)
|
||||
{{ $label }}
|
||||
@else
|
||||
{{ $id }}
|
||||
@endif
|
||||
@if ($helper)
|
||||
<div class="-mb-1 dropdown dropdown-right dropdown-hover">
|
||||
<label tabindex="0" class="cursor-pointer text-warning">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
||||
class="w-4 h-4 stroke-current">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
||||
</svg>
|
||||
</label>
|
||||
<div tabindex="0"
|
||||
class="border rounded shadow border-coolgray-400 card compact dropdown-content bg-coolgray-200 w-96">
|
||||
<div class="card-body">
|
||||
{!! $helper !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="flex-1"></div>
|
||||
<input type="checkbox" @if ($disabled !== null) disabled @endif name={{ $id }}
|
||||
@if (!$noDirty) wire:dirty.class="input-warning" @endif
|
||||
@if ($instantSave) wire:click='instantSave' wire:model.defer={{ $id }} @else wire:model.defer={{ $value ?? $id }} @endif />
|
||||
</label>
|
||||
48
resources/views/components/forms/input.blade.php
Normal file
48
resources/views/components/forms/input.blade.php
Normal file
@@ -0,0 +1,48 @@
|
||||
@props([
|
||||
'id' => $attributes->has('id'),
|
||||
'type' => $attributes->get('type') ?? 'text',
|
||||
'label' => $attributes->has('label'),
|
||||
'required' => null,
|
||||
'disabled' => null,
|
||||
'helper' => $attributes->has('helper'),
|
||||
'noDirty' => $attributes->has('noDirty'),
|
||||
])
|
||||
<div {{ $attributes->merge(['class' => 'w-full form-control']) }}>
|
||||
@if ($label)
|
||||
<label class="label">
|
||||
<span class="label-text">
|
||||
{{ $label }}
|
||||
@if ($required)
|
||||
<span class="text-warning">*</span>
|
||||
@endif
|
||||
@if ($helper)
|
||||
<div class="-mb-1 dropdown dropdown-right dropdown-hover">
|
||||
<label tabindex="0" class="cursor-pointer text-warning">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
||||
class="w-4 h-4 stroke-current">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
||||
</svg>
|
||||
</label>
|
||||
<div tabindex="0"
|
||||
class="border rounded shadow border-coolgray-400 card compact dropdown-content bg-coolgray-200 w-96">
|
||||
<div class="card-body">
|
||||
{!! $helper !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</span>
|
||||
</label>
|
||||
@endif
|
||||
<input type={{ $type }}
|
||||
@if ($id) name={{ $id }} wire:model.defer={{ $id }} @endisset
|
||||
@if ($disabled !== null) disabled @endif
|
||||
@if ($required !== null) required @endif
|
||||
@if (!$noDirty && $id) wire:dirty.class="input-warning" @endif {{ $attributes }} />
|
||||
@error($id)
|
||||
<label class="label">
|
||||
<span class="text-red-500 label-text-alt">{{ $message }}</span>
|
||||
</label>
|
||||
@enderror
|
||||
</div>
|
||||
25
resources/views/components/forms/select.blade.php
Normal file
25
resources/views/components/forms/select.blade.php
Normal file
@@ -0,0 +1,25 @@
|
||||
@props([
|
||||
'id' => null,
|
||||
'label' => null,
|
||||
'required' => false,
|
||||
])
|
||||
|
||||
<span {{ $attributes->merge(['class' => 'flex flex-col']) }}>
|
||||
<label for={{ $id }}>
|
||||
@if ($label)
|
||||
{{ $label }}
|
||||
@else
|
||||
{{ $id }}
|
||||
@endif
|
||||
@if ($required)
|
||||
<span class="text-warning">*</span>
|
||||
@endif
|
||||
</label>
|
||||
<select {{ $attributes }} wire:model.defer={{ $id }}>
|
||||
{{ $slot }}
|
||||
</select>
|
||||
|
||||
@error($id)
|
||||
<div class="text-red-500">{{ $message }}</div>
|
||||
@enderror
|
||||
</span>
|
||||
50
resources/views/components/forms/textarea.blade.php
Normal file
50
resources/views/components/forms/textarea.blade.php
Normal file
@@ -0,0 +1,50 @@
|
||||
@props([
|
||||
'id' => $attributes->has('id') || $attributes->has('label'),
|
||||
'required' => $attributes->has('required'),
|
||||
'label' => $attributes->has('label'),
|
||||
'helper' => $attributes->has('helper'),
|
||||
'instantSave' => $attributes->has('instantSave'),
|
||||
'noLabel' => $attributes->has('noLabel'),
|
||||
'noDirty' => $attributes->has('noDirty'),
|
||||
])
|
||||
|
||||
<div class=" form-control">
|
||||
@if (!$noLabel)
|
||||
<label class="label">
|
||||
<span class="label-text">
|
||||
@if ($label)
|
||||
{{ $label }}
|
||||
@else
|
||||
{{ $id }}
|
||||
@endif
|
||||
@if ($required)
|
||||
<span class="text-warning">*</span>
|
||||
@endif
|
||||
@if ($helper)
|
||||
<div class="dropdown dropdown-right">
|
||||
<label tabindex="0" class="btn btn-circle btn-ghost btn-xs text-warning">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
||||
class="w-4 h-4 stroke-current">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
||||
</svg>
|
||||
</label>
|
||||
<div tabindex="0"
|
||||
class="w-64 border-2 shadow border-coolgray-500 card compact dropdown-content bg-coolgray-200 ">
|
||||
<div class="card-body">
|
||||
{{ $helper }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</span>
|
||||
</label>
|
||||
@endif
|
||||
<textarea {{ $attributes }} name={{ $id }} wire:model.defer={{ $value ?? $id }}
|
||||
@if (!$noDirty) wire:dirty.class="input-warning" @endif></textarea>
|
||||
@error($id)
|
||||
<label class="label">
|
||||
<span class="text-red-500 label-text-alt">{{ $message }}</span>
|
||||
</label>
|
||||
@enderror
|
||||
</div>
|
||||
Reference in New Issue
Block a user