@extends('layouts.app') @section('titulo','Orden de trabajo') @section('contenido') @php $editando = (bool) $orden->id; @endphp

{{ $editando?'Editar':'Nueva' }} orden ({{ ucfirst($orden->clase) }})

@csrf @if($editando) @method('PUT') @endif
Cancelar
@push('scripts_inline') (function () { const planSel = document.querySelector('select[name="plan_id"]'); if (!planSel) return; const areaSel = document.querySelector('select[name="area_id"]'); const equipoSel = document.querySelector('select[name="equipo_id"]'); const respSel = document.querySelector('select[name="responsable_id"]'); const setVal = (sel, val) => { if (!sel || val === '' || val == null) return; if (sel.tomselect) sel.tomselect.setValue(String(val), true); else sel.value = String(val); }; const llenar = () => { const opt = planSel.options[planSel.selectedIndex]; if (!opt || !opt.value) return; setVal(areaSel, opt.dataset.area); setVal(equipoSel, opt.dataset.equipo); if (respSel && !respSel.value && opt.dataset.responsable) { setVal(respSel, opt.dataset.responsable); } }; planSel.addEventListener('change', llenar); })(); @endpush @endsection