import{r as t,A as g,d as w,aT as d,f as n,j as l,bR as p}from"./index-ca24af84.js";import{F as T}from"./Tabla-a272f202.js";import"./NoRowsComponent-10f615cd.js";import"./DataGrid-e816acb7.js";import"./toPropertyKey-4015efc6.js";import"./dividerClasses-fa4eeeba.js";import"./listItemTextClasses-9e4a600e.js";import"./ListItemIcon-2dd9a578.js";import"./cjs-8bb62be0.js";import"./env-198ff0f3.js";const B=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:b()}}))},[o,i]),t.useEffect(()=>{I("TarId")},[o]);const b=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]),u={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:u,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{B as default};
