import{i as g}from"./emotion-use-insertion-effect-with-fallbacks.browser.esm-2ce7a1bc.js";import{j as c,a as i}from"./Tooltip-5ec3092e.js";import{F as w}from"./Tabla-fe3d1310.js";import{A as T,h,m as o,O as n}from"./index-50f78195.js";const{useCallback:P,useContext:y,useEffect:m,useState:q}=await g("react"),D=N=>{const{empresaActual:d}=y(T),[e,p]=q({title:"Etiquetas",tabla:"wftag",campoId:"TagId",configuracion:{permiteBorrar:!1},query:{name:"TagId",type:"supercombobox",dominio:"",tabla:"wftag, wfproc, wftar",id:"TagId",text:"TagNom",where:"wftag.ProcId = wfproc.ProcId AND wftag.TarId = wftar.TarId",otrosCampos:"wftag.*, wfproc.ProcNom, wftar.TarNom",ordenBy:"wftag.TagId",whereCallback:()=>`wfproc.EmpId = ${d?.empId}`,limit:""},columnas:[{visible:!1,esId:!0,name:"TagId",disabled:!0,label:"Identificador",type:"number"},{visible:!0,name:"TagNom",disabled:!1,label:"Nombre",type:"text"},{visible:!0,disabled:!1,label:"Proceso",name:"ProcId",type:"supercombobox",tabla:"wfproc p, wfseq s, wfcomerprc w",id:"p.ProcId",text:"p.ProcNom",dominio:"",otrosCampos:"s.TarId, p.*,s.SeqId",where:'p.ProcId = s.ProcId and s.SeqOrd = 1 AND s.SeqTip  in("SEQ","AUT") AND w.ProcId = p.ProcId',whereCallback:()=>`p.EmpId = ${d?.empId}`,groupBy:"p.ProcId",recargaAlAbrir:!0},{visible:!0,disabled:!1,label:"Tarea",name:"TarId",type:"supercombobox",tabla:"wftar t, wfseq q",id:"t.TarId",text:"t.TarNom",dominio:"",otrosCampos:"t.*, q.ProcId",where:"t.TarId = q.TarId",whereAdicion:"",groupBy:"t.TarId",recargaAlAbrir:!0,valueDependency:{dependentField:"ProcId",depententQueryFilter:"q.ProcId = @[ProcId]"}}],tablaColDef:[{field:"TagId",headerName:"Identificador",type:"number",width:120,align:"right",headerAlign:"right"},{field:"TagNom",headerName:"Nombre",type:"string",width:320,align:"left",headerAlign:"left"},{field:"ProcNom",headerName:"Proceso",type:"string",width:320,align:"left",headerAlign:"left"},{field:"TarNom",headerName:"Tarea",type:"string",width:270,align:"left",headerAlign:"left"}],filtros:[]}),{control:l,getValues:s,watch:f,resetField:I}=h({mode:"onChange",defaultValues:{ProcId:"",TarId:""}}),[r,t]=f(["ProcId","TarId"]);m(()=>{p(a=>({...a,query:{...a.query,whereAdicion:u()}}))},[r,t]),m(()=>{I("TarId")},[r]);const u=P(()=>{const a=[];return o.isTruthy(r)&&a.push(`wfproc.ProcId = ${r}`),o.isTruthy(t)&&a.push(`wftar.TarId = ${t}`),o.formateaCondicionesWhere(a)},[r,t]),b={id:"ProcId",name:"ProcId",text:"ProcNom",tabla:"wfproc",where:`wfproc.EmpId = ${d?.empId}`,type:"supercombobox"};return c("div",{children:[c("form",{children:[i(n,{control:l,name:"ProcId",type:"supercombobox",iField:b,label:"Proceso"}),i(n,{control:l,name:"TarId",type:"supercombobox",iField:{label:"Tarea",name:"TarId",type:"supercombobox",tabla:"wftar t, wfseq q",id:"t.TarId",text:"t.TarNom",otrosCampos:"t.*, q.ProcId, q.SeqOrd",where:"t.TarId = q.TarId",groupBy:"t.TarId",recargaAlAbrir:!0,whereCallback(){return o.isTruthy(s("ProcId"))?`q.ProcId = ${s("ProcId")}`:""},ordenBy:"q.SeqOrd"},label:"Tarea",disabled:!o.isTruthy(r)})]}),i(w,{tabla:e.tabla,title:e.title,configuracion:e.configuracion,query:e.query,columnasData:e.columnas,tablaColDef:e.tablaColDef,campoId:e.campoId,filtros:e.filtros})]})};export{D as default};
