@imj_media/tareas 0.1.29 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tareas.cjs +1 -1
- package/dist/tareas.es.js +101 -98
- package/package.json +2 -2
package/dist/tareas.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");require("@imj_media/imj-ui/styles.css");const P=require("@tanstack/react-query"),c=require("react"),w=require("@imj_media/tasks-modules"),G=require("react-dom"),je=require("axios"),ye=require("qs"),V=require("date-fns"),Z=require("date-fns/locale"),S=require("@imj_media/imj-ui"),$e=require("react-hook-form"),ze=require("primereact/paginator"),Re=({label:a,active:s,onClick:n,disabled:t})=>t?e.jsx(w.Tooltip,{dispatch:e.jsxs("button",{className:"text-texts-placeholder text-xs font-semibold cursor-help",children:[" ",a," "]}),children:e.jsx("div",{className:"flex items-center justify-center px-3 py-2 bg-bg-card rounded-lg border border-border-card",children:e.jsx("p",{className:"text-texts-placeholder text-xs font-semibold",children:"Espéralo muy pronto..."})})}):e.jsx("button",{disabled:t,onClick:n,className:`${s?"text-texts-enfasis border-b-2 border-texts-enfasis":""} text-xs font-semibold ${t?"cursor-not-allowed text-texts-placeholder":"text-texts-subtext"} `,children:a}),Le=({tabs:a,renderItem:s,initialTab:n})=>{const[t,r]=c.useState(n??a[0].toLowerCase());c.useEffect(()=>{n&&r(n)},[n]);const l=i=>{r(i),s(i)};return e.jsx("div",{className:"flex",children:a.map((i,d)=>e.jsx("div",{className:`${d===0?"border-l-2":""} border-r-2 border-gray-200 px-m`,children:e.jsx(Re,{onClick:()=>l(i.toLowerCase()),label:i,active:i.toLowerCase()===t,disabled:["gantt"].includes(i.toLowerCase())},d)}))})},v={bg:{DEFAULT:"#EFEFEF",content:"#FAFAFA",card:"#FAFAFA"},texts:{DEFAULT:"#252525",enfasis:"#3658c1",subtext:"#4f4f4f",placeholder:"#929292"},primary:{light:"#E7E9F2",medium:"#dae2ec",dark:"#334990",regular:"#425CAC",pastel:"#5c7ddd"},success:{light:"#368156",medium:"#D2E9DC",dark:"#368156",regular:"#43B071",pastel:"#57BA81"},danger:{light:"#F1E5E4",medium:"#EBDBD9",dark:"#8C352C",regular:"#C34335",pastel:"#C43355"},warning:{light:"#F2ECE5",medium:"#EBE3D9",dark:"#B4782F",regular:"#D38A31",pastel:"#D38A31"},alert:{light:"#F1F1E4",medium:"#EAE9D9",dark:"#ADA63A",regular:"#D6CC48",pastel:"#D6CC48"},info:{light:"#E7F5FF",medium:"#D9E6EE",dark:"#1C5073",regular:"#1B6698",pastel:"#1B6698"},link:{light:"#ECF8FE",medium:"#D8F1FD",dark:"#0A7AAE",regular:"#0EA5E9",pastel:"#0EA5E9"}},ee=()=>{const[a,s]=c.useState(null);return{position:a,setElementPosition:l=>{var g;let i=(g=l.current)==null?void 0:g.getBoundingClientRect(),d=(i==null?void 0:i.x)+((i==null?void 0:i.width)??0),o=(i==null?void 0:i.y)+(i==null?void 0:i.height);s(a?null:{x:d??0,y:o??0})},getChildrenSize:l=>{var i;return(i=l.current)==null?void 0:i.getBoundingClientRect()},clearPosition:()=>{s(null)}}},Be=({children:a,filterChildren:s})=>{const{position:n,setElementPosition:t}=ee(),r=c.useRef(null),l=({children:i})=>{const[d,o]=c.useState();return c.useEffect(()=>{var g,u;s.current&&o(((n==null?void 0:n.x)??0)-(((u=(g=s.current)==null?void 0:g.getBoundingClientRect())==null?void 0:u.width)??0))},[s==null?void 0:s.current,n==null?void 0:n.x]),n&&G.createPortal(e.jsx("div",{className:`absolute w-fit h-fit ${d?"block":"hidden"}`,style:{top:`${n==null?void 0:n.y}px`,left:`${d}px`,zIndex:1},children:i}),document.body)};return e.jsxs(e.Fragment,{children:[e.jsxs("label",{ref:r,htmlFor:"filter-button",className:"flex cursor-pointer items-center gap-m p-s text-texts-enfasis fill-texts-enfasis bg-bg rounded-lg px-l h-[30px] shadow-button-primary hover:shadow-button-primary-hover ",children:[e.jsx(w.Icons,{icon:"filter",size:"xs",strokeWidth:5,color:v.primary.regular}),"Filtrar"]}),e.jsx("button",{className:"hidden",id:"filter-button",onClick:()=>{t(r)}}),e.jsx(l,{children:a})]})},ge=a=>{let s={};return Object.entries(a).forEach(([n,t])=>{if(n.includes(".")){let[r,l]=n.split(".");s[r]=s[r]||{},s[r][l]=t}else s[n]=t}),s},we=c.createContext({}),Ke=({children:a})=>{const[s,n]=c.useState({}),[t,r]=c.useState({}),[l,i]=c.useState([]),[d,o]=c.useState(""),g=({name:x,value:f})=>{function m(N){return!isNaN(N)&&N!==null&&N!==""?parseFloat(N):null}let j=m(f);r(N=>{let _={...N},F=l==null?void 0:l.find(h=>h.label.toLowerCase().replace(/ /g,"_")===x);return F?_[F.id]=j??f:_[x]=j??f,_})};c.useEffect(()=>{let x=l.map(f=>f.id==="owner.config"?[f.id,"yo_y_mis_equipos"]:f.id==="dependency"?[f.id,"ambas"]:[f.id,null]);r(Object.fromEntries(x))},[l]);const u=()=>{let x=l.map(f=>f.id==="owner.config"?[f.id,"yo_y_mis_equipos"]:f.id==="dependency"?[f.id,"ambas"]:[f.id,null]);r(Object.fromEntries(x)),n(ge(Object.fromEntries(x)))},b=()=>{let x=ge(t);console.log({filtersWithEstructure:x}),n(x)};return e.jsx(we.Provider,{value:{fields:l,filters:s,path:d,defineFields:i,updateFilters:g,cleanFilters:u,applyFilters:b,initialFilters:t,selectPath:o},children:a})},$=()=>c.useContext(we);function ve(a,s=300,n={leading:!1,trailing:!0}){let t,r=null;return function(...l){const i=Date.now(),d=n.leading&&!r;clearTimeout(t),d&&a(...l),r=i,t=setTimeout(()=>{n.trailing&&(!n.leading||i-r>=s)&&(a(...l),r=null)},s)}}const Qe=()=>{const{fields:a,updateFilters:s,cleanFilters:n,applyFilters:t,initialFilters:r}=$();return e.jsxs("div",{className:"flex flex-col gap-l min-w-[250px] z-[100]",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("p",{className:"text-texts text-m",children:"Filtros"}),e.jsx("button",{className:"text-xs font-semibold flex cursor-pointer items-center gap-m p-s text-texts-enfasis fill-texts-enfasis bg-bg rounded-lg px-l h-fit shadow-button-primary hover:shadow-button-primary-hover ",onClick:n,children:"Limpiar"})]}),e.jsx("div",{className:"flex flex-col gap-m",children:a==null?void 0:a.map((l,i)=>{var d;return e.jsxs("div",{children:[e.jsx("p",{className:"text-sm",children:l.label}),(l==null?void 0:l.type)==="select"?e.jsx("select",{onChange:o=>{var g,u;s({name:(g=o==null?void 0:o.target)==null?void 0:g.name,value:(u=o==null?void 0:o.target)==null?void 0:u.value})},value:r==null?void 0:r[l==null?void 0:l.id],className:"w-full h-[30px] shadow-input rounded-lg p-s",name:l.id,id:l.id,children:(d=l==null?void 0:l.options)==null?void 0:d.map((o,g)=>e.jsx("option",{value:o.id,children:o.name},g))}):e.jsx("input",{className:"w-full h-[30px] shadow-input rounded-lg p-s",type:l.type,value:r==null?void 0:r[l==null?void 0:l.id],name:l.label.toLowerCase().replace(/ /g,"_"),onChange:ve(o=>{var g,u;return s({name:(g=o==null?void 0:o.target)==null?void 0:g.name,value:(u=o==null?void 0:o.target)==null?void 0:u.value})},1e3)})]},i)})}),e.jsx("button",{className:"btn-primary rounded-md py-s",onClick:t,children:"Filtrar"})]})},O=a=>{const s=t=>Object.prototype.toString.call(t)==="[object Object]",n=t=>t.attributes?{id:t.id,...t.attributes}:t;if(Array.isArray(a))return a.map(t=>O(t));if(s(a)){Array.isArray(a.data)?a=[...a.data]:s(a.data)?a=n({...a.data}):a.data===null?a=null:a=n(a);for(const t in a)a[t]=O(a[t]);return a}return a};class We{static toCampaignTasks(s){var t,r,l,i,d,o,g,u,b,x,f,m;let n=[];return s!=null&&s.responsable&&n.push({id:s.responsable.id,name:s.responsable.nombre,image:(d=(i=(l=(r=(t=s.responsable)==null?void 0:t.userOBP)==null?void 0:r.imagen)==null?void 0:l.formats)==null?void 0:i.thumbnail)==null?void 0:d.url}),console.log("task",s),(o=s==null?void 0:s.equipo)!=null&&o.miembros&&s.equipo.miembros.forEach(j=>{var N,_,F,h;n!=null&&n.find(y=>y.id===j.idUser.id)||j.idUser&&n.push({id:j.idUser.id,name:j.idUser.nombre,image:(h=(F=(_=(N=j==null?void 0:j.userOBP)==null?void 0:N.imagen)==null?void 0:_.formats)==null?void 0:F.thumbnail)==null?void 0:h.url})}),{isPrincipalTask:(s==null?void 0:s.tarea_principal)??!1,projectName:((g=s==null?void 0:s.proyecto)==null?void 0:g.nombre)??null,orden:(s==null?void 0:s.orden)??null,id:(s==null?void 0:s.id)??null,task:(s==null?void 0:s.texto_corto)??null,status:(s==null?void 0:s.estatus)??null,difficulty:(s==null?void 0:s.nivel_dificultad)??null,priority:(s==null?void 0:s.prioridad)??0,endDate:new Date((s==null?void 0:s.ffin)??null),startDate:new Date((s==null?void 0:s.finicio)??null),mediumName:(s==null?void 0:s.nombre_medio)??null,users:n,repeatsToDo:(s==null?void 0:s.repeticiones)??null,repeats:(s==null?void 0:s.repeticiones_realizadas)??null,comments:((u=s==null?void 0:s.comentarios)==null?void 0:u.length)??null,willBePaused:s==null?void 0:s.es_pausable,statusRequiredTask:((b=s==null?void 0:s.id_t_requerida)==null?void 0:b.estatus)??null,nameRequiredTask:((x=s==null?void 0:s.id_t_requerida)==null?void 0:x.texto_corto)??null,responsible:((f=s==null?void 0:s.responsable)==null?void 0:f.id)??null,tasks:((m=s==null?void 0:s.tareas)==null?void 0:m.map(j=>({id:j.id,name:j.texto_corto,status:j.estatus})))??null}}}const Oe=async({filters:a,tasks_api:s,project:n})=>{try{const t=await s.get("/api/listado_tareas_flujo",{params:{...a,project:{id:n},includeAllTasks:!0}});return O(t.data.tareas).map(We.toCampaignTasks)}catch(t){console.log(t)}},Ne=c.createContext({}),Ue=({children:a,user:s,url:n})=>{const t=je.create({baseURL:n,headers:{Authorization:`Bearer ${s.accessToken}`},paramsSerializer:r=>ye.stringify(r,{encodeValuesOnly:!0})});return e.jsx(Ne.Provider,{value:{tasks_api:t},children:a})},z=()=>c.useContext(Ne),Ce=c.createContext({}),ke=({children:a,user:s,url:n})=>{const t=je.create({baseURL:n,headers:{Authorization:`Bearer ${s.accessToken}`},paramsSerializer:r=>ye.stringify(r,{encodeValuesOnly:!0})});return e.jsx(Ce.Provider,{value:{user:s,tasks_api:t},children:a})},Q=()=>c.useContext(Ce),_e=c.createContext({}),He=({children:a,project:s})=>{var N;const n=P.useQueryClient(),[t,r]=c.useState([]),[l,i]=c.useState([]),{tasks_api:d}=z(),{filters:o}=$(),{user:g}=Q(),[u,b]=c.useState({owner:{user:g.id,config:((N=o==null?void 0:o.owner)==null?void 0:N.config)??"yo_y_mis_equipos"},project:{id:s}}),x=P.useQuery({queryKey:["tasksProject",o,s],queryFn:()=>Oe({filters:{...u},project:s,tasks_api:d})});c.useEffect(()=>{var _;Object.keys(o).length>0&&b({...o,owner:{user:g.id,config:((_=o==null?void 0:o.owner)==null?void 0:_.config)??"yo_y_mis_equipos"},project:{id:s}})},[o]),c.useEffect(()=>{n.invalidateQueries({queryKey:["tasksProject",o,s]})},[u]);const f=_=>{r(F=>[...F,_])},m=_=>{i(F=>F.includes(_)?F.filter(h=>h!==_):[...F,_])},j=s??null;return e.jsx(_e.Provider,{value:{tasksProject:x,selectedTasks:t,projectID:j,openTasks:l,selectTask:f,openTask:m},children:a})},H=()=>c.useContext(_e),Ve=[{label:"Tipo de dependencia",type:"select",id:"dependency",options:[{id:"con",name:"Con dependencia"},{id:"sin",name:"Sin dependencia"},{id:"ambas",name:"Ambas"}]},{label:"Por responsable",type:"select",id:"owner.config",options:[{id:"yo",name:"Mis tareas"},{id:"yo_y_mis_equipos",name:"Tareas mías y de mis equipos"},{id:"mis_equipos",name:"Tareas de mis equipos"}]},{label:"Por dificultad",type:"select",id:"difficulty",options:[{id:0,name:"Muy facil"},{id:1,name:"Facil"},{id:2,name:"Media"},{id:3,name:"Dificil"},{id:4,name:"Muy dificil"}]}],Y=()=>{const{tasks_api:a}=z(),{user:s}=Q(),{filters:n,path:t}=$(),r=P.useQueryClient(),{projectID:l}=H(),i=async({id:h})=>(await a.put(`/api/tareas/${h}`,{data:{estatus:1,responsable:s==null?void 0:s.id,updated_by:s==null?void 0:s.id}})).data,d=async({id:h})=>(await a.post("/api/terminarTarea",{id_task:h,ended_at:new Date().toISOString(),id_user:s==null?void 0:s.id})).data,o=async({id:h,repeats:y})=>(await a.put(`/api/tareas/${h}`,{data:{repeticiones_realizadas:y,updated_by:s==null?void 0:s.id}})).data,g=async({id:h,idNewResponsible:y,typeOfSelect:C})=>{let D={updated_by:s==null?void 0:s.id};return C==="responsible"&&(D={...D,responsable:y}),C==="team"&&(D={...D,responsable:null,equipo:y}),(await a.put(`/api/tareas/${h}`,{data:D})).data},u=async({id:h,data:y,user:C})=>{},b=async({id:h})=>{await x({id:h})},{mutateAsync:x}=P.useMutation({mutationFn:i,onSuccess:()=>{const h={"kanban-general":"to_do_tasks","kanban-campania":"tasksProject"};try{t==="kanban-general"&&(r.invalidateQueries({queryKey:[h[t],n]}),r.invalidateQueries({queryKey:["working_tasks",n]})),t==="kanban-campania"&&(r.invalidateQueries({queryKey:["tasksProject"]}),r.invalidateQueries({queryKey:["tasksProject",n,l]}))}catch(y){console.error("Error updating the element:",y)}},onError:h=>{console.error("Failed to update the task.",h)},onMutate:async({id:h})=>{await r.cancelQueries({queryKey:["working_tasks"]}),await r.cancelQueries({queryKey:["to_do_tasks"]})}}),{mutateAsync:f}=P.useMutation({mutationFn:d,onSuccess:()=>{const h={"kanban-general":"to_do_tasks","kanban-campania":"tasksProject"};try{r.setQueryData([h[t],n],y=>{console.log({oldData:y})}),t==="kanban-general"&&(r.invalidateQueries({queryKey:[h[t],n]}),r.invalidateQueries({queryKey:["done_tasks",n]}),r.invalidateQueries({queryKey:["working_tasks",n]})),t==="kanban-campania"&&(r.invalidateQueries({queryKey:["tasksProject"]}),r.invalidateQueries({queryKey:["tasksProject",n,l]}))}catch(y){console.error("Error invalidating queries:",y)}},onError:h=>{console.error("Failed to update the task.",h)},onMutate:async({id:h})=>{await r.cancelQueries({queryKey:["working_tasks"]}),await r.cancelQueries({queryKey:["done_tasks"]}),await r.cancelQueries({queryKey:["to_do_tasks"]})}}),{mutateAsync:m}=P.useMutation({mutationFn:o,onSuccess:()=>{const h={"kanban-general":"to_do_tasks","kanban-campania":"tasksProject"};try{t==="kanban-general"&&(r.invalidateQueries({queryKey:[h[t],n]}),r.invalidateQueries({queryKey:["done_tasks",n]}),r.invalidateQueries({queryKey:["working_tasks",n]})),t==="kanban-campania"&&(r.invalidateQueries({queryKey:["tasksProject"]}),r.invalidateQueries({queryKey:["tasksProject",n,l]}))}catch(y){console.error("Error invalidating queries:",y)}},onError:h=>{console.error("Failed to update the task.",h)},onMutate:async({id:h})=>{await r.cancelQueries({queryKey:["working_tasks"]}),await r.cancelQueries({queryKey:["done_tasks"]}),await r.cancelQueries({queryKey:["to_do_tasks"]})}}),{mutateAsync:j}=P.useMutation({mutationFn:g,onSuccess:()=>{const h={"kanban-general":"to_do_tasks","kanban-campania":"tasksProject"};try{t==="kanban-general"&&(r.invalidateQueries({queryKey:[h[t],n]}),r.invalidateQueries({queryKey:["done_tasks",n]}),r.invalidateQueries({queryKey:["working_tasks",n]})),t==="kanban-campania"&&(r.invalidateQueries({queryKey:["tasksProject"]}),r.invalidateQueries({queryKey:["tasksProject",n,l]}))}catch(y){console.error("Error invalidating queries:",y)}},onError:h=>{console.error("Failed to reassign the task.",h)},onMutate:async({id:h})=>{await r.cancelQueries({queryKey:["working_tasks"]}),await r.cancelQueries({queryKey:["done_tasks"]}),await r.cancelQueries({queryKey:["to_do_tasks"]})}});return{updateTask:u,startWorking:b,completeTask:async({id:h})=>{await f({id:h})},reasignResponsible:async({id:h,idNewResponsible:y,typeOfSelect:C})=>{await j({id:h,idNewResponsible:y,typeOfSelect:C})},updateUnitys:async({repeats:h,id:y})=>{await m({repeats:h,id:y})}}},Ge=({id:a})=>{const[s,n]=c.useState(!1),{completeTask:t}=Y();return{checked:s,checkTask:()=>{n(!s),t({id:a})}}},Fe=({id:a,nameRequiredTask:s,statusRequiredTask:n,status:t})=>{const{checked:r,checkTask:l}=Ge({id:a});let i=Math.random().toString();return e.jsxs(e.Fragment,{children:[t===2&&e.jsx("div",{className:"bg-success-regular rounded-full flex items-center justify-center mx-[2px] transition-all",children:e.jsx(w.Icons,{icon:"circle_checked",color:"white",strokeWidth:4,size:"xs"})}),s!==""&&n===2||!s?t===1?e.jsx("label",{htmlFor:i,className:r?"bg-success-regular rounded-full w-[20px] h-[20px] flex items-center justify-center mx-[2px] transition-all":" transition-colors",children:e.jsx(w.Icons,{icon:r?"check_outline":"circle_checked",color:r?"white":v.texts.placeholder,strokeWidth:4,size:r?"xs":"s"})}):e.jsx(e.Fragment,{children:" "}):e.jsx(w.Tooltip,{dispatch:e.jsx("label",{className:"cursor-help",children:e.jsx(w.Icons,{icon:"info_circle",color:v.warning.regular,strokeWidth:4})}),children:e.jsxs("div",{className:" p-l max-w-[400px] w-fit bg-warning-light rounded-lg border-l-[5px] border-warning-regular text-warning-dark text-xs flex flex-col gap-m",children:[e.jsx("p",{className:"font-bold",children:" Requiere completar su tarea requerida: "}),e.jsxs("p",{children:[" ",s," "]})]})}),e.jsx("input",{id:i,checked:r,onChange:l,type:"checkbox",className:"hidden"})]})},U=({imageUrl:a="https://www.uv.unach.mx/assets/img/prueba/directorio/userM.png",alt:s="avatar"})=>e.jsx("img",{src:a===""?"https://www.uv.unach.mx/assets/img/prueba/directorio/userM.png":a,alt:s??"avatar",className:"w-[28px] h-[28px] min-w-[28px] min-h-[28px] rounded-full bg-containers border-2 border-white"}),he=({trigger:a,user:s,showUser:n=!0})=>e.jsx(w.Tooltip,{dispatch:a,children:n&&e.jsxs("div",{className:"flex items-center gap-2 bg-containers w-fit h-fit p-2 rounded-lg border-containers",children:[e.jsx(U,{imageUrl:s.image??"",alt:s.name}),e.jsx("p",{className:"text-xs font-bold content-text",children:s.name})]})}),Ye=({options:a,onselect:s})=>{const[n,t]=c.useState(null),r=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),l=[...a].filter(i=>i.name.toLowerCase().includes((n==null?void 0:n.toLowerCase())??""));return e.jsxs("div",{className:"h-fit w-full min-w-max",children:[e.jsxs("div",{className:"relative flex items-center",children:[e.jsx("input",{id:r,value:n??"",onChange:i=>t(i.target.value),type:"text",className:"w-full h-[32px] bg-bg-card border-cards rounded-lg p-2",placeholder:"Buscar"}),e.jsx("div",{className:"absolute right-[8px]",children:e.jsx(w.Icons,{icon:"search",size:"xs",strokeWidth:3})})]}),e.jsx("div",{className:"bg-bg-card border-cards rounded-lg p-2 flex flex-col gap-s overflow-y-auto max-h-[120px] min-w-max",children:l.map(i=>e.jsxs("button",{onClick:()=>{s(i)},className:"flex gap-s items-center max-w-[200px] min-w-full hover:bg-primary-light cursor-pointer",children:[e.jsx(U,{imageUrl:i.image,alt:i.name}),e.jsx("p",{className:"text-xs font-bold content-text",children:i.name})]}))})]})};class Xe{static toDomain(s){return{id:s.id,name:s.nombre,color:s.color}}}const Je=()=>{const{tasks_api:a}=z();return{teams:P.useQuery({queryKey:["teams","all"],queryFn:async()=>{const n=await a.get("/api/equipos");return O(n.data).map(Xe.toDomain)}})}};class Ze{static toUsers(s){var n,t,r;return{id:s.id,name:s.nombre,image:(r=(t=(n=s.imagen)==null?void 0:n.formats)==null?void 0:t.thumbnail)==null?void 0:r.url}}}const es=async({tasks_api:a})=>{try{const s=await a.get("/api/allOBPUsers");return O(s.data).map(Ze.toUsers)}catch(s){throw console.log("Error al obtener los usuarios comerciales",s),`Error al obtener los usuarios comerciales: ${s}`}},ss=()=>{const{tasks_api:a}=z();return{users:P.useQuery({queryKey:["users"],queryFn:()=>es({tasks_api:a}),staleTime:1e3*60*60*24})}},se=a=>new Intl.DateTimeFormat("es-MX",{month:"long"}).format(a);function ts(a){const s=["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],n=new Date(a).getDay();return s[n]}const fe=a=>{let s=a||new Date,n=s.getDate(),t=se(s.getMonth()).slice(0,3),r=s.getFullYear().toString().slice(-2),l=ts(s).slice(0,3);return`${l.charAt(0).toUpperCase()+l.slice(1)} ${n} ${t.charAt(0).toUpperCase()+t.slice(1)} ${r}`},te=a=>({...a,image:a.image?`https://devobp.imjmedia.com.mx${a.image}`:""}),Se=({users:a,onClick:s,responsible:n})=>{let t=`button-assign-users-${Math.random().toString(36).substring(2,15)}`;const{setElementPosition:r,position:l,clearPosition:i}=ee(),d=c.useRef(null),o=()=>n?null:a.length>3&&e.jsx(w.Tooltip,{dispatch:e.jsx("div",{className:"w-[28px] h-[28px] rounded-full btn-primary flex items-center justify-center border-2 border-white ml-[-8px]",children:e.jsx("p",{className:"text-xs font-bold text-white ",children:`+${a.length-3}`})}),children:e.jsx("div",{className:"bg-containers w-fit h-fit p-2 rounded-lg border-containers",children:a==null?void 0:a.slice(3).map((x,f)=>e.jsxs("div",{className:"flex items-center gap-2 ",children:[e.jsx(U,{imageUrl:x.image??"",alt:x.name},f),e.jsx("p",{className:"text-xs font-bold content-text",children:x.name})]},f))})}),g=()=>{if(n){let x=a.find(f=>f.id===n);return e.jsx("div",{children:e.jsx(he,{trigger:e.jsx(U,{imageUrl:x==null?void 0:x.image,alt:x==null?void 0:x.name},n),user:x,showUser:!(l!=null&&l.x)})})}return(a==null?void 0:a.length)>0&&a.slice(0,3).map((x,f)=>e.jsx("div",{className:`${f===0?"":"ml-[-8px]"}`,children:e.jsx(he,{trigger:e.jsx(U,{imageUrl:x.image,alt:x.name},f),user:x,showUser:!(l!=null&&l.x)})}))},u=({children:x})=>e.jsx("label",{ref:d,htmlFor:t,className:"cursor-pointer flex items-center",children:x});if(a.length===0)return e.jsx(u,{children:e.jsx(w.Icons,{icon:"user",size:"xs",strokeWidth:3})});const b=()=>{var h;const[x,f]=c.useState(),[m,j]=c.useState("team"),{teams:N}=Je(),{users:_}=ss();c.useEffect(()=>{var y,C;d.current&&f(((l==null?void 0:l.x)??0)-(((C=(y=d.current)==null?void 0:y.getBoundingClientRect())==null?void 0:C.width)??0))},[d==null?void 0:d.current,l==null?void 0:l.x]);const F=()=>{const y=[{id:"team",label:"Equipo"},{id:"responsible",label:"Responsable"}];return e.jsx("div",{className:"w-full flex justify-center gap-l text-texts-placeholder font-bold",children:y.map((C,D)=>e.jsx("button",{className:`w-full text-sm border-texts-placeholder text-center ${m===C.id?"text-primary-pastel":""} ${D===y.length-1?"border-r-0":" border-r-2"}`,onClick:()=>j(C.id),children:C.label}))})};return(l==null?void 0:l.x)&&G.createPortal(e.jsx("div",{className:`absolute w-[300px] h-fit ${x?"block":"hidden"}`,style:{top:`${l==null?void 0:l.y}px`,left:`${x}px`,zIndex:1},children:e.jsxs("div",{className:"flex flex-col gap-m bg-bg-card border-cards rounded-lg p-2 max-h-[200px] overflow-y-hidden",children:[e.jsx(F,{}),e.jsx(Ye,{options:m==="team"?N.data.map(y=>({id:y.id,name:y.name,image:""})):(h=_.data)==null?void 0:h.map(te),onselect:y=>{i(),s&&s(y,m)}})]})}),document.body)};return e.jsxs(e.Fragment,{children:[e.jsxs(u,{children:[g(),o()]}),e.jsx("button",{className:"hidden",id:t,onClick:()=>r(d)}),e.jsx(b,{})]})};function as({items:a}){var t;const[s,n]=c.useState(1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-row mb-2 border-b border-neutral-100 bg-white mt-4",children:a.map((r,l)=>e.jsx("div",{className:`border-r border-neutral-100 pr-3 py-1 ${l!==0?"px-3":""}`,children:e.jsx(S.Button,{variant:"ghost",onClick:()=>n(r.id),className:`text-sm font-normal rounded-none py-1 h-8 ${s===r.id?"text-primary border-b border-primary":"text-neutral-400 border-b-0"}`,children:r.label},r.id)},r.id))}),e.jsx("div",{className:"pt-4 flex-1 overflow-y-auto bg-white",children:(t=a.find(r=>r.id===s))==null?void 0:t.component})]})}const Te="https://devobp.imjmedia.com.mx";function ae(a){return a?a.split(" ").map(t=>{var r;return(r=t[0])==null?void 0:r.toUpperCase()}).slice(0,2).join(""):""}const rs="https://devobp.imjmedia.com.mx";function ns({comment:a}){var n,t,r,l,i,d;function s(o){const g=V.parseISO(o);return V.formatDistanceToNow(g,{locale:Z.es,addSuffix:!0})}return e.jsx("div",{children:e.jsxs("div",{className:"flex flex-row gap-3 items-start",children:[e.jsxs(S.Avatar,{className:"w-[28px] h-[28px]",children:[e.jsx(S.AvatarImage,{src:`${rs}${(l=(r=(t=(n=a==null?void 0:a.autor)==null?void 0:n.imagen)==null?void 0:t.formats)==null?void 0:r.thumbnail)==null?void 0:l.url}`,alt:"@shadcn"}),e.jsx(S.AvatarFallback,{children:ae((i=a==null?void 0:a.autor)==null?void 0:i.nombre)})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex flex-row gap-2",children:[e.jsx("p",{className:"text-sm text-neutral-900 font-medium",children:(d=a==null?void 0:a.autor)==null?void 0:d.nombre}),e.jsx("span",{className:"text-xs text-neutral-600 font-normal mt-[2px]",children:s(a==null?void 0:a.createdAt)})]}),e.jsx("p",{className:"text-sm text-neutral-600 font-normal",children:a==null?void 0:a.comentario})]})]})})}function ls({currentUser:a,data:s,taskId:n,onNewComment:t}){var b,x,f;const{tasks_api:r}=z(),{register:l,handleSubmit:i,reset:d}=$e.useForm(),[o,g]=c.useState([]);c.useEffect(()=>{if(s!=null&&s.comentarios){const m=[...s.comentarios].sort((j,N)=>new Date(N.createdAt).getTime()-new Date(j.createdAt).getTime());g(m)}},[s]);const u=async m=>{try{const j={autor:{id:a==null?void 0:a.id,email:a==null?void 0:a.email,nombre:a==null?void 0:a.nombre,imagen:a==null?void 0:a.imagen},comentario:m==null?void 0:m.comment,createdAt:new Date().toISOString()};await r.post("/api/comentarios",{data:{autor:a==null?void 0:a.id,comentario:m.comment,tarea:n}}),t(!0),g(N=>[j,...N]),d()}catch(j){console.error("Error al agregar comentario:",j)}};return e.jsxs("div",{className:"flex flex-col h-full gap-4",children:[e.jsxs("form",{onSubmit:i(u),className:"flex flex-row items-center gap-3",children:[e.jsxs(S.Avatar,{className:"w-[28px] h-[28px]",children:[e.jsx(S.AvatarImage,{src:`${Te}${(f=(x=(b=a==null?void 0:a.imagen)==null?void 0:b.formats)==null?void 0:x.thumbnail)==null?void 0:f.url}`,alt:"@shadcn"}),e.jsx(S.AvatarFallback,{className:"border border-x-primary-pastel",children:ae(a==null?void 0:a.nombre)})]}),e.jsx(S.Input,{...l("comment",{required:!0}),autoComplete:"off",placeholder:"Escribe un comentario",className:"w-full bg-white border border-neutral-200"})]}),o.map((m,j)=>e.jsx(ns,{comment:m},j))]})}function is({data:a}){const s={0:{color:"bg-gray-400",label:"Sin estado"},1:{color:"bg-primary-regular",label:"En curso"},2:{color:"bg-success-regular",label:"Finalizada"},3:{color:"bg-success-regular",label:"Finalizada"}},n=t=>t?V.format(new Date(t),"d MMM",{locale:Z.es}):"";return e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-row items-center gap-4",children:[e.jsx(S.Label,{className:"text-lg font-medium text-neutral-900",children:"Tareas dependientes"}),e.jsx("span",{className:"text-sm font-normal text-neutral-600 bg-[#E1EBF9] w-6 h-6 rounded-full flex items-center justify-center text-primary",children:a==null?void 0:a.length})]}),e.jsx("div",{className:"flex flex-col gap-2 border border-neutral-200 rounded-lg mt-3",children:a==null?void 0:a.map(t=>{var r,l,i,d,o;return e.jsxs("div",{className:"flex flex-row w-full items-center justify-between gap-s border-b border-neutral-200 py-1 px-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{imageUrl:(d=(i=(l=(r=t.responsable)==null?void 0:r.image)==null?void 0:l.formats)==null?void 0:i.thumbnail)==null?void 0:d.url}),e.jsx("p",{className:"text-sm font-normal w-[400px] text-nowrap text-ellipsis overflow-hidden",children:t==null?void 0:t.texto_corto})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("p",{className:"text-sm font-normal",children:n(t==null?void 0:t.createdAt)}),e.jsx("div",{className:`w-4 h-4 bg-gray-400 block rounded-full ${((o=s[t==null?void 0:t.estatus])==null?void 0:o.color)??"bg-gray-400"}`})]})]},t.id)})})]})}const os="https://devobp.imjmedia.com.mx";function cs({isOpen:a,setIsOpen:s,taskId:n}){var N,_,F,h,y,C,D,W,R,L,p,q,M;const[t,r]=c.useState(null),[l,i]=c.useState(!1),[d,o]=c.useState(!1),[g,u]=c.useState(null),{tasks_api:b}=z(),{user:x}=Q();c.useEffect(()=>{if(a&&n||l){const A=async()=>{const T=await b.get(`/api/detalleTarea/${n}`);r(T==null?void 0:T.data)},B=async()=>{var I,K;const T=await b.get(`/api/users/${x.id}`),E=await b.post("/api/obtenerUsuarioOBP/",{emailList:[(I=T==null?void 0:T.data)==null?void 0:I.email]});u((K=E==null?void 0:E.data)==null?void 0:K.data[0])};A(),B()}},[a,n,l]);const f={0:{label:"Sin prioridad",color:"text-primary-regular",iconColor:"#425CAC"},1:{label:"Baja",color:"text-success-regular",iconColor:"#43B071"},2:{label:"Media",color:"text-warning-regular",iconColor:"#D38A31"},3:{label:"Alta",color:"text-danger-regular",iconColor:"#C34335"}},m=A=>A?V.format(A,"d MMM yyyy, h:mmaaa",{locale:Z.es}):"Fecha no disponible",j=[{id:1,label:"Todo",component:e.jsx(ls,{taskId:n,currentUser:g,data:t,onNewComment:i})},{id:2,label:"Dependencias",component:e.jsx(is,{data:t==null?void 0:t.ids_t_dependientes})}];return a&&G.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`fixed inset-0 bg-transparent bg-opacity-50 flex justify-center items-center z-1 ${a?"pointer-events-auto block":"pointer-events-none hidden"}`,onClick:()=>s(!1)}),e.jsx("section",{className:`fixed top-0 bottom-0 bg-white bg-opacity-50 flex justify-center items-center w-[40rem] h-screen z-1 overflow-hidden transition-all ease-in-out duration-500 shadow-2xl ${a?"right-0 pointer-events-auto block":"right-[-100%] pointer-events-none hidden"}`,children:e.jsxs("div",{className:"flex w-full h-full flex-col overflow-y-scroll bg-white border-none shadow-xl px-4 py-6",children:[e.jsxs("div",{className:"w-full flex flex-row justify-between pb-4 gap-10 border-none",children:[e.jsxs("div",{className:"flex flex-row items-start gap-2 relative",children:[((N=t==null?void 0:t.id_t_requerida)==null?void 0:N.id)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"cursor-help",onMouseOver:()=>o(!0),onMouseLeave:()=>o(!1),children:e.jsx(w.Icons,{icon:"info_circle",color:v.warning.regular,strokeWidth:4})}),d&&e.jsxs("div",{style:{top:"25px"},className:"p-l max-w-[400px] absolute w-fit bg-warning-light rounded-lg border-l-[5px] border-warning-regular text-warning-dark text-xs flex flex-col gap-m",children:[e.jsx("p",{className:"font-bold",children:"Requiere completar su tarea requerida:"}),e.jsx("p",{className:"text-xs text-neutral-600 font-normal",children:(_=t==null?void 0:t.id_t_requerida)==null?void 0:_.texto_corto})]})]}),e.jsx("h3",{className:"text-lg font-semibold text-neutral-900",children:t==null?void 0:t.texto_corto})]}),e.jsx(S.Button,{variant:"shadow",size:"sm",onClick:()=>s(!1),className:"bg-neutral-100 w-10 h-10",children:e.jsx(w.Icons,{icon:"x_outline"})})]}),e.jsx("div",{className:"w-full flex flex-row justify-between",children:e.jsxs("span",{className:"text-neutral-600 text-sm",children:[t==null?void 0:t.campania," / ",t==null?void 0:t.nombre_medio]})}),e.jsxs("div",{className:"w-full flex flex-col gap-3 mt-4",children:[e.jsx("h6",{className:"text-neutral-900 font-semibold text-base",children:"Descripción"}),e.jsx("p",{className:"text-neutral-600 font-normal text-sm",children:(t==null?void 0:t.texto_largo)??"Sin descripción"})]}),e.jsx(S.Accordion,{type:"single",collapsible:!0,defaultValue:"item-1",className:"w-full flex flex-col border border-neutral-200 rounded-xl mt-4",children:e.jsxs(S.AccordionItem,{value:"item-1",className:"border-none",children:[e.jsx(S.AccordionTrigger,{className:"text-neutral-900 font-medium text-sm w-full flex flex-row border-b border-neutral-200 p-4 ",children:"Detalles"}),e.jsx(S.AccordionContent,{className:"border-none",children:e.jsxs("div",{className:"w-full grid grid-cols-3 gap-4 p-4",children:[e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Responsable"}),(F=t==null?void 0:t.responsable)!=null&&F.nombre?e.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[e.jsxs(S.Avatar,{className:"w-[28px] h-[28px]",children:[e.jsx(S.AvatarImage,{src:`${os}${(D=(C=(y=(h=t==null?void 0:t.responsable)==null?void 0:h.imagen)==null?void 0:y.formats)==null?void 0:C.thumbnail)==null?void 0:D.url}`,alt:"@shadcn"}),e.jsx(S.AvatarFallback,{children:ae((W=t==null?void 0:t.responsable)==null?void 0:W.nombre)})]}),e.jsx("span",{className:"text-xs text-neutral-600 font-normal",children:(R=t==null?void 0:t.responsable)==null?void 0:R.nombre})]}):e.jsx("span",{className:"text-xs text-neutral-600 font-normal",children:"Sin responsable"})]}),e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Equipo asignado"}),e.jsx("div",{className:"flex flex-row gap-2",children:e.jsx("span",{className:"text-xs text-neutral-600 font-normal",children:((L=t==null?void 0:t.equipo)==null?void 0:L.nombre)??"Sin equipo"})})]}),e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Prioridad"}),e.jsxs("div",{className:"flex flex-row items-center gap-2",children:[e.jsx(w.Icons,{icon:"flag",size:"xs",strokeWidth:5,color:(p=f[t==null?void 0:t.prioridad])==null?void 0:p.iconColor}),e.jsx("span",{className:`text-sm text-neutral-600 font-normal ${(q=f[t==null?void 0:t.prioridad])==null?void 0:q.color}`,children:((M=f[t==null?void 0:t.prioridad])==null?void 0:M.label)??"Sin prioridad"})]})]}),e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Lista"}),e.jsx("div",{className:"flex flex-row gap-2",children:e.jsx("span",{className:"text-xs text-neutral-600 font-normal",children:(t==null?void 0:t.lista)??"Sin lista"})})]}),e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Fecha estimada de inicio"}),e.jsx("p",{className:"text-xs text-neutral-600 font-normal",children:m(t==null?void 0:t.f_inicio_estimada)})]}),e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Fecha estimada de fin"}),e.jsx("p",{className:"text-xs text-neutral-600 font-normal",children:m(t==null?void 0:t.f_fin_estimada)})]}),e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Fecha de fin"}),e.jsx("p",{className:"text-xs text-neutral-600 font-normal",children:m(t==null?void 0:t.ffin)})]}),e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Creado"}),e.jsx("p",{className:"text-xs text-neutral-600 font-normal",children:m(t==null?void 0:t.createdAt)})]}),e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Última modificación"}),e.jsx("p",{className:"text-xs text-neutral-600 font-normal",children:m(t==null?void 0:t.updatedAt)})]})]})})]})}),e.jsx(as,{items:j})]})})]}),document.body)}const qe=({status:a,nameRequiredTask:s,statusRequiredTask:n,id:t})=>{const{setElementPosition:r,position:l}=ee(),{startWorking:i,completeTask:d}=Y(),o=c.useRef(null),g=c.useRef(!1),u=({children:b})=>{const[x,f]=c.useState();return c.useEffect(()=>{var m,j;o.current&&f(((l==null?void 0:l.x)??0)-(((j=(m=o.current)==null?void 0:m.getBoundingClientRect())==null?void 0:j.width)??0))},[o==null?void 0:o.current,l==null?void 0:l.x]),l&&G.createPortal(e.jsx("div",{className:`absolute w-fit h-fit ${x?"block":"hidden"}`,style:{top:`${l==null?void 0:l.y}px`,left:`${x}px`,zIndex:1},children:b}),document.body)};return e.jsxs(e.Fragment,{children:[a<2&&(s!==""&&n===2||!s)&&e.jsx("button",{ref:o,onClick:()=>{r(o)},className:"flex items-center justify-center text-sm font-extrabold bg-bg hover:filter-[drop-shadow(0_0_10px_#000000)] rounded-full w-[24px] h-[24px] m-block",children:e.jsx("span",{className:"rotate-90",children:e.jsx(w.Icons,{icon:"elipsis",size:"xs"})})}),e.jsx(u,{children:g!=null&&g.current?e.jsx("div",{className:"w-max h-fit bg-bg-card rounded-lg p-l shadow-lg flex items-center gap-2 hover:bg-primary-light",children:e.jsx("p",{className:"text-sm font-normal text-primary-pastel font-regular",children:"Moviendo..."})}):e.jsxs("button",{className:"w-max h-fit bg-bg-card rounded-lg p-l shadow-lg flex items-center gap-2 hover:bg-primary-light",onClick:()=>{g.current=!0,a===0?i({id:t}):d({id:t})},children:[e.jsx("p",{className:"text-sm font-normal text-texts-placeholder font-regular",children:a===0?"Mover a trabajando":"Mover a completadas"}),e.jsx(w.Icons,{icon:"arrow_right",size:"xs",strokeWidth:4,color:v.primary.regular})]})})]})},ds=({id:a,task:s,endDate:n,users:t,willBePaused:r,nameProject:l,idProject:i,comments:d,priority:o,difficulty:g,responsible:u,nameRequiredTask:b,statusRequiredTask:x,status:f,repeatsToDo:m,repeats:j,medioName:N})=>{var q,M,A,B,T,E;const[_,F]=c.useState(!1),{reasignResponsible:h,updateUnitys:y}=Y(),[C,D]=c.useState(j??0),W=()=>e.jsxs("div",{className:"flex justify-between items-center w-full h-fit relative",children:[e.jsxs("div",{className:"flex items-center gap-[8px] w-[calc(100%-32px)] ",children:[f<2&&(m&&j===m||m===1||!m)&&e.jsx(Fe,{id:a,nameRequiredTask:b??"",statusRequiredTask:x??0,status:f}),e.jsx("p",{className:"title-text",onClick:()=>F(!0),children:s})]}),(m&&j===m||m===1||!m)&&e.jsx(qe,{id:a,nameRequiredTask:b,status:f,statusRequiredTask:x})]}),R={0:{title:"N/A",color:v.texts.placeholder},1:{title:"Baja",color:v.primary.regular},2:{title:"Media",color:v.success.regular},3:{title:"Alta",color:v.danger.regular}},L={0:{title:"Muy fácil",color:v.primary.regular},1:{title:"Fácil",color:v.success.regular},2:{title:"Media",color:v.warning.regular},3:{title:"Difícil",color:v.danger.regular},4:{title:"Muy difícil",color:v.danger.dark}},p=I=>{D(K=>I==="minus"?Math.max(0,K-1):Math.min(m,K+1))};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-bg-card border-cards max-w-[350px] rounded-lg relative h-fit p-[12px_12px] hover:border-active hover:bg-active cursor-pointer ",children:[e.jsx(W,{}),e.jsxs("div",{className:"flex flex-col gap-[4px] py-2",children:[e.jsx("p",{className:"subtitle-text",children:l}),N&&e.jsx("p",{className:"content-text",children:N})]}),e.jsxs("div",{className:"flex justify-between items-center w-full h-fit relative pt-5 pb-1",children:[e.jsxs("div",{className:"flex items-center relative",children:[e.jsx(Se,{responsible:u,users:t.filter(I=>u?I.id===u:!0).map(te),onClick:async(I,K)=>{await h({idNewResponsible:I==null?void 0:I.id,id:a,typeOfSelect:K})}}),r&&e.jsx(w.Tooltip,{dispatch:e.jsxs("button",{className:"text-sm font-regular text-gray-400 flex items-center gap-2",children:[e.jsx(w.Icons,{icon:"pause",size:"s",strokeWidth:2}),e.jsx("span",{children:"Pause"})]}),children:e.jsx("p",{className:"text-sm font-regular text-white p-5",children:"Al pulsar el botón se solicitará razón del pausado"})})]}),e.jsxs("div",{className:"flex gap-m items-center flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w.Tooltip,{dispatch:e.jsx(w.Icons,{icon:"difficulty",size:"xs",color:(q=L[g??0])==null?void 0:q.color,strokeWidth:4}),children:e.jsx("p",{className:"text-sm font-regular p-5 bg-bg-card rounded-lg",style:{color:(M=L[g??0])==null?void 0:M.color},children:`Dificultad ${(A=L[g??0])==null?void 0:A.title}`})}),e.jsx(w.Tooltip,{dispatch:e.jsx(w.Icons,{icon:"flag",size:"xs",color:(B=R[o??0])==null?void 0:B.color,strokeWidth:4}),children:e.jsx("p",{className:"text-sm font-regular p-5 bg-bg-card rounded-lg",style:{color:(T=R[o??0])==null?void 0:T.color},children:`Prioridad: ${(E=R[o??0])==null?void 0:E.title}`})}),!m||m&&f===0&&e.jsxs(e.Fragment,{children:[e.jsx(w.Icons,{icon:"calendar",size:"xs",strokeWidth:3,color:v.texts.subtext}),e.jsx("p",{className:"text-sm font-regular text-texts-subtext",children:`${n.getDate()} ${se(n.getMonth()).slice(0,3)}`})]})]}),f===1&&m&&m>0&&e.jsxs("div",{className:"flex items-center gap-m",children:[e.jsx("p",{className:"text-xs text-texts-placeholder ",children:"unidades"}),e.jsx("button",{onClick:()=>p("minus"),className:"flex items-center justify-center bg-gray-200 w-[0] rounded-full hover:bg-gray-400",children:e.jsx(w.Icons,{icon:"circle_minus",size:"xs",strokeWidth:3,color:v.texts.placeholder})}),e.jsx("p",{className:"text-xs text-texts-placeholder",children:`${C??0} / ${m??0}`}),e.jsx("button",{onClick:()=>p("plus"),className:"flex items-center justify-center bg-gray-200 w-[0] rounded-full hover:bg-gray-400",children:e.jsx(w.Icons,{icon:"circle_plus",size:"xs",strokeWidth:3,color:v.texts.placeholder})}),e.jsx("button",{className:"text-xs bg-primary-medium rounded-md py-s px-m text-primary-regular",onClick:()=>{y({repeats:C,id:a})},children:"Agregar"})]})]})]}),d>0&&e.jsx("div",{className:"border-t border-gray-200 mt-4 pt-2",children:e.jsxs("button",{onClick:()=>F(!0),className:"flex items-center gap-2",children:[e.jsx(w.Icons,{icon:"comment",size:"xs",strokeWidth:4}),e.jsx("span",{className:"text-sm font-regular text-gray-400",children:d})]})})]}),e.jsx(cs,{taskId:a,isOpen:_,setIsOpen:F})]})},us=()=>e.jsxs("div",{className:"bg-gray-200 h-[150px] w-full animate-pulse rounded-md flex flex-col gap-[50px] p-4",children:[e.jsxs("div",{className:"flex h-[30px] gap-3",children:[e.jsx("div",{className:"w-[30px] min-w-[30px] h-full bg-gray-300 rounded-full"}),e.jsx("div",{className:"w-full h-full bg-gray-300"}),e.jsx("div",{className:"w-[30px] min-w-[30px] h-full bg-gray-300 rounded-full"})]}),e.jsxs("div",{className:"flex justify-between w-full h-[30px] gap-[50px]",children:[e.jsx("div",{className:"w-full h-[30px] bg-gray-300"}),e.jsx("div",{className:"w-full h-[30px] bg-gray-300"})]})]}),X=({title:a,tasks:s,loadNextPage:n,isFetching:t,total:r})=>{const l=c.useRef(null),i=c.useRef(null),d=c.useRef(!1);c.useEffect(()=>{var u;l!=null&&l.current&&(i!=null&&i.current)&&(i.current.style.minHeight=`${((u=l==null?void 0:l.current)==null?void 0:u.clientHeight)-50}px`)},[l==null?void 0:l.current]);const o=u=>{if(d.current)return;const{scrollTop:b,clientHeight:x,scrollHeight:f}=u==null?void 0:u.target,m=b/(f-x)*100;m<=95||m>=95&&(d.current=!0,n&&n(),setTimeout(()=>{d.current=!1},200))},g={"Por hacer":"border-texts-placeholder",Trabajando:"border-primary-regular",Completadas:"border-success-regular"};return e.jsxs("div",{ref:l,className:` flex flex-col bg-containers w-fit max-w-[400px] min-w-[400px] h-full min-h-[100%] pb-[200px] relative p-[16px] rounded-lg overflow-hidden border-t-4 ${g[a]}`,children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("div",{className:"flex items-center gap-[8px]",children:e.jsx("p",{className:"text-base",children:a})}),e.jsx("div",{className:"flex items-center gap-[8px]",children:e.jsxs("div",{className:"flex items-center gap-[4px]",children:[e.jsx(w.Icons,{icon:"group_files",size:"xs",strokeWidth:5,color:v.texts.placeholder}),e.jsx("p",{className:"text-md text-texts-placeholder",children:r??0})]})})]}),e.jsxs("div",{ref:i,className:"flex flex-col gap-[12px] overflow-y-auto scrollbar-none py-4",onScroll:o,children:[s==null?void 0:s.map(u=>e.jsx(ds,{...u},u.id)),t?e.jsx(us,{}):e.jsx("p",{className:"text-center text-gray-500",children:"No hay más tareas por mostrar..."})]})]})},xs=()=>{var r;const{defineFields:a}=$(),{tasksProject:s}=H();c.useEffect(()=>{(async()=>{let i=[...Ve];a(i)})()},[]);let n=(r=s==null?void 0:s.data)==null?void 0:r.filter(l=>{var i;return((i=l==null?void 0:l.tasks)==null?void 0:i.length)===0}).reduce((l,i)=>(l[i.status]=l[i.status]||[],l[i.status].push(i),l),{});const t=["Por hacer","Trabajando","Completadas"];return e.jsx("div",{className:"flex gap-4 w-full h-full min-h-[100%] relative ",children:t.map((l,i)=>{var d;return e.jsx(X,{total:((d=n==null?void 0:n[i])==null?void 0:d.length)??0,title:l,tasks:(n==null?void 0:n[i])??[],isFetching:s==null?void 0:s.isFetching,isLoadingData:s==null?void 0:s.isLoading})})})};class ms{static toKanbanTasks(s){var t,r,l,i,d,o,g,u,b,x,f;let n=[];return s!=null&&s.responsable&&n.push({id:s.responsable.id,name:s.responsable.nombre,image:(d=(i=(l=(r=(t=s.responsable)==null?void 0:t.userOBP)==null?void 0:r.imagen)==null?void 0:l.formats)==null?void 0:i.thumbnail)==null?void 0:d.url}),(o=s==null?void 0:s.equipo)!=null&&o.miembros&&s.equipo.miembros.forEach(m=>{var j,N,_,F;n!=null&&n.find(h=>h.id===m.idUser.id)||m.idUser&&n.push({id:m.idUser.id,name:m.idUser.nombre,image:(F=(_=(N=(j=m==null?void 0:m.userOBP)==null?void 0:j.imagen)==null?void 0:N.formats)==null?void 0:_.thumbnail)==null?void 0:F.url})}),{repeats:s==null?void 0:s.repeticiones_realizadas,repeatsToDo:s==null?void 0:s.repeticiones,comments:0,nameProject:(g=s==null?void 0:s.proyecto)==null?void 0:g.nombre,idProject:(u=s==null?void 0:s.proyecto)==null?void 0:u.id,willBePaused:s.es_pausable,difficulty:s.nivel_dificultad,endDate:new Date(s.ffin),id:s.id,priority:s.prioridad??0,status:s.estatus,task:s.texto_corto,users:n,responsible:((b=s==null?void 0:s.responsable)==null?void 0:b.id)??null,statusRequiredTask:((x=s.id_t_requerida)==null?void 0:x.estatus)??null,nameRequiredTask:((f=s.id_t_requerida)==null?void 0:f.texto_corto)??null,medioName:(s==null?void 0:s.nombre_medio)??null}}}const re=async({filters:a,tasks_api:s})=>{try{return(await s.get("/api/listado_tareas",{params:a})).data.tareas.map(O).map(ms.toKanbanTasks)}catch(n){throw console.log({error:n}),`Error al obtener las tareas: ${n}`}},ne=a=>{var s;if(a!=null&&a.hasNextPage){const n=(s=a==null?void 0:a.data)==null?void 0:s.pages[a.data.pages.length-1];(n==null?void 0:n.length)===30&&(a==null||a.fetchNextPage())}},k=a=>({pagination:{page:a,pageSize:30,withCount:!0}}),ps=()=>{var g;const a=P.useQueryClient(),{tasks_api:s}=z(),{user:n}=Q(),{filters:t}=$(),[r,l]=c.useState(0),[i,d]=c.useState({owner:{user:n.id,config:((g=t==null?void 0:t.owner)==null?void 0:g.config)??"yo_y_mis_equipos"},status:"por_hacer"}),o=P.useInfiniteQuery({initialPageParam:1,queryKey:["to_do_tasks",i],queryFn:({pageParam:u})=>re({filters:{...i,status:"por_hacer",...k(u)},tasks_api:s,page:u}),staleTime:1e3*60*60*24,getNextPageParam:(u,b)=>b.length+1});return c.useEffect(()=>{var u;Object.keys(t).length>0&&d({...t,owner:{user:n.id,config:((u=t==null?void 0:t.owner)==null?void 0:u.config)??"yo_y_mis_equipos"},status:"por_hacer"})},[t]),c.useEffect(()=>{a.invalidateQueries({queryKey:["to_do_tasks",i]})},[i]),c.useEffect(()=>{(async()=>{const b=await s.get("/api/listado_tareas",{params:{...i,status:"por_hacer",...k(1),tasks_api:s,justCount:!0}});l(b.data.total)})()},[i,o==null?void 0:o.data]),{toDoTasks:o,total:r}},gs=()=>{var t,r;const{toDoTasks:a,total:s}=ps(),n=[...((r=(t=a==null?void 0:a.data)==null?void 0:t.pages)==null?void 0:r.flat())??[]];return e.jsx(X,{total:s,title:"Por hacer",tasks:n,loadNextPage:()=>ne(a),isFetching:a==null?void 0:a.isFetching,isLoadingData:a==null?void 0:a.isLoading})},hs=()=>{var g;const a=P.useQueryClient(),{tasks_api:s}=z(),{user:n}=Q(),{filters:t}=$(),[r,l]=c.useState(0),[i,d]=c.useState({owner:{user:n.id,config:((g=t==null?void 0:t.owner)==null?void 0:g.config)??"yo_y_mis_equipos"},status:"trabajando"}),o=P.useInfiniteQuery({initialPageParam:1,queryKey:["working_tasks",t],queryFn:({pageParam:u})=>re({filters:{...i,status:"trabajando",...k(u)},tasks_api:s,page:u}),staleTime:1e3*60*60*24,getNextPageParam:(u,b)=>b.length+1});return c.useEffect(()=>{var u;Object.keys(t).length>0&&d({...t,owner:{user:n.id,config:((u=t==null?void 0:t.owner)==null?void 0:u.config)??"yo_y_mis_equipos"},status:"trabajando"})},[t]),c.useEffect(()=>{a.invalidateQueries({queryKey:["working_tasks",t]})},[i]),c.useEffect(()=>{(async()=>{const b=await s.get("/api/listado_tareas",{params:{...i,status:"trabajando",...k(1),tasks_api:s,justCount:!0}});l(b.data.total)})()},[i,o==null?void 0:o.data]),{workingTasks:o,total:r}},fs=()=>{var t,r;const{workingTasks:a,total:s}=hs(),n=[...((r=(t=a==null?void 0:a.data)==null?void 0:t.pages)==null?void 0:r.flat())??[]];return e.jsx(X,{total:s,title:"Trabajando",tasks:n,loadNextPage:()=>ne(a),isFetching:a==null?void 0:a.isFetching})},bs=()=>{var g;const a=P.useQueryClient(),{user:s}=Q(),{tasks_api:n}=z(),{filters:t}=$(),[r,l]=c.useState(0),[i,d]=c.useState({owner:{user:s.id,config:((g=t==null?void 0:t.owner)==null?void 0:g.config)??"yo_y_mis_equipos"},status:"completadas"}),o=P.useInfiniteQuery({initialPageParam:1,queryKey:["done_tasks",i],queryFn:({pageParam:u})=>re({filters:{...i,status:"completadas",...k(u)},tasks_api:n,page:u}),staleTime:1e3*60*60*24,getNextPageParam:(u,b)=>b.length+1});return c.useEffect(()=>{var u;Object.keys(t).length>0&&d({...t,owner:{user:s.id,config:((u=t==null?void 0:t.owner)==null?void 0:u.config)??"yo_y_mis_equipos"},status:"completadas"})},[t]),c.useEffect(()=>{a.invalidateQueries({queryKey:["done_tasks",i]})},[i]),c.useEffect(()=>{(async()=>{const b=await n.get("/api/listado_tareas",{params:{...i,status:"completadas",...k(1),justCount:!0,tasks_api:n}});l(b.data.total)})()},[o==null?void 0:o.data,i]),{doneTasks:o,total:r}},js=()=>{var t,r;const{doneTasks:a,total:s}=bs(),n=[...((r=(t=a==null?void 0:a.data)==null?void 0:t.pages)==null?void 0:r.flat())??[]];return e.jsx(X,{title:"Completadas",tasks:n,loadNextPage:()=>ne(a),isFetching:a==null?void 0:a.isFetching,total:s})};class J{static toSalesmanUsers(s){return{id:s.id,name:s.nombre}}}const ys=()=>{const{tasks_api:a}=z(),{filters:s}=$(),{user:n}=Q();return{getSalesmanAndProjects:async()=>{const[i]=await Promise.all([a.get("/api/obtener-comerciales")]);return{salesmanUsers:i.data.map(J.toSalesmanUsers)}},getProjects:async()=>{var d;return(await a.get("/api/listado_tareas",{params:{...s,owner:{user:n.id,config:((d=s==null?void 0:s.owner)==null?void 0:d.config)??"yo_y_mis_equipos"},justProjects:!0}})).data.map(J.toSalesmanUsers)},getSalesmans:async()=>(await a.get("/api/obtener-comerciales")).data.map(J.toSalesmanUsers)}},ws=[{label:"Tipo de dependencia",type:"select",id:"dependency",options:[{id:"con",name:"Con dependencia"},{id:"sin",name:"Sin dependencia"},{id:"ambas",name:"Ambas"}]},{label:"Por proyecto",type:"select",id:"project.id",options:[]},{label:"Por responsable",type:"select",id:"owner.config",options:[{id:"yo",name:"Mis tareas"},{id:"yo_y_mis_equipos",name:"Tareas mías y de mis equipos"},{id:"mis_equipos",name:"Tareas de mis equipos"}]},{label:"Por ejecutivo",type:"select",id:"salesman.name",options:[]},{label:"Por dificultad",type:"select",id:"difficulty",options:[{id:0,name:"Muy facil"},{id:1,name:"Facil"},{id:2,name:"Media"},{id:3,name:"Dificil"},{id:4,name:"Muy dificil"}]}],be=[{label:"Responsable",type:"select",id:"responsable.responsableType",options:[{id:"yo_y_mis_equipos",name:"Yo y mis equipos"},{id:"mis_equipos",name:"Mis equipos"},{id:"yo",name:"Yo"}]},{label:"Por Ejecutivo",type:"select",id:"ejecutivo",options:[]}],vs=()=>{const{defineFields:a}=$(),{getSalesmanAndProjects:s}=ys();return c.useEffect(()=>{(async()=>{let t=[...ws],{salesmanUsers:r}=await s();a(t.map(l=>(l.id==="salesman.name"&&(l.options=r),l)))})()},[]),e.jsxs("div",{className:"flex gap-4 w-full h-full min-h-[100%] relative ",children:[e.jsx(gs,{}),e.jsx(fs,{}),e.jsx(js,{})]})},Pe=c.createContext({}),Ns=({children:a})=>{const[s,n]=c.useState([]);c.useEffect(()=>{console.log({selectedTasks:s})},[s]);const t=r=>{n(l=>l.includes(r)?l.filter(i=>i!==r):[...l,r])};return e.jsx(Pe.Provider,{value:{selectedTasks:s,selectTask:t},children:a})},Cs=()=>c.useContext(Pe),Ae=()=>{const a=()=>e.jsxs("div",{className:"w-full flex gap-m",children:[e.jsx("div",{className:"w-[30px] h-[30px] min-w-[30px] min-h-[30px] bg-gray-200 rounded-full animate-pulse"}),e.jsx("div",{className:"w-[30%] h-[30px] bg-gray-200 rounded-md animate-pulse"}),e.jsx("div",{className:"w-[30px] h-[30px] min-w-[30px] min-h-[30px] bg-gray-200 rounded-lg animate-pulse"}),e.jsx("div",{className:"w-[30px] h-[30px] min-w-[30px] min-h-[30px] bg-gray-200 rounded-lg animate-pulse"}),e.jsx("div",{className:"w-[30px] h-[30px] min-w-[30px] min-h-[30px] bg-gray-200 rounded-lg animate-pulse"}),e.jsx("div",{className:"w-[10%] h-[30px] bg-gray-200 rounded-md animate-pulse"}),e.jsx("div",{className:"w-[30px] h-[30px] min-w-[30px] min-h-[30px] bg-gray-200 rounded-lg animate-pulse"}),e.jsx("div",{className:"w-[10%] h-[30px] bg-gray-200 rounded-md animate-pulse"}),e.jsx("div",{className:"w-[30px] h-[30px] min-w-[30px] min-h-[30px] bg-gray-200 rounded-lg animate-pulse"}),e.jsx("div",{className:"w-[30px] h-[30px] min-w-[30px] min-h-[30px] bg-gray-200 rounded-lg animate-pulse"})]});return e.jsxs("div",{className:"flex flex-col gap-m",children:[e.jsx(a,{}),e.jsxs("div",{className:"pl-5 flex flex-col gap-m",children:[e.jsx(a,{}),e.jsx("div",{className:"pl-5",children:e.jsx(a,{})})]}),e.jsx(a,{}),e.jsxs("div",{className:"pl-5 flex flex-col gap-m",children:[e.jsx(a,{}),e.jsx("div",{className:"pl-5",children:e.jsx(a,{})})]})]})},Ee=({startDate:a,endDate:s})=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"gap-s bg-gray-100 rounded-md h-[30px] w-fit flex justify-center items-center px-xxxl",children:[e.jsx(w.Icons,{icon:"calendar",size:"xs",strokeWidth:4,color:v.texts.subtext}),e.jsxs("p",{className:"text-sm",children:[" ",fe(a)]})]}),e.jsx(w.Icons,{icon:"arrow_right",size:"xs",strokeWidth:4,color:v.texts.DEFAULT}),e.jsxs("div",{className:"gap-s bg-gray-100 rounded-md h-[30px] w-fit flex justify-center items-center px-xxxl",children:[e.jsx(w.Icons,{icon:"calendar",size:"xs",strokeWidth:4,color:v.texts.subtext}),e.jsxs("p",{className:"text-sm",children:[" ",fe(s)]})]})]}),_s=({id:a})=>e.jsx(e.Fragment,{children:e.jsx("button",{onClick:()=>alert("pausar tarea "+a),children:e.jsx(w.Icons,{icon:"pause",size:"xs",strokeWidth:4,color:v.texts.subtext})})}),Me=({id:a,priority:s,difficulty:n,endDate:t})=>{var i,d;const r={0:{title:"N/A",color:v.success.regular,bg:"bg-texts-placeholder border-texts-placeholder"},1:{title:"Baja",color:v.success.regular,bg:"bg-success-medium border-success-pastel"},2:{title:"Media",color:v.warning.regular,bg:"bg-warning-light border-warning-regular"},3:{title:"Alta",color:v.danger.regular,bg:"bg-danger-light border-danger-regular"}},l={0:{title:"Muy fácil",color:v.success.dark,bg:"bg-success-medium border-success-regular"},1:{title:"Fácil",color:v.success.regular,bg:"bg-success-medium border-success-pastel"},2:{title:"Media",color:v.warning.regular,bg:"bg-warning-light border-warning-regular"},3:{title:"Difícil",color:v.danger.regular,bg:"bg-danger-light border-danger-regular"},4:{title:"Muy difícil",color:v.danger.dark,bg:"bg-danger-light border-danger-regular"}};return e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"gap-s bg-gray-100 rounded-md h-[30px] w-[30px] flex justify-center items-center hover:bg-gray-200",children:e.jsx(w.Tooltip,{dispatch:e.jsx(w.Icons,{icon:"align_center",size:"xs",strokeWidth:4,color:v.texts.subtext}),children:e.jsx("p",{className:"text-sm font-regular py-2 px-4 bg-bg-card rounded-lg",style:{color:"gray"},children:"Espéralo muy pronto..."})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`gap-s ${((i=l[n??0])==null?void 0:i.bg)??"bg-gray-100"} border rounded-md h-[30px] w-[30px] flex justify-center items-center`,children:e.jsx(w.Tooltip,{dispatch:e.jsx(w.Icons,{icon:"difficulty",size:"xs",color:l[n??0].color,strokeWidth:4}),children:e.jsx("p",{className:"text-sm font-regular p-5 bg-bg-card rounded-lg",style:{color:l[n??0].color},children:l[n??0].title})})}),e.jsx("div",{className:`gap-s ${((d=r[s??0])==null?void 0:d.bg)??"bg-gray-100"} border rounded-md h-[30px] w-[30px] flex justify-center items-center`,children:e.jsx(w.Tooltip,{dispatch:e.jsx(w.Icons,{icon:"flag",size:"xs",color:r[s??0].color,strokeWidth:4}),children:e.jsx("p",{className:"text-sm font-regular p-5 bg-bg-card rounded-lg",style:{color:r[s??0].color},children:r[s??0].title})})}),e.jsx(w.Icons,{icon:"calendar",size:"xs",strokeWidth:3,color:v.texts.subtext}),e.jsx("p",{className:"text-sm font-regular text-texts-subtext",children:`${t.getDate()} ${se(t.getMonth()).slice(0,3)}`})]})]})},Fs=({id:a})=>{const{selectedTasks:s,selectTask:n}=Cs();return e.jsxs(e.Fragment,{children:[e.jsx("label",{className:"cursor-pointer w-[20px] h-[20px] border-2 border-gray-200 rounded-md flex justify-center items-center",htmlFor:a.toString(),children:e.jsx("span",{className:`${s.includes(a)?"opacity-100":"opacity-0"} transition-opacity duration-500`,children:e.jsx(w.Icons,{icon:"check_outline",size:"xs",color:v.primary.regular,strokeWidth:6})})}),e.jsx("input",{className:"hidden",id:a.toString(),type:"checkbox",onChange:()=>n(a)})]})},Ie=({task:a})=>e.jsx(w.Tooltip,{dispatch:e.jsx("p",{className:"text-sm text-texts-subtext max-w-[400px] truncate",children:a}),children:e.jsx("p",{className:"text-sm text-texts-subtext p-2 max-w-[400px]",children:a})}),Ss=({id:a})=>{var r,l;const{tasksProject:s}=H(),{reasignResponsible:n}=Y(),t=(r=s==null?void 0:s.data)==null?void 0:r.find(i=>i.id===a);return e.jsx("div",{className:"border-b border-gray-200 pb-3",children:e.jsxs("div",{className:"ml-[30px] mb-3 mt-1 p-2 flex flex-wrap items-center gap-xl rounded-md hover:bg-gray-100",children:[!(t!=null&&t.nameRequiredTask)||(t==null?void 0:t.nameRequiredTask)!==""&&(t==null?void 0:t.statusRequiredTask)===2&&e.jsx(Fs,{id:a}),e.jsx(Fe,{id:a,nameRequiredTask:(t==null?void 0:t.nameRequiredTask)??"",status:t==null?void 0:t.status,statusRequiredTask:(t==null?void 0:t.statusRequiredTask)??0},a),(t==null?void 0:t.willBePaused)&&e.jsx(_s,{id:a}),e.jsx(Se,{onClick:async(i,d)=>{await n({idNewResponsible:i==null?void 0:i.id,id:a,typeOfSelect:d})},responsible:t==null?void 0:t.responsible,users:((l=t==null?void 0:t.users)==null?void 0:l.map(te))??[]}),e.jsx(Ie,{task:(t==null?void 0:t.task)??""}),e.jsx(Me,{id:a,priority:t==null?void 0:t.priority,difficulty:t.difficulty,endDate:t==null?void 0:t.endDate}),e.jsx(Ee,{startDate:t==null?void 0:t.startDate,endDate:t==null?void 0:t.endDate}),e.jsx(qe,{id:a,nameRequiredTask:t.nameRequiredTask,status:t.status,statusRequiredTask:t.statusRequiredTask})]})})},De=({id:a})=>{var l,i,d,o,g,u,b;const{tasksProject:s,openTasks:n,openTask:t}=H(),r=(l=s==null?void 0:s.data)==null?void 0:l.find(x=>x.id===a);return r?e.jsxs("div",{className:"flex flex-col gap-m mb-2 ",children:[e.jsxs("div",{className:"flex items-center gap-m flex-wrap hover:bg-gray-100 p-2 rounded-md",children:[e.jsx("button",{className:`${n.includes(a)?"":"-rotate-90"} transition-all duration-300`,onClick:()=>t(a),children:e.jsx(w.Icons,{icon:"angle_down_outline",color:v.texts.subtext})}),e.jsx("div",{className:"flex items-center justify-center min-w-[20px] min-h-[20px] w-fit h-[20px] mx-1 bg-primary-medium rounded-full",children:e.jsx("p",{className:"text-sm text-primary",children:((i=r==null?void 0:r.tasks)==null?void 0:i.length)===0?1:(d=r==null?void 0:r.tasks)==null?void 0:d.length})}),e.jsx(Ie,{task:(r==null?void 0:r.task)??""}),e.jsx(Me,{id:a,priority:r==null?void 0:r.priority,difficulty:r.difficulty,endDate:r==null?void 0:r.endDate}),e.jsx(Ee,{startDate:r==null?void 0:r.startDate,endDate:r==null?void 0:r.endDate}),e.jsxs("button",{className:"gap-s bg-gray-100 rounded-md h-[30px] flex justify-center items-center w-fit px-m hover:bg-gray-200",children:[e.jsx(w.Icons,{icon:"subtasks",size:"xs",strokeWidth:5,color:v.texts.subtext}),e.jsx("p",{children:((o=r==null?void 0:r.tasks)==null?void 0:o.length)===0?1:(g=r==null?void 0:r.tasks)==null?void 0:g.length})]})]}),n.includes(a)&&e.jsx("div",{className:"ml-[30px]",children:((u=r==null?void 0:r.tasks)==null?void 0:u.length)>0?(b=r==null?void 0:r.tasks)==null?void 0:b.map(x=>e.jsx(De,{id:x==null?void 0:x.id})):e.jsx(Ss,{id:r==null?void 0:r.id})})]}):null},Ts=()=>{var t;const{tasksProject:a,projectID:s}=H();if(a!=null&&a.isFetching||a!=null&&a.isLoading)return e.jsx(Ae,{});let n=[...(t=a==null?void 0:a.data)==null?void 0:t.filter(r=>r.isPrincipalTask)];return e.jsx("div",{className:"flex flex-col gap-m h-full overflow-y-auto pb-3",children:e.jsx(Ns,{project:s,children:n==null?void 0:n.sort((r,l)=>r.orden-l.orden).map(r=>e.jsx("div",{className:"flex flex-col gap-m border-b border-gray-200 pb-m h-full",children:e.jsx(De,{id:r.id})}))})})},qs=({setPath:a,setProject:s})=>{const[n,t]=c.useState([]),[r,l]=c.useState(!0),[i,d]=c.useState(0),[o,g]=c.useState(10),[u,b]=c.useState(0),[x,f]=c.useState("nombre"),{filters:m,defineFields:j,cleanFilters:N}=$(),{tasks_api:_}=z(),{user:F}=Q(),h=async(p,q)=>{var M,A,B;try{l(!0);const T={filters:{search:(m==null?void 0:m.taskName)??"",responsable:{idUser:F.id,responsableType:(M=m==null?void 0:m.responsable)==null?void 0:M.responsableType},ejecutivo:(m==null?void 0:m.ejecutivo)??""}};console.log("FiltrosPARAMS: ",T);const E=await _.get("/api/listado_campanias",{params:{pagination:{page:p,pageSize:q},orderBy:x,...T}}),I=O(E==null?void 0:E.data);t(I),b((B=(A=E==null?void 0:E.data)==null?void 0:A.meta)==null?void 0:B.total)}catch(T){console.error("Error fetching data en Lista Campaña:",T)}finally{l(!1)}},y=async()=>{try{const p=await _.get("/api/obtener-comerciales");return[...be].map(M=>(M.id==="ejecutivo"&&(M.options=p.data.map(A=>({id:A.nombre,name:A.nombre}))),M))}catch(p){return console.error("Error fetching salesman data:",p),[...be]}};c.useEffect(()=>{(async()=>{const q=await y();j(q)})()},[]),c.useEffect(()=>{const p=Math.floor(i/o)+1;h(p,o)},[i,o,x,m]);const C=p=>{d(p.first),g(p.rows)},D=[{label:"5 filas",value:5},{label:"10 filas",value:10},{label:"15 filas",value:15},{label:"20 filas",value:20},{label:"25 filas",value:25},{label:"50 filas",value:50}],W=p=>{const q=parseInt(p.target.value,10);g(q),C({first:0,rows:q})},R=p=>{f(q=>q===p?`${p}:desc`:p)},L=p=>x===p?"↑↓":x===`${p}:desc`?"↓↑":"↑↓";return e.jsx("div",{className:"table-container",children:r?e.jsx("div",{style:{width:"100%"},children:e.jsx(Ae,{})}):e.jsxs(e.Fragment,{children:[e.jsxs("table",{className:"table",style:{borderCollapse:"collapse",width:"100%",borderSpacing:"0"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{color:"#F5F5F5"},children:[e.jsxs("th",{onClick:()=>R("nombre"),children:[e.jsx("label",{style:{color:"#C4C4C4",fontSize:"10px"},children:L("nombre")}),"Campaña"]}),e.jsx("th",{onClick:()=>R("inicia"),style:{textAlign:"center",whiteSpace:"nowrap"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",width:"fit-content"},children:[e.jsx("label",{style:{color:"#C4C4C4",fontSize:"10px"},children:L("inicia")})," ",e.jsx(w.Icons,{icon:"calendar",size:"xs",strokeWidth:5,color:"#C4C4C4"}),e.jsx("span",{children:"Fecha Inicio"})]})}),e.jsx("th",{onClick:()=>R("termina"),style:{whiteSpace:"nowrap",textAlign:"center"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",width:"fit-content"},children:[e.jsx("label",{style:{color:"#C4C4C4",fontSize:"10px"},children:L("termina")}),e.jsx(w.Icons,{icon:"calendar",size:"xs",strokeWidth:5,color:"#C4C4C4"}),e.jsx("span",{children:"Fecha Fin"})]})}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Responsable"})]})}),e.jsx("tbody",{children:n==null?void 0:n.map((p,q)=>{var M,A,B,T,E,I,K,le,ie,oe,ce,de,ue,xe,me,pe;return e.jsxs("tr",{className:"table-row",onClick:()=>{N(),s({id:p==null?void 0:p.id,project:p==null?void 0:p.nombre}),a("kanban-campania")},children:[e.jsx("td",{children:(M=p==null?void 0:p.campania)==null?void 0:M.nombre}),e.jsxs("td",{children:[" ",(A=p==null?void 0:p.campania)==null?void 0:A.inicia]}),e.jsx("td",{children:(B=p==null?void 0:p.campania)==null?void 0:B.termina}),e.jsx("td",{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"15px",padding:"none",fontSize:"10px",width:"auto",minWidth:"170px"},children:[e.jsxs("label",{style:{width:"50px",minWidth:"50px",textAlign:"right",color:"#000"},children:[p==null?void 0:p.progreso,"%"]}),e.jsx("div",{style:{position:"relative",height:"10px",flex:1,backgroundColor:"#C4C4C4",borderRadius:"10px",overflow:"hidden"},children:e.jsx("div",{style:{position:"absolute",top:0,left:0,height:"100%",width:`${p.progreso}%`,backgroundColor:p.progreso===100?"#039B59":p.progreso>50?"#3658C1":p.progreso>0?"#DC8921":"#C4C4C4",borderRadius:"10px",transition:"width 0.3s ease-in-out"}})})]})}),e.jsx("td",{children:e.jsxs("div",{className:"avatar-container",children:[e.jsxs(S.Avatar,{className:"avatar w-[28px] h-[28px]",children:[e.jsx(S.AvatarImage,{src:`${Te}${(le=(K=(I=(E=(T=p==null?void 0:p.campania)==null?void 0:T.responsable)==null?void 0:E.imagen)==null?void 0:I.formats)==null?void 0:K.thumbnail)==null?void 0:le.url}`,alt:(ce=(oe=(ie=p==null?void 0:p.campania)==null?void 0:ie.responsable)==null?void 0:oe.nombre)==null?void 0:ce.charAt(0)}),e.jsx(S.AvatarFallback,{style:{boxShadow:"10px 5px 10px rgba(0, 0, 0, 0.5)"},children:(xe=(ue=(de=p==null?void 0:p.campania)==null?void 0:de.responsable)==null?void 0:ue.nombre)==null?void 0:xe.charAt(0)})]}),e.jsx("span",{style:{marginLeft:"8px",fontSize:"10px"},children:(pe=(me=p==null?void 0:p.campania)==null?void 0:me.responsable)==null?void 0:pe.nombre})]})})]},q)})})]}),e.jsxs("div",{className:"pagination",style:{background:"#FAFAFA",display:"flex"},children:[e.jsxs("span",{style:{alignItems:"center",fontSize:"10px",textAlign:"left",width:"auto",height:"auto",whiteSpace:"nowrap"},children:[n.length," elementos de ",u]}),e.jsx(ze.Paginator,{first:i,rows:o,totalRecords:u,rowsPerPageOptions:[5,10,20,50],onPageChange:C,className:"pagination",template:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"10px",whiteSpace:"nowrap"},children:"Filas por página:"}),e.jsx("select",{className:"select",value:o,onChange:p=>W(p),children:D.map(p=>e.jsx("option",{className:"option-select",value:p.value,style:{background:"#F5F5F5"},children:p.label},p.value))})]})]})]})})},Ps=({path:a,tab:s,setPath:n,project:t,setProject:r})=>{const l={"kanban-general":{kanban:e.jsx(vs,{})},"lista-campanias":{lista:e.jsx(qs,{setPath:n,setProject:r}),gantt:e.jsx("div",{children:"gantt-campanias"})},"kanban-campania":{kanban:e.jsx(xs,{}),lista:e.jsx(Ts,{}),gantt:e.jsx("div",{children:"kanban-campania-gantt"})}};return a==="kanban-campania"?e.jsx(He,{project:t==null?void 0:t.id,children:l[a][s]}):l[a][s]},As=({path:a})=>{const s=()=>{const{selectPath:n,updateFilters:t,applyFilters:r,filters:l}=$(),[i,d]=c.useState("kanban"),[o,g]=c.useState(a),[u,b]=c.useState({id:1704,project:"Kanban de Campania"}),[x,f]=c.useState((l==null?void 0:l.taskName)??""),[m,j]=c.useState(""),N=c.useRef(null);c.useEffect(()=>{d(o==="lista-campanias"?"lista":"kanban"),n(o)},[a,o]),c.useEffect(()=>{(x==null?void 0:x.trim())===""&&t({name:"taskName",value:null}),r()},[m]),c.useEffect(()=>{f((l==null?void 0:l.taskName)??"")},[l==null?void 0:l.taskName]);const _=C=>({"kanban-general":"Kanban General","lista-campanias":"Campanias","kanban-campania":`Kanban de ${u.project}`})[C],F=C=>{g(C)},h=["lista-campanias","kanban-campania"],y={"lista-campanias":["lista","gantt"],"kanban-campania":["kanban","lista","gantt"]};return e.jsxs("div",{className:"bg-bg-card p-m rounded-lg border border-gray-200 flex flex-col gap-m w-full h-full min-h-[100%] relative overflow-hidden",children:[e.jsxs("div",{className:"w-full justify-between flex items-end border-b border-gray-200 pb-m px-l flex-wrap gap-l",children:[e.jsxs("div",{className:"flex gap-xl",children:[e.jsx("h2",{className:"text-texts font-medium",children:_(o)}),h.includes(o)&&e.jsx(Le,{tabs:y[o],renderItem:C=>{d(C)},initialTab:i})]}),e.jsxs("div",{className:"flex items-center gap-s",children:[e.jsx("input",{onChange:C=>{f(C.target.value),ve(()=>{t({name:"taskName",value:C.target.value.trim()}),j(C.target.value)},1e3)()},type:"text",placeholder:"Buscar",value:x,className:"w-[200px] h-[30px] border-none bg-bg-card shadow-input border border-gray-200 rounded-lg px-l "}),e.jsx(Be,{filterChildren:N,children:e.jsx("div",{ref:N,className:"w-max max-w-[400px] h-fit bg-bg-card shadow-lg rounded-lg p-l",children:e.jsx(Qe,{})})})]})]}),e.jsx("div",{className:"overflow-y-hidden scrollbar-none",children:e.jsx(Ps,{path:o,tab:i,setPath:F,project:u,setProject:b})})]})};return e.jsx(Ke,{children:e.jsx(s,{})})},Es=()=>e.jsx("div",{className:"w-full h-full min-h-[100%] relative",children:e.jsx("div",{className:"flex justify-center items-center h-full",children:e.jsxs("div",{className:"text-2xl font-bold flex flex-col items-center",children:[e.jsx("div",{className:"w-10 h-10 bg-primary-regular rounded-full animate-pulse"}),e.jsx("p",{className:"text-l text-texts-enfasis",children:"un momento..."}),e.jsx("p",{className:"text-sm text-texts-placeholder",children:"estamos buscando tu usuario"})]})})}),Ms=()=>e.jsx("div",{className:"w-full h-full min-h-[100%] relative",children:e.jsx("div",{className:"flex justify-center items-center h-full",children:e.jsxs("div",{className:"text-2xl font-bold flex flex-col items-center",children:[e.jsx("div",{className:"w-10 h-10 bg-primary-regular rounded-full animate-pulse"}),e.jsx("p",{className:"text-l text-texts-enfasis",children:"No encontramos tu acceso"}),e.jsx("p",{className:"text-sm text-texts-placeholder",children:"por favor, contacta al administrador"})]})})}),Is=({path:a,user:s,url:n})=>{const t=new P.QueryClient;if(!s)return e.jsx(Es,{});if(!s.accessToken)return e.jsx(Ms,{});let r={user:s,url:n};return e.jsx(e.Fragment,{children:e.jsx(ke,{...r,children:e.jsx(Ue,{...r,children:e.jsx("div",{className:"w-full h-full min-h-[100%] relative",children:e.jsxs(P.QueryClientProvider,{client:t,children:[e.jsx(As,{path:a})," "]})})})})})};exports.AppTasks=Is;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");require("@imj_media/imj-ui/styles.css");const P=require("@tanstack/react-query"),c=require("react"),w=require("@imj_media/tasks-modules"),G=require("react-dom"),je=require("axios"),ye=require("qs"),V=require("date-fns"),Z=require("date-fns/locale"),S=require("@imj_media/imj-ui"),$e=require("react-hook-form"),ze=require("primereact/paginator"),Re=({label:a,active:s,onClick:n,disabled:t})=>t?e.jsx(w.Tooltip,{dispatch:e.jsxs("button",{className:"text-texts-placeholder text-xs font-semibold cursor-help",children:[" ",a," "]}),children:e.jsx("div",{className:"flex items-center justify-center px-3 py-2 bg-bg-card rounded-lg border border-border-card",children:e.jsx("p",{className:"text-texts-placeholder text-xs font-semibold",children:"Espéralo muy pronto..."})})}):e.jsx("button",{disabled:t,onClick:n,className:`${s?"text-texts-enfasis border-b-2 border-texts-enfasis":""} text-xs font-semibold ${t?"cursor-not-allowed text-texts-placeholder":"text-texts-subtext"} `,children:a}),Le=({tabs:a,renderItem:s,initialTab:n})=>{const[t,r]=c.useState(n??a[0].toLowerCase());c.useEffect(()=>{n&&r(n)},[n]);const l=i=>{r(i),s(i)};return e.jsx("div",{className:"flex",children:a.map((i,d)=>e.jsx("div",{className:`${d===0?"border-l-2":""} border-r-2 border-gray-200 px-m`,children:e.jsx(Re,{onClick:()=>l(i.toLowerCase()),label:i,active:i.toLowerCase()===t,disabled:["gantt"].includes(i.toLowerCase())},d)}))})},v={bg:{DEFAULT:"#EFEFEF",content:"#FAFAFA",card:"#FAFAFA"},texts:{DEFAULT:"#252525",enfasis:"#3658c1",subtext:"#4f4f4f",placeholder:"#929292"},primary:{light:"#E7E9F2",medium:"#dae2ec",dark:"#334990",regular:"#425CAC",pastel:"#5c7ddd"},success:{light:"#368156",medium:"#D2E9DC",dark:"#368156",regular:"#43B071",pastel:"#57BA81"},danger:{light:"#F1E5E4",medium:"#EBDBD9",dark:"#8C352C",regular:"#C34335",pastel:"#C43355"},warning:{light:"#F2ECE5",medium:"#EBE3D9",dark:"#B4782F",regular:"#D38A31",pastel:"#D38A31"},alert:{light:"#F1F1E4",medium:"#EAE9D9",dark:"#ADA63A",regular:"#D6CC48",pastel:"#D6CC48"},info:{light:"#E7F5FF",medium:"#D9E6EE",dark:"#1C5073",regular:"#1B6698",pastel:"#1B6698"},link:{light:"#ECF8FE",medium:"#D8F1FD",dark:"#0A7AAE",regular:"#0EA5E9",pastel:"#0EA5E9"}},ee=()=>{const[a,s]=c.useState(null);return{position:a,setElementPosition:l=>{var g;let i=(g=l.current)==null?void 0:g.getBoundingClientRect(),d=(i==null?void 0:i.x)+((i==null?void 0:i.width)??0),o=(i==null?void 0:i.y)+(i==null?void 0:i.height);s(a?null:{x:d??0,y:o??0})},getChildrenSize:l=>{var i;return(i=l.current)==null?void 0:i.getBoundingClientRect()},clearPosition:()=>{s(null)}}},Be=({children:a,filterChildren:s})=>{const{position:n,setElementPosition:t}=ee(),r=c.useRef(null),l=({children:i})=>{const[d,o]=c.useState();return c.useEffect(()=>{var g,u;s.current&&o(((n==null?void 0:n.x)??0)-(((u=(g=s.current)==null?void 0:g.getBoundingClientRect())==null?void 0:u.width)??0))},[s==null?void 0:s.current,n==null?void 0:n.x]),n&&G.createPortal(e.jsx("div",{className:`absolute w-fit h-fit ${d?"block":"hidden"}`,style:{top:`${n==null?void 0:n.y}px`,left:`${d}px`,zIndex:1},"data-portal-host":!0,children:i}),document.body)};return e.jsxs(e.Fragment,{children:[e.jsxs("label",{ref:r,htmlFor:"filter-button",className:"flex cursor-pointer items-center gap-m p-s text-texts-enfasis fill-texts-enfasis bg-bg rounded-lg px-l h-[30px] shadow-button-primary hover:shadow-button-primary-hover ",children:[e.jsx(w.Icons,{icon:"filter",size:"xs",strokeWidth:5,color:v.primary.regular}),"Filtrar"]}),e.jsx("button",{className:"hidden",id:"filter-button",onClick:()=>{t(r)}}),e.jsx(l,{children:a})]})},ge=a=>{let s={};return Object.entries(a).forEach(([n,t])=>{if(n.includes(".")){let[r,l]=n.split(".");s[r]=s[r]||{},s[r][l]=t}else s[n]=t}),s},we=c.createContext({}),Ke=({children:a})=>{const[s,n]=c.useState({}),[t,r]=c.useState({}),[l,i]=c.useState([]),[d,o]=c.useState(""),g=({name:x,value:f})=>{function m(N){return!isNaN(N)&&N!==null&&N!==""?parseFloat(N):null}let j=m(f);r(N=>{let _={...N},F=l==null?void 0:l.find(h=>h.label.toLowerCase().replace(/ /g,"_")===x);return F?_[F.id]=j??f:_[x]=j??f,_})};c.useEffect(()=>{let x=l.map(f=>f.id==="owner.config"?[f.id,"yo_y_mis_equipos"]:f.id==="dependency"?[f.id,"ambas"]:[f.id,null]);r(Object.fromEntries(x))},[l]);const u=()=>{let x=l.map(f=>f.id==="owner.config"?[f.id,"yo_y_mis_equipos"]:f.id==="dependency"?[f.id,"ambas"]:[f.id,null]);r(Object.fromEntries(x)),n(ge(Object.fromEntries(x)))},b=()=>{let x=ge(t);console.log({filtersWithEstructure:x}),n(x)};return e.jsx(we.Provider,{value:{fields:l,filters:s,path:d,defineFields:i,updateFilters:g,cleanFilters:u,applyFilters:b,initialFilters:t,selectPath:o},children:a})},$=()=>c.useContext(we);function ve(a,s=300,n={leading:!1,trailing:!0}){let t,r=null;return function(...l){const i=Date.now(),d=n.leading&&!r;clearTimeout(t),d&&a(...l),r=i,t=setTimeout(()=>{n.trailing&&(!n.leading||i-r>=s)&&(a(...l),r=null)},s)}}const Qe=()=>{const{fields:a,updateFilters:s,cleanFilters:n,applyFilters:t,initialFilters:r}=$();return e.jsxs("div",{className:"flex flex-col gap-l min-w-[250px] z-[100]",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("p",{className:"text-texts text-m",children:"Filtros"}),e.jsx("button",{className:"text-xs font-semibold flex cursor-pointer items-center gap-m p-s text-texts-enfasis fill-texts-enfasis bg-bg rounded-lg px-l h-fit shadow-button-primary hover:shadow-button-primary-hover ",onClick:n,children:"Limpiar"})]}),e.jsx("div",{className:"flex flex-col gap-m",children:a==null?void 0:a.map((l,i)=>{var d;return e.jsxs("div",{children:[e.jsx("p",{className:"text-sm",children:l.label}),(l==null?void 0:l.type)==="select"?e.jsx("select",{onChange:o=>{var g,u;s({name:(g=o==null?void 0:o.target)==null?void 0:g.name,value:(u=o==null?void 0:o.target)==null?void 0:u.value})},value:r==null?void 0:r[l==null?void 0:l.id],className:"w-full h-[30px] shadow-input rounded-lg p-s",name:l.id,id:l.id,children:(d=l==null?void 0:l.options)==null?void 0:d.map((o,g)=>e.jsx("option",{value:o.id,children:o.name},g))}):e.jsx("input",{className:"w-full h-[30px] shadow-input rounded-lg p-s",type:l.type,value:r==null?void 0:r[l==null?void 0:l.id],name:l.label.toLowerCase().replace(/ /g,"_"),onChange:ve(o=>{var g,u;return s({name:(g=o==null?void 0:o.target)==null?void 0:g.name,value:(u=o==null?void 0:o.target)==null?void 0:u.value})},1e3)})]},i)})}),e.jsx("button",{className:"btn-primary rounded-md py-s",onClick:t,children:"Filtrar"})]})},O=a=>{const s=t=>Object.prototype.toString.call(t)==="[object Object]",n=t=>t.attributes?{id:t.id,...t.attributes}:t;if(Array.isArray(a))return a.map(t=>O(t));if(s(a)){Array.isArray(a.data)?a=[...a.data]:s(a.data)?a=n({...a.data}):a.data===null?a=null:a=n(a);for(const t in a)a[t]=O(a[t]);return a}return a};class We{static toCampaignTasks(s){var t,r,l,i,d,o,g,u,b,x,f,m;let n=[];return s!=null&&s.responsable&&n.push({id:s.responsable.id,name:s.responsable.nombre,image:(d=(i=(l=(r=(t=s.responsable)==null?void 0:t.userOBP)==null?void 0:r.imagen)==null?void 0:l.formats)==null?void 0:i.thumbnail)==null?void 0:d.url}),console.log("task",s),(o=s==null?void 0:s.equipo)!=null&&o.miembros&&s.equipo.miembros.forEach(j=>{var N,_,F,h;n!=null&&n.find(y=>y.id===j.idUser.id)||j.idUser&&n.push({id:j.idUser.id,name:j.idUser.nombre,image:(h=(F=(_=(N=j==null?void 0:j.userOBP)==null?void 0:N.imagen)==null?void 0:_.formats)==null?void 0:F.thumbnail)==null?void 0:h.url})}),{isPrincipalTask:(s==null?void 0:s.tarea_principal)??!1,projectName:((g=s==null?void 0:s.proyecto)==null?void 0:g.nombre)??null,orden:(s==null?void 0:s.orden)??null,id:(s==null?void 0:s.id)??null,task:(s==null?void 0:s.texto_corto)??null,status:(s==null?void 0:s.estatus)??null,difficulty:(s==null?void 0:s.nivel_dificultad)??null,priority:(s==null?void 0:s.prioridad)??0,endDate:new Date((s==null?void 0:s.ffin)??null),startDate:new Date((s==null?void 0:s.finicio)??null),mediumName:(s==null?void 0:s.nombre_medio)??null,users:n,repeatsToDo:(s==null?void 0:s.repeticiones)??null,repeats:(s==null?void 0:s.repeticiones_realizadas)??null,comments:((u=s==null?void 0:s.comentarios)==null?void 0:u.length)??null,willBePaused:s==null?void 0:s.es_pausable,statusRequiredTask:((b=s==null?void 0:s.id_t_requerida)==null?void 0:b.estatus)??null,nameRequiredTask:((x=s==null?void 0:s.id_t_requerida)==null?void 0:x.texto_corto)??null,responsible:((f=s==null?void 0:s.responsable)==null?void 0:f.id)??null,tasks:((m=s==null?void 0:s.tareas)==null?void 0:m.map(j=>({id:j.id,name:j.texto_corto,status:j.estatus})))??null}}}const Oe=async({filters:a,tasks_api:s,project:n})=>{try{const t=await s.get("/api/listado_tareas_flujo",{params:{...a,project:{id:n},includeAllTasks:!0}});return O(t.data.tareas).map(We.toCampaignTasks)}catch(t){console.log(t)}},Ne=c.createContext({}),Ue=({children:a,user:s,url:n})=>{const t=je.create({baseURL:n,headers:{Authorization:`Bearer ${s.accessToken}`},paramsSerializer:r=>ye.stringify(r,{encodeValuesOnly:!0})});return e.jsx(Ne.Provider,{value:{tasks_api:t},children:a})},z=()=>c.useContext(Ne),Ce=c.createContext({}),ke=({children:a,user:s,url:n})=>{const t=je.create({baseURL:n,headers:{Authorization:`Bearer ${s.accessToken}`},paramsSerializer:r=>ye.stringify(r,{encodeValuesOnly:!0})});return e.jsx(Ce.Provider,{value:{user:s,tasks_api:t},children:a})},Q=()=>c.useContext(Ce),_e=c.createContext({}),He=({children:a,project:s})=>{var N;const n=P.useQueryClient(),[t,r]=c.useState([]),[l,i]=c.useState([]),{tasks_api:d}=z(),{filters:o}=$(),{user:g}=Q(),[u,b]=c.useState({owner:{user:g.id,config:((N=o==null?void 0:o.owner)==null?void 0:N.config)??"yo_y_mis_equipos"},project:{id:s}}),x=P.useQuery({queryKey:["tasksProject",o,s],queryFn:()=>Oe({filters:{...u},project:s,tasks_api:d})});c.useEffect(()=>{var _;Object.keys(o).length>0&&b({...o,owner:{user:g.id,config:((_=o==null?void 0:o.owner)==null?void 0:_.config)??"yo_y_mis_equipos"},project:{id:s}})},[o]),c.useEffect(()=>{n.invalidateQueries({queryKey:["tasksProject",o,s]})},[u]);const f=_=>{r(F=>[...F,_])},m=_=>{i(F=>F.includes(_)?F.filter(h=>h!==_):[...F,_])},j=s??null;return e.jsx(_e.Provider,{value:{tasksProject:x,selectedTasks:t,projectID:j,openTasks:l,selectTask:f,openTask:m},children:a})},H=()=>c.useContext(_e),Ve=[{label:"Tipo de dependencia",type:"select",id:"dependency",options:[{id:"con",name:"Con dependencia"},{id:"sin",name:"Sin dependencia"},{id:"ambas",name:"Ambas"}]},{label:"Por responsable",type:"select",id:"owner.config",options:[{id:"yo",name:"Mis tareas"},{id:"yo_y_mis_equipos",name:"Tareas mías y de mis equipos"},{id:"mis_equipos",name:"Tareas de mis equipos"}]},{label:"Por dificultad",type:"select",id:"difficulty",options:[{id:0,name:"Muy facil"},{id:1,name:"Facil"},{id:2,name:"Media"},{id:3,name:"Dificil"},{id:4,name:"Muy dificil"}]}],Y=()=>{const{tasks_api:a}=z(),{user:s}=Q(),{filters:n,path:t}=$(),r=P.useQueryClient(),{projectID:l}=H(),i=async({id:h})=>(await a.put(`/api/tareas/${h}`,{data:{estatus:1,responsable:s==null?void 0:s.id,updated_by:s==null?void 0:s.id}})).data,d=async({id:h})=>(await a.post("/api/terminarTarea",{id_task:h,ended_at:new Date().toISOString(),id_user:s==null?void 0:s.id})).data,o=async({id:h,repeats:y})=>(await a.put(`/api/tareas/${h}`,{data:{repeticiones_realizadas:y,updated_by:s==null?void 0:s.id}})).data,g=async({id:h,idNewResponsible:y,typeOfSelect:C})=>{let D={updated_by:s==null?void 0:s.id};return C==="responsible"&&(D={...D,responsable:y}),C==="team"&&(D={...D,responsable:null,equipo:y}),(await a.put(`/api/tareas/${h}`,{data:D})).data},u=async({id:h,data:y,user:C})=>{},b=async({id:h})=>{await x({id:h})},{mutateAsync:x}=P.useMutation({mutationFn:i,onSuccess:()=>{const h={"kanban-general":"to_do_tasks","kanban-campania":"tasksProject"};try{t==="kanban-general"&&(r.invalidateQueries({queryKey:[h[t],n]}),r.invalidateQueries({queryKey:["working_tasks",n]})),t==="kanban-campania"&&(r.invalidateQueries({queryKey:["tasksProject"]}),r.invalidateQueries({queryKey:["tasksProject",n,l]}))}catch(y){console.error("Error updating the element:",y)}},onError:h=>{console.error("Failed to update the task.",h)},onMutate:async({id:h})=>{await r.cancelQueries({queryKey:["working_tasks"]}),await r.cancelQueries({queryKey:["to_do_tasks"]})}}),{mutateAsync:f}=P.useMutation({mutationFn:d,onSuccess:()=>{const h={"kanban-general":"to_do_tasks","kanban-campania":"tasksProject"};try{r.setQueryData([h[t],n],y=>{console.log({oldData:y})}),t==="kanban-general"&&(r.invalidateQueries({queryKey:[h[t],n]}),r.invalidateQueries({queryKey:["done_tasks",n]}),r.invalidateQueries({queryKey:["working_tasks",n]})),t==="kanban-campania"&&(r.invalidateQueries({queryKey:["tasksProject"]}),r.invalidateQueries({queryKey:["tasksProject",n,l]}))}catch(y){console.error("Error invalidating queries:",y)}},onError:h=>{console.error("Failed to update the task.",h)},onMutate:async({id:h})=>{await r.cancelQueries({queryKey:["working_tasks"]}),await r.cancelQueries({queryKey:["done_tasks"]}),await r.cancelQueries({queryKey:["to_do_tasks"]})}}),{mutateAsync:m}=P.useMutation({mutationFn:o,onSuccess:()=>{const h={"kanban-general":"to_do_tasks","kanban-campania":"tasksProject"};try{t==="kanban-general"&&(r.invalidateQueries({queryKey:[h[t],n]}),r.invalidateQueries({queryKey:["done_tasks",n]}),r.invalidateQueries({queryKey:["working_tasks",n]})),t==="kanban-campania"&&(r.invalidateQueries({queryKey:["tasksProject"]}),r.invalidateQueries({queryKey:["tasksProject",n,l]}))}catch(y){console.error("Error invalidating queries:",y)}},onError:h=>{console.error("Failed to update the task.",h)},onMutate:async({id:h})=>{await r.cancelQueries({queryKey:["working_tasks"]}),await r.cancelQueries({queryKey:["done_tasks"]}),await r.cancelQueries({queryKey:["to_do_tasks"]})}}),{mutateAsync:j}=P.useMutation({mutationFn:g,onSuccess:()=>{const h={"kanban-general":"to_do_tasks","kanban-campania":"tasksProject"};try{t==="kanban-general"&&(r.invalidateQueries({queryKey:[h[t],n]}),r.invalidateQueries({queryKey:["done_tasks",n]}),r.invalidateQueries({queryKey:["working_tasks",n]})),t==="kanban-campania"&&(r.invalidateQueries({queryKey:["tasksProject"]}),r.invalidateQueries({queryKey:["tasksProject",n,l]}))}catch(y){console.error("Error invalidating queries:",y)}},onError:h=>{console.error("Failed to reassign the task.",h)},onMutate:async({id:h})=>{await r.cancelQueries({queryKey:["working_tasks"]}),await r.cancelQueries({queryKey:["done_tasks"]}),await r.cancelQueries({queryKey:["to_do_tasks"]})}});return{updateTask:u,startWorking:b,completeTask:async({id:h})=>{await f({id:h})},reasignResponsible:async({id:h,idNewResponsible:y,typeOfSelect:C})=>{await j({id:h,idNewResponsible:y,typeOfSelect:C})},updateUnitys:async({repeats:h,id:y})=>{await m({repeats:h,id:y})}}},Ge=({id:a})=>{const[s,n]=c.useState(!1),{completeTask:t}=Y();return{checked:s,checkTask:()=>{n(!s),t({id:a})}}},Fe=({id:a,nameRequiredTask:s,statusRequiredTask:n,status:t})=>{const{checked:r,checkTask:l}=Ge({id:a});let i=Math.random().toString();return e.jsxs(e.Fragment,{children:[t===2&&e.jsx("div",{className:"bg-success-regular rounded-full flex items-center justify-center mx-[2px] transition-all",children:e.jsx(w.Icons,{icon:"circle_checked",color:"white",strokeWidth:4,size:"xs"})}),s!==""&&n===2||!s?t===1?e.jsx("label",{htmlFor:i,className:r?"bg-success-regular rounded-full w-[20px] h-[20px] flex items-center justify-center mx-[2px] transition-all":" transition-colors",children:e.jsx(w.Icons,{icon:r?"check_outline":"circle_checked",color:r?"white":v.texts.placeholder,strokeWidth:4,size:r?"xs":"s"})}):e.jsx(e.Fragment,{children:" "}):e.jsx(w.Tooltip,{dispatch:e.jsx("label",{className:"cursor-help",children:e.jsx(w.Icons,{icon:"info_circle",color:v.warning.regular,strokeWidth:4})}),children:e.jsxs("div",{className:" p-l max-w-[400px] w-fit bg-warning-light rounded-lg border-l-[5px] border-warning-regular text-warning-dark text-xs flex flex-col gap-m",children:[e.jsx("p",{className:"font-bold",children:" Requiere completar su tarea requerida: "}),e.jsxs("p",{children:[" ",s," "]})]})}),e.jsx("input",{id:i,checked:r,onChange:l,type:"checkbox",className:"hidden"})]})},U=({imageUrl:a="https://www.uv.unach.mx/assets/img/prueba/directorio/userM.png",alt:s="avatar"})=>e.jsx("img",{src:a===""?"https://www.uv.unach.mx/assets/img/prueba/directorio/userM.png":a,alt:s??"avatar",className:"w-[28px] h-[28px] min-w-[28px] min-h-[28px] rounded-full bg-containers border-2 border-white"}),he=({trigger:a,user:s,showUser:n=!0})=>e.jsx(w.Tooltip,{dispatch:a,children:n&&e.jsxs("div",{className:"flex items-center gap-2 bg-containers w-fit h-fit p-2 rounded-lg border-containers",children:[e.jsx(U,{imageUrl:s.image??"",alt:s.name}),e.jsx("p",{className:"text-xs font-bold content-text",children:s.name})]})}),Ye=({options:a,onselect:s})=>{const[n,t]=c.useState(null),r=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),l=[...a].filter(i=>i.name.toLowerCase().includes((n==null?void 0:n.toLowerCase())??""));return e.jsxs("div",{className:"h-fit w-full min-w-max",children:[e.jsxs("div",{className:"relative flex items-center",children:[e.jsx("input",{id:r,value:n??"",onChange:i=>t(i.target.value),type:"text",className:"w-full h-[32px] bg-bg-card border-cards rounded-lg p-2",placeholder:"Buscar"}),e.jsx("div",{className:"absolute right-[8px]",children:e.jsx(w.Icons,{icon:"search",size:"xs",strokeWidth:3})})]}),e.jsx("div",{className:"bg-bg-card border-cards rounded-lg p-2 flex flex-col gap-s overflow-y-auto max-h-[120px] min-w-max",children:l.map(i=>e.jsxs("button",{onClick:()=>{s(i)},className:"flex gap-s items-center max-w-[200px] min-w-full hover:bg-primary-light cursor-pointer",children:[e.jsx(U,{imageUrl:i.image,alt:i.name}),e.jsx("p",{className:"text-xs font-bold content-text",children:i.name})]}))})]})};class Xe{static toDomain(s){return{id:s.id,name:s.nombre,color:s.color}}}const Je=()=>{const{tasks_api:a}=z();return{teams:P.useQuery({queryKey:["teams","all"],queryFn:async()=>{const n=await a.get("/api/equipos");return O(n.data).map(Xe.toDomain)}})}};class Ze{static toUsers(s){var n,t,r;return{id:s.id,name:s.nombre,image:(r=(t=(n=s.imagen)==null?void 0:n.formats)==null?void 0:t.thumbnail)==null?void 0:r.url}}}const es=async({tasks_api:a})=>{try{const s=await a.get("/api/allOBPUsers");return O(s.data).map(Ze.toUsers)}catch(s){throw console.log("Error al obtener los usuarios comerciales",s),`Error al obtener los usuarios comerciales: ${s}`}},ss=()=>{const{tasks_api:a}=z();return{users:P.useQuery({queryKey:["users"],queryFn:()=>es({tasks_api:a}),staleTime:1e3*60*60*24})}},se=a=>new Intl.DateTimeFormat("es-MX",{month:"long"}).format(a);function ts(a){const s=["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],n=new Date(a).getDay();return s[n]}const fe=a=>{let s=a||new Date,n=s.getDate(),t=se(s.getMonth()).slice(0,3),r=s.getFullYear().toString().slice(-2),l=ts(s).slice(0,3);return`${l.charAt(0).toUpperCase()+l.slice(1)} ${n} ${t.charAt(0).toUpperCase()+t.slice(1)} ${r}`},te=a=>({...a,image:a.image?`https://devobp.imjmedia.com.mx${a.image}`:""}),Se=({users:a,onClick:s,responsible:n})=>{let t=`button-assign-users-${Math.random().toString(36).substring(2,15)}`;const{setElementPosition:r,position:l,clearPosition:i}=ee(),d=c.useRef(null),o=()=>n?null:a.length>3&&e.jsx(w.Tooltip,{dispatch:e.jsx("div",{className:"w-[28px] h-[28px] rounded-full btn-primary flex items-center justify-center border-2 border-white ml-[-8px]",children:e.jsx("p",{className:"text-xs font-bold text-white ",children:`+${a.length-3}`})}),children:e.jsx("div",{className:"bg-containers w-fit h-fit p-2 rounded-lg border-containers",children:a==null?void 0:a.slice(3).map((x,f)=>e.jsxs("div",{className:"flex items-center gap-2 ",children:[e.jsx(U,{imageUrl:x.image??"",alt:x.name},f),e.jsx("p",{className:"text-xs font-bold content-text",children:x.name})]},f))})}),g=()=>{if(n){let x=a.find(f=>f.id===n);return e.jsx("div",{children:e.jsx(he,{trigger:e.jsx(U,{imageUrl:x==null?void 0:x.image,alt:x==null?void 0:x.name},n),user:x,showUser:!(l!=null&&l.x)})})}return(a==null?void 0:a.length)>0&&a.slice(0,3).map((x,f)=>e.jsx("div",{className:`${f===0?"":"ml-[-8px]"}`,children:e.jsx(he,{trigger:e.jsx(U,{imageUrl:x.image,alt:x.name},f),user:x,showUser:!(l!=null&&l.x)})}))},u=({children:x})=>e.jsx("label",{ref:d,htmlFor:t,className:"cursor-pointer flex items-center",children:x});if(a.length===0)return e.jsx(u,{children:e.jsx(w.Icons,{icon:"user",size:"xs",strokeWidth:3})});const b=()=>{var h;const[x,f]=c.useState(),[m,j]=c.useState("team"),{teams:N}=Je(),{users:_}=ss();c.useEffect(()=>{var y,C;d.current&&f(((l==null?void 0:l.x)??0)-(((C=(y=d.current)==null?void 0:y.getBoundingClientRect())==null?void 0:C.width)??0))},[d==null?void 0:d.current,l==null?void 0:l.x]);const F=()=>{const y=[{id:"team",label:"Equipo"},{id:"responsible",label:"Responsable"}];return e.jsx("div",{className:"w-full flex justify-center gap-l text-texts-placeholder font-bold",children:y.map((C,D)=>e.jsx("button",{className:`w-full text-sm border-texts-placeholder text-center ${m===C.id?"text-primary-pastel":""} ${D===y.length-1?"border-r-0":" border-r-2"}`,onClick:()=>j(C.id),children:C.label}))})};return(l==null?void 0:l.x)&&G.createPortal(e.jsx("div",{"data-portal-host":!0,className:`absolute w-[300px] h-fit ${x?"block":"hidden"}`,style:{top:`${l==null?void 0:l.y}px`,left:`${x}px`,zIndex:1},children:e.jsxs("div",{className:"flex flex-col gap-m bg-bg-card border-cards rounded-lg p-2 max-h-[200px] overflow-y-hidden",children:[e.jsx(F,{}),e.jsx(Ye,{options:m==="team"?N.data.map(y=>({id:y.id,name:y.name,image:""})):(h=_.data)==null?void 0:h.map(te),onselect:y=>{i(),s&&s(y,m)}})]})}),document.body)};return e.jsxs(e.Fragment,{children:[e.jsxs(u,{children:[g(),o()]}),e.jsx("button",{className:"hidden",id:t,onClick:()=>r(d)}),e.jsx(b,{})]})};function as({items:a}){var t;const[s,n]=c.useState(1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-row mb-2 border-b border-neutral-100 bg-white mt-4",children:a.map((r,l)=>e.jsx("div",{className:`border-r border-neutral-100 pr-3 py-1 ${l!==0?"px-3":""}`,children:e.jsx(S.Button,{variant:"ghost",onClick:()=>n(r.id),className:`text-sm font-normal rounded-none py-1 h-8 ${s===r.id?"text-primary border-b border-primary":"text-neutral-400 border-b-0"}`,children:r.label},r.id)},r.id))}),e.jsx("div",{className:"pt-4 flex-1 overflow-y-auto bg-white",children:(t=a.find(r=>r.id===s))==null?void 0:t.component})]})}const Te="https://devobp.imjmedia.com.mx";function ae(a){return a?a.split(" ").map(t=>{var r;return(r=t[0])==null?void 0:r.toUpperCase()}).slice(0,2).join(""):""}const rs="https://devobp.imjmedia.com.mx";function ns({comment:a}){var n,t,r,l,i,d;function s(o){const g=V.parseISO(o);return V.formatDistanceToNow(g,{locale:Z.es,addSuffix:!0})}return e.jsx("div",{children:e.jsxs("div",{className:"flex flex-row gap-3 items-start",children:[e.jsxs(S.Avatar,{className:"w-[28px] h-[28px]",children:[e.jsx(S.AvatarImage,{src:`${rs}${(l=(r=(t=(n=a==null?void 0:a.autor)==null?void 0:n.imagen)==null?void 0:t.formats)==null?void 0:r.thumbnail)==null?void 0:l.url}`,alt:"@shadcn"}),e.jsx(S.AvatarFallback,{children:ae((i=a==null?void 0:a.autor)==null?void 0:i.nombre)})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex flex-row gap-2",children:[e.jsx("p",{className:"text-sm text-neutral-900 font-medium",children:(d=a==null?void 0:a.autor)==null?void 0:d.nombre}),e.jsx("span",{className:"text-xs text-neutral-600 font-normal mt-[2px]",children:s(a==null?void 0:a.createdAt)})]}),e.jsx("p",{className:"text-sm text-neutral-600 font-normal",children:a==null?void 0:a.comentario})]})]})})}function ls({currentUser:a,data:s,taskId:n,onNewComment:t}){var b,x,f;const{tasks_api:r}=z(),{register:l,handleSubmit:i,reset:d}=$e.useForm(),[o,g]=c.useState([]);c.useEffect(()=>{if(s!=null&&s.comentarios){const m=[...s.comentarios].sort((j,N)=>new Date(N.createdAt).getTime()-new Date(j.createdAt).getTime());g(m)}},[s]);const u=async m=>{try{const j={autor:{id:a==null?void 0:a.id,email:a==null?void 0:a.email,nombre:a==null?void 0:a.nombre,imagen:a==null?void 0:a.imagen},comentario:m==null?void 0:m.comment,createdAt:new Date().toISOString()};await r.post("/api/comentarios",{data:{autor:a==null?void 0:a.id,comentario:m.comment,tarea:n}}),t(!0),g(N=>[j,...N]),d()}catch(j){console.error("Error al agregar comentario:",j)}};return e.jsxs("div",{className:"flex flex-col h-full gap-4",children:[e.jsxs("form",{onSubmit:i(u),className:"flex flex-row items-center gap-3",children:[e.jsxs(S.Avatar,{className:"w-[28px] h-[28px]",children:[e.jsx(S.AvatarImage,{src:`${Te}${(f=(x=(b=a==null?void 0:a.imagen)==null?void 0:b.formats)==null?void 0:x.thumbnail)==null?void 0:f.url}`,alt:"@shadcn"}),e.jsx(S.AvatarFallback,{className:"border border-x-primary-pastel",children:ae(a==null?void 0:a.nombre)})]}),e.jsx(S.Input,{...l("comment",{required:!0}),autoComplete:"off",placeholder:"Escribe un comentario",className:"w-full bg-white border border-neutral-200"})]}),o.map((m,j)=>e.jsx(ns,{comment:m},j))]})}function is({data:a}){const s={0:{color:"bg-gray-400",label:"Sin estado"},1:{color:"bg-primary-regular",label:"En curso"},2:{color:"bg-success-regular",label:"Finalizada"},3:{color:"bg-success-regular",label:"Finalizada"}},n=t=>t?V.format(new Date(t),"d MMM",{locale:Z.es}):"";return e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-row items-center gap-4",children:[e.jsx(S.Label,{className:"text-lg font-medium text-neutral-900",children:"Tareas dependientes"}),e.jsx("span",{className:"text-sm font-normal text-neutral-600 bg-[#E1EBF9] w-6 h-6 rounded-full flex items-center justify-center text-primary",children:a==null?void 0:a.length})]}),e.jsx("div",{className:"flex flex-col gap-2 border border-neutral-200 rounded-lg mt-3",children:a==null?void 0:a.map(t=>{var r,l,i,d,o;return e.jsxs("div",{className:"flex flex-row w-full items-center justify-between gap-s border-b border-neutral-200 py-1 px-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{imageUrl:(d=(i=(l=(r=t.responsable)==null?void 0:r.image)==null?void 0:l.formats)==null?void 0:i.thumbnail)==null?void 0:d.url}),e.jsx("p",{className:"text-sm font-normal w-[400px] text-nowrap text-ellipsis overflow-hidden",children:t==null?void 0:t.texto_corto})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("p",{className:"text-sm font-normal",children:n(t==null?void 0:t.createdAt)}),e.jsx("div",{className:`w-4 h-4 bg-gray-400 block rounded-full ${((o=s[t==null?void 0:t.estatus])==null?void 0:o.color)??"bg-gray-400"}`})]})]},t.id)})})]})}const os="https://devobp.imjmedia.com.mx";function cs({isOpen:a,setIsOpen:s,taskId:n}){var N,_,F,h,y,C,D,W,R,L,p,q,M;const[t,r]=c.useState(null),[l,i]=c.useState(!1),[d,o]=c.useState(!1),[g,u]=c.useState(null),{tasks_api:b}=z(),{user:x}=Q();c.useEffect(()=>{if(a&&n||l){const A=async()=>{const T=await b.get(`/api/detalleTarea/${n}`);r(T==null?void 0:T.data)},B=async()=>{var I,K;const T=await b.get(`/api/users/${x.id}`),E=await b.post("/api/obtenerUsuarioOBP/",{emailList:[(I=T==null?void 0:T.data)==null?void 0:I.email]});u((K=E==null?void 0:E.data)==null?void 0:K.data[0])};A(),B()}},[a,n,l]);const f={0:{label:"Sin prioridad",color:"text-primary-regular",iconColor:"#425CAC"},1:{label:"Baja",color:"text-success-regular",iconColor:"#43B071"},2:{label:"Media",color:"text-warning-regular",iconColor:"#D38A31"},3:{label:"Alta",color:"text-danger-regular",iconColor:"#C34335"}},m=A=>A?V.format(A,"d MMM yyyy, h:mmaaa",{locale:Z.es}):"Fecha no disponible",j=[{id:1,label:"Todo",component:e.jsx(ls,{taskId:n,currentUser:g,data:t,onNewComment:i})},{id:2,label:"Dependencias",component:e.jsx(is,{data:t==null?void 0:t.ids_t_dependientes})}];return a&&G.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-portal-host":!0,className:`fixed inset-0 bg-transparent bg-opacity-50 flex justify-center items-center z-1 ${a?"pointer-events-auto block":"pointer-events-none hidden"}`,onClick:()=>s(!1)}),e.jsx("section",{className:`fixed top-0 bottom-0 bg-white bg-opacity-50 flex justify-center items-center w-[40rem] h-screen z-1 overflow-hidden transition-all ease-in-out duration-500 shadow-2xl ${a?"right-0 pointer-events-auto block":"right-[-100%] pointer-events-none hidden"}`,children:e.jsxs("div",{className:"flex w-full h-full flex-col overflow-y-scroll bg-white border-none shadow-xl px-4 py-6",children:[e.jsxs("div",{className:"w-full flex flex-row justify-between pb-4 gap-10 border-none",children:[e.jsxs("div",{className:"flex flex-row items-start gap-2 relative",children:[((N=t==null?void 0:t.id_t_requerida)==null?void 0:N.id)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"cursor-help",onMouseOver:()=>o(!0),onMouseLeave:()=>o(!1),children:e.jsx(w.Icons,{icon:"info_circle",color:v.warning.regular,strokeWidth:4})}),d&&e.jsxs("div",{style:{top:"25px"},className:"p-l max-w-[400px] absolute w-fit bg-warning-light rounded-lg border-l-[5px] border-warning-regular text-warning-dark text-xs flex flex-col gap-m",children:[e.jsx("p",{className:"font-bold",children:"Requiere completar su tarea requerida:"}),e.jsx("p",{className:"text-xs text-neutral-600 font-normal",children:(_=t==null?void 0:t.id_t_requerida)==null?void 0:_.texto_corto})]})]}),e.jsx("h3",{className:"text-lg font-semibold text-neutral-900",children:t==null?void 0:t.texto_corto})]}),e.jsx(S.Button,{variant:"shadow",size:"sm",onClick:()=>s(!1),className:"bg-neutral-100 w-10 h-10",children:e.jsx(w.Icons,{icon:"x_outline"})})]}),e.jsx("div",{className:"w-full flex flex-row justify-between",children:e.jsxs("span",{className:"text-neutral-600 text-sm",children:[t==null?void 0:t.campania," / ",t==null?void 0:t.nombre_medio]})}),e.jsxs("div",{className:"w-full flex flex-col gap-3 mt-4",children:[e.jsx("h6",{className:"text-neutral-900 font-semibold text-base",children:"Descripción"}),e.jsx("p",{className:"text-neutral-600 font-normal text-sm",children:(t==null?void 0:t.texto_largo)??"Sin descripción"})]}),e.jsx(S.Accordion,{type:"single",collapsible:!0,defaultValue:"item-1",className:"w-full flex flex-col border border-neutral-200 rounded-xl mt-4",children:e.jsxs(S.AccordionItem,{value:"item-1",className:"border-none",children:[e.jsx(S.AccordionTrigger,{className:"text-neutral-900 font-medium text-sm w-full flex flex-row border-b border-neutral-200 p-4 ",children:"Detalles"}),e.jsx(S.AccordionContent,{className:"border-none",children:e.jsxs("div",{className:"w-full grid grid-cols-3 gap-4 p-4",children:[e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Responsable"}),(F=t==null?void 0:t.responsable)!=null&&F.nombre?e.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[e.jsxs(S.Avatar,{className:"w-[28px] h-[28px]",children:[e.jsx(S.AvatarImage,{src:`${os}${(D=(C=(y=(h=t==null?void 0:t.responsable)==null?void 0:h.imagen)==null?void 0:y.formats)==null?void 0:C.thumbnail)==null?void 0:D.url}`,alt:"@shadcn"}),e.jsx(S.AvatarFallback,{children:ae((W=t==null?void 0:t.responsable)==null?void 0:W.nombre)})]}),e.jsx("span",{className:"text-xs text-neutral-600 font-normal",children:(R=t==null?void 0:t.responsable)==null?void 0:R.nombre})]}):e.jsx("span",{className:"text-xs text-neutral-600 font-normal",children:"Sin responsable"})]}),e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Equipo asignado"}),e.jsx("div",{className:"flex flex-row gap-2",children:e.jsx("span",{className:"text-xs text-neutral-600 font-normal",children:((L=t==null?void 0:t.equipo)==null?void 0:L.nombre)??"Sin equipo"})})]}),e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Prioridad"}),e.jsxs("div",{className:"flex flex-row items-center gap-2",children:[e.jsx(w.Icons,{icon:"flag",size:"xs",strokeWidth:5,color:(p=f[t==null?void 0:t.prioridad])==null?void 0:p.iconColor}),e.jsx("span",{className:`text-sm text-neutral-600 font-normal ${(q=f[t==null?void 0:t.prioridad])==null?void 0:q.color}`,children:((M=f[t==null?void 0:t.prioridad])==null?void 0:M.label)??"Sin prioridad"})]})]}),e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Lista"}),e.jsx("div",{className:"flex flex-row gap-2",children:e.jsx("span",{className:"text-xs text-neutral-600 font-normal",children:(t==null?void 0:t.lista)??"Sin lista"})})]}),e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Fecha estimada de inicio"}),e.jsx("p",{className:"text-xs text-neutral-600 font-normal",children:m(t==null?void 0:t.f_inicio_estimada)})]}),e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Fecha estimada de fin"}),e.jsx("p",{className:"text-xs text-neutral-600 font-normal",children:m(t==null?void 0:t.f_fin_estimada)})]}),e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Fecha de fin"}),e.jsx("p",{className:"text-xs text-neutral-600 font-normal",children:m(t==null?void 0:t.ffin)})]}),e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Creado"}),e.jsx("p",{className:"text-xs text-neutral-600 font-normal",children:m(t==null?void 0:t.createdAt)})]}),e.jsxs("div",{className:"flex flex-col w-auto gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-900 font-medium",children:"Última modificación"}),e.jsx("p",{className:"text-xs text-neutral-600 font-normal",children:m(t==null?void 0:t.updatedAt)})]})]})})]})}),e.jsx(as,{items:j})]})})]}),document.body)}const qe=({status:a,nameRequiredTask:s,statusRequiredTask:n,id:t})=>{const{setElementPosition:r,position:l}=ee(),{startWorking:i,completeTask:d}=Y(),o=c.useRef(null),g=c.useRef(!1),u=({children:b})=>{const[x,f]=c.useState();return c.useEffect(()=>{var m,j;o.current&&f(((l==null?void 0:l.x)??0)-(((j=(m=o.current)==null?void 0:m.getBoundingClientRect())==null?void 0:j.width)??0))},[o==null?void 0:o.current,l==null?void 0:l.x]),l&&G.createPortal(e.jsx("div",{"data-portal-host":!0,className:`absolute w-fit h-fit ${x?"block":"hidden"}`,style:{top:`${l==null?void 0:l.y}px`,left:`${x}px`,zIndex:1},children:b}),document.body)};return e.jsxs(e.Fragment,{children:[a<2&&(s!==""&&n===2||!s)&&e.jsx("button",{ref:o,onClick:()=>{r(o)},className:"flex items-center justify-center text-sm font-extrabold bg-bg hover:filter-[drop-shadow(0_0_10px_#000000)] rounded-full w-[24px] h-[24px] m-block",children:e.jsx("span",{className:"rotate-90",children:e.jsx(w.Icons,{icon:"elipsis",size:"xs"})})}),e.jsx(u,{children:g!=null&&g.current?e.jsx("div",{className:"w-max h-fit bg-bg-card rounded-lg p-l shadow-lg flex items-center gap-2 hover:bg-primary-light",children:e.jsx("p",{className:"text-sm font-normal text-primary-pastel font-regular",children:"Moviendo..."})}):e.jsxs("button",{className:"w-max h-fit bg-bg-card rounded-lg p-l shadow-lg flex items-center gap-2 hover:bg-primary-light",onClick:()=>{g.current=!0,a===0?i({id:t}):d({id:t})},children:[e.jsx("p",{className:"text-sm font-normal text-texts-placeholder font-regular",children:a===0?"Mover a trabajando":"Mover a completadas"}),e.jsx(w.Icons,{icon:"arrow_right",size:"xs",strokeWidth:4,color:v.primary.regular})]})})]})},ds=({id:a,task:s,endDate:n,users:t,willBePaused:r,nameProject:l,idProject:i,comments:d,priority:o,difficulty:g,responsible:u,nameRequiredTask:b,statusRequiredTask:x,status:f,repeatsToDo:m,repeats:j,medioName:N})=>{var q,M,A,B,T,E;const[_,F]=c.useState(!1),{reasignResponsible:h,updateUnitys:y}=Y(),[C,D]=c.useState(j??0),W=()=>e.jsxs("div",{className:"flex justify-between items-center w-full h-fit relative",children:[e.jsxs("div",{className:"flex items-center gap-[8px] w-[calc(100%-32px)] ",children:[f<2&&(m&&j===m||m===1||!m)&&e.jsx(Fe,{id:a,nameRequiredTask:b??"",statusRequiredTask:x??0,status:f}),e.jsx("p",{className:"title-text",onClick:()=>F(!0),children:s})]}),(m&&j===m||m===1||!m)&&e.jsx(qe,{id:a,nameRequiredTask:b,status:f,statusRequiredTask:x})]}),R={0:{title:"N/A",color:v.texts.placeholder},1:{title:"Baja",color:v.primary.regular},2:{title:"Media",color:v.success.regular},3:{title:"Alta",color:v.danger.regular}},L={0:{title:"Muy fácil",color:v.primary.regular},1:{title:"Fácil",color:v.success.regular},2:{title:"Media",color:v.warning.regular},3:{title:"Difícil",color:v.danger.regular},4:{title:"Muy difícil",color:v.danger.dark}},p=I=>{D(K=>I==="minus"?Math.max(0,K-1):Math.min(m,K+1))};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-bg-card border-cards max-w-[350px] rounded-lg relative h-fit p-[12px_12px] hover:border-active hover:bg-active cursor-pointer ",children:[e.jsx(W,{}),e.jsxs("div",{className:"flex flex-col gap-[4px] py-2",children:[e.jsx("p",{className:"subtitle-text",children:l}),N&&e.jsx("p",{className:"content-text",children:N})]}),e.jsxs("div",{className:"flex justify-between items-center w-full h-fit relative pt-5 pb-1",children:[e.jsxs("div",{className:"flex items-center relative",children:[e.jsx(Se,{responsible:u,users:t.filter(I=>u?I.id===u:!0).map(te),onClick:async(I,K)=>{await h({idNewResponsible:I==null?void 0:I.id,id:a,typeOfSelect:K})}}),r&&e.jsx(w.Tooltip,{dispatch:e.jsxs("button",{className:"text-sm font-regular text-gray-400 flex items-center gap-2",children:[e.jsx(w.Icons,{icon:"pause",size:"s",strokeWidth:2}),e.jsx("span",{children:"Pause"})]}),children:e.jsx("p",{className:"text-sm font-regular text-white p-5",children:"Al pulsar el botón se solicitará razón del pausado"})})]}),e.jsxs("div",{className:"flex gap-m items-center flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w.Tooltip,{dispatch:e.jsx(w.Icons,{icon:"difficulty",size:"xs",color:(q=L[g??0])==null?void 0:q.color,strokeWidth:4}),children:e.jsx("p",{className:"text-sm font-regular p-5 bg-bg-card rounded-lg",style:{color:(M=L[g??0])==null?void 0:M.color},children:`Dificultad ${(A=L[g??0])==null?void 0:A.title}`})}),e.jsx(w.Tooltip,{dispatch:e.jsx(w.Icons,{icon:"flag",size:"xs",color:(B=R[o??0])==null?void 0:B.color,strokeWidth:4}),children:e.jsx("p",{className:"text-sm font-regular p-5 bg-bg-card rounded-lg",style:{color:(T=R[o??0])==null?void 0:T.color},children:`Prioridad: ${(E=R[o??0])==null?void 0:E.title}`})}),!m||m&&f===0&&e.jsxs(e.Fragment,{children:[e.jsx(w.Icons,{icon:"calendar",size:"xs",strokeWidth:3,color:v.texts.subtext}),e.jsx("p",{className:"text-sm font-regular text-texts-subtext",children:`${n.getDate()} ${se(n.getMonth()).slice(0,3)}`})]})]}),f===1&&m&&m>0&&e.jsxs("div",{className:"flex items-center gap-m",children:[e.jsx("p",{className:"text-xs text-texts-placeholder ",children:"unidades"}),e.jsx("button",{onClick:()=>p("minus"),className:"flex items-center justify-center bg-gray-200 w-[0] rounded-full hover:bg-gray-400",children:e.jsx(w.Icons,{icon:"circle_minus",size:"xs",strokeWidth:3,color:v.texts.placeholder})}),e.jsx("p",{className:"text-xs text-texts-placeholder",children:`${C??0} / ${m??0}`}),e.jsx("button",{onClick:()=>p("plus"),className:"flex items-center justify-center bg-gray-200 w-[0] rounded-full hover:bg-gray-400",children:e.jsx(w.Icons,{icon:"circle_plus",size:"xs",strokeWidth:3,color:v.texts.placeholder})}),e.jsx("button",{className:"text-xs bg-primary-medium rounded-md py-s px-m text-primary-regular",onClick:()=>{y({repeats:C,id:a})},children:"Agregar"})]})]})]}),d>0&&e.jsx("div",{className:"border-t border-gray-200 mt-4 pt-2",children:e.jsxs("button",{onClick:()=>F(!0),className:"flex items-center gap-2",children:[e.jsx(w.Icons,{icon:"comment",size:"xs",strokeWidth:4}),e.jsx("span",{className:"text-sm font-regular text-gray-400",children:d})]})})]}),e.jsx(cs,{taskId:a,isOpen:_,setIsOpen:F})]})},us=()=>e.jsxs("div",{className:"bg-gray-200 h-[150px] w-full animate-pulse rounded-md flex flex-col gap-[50px] p-4",children:[e.jsxs("div",{className:"flex h-[30px] gap-3",children:[e.jsx("div",{className:"w-[30px] min-w-[30px] h-full bg-gray-300 rounded-full"}),e.jsx("div",{className:"w-full h-full bg-gray-300"}),e.jsx("div",{className:"w-[30px] min-w-[30px] h-full bg-gray-300 rounded-full"})]}),e.jsxs("div",{className:"flex justify-between w-full h-[30px] gap-[50px]",children:[e.jsx("div",{className:"w-full h-[30px] bg-gray-300"}),e.jsx("div",{className:"w-full h-[30px] bg-gray-300"})]})]}),X=({title:a,tasks:s,loadNextPage:n,isFetching:t,total:r})=>{const l=c.useRef(null),i=c.useRef(null),d=c.useRef(!1);c.useEffect(()=>{var u;l!=null&&l.current&&(i!=null&&i.current)&&(i.current.style.minHeight=`${((u=l==null?void 0:l.current)==null?void 0:u.clientHeight)-50}px`)},[l==null?void 0:l.current]);const o=u=>{if(d.current)return;const{scrollTop:b,clientHeight:x,scrollHeight:f}=u==null?void 0:u.target,m=b/(f-x)*100;m<=95||m>=95&&(d.current=!0,n&&n(),setTimeout(()=>{d.current=!1},200))},g={"Por hacer":"border-texts-placeholder",Trabajando:"border-primary-regular",Completadas:"border-success-regular"};return e.jsxs("div",{ref:l,className:` flex flex-col bg-containers w-fit max-w-[400px] min-w-[400px] h-full min-h-[100%] pb-[200px] relative p-[16px] rounded-lg overflow-hidden border-t-4 ${g[a]}`,children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("div",{className:"flex items-center gap-[8px]",children:e.jsx("p",{className:"text-base",children:a})}),e.jsx("div",{className:"flex items-center gap-[8px]",children:e.jsxs("div",{className:"flex items-center gap-[4px]",children:[e.jsx(w.Icons,{icon:"group_files",size:"xs",strokeWidth:5,color:v.texts.placeholder}),e.jsx("p",{className:"text-md text-texts-placeholder",children:r??0})]})})]}),e.jsxs("div",{ref:i,className:"flex flex-col gap-[12px] overflow-y-auto scrollbar-none py-4",onScroll:o,children:[s==null?void 0:s.map(u=>e.jsx(ds,{...u},u.id)),t?e.jsx(us,{}):e.jsx("p",{className:"text-center text-gray-500",children:"No hay más tareas por mostrar..."})]})]})},xs=()=>{var r;const{defineFields:a}=$(),{tasksProject:s}=H();c.useEffect(()=>{(async()=>{let i=[...Ve];a(i)})()},[]);let n=(r=s==null?void 0:s.data)==null?void 0:r.filter(l=>{var i;return((i=l==null?void 0:l.tasks)==null?void 0:i.length)===0}).reduce((l,i)=>(l[i.status]=l[i.status]||[],l[i.status].push(i),l),{});const t=["Por hacer","Trabajando","Completadas"];return e.jsx("div",{className:"flex gap-4 w-full h-full min-h-[100%] relative ",children:t.map((l,i)=>{var d;return e.jsx(X,{total:((d=n==null?void 0:n[i])==null?void 0:d.length)??0,title:l,tasks:(n==null?void 0:n[i])??[],isFetching:s==null?void 0:s.isFetching,isLoadingData:s==null?void 0:s.isLoading})})})};class ms{static toKanbanTasks(s){var t,r,l,i,d,o,g,u,b,x,f;let n=[];return s!=null&&s.responsable&&n.push({id:s.responsable.id,name:s.responsable.nombre,image:(d=(i=(l=(r=(t=s.responsable)==null?void 0:t.userOBP)==null?void 0:r.imagen)==null?void 0:l.formats)==null?void 0:i.thumbnail)==null?void 0:d.url}),(o=s==null?void 0:s.equipo)!=null&&o.miembros&&s.equipo.miembros.forEach(m=>{var j,N,_,F;n!=null&&n.find(h=>h.id===m.idUser.id)||m.idUser&&n.push({id:m.idUser.id,name:m.idUser.nombre,image:(F=(_=(N=(j=m==null?void 0:m.userOBP)==null?void 0:j.imagen)==null?void 0:N.formats)==null?void 0:_.thumbnail)==null?void 0:F.url})}),{repeats:s==null?void 0:s.repeticiones_realizadas,repeatsToDo:s==null?void 0:s.repeticiones,comments:0,nameProject:(g=s==null?void 0:s.proyecto)==null?void 0:g.nombre,idProject:(u=s==null?void 0:s.proyecto)==null?void 0:u.id,willBePaused:s.es_pausable,difficulty:s.nivel_dificultad,endDate:new Date(s.ffin),id:s.id,priority:s.prioridad??0,status:s.estatus,task:s.texto_corto,users:n,responsible:((b=s==null?void 0:s.responsable)==null?void 0:b.id)??null,statusRequiredTask:((x=s.id_t_requerida)==null?void 0:x.estatus)??null,nameRequiredTask:((f=s.id_t_requerida)==null?void 0:f.texto_corto)??null,medioName:(s==null?void 0:s.nombre_medio)??null}}}const re=async({filters:a,tasks_api:s})=>{try{return(await s.get("/api/listado_tareas",{params:a})).data.tareas.map(O).map(ms.toKanbanTasks)}catch(n){throw console.log({error:n}),`Error al obtener las tareas: ${n}`}},ne=a=>{var s;if(a!=null&&a.hasNextPage){const n=(s=a==null?void 0:a.data)==null?void 0:s.pages[a.data.pages.length-1];(n==null?void 0:n.length)===30&&(a==null||a.fetchNextPage())}},k=a=>({pagination:{page:a,pageSize:30,withCount:!0}}),ps=()=>{var g;const a=P.useQueryClient(),{tasks_api:s}=z(),{user:n}=Q(),{filters:t}=$(),[r,l]=c.useState(0),[i,d]=c.useState({owner:{user:n.id,config:((g=t==null?void 0:t.owner)==null?void 0:g.config)??"yo_y_mis_equipos"},status:"por_hacer"}),o=P.useInfiniteQuery({initialPageParam:1,queryKey:["to_do_tasks",i],queryFn:({pageParam:u})=>re({filters:{...i,status:"por_hacer",...k(u)},tasks_api:s,page:u}),staleTime:1e3*60*60*24,getNextPageParam:(u,b)=>b.length+1});return c.useEffect(()=>{var u;Object.keys(t).length>0&&d({...t,owner:{user:n.id,config:((u=t==null?void 0:t.owner)==null?void 0:u.config)??"yo_y_mis_equipos"},status:"por_hacer"})},[t]),c.useEffect(()=>{a.invalidateQueries({queryKey:["to_do_tasks",i]})},[i]),c.useEffect(()=>{(async()=>{const b=await s.get("/api/listado_tareas",{params:{...i,status:"por_hacer",...k(1),tasks_api:s,justCount:!0}});l(b.data.total)})()},[i,o==null?void 0:o.data]),{toDoTasks:o,total:r}},gs=()=>{var t,r;const{toDoTasks:a,total:s}=ps(),n=[...((r=(t=a==null?void 0:a.data)==null?void 0:t.pages)==null?void 0:r.flat())??[]];return e.jsx(X,{total:s,title:"Por hacer",tasks:n,loadNextPage:()=>ne(a),isFetching:a==null?void 0:a.isFetching,isLoadingData:a==null?void 0:a.isLoading})},hs=()=>{var g;const a=P.useQueryClient(),{tasks_api:s}=z(),{user:n}=Q(),{filters:t}=$(),[r,l]=c.useState(0),[i,d]=c.useState({owner:{user:n.id,config:((g=t==null?void 0:t.owner)==null?void 0:g.config)??"yo_y_mis_equipos"},status:"trabajando"}),o=P.useInfiniteQuery({initialPageParam:1,queryKey:["working_tasks",t],queryFn:({pageParam:u})=>re({filters:{...i,status:"trabajando",...k(u)},tasks_api:s,page:u}),staleTime:1e3*60*60*24,getNextPageParam:(u,b)=>b.length+1});return c.useEffect(()=>{var u;Object.keys(t).length>0&&d({...t,owner:{user:n.id,config:((u=t==null?void 0:t.owner)==null?void 0:u.config)??"yo_y_mis_equipos"},status:"trabajando"})},[t]),c.useEffect(()=>{a.invalidateQueries({queryKey:["working_tasks",t]})},[i]),c.useEffect(()=>{(async()=>{const b=await s.get("/api/listado_tareas",{params:{...i,status:"trabajando",...k(1),tasks_api:s,justCount:!0}});l(b.data.total)})()},[i,o==null?void 0:o.data]),{workingTasks:o,total:r}},fs=()=>{var t,r;const{workingTasks:a,total:s}=hs(),n=[...((r=(t=a==null?void 0:a.data)==null?void 0:t.pages)==null?void 0:r.flat())??[]];return e.jsx(X,{total:s,title:"Trabajando",tasks:n,loadNextPage:()=>ne(a),isFetching:a==null?void 0:a.isFetching})},bs=()=>{var g;const a=P.useQueryClient(),{user:s}=Q(),{tasks_api:n}=z(),{filters:t}=$(),[r,l]=c.useState(0),[i,d]=c.useState({owner:{user:s.id,config:((g=t==null?void 0:t.owner)==null?void 0:g.config)??"yo_y_mis_equipos"},status:"completadas"}),o=P.useInfiniteQuery({initialPageParam:1,queryKey:["done_tasks",i],queryFn:({pageParam:u})=>re({filters:{...i,status:"completadas",...k(u)},tasks_api:n,page:u}),staleTime:1e3*60*60*24,getNextPageParam:(u,b)=>b.length+1});return c.useEffect(()=>{var u;Object.keys(t).length>0&&d({...t,owner:{user:s.id,config:((u=t==null?void 0:t.owner)==null?void 0:u.config)??"yo_y_mis_equipos"},status:"completadas"})},[t]),c.useEffect(()=>{a.invalidateQueries({queryKey:["done_tasks",i]})},[i]),c.useEffect(()=>{(async()=>{const b=await n.get("/api/listado_tareas",{params:{...i,status:"completadas",...k(1),justCount:!0,tasks_api:n}});l(b.data.total)})()},[o==null?void 0:o.data,i]),{doneTasks:o,total:r}},js=()=>{var t,r;const{doneTasks:a,total:s}=bs(),n=[...((r=(t=a==null?void 0:a.data)==null?void 0:t.pages)==null?void 0:r.flat())??[]];return e.jsx(X,{title:"Completadas",tasks:n,loadNextPage:()=>ne(a),isFetching:a==null?void 0:a.isFetching,total:s})};class J{static toSalesmanUsers(s){return{id:s.id,name:s.nombre}}}const ys=()=>{const{tasks_api:a}=z(),{filters:s}=$(),{user:n}=Q();return{getSalesmanAndProjects:async()=>{const[i]=await Promise.all([a.get("/api/obtener-comerciales")]);return{salesmanUsers:i.data.map(J.toSalesmanUsers)}},getProjects:async()=>{var d;return(await a.get("/api/listado_tareas",{params:{...s,owner:{user:n.id,config:((d=s==null?void 0:s.owner)==null?void 0:d.config)??"yo_y_mis_equipos"},justProjects:!0}})).data.map(J.toSalesmanUsers)},getSalesmans:async()=>(await a.get("/api/obtener-comerciales")).data.map(J.toSalesmanUsers)}},ws=[{label:"Tipo de dependencia",type:"select",id:"dependency",options:[{id:"con",name:"Con dependencia"},{id:"sin",name:"Sin dependencia"},{id:"ambas",name:"Ambas"}]},{label:"Por proyecto",type:"select",id:"project.id",options:[]},{label:"Por responsable",type:"select",id:"owner.config",options:[{id:"yo",name:"Mis tareas"},{id:"yo_y_mis_equipos",name:"Tareas mías y de mis equipos"},{id:"mis_equipos",name:"Tareas de mis equipos"}]},{label:"Por ejecutivo",type:"select",id:"salesman.name",options:[]},{label:"Por dificultad",type:"select",id:"difficulty",options:[{id:0,name:"Muy facil"},{id:1,name:"Facil"},{id:2,name:"Media"},{id:3,name:"Dificil"},{id:4,name:"Muy dificil"}]}],be=[{label:"Responsable",type:"select",id:"responsable.responsableType",options:[{id:"yo_y_mis_equipos",name:"Yo y mis equipos"},{id:"mis_equipos",name:"Mis equipos"},{id:"yo",name:"Yo"}]},{label:"Por Ejecutivo",type:"select",id:"ejecutivo",options:[]}],vs=()=>{const{defineFields:a}=$(),{getSalesmanAndProjects:s}=ys();return c.useEffect(()=>{(async()=>{let t=[...ws],{salesmanUsers:r}=await s();a(t.map(l=>(l.id==="salesman.name"&&(l.options=r),l)))})()},[]),e.jsxs("div",{className:"flex gap-4 w-full h-full min-h-[100%] relative ",children:[e.jsx(gs,{}),e.jsx(fs,{}),e.jsx(js,{})]})},Pe=c.createContext({}),Ns=({children:a})=>{const[s,n]=c.useState([]);c.useEffect(()=>{console.log({selectedTasks:s})},[s]);const t=r=>{n(l=>l.includes(r)?l.filter(i=>i!==r):[...l,r])};return e.jsx(Pe.Provider,{value:{selectedTasks:s,selectTask:t},children:a})},Cs=()=>c.useContext(Pe),Ae=()=>{const a=()=>e.jsxs("div",{className:"w-full flex gap-m",children:[e.jsx("div",{className:"w-[30px] h-[30px] min-w-[30px] min-h-[30px] bg-gray-200 rounded-full animate-pulse"}),e.jsx("div",{className:"w-[30%] h-[30px] bg-gray-200 rounded-md animate-pulse"}),e.jsx("div",{className:"w-[30px] h-[30px] min-w-[30px] min-h-[30px] bg-gray-200 rounded-lg animate-pulse"}),e.jsx("div",{className:"w-[30px] h-[30px] min-w-[30px] min-h-[30px] bg-gray-200 rounded-lg animate-pulse"}),e.jsx("div",{className:"w-[30px] h-[30px] min-w-[30px] min-h-[30px] bg-gray-200 rounded-lg animate-pulse"}),e.jsx("div",{className:"w-[10%] h-[30px] bg-gray-200 rounded-md animate-pulse"}),e.jsx("div",{className:"w-[30px] h-[30px] min-w-[30px] min-h-[30px] bg-gray-200 rounded-lg animate-pulse"}),e.jsx("div",{className:"w-[10%] h-[30px] bg-gray-200 rounded-md animate-pulse"}),e.jsx("div",{className:"w-[30px] h-[30px] min-w-[30px] min-h-[30px] bg-gray-200 rounded-lg animate-pulse"}),e.jsx("div",{className:"w-[30px] h-[30px] min-w-[30px] min-h-[30px] bg-gray-200 rounded-lg animate-pulse"})]});return e.jsxs("div",{className:"flex flex-col gap-m",children:[e.jsx(a,{}),e.jsxs("div",{className:"pl-5 flex flex-col gap-m",children:[e.jsx(a,{}),e.jsx("div",{className:"pl-5",children:e.jsx(a,{})})]}),e.jsx(a,{}),e.jsxs("div",{className:"pl-5 flex flex-col gap-m",children:[e.jsx(a,{}),e.jsx("div",{className:"pl-5",children:e.jsx(a,{})})]})]})},Ee=({startDate:a,endDate:s})=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"gap-s bg-gray-100 rounded-md h-[30px] w-fit flex justify-center items-center px-xxxl",children:[e.jsx(w.Icons,{icon:"calendar",size:"xs",strokeWidth:4,color:v.texts.subtext}),e.jsxs("p",{className:"text-sm",children:[" ",fe(a)]})]}),e.jsx(w.Icons,{icon:"arrow_right",size:"xs",strokeWidth:4,color:v.texts.DEFAULT}),e.jsxs("div",{className:"gap-s bg-gray-100 rounded-md h-[30px] w-fit flex justify-center items-center px-xxxl",children:[e.jsx(w.Icons,{icon:"calendar",size:"xs",strokeWidth:4,color:v.texts.subtext}),e.jsxs("p",{className:"text-sm",children:[" ",fe(s)]})]})]}),_s=({id:a})=>e.jsx(e.Fragment,{children:e.jsx("button",{onClick:()=>alert("pausar tarea "+a),children:e.jsx(w.Icons,{icon:"pause",size:"xs",strokeWidth:4,color:v.texts.subtext})})}),Me=({id:a,priority:s,difficulty:n,endDate:t})=>{var i,d;const r={0:{title:"N/A",color:v.success.regular,bg:"bg-texts-placeholder border-texts-placeholder"},1:{title:"Baja",color:v.success.regular,bg:"bg-success-medium border-success-pastel"},2:{title:"Media",color:v.warning.regular,bg:"bg-warning-light border-warning-regular"},3:{title:"Alta",color:v.danger.regular,bg:"bg-danger-light border-danger-regular"}},l={0:{title:"Muy fácil",color:v.success.dark,bg:"bg-success-medium border-success-regular"},1:{title:"Fácil",color:v.success.regular,bg:"bg-success-medium border-success-pastel"},2:{title:"Media",color:v.warning.regular,bg:"bg-warning-light border-warning-regular"},3:{title:"Difícil",color:v.danger.regular,bg:"bg-danger-light border-danger-regular"},4:{title:"Muy difícil",color:v.danger.dark,bg:"bg-danger-light border-danger-regular"}};return e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"gap-s bg-gray-100 rounded-md h-[30px] w-[30px] flex justify-center items-center hover:bg-gray-200",children:e.jsx(w.Tooltip,{dispatch:e.jsx(w.Icons,{icon:"align_center",size:"xs",strokeWidth:4,color:v.texts.subtext}),children:e.jsx("p",{className:"text-sm font-regular py-2 px-4 bg-bg-card rounded-lg",style:{color:"gray"},children:"Espéralo muy pronto..."})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`gap-s ${((i=l[n??0])==null?void 0:i.bg)??"bg-gray-100"} border rounded-md h-[30px] w-[30px] flex justify-center items-center`,children:e.jsx(w.Tooltip,{dispatch:e.jsx(w.Icons,{icon:"difficulty",size:"xs",color:l[n??0].color,strokeWidth:4}),children:e.jsx("p",{className:"text-sm font-regular p-5 bg-bg-card rounded-lg",style:{color:l[n??0].color},children:l[n??0].title})})}),e.jsx("div",{className:`gap-s ${((d=r[s??0])==null?void 0:d.bg)??"bg-gray-100"} border rounded-md h-[30px] w-[30px] flex justify-center items-center`,children:e.jsx(w.Tooltip,{dispatch:e.jsx(w.Icons,{icon:"flag",size:"xs",color:r[s??0].color,strokeWidth:4}),children:e.jsx("p",{className:"text-sm font-regular p-5 bg-bg-card rounded-lg",style:{color:r[s??0].color},children:r[s??0].title})})}),e.jsx(w.Icons,{icon:"calendar",size:"xs",strokeWidth:3,color:v.texts.subtext}),e.jsx("p",{className:"text-sm font-regular text-texts-subtext",children:`${t.getDate()} ${se(t.getMonth()).slice(0,3)}`})]})]})},Fs=({id:a})=>{const{selectedTasks:s,selectTask:n}=Cs();return e.jsxs(e.Fragment,{children:[e.jsx("label",{className:"cursor-pointer w-[20px] h-[20px] border-2 border-gray-200 rounded-md flex justify-center items-center",htmlFor:a.toString(),children:e.jsx("span",{className:`${s.includes(a)?"opacity-100":"opacity-0"} transition-opacity duration-500`,children:e.jsx(w.Icons,{icon:"check_outline",size:"xs",color:v.primary.regular,strokeWidth:6})})}),e.jsx("input",{className:"hidden",id:a.toString(),type:"checkbox",onChange:()=>n(a)})]})},Ie=({task:a})=>e.jsx(w.Tooltip,{dispatch:e.jsx("p",{className:"text-sm text-texts-subtext max-w-[400px] truncate",children:a}),children:e.jsx("p",{className:"text-sm text-texts-subtext p-2 max-w-[400px]",children:a})}),Ss=({id:a})=>{var r,l;const{tasksProject:s}=H(),{reasignResponsible:n}=Y(),t=(r=s==null?void 0:s.data)==null?void 0:r.find(i=>i.id===a);return e.jsx("div",{className:"border-b border-gray-200 pb-3",children:e.jsxs("div",{className:"ml-[30px] mb-3 mt-1 p-2 flex flex-wrap items-center gap-xl rounded-md hover:bg-gray-100",children:[!(t!=null&&t.nameRequiredTask)||(t==null?void 0:t.nameRequiredTask)!==""&&(t==null?void 0:t.statusRequiredTask)===2&&e.jsx(Fs,{id:a}),e.jsx(Fe,{id:a,nameRequiredTask:(t==null?void 0:t.nameRequiredTask)??"",status:t==null?void 0:t.status,statusRequiredTask:(t==null?void 0:t.statusRequiredTask)??0},a),(t==null?void 0:t.willBePaused)&&e.jsx(_s,{id:a}),e.jsx(Se,{onClick:async(i,d)=>{await n({idNewResponsible:i==null?void 0:i.id,id:a,typeOfSelect:d})},responsible:t==null?void 0:t.responsible,users:((l=t==null?void 0:t.users)==null?void 0:l.map(te))??[]}),e.jsx(Ie,{task:(t==null?void 0:t.task)??""}),e.jsx(Me,{id:a,priority:t==null?void 0:t.priority,difficulty:t.difficulty,endDate:t==null?void 0:t.endDate}),e.jsx(Ee,{startDate:t==null?void 0:t.startDate,endDate:t==null?void 0:t.endDate}),e.jsx(qe,{id:a,nameRequiredTask:t.nameRequiredTask,status:t.status,statusRequiredTask:t.statusRequiredTask})]})})},De=({id:a})=>{var l,i,d,o,g,u,b;const{tasksProject:s,openTasks:n,openTask:t}=H(),r=(l=s==null?void 0:s.data)==null?void 0:l.find(x=>x.id===a);return r?e.jsxs("div",{className:"flex flex-col gap-m mb-2 ",children:[e.jsxs("div",{className:"flex items-center gap-m flex-wrap hover:bg-gray-100 p-2 rounded-md",children:[e.jsx("button",{className:`${n.includes(a)?"":"-rotate-90"} transition-all duration-300`,onClick:()=>t(a),children:e.jsx(w.Icons,{icon:"angle_down_outline",color:v.texts.subtext})}),e.jsx("div",{className:"flex items-center justify-center min-w-[20px] min-h-[20px] w-fit h-[20px] mx-1 bg-primary-medium rounded-full",children:e.jsx("p",{className:"text-sm text-primary",children:((i=r==null?void 0:r.tasks)==null?void 0:i.length)===0?1:(d=r==null?void 0:r.tasks)==null?void 0:d.length})}),e.jsx(Ie,{task:(r==null?void 0:r.task)??""}),e.jsx(Me,{id:a,priority:r==null?void 0:r.priority,difficulty:r.difficulty,endDate:r==null?void 0:r.endDate}),e.jsx(Ee,{startDate:r==null?void 0:r.startDate,endDate:r==null?void 0:r.endDate}),e.jsxs("button",{className:"gap-s bg-gray-100 rounded-md h-[30px] flex justify-center items-center w-fit px-m hover:bg-gray-200",children:[e.jsx(w.Icons,{icon:"subtasks",size:"xs",strokeWidth:5,color:v.texts.subtext}),e.jsx("p",{children:((o=r==null?void 0:r.tasks)==null?void 0:o.length)===0?1:(g=r==null?void 0:r.tasks)==null?void 0:g.length})]})]}),n.includes(a)&&e.jsx("div",{className:"ml-[30px]",children:((u=r==null?void 0:r.tasks)==null?void 0:u.length)>0?(b=r==null?void 0:r.tasks)==null?void 0:b.map(x=>e.jsx(De,{id:x==null?void 0:x.id})):e.jsx(Ss,{id:r==null?void 0:r.id})})]}):null},Ts=()=>{var t;const{tasksProject:a,projectID:s}=H();if(a!=null&&a.isFetching||a!=null&&a.isLoading)return e.jsx(Ae,{});let n=[...(t=a==null?void 0:a.data)==null?void 0:t.filter(r=>r.isPrincipalTask)];return e.jsx("div",{className:"flex flex-col gap-m h-full overflow-y-auto pb-3",children:e.jsx(Ns,{project:s,children:n==null?void 0:n.sort((r,l)=>r.orden-l.orden).map(r=>e.jsx("div",{className:"flex flex-col gap-m border-b border-gray-200 pb-m h-full",children:e.jsx(De,{id:r.id})}))})})},qs=({setPath:a,setProject:s})=>{const[n,t]=c.useState([]),[r,l]=c.useState(!0),[i,d]=c.useState(0),[o,g]=c.useState(10),[u,b]=c.useState(0),[x,f]=c.useState("nombre"),{filters:m,defineFields:j,cleanFilters:N}=$(),{tasks_api:_}=z(),{user:F}=Q(),h=async(p,q)=>{var M,A,B;try{l(!0);const T={filters:{search:(m==null?void 0:m.taskName)??"",responsable:{idUser:F.id,responsableType:(M=m==null?void 0:m.responsable)==null?void 0:M.responsableType},ejecutivo:(m==null?void 0:m.ejecutivo)??""}};console.log("FiltrosPARAMS: ",T);const E=await _.get("/api/listado_campanias",{params:{pagination:{page:p,pageSize:q},orderBy:x,...T}}),I=O(E==null?void 0:E.data);t(I),b((B=(A=E==null?void 0:E.data)==null?void 0:A.meta)==null?void 0:B.total)}catch(T){console.error("Error fetching data en Lista Campaña:",T)}finally{l(!1)}},y=async()=>{try{const p=await _.get("/api/obtener-comerciales");return[...be].map(M=>(M.id==="ejecutivo"&&(M.options=p.data.map(A=>({id:A.nombre,name:A.nombre}))),M))}catch(p){return console.error("Error fetching salesman data:",p),[...be]}};c.useEffect(()=>{(async()=>{const q=await y();j(q)})()},[]),c.useEffect(()=>{const p=Math.floor(i/o)+1;h(p,o)},[i,o,x,m]);const C=p=>{d(p.first),g(p.rows)},D=[{label:"5 filas",value:5},{label:"10 filas",value:10},{label:"15 filas",value:15},{label:"20 filas",value:20},{label:"25 filas",value:25},{label:"50 filas",value:50}],W=p=>{const q=parseInt(p.target.value,10);g(q),C({first:0,rows:q})},R=p=>{f(q=>q===p?`${p}:desc`:p)},L=p=>x===p?"↑↓":x===`${p}:desc`?"↓↑":"↑↓";return e.jsx("div",{className:"table-container",children:r?e.jsx("div",{style:{width:"100%"},children:e.jsx(Ae,{})}):e.jsxs(e.Fragment,{children:[e.jsxs("table",{className:"table",style:{borderCollapse:"collapse",width:"100%",borderSpacing:"0"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{color:"#F5F5F5"},children:[e.jsxs("th",{onClick:()=>R("nombre"),children:[e.jsx("label",{style:{color:"#C4C4C4",fontSize:"10px"},children:L("nombre")}),"Campaña"]}),e.jsx("th",{onClick:()=>R("inicia"),style:{textAlign:"center",whiteSpace:"nowrap"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",width:"fit-content"},children:[e.jsx("label",{style:{color:"#C4C4C4",fontSize:"10px"},children:L("inicia")})," ",e.jsx(w.Icons,{icon:"calendar",size:"xs",strokeWidth:5,color:"#C4C4C4"}),e.jsx("span",{children:"Fecha Inicio"})]})}),e.jsx("th",{onClick:()=>R("termina"),style:{whiteSpace:"nowrap",textAlign:"center"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",width:"fit-content"},children:[e.jsx("label",{style:{color:"#C4C4C4",fontSize:"10px"},children:L("termina")}),e.jsx(w.Icons,{icon:"calendar",size:"xs",strokeWidth:5,color:"#C4C4C4"}),e.jsx("span",{children:"Fecha Fin"})]})}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Responsable"})]})}),e.jsx("tbody",{children:n==null?void 0:n.map((p,q)=>{var M,A,B,T,E,I,K,le,ie,oe,ce,de,ue,xe,me,pe;return e.jsxs("tr",{className:"table-row",onClick:()=>{N(),s({id:p==null?void 0:p.id,project:p==null?void 0:p.nombre}),a("kanban-campania")},children:[e.jsx("td",{children:(M=p==null?void 0:p.campania)==null?void 0:M.nombre}),e.jsxs("td",{children:[" ",(A=p==null?void 0:p.campania)==null?void 0:A.inicia]}),e.jsx("td",{children:(B=p==null?void 0:p.campania)==null?void 0:B.termina}),e.jsx("td",{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"15px",padding:"none",fontSize:"10px",width:"auto",minWidth:"170px"},children:[e.jsxs("label",{style:{width:"50px",minWidth:"50px",textAlign:"right",color:"#000"},children:[p==null?void 0:p.progreso,"%"]}),e.jsx("div",{style:{position:"relative",height:"10px",flex:1,backgroundColor:"#C4C4C4",borderRadius:"10px",overflow:"hidden"},children:e.jsx("div",{style:{position:"absolute",top:0,left:0,height:"100%",width:`${p.progreso}%`,backgroundColor:p.progreso===100?"#039B59":p.progreso>50?"#3658C1":p.progreso>0?"#DC8921":"#C4C4C4",borderRadius:"10px",transition:"width 0.3s ease-in-out"}})})]})}),e.jsx("td",{children:e.jsxs("div",{className:"avatar-container",children:[e.jsxs(S.Avatar,{className:"avatar w-[28px] h-[28px]",children:[e.jsx(S.AvatarImage,{src:`${Te}${(le=(K=(I=(E=(T=p==null?void 0:p.campania)==null?void 0:T.responsable)==null?void 0:E.imagen)==null?void 0:I.formats)==null?void 0:K.thumbnail)==null?void 0:le.url}`,alt:(ce=(oe=(ie=p==null?void 0:p.campania)==null?void 0:ie.responsable)==null?void 0:oe.nombre)==null?void 0:ce.charAt(0)}),e.jsx(S.AvatarFallback,{style:{boxShadow:"10px 5px 10px rgba(0, 0, 0, 0.5)"},children:(xe=(ue=(de=p==null?void 0:p.campania)==null?void 0:de.responsable)==null?void 0:ue.nombre)==null?void 0:xe.charAt(0)})]}),e.jsx("span",{style:{marginLeft:"8px",fontSize:"10px"},children:(pe=(me=p==null?void 0:p.campania)==null?void 0:me.responsable)==null?void 0:pe.nombre})]})})]},q)})})]}),e.jsxs("div",{className:"pagination",style:{background:"#FAFAFA",display:"flex"},children:[e.jsxs("span",{style:{alignItems:"center",fontSize:"10px",textAlign:"left",width:"auto",height:"auto",whiteSpace:"nowrap"},children:[n.length," elementos de ",u]}),e.jsx(ze.Paginator,{first:i,rows:o,totalRecords:u,rowsPerPageOptions:[5,10,20,50],onPageChange:C,className:"pagination",template:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"10px",whiteSpace:"nowrap"},children:"Filas por página:"}),e.jsx("select",{className:"select",value:o,onChange:p=>W(p),children:D.map(p=>e.jsx("option",{className:"option-select",value:p.value,style:{background:"#F5F5F5"},children:p.label},p.value))})]})]})]})})},Ps=({path:a,tab:s,setPath:n,project:t,setProject:r})=>{const l={"kanban-general":{kanban:e.jsx(vs,{})},"lista-campanias":{lista:e.jsx(qs,{setPath:n,setProject:r}),gantt:e.jsx("div",{children:"gantt-campanias"})},"kanban-campania":{kanban:e.jsx(xs,{}),lista:e.jsx(Ts,{}),gantt:e.jsx("div",{children:"kanban-campania-gantt"})}};return a==="kanban-campania"?e.jsx(He,{project:t==null?void 0:t.id,children:l[a][s]}):l[a][s]},As=({path:a})=>{const s=()=>{const{selectPath:n,updateFilters:t,applyFilters:r,filters:l}=$(),[i,d]=c.useState("kanban"),[o,g]=c.useState(a),[u,b]=c.useState({id:1704,project:"Kanban de Campania"}),[x,f]=c.useState((l==null?void 0:l.taskName)??""),[m,j]=c.useState(""),N=c.useRef(null);c.useEffect(()=>{d(o==="lista-campanias"?"lista":"kanban"),n(o)},[a,o]),c.useEffect(()=>{(x==null?void 0:x.trim())===""&&t({name:"taskName",value:null}),r()},[m]),c.useEffect(()=>{f((l==null?void 0:l.taskName)??"")},[l==null?void 0:l.taskName]);const _=C=>({"kanban-general":"Kanban General","lista-campanias":"Campanias","kanban-campania":`Kanban de ${u.project}`})[C],F=C=>{g(C)},h=["lista-campanias","kanban-campania"],y={"lista-campanias":["lista","gantt"],"kanban-campania":["kanban","lista","gantt"]};return e.jsxs("div",{className:"bg-bg-card p-m rounded-lg border border-gray-200 flex flex-col gap-m w-full h-full min-h-[100%] relative overflow-hidden",children:[e.jsxs("div",{className:"w-full justify-between flex items-end border-b border-gray-200 pb-m px-l flex-wrap gap-l",children:[e.jsxs("div",{className:"flex gap-xl",children:[e.jsx("h2",{className:"text-texts font-medium",children:_(o)}),h.includes(o)&&e.jsx(Le,{tabs:y[o],renderItem:C=>{d(C)},initialTab:i})]}),e.jsxs("div",{className:"flex items-center gap-s",children:[e.jsx("input",{onChange:C=>{f(C.target.value),ve(()=>{t({name:"taskName",value:C.target.value.trim()}),j(C.target.value)},1e3)()},type:"text",placeholder:"Buscar",value:x,className:"w-[200px] h-[30px] border-none bg-bg-card shadow-input border border-gray-200 rounded-lg px-l "}),e.jsx(Be,{filterChildren:N,children:e.jsx("div",{ref:N,className:"w-max max-w-[400px] h-fit bg-bg-card shadow-lg rounded-lg p-l",children:e.jsx(Qe,{})})})]})]}),e.jsx("div",{className:"overflow-y-hidden scrollbar-none",children:e.jsx(Ps,{path:o,tab:i,setPath:F,project:u,setProject:b})})]})};return e.jsx(Ke,{children:e.jsx(s,{})})},Es=()=>e.jsx("div",{className:"w-full h-full min-h-[100%] relative",children:e.jsx("div",{className:"flex justify-center items-center h-full",children:e.jsxs("div",{className:"text-2xl font-bold flex flex-col items-center",children:[e.jsx("div",{className:"w-10 h-10 bg-primary-regular rounded-full animate-pulse"}),e.jsx("p",{className:"text-l text-texts-enfasis",children:"un momento..."}),e.jsx("p",{className:"text-sm text-texts-placeholder",children:"estamos buscando tu usuario"})]})})}),Ms=()=>e.jsx("div",{className:"w-full h-full min-h-[100%] relative",children:e.jsx("div",{className:"flex justify-center items-center h-full",children:e.jsxs("div",{className:"text-2xl font-bold flex flex-col items-center",children:[e.jsx("div",{className:"w-10 h-10 bg-primary-regular rounded-full animate-pulse"}),e.jsx("p",{className:"text-l text-texts-enfasis",children:"No encontramos tu acceso"}),e.jsx("p",{className:"text-sm text-texts-placeholder",children:"por favor, contacta al administrador"})]})})}),Is=({path:a,user:s,url:n})=>{const t=new P.QueryClient;if(!s)return e.jsx(Es,{});if(!s.accessToken)return e.jsx(Ms,{});let r={user:s,url:n};return e.jsx(e.Fragment,{children:e.jsx(ke,{...r,children:e.jsx(Ue,{...r,children:e.jsx("div",{className:"w-full h-full min-h-[100%] relative",children:e.jsxs(P.QueryClientProvider,{client:t,children:[e.jsx(As,{path:a})," "]})})})})})};exports.AppTasks=Is;
|
package/dist/tareas.es.js
CHANGED
|
@@ -102,8 +102,8 @@ const it = ({ label: r, active: t, onClick: s, disabled: a }) => a ? /* @__PURE_
|
|
|
102
102
|
position: r,
|
|
103
103
|
//Methods
|
|
104
104
|
setElementPosition: (l) => {
|
|
105
|
-
var
|
|
106
|
-
let i = (
|
|
105
|
+
var g;
|
|
106
|
+
let i = (g = l.current) == null ? void 0 : g.getBoundingClientRect(), d = (i == null ? void 0 : i.x) + ((i == null ? void 0 : i.width) ?? 0), c = (i == null ? void 0 : i.y) + (i == null ? void 0 : i.height);
|
|
107
107
|
t(r ? null : { x: d ?? 0, y: c ?? 0 });
|
|
108
108
|
},
|
|
109
109
|
getChildrenSize: (l) => {
|
|
@@ -118,10 +118,10 @@ const it = ({ label: r, active: t, onClick: s, disabled: a }) => a ? /* @__PURE_
|
|
|
118
118
|
const { position: s, setElementPosition: a } = ue(), n = O(null), l = ({ children: i }) => {
|
|
119
119
|
const [d, c] = v();
|
|
120
120
|
return P(() => {
|
|
121
|
-
var
|
|
122
|
-
t.current && c(((s == null ? void 0 : s.x) ?? 0) - (((u = (
|
|
121
|
+
var g, u;
|
|
122
|
+
t.current && c(((s == null ? void 0 : s.x) ?? 0) - (((u = (g = t.current) == null ? void 0 : g.getBoundingClientRect()) == null ? void 0 : u.width) ?? 0));
|
|
123
123
|
}, [t == null ? void 0 : t.current, s == null ? void 0 : s.x]), s && te.createPortal(
|
|
124
|
-
/* @__PURE__ */ e("div", { className: `absolute w-fit h-fit ${d ? "block" : "hidden"}`, style: { top: `${s == null ? void 0 : s.y}px`, left: `${d}px`, zIndex: 1 }, children: i }),
|
|
124
|
+
/* @__PURE__ */ e("div", { className: `absolute w-fit h-fit ${d ? "block" : "hidden"}`, style: { top: `${s == null ? void 0 : s.y}px`, left: `${d}px`, zIndex: 1 }, "data-portal-host": !0, children: i }),
|
|
125
125
|
document.body
|
|
126
126
|
);
|
|
127
127
|
};
|
|
@@ -153,7 +153,7 @@ const it = ({ label: r, active: t, onClick: s, disabled: a }) => a ? /* @__PURE_
|
|
|
153
153
|
t[s] = a;
|
|
154
154
|
}), t;
|
|
155
155
|
}, $e = X({}), dt = ({ children: r }) => {
|
|
156
|
-
const [t, s] = v({}), [a, n] = v({}), [l, i] = v([]), [d, c] = v(""),
|
|
156
|
+
const [t, s] = v({}), [a, n] = v({}), [l, i] = v([]), [d, c] = v(""), g = ({ name: m, value: f }) => {
|
|
157
157
|
function p(_) {
|
|
158
158
|
return !isNaN(_) && _ !== null && _ !== "" ? parseFloat(_) : null;
|
|
159
159
|
}
|
|
@@ -183,7 +183,7 @@ const it = ({ label: r, active: t, onClick: s, disabled: a }) => a ? /* @__PURE_
|
|
|
183
183
|
path: d,
|
|
184
184
|
//methods
|
|
185
185
|
defineFields: i,
|
|
186
|
-
updateFilters:
|
|
186
|
+
updateFilters: g,
|
|
187
187
|
cleanFilters: u,
|
|
188
188
|
applyFilters: b,
|
|
189
189
|
initialFilters: a,
|
|
@@ -220,9 +220,9 @@ const ut = () => {
|
|
|
220
220
|
"select",
|
|
221
221
|
{
|
|
222
222
|
onChange: (c) => {
|
|
223
|
-
var
|
|
223
|
+
var g, u;
|
|
224
224
|
t({
|
|
225
|
-
name: (
|
|
225
|
+
name: (g = c == null ? void 0 : c.target) == null ? void 0 : g.name,
|
|
226
226
|
value: (u = c == null ? void 0 : c.target) == null ? void 0 : u.value
|
|
227
227
|
});
|
|
228
228
|
},
|
|
@@ -230,13 +230,13 @@ const ut = () => {
|
|
|
230
230
|
className: "w-full h-[30px] shadow-input rounded-lg p-s",
|
|
231
231
|
name: l.id,
|
|
232
232
|
id: l.id,
|
|
233
|
-
children: (d = l == null ? void 0 : l.options) == null ? void 0 : d.map((c,
|
|
233
|
+
children: (d = l == null ? void 0 : l.options) == null ? void 0 : d.map((c, g) => /* @__PURE__ */ e(
|
|
234
234
|
"option",
|
|
235
235
|
{
|
|
236
236
|
value: c.id,
|
|
237
237
|
children: c.name
|
|
238
238
|
},
|
|
239
|
-
|
|
239
|
+
g
|
|
240
240
|
))
|
|
241
241
|
}
|
|
242
242
|
) : /* @__PURE__ */ e(
|
|
@@ -247,9 +247,9 @@ const ut = () => {
|
|
|
247
247
|
value: n == null ? void 0 : n[l == null ? void 0 : l.id],
|
|
248
248
|
name: l.label.toLowerCase().replace(/ /g, "_"),
|
|
249
249
|
onChange: Ee((c) => {
|
|
250
|
-
var
|
|
250
|
+
var g, u;
|
|
251
251
|
return t({
|
|
252
|
-
name: (
|
|
252
|
+
name: (g = c == null ? void 0 : c.target) == null ? void 0 : g.name,
|
|
253
253
|
value: (u = c == null ? void 0 : c.target) == null ? void 0 : u.value
|
|
254
254
|
});
|
|
255
255
|
}, 1e3)
|
|
@@ -276,14 +276,14 @@ const ut = () => {
|
|
|
276
276
|
};
|
|
277
277
|
class mt {
|
|
278
278
|
static toCampaignTasks(t) {
|
|
279
|
-
var a, n, l, i, d, c,
|
|
279
|
+
var a, n, l, i, d, c, g, u, b, m, f, p;
|
|
280
280
|
let s = [];
|
|
281
281
|
return t != null && t.responsable && s.push({ id: t.responsable.id, name: t.responsable.nombre, image: (d = (i = (l = (n = (a = t.responsable) == null ? void 0 : a.userOBP) == null ? void 0 : n.imagen) == null ? void 0 : l.formats) == null ? void 0 : i.thumbnail) == null ? void 0 : d.url }), console.log("task", t), (c = t == null ? void 0 : t.equipo) != null && c.miembros && t.equipo.miembros.forEach((y) => {
|
|
282
282
|
var _, T, q, x;
|
|
283
283
|
s != null && s.find((w) => w.id === y.idUser.id) || y.idUser && s.push({ id: y.idUser.id, name: y.idUser.nombre, image: (x = (q = (T = (_ = y == null ? void 0 : y.userOBP) == null ? void 0 : _.imagen) == null ? void 0 : T.formats) == null ? void 0 : q.thumbnail) == null ? void 0 : x.url });
|
|
284
284
|
}), {
|
|
285
285
|
isPrincipalTask: (t == null ? void 0 : t.tarea_principal) ?? !1,
|
|
286
|
-
projectName: ((
|
|
286
|
+
projectName: ((g = t == null ? void 0 : t.proyecto) == null ? void 0 : g.nombre) ?? null,
|
|
287
287
|
orden: (t == null ? void 0 : t.orden) ?? null,
|
|
288
288
|
id: (t == null ? void 0 : t.id) ?? null,
|
|
289
289
|
task: (t == null ? void 0 : t.texto_corto) ?? null,
|
|
@@ -320,7 +320,7 @@ const pt = async ({ filters: r, tasks_api: t, project: s }) => {
|
|
|
320
320
|
} catch (a) {
|
|
321
321
|
console.log(a);
|
|
322
322
|
}
|
|
323
|
-
}, ze = X({}),
|
|
323
|
+
}, ze = X({}), ht = ({ children: r, user: t, url: s }) => {
|
|
324
324
|
const a = Se.create({
|
|
325
325
|
baseURL: s,
|
|
326
326
|
headers: {
|
|
@@ -338,7 +338,7 @@ const pt = async ({ filters: r, tasks_api: t, project: s }) => {
|
|
|
338
338
|
children: r
|
|
339
339
|
}
|
|
340
340
|
);
|
|
341
|
-
}, K = () => J(ze), Le = X({}),
|
|
341
|
+
}, K = () => J(ze), Le = X({}), gt = ({ children: r, user: t, url: s }) => {
|
|
342
342
|
const a = Se.create({
|
|
343
343
|
baseURL: s,
|
|
344
344
|
headers: {
|
|
@@ -360,9 +360,9 @@ const pt = async ({ filters: r, tasks_api: t, project: s }) => {
|
|
|
360
360
|
);
|
|
361
361
|
}, U = () => J(Le), Be = X({}), xt = ({ children: r, project: t }) => {
|
|
362
362
|
var _;
|
|
363
|
-
const s = Y(), [a, n] = v([]), [l, i] = v([]), { tasks_api: d } = K(), { filters: c } = B(), { user:
|
|
363
|
+
const s = Y(), [a, n] = v([]), [l, i] = v([]), { tasks_api: d } = K(), { filters: c } = B(), { user: g } = U(), [u, b] = v({
|
|
364
364
|
owner: {
|
|
365
|
-
user:
|
|
365
|
+
user: g.id,
|
|
366
366
|
config: ((_ = c == null ? void 0 : c.owner) == null ? void 0 : _.config) ?? "yo_y_mis_equipos"
|
|
367
367
|
},
|
|
368
368
|
project: {
|
|
@@ -383,7 +383,7 @@ const pt = async ({ filters: r, tasks_api: t, project: s }) => {
|
|
|
383
383
|
Object.keys(c).length > 0 && b({
|
|
384
384
|
...c,
|
|
385
385
|
owner: {
|
|
386
|
-
user:
|
|
386
|
+
user: g.id,
|
|
387
387
|
config: ((T = c == null ? void 0 : c.owner) == null ? void 0 : T.config) ?? "yo_y_mis_equipos"
|
|
388
388
|
},
|
|
389
389
|
project: {
|
|
@@ -483,7 +483,7 @@ const pt = async ({ filters: r, tasks_api: t, project: s }) => {
|
|
|
483
483
|
repeticiones_realizadas: w,
|
|
484
484
|
updated_by: t == null ? void 0 : t.id
|
|
485
485
|
}
|
|
486
|
-
})).data,
|
|
486
|
+
})).data, g = async ({ id: x, idNewResponsible: w, typeOfSelect: C }) => {
|
|
487
487
|
let z = {
|
|
488
488
|
updated_by: t == null ? void 0 : t.id
|
|
489
489
|
};
|
|
@@ -557,7 +557,7 @@ const pt = async ({ filters: r, tasks_api: t, project: s }) => {
|
|
|
557
557
|
await n.cancelQueries({ queryKey: ["working_tasks"] }), await n.cancelQueries({ queryKey: ["done_tasks"] }), await n.cancelQueries({ queryKey: ["to_do_tasks"] });
|
|
558
558
|
}
|
|
559
559
|
}), { mutateAsync: y } = ee({
|
|
560
|
-
mutationFn:
|
|
560
|
+
mutationFn: g,
|
|
561
561
|
onSuccess: () => {
|
|
562
562
|
const x = {
|
|
563
563
|
"kanban-general": "to_do_tasks",
|
|
@@ -734,7 +734,7 @@ const Pe = (r) => {
|
|
|
734
734
|
/* @__PURE__ */ e("p", { className: "text-xs font-bold content-text", children: m.name })
|
|
735
735
|
] }, f)) })
|
|
736
736
|
}
|
|
737
|
-
),
|
|
737
|
+
), g = () => {
|
|
738
738
|
if (s) {
|
|
739
739
|
let m = r.find(
|
|
740
740
|
(f) => f.id === s
|
|
@@ -791,6 +791,7 @@ const Pe = (r) => {
|
|
|
791
791
|
/* @__PURE__ */ e(
|
|
792
792
|
"div",
|
|
793
793
|
{
|
|
794
|
+
"data-portal-host": !0,
|
|
794
795
|
className: `absolute w-[300px] h-fit ${m ? "block" : "hidden"}`,
|
|
795
796
|
style: { top: `${l == null ? void 0 : l.y}px`, left: `${m}px`, zIndex: 1 },
|
|
796
797
|
children: /* @__PURE__ */ o("div", { className: "flex flex-col gap-m bg-bg-card border-cards rounded-lg p-2 max-h-[200px] overflow-y-hidden", children: [
|
|
@@ -816,7 +817,7 @@ const Pe = (r) => {
|
|
|
816
817
|
};
|
|
817
818
|
return /* @__PURE__ */ o(D, { children: [
|
|
818
819
|
/* @__PURE__ */ o(u, { children: [
|
|
819
|
-
|
|
820
|
+
g(),
|
|
820
821
|
c()
|
|
821
822
|
] }),
|
|
822
823
|
/* @__PURE__ */ e(
|
|
@@ -855,7 +856,7 @@ function Tt({ items: r }) {
|
|
|
855
856
|
] });
|
|
856
857
|
}
|
|
857
858
|
const Qe = "https://devobp.imjmedia.com.mx";
|
|
858
|
-
function
|
|
859
|
+
function he(r) {
|
|
859
860
|
return r ? r.split(" ").map((a) => {
|
|
860
861
|
var n;
|
|
861
862
|
return (n = a[0]) == null ? void 0 : n.toUpperCase();
|
|
@@ -865,8 +866,8 @@ const qt = "https://devobp.imjmedia.com.mx";
|
|
|
865
866
|
function Pt({ comment: r }) {
|
|
866
867
|
var s, a, n, l, i, d;
|
|
867
868
|
function t(c) {
|
|
868
|
-
const
|
|
869
|
-
return Je(
|
|
869
|
+
const g = Xe(c);
|
|
870
|
+
return Je(g, { locale: de, addSuffix: !0 });
|
|
870
871
|
}
|
|
871
872
|
return /* @__PURE__ */ e("div", { children: /* @__PURE__ */ o("div", { className: "flex flex-row gap-3 items-start", children: [
|
|
872
873
|
/* @__PURE__ */ o(ae, { className: "w-[28px] h-[28px]", children: [
|
|
@@ -877,7 +878,7 @@ function Pt({ comment: r }) {
|
|
|
877
878
|
alt: "@shadcn"
|
|
878
879
|
}
|
|
879
880
|
),
|
|
880
|
-
/* @__PURE__ */ e(ne, { children:
|
|
881
|
+
/* @__PURE__ */ e(ne, { children: he((i = r == null ? void 0 : r.autor) == null ? void 0 : i.nombre) })
|
|
881
882
|
] }),
|
|
882
883
|
/* @__PURE__ */ o("div", { className: "flex flex-col gap-1", children: [
|
|
883
884
|
/* @__PURE__ */ o("div", { className: "flex flex-row gap-2", children: [
|
|
@@ -890,13 +891,13 @@ function Pt({ comment: r }) {
|
|
|
890
891
|
}
|
|
891
892
|
function At({ currentUser: r, data: t, taskId: s, onNewComment: a }) {
|
|
892
893
|
var b, m, f;
|
|
893
|
-
const { tasks_api: n } = K(), { register: l, handleSubmit: i, reset: d } = st(), [c,
|
|
894
|
+
const { tasks_api: n } = K(), { register: l, handleSubmit: i, reset: d } = st(), [c, g] = v([]);
|
|
894
895
|
return P(() => {
|
|
895
896
|
if (t != null && t.comentarios) {
|
|
896
897
|
const p = [...t.comentarios].sort(
|
|
897
898
|
(y, _) => new Date(_.createdAt).getTime() - new Date(y.createdAt).getTime()
|
|
898
899
|
);
|
|
899
|
-
|
|
900
|
+
g(p);
|
|
900
901
|
}
|
|
901
902
|
}, [t]), /* @__PURE__ */ o("div", { className: "flex flex-col h-full gap-4", children: [
|
|
902
903
|
/* @__PURE__ */ o("form", { onSubmit: i(async (p) => {
|
|
@@ -917,7 +918,7 @@ function At({ currentUser: r, data: t, taskId: s, onNewComment: a }) {
|
|
|
917
918
|
comentario: p.comment,
|
|
918
919
|
tarea: s
|
|
919
920
|
}
|
|
920
|
-
}), a(!0),
|
|
921
|
+
}), a(!0), g((_) => [y, ..._]), d();
|
|
921
922
|
} catch (y) {
|
|
922
923
|
console.error("Error al agregar comentario:", y);
|
|
923
924
|
}
|
|
@@ -930,7 +931,7 @@ function At({ currentUser: r, data: t, taskId: s, onNewComment: a }) {
|
|
|
930
931
|
alt: "@shadcn"
|
|
931
932
|
}
|
|
932
933
|
),
|
|
933
|
-
/* @__PURE__ */ e(ne, { className: "border border-x-primary-pastel", children:
|
|
934
|
+
/* @__PURE__ */ e(ne, { className: "border border-x-primary-pastel", children: he(r == null ? void 0 : r.nombre) })
|
|
934
935
|
] }),
|
|
935
936
|
/* @__PURE__ */ e(
|
|
936
937
|
Ze,
|
|
@@ -998,8 +999,8 @@ function St({ data: r }) {
|
|
|
998
999
|
}
|
|
999
1000
|
const jt = "https://devobp.imjmedia.com.mx";
|
|
1000
1001
|
function Mt({ isOpen: r, setIsOpen: t, taskId: s }) {
|
|
1001
|
-
var _, T, q, x, w, C, z, k, R, Q,
|
|
1002
|
-
const [a, n] = v(null), [l, i] = v(!1), [d, c] = v(!1), [
|
|
1002
|
+
var _, T, q, x, w, C, z, k, R, Q, h, S, $;
|
|
1003
|
+
const [a, n] = v(null), [l, i] = v(!1), [d, c] = v(!1), [g, u] = v(null), { tasks_api: b } = K(), { user: m } = U();
|
|
1003
1004
|
P(() => {
|
|
1004
1005
|
if (r && s || l) {
|
|
1005
1006
|
const j = async () => {
|
|
@@ -1046,7 +1047,7 @@ function Mt({ isOpen: r, setIsOpen: t, taskId: s }) {
|
|
|
1046
1047
|
At,
|
|
1047
1048
|
{
|
|
1048
1049
|
taskId: s,
|
|
1049
|
-
currentUser:
|
|
1050
|
+
currentUser: g,
|
|
1050
1051
|
data: a,
|
|
1051
1052
|
onNewComment: i
|
|
1052
1053
|
}
|
|
@@ -1063,6 +1064,7 @@ function Mt({ isOpen: r, setIsOpen: t, taskId: s }) {
|
|
|
1063
1064
|
/* @__PURE__ */ e(
|
|
1064
1065
|
"div",
|
|
1065
1066
|
{
|
|
1067
|
+
"data-portal-host": !0,
|
|
1066
1068
|
className: `fixed inset-0 bg-transparent bg-opacity-50 flex justify-center items-center z-1 ${r ? "pointer-events-auto block" : "pointer-events-none hidden"}`,
|
|
1067
1069
|
onClick: () => t(!1)
|
|
1068
1070
|
}
|
|
@@ -1148,7 +1150,7 @@ function Mt({ isOpen: r, setIsOpen: t, taskId: s }) {
|
|
|
1148
1150
|
alt: "@shadcn"
|
|
1149
1151
|
}
|
|
1150
1152
|
),
|
|
1151
|
-
/* @__PURE__ */ e(ne, { children:
|
|
1153
|
+
/* @__PURE__ */ e(ne, { children: he((k = a == null ? void 0 : a.responsable) == null ? void 0 : k.nombre) })
|
|
1152
1154
|
] }),
|
|
1153
1155
|
/* @__PURE__ */ e("span", { className: "text-xs text-neutral-600 font-normal", children: (R = a == null ? void 0 : a.responsable) == null ? void 0 : R.nombre })
|
|
1154
1156
|
] }) : /* @__PURE__ */ e("span", { className: "text-xs text-neutral-600 font-normal", children: "Sin responsable" })
|
|
@@ -1166,7 +1168,7 @@ function Mt({ isOpen: r, setIsOpen: t, taskId: s }) {
|
|
|
1166
1168
|
icon: "flag",
|
|
1167
1169
|
size: "xs",
|
|
1168
1170
|
strokeWidth: 5,
|
|
1169
|
-
color: (
|
|
1171
|
+
color: (h = f[a == null ? void 0 : a.prioridad]) == null ? void 0 : h.iconColor
|
|
1170
1172
|
}
|
|
1171
1173
|
),
|
|
1172
1174
|
/* @__PURE__ */ e(
|
|
@@ -1220,7 +1222,7 @@ const We = ({
|
|
|
1220
1222
|
statusRequiredTask: s,
|
|
1221
1223
|
id: a
|
|
1222
1224
|
}) => {
|
|
1223
|
-
const { setElementPosition: n, position: l } = ue(), { startWorking: i, completeTask: d } = se(), c = O(null),
|
|
1225
|
+
const { setElementPosition: n, position: l } = ue(), { startWorking: i, completeTask: d } = se(), c = O(null), g = O(!1), u = ({ children: b }) => {
|
|
1224
1226
|
const [m, f] = v();
|
|
1225
1227
|
return P(() => {
|
|
1226
1228
|
var p, y;
|
|
@@ -1231,6 +1233,7 @@ const We = ({
|
|
|
1231
1233
|
/* @__PURE__ */ e(
|
|
1232
1234
|
"div",
|
|
1233
1235
|
{
|
|
1236
|
+
"data-portal-host": !0,
|
|
1234
1237
|
className: `absolute w-fit h-fit ${m ? "block" : "hidden"}`,
|
|
1235
1238
|
style: { top: `${l == null ? void 0 : l.y}px`, left: `${m}px`, zIndex: 1 },
|
|
1236
1239
|
children: b
|
|
@@ -1251,12 +1254,12 @@ const We = ({
|
|
|
1251
1254
|
children: /* @__PURE__ */ e("span", { className: "rotate-90", children: /* @__PURE__ */ e(F, { icon: "elipsis", size: "xs" }) })
|
|
1252
1255
|
}
|
|
1253
1256
|
),
|
|
1254
|
-
/* @__PURE__ */ e(u, { children:
|
|
1257
|
+
/* @__PURE__ */ e(u, { children: g != null && g.current ? /* @__PURE__ */ e("div", { className: "w-max h-fit bg-bg-card rounded-lg p-l shadow-lg flex items-center gap-2 hover:bg-primary-light", children: /* @__PURE__ */ e("p", { className: "text-sm font-normal text-primary-pastel font-regular", children: "Moviendo..." }) }) : /* @__PURE__ */ o(
|
|
1255
1258
|
"button",
|
|
1256
1259
|
{
|
|
1257
1260
|
className: "w-max h-fit bg-bg-card rounded-lg p-l shadow-lg flex items-center gap-2 hover:bg-primary-light",
|
|
1258
1261
|
onClick: () => {
|
|
1259
|
-
|
|
1262
|
+
g.current = !0, r === 0 ? i({ id: a }) : d({ id: a });
|
|
1260
1263
|
},
|
|
1261
1264
|
children: [
|
|
1262
1265
|
/* @__PURE__ */ e("p", { className: "text-sm font-normal text-texts-placeholder font-regular", children: r === 0 ? "Mover a trabajando" : "Mover a completadas" }),
|
|
@@ -1283,7 +1286,7 @@ const We = ({
|
|
|
1283
1286
|
idProject: i,
|
|
1284
1287
|
comments: d,
|
|
1285
1288
|
priority: c,
|
|
1286
|
-
difficulty:
|
|
1289
|
+
difficulty: g,
|
|
1287
1290
|
responsible: u,
|
|
1288
1291
|
nameRequiredTask: b,
|
|
1289
1292
|
statusRequiredTask: m,
|
|
@@ -1326,7 +1329,7 @@ const We = ({
|
|
|
1326
1329
|
2: { title: "Media", color: N.warning.regular },
|
|
1327
1330
|
3: { title: "Difícil", color: N.danger.regular },
|
|
1328
1331
|
4: { title: "Muy difícil", color: N.danger.dark }
|
|
1329
|
-
},
|
|
1332
|
+
}, h = (E) => {
|
|
1330
1333
|
z((I) => E === "minus" ? Math.max(0, I - 1) : Math.min(p, I + 1));
|
|
1331
1334
|
};
|
|
1332
1335
|
return /* @__PURE__ */ o(D, { children: [
|
|
@@ -1369,7 +1372,7 @@ const We = ({
|
|
|
1369
1372
|
{
|
|
1370
1373
|
icon: "difficulty",
|
|
1371
1374
|
size: "xs",
|
|
1372
|
-
color: (S = Q[
|
|
1375
|
+
color: (S = Q[g ?? 0]) == null ? void 0 : S.color,
|
|
1373
1376
|
strokeWidth: 4
|
|
1374
1377
|
}
|
|
1375
1378
|
),
|
|
@@ -1377,8 +1380,8 @@ const We = ({
|
|
|
1377
1380
|
"p",
|
|
1378
1381
|
{
|
|
1379
1382
|
className: "text-sm font-regular p-5 bg-bg-card rounded-lg",
|
|
1380
|
-
style: { color: ($ = Q[
|
|
1381
|
-
children: `Dificultad ${(j = Q[
|
|
1383
|
+
style: { color: ($ = Q[g ?? 0]) == null ? void 0 : $.color },
|
|
1384
|
+
children: `Dificultad ${(j = Q[g ?? 0]) == null ? void 0 : j.title}`
|
|
1382
1385
|
}
|
|
1383
1386
|
)
|
|
1384
1387
|
}
|
|
@@ -1420,9 +1423,9 @@ const We = ({
|
|
|
1420
1423
|
] }),
|
|
1421
1424
|
f === 1 && p && p > 0 && /* @__PURE__ */ o("div", { className: "flex items-center gap-m", children: [
|
|
1422
1425
|
/* @__PURE__ */ e("p", { className: "text-xs text-texts-placeholder ", children: "unidades" }),
|
|
1423
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
1426
|
+
/* @__PURE__ */ e("button", { onClick: () => h("minus"), className: "flex items-center justify-center bg-gray-200 w-[0] rounded-full hover:bg-gray-400", children: /* @__PURE__ */ e(F, { icon: "circle_minus", size: "xs", strokeWidth: 3, color: N.texts.placeholder }) }),
|
|
1424
1427
|
/* @__PURE__ */ e("p", { className: "text-xs text-texts-placeholder", children: `${C ?? 0} / ${p ?? 0}` }),
|
|
1425
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
1428
|
+
/* @__PURE__ */ e("button", { onClick: () => h("plus"), className: "flex items-center justify-center bg-gray-200 w-[0] rounded-full hover:bg-gray-400", children: /* @__PURE__ */ e(F, { icon: "circle_plus", size: "xs", strokeWidth: 3, color: N.texts.placeholder }) }),
|
|
1426
1429
|
/* @__PURE__ */ e("button", { className: "text-xs bg-primary-medium rounded-md py-s px-m text-primary-regular", onClick: () => {
|
|
1427
1430
|
w({ repeats: C, id: r });
|
|
1428
1431
|
}, children: "Agregar" })
|
|
@@ -1528,7 +1531,7 @@ const We = ({
|
|
|
1528
1531
|
};
|
|
1529
1532
|
class zt {
|
|
1530
1533
|
static toKanbanTasks(t) {
|
|
1531
|
-
var a, n, l, i, d, c,
|
|
1534
|
+
var a, n, l, i, d, c, g, u, b, m, f;
|
|
1532
1535
|
let s = [];
|
|
1533
1536
|
return t != null && t.responsable && s.push({ id: t.responsable.id, name: t.responsable.nombre, image: (d = (i = (l = (n = (a = t.responsable) == null ? void 0 : a.userOBP) == null ? void 0 : n.imagen) == null ? void 0 : l.formats) == null ? void 0 : i.thumbnail) == null ? void 0 : d.url }), (c = t == null ? void 0 : t.equipo) != null && c.miembros && t.equipo.miembros.forEach((p) => {
|
|
1534
1537
|
var y, _, T, q;
|
|
@@ -1537,7 +1540,7 @@ class zt {
|
|
|
1537
1540
|
repeats: t == null ? void 0 : t.repeticiones_realizadas,
|
|
1538
1541
|
repeatsToDo: t == null ? void 0 : t.repeticiones,
|
|
1539
1542
|
comments: 0,
|
|
1540
|
-
nameProject: (
|
|
1543
|
+
nameProject: (g = t == null ? void 0 : t.proyecto) == null ? void 0 : g.nombre,
|
|
1541
1544
|
idProject: (u = t == null ? void 0 : t.proyecto) == null ? void 0 : u.id,
|
|
1542
1545
|
willBePaused: t.es_pausable,
|
|
1543
1546
|
difficulty: t.nivel_dificultad,
|
|
@@ -1554,7 +1557,7 @@ class zt {
|
|
|
1554
1557
|
};
|
|
1555
1558
|
}
|
|
1556
1559
|
}
|
|
1557
|
-
const
|
|
1560
|
+
const ge = async ({ filters: r, tasks_api: t }) => {
|
|
1558
1561
|
try {
|
|
1559
1562
|
return (await t.get("/api/listado_tareas", { params: r })).data.tareas.map(H).map(zt.toKanbanTasks);
|
|
1560
1563
|
} catch (s) {
|
|
@@ -1573,17 +1576,17 @@ const he = async ({ filters: r, tasks_api: t }) => {
|
|
|
1573
1576
|
withCount: !0
|
|
1574
1577
|
}
|
|
1575
1578
|
}), Lt = () => {
|
|
1576
|
-
var
|
|
1579
|
+
var g;
|
|
1577
1580
|
const r = Y(), { tasks_api: t } = K(), { user: s } = U(), { filters: a } = B(), [n, l] = v(0), [i, d] = v({
|
|
1578
1581
|
owner: {
|
|
1579
1582
|
user: s.id,
|
|
1580
|
-
config: ((
|
|
1583
|
+
config: ((g = a == null ? void 0 : a.owner) == null ? void 0 : g.config) ?? "yo_y_mis_equipos"
|
|
1581
1584
|
},
|
|
1582
1585
|
status: "por_hacer"
|
|
1583
1586
|
}), c = ce({
|
|
1584
1587
|
initialPageParam: 1,
|
|
1585
1588
|
queryKey: ["to_do_tasks", i],
|
|
1586
|
-
queryFn: ({ pageParam: u }) =>
|
|
1589
|
+
queryFn: ({ pageParam: u }) => ge({
|
|
1587
1590
|
filters: {
|
|
1588
1591
|
...i,
|
|
1589
1592
|
status: "por_hacer",
|
|
@@ -1633,17 +1636,17 @@ const he = async ({ filters: r, tasks_api: t }) => {
|
|
|
1633
1636
|
const { toDoTasks: r, total: t } = Lt(), s = [...((n = (a = r == null ? void 0 : r.data) == null ? void 0 : a.pages) == null ? void 0 : n.flat()) ?? []];
|
|
1634
1637
|
return /* @__PURE__ */ e(le, { total: t, title: "Por hacer", tasks: s, loadNextPage: () => xe(r), isFetching: r == null ? void 0 : r.isFetching, isLoadingData: r == null ? void 0 : r.isLoading });
|
|
1635
1638
|
}, Kt = () => {
|
|
1636
|
-
var
|
|
1639
|
+
var g;
|
|
1637
1640
|
const r = Y(), { tasks_api: t } = K(), { user: s } = U(), { filters: a } = B(), [n, l] = v(0), [i, d] = v({
|
|
1638
1641
|
owner: {
|
|
1639
1642
|
user: s.id,
|
|
1640
|
-
config: ((
|
|
1643
|
+
config: ((g = a == null ? void 0 : a.owner) == null ? void 0 : g.config) ?? "yo_y_mis_equipos"
|
|
1641
1644
|
},
|
|
1642
1645
|
status: "trabajando"
|
|
1643
1646
|
}), c = ce({
|
|
1644
1647
|
initialPageParam: 1,
|
|
1645
1648
|
queryKey: ["working_tasks", a],
|
|
1646
|
-
queryFn: ({ pageParam: u }) =>
|
|
1649
|
+
queryFn: ({ pageParam: u }) => ge({
|
|
1647
1650
|
filters: {
|
|
1648
1651
|
...i,
|
|
1649
1652
|
status: "trabajando",
|
|
@@ -1702,17 +1705,17 @@ const he = async ({ filters: r, tasks_api: t }) => {
|
|
|
1702
1705
|
}
|
|
1703
1706
|
);
|
|
1704
1707
|
}, Qt = () => {
|
|
1705
|
-
var
|
|
1708
|
+
var g;
|
|
1706
1709
|
const r = Y(), { user: t } = U(), { tasks_api: s } = K(), { filters: a } = B(), [n, l] = v(0), [i, d] = v({
|
|
1707
1710
|
owner: {
|
|
1708
1711
|
user: t.id,
|
|
1709
|
-
config: ((
|
|
1712
|
+
config: ((g = a == null ? void 0 : a.owner) == null ? void 0 : g.config) ?? "yo_y_mis_equipos"
|
|
1710
1713
|
},
|
|
1711
1714
|
status: "completadas"
|
|
1712
1715
|
}), c = ce({
|
|
1713
1716
|
initialPageParam: 1,
|
|
1714
1717
|
queryKey: ["done_tasks", i],
|
|
1715
|
-
queryFn: ({ pageParam: u }) =>
|
|
1718
|
+
queryFn: ({ pageParam: u }) => ge({
|
|
1716
1719
|
filters: {
|
|
1717
1720
|
...i,
|
|
1718
1721
|
status: "completadas",
|
|
@@ -2053,7 +2056,7 @@ const It = () => {
|
|
|
2053
2056
|
)
|
|
2054
2057
|
] }) });
|
|
2055
2058
|
}, Ve = ({ id: r }) => {
|
|
2056
|
-
var l, i, d, c,
|
|
2059
|
+
var l, i, d, c, g, u, b;
|
|
2057
2060
|
const { tasksProject: t, openTasks: s, openTask: a } = Z(), n = (l = t == null ? void 0 : t.data) == null ? void 0 : l.find((m) => m.id === r);
|
|
2058
2061
|
return n ? /* @__PURE__ */ o("div", { className: "flex flex-col gap-m mb-2 ", children: [
|
|
2059
2062
|
/* @__PURE__ */ o("div", { className: "flex items-center gap-m flex-wrap hover:bg-gray-100 p-2 rounded-md", children: [
|
|
@@ -2064,7 +2067,7 @@ const It = () => {
|
|
|
2064
2067
|
/* @__PURE__ */ e(Ue, { startDate: n == null ? void 0 : n.startDate, endDate: n == null ? void 0 : n.endDate }),
|
|
2065
2068
|
/* @__PURE__ */ o("button", { className: "gap-s bg-gray-100 rounded-md h-[30px] flex justify-center items-center w-fit px-m hover:bg-gray-200", children: [
|
|
2066
2069
|
/* @__PURE__ */ e(F, { icon: "subtasks", size: "xs", strokeWidth: 5, color: N.texts.subtext }),
|
|
2067
|
-
/* @__PURE__ */ e("p", { children: ((c = n == null ? void 0 : n.tasks) == null ? void 0 : c.length) === 0 ? 1 : (
|
|
2070
|
+
/* @__PURE__ */ e("p", { children: ((c = n == null ? void 0 : n.tasks) == null ? void 0 : c.length) === 0 ? 1 : (g = n == null ? void 0 : n.tasks) == null ? void 0 : g.length })
|
|
2068
2071
|
] })
|
|
2069
2072
|
] }),
|
|
2070
2073
|
s.includes(r) && /* @__PURE__ */ e("div", { className: "ml-[30px]", children: ((u = n == null ? void 0 : n.tasks) == null ? void 0 : u.length) > 0 ? (b = n == null ? void 0 : n.tasks) == null ? void 0 : b.map((m) => /* @__PURE__ */ e(Ve, { id: m == null ? void 0 : m.id })) : /* @__PURE__ */ e(Yt, { id: n == null ? void 0 : n.id }) })
|
|
@@ -2079,7 +2082,7 @@ const It = () => {
|
|
|
2079
2082
|
setPath: r,
|
|
2080
2083
|
setProject: t
|
|
2081
2084
|
}) => {
|
|
2082
|
-
const [s, a] = v([]), [n, l] = v(!0), [i, d] = v(0), [c,
|
|
2085
|
+
const [s, a] = v([]), [n, l] = v(!0), [i, d] = v(0), [c, g] = v(10), [u, b] = v(0), [m, f] = v("nombre"), { filters: p, defineFields: y, cleanFilters: _ } = B(), { tasks_api: T } = K(), { user: q } = U(), x = async (h, S) => {
|
|
2083
2086
|
var $, j, W;
|
|
2084
2087
|
try {
|
|
2085
2088
|
l(!0);
|
|
@@ -2097,7 +2100,7 @@ const It = () => {
|
|
|
2097
2100
|
const M = await T.get("/api/listado_campanias", {
|
|
2098
2101
|
params: {
|
|
2099
2102
|
pagination: {
|
|
2100
|
-
page:
|
|
2103
|
+
page: h,
|
|
2101
2104
|
pageSize: S
|
|
2102
2105
|
},
|
|
2103
2106
|
orderBy: m,
|
|
@@ -2112,13 +2115,13 @@ const It = () => {
|
|
|
2112
2115
|
}
|
|
2113
2116
|
}, w = async () => {
|
|
2114
2117
|
try {
|
|
2115
|
-
const
|
|
2116
|
-
return [...Ae].map(($) => ($.id === "ejecutivo" && ($.options =
|
|
2118
|
+
const h = await T.get("/api/obtener-comerciales");
|
|
2119
|
+
return [...Ae].map(($) => ($.id === "ejecutivo" && ($.options = h.data.map((j) => ({
|
|
2117
2120
|
id: j.nombre,
|
|
2118
2121
|
name: j.nombre
|
|
2119
2122
|
}))), $));
|
|
2120
|
-
} catch (
|
|
2121
|
-
return console.error("Error fetching salesman data:",
|
|
2123
|
+
} catch (h) {
|
|
2124
|
+
return console.error("Error fetching salesman data:", h), [...Ae];
|
|
2122
2125
|
}
|
|
2123
2126
|
};
|
|
2124
2127
|
P(() => {
|
|
@@ -2127,11 +2130,11 @@ const It = () => {
|
|
|
2127
2130
|
y(S);
|
|
2128
2131
|
})();
|
|
2129
2132
|
}, []), P(() => {
|
|
2130
|
-
const
|
|
2131
|
-
x(
|
|
2133
|
+
const h = Math.floor(i / c) + 1;
|
|
2134
|
+
x(h, c);
|
|
2132
2135
|
}, [i, c, m, p]);
|
|
2133
|
-
const C = (
|
|
2134
|
-
d(
|
|
2136
|
+
const C = (h) => {
|
|
2137
|
+
d(h.first), g(h.rows);
|
|
2135
2138
|
}, z = [
|
|
2136
2139
|
{ label: "5 filas", value: 5 },
|
|
2137
2140
|
{ label: "10 filas", value: 10 },
|
|
@@ -2139,12 +2142,12 @@ const It = () => {
|
|
|
2139
2142
|
{ label: "20 filas", value: 20 },
|
|
2140
2143
|
{ label: "25 filas", value: 25 },
|
|
2141
2144
|
{ label: "50 filas", value: 50 }
|
|
2142
|
-
], k = (
|
|
2143
|
-
const S = parseInt(
|
|
2144
|
-
|
|
2145
|
-
}, R = (
|
|
2146
|
-
f((S) => S ===
|
|
2147
|
-
}, Q = (
|
|
2145
|
+
], k = (h) => {
|
|
2146
|
+
const S = parseInt(h.target.value, 10);
|
|
2147
|
+
g(S), C({ first: 0, rows: S });
|
|
2148
|
+
}, R = (h) => {
|
|
2149
|
+
f((S) => S === h ? `${h}:desc` : h);
|
|
2150
|
+
}, Q = (h) => m === h ? "↑↓" : m === `${h}:desc` ? "↓↑" : "↑↓";
|
|
2148
2151
|
return /* @__PURE__ */ e("div", { className: "table-container", children: n ? /* @__PURE__ */ e("div", { style: { width: "100%" }, children: /* @__PURE__ */ e(Oe, {}) }) : /* @__PURE__ */ o(D, { children: [
|
|
2149
2152
|
/* @__PURE__ */ o(
|
|
2150
2153
|
"table",
|
|
@@ -2234,7 +2237,7 @@ const It = () => {
|
|
|
2234
2237
|
/* @__PURE__ */ e("th", { children: "Status" }),
|
|
2235
2238
|
/* @__PURE__ */ e("th", { children: "Responsable" })
|
|
2236
2239
|
] }) }),
|
|
2237
|
-
/* @__PURE__ */ e("tbody", { children: s == null ? void 0 : s.map((
|
|
2240
|
+
/* @__PURE__ */ e("tbody", { children: s == null ? void 0 : s.map((h, S) => {
|
|
2238
2241
|
var $, j, W, A, M, E, I, fe, be, ye, we, ve, Ne, _e, Ce, Fe;
|
|
2239
2242
|
return /* @__PURE__ */ o(
|
|
2240
2243
|
"tr",
|
|
@@ -2242,17 +2245,17 @@ const It = () => {
|
|
|
2242
2245
|
className: "table-row",
|
|
2243
2246
|
onClick: () => {
|
|
2244
2247
|
_(), t({
|
|
2245
|
-
id:
|
|
2246
|
-
project:
|
|
2248
|
+
id: h == null ? void 0 : h.id,
|
|
2249
|
+
project: h == null ? void 0 : h.nombre
|
|
2247
2250
|
}), r("kanban-campania");
|
|
2248
2251
|
},
|
|
2249
2252
|
children: [
|
|
2250
|
-
/* @__PURE__ */ e("td", { children: ($ =
|
|
2253
|
+
/* @__PURE__ */ e("td", { children: ($ = h == null ? void 0 : h.campania) == null ? void 0 : $.nombre }),
|
|
2251
2254
|
/* @__PURE__ */ o("td", { children: [
|
|
2252
2255
|
" ",
|
|
2253
|
-
(j =
|
|
2256
|
+
(j = h == null ? void 0 : h.campania) == null ? void 0 : j.inicia
|
|
2254
2257
|
] }),
|
|
2255
|
-
/* @__PURE__ */ e("td", { children: (W =
|
|
2258
|
+
/* @__PURE__ */ e("td", { children: (W = h == null ? void 0 : h.campania) == null ? void 0 : W.termina }),
|
|
2256
2259
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ o(
|
|
2257
2260
|
"div",
|
|
2258
2261
|
{
|
|
@@ -2276,7 +2279,7 @@ const It = () => {
|
|
|
2276
2279
|
color: "#000"
|
|
2277
2280
|
},
|
|
2278
2281
|
children: [
|
|
2279
|
-
|
|
2282
|
+
h == null ? void 0 : h.progreso,
|
|
2280
2283
|
"%"
|
|
2281
2284
|
]
|
|
2282
2285
|
}
|
|
@@ -2300,8 +2303,8 @@ const It = () => {
|
|
|
2300
2303
|
top: 0,
|
|
2301
2304
|
left: 0,
|
|
2302
2305
|
height: "100%",
|
|
2303
|
-
width: `${
|
|
2304
|
-
backgroundColor:
|
|
2306
|
+
width: `${h.progreso}%`,
|
|
2307
|
+
backgroundColor: h.progreso === 100 ? "#039B59" : h.progreso > 50 ? "#3658C1" : h.progreso > 0 ? "#DC8921" : "#C4C4C4",
|
|
2305
2308
|
borderRadius: "10px",
|
|
2306
2309
|
transition: "width 0.3s ease-in-out"
|
|
2307
2310
|
}
|
|
@@ -2317,8 +2320,8 @@ const It = () => {
|
|
|
2317
2320
|
/* @__PURE__ */ e(
|
|
2318
2321
|
re,
|
|
2319
2322
|
{
|
|
2320
|
-
src: `${Qe}${(fe = (I = (E = (M = (A =
|
|
2321
|
-
alt: (we = (ye = (be =
|
|
2323
|
+
src: `${Qe}${(fe = (I = (E = (M = (A = h == null ? void 0 : h.campania) == null ? void 0 : A.responsable) == null ? void 0 : M.imagen) == null ? void 0 : E.formats) == null ? void 0 : I.thumbnail) == null ? void 0 : fe.url}`,
|
|
2324
|
+
alt: (we = (ye = (be = h == null ? void 0 : h.campania) == null ? void 0 : be.responsable) == null ? void 0 : ye.nombre) == null ? void 0 : we.charAt(
|
|
2322
2325
|
0
|
|
2323
2326
|
)
|
|
2324
2327
|
}
|
|
@@ -2329,11 +2332,11 @@ const It = () => {
|
|
|
2329
2332
|
style: {
|
|
2330
2333
|
boxShadow: "10px 5px 10px rgba(0, 0, 0, 0.5)"
|
|
2331
2334
|
},
|
|
2332
|
-
children: (_e = (Ne = (ve =
|
|
2335
|
+
children: (_e = (Ne = (ve = h == null ? void 0 : h.campania) == null ? void 0 : ve.responsable) == null ? void 0 : Ne.nombre) == null ? void 0 : _e.charAt(0)
|
|
2333
2336
|
}
|
|
2334
2337
|
)
|
|
2335
2338
|
] }),
|
|
2336
|
-
/* @__PURE__ */ e("span", { style: { marginLeft: "8px", fontSize: "10px" }, children: (Fe = (Ce =
|
|
2339
|
+
/* @__PURE__ */ e("span", { style: { marginLeft: "8px", fontSize: "10px" }, children: (Fe = (Ce = h == null ? void 0 : h.campania) == null ? void 0 : Ce.responsable) == null ? void 0 : Fe.nombre })
|
|
2337
2340
|
] }) })
|
|
2338
2341
|
]
|
|
2339
2342
|
},
|
|
@@ -2398,16 +2401,16 @@ const It = () => {
|
|
|
2398
2401
|
{
|
|
2399
2402
|
className: "select",
|
|
2400
2403
|
value: c,
|
|
2401
|
-
onChange: (
|
|
2402
|
-
children: z.map((
|
|
2404
|
+
onChange: (h) => k(h),
|
|
2405
|
+
children: z.map((h) => /* @__PURE__ */ e(
|
|
2403
2406
|
"option",
|
|
2404
2407
|
{
|
|
2405
2408
|
className: "option-select",
|
|
2406
|
-
value:
|
|
2409
|
+
value: h.value,
|
|
2407
2410
|
style: { background: "#F5F5F5" },
|
|
2408
|
-
children:
|
|
2411
|
+
children: h.label
|
|
2409
2412
|
},
|
|
2410
|
-
|
|
2413
|
+
h.value
|
|
2411
2414
|
))
|
|
2412
2415
|
}
|
|
2413
2416
|
)
|
|
@@ -2433,7 +2436,7 @@ const It = () => {
|
|
|
2433
2436
|
};
|
|
2434
2437
|
return r === "kanban-campania" ? /* @__PURE__ */ e(xt, { project: a == null ? void 0 : a.id, children: l[r][t] }) : l[r][t];
|
|
2435
2438
|
}, ea = ({ path: r }) => /* @__PURE__ */ e(dt, { children: /* @__PURE__ */ e(() => {
|
|
2436
|
-
const { selectPath: s, updateFilters: a, applyFilters: n, filters: l } = B(), [i, d] = v("kanban"), [c,
|
|
2439
|
+
const { selectPath: s, updateFilters: a, applyFilters: n, filters: l } = B(), [i, d] = v("kanban"), [c, g] = v(r), [u, b] = v({
|
|
2437
2440
|
id: 1704,
|
|
2438
2441
|
project: "Kanban de Campania"
|
|
2439
2442
|
}), [m, f] = v((l == null ? void 0 : l.taskName) ?? ""), [p, y] = v(""), _ = O(null);
|
|
@@ -2452,7 +2455,7 @@ const It = () => {
|
|
|
2452
2455
|
"lista-campanias": "Campanias",
|
|
2453
2456
|
"kanban-campania": `Kanban de ${u.project}`
|
|
2454
2457
|
})[C], q = (C) => {
|
|
2455
|
-
|
|
2458
|
+
g(C);
|
|
2456
2459
|
}, x = ["lista-campanias", "kanban-campania"], w = {
|
|
2457
2460
|
"lista-campanias": ["lista", "gantt"],
|
|
2458
2461
|
"kanban-campania": ["kanban", "lista", "gantt"]
|
|
@@ -2530,7 +2533,7 @@ const It = () => {
|
|
|
2530
2533
|
if (!t) return /* @__PURE__ */ e(ta, {});
|
|
2531
2534
|
if (!t.accessToken) return /* @__PURE__ */ e(aa, {});
|
|
2532
2535
|
let n = { user: t, url: s };
|
|
2533
|
-
return /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e(
|
|
2536
|
+
return /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e(gt, { ...n, children: /* @__PURE__ */ e(ht, { ...n, children: /* @__PURE__ */ e("div", { className: "w-full h-full min-h-[100%] relative", children: /* @__PURE__ */ o(Ye, { client: a, children: [
|
|
2534
2537
|
/* @__PURE__ */ e(ea, { path: r }),
|
|
2535
2538
|
" "
|
|
2536
2539
|
] }) }) }) }) });
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imj_media/tareas",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.30",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc && vite build && npm run build:css",
|
|
7
7
|
"build:css": "tailwindcss -m -i ./src/index.css -o ./dist/tareas.css",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"access": "public",
|
|
80
80
|
"registry": "https://registry.npmjs.org/@imjmedia"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "e9586a61370b55d31ac31afd2a36e6176fdfd8b3"
|
|
83
83
|
}
|