coolify/resources/views/components/forms/input.blade.php

68 lines
3.2 KiB
PHP
Raw Normal View History

2023-05-03 14:09:10 +02:00
@props([
2023-05-25 14:05:44 +02:00
'id' => $attributes->has('id'),
2023-05-18 13:26:35 +02:00
'type' => $attributes->get('type') ?? 'text',
2023-05-05 10:13:43 +02:00
'label' => $attributes->has('label'),
2023-06-07 21:44:16 +02:00
'readonly' => null,
2023-05-25 14:05:44 +02:00
'required' => null,
'disabled' => null,
2023-05-17 15:46:20 +02:00
'helper' => $attributes->has('helper'),
2023-05-05 10:13:43 +02:00
'noDirty' => $attributes->has('noDirty'),
2023-05-03 14:09:10 +02:00
])
2023-05-18 13:26:35 +02:00
<div {{ $attributes->merge(['class' => 'w-full form-control']) }}>
2023-05-25 14:05:44 +02:00
@if ($label)
2023-05-17 15:46:20 +02:00
<label class="label">
2023-06-07 21:44:16 +02:00
<span class="flex gap-1 label-text">
2023-05-25 14:05:44 +02:00
{{ $label }}
2023-05-17 15:46:20 +02:00
@if ($required)
<span class="text-warning">*</span>
@endif
@if ($helper)
2023-06-07 21:44:16 +02:00
<div class="group">
<div class="cursor-pointer text-warning">
2023-05-17 15:46:20 +02:00
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
2023-05-18 13:49:49 +02:00
class="w-4 h-4 stroke-current">
2023-05-17 15:46:20 +02:00
<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>
2023-06-07 21:44:16 +02:00
</div>
<div class="absolute hidden text-xs group-hover:block border-coolgray-400 bg-coolgray-500">
<div class="p-4 card-body">
2023-05-18 13:49:49 +02:00
{!! $helper !!}
2023-05-17 15:46:20 +02:00
</div>
</div>
</div>
@endif
</span>
2023-05-05 09:28:00 +02:00
</label>
@endif
2023-06-12 22:30:47 +02:00
@if ($type === 'password')
<div class="join" x-data>
<input class="w-full border-r-0 rounded-l join-item" type={{ $type }}
@if ($id) id={{ $id }} name={{ $id }} wire:model.defer={{ $id }} @endisset
2023-05-25 14:05:44 +02:00
@if ($disabled !== null) disabled @endif
2023-06-12 22:30:47 +02:00
@if ($required !== null) required @endif @if ($readonly !== null) readonly @endif
@if (!$noDirty && $id) wire:dirty.class="input-warning" @endif {{ $attributes }} />
2023-06-13 10:11:11 +02:00
<span x-on:click="changePasswordFieldType('{{ $id }}')" x-cloak
class="border-l-0 border-none rounded-r hover:bg-coolgray-200 no-animation h-7 btn join-item btn-xs bg-coolgray-200 "><svg
xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 icon" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
<path d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6" />
</svg></span>
2023-06-12 22:30:47 +02:00
</div>
@else
<input type={{ $type }}
@if ($id) name={{ $id }} wire:model.defer={{ $id }} @endisset
@if ($disabled !== null) disabled @endif
@if ($required !== null) required @endif @if ($readonly !== null) readonly @endif
@if (!$noDirty && $id) wire:dirty.class="input-warning" @endif {{ $attributes }} />
@endif
2023-04-25 14:43:35 +02:00
@error($id)
2023-05-17 15:46:20 +02:00
<label class="label">
<span class="text-red-500 label-text-alt">{{ $message }}</span>
</label>
2023-04-25 14:43:35 +02:00
@enderror
2023-05-17 15:46:20 +02:00
</div>