import{r as t,A as g,h as w,m as d,o as n,j as l,O as p}from"./index-62412d73.js";import{F as T}from"./Tabla-7ec861ea.js";import"./Edit-b0ca90dc.js";import"./ListItemIcon-db4667b4.js";import"./cjs-450adfd1.js";import"./env-198ff0f3.js";import"./NoRowsComponent-60007845.js";import"./Alert-00e531f3.js";const D=h=>{const{empresaActual:e}=t.useContext(g),[r,m]=t.useState({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 = ${e==null?void 0:e.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 = ${e==null?void 0:e.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:s,getValues:c,watch:f,resetField:I}=w({mode:"onChange",defaultValues:{ProcId:"",TarId:""}}),[o,i]=f(["ProcId","TarId"]);t.useEffect(()=>{m(a=>({...a,query:{...a.query,whereAdicion:u()}}))},[o,i]),t.useEffect(()=>{I("TarId")},[o]);const u=t.useCallback(()=>{const a=[];return d.isTruthy(o)&&a.push(`wfproc.ProcId = ${o}`),d.isTruthy(i)&&a.push(`wftar.TarId = ${i}`),d.formateaCondicionesWhere(a)},[o,i]),b={id:"ProcId",name:"ProcId",text:"ProcNom",tabla:"wfproc",where:`wfproc.EmpId = ${e==null?void 0:e.empId}`,type:"supercombobox"};return n("div",{children:[n("form",{children:[l(p,{control:s,name:"ProcId",type:"supercombobox",iField:b,label:"Proceso"}),l(p,{control:s,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 d.isTruthy(c("ProcId"))?`q.ProcId = ${c("ProcId")}`:""},ordenBy:"q.SeqOrd"},label:"Tarea",disabled:!d.isTruthy(o)})]}),l(T,{tabla:r.tabla,title:r.title,configuracion:r.configuracion,query:r.query,columnasData:r.columnas,tablaColDef:r.tablaColDef,campoId:r.campoId,filtros:r.filtros})]})};export{D as default};
