57 lines
4.9 KiB
PHP
57 lines
4.9 KiB
PHP
<div>
|
|
<div class="mb-6">
|
|
<h1 class="text-2xl font-bold text-gray-900">Gestione Zone</h1>
|
|
</div>
|
|
|
|
|
|
<div class="bg-white rounded-xl shadow-sm border border-gray-200 p-4 mb-4 max-w-lg">
|
|
<form wire:submit="addZona" class="flex items-end gap-3">
|
|
<div class="flex-1">
|
|
<label for="nuovaZona" class="block text-sm font-medium text-gray-700">Nuova Zona</label>
|
|
<input wire:model="nuovaZona" type="text" id="nuovaZona" placeholder="Nome zona..." class="mt-1 block w-full rounded-lg border-gray-300 shadow-sm focus:ring-indigo-500 focus:border-indigo-500 text-sm">
|
|
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['nuovaZona'];
|
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
|
if ($__bag->has($__errorArgs[0])) :
|
|
if (isset($message)) { $__messageOriginal = $message; }
|
|
$message = $__bag->first($__errorArgs[0]); ?> <p class="text-red-500 text-xs mt-1"><?php echo e($message); ?></p> <?php unset($message);
|
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
|
endif;
|
|
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
|
</div>
|
|
<button type="submit" class="px-4 py-2 text-sm font-medium text-white bg-indigo-600 rounded-lg hover:bg-indigo-700 transition">Aggiungi</button>
|
|
</form>
|
|
</div>
|
|
|
|
|
|
<div class="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden max-w-lg">
|
|
<ul class="divide-y divide-gray-200">
|
|
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $zone; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $zona): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
|
|
<li class="px-4 py-3 flex items-center justify-between hover:bg-gray-50">
|
|
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($editingId === $zona->id): ?>
|
|
<form wire:submit="saveEdit" class="flex items-center gap-2 flex-1">
|
|
<input wire:model="editingNome" type="text" class="flex-1 rounded-lg border-gray-300 text-sm focus:ring-indigo-500 focus:border-indigo-500">
|
|
<button type="submit" class="text-green-600 hover:text-green-800 text-xs font-medium">Salva</button>
|
|
<button type="button" wire:click="cancelEdit" class="text-gray-500 hover:text-gray-700 text-xs">Annulla</button>
|
|
</form>
|
|
<?php else: ?>
|
|
<div class="flex items-center gap-2">
|
|
<span class="text-sm font-medium <?php echo e($zona->attivo ? 'text-gray-900' : 'text-gray-400 line-through'); ?>"><?php echo e($zona->nome); ?></span>
|
|
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(!$zona->attivo): ?>
|
|
<span class="text-xs text-gray-400">(inattiva)</span>
|
|
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
|
<span class="text-xs text-gray-400"><?php echo e($zona->territori()->count()); ?> territori</span>
|
|
</div>
|
|
<div class="flex items-center gap-2">
|
|
<button wire:click="startEdit(<?php echo e($zona->id); ?>)" class="text-yellow-600 hover:text-yellow-800 text-xs">Rinomina</button>
|
|
<button wire:click="toggleActive(<?php echo e($zona->id); ?>)" class="text-xs <?php echo e($zona->attivo ? 'text-gray-500' : 'text-green-600'); ?>"><?php echo e($zona->attivo ? 'Disattiva' : 'Attiva'); ?></button>
|
|
<button wire:click="deleteZona(<?php echo e($zona->id); ?>)" wire:confirm="Eliminare la zona '<?php echo e($zona->nome); ?>'?" class="text-red-500 hover:text-red-700 text-xs">Elimina</button>
|
|
</div>
|
|
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
|
</li>
|
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
|
|
<li class="px-4 py-6 text-center text-gray-500 text-sm">Nessuna zona configurata.</li>
|
|
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<?php /**PATH /var/www/html/resources/views/livewire/settings/zone-index.blade.php ENDPATH**/ ?>
|