<?php $__env->startSection('titulo','Equipo'); ?>
<?php $__env->startSection('contenido'); ?>
<?php $editando = (bool) $registro->id; ?>
<h4><i class="fa fa-gear"></i> <?php echo e($editando?'Editar':'Nuevo'); ?> equipo</h4>
<form method="POST" enctype="multipart/form-data"
      action="<?php echo e($editando ? route('equipos.update',$registro) : route('equipos.store')); ?>" class="card p-3">
  <?php echo csrf_field(); ?> <?php if($editando): ?> <?php echo method_field('PUT'); ?> <?php endif; ?>
  <div class="row g-3">
    <div class="col-md-4"><label class="form-label small">Área *</label>
      <select name="area_id" class="form-select" required>
        <option value="">—</option>
        <?php $__currentLoopData = $areas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $a): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($a->id); ?>" <?php if(old('area_id',$registro->area_id)==$a->id): echo 'selected'; endif; ?>><?php echo e($a->nombre); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
      </select></div>
    <div class="col-md-4"><label class="form-label small">Sistema</label>
      <select name="sistema_id" class="form-select">
        <option value="">—</option>
        <?php $__currentLoopData = $sistemas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($s->id); ?>" <?php if(old('sistema_id',$registro->sistema_id)==$s->id): echo 'selected'; endif; ?>><?php echo e($s->nombre); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
      </select></div>
    <div class="col-md-4"><label class="form-label small">Código *</label>
      <input name="codigo" value="<?php echo e(old('codigo',$registro->codigo)); ?>" class="form-control" required></div>
    <div class="col-md-12"><label class="form-label small">Nombre *</label>
      <input name="nombre" value="<?php echo e(old('nombre',$registro->nombre)); ?>" class="form-control" required></div>
    <div class="col-md-4"><label class="form-label small">Marca</label>
      <input name="marca" value="<?php echo e(old('marca',$registro->marca)); ?>" class="form-control"></div>
    <div class="col-md-4"><label class="form-label small">Modelo</label>
      <input name="modelo" value="<?php echo e(old('modelo',$registro->modelo)); ?>" class="form-control"></div>
    <div class="col-md-4"><label class="form-label small">Serie</label>
      <input name="serie" value="<?php echo e(old('serie',$registro->serie)); ?>" class="form-control"></div>
    <div class="col-md-6"><label class="form-label small">Ubicación</label>
      <input name="ubicacion" value="<?php echo e(old('ubicacion',$registro->ubicacion)); ?>" class="form-control"></div>
    <div class="col-md-3"><label class="form-label small">Instalación</label>
      <input type="date" name="fecha_instalacion" value="<?php echo e(old('fecha_instalacion',optional($registro->fecha_instalacion)->format('Y-m-d'))); ?>" class="form-control"></div>
    <div class="col-md-3"><label class="form-label small">Horómetro actual</label>
      <input type="number" step="0.01" name="horometro_actual" value="<?php echo e(old('horometro_actual',$registro->horometro_actual)); ?>" class="form-control"></div>
    <div class="col-md-12"><label class="form-label small">Descripción</label>
      <textarea name="descripcion" class="form-control" rows="2"><?php echo e(old('descripcion',$registro->descripcion)); ?></textarea></div>
    <div class="col-md-6"><label class="form-label small">Imagen del equipo</label>
      <input type="file" name="imagen" accept="image/*" class="form-control">
      <?php if($registro->imagen): ?><img src="<?php echo e(asset('storage/'.$registro->imagen)); ?>" class="mt-2" style="max-height:100px;"><?php endif; ?>
    </div>
    <div class="col-md-3 d-flex align-items-end">
      <div class="form-check form-switch">
        <input type="hidden" name="activo" value="0">
        <input type="checkbox" name="activo" value="1" class="form-check-input" <?php echo e(old('activo',$registro->activo??1)?'checked':''); ?>>
        <label class="form-check-label">Activo</label>
      </div>
    </div>
  </div>
  <div class="mt-3 text-end">
    <a href="<?php echo e(route('equipos.index')); ?>" class="btn btn-outline-secondary">Cancelar</a>
    <button class="btn btn-primario"><i class="fa fa-save"></i> Guardar</button>
  </div>
</form>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\mto\resources\views/catalogos/equipos_form.blade.php ENDPATH**/ ?>