@imj_media/tareas 0.1.10 → 0.1.11
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 +9 -10
- package/package.json +2 -2
package/dist/tareas.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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 T=require("@tanstack/react-query"),d=require("react"),b=require("@imj_media/tasks-modules"),W=require("react-dom"),ae=require("axios"),ne=require("qs"),O=require("date-fns"),H=require("date-fns/locale"),_=require("@imj_media/imj-ui"),be=require("react-hook-form"),ye=require("primereact/avatar"),we=require("primereact/paginator"),Ne=require("primereact/dropdown"),ve=({label:t,active:s,onClick:n,disabled:a})=>a?e.jsx(b.Tooltip,{dispatch:e.jsxs("button",{className:"text-texts-placeholder text-xs font-semibold cursor-help",children:[" ",t," "]}),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:a,onClick:n,className:`${s?"text-texts-enfasis border-b-2 border-texts-enfasis":""} text-xs font-semibold ${a?"cursor-not-allowed text-texts-placeholder":"text-texts-subtext"} `,children:t}),Ce=({tabs:t,renderItem:s,initialTab:n})=>{const[a,r]=d.useState(n??t[0].toLowerCase());d.useEffect(()=>{n&&r(n)},[n]);const l=i=>{r(i),s(i)};return e.jsx("div",{className:"flex",children:t.map((i,x)=>e.jsx("div",{className:`${x===0?"border-l-2":""} border-r-2 border-gray-200 px-m`,children:e.jsx(ve,{onClick:()=>l(i.toLowerCase()),label:i,active:i.toLowerCase()===a,disabled:["gantt"].includes(i.toLowerCase())},x)}))})},C={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:"#C4335"},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"}},V=()=>{const[t,s]=d.useState(null);return{position:t,setElementPosition:l=>{var m;let i=(m=l.current)==null?void 0:m.getBoundingClientRect(),x=(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(t?null:{x:x??0,y:o??0})},getChildrenSize:l=>{var i;return(i=l.current)==null?void 0:i.getBoundingClientRect()},clearPosition:()=>{s(null)}}},_e=({children:t,filterChildren:s})=>{const{position:n,setElementPosition:a}=V(),r=d.useRef(null),l=({children:i})=>{const[x,o]=d.useState();return d.useEffect(()=>{var m,c;s.current&&o(((n==null?void 0:n.x)??0)-(((c=(m=s.current)==null?void 0:m.getBoundingClientRect())==null?void 0:c.width)??0))},[s==null?void 0:s.current,n==null?void 0:n.x]),n&&W.createPortal(e.jsx("div",{className:`absolute w-fit h-fit ${x?"block":"hidden"}`,style:{top:`${n==null?void 0:n.y}px`,left:`${x}px`},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(b.Icons,{icon:"filter",size:"xs",strokeWidth:5,color:C.primary.regular}),"Filtrar"]}),e.jsx("button",{className:"hidden",id:"filter-button",onClick:()=>{a(r)}}),e.jsx(l,{children:t})]})},ee=t=>{let s={};return Object.entries(t).forEach(([n,a])=>{if(n.includes(".")){let[r,l]=n.split(".");s[r]=s[r]||{},s[r][l]=a}else s[n]=a}),s},re=d.createContext({}),Fe=({children:t})=>{const[s,n]=d.useState({}),[a,r]=d.useState({}),[l,i]=d.useState([]),x=({name:c,value:p})=>{function h(g){return!isNaN(g)&&g!==null&&g!==""?parseFloat(g):null}let j=h(p);r(g=>{let f={...g},y=l==null?void 0:l.find(u=>u.label.toLowerCase().replace(/ /g,"_")===c);return y?f[y.id]=j??p:f[c]=j??p,f})};d.useEffect(()=>{let c=l.map(p=>p.id==="owner.config"?[p.id,"yo_y_mis_equipos"]:p.id==="dependency"?[p.id,"ambas"]:[p.id,null]);r(Object.fromEntries(c))},[l]);const o=()=>{let c=l.map(p=>p.id==="owner.config"?[p.id,"yo_y_mis_equipos"]:p.id==="dependency"?[p.id,"ambas"]:[p.id,null]);r(Object.fromEntries(c)),n(ee(Object.fromEntries(c)))},m=()=>{let c=ee(a);n(c)};return e.jsx(re.Provider,{value:{fields:l,filters:s,defineFields:i,updateFilters:x,cleanFilters:o,applyFilters:m,initialFilters:a},children:t})},E=()=>d.useContext(re);function le(t,s=300,n={leading:!1,trailing:!0}){let a,r=null;return function(...l){const i=Date.now(),x=n.leading&&!r;clearTimeout(a),x&&t(...l),r=i,a=setTimeout(()=>{n.trailing&&(!n.leading||i-r>=s)&&(t(...l),r=null)},s)}}const Te=()=>{const{fields:t,updateFilters:s,cleanFilters:n,applyFilters:a,initialFilters:r}=E();return e.jsxs("div",{className:"flex flex-col gap-l min-w-[250px]",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:t==null?void 0:t.map((l,i)=>{var x;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 m,c;s({name:(m=o==null?void 0:o.target)==null?void 0:m.name,value:(c=o==null?void 0:o.target)==null?void 0:c.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:(x=l==null?void 0:l.options)==null?void 0:x.map((o,m)=>e.jsx("option",{value:o.id,children:o.name},m))}):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:le(o=>{var m,c;return s({name:(m=o==null?void 0:o.target)==null?void 0:m.name,value:(c=o==null?void 0:o.target)==null?void 0:c.value})},1e3)})]},i)})}),e.jsx("button",{className:"btn-primary rounded-md py-s",onClick:a,children:"Filtrar"})]})},$=t=>{const s=a=>Object.prototype.toString.call(a)==="[object Object]",n=a=>a.attributes?{id:a.id,...a.attributes}:a;if(Array.isArray(t))return t.map(a=>$(a));if(s(t)){Array.isArray(t.data)?t=[...t.data]:s(t.data)?t=n({...t.data}):t.data===null?t=null:t=n(t);for(const a in t)t[a]=$(t[a]);return t}return t};class Se{static toCampaignTasks(s){var a,r,l,i,x,o,m,c,p,h,j,g;let n=[];return s!=null&&s.responsable&&n.push({id:s.responsable.id,name:s.responsable.nombre,image:(x=(i=(l=(r=(a=s.responsable)==null?void 0:a.userOBP)==null?void 0:r.imagen)==null?void 0:l.formats)==null?void 0:i.thumbnail)==null?void 0:x.url}),console.log("task",s),(o=s==null?void 0:s.equipo)!=null&&o.miembros&&s.equipo.miembros.forEach(f=>{var y,u,w,v;n!=null&&n.find(N=>N.id===f.idUser.id)||f.idUser&&n.push({id:f.idUser.id,name:f.idUser.nombre,image:(v=(w=(u=(y=f==null?void 0:f.userOBP)==null?void 0:y.imagen)==null?void 0:u.formats)==null?void 0:w.thumbnail)==null?void 0:v.url})}),{isPrincipalTask:(s==null?void 0:s.tarea_principal)??!1,projectName:((m=s==null?void 0:s.proyecto)==null?void 0:m.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:((c=s==null?void 0:s.comentarios)==null?void 0:c.length)??null,willBePaused:s==null?void 0:s.es_pausable,statusRequiredTask:((p=s==null?void 0:s.id_t_requerida)==null?void 0:p.estatus)??null,nameRequiredTask:((h=s==null?void 0:s.id_t_requerida)==null?void 0:h.texto_corto)??null,responsible:((j=s==null?void 0:s.responsable)==null?void 0:j.id)??null,tasks:((g=s==null?void 0:s.tareas)==null?void 0:g.map(f=>({id:f.id,name:f.texto_corto,status:f.estatus})))??null}}}const Ae=async({filters:t,tasks_api:s,project:n})=>{try{const a=await s.get("/api/listado_tareas",{params:{...t,project:{id:n},includeAllTasks:!0}});return $(a.data.tareas).map(Se.toCampaignTasks)}catch(a){console.log(a)}},ie=d.createContext({}),qe=({children:t,user:s,url:n})=>{const a=ae.create({baseURL:n,headers:{Authorization:`Bearer ${s.accessToken}`},paramsSerializer:r=>ne.stringify(r,{encodeValuesOnly:!0})});return e.jsx(ie.Provider,{value:{tasks_api:a},children:t})},S=()=>d.useContext(ie),oe=d.createContext({}),Pe=({children:t,user:s,url:n})=>{const a=ae.create({baseURL:n,headers:{Authorization:`Bearer ${s.accessToken}`},paramsSerializer:r=>ne.stringify(r,{encodeValuesOnly:!0})});return e.jsx(oe.Provider,{value:{user:s,tasks_api:a},children:t})},M=()=>d.useContext(oe),ce=d.createContext({}),Ee=({children:t,project:s})=>{var y;const n=T.useQueryClient(),[a,r]=d.useState([]),[l,i]=d.useState([]),{tasks_api:x}=S(),{filters:o}=E(),{user:m}=M(),[c,p]=d.useState({owner:{user:m.id,config:((y=o==null?void 0:o.owner)==null?void 0:y.config)??"yo_y_mis_equipos"},project:{id:s}});d.useEffect(()=>{console.log(a)},[a]);const h=T.useQuery({queryKey:["tasksProject",s],queryFn:()=>Ae({filters:{...c},project:s,tasks_api:x})});d.useEffect(()=>{var u;Object.keys(o).length>0&&p({...o,owner:{user:m.id,config:((u=o==null?void 0:o.owner)==null?void 0:u.config)??"yo_y_mis_equipos"},project:{id:s}})},[o]),d.useEffect(()=>{n.invalidateQueries({queryKey:["tasksProject",s]})},[c]);const j=u=>{r(w=>[...w,u])},g=u=>{i(w=>w.includes(u)?w.filter(v=>v!==u):[...w,u])},f=s??null;return e.jsx(ce.Provider,{value:{tasksProject:h,selectedTasks:a,projectID:f,openTasks:l,selectTask:j,openTask:g},children:t})},U=()=>d.useContext(ce),De=[{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"}]}],Ie=({id:t})=>{const[s,n]=d.useState(!1);return{checked:s,checkTask:()=>{n(!s),console.log("completar tarea",t)}}},de=({id:t,nameRequiredTask:s,statusRequiredTask:n,status:a})=>{const{checked:r,checkTask:l}=Ie({id:t});let i=Math.random().toString();return console.log({statusRequiredTask:n}),e.jsxs(e.Fragment,{children:[a===1&&(n<2&&s!==""?e.jsx(b.Tooltip,{dispatch:e.jsx("label",{htmlFor:i,children:e.jsx(b.Icons,{icon:"info_circle",color:C.warning.regular,strokeWidth:4})}),children:e.jsxs("div",{className:"px-m py-s max-w-[200px] bg-warning-light rounded-lg border-l-[5px] border-warning-regular text-warning-dark text-xs",children:[e.jsx("p",{className:"font-bold",children:"Requiere completar su tarea requerida:"}),e.jsxs("p",{children:[" ",s," "]})]})}):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(b.Icons,{icon:r?"check_outline":"circle_checked",color:r?"white":C.texts.placeholder,strokeWidth:4,size:r?"xs":"s"})})),e.jsx("input",{id:i,checked:r,onChange:l,type:"checkbox",className:"hidden"})]})},B=({imageUrl:t="https://www.uv.unach.mx/assets/img/prueba/directorio/userM.png",alt:s="avatar"})=>e.jsx("img",{src:t===""?"https://www.uv.unach.mx/assets/img/prueba/directorio/userM.png":t,alt:s??"avatar",className:"w-[28px] h-[28px] min-w-[28px] min-h-[28px] rounded-full bg-containers border-2 border-white"}),se=({trigger:t,user:s,showUser:n=!0})=>e.jsx(b.Tooltip,{dispatch:t,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(B,{imageUrl:s.image??"",alt:s.name}),e.jsx("p",{className:"text-xs font-bold content-text",children:s.name})]})}),$e=({options:t,onselect:s})=>{const[n,a]=d.useState(null),r=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),l=[...t].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=>a(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(b.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(B,{imageUrl:i.image,alt:i.name}),e.jsx("p",{className:"text-xs font-bold content-text",children:i.name})]}))})]})};class Be{static toDomain(s){return{id:s.id,name:s.nombre,color:s.color}}}const Le=()=>{const{tasks_api:t}=S();return{teams:T.useQuery({queryKey:["teams","all"],queryFn:async()=>{const n=await t.get("/api/equipos");return $(n.data).map(Be.toDomain)}})}};class Me{static toUsers(s){var n,a,r;return{id:s.id,name:s.nombre,image:(r=(a=(n=s.imagen)==null?void 0:n.formats)==null?void 0:a.thumbnail)==null?void 0:r.url}}}const ze=async({tasks_api:t})=>{try{const s=await t.get("/api/allOBPUsers");return $(s.data).map(Me.toUsers)}catch(s){throw console.log("Error al obtener los usuarios comerciales",s),`Error al obtener los usuarios comerciales: ${s}`}},Re=()=>{const{tasks_api:t}=S();return{users:T.useQuery({queryKey:["users"],queryFn:()=>ze({tasks_api:t}),staleTime:1e3*60*60*24})}},xe=t=>new Intl.DateTimeFormat("es-MX",{month:"long"}).format(t);function Oe(t){const s=["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],n=new Date(t).getDay();return s[n]}const te=t=>{let s=t||new Date,n=s.getDate(),a=xe(s.getMonth()).slice(0,3),r=s.getFullYear().toString().slice(-2),l=Oe(s).slice(0,3);return`${l.charAt(0).toUpperCase()+l.slice(1)} ${n} ${a.charAt(0).toUpperCase()+a.slice(1)} ${r}`},G=t=>({...t,image:t.image?`https://devobp.imjmedia.com.mx${t.image}`:""}),ue=({users:t,onClick:s,responsible:n})=>{let a=`button-assign-users-${Math.random().toString(36).substring(2,15)}`;const{setElementPosition:r,position:l,clearPosition:i}=V(),x=d.useRef(null);console.log(t);const o=()=>n?null:t.length>3&&e.jsx(b.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:`+${t.length-3}`})}),children:e.jsx("div",{className:"bg-containers w-fit h-fit p-2 rounded-lg border-containers",children:t==null?void 0:t.slice(3).map((h,j)=>e.jsxs("div",{className:"flex items-center gap-2 ",children:[e.jsx(B,{imageUrl:h.image??"",alt:h.name},j),e.jsx("p",{className:"text-xs font-bold content-text",children:h.name})]},j))})}),m=()=>{if(n){let h=t.find(j=>j.id===n);return e.jsx("div",{children:e.jsx(se,{trigger:e.jsx(B,{imageUrl:h==null?void 0:h.image,alt:h==null?void 0:h.name},n),user:h,showUser:!(l!=null&&l.x)})})}return(t==null?void 0:t.length)>0&&t.slice(0,3).map((h,j)=>e.jsx("div",{className:`${j===0?"":"ml-[-8px]"}`,children:e.jsx(se,{trigger:e.jsx(B,{imageUrl:h.image,alt:h.name},j),user:h,showUser:!(l!=null&&l.x)})}))},c=({children:h})=>e.jsx("label",{ref:x,htmlFor:a,className:"cursor-pointer flex items-center",children:h});if(t.length===0)return e.jsx(c,{children:e.jsx(b.Icons,{icon:"user",size:"xs",strokeWidth:3})});const p=()=>{var v;const[h,j]=d.useState(),[g,f]=d.useState("team"),{teams:y}=Le(),{users:u}=Re();d.useEffect(()=>{var N,F;x.current&&j(((l==null?void 0:l.x)??0)-(((F=(N=x.current)==null?void 0:N.getBoundingClientRect())==null?void 0:F.width)??0))},[x==null?void 0:x.current,l==null?void 0:l.x]);const w=()=>{const N=[{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:N.map((F,A)=>e.jsx("button",{className:`w-full text-sm border-texts-placeholder text-center ${g===F.id?"text-primary-pastel":""} ${A===N.length-1?"border-r-0":" border-r-2"}`,onClick:()=>f(F.id),children:F.label}))})};return(l==null?void 0:l.x)&&W.createPortal(e.jsx("div",{className:`absolute w-[300px] h-fit ${h?"block":"hidden"}`,style:{top:`${l==null?void 0:l.y}px`,left:`${h}px`},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(w,{}),e.jsx($e,{options:g==="team"?y.data.map(N=>({id:N.id,name:N.name,image:""})):(v=u.data)==null?void 0:v.map(G),onselect:N=>{i(),s&&s(N)}})]})}),document.body)};return e.jsxs(e.Fragment,{children:[e.jsxs(c,{children:[m(),o()]}),e.jsx("button",{className:"hidden",id:a,onClick:()=>r(x)}),e.jsx(p,{})]})},We=()=>{const{tasks_api:t}=S(),s=T.useQueryClient(),n=async({newData:l,id:i})=>(await t.put(`/api/tareas/${i}`,{data:l})).data,a=T.useMutation({mutationFn:({newData:l,id:i})=>n({newData:l,id:i}),onSuccess:()=>{s.invalidateQueries({queryKey:["toDoTasks"]}),s.invalidateQueries({queryKey:["inProgressTasks"]}),s.invalidateQueries({queryKey:["doneTasks"]}),console.log("Task updated successfully!")},onError:l=>{console.error("Failed to update the task.",l)}});return{updateTask:async({id:l,data:i,user:x})=>{let o={updated_at:new Date().toISOString(),updated_by:x,...i};try{await a.mutateAsync({newData:o,id:l})}catch(m){console.error("Error updating the element:",m)}}}},me=({priority:t,id:s})=>{const{updateTask:n}=We(),a=Math.random().toString(36),[r,l]=d.useState(null),i=o=>({0:C.primary.regular,1:C.success.regular,2:C.warning.regular,3:C.danger.regular})[o],x=()=>{if(!r)return null;const o=({priority:m,text:c})=>e.jsxs("button",{onClick:()=>{n({id:s,data:{prioridad:m},user:272}),l(null)},className:"flex gap-m items-center px-l py-s hover:bg-primary-light",children:[e.jsx(b.Icons,{icon:"flag",size:"xs",strokeWidth:3,color:i(m)}),e.jsx("p",{className:"text-sm",style:{color:i(m)},children:c})]});return W.createPortal(e.jsxs("div",{onBlur:()=>{l(null)},id:`${a}-options`,style:{top:`${r.y+5}px`,left:`${r.x+5}px`},className:`absolute h-fit p-m flex flex-col gap-2 bg-bg-card rounded-xl shadow-lg
|
|
2
|
-
w-max`,children:[e.jsx(o,{priority:0,text:"Baja"}),e.jsx(o,{priority:1,text:"Normal"}),e.jsx(o,{priority:2,text:"Media"}),e.jsx(o,{priority:3,text:"Alta"})]}),document.body)};return e.jsxs("div",{className:"relative h-[22px]",children:[e.jsx("label",{onBlur:()=>{l(null)},htmlFor:a,className:"flex items-center gap-2 cursor-pointer active:opacity-50",children:e.jsx(b.Icons,{icon:"flag",size:"xs",strokeWidth:3,color:i(t)})}),e.jsx("button",{id:a,onClick:o=>{l(r?null:{x:o.clientX,y:o.clientY})},className:"hidden"}),e.jsx(x,{})]})};function Ue({items:t}){var a;const[s,n]=d.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:t.map((r,l)=>e.jsx("div",{className:`border-r border-neutral-100 pr-3 py-1 ${l!==0?"px-3":""}`,children:e.jsx(_.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:(a=t.find(r=>r.id===s))==null?void 0:a.component})]})}const Ke="https://devobp.imjmedia.com.mx";function Y(t){return t?t.split(" ").map(a=>{var r;return(r=a[0])==null?void 0:r.toUpperCase()}).slice(0,2).join(""):""}const Qe="https://devobp.imjmedia.com.mx";function He({comment:t}){var n,a,r,l,i,x;function s(o){const m=O.parseISO(o);return O.formatDistanceToNow(m,{locale:H.es,addSuffix:!0})}return e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-row gap-2 items-start",children:[e.jsxs(_.Avatar,{className:"w-8 h-8 max-w-8 max-h-8 min-w-8 min-h-8",children:[e.jsx(_.AvatarImage,{className:"w-8 h-8",src:`${Qe}${(l=(r=(a=(n=t==null?void 0:t.autor)==null?void 0:n.imagen)==null?void 0:a.formats)==null?void 0:r.thumbnail)==null?void 0:l.url}`,alt:"@shadcn"}),e.jsx(_.AvatarFallback,{children:Y((i=t==null?void 0:t.autor)==null?void 0:i.nombre)})]}),e.jsx("p",{className:"text-sm text-neutral-900 font-medium",children:(x=t==null?void 0:t.autor)==null?void 0:x.nombre}),e.jsx("span",{className:"text-xs text-neutral-600 font-normal mt-[2px]",children:s(t==null?void 0:t.createdAt)})]}),e.jsx("p",{className:"text-sm text-neutral-600 font-normal pl-10",children:t==null?void 0:t.comentario})]})}function Ve({currentUser:t,data:s,taskId:n,onNewComment:a}){var p,h,j;const{tasks_api:r}=S(),{register:l,handleSubmit:i,reset:x}=be.useForm(),[o,m]=d.useState([]);d.useEffect(()=>{if(s!=null&&s.comentarios){const g=[...s.comentarios].sort((f,y)=>new Date(y.createdAt).getTime()-new Date(f.createdAt).getTime());m(g)}},[s]);const c=async g=>{try{const f={autor:{id:t==null?void 0:t.id,email:t==null?void 0:t.email,nombre:t==null?void 0:t.nombre,imagen:t==null?void 0:t.imagen},comentario:g==null?void 0:g.comment,createdAt:new Date().toISOString()};await r.post("/api/comentarios",{data:{autor:t==null?void 0:t.id,comentario:g.comment,tarea:n}}),a(!0),m(y=>[f,...y]),x()}catch(f){console.error("Error al agregar comentario:",f)}};return e.jsxs("div",{className:"flex flex-col h-full gap-4",children:[e.jsxs("form",{onSubmit:i(c),className:"flex flex-row items-center gap-3",children:[e.jsxs(_.Avatar,{className:"w-8 h-8 max-w-8 max-h-8 min-w-8 min-h-8",children:[e.jsx(_.AvatarImage,{className:"w-8 h-8",src:`${Ke}${(j=(h=(p=t==null?void 0:t.imagen)==null?void 0:p.formats)==null?void 0:h.thumbnail)==null?void 0:j.url}`,alt:"@shadcn"}),e.jsx(_.AvatarFallback,{className:"border border-x-primary-pastel",children:Y(t==null?void 0:t.nombre)})]}),e.jsx(_.Input,{...l("comment",{required:!0}),autoComplete:"off",placeholder:"Escribe un comentario",className:"w-full bg-white border border-neutral-200"})]}),o.map((g,f)=>e.jsx(He,{comment:g},f))]})}function Ge({data:t}){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=a=>a?O.format(new Date(a),"d MMM",{locale:H.es}):"";return e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-row items-center gap-4",children:[e.jsx(_.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:t==null?void 0:t.length})]}),e.jsx("div",{className:"flex flex-col gap-2 border border-neutral-200 rounded-lg mt-3",children:t==null?void 0:t.map(a=>{var r,l,i,x,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(B,{imageUrl:(x=(i=(l=(r=a.responsable)==null?void 0:r.image)==null?void 0:l.formats)==null?void 0:i.thumbnail)==null?void 0:x.url}),e.jsx("p",{className:"text-sm font-normal w-[400px] text-nowrap text-ellipsis overflow-hidden",children:a==null?void 0:a.texto_corto})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("p",{className:"text-sm font-normal",children:n(a==null?void 0:a.createdAt)}),e.jsx("div",{className:`w-4 h-4 bg-gray-400 block rounded-full ${((o=s[a==null?void 0:a.estatus])==null?void 0:o.color)??"bg-gray-400"}`})]})]},a.id)})})]})}const Ye="https://devobp.imjmedia.com.mx";function Xe({isOpen:t,setIsOpen:s,taskId:n}){var g,f,y,u,w,v,N,F,A,q,P;const[a,r]=d.useState(null),[l,i]=d.useState(!1),[x,o]=d.useState(null),{tasks_api:m}=S(),{user:c}=M();d.useEffect(()=>{if(t&&n||l){const D=async()=>{const I=await m.get(`/api/detalleTarea/${n}`);r(I==null?void 0:I.data)},z=async()=>{var Z,k;const I=await m.get(`/api/users/${c.id}`),Q=await m.post("/api/obtenerUsuarioOBP/",{emailList:[(Z=I==null?void 0:I.data)==null?void 0:Z.email]});o((k=Q==null?void 0:Q.data)==null?void 0:k.data[0])};D(),z()}},[t,n,l]);const p={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"}},h=D=>D?O.format(D,"d MMM yyyy, h:mmaaa",{locale:H.es}):"Fecha no disponible",j=[{id:1,label:"Todo",component:e.jsx(Ve,{taskId:n,currentUser:x,data:a,onNewComment:i})},{id:2,label:"Dependencias",component:e.jsx(Ge,{data:a==null?void 0:a.ids_t_dependientes})}];return e.jsx(e.Fragment,{children:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`fixed inset-0 bg-transparent bg-opacity-50 flex justify-center items-center z-20 ${t?"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-50 overflow-hidden transition-all ease-in-out duration-500 shadow-2xl ${t?"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.jsx("h3",{className:"text-lg font-semibold text-neutral-900",children:a==null?void 0:a.texto_corto}),e.jsx(_.Button,{variant:"shadow",size:"sm",onClick:()=>s(!1),className:"bg-neutral-100 w-10 h-10",children:e.jsx(b.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:[a==null?void 0:a.campania," / ",a==null?void 0:a.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:(a==null?void 0:a.texto_largo)??"Sin descripción"})]}),e.jsx(_.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(_.AccordionItem,{value:"item-1",className:"border-none",children:[e.jsx(_.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(_.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"}),(g=a==null?void 0:a.responsable)!=null&&g.nombre?e.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[e.jsxs(_.Avatar,{className:"w-8 h-8",children:[e.jsx(_.AvatarImage,{src:`${Ye}${(w=(u=(y=(f=a==null?void 0:a.responsable)==null?void 0:f.imagen)==null?void 0:y.formats)==null?void 0:u.thumbnail)==null?void 0:w.url}`,alt:"@shadcn"}),e.jsx(_.AvatarFallback,{children:Y((v=a==null?void 0:a.responsable)==null?void 0:v.nombre)})]}),e.jsx("span",{className:"text-xs text-neutral-600 font-normal",children:(N=a==null?void 0:a.responsable)==null?void 0:N.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:((F=a==null?void 0:a.equipo)==null?void 0:F.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(b.Icons,{icon:"flag",size:"xs",strokeWidth:5,color:(A=p[a==null?void 0:a.prioridad])==null?void 0:A.iconColor}),e.jsx("span",{className:`text-sm text-neutral-600 font-normal ${(q=p[a==null?void 0:a.prioridad])==null?void 0:q.color}`,children:((P=p[a==null?void 0:a.prioridad])==null?void 0:P.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:(a==null?void 0:a.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:h(a==null?void 0:a.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:h(a==null?void 0:a.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:h(a==null?void 0:a.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:h(a==null?void 0:a.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:h(a==null?void 0:a.updatedAt)})]})]})})]})}),e.jsx(Ue,{items:j})]})})]})})}const Je=({id:t,task:s,endDate:n,users:a,willBePaused:r,nameProject:l,idProject:i,comments:x,priority:o,responsible:m,nameRequiredTask:c,statusRequiredTask:p,status:h})=>{const j=d.useRef(null),[g,f]=d.useState(!1),{setElementPosition:y,position:u}=V(),w=({children:N})=>{const[F,A]=d.useState();return d.useEffect(()=>{var q,P;j.current&&A(((u==null?void 0:u.x)??0)-(((P=(q=j.current)==null?void 0:q.getBoundingClientRect())==null?void 0:P.width)??0))},[j==null?void 0:j.current,u==null?void 0:u.x]),u&&W.createPortal(e.jsx("div",{className:`absolute w-fit h-fit ${F?"block":"hidden"}`,style:{top:`${u==null?void 0:u.y}px`,left:`${F}px`},children:N}),document.body)},v=()=>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:[e.jsx(de,{id:t,nameRequiredTask:c??"",statusRequiredTask:p??0,status:h}),e.jsx("p",{className:"title-text",onClick:()=>f(!0),children:s})]}),e.jsx("button",{ref:j,onClick:()=>{y(j)},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(b.Icons,{icon:"elipsis",size:"xs"})})}),e.jsx(w,{children: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:()=>{},children:[e.jsx("p",{className:"text-sm font-normal text-texts-placeholder font-regular",children:"Mover a trabajando"}),e.jsx(b.Icons,{icon:"arrow_right",size:"xs",strokeWidth:4,color:C.primary.regular})]})})]});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(v,{}),e.jsxs("div",{className:"flex flex-col gap-[4px] py-2",children:[e.jsx("p",{className:"subtitle-text",children:l}),i&&e.jsx("p",{className:"content-text",children:i})]}),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(ue,{responsible:m,users:a.filter(N=>m?N.id===m:!0).map(G),onClick:()=>{}}),r&&e.jsx(b.Tooltip,{dispatch:e.jsxs("button",{className:"text-sm font-regular text-gray-400 flex items-center gap-2",children:[e.jsx(b.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 items-center gap-2",children:[e.jsx(b.Icons,{icon:"at",size:"xs"}),e.jsx(me,{priority:o,id:t}),e.jsx(b.Icons,{icon:"calendar",size:"xs",strokeWidth:3,color:C.texts.subtext}),e.jsx("p",{className:"text-sm font-regular text-texts-subtext",children:`${n.getDate()} ${xe(n.getMonth()).slice(0,3)}`})]})]}),x>0&&e.jsx("div",{className:"border-t border-gray-200 mt-4 pt-2",children:e.jsxs("button",{className:"flex items-center gap-2",children:[e.jsx(b.Icons,{icon:"comment",size:"xs",strokeWidth:4}),e.jsx("span",{className:"text-sm font-regular text-gray-400",children:x})]})})]}),e.jsx(Xe,{taskId:t,isOpen:g,setIsOpen:f})]})},Ze=()=>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"})]})]}),K=({title:t,tasks:s,loadNextPage:n,isFetching:a,total:r})=>{const l=d.useRef(null),i=d.useRef(null),x=d.useRef(!1);d.useEffect(()=>{var c;l!=null&&l.current&&(i!=null&&i.current)&&(i.current.style.minHeight=`${((c=l==null?void 0:l.current)==null?void 0:c.clientHeight)-50}px`)},[l==null?void 0:l.current]);const o=c=>{if(x.current)return;const{scrollTop:p,clientHeight:h,scrollHeight:j}=c==null?void 0:c.target,g=p/(j-h)*100;g<=95||g>=95&&(x.current=!0,n&&n(),setTimeout(()=>{x.current=!1},200))},m={"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 ${m[t]}`,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:t})}),e.jsx("div",{className:"flex items-center gap-[8px]",children:e.jsxs("div",{className:"flex items-center gap-[4px]",children:[e.jsx(b.Icons,{icon:"group_files",size:"xs",strokeWidth:5,color:C.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(c=>e.jsx(Je,{...c},c.id)),a?e.jsx(Ze,{}):e.jsx("p",{className:"text-center text-gray-500",children:"No hay más tareas por mostrar..."})]})]})},ke=()=>{var r;const{defineFields:t}=E(),{tasksProject:s}=U();d.useEffect(()=>{(async()=>{let i=[...De];t(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 a=["Por hacer","Trabajando","Completadas"];return e.jsx("div",{className:"flex gap-4 w-full h-full min-h-[100%] relative ",children:a.map((l,i)=>{var x;return e.jsx(K,{total:((x=n==null?void 0:n[i])==null?void 0:x.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 es{static toKanbanTasks(s){var a,r,l,i,x,o,m,c,p,h,j;let n=[];return s!=null&&s.responsable&&n.push({id:s.responsable.id,name:s.responsable.nombre,image:(x=(i=(l=(r=(a=s.responsable)==null?void 0:a.userOBP)==null?void 0:r.imagen)==null?void 0:l.formats)==null?void 0:i.thumbnail)==null?void 0:x.url}),(o=s==null?void 0:s.equipo)!=null&&o.miembros&&s.equipo.miembros.forEach(g=>{var f,y,u,w;n!=null&&n.find(v=>v.id===g.idUser.id)||g.idUser&&n.push({id:g.idUser.id,name:g.idUser.nombre,image:(w=(u=(y=(f=g==null?void 0:g.userOBP)==null?void 0:f.imagen)==null?void 0:y.formats)==null?void 0:u.thumbnail)==null?void 0:w.url})}),{comments:0,nameProject:(m=s==null?void 0:s.proyecto)==null?void 0:m.nombre,idProject:(c=s==null?void 0:s.proyecto)==null?void 0:c.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:((p=s==null?void 0:s.responsable)==null?void 0:p.id)??null,statusRequiredTask:((h=s.id_t_requerida)==null?void 0:h.estatus)??null,nameRequiredTask:((j=s.id_t_requerida)==null?void 0:j.texto_corto)??null}}}const X=async({filters:t,tasks_api:s})=>{try{return(await s.get("/api/listado_tareas",{params:t})).data.tareas.map($).map(es.toKanbanTasks)}catch(n){throw console.log({error:n}),`Error al obtener las tareas: ${n}`}},J=t=>{var s;if(t!=null&&t.hasNextPage){const n=(s=t==null?void 0:t.data)==null?void 0:s.pages[t.data.pages.length-1];(n==null?void 0:n.length)===30&&(t==null||t.fetchNextPage())}},L=t=>({pagination:{page:t,pageSize:30,withCount:!0}}),ss=()=>{var m;const t=T.useQueryClient(),{tasks_api:s}=S(),{user:n}=M(),{filters:a}=E(),[r,l]=d.useState(0),[i,x]=d.useState({owner:{user:n.id,config:((m=a==null?void 0:a.owner)==null?void 0:m.config)??"yo_y_mis_equipos"},status:"por_hacer"}),o=T.useInfiniteQuery({initialPageParam:1,queryKey:["to_do_tasks",i],queryFn:({pageParam:c})=>X({filters:{...i,status:"por_hacer",...L(c)},tasks_api:s,page:c}),staleTime:1e3*60*60*24,getNextPageParam:(c,p)=>p.length+1});return d.useEffect(()=>{var c;Object.keys(a).length>0&&x({...a,owner:{user:n.id,config:((c=a==null?void 0:a.owner)==null?void 0:c.config)??"yo_y_mis_equipos"},status:"por_hacer"})},[a]),d.useEffect(()=>{t.invalidateQueries({queryKey:["to_do_tasks",i]})},[i]),d.useEffect(()=>{(async()=>{const p=await s.get("/api/listado_tareas",{params:{...i,status:"por_hacer",...L(1),tasks_api:s,justCount:!0}});l(p.data.total)})()},[i,o==null?void 0:o.data]),{toDoTasks:o,total:r}},ts=()=>{var a,r;const{toDoTasks:t,total:s}=ss(),n=[...((r=(a=t==null?void 0:t.data)==null?void 0:a.pages)==null?void 0:r.flat())??[]];return e.jsx(K,{total:s,title:"Por hacer",tasks:n,loadNextPage:()=>J(t),isFetching:t==null?void 0:t.isFetching,isLoadingData:t==null?void 0:t.isLoading})},as=()=>{var m;const t=T.useQueryClient(),{tasks_api:s}=S(),{user:n}=M(),{filters:a}=E(),[r,l]=d.useState(0),[i,x]=d.useState({owner:{user:n.id,config:((m=a==null?void 0:a.owner)==null?void 0:m.config)??"yo_y_mis_equipos"},status:"trabajando"}),o=T.useInfiniteQuery({initialPageParam:1,queryKey:["working_tasks",i],queryFn:({pageParam:c})=>X({filters:{...i,status:"trabajando",...L(c)},tasks_api:s,page:c}),staleTime:1e3*60*60*24,getNextPageParam:(c,p)=>p.length+1});return d.useEffect(()=>{var c;Object.keys(a).length>0&&x({...a,owner:{user:n.id,config:((c=a==null?void 0:a.owner)==null?void 0:c.config)??"yo_y_mis_equipos"},status:"trabajando"})},[a]),d.useEffect(()=>{t.invalidateQueries({queryKey:["working_tasks",i]})},[i]),d.useEffect(()=>{(async()=>{const p=await s.get("/api/listado_tareas",{params:{...i,status:"trabajando",...L(1),tasks_api:s,justCount:!0}});l(p.data.total)})()},[i,o==null?void 0:o.data]),{workingTasks:o,total:r}},ns=()=>{var a,r;const{workingTasks:t,total:s}=as(),n=[...((r=(a=t==null?void 0:t.data)==null?void 0:a.pages)==null?void 0:r.flat())??[]];return e.jsx(K,{total:s,title:"Trabajando",tasks:n,loadNextPage:()=>J(t),isFetching:t==null?void 0:t.isFetching})},rs=()=>{var m;const t=T.useQueryClient(),{user:s}=M(),{tasks_api:n}=S(),{filters:a}=E(),[r,l]=d.useState(0),[i,x]=d.useState({owner:{user:s.id,config:((m=a==null?void 0:a.owner)==null?void 0:m.config)??"yo_y_mis_equipos"},status:"completadas"}),o=T.useInfiniteQuery({initialPageParam:1,queryKey:["done_tasks",i],queryFn:({pageParam:c})=>X({filters:{...i,status:"completadas",...L(c)},tasks_api:n,page:c}),staleTime:1e3*60*60*24,getNextPageParam:(c,p)=>p.length+1});return d.useEffect(()=>{var c;Object.keys(a).length>0&&x({...a,owner:{user:s.id,config:((c=a==null?void 0:a.owner)==null?void 0:c.config)??"yo_y_mis_equipos"},status:"completadas"})},[a]),d.useEffect(()=>{t.invalidateQueries({queryKey:["done_tasks",i]})},[i]),d.useEffect(()=>{(async()=>{const p=await n.get("/api/listado_tareas",{params:{...i,status:"completadas",...L(1),justCount:!0,tasks_api:n}});l(p.data.total)})()},[o==null?void 0:o.data,i]),{doneTasks:o,total:r}},ls=()=>{var a,r;const{doneTasks:t,total:s}=rs(),n=[...((r=(a=t==null?void 0:t.data)==null?void 0:a.pages)==null?void 0:r.flat())??[]];return e.jsx(K,{title:"Completadas",tasks:n,loadNextPage:()=>J(t),isFetching:t==null?void 0:t.isFetching,total:s})};class R{static toSalesmanUsers(s){return{id:s.id,name:s.nombre}}}const is=()=>{const{tasks_api:t}=S(),{filters:s}=E(),{user:n}=M();return{getSalesmanAndProjects:async()=>{var o;const[i,x]=await Promise.all([t.get("/api/obtener-comerciales"),t.get("/api/listado_tareas",{params:{...s,owner:{user:n.id,config:((o=s==null?void 0:s.owner)==null?void 0:o.config)??"yo_y_mis_equipos"},justProjects:!0}})]);return{salesmanUsers:i.data.map(R.toSalesmanUsers),projects:x.data.map(R.toSalesmanUsers)}},getProjects:async()=>{var x;return(await t.get("/api/listado_tareas",{params:{...s,owner:{user:n.id,config:((x=s==null?void 0:s.owner)==null?void 0:x.config)??"yo_y_mis_equipos"},justProjects:!0}})).data.map(R.toSalesmanUsers)},getSalesmans:async()=>(await t.get("/api/obtener-comerciales")).data.map(R.toSalesmanUsers)}},os=[{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"}]}],cs=()=>{const{defineFields:t}=E(),{getSalesmanAndProjects:s}=is();return d.useEffect(()=>{(async()=>{let a=[...os],{salesmanUsers:r,projects:l}=await s();t(a.map(i=>(i.id==="project.id"&&(i.options=l),i.id==="salesman.name"&&(i.options=r),i)))})()},[]),e.jsxs("div",{className:"flex gap-4 w-full h-full min-h-[100%] relative ",children:[e.jsx(ts,{}),e.jsx(ns,{}),e.jsx(ls,{})]})},pe=d.createContext({}),ds=({children:t})=>{const[s,n]=d.useState([]);d.useEffect(()=>{console.log({selectedTasks:s})},[s]);const a=r=>{n(l=>l.includes(r)?l.filter(i=>i!==r):[...l,r])};return e.jsx(pe.Provider,{value:{selectedTasks:s,selectTask:a},children:t})},xs=()=>d.useContext(pe),us=()=>{const t=()=>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(t,{}),e.jsxs("div",{className:"pl-5 flex flex-col gap-m",children:[e.jsx(t,{}),e.jsx("div",{className:"pl-5",children:e.jsx(t,{})})]}),e.jsx(t,{}),e.jsxs("div",{className:"pl-5 flex flex-col gap-m",children:[e.jsx(t,{}),e.jsx("div",{className:"pl-5",children:e.jsx(t,{})})]})]})},he=({startDate:t,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(b.Icons,{icon:"calendar",size:"xs",strokeWidth:4,color:C.texts.subtext}),e.jsxs("p",{className:"text-sm",children:[" ",te(t)]})]}),e.jsx(b.Icons,{icon:"arrow_right",size:"xs",strokeWidth:4,color:C.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(b.Icons,{icon:"calendar",size:"xs",strokeWidth:4,color:C.texts.subtext}),e.jsxs("p",{className:"text-sm",children:[" ",te(s)]})]})]}),ms=({id:t})=>e.jsx(e.Fragment,{children:e.jsx("button",{onClick:()=>alert("pausar tarea "+t),children:e.jsx(b.Icons,{icon:"pause",size:"xs",strokeWidth:4,color:C.texts.subtext})})}),ge=({id:t,priority:s})=>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(b.Icons,{icon:"align_center",size:"xs",strokeWidth:4,color:C.texts.subtext})}),e.jsx("div",{className:"gap-s bg-success-medium border border-success-pastel rounded-md h-[30px] w-[30px] flex justify-center items-center",children:e.jsx(me,{id:t,priority:s})}),e.jsx("button",{className:"gap-s bg-danger-light border border-danger-regular rounded-md h-[30px] w-[30px] flex justify-center items-center",children:e.jsx(b.Icons,{icon:"difficulty",size:"xs",strokeWidth:4,color:C.danger.regular})})]}),ps=({id:t})=>{const{selectedTasks:s,selectTask:n}=xs();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:t.toString(),children:e.jsx("span",{className:`${s.includes(t)?"opacity-100":"opacity-0"} transition-opacity duration-500`,children:e.jsx(b.Icons,{icon:"check_outline",size:"xs",color:C.primary.regular,strokeWidth:6})})}),e.jsx("input",{className:"hidden",id:t.toString(),type:"checkbox",onChange:()=>n(t)})]})},fe=({task:t})=>e.jsx(b.Tooltip,{dispatch:e.jsx("p",{className:"text-sm text-texts-subtext max-w-[400px] truncate",children:t}),children:e.jsx("p",{className:"text-sm text-texts-subtext p-2 max-w-[400px]",children:t})}),hs=({id:t})=>{var a,r;const{tasksProject:s}=U(),n=(a=s==null?void 0:s.data)==null?void 0:a.find(l=>l.id===t);return e.jsxs("div",{className:"ml-[30px] mb-3 mt-1 flex flex-wrap items-center gap-xl",children:[!(n!=null&&n.nameRequiredTask)||(n==null?void 0:n.nameRequiredTask)!==""&&(n==null?void 0:n.statusRequiredTask)===2&&e.jsx(ps,{id:t}),e.jsx(de,{id:t,nameRequiredTask:(n==null?void 0:n.nameRequiredTask)??"",status:n==null?void 0:n.status,statusRequiredTask:(n==null?void 0:n.statusRequiredTask)??0},t),(n==null?void 0:n.willBePaused)&&e.jsx(ms,{id:t}),e.jsx(ue,{onClick:()=>{},responsible:n==null?void 0:n.responsible,users:((r=n==null?void 0:n.users)==null?void 0:r.map(G))??[]}),e.jsx(fe,{task:(n==null?void 0:n.task)??""}),e.jsx(ge,{id:t,priority:n==null?void 0:n.priority}),e.jsx(he,{startDate:n==null?void 0:n.startDate,endDate:n==null?void 0:n.endDate})]})},je=({id:t})=>{var l,i,x,o,m,c,p;const{tasksProject:s,openTasks:n,openTask:a}=U(),r=(l=s==null?void 0:s.data)==null?void 0:l.find(h=>h.id===t);return r?(console.log({task: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",children:[e.jsx("button",{className:`${n.includes(t)?"":"-rotate-90"} transition-all duration-300`,onClick:()=>a(t),children:e.jsx(b.Icons,{icon:"angle_down_outline",color:C.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:(x=r==null?void 0:r.tasks)==null?void 0:x.length})}),e.jsx(fe,{task:(r==null?void 0:r.task)??""}),e.jsx(ge,{id:t,priority:r==null?void 0:r.priority}),e.jsx(he,{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(b.Icons,{icon:"subtasks",size:"xs",strokeWidth:5,color:C.texts.subtext}),e.jsx("p",{children:((o=r==null?void 0:r.tasks)==null?void 0:o.length)===0?1:(m=r==null?void 0:r.tasks)==null?void 0:m.length})]})]}),n.includes(t)&&e.jsx("div",{className:"ml-[30px]",children:((c=r==null?void 0:r.tasks)==null?void 0:c.length)>0?(p=r==null?void 0:r.tasks)==null?void 0:p.map(h=>e.jsx(je,{id:h==null?void 0:h.id})):e.jsx(hs,{id:r==null?void 0:r.id})})]})):null},gs=()=>{var a;const{tasksProject:t,projectID:s}=U();if(t!=null&&t.isFetching||t!=null&&t.isLoading)return e.jsx(us,{});let n=[...(a=t==null?void 0:t.data)==null?void 0:a.filter(r=>r.isPrincipalTask)];return e.jsx("div",{className:"flex flex-col gap-m",children:e.jsx(ds,{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",children:e.jsx(je,{id:r.id})}))})})},fs=()=>{const[t,s]=d.useState([]),[n,a]=d.useState(0),[r,l]=d.useState(10),[i,x]=d.useState(0),[o,m]=d.useState("nombre"),{tasks_api:c}=S(),p=async(u,w)=>{try{const v=await c.get("/listado_campanias",{params:{"pagination[page]":u,"pagination[pageSize]":w,orderBy:o}}),N=$(v.data);s(N),x(v.data.meta.total)}catch(v){console.error("Error fetching data:",v)}};d.useEffect(()=>{const u=Math.floor(n/r)+1;p(u,r)},[n,r,o]);const h=u=>{a(u.first),l(u.rows)},j=[{label:"5",value:5},{label:"10",value:10},{label:"15",value:15},{label:"20",value:20}],g=u=>{u.value!==r&&(l(u.value),a(0))},f=u=>{m(w=>w===u?`${u}:desc`:u)},y=u=>o===u?"↑↓":o===`${u}:desc`?"↓↑":"↑↓";return e.jsxs("div",{className:"table-container",children:[e.jsxs("table",{className:"table",style:{borderCollapse:"collapse",width:"100%",borderSpacing:"0"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsxs("th",{onClick:()=>f("nombre"),children:[e.jsx("label",{style:{color:"#C4C4C4",fontSize:"10px"},children:y("nombre")}),"Campaña"]}),e.jsxs("th",{onClick:()=>f("inicia"),children:[e.jsx("label",{style:{color:"#C4C4C4",fontSize:"10px"},children:y("inicia")}),"Fecha Inicio"]}),e.jsxs("th",{onClick:()=>f("termina"),children:[e.jsx("label",{style:{color:"#C4C4C4",fontSize:"10px"},children:y("termina")}),"Fecha Fin"]}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Responsable"})]})}),e.jsx("tbody",{children:t==null?void 0:t.map((u,w)=>{var v,N,F,A,q,P,D,z;return e.jsxs("tr",{className:"table-row",children:[e.jsx("td",{children:(v=u==null?void 0:u.campania)==null?void 0:v.nombre}),e.jsx("td",{children:(N=u==null?void 0:u.campania)==null?void 0:N.inicia}),e.jsx("td",{children:(F=u==null?void 0:u.campania)==null?void 0:F.termina}),e.jsx("td",{style:{width:"20%"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"15px",padding:"none",fontSize:"12px",width:"auto"},children:[e.jsxs("label",{style:{width:"20px",minWidth:"50px",textAlign:"right",color:"#000"},children:[u==null?void 0:u.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:`${u.progreso}%`,backgroundColor:u.progreso===100?"#039B59":u.progreso>50?"#3658C1":u.progreso>0?"#DC8921":"#C4C4C4",borderRadius:"10px",transition:"width 0.3s ease-in-out"}})})]})}),e.jsx("td",{style:{width:"auto"},children:e.jsxs("div",{className:"avatar-container",children:[e.jsx(ye.Avatar,{className:"avatar",label:(P=(q=(A=u==null?void 0:u.campania)==null?void 0:A.responsable)==null?void 0:q.nombre)==null?void 0:P.charAt(0),shape:"circle"}),e.jsx("span",{style:{marginLeft:"8px",fontSize:"12px"},children:(z=(D=u==null?void 0:u.campania)==null?void 0:D.responsable)==null?void 0:z.nombre})]})})]},w)})})]}),e.jsxs("div",{className:"pagination",style:{background:"#FAFAFA",marginTop:"1rem",display:"flex",gap:"0.5rem"},children:[e.jsxs("span",{style:{alignItems:"center",fontSize:"10px",textAlign:"left",width:"auto",height:"auto",padding:"12px",whiteSpace:"nowrap"},children:[r," elementos de ",i]}),e.jsx(we.Paginator,{first:n,rows:r,totalRecords:i,rowsPerPageOptions:[5,10,20,50],onPageChange:h,className:"pagination",template:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",whiteSpace:"nowrap",padding:"0 1rem"},children:[e.jsx("span",{style:{fontSize:"12px"},children:"Filas por página:"}),e.jsx(Ne.Dropdown,{value:r,options:j,onChange:g,style:{minWidth:"5rem",width:"auto",height:"2rem",zIndex:"999999",transform:"translateY(-100%)"},className:"p-dropdown-sm",optionLabel:"label",optionValue:"value"})]})]})]})},js=({path:t,tab:s})=>{const n={"kanban-general":{kanban:e.jsx(cs,{})},"lista-campanias":{lista:e.jsx(fs,{}),gantt:e.jsx("div",{children:"gantt-campanias"})},"kanban-campania":{kanban:e.jsx(ke,{}),lista:e.jsx(gs,{}),gantt:e.jsx("div",{children:"kanban-campania-gantt"})}};return t==="kanban-campania"?e.jsx(Ee,{project:1839,children:n[t][s]}):n[t][s]},bs=({path:t})=>{const s=()=>{const[n,a]=d.useState("kanban"),[r,l]=d.useState(""),i=d.useRef(null);d.useEffect(()=>{a("kanban")},[t]);const x=c=>({"kanban-general":"Kanban General","lista-campanias":"Campanias","kanban-campania":"Kanban de Campania"})[c],o=["lista-campanias","kanban-campania"],m={"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:x(t)}),o.includes(t)&&e.jsx(Ce,{tabs:m[t],renderItem:c=>{a(c)}})]}),e.jsxs("div",{className:"flex items-center gap-s",children:[e.jsx("input",{onChange:le(c=>{var p;return l((p=c==null?void 0:c.target)==null?void 0:p.value)},1e3),type:"text",placeholder:"Buscar",className:"w-[200px] h-[30px] border-none bg-bg-card shadow-input border border-gray-200 rounded-lg px-l "}),e.jsx(_e,{filterChildren:i,children:e.jsx("div",{ref:i,className:"w-max max-w-[400px] h-fit bg-bg-card shadow-lg rounded-lg p-l",children:e.jsx(Te,{})})})]})]}),e.jsx("div",{className:"overflow-auto scrollbar-none",children:e.jsx(js,{path:t,tab:n})})]})};return e.jsx(Fe,{children:e.jsx(s,{})})},ys=()=>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"})]})})}),ws=()=>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"})]})})}),Ns=({path:t,user:s,url:n})=>{const a=new T.QueryClient;if(!s)return e.jsx(ys,{});if(!s.accessToken)return e.jsx(ws,{});let r={user:s,url:n};return e.jsx(Pe,{...r,children:e.jsx(qe,{...r,children:e.jsx("div",{className:"w-full h-full min-h-[100%] relative",children:e.jsx(T.QueryClientProvider,{client:a,children:e.jsx(bs,{path:t})})})})})};exports.AppTasks=Ns;
|
|
2
|
+
w-max`,children:[e.jsx(o,{priority:0,text:"Baja"}),e.jsx(o,{priority:1,text:"Normal"}),e.jsx(o,{priority:2,text:"Media"}),e.jsx(o,{priority:3,text:"Alta"})]}),document.body)};return e.jsxs("div",{className:"relative h-[22px]",children:[e.jsx("label",{onBlur:()=>{l(null)},htmlFor:a,className:"flex items-center gap-2 cursor-pointer active:opacity-50",children:e.jsx(b.Icons,{icon:"flag",size:"xs",strokeWidth:3,color:i(t)})}),e.jsx("button",{id:a,onClick:o=>{l(r?null:{x:o.clientX,y:o.clientY})},className:"hidden"}),e.jsx(x,{})]})};function Ue({items:t}){var a;const[s,n]=d.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:t.map((r,l)=>e.jsx("div",{className:`border-r border-neutral-100 pr-3 py-1 ${l!==0?"px-3":""}`,children:e.jsx(_.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:(a=t.find(r=>r.id===s))==null?void 0:a.component})]})}const Ke="https://devobp.imjmedia.com.mx";function Y(t){return t?t.split(" ").map(a=>{var r;return(r=a[0])==null?void 0:r.toUpperCase()}).slice(0,2).join(""):""}const Qe="https://devobp.imjmedia.com.mx";function He({comment:t}){var n,a,r,l,i,x;function s(o){const m=O.parseISO(o);return O.formatDistanceToNow(m,{locale:H.es,addSuffix:!0})}return e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-row gap-2 items-start",children:[e.jsxs(_.Avatar,{className:"w-[2rem] h-[2rem]",children:[e.jsx(_.AvatarImage,{src:`${Qe}${(l=(r=(a=(n=t==null?void 0:t.autor)==null?void 0:n.imagen)==null?void 0:a.formats)==null?void 0:r.thumbnail)==null?void 0:l.url}`,alt:"@shadcn"}),e.jsx(_.AvatarFallback,{children:Y((i=t==null?void 0:t.autor)==null?void 0:i.nombre)})]}),e.jsx("p",{className:"text-sm text-neutral-900 font-medium",children:(x=t==null?void 0:t.autor)==null?void 0:x.nombre}),e.jsx("span",{className:"text-xs text-neutral-600 font-normal mt-[2px]",children:s(t==null?void 0:t.createdAt)})]}),e.jsx("p",{className:"text-sm text-neutral-600 font-normal pl-10",children:t==null?void 0:t.comentario})]})}function Ve({currentUser:t,data:s,taskId:n,onNewComment:a}){var p,h,j;const{tasks_api:r}=S(),{register:l,handleSubmit:i,reset:x}=be.useForm(),[o,m]=d.useState([]);d.useEffect(()=>{if(s!=null&&s.comentarios){const g=[...s.comentarios].sort((f,y)=>new Date(y.createdAt).getTime()-new Date(f.createdAt).getTime());m(g)}},[s]);const c=async g=>{try{const f={autor:{id:t==null?void 0:t.id,email:t==null?void 0:t.email,nombre:t==null?void 0:t.nombre,imagen:t==null?void 0:t.imagen},comentario:g==null?void 0:g.comment,createdAt:new Date().toISOString()};await r.post("/api/comentarios",{data:{autor:t==null?void 0:t.id,comentario:g.comment,tarea:n}}),a(!0),m(y=>[f,...y]),x()}catch(f){console.error("Error al agregar comentario:",f)}};return e.jsxs("div",{className:"flex flex-col h-full gap-4",children:[e.jsxs("form",{onSubmit:i(c),className:"flex flex-row items-center gap-3",children:[e.jsxs(_.Avatar,{className:"w-8 h-8 max-w-8 max-h-8 min-w-8 min-h-8",children:[e.jsx(_.AvatarImage,{className:"w-[2rem] h-[2rem]",src:`${Ke}${(j=(h=(p=t==null?void 0:t.imagen)==null?void 0:p.formats)==null?void 0:h.thumbnail)==null?void 0:j.url}`,alt:"@shadcn"}),e.jsx(_.AvatarFallback,{className:"border border-x-primary-pastel",children:Y(t==null?void 0:t.nombre)})]}),e.jsx(_.Input,{...l("comment",{required:!0}),autoComplete:"off",placeholder:"Escribe un comentario",className:"w-full bg-white border border-neutral-200"})]}),o.map((g,f)=>e.jsx(He,{comment:g},f))]})}function Ge({data:t}){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=a=>a?O.format(new Date(a),"d MMM",{locale:H.es}):"";return e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-row items-center gap-4",children:[e.jsx(_.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:t==null?void 0:t.length})]}),e.jsx("div",{className:"flex flex-col gap-2 border border-neutral-200 rounded-lg mt-3",children:t==null?void 0:t.map(a=>{var r,l,i,x,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(B,{imageUrl:(x=(i=(l=(r=a.responsable)==null?void 0:r.image)==null?void 0:l.formats)==null?void 0:i.thumbnail)==null?void 0:x.url}),e.jsx("p",{className:"text-sm font-normal w-[400px] text-nowrap text-ellipsis overflow-hidden",children:a==null?void 0:a.texto_corto})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("p",{className:"text-sm font-normal",children:n(a==null?void 0:a.createdAt)}),e.jsx("div",{className:`w-4 h-4 bg-gray-400 block rounded-full ${((o=s[a==null?void 0:a.estatus])==null?void 0:o.color)??"bg-gray-400"}`})]})]},a.id)})})]})}const Ye="https://devobp.imjmedia.com.mx";function Xe({isOpen:t,setIsOpen:s,taskId:n}){var g,f,y,u,w,v,N,F,A,q,P;const[a,r]=d.useState(null),[l,i]=d.useState(!1),[x,o]=d.useState(null),{tasks_api:m}=S(),{user:c}=M();d.useEffect(()=>{if(t&&n||l){const D=async()=>{const I=await m.get(`/api/detalleTarea/${n}`);r(I==null?void 0:I.data)},z=async()=>{var Z,k;const I=await m.get(`/api/users/${c.id}`),Q=await m.post("/api/obtenerUsuarioOBP/",{emailList:[(Z=I==null?void 0:I.data)==null?void 0:Z.email]});o((k=Q==null?void 0:Q.data)==null?void 0:k.data[0])};D(),z()}},[t,n,l]);const p={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"}},h=D=>D?O.format(D,"d MMM yyyy, h:mmaaa",{locale:H.es}):"Fecha no disponible",j=[{id:1,label:"Todo",component:e.jsx(Ve,{taskId:n,currentUser:x,data:a,onNewComment:i})},{id:2,label:"Dependencias",component:e.jsx(Ge,{data:a==null?void 0:a.ids_t_dependientes})}];return e.jsx(e.Fragment,{children:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`fixed inset-0 bg-transparent bg-opacity-50 flex justify-center items-center z-20 ${t?"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-50 overflow-hidden transition-all ease-in-out duration-500 shadow-2xl ${t?"right-0 pointer-events-auto block":"right-[-100%] pointer-events-none hidden"}`,children:e.jsxs("div",{className:"flex w-[100%] h-[100%] flex-col overflow-y-scroll bg-white border-none shadow-xl px-4 py-6",children:[e.jsxs("div",{className:"w-[100%] flex flex-row justify-between pb-4 gap-10 border-none",children:[e.jsx("h3",{className:"text-lg font-semibold text-neutral-900",children:a==null?void 0:a.texto_corto}),e.jsx(_.Button,{variant:"shadow",size:"sm",onClick:()=>s(!1),className:"bg-neutral-100 w-10 h-10",children:e.jsx(b.Icons,{icon:"x_outline"})})]}),e.jsx("div",{className:"w-[100%] flex flex-row justify-between",children:e.jsxs("span",{className:"text-neutral-600 text-sm",children:[a==null?void 0:a.campania," / ",a==null?void 0:a.nombre_medio]})}),e.jsxs("div",{className:"w-[100%] 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:(a==null?void 0:a.texto_largo)??"Sin descripción"})]}),e.jsx(_.Accordion,{type:"single",collapsible:!0,defaultValue:"item-1",className:"w-[100%] flex flex-col border border-neutral-200 rounded-xl mt-4",children:e.jsxs(_.AccordionItem,{value:"item-1",className:"border-none",children:[e.jsx(_.AccordionTrigger,{className:"text-neutral-900 font-medium text-sm w-[100%] flex flex-row border-b border-neutral-200 p-4 ",children:"Detalles"}),e.jsx(_.AccordionContent,{className:"border-none",children:e.jsxs("div",{className:"w-[100%] 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"}),(g=a==null?void 0:a.responsable)!=null&&g.nombre?e.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[e.jsxs(_.Avatar,{className:"w-8 h-8",children:[e.jsx(_.AvatarImage,{src:`${Ye}${(w=(u=(y=(f=a==null?void 0:a.responsable)==null?void 0:f.imagen)==null?void 0:y.formats)==null?void 0:u.thumbnail)==null?void 0:w.url}`,alt:"@shadcn"}),e.jsx(_.AvatarFallback,{children:Y((v=a==null?void 0:a.responsable)==null?void 0:v.nombre)})]}),e.jsx("span",{className:"text-xs text-neutral-600 font-normal",children:(N=a==null?void 0:a.responsable)==null?void 0:N.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:((F=a==null?void 0:a.equipo)==null?void 0:F.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(b.Icons,{icon:"flag",size:"xs",strokeWidth:5,color:(A=p[a==null?void 0:a.prioridad])==null?void 0:A.iconColor}),e.jsx("span",{className:`text-sm text-neutral-600 font-normal ${(q=p[a==null?void 0:a.prioridad])==null?void 0:q.color}`,children:((P=p[a==null?void 0:a.prioridad])==null?void 0:P.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:(a==null?void 0:a.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:h(a==null?void 0:a.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:h(a==null?void 0:a.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:h(a==null?void 0:a.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:h(a==null?void 0:a.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:h(a==null?void 0:a.updatedAt)})]})]})})]})}),e.jsx(Ue,{items:j})]})})]})})}const Je=({id:t,task:s,endDate:n,users:a,willBePaused:r,nameProject:l,idProject:i,comments:x,priority:o,responsible:m,nameRequiredTask:c,statusRequiredTask:p,status:h})=>{const j=d.useRef(null),[g,f]=d.useState(!1),{setElementPosition:y,position:u}=V(),w=({children:N})=>{const[F,A]=d.useState();return d.useEffect(()=>{var q,P;j.current&&A(((u==null?void 0:u.x)??0)-(((P=(q=j.current)==null?void 0:q.getBoundingClientRect())==null?void 0:P.width)??0))},[j==null?void 0:j.current,u==null?void 0:u.x]),u&&W.createPortal(e.jsx("div",{className:`absolute w-fit h-fit ${F?"block":"hidden"}`,style:{top:`${u==null?void 0:u.y}px`,left:`${F}px`},children:N}),document.body)},v=()=>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:[e.jsx(de,{id:t,nameRequiredTask:c??"",statusRequiredTask:p??0,status:h}),e.jsx("p",{className:"title-text",onClick:()=>f(!0),children:s})]}),e.jsx("button",{ref:j,onClick:()=>{y(j)},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(b.Icons,{icon:"elipsis",size:"xs"})})}),e.jsx(w,{children: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:()=>{},children:[e.jsx("p",{className:"text-sm font-normal text-texts-placeholder font-regular",children:"Mover a trabajando"}),e.jsx(b.Icons,{icon:"arrow_right",size:"xs",strokeWidth:4,color:C.primary.regular})]})})]});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(v,{}),e.jsxs("div",{className:"flex flex-col gap-[4px] py-2",children:[e.jsx("p",{className:"subtitle-text",children:l}),i&&e.jsx("p",{className:"content-text",children:i})]}),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(ue,{responsible:m,users:a.filter(N=>m?N.id===m:!0).map(G),onClick:()=>{}}),r&&e.jsx(b.Tooltip,{dispatch:e.jsxs("button",{className:"text-sm font-regular text-gray-400 flex items-center gap-2",children:[e.jsx(b.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 items-center gap-2",children:[e.jsx(b.Icons,{icon:"at",size:"xs"}),e.jsx(me,{priority:o,id:t}),e.jsx(b.Icons,{icon:"calendar",size:"xs",strokeWidth:3,color:C.texts.subtext}),e.jsx("p",{className:"text-sm font-regular text-texts-subtext",children:`${n.getDate()} ${xe(n.getMonth()).slice(0,3)}`})]})]}),x>0&&e.jsx("div",{className:"border-t border-gray-200 mt-4 pt-2",children:e.jsxs("button",{className:"flex items-center gap-2",children:[e.jsx(b.Icons,{icon:"comment",size:"xs",strokeWidth:4}),e.jsx("span",{className:"text-sm font-regular text-gray-400",children:x})]})})]}),e.jsx(Xe,{taskId:t,isOpen:g,setIsOpen:f})]})},Ze=()=>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"})]})]}),K=({title:t,tasks:s,loadNextPage:n,isFetching:a,total:r})=>{const l=d.useRef(null),i=d.useRef(null),x=d.useRef(!1);d.useEffect(()=>{var c;l!=null&&l.current&&(i!=null&&i.current)&&(i.current.style.minHeight=`${((c=l==null?void 0:l.current)==null?void 0:c.clientHeight)-50}px`)},[l==null?void 0:l.current]);const o=c=>{if(x.current)return;const{scrollTop:p,clientHeight:h,scrollHeight:j}=c==null?void 0:c.target,g=p/(j-h)*100;g<=95||g>=95&&(x.current=!0,n&&n(),setTimeout(()=>{x.current=!1},200))},m={"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 ${m[t]}`,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:t})}),e.jsx("div",{className:"flex items-center gap-[8px]",children:e.jsxs("div",{className:"flex items-center gap-[4px]",children:[e.jsx(b.Icons,{icon:"group_files",size:"xs",strokeWidth:5,color:C.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(c=>e.jsx(Je,{...c},c.id)),a?e.jsx(Ze,{}):e.jsx("p",{className:"text-center text-gray-500",children:"No hay más tareas por mostrar..."})]})]})},ke=()=>{var r;const{defineFields:t}=E(),{tasksProject:s}=U();d.useEffect(()=>{(async()=>{let i=[...De];t(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 a=["Por hacer","Trabajando","Completadas"];return e.jsx("div",{className:"flex gap-4 w-full h-full min-h-[100%] relative ",children:a.map((l,i)=>{var x;return e.jsx(K,{total:((x=n==null?void 0:n[i])==null?void 0:x.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 es{static toKanbanTasks(s){var a,r,l,i,x,o,m,c,p,h,j;let n=[];return s!=null&&s.responsable&&n.push({id:s.responsable.id,name:s.responsable.nombre,image:(x=(i=(l=(r=(a=s.responsable)==null?void 0:a.userOBP)==null?void 0:r.imagen)==null?void 0:l.formats)==null?void 0:i.thumbnail)==null?void 0:x.url}),(o=s==null?void 0:s.equipo)!=null&&o.miembros&&s.equipo.miembros.forEach(g=>{var f,y,u,w;n!=null&&n.find(v=>v.id===g.idUser.id)||g.idUser&&n.push({id:g.idUser.id,name:g.idUser.nombre,image:(w=(u=(y=(f=g==null?void 0:g.userOBP)==null?void 0:f.imagen)==null?void 0:y.formats)==null?void 0:u.thumbnail)==null?void 0:w.url})}),{comments:0,nameProject:(m=s==null?void 0:s.proyecto)==null?void 0:m.nombre,idProject:(c=s==null?void 0:s.proyecto)==null?void 0:c.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:((p=s==null?void 0:s.responsable)==null?void 0:p.id)??null,statusRequiredTask:((h=s.id_t_requerida)==null?void 0:h.estatus)??null,nameRequiredTask:((j=s.id_t_requerida)==null?void 0:j.texto_corto)??null}}}const X=async({filters:t,tasks_api:s})=>{try{return(await s.get("/api/listado_tareas",{params:t})).data.tareas.map($).map(es.toKanbanTasks)}catch(n){throw console.log({error:n}),`Error al obtener las tareas: ${n}`}},J=t=>{var s;if(t!=null&&t.hasNextPage){const n=(s=t==null?void 0:t.data)==null?void 0:s.pages[t.data.pages.length-1];(n==null?void 0:n.length)===30&&(t==null||t.fetchNextPage())}},L=t=>({pagination:{page:t,pageSize:30,withCount:!0}}),ss=()=>{var m;const t=T.useQueryClient(),{tasks_api:s}=S(),{user:n}=M(),{filters:a}=E(),[r,l]=d.useState(0),[i,x]=d.useState({owner:{user:n.id,config:((m=a==null?void 0:a.owner)==null?void 0:m.config)??"yo_y_mis_equipos"},status:"por_hacer"}),o=T.useInfiniteQuery({initialPageParam:1,queryKey:["to_do_tasks",i],queryFn:({pageParam:c})=>X({filters:{...i,status:"por_hacer",...L(c)},tasks_api:s,page:c}),staleTime:1e3*60*60*24,getNextPageParam:(c,p)=>p.length+1});return d.useEffect(()=>{var c;Object.keys(a).length>0&&x({...a,owner:{user:n.id,config:((c=a==null?void 0:a.owner)==null?void 0:c.config)??"yo_y_mis_equipos"},status:"por_hacer"})},[a]),d.useEffect(()=>{t.invalidateQueries({queryKey:["to_do_tasks",i]})},[i]),d.useEffect(()=>{(async()=>{const p=await s.get("/api/listado_tareas",{params:{...i,status:"por_hacer",...L(1),tasks_api:s,justCount:!0}});l(p.data.total)})()},[i,o==null?void 0:o.data]),{toDoTasks:o,total:r}},ts=()=>{var a,r;const{toDoTasks:t,total:s}=ss(),n=[...((r=(a=t==null?void 0:t.data)==null?void 0:a.pages)==null?void 0:r.flat())??[]];return e.jsx(K,{total:s,title:"Por hacer",tasks:n,loadNextPage:()=>J(t),isFetching:t==null?void 0:t.isFetching,isLoadingData:t==null?void 0:t.isLoading})},as=()=>{var m;const t=T.useQueryClient(),{tasks_api:s}=S(),{user:n}=M(),{filters:a}=E(),[r,l]=d.useState(0),[i,x]=d.useState({owner:{user:n.id,config:((m=a==null?void 0:a.owner)==null?void 0:m.config)??"yo_y_mis_equipos"},status:"trabajando"}),o=T.useInfiniteQuery({initialPageParam:1,queryKey:["working_tasks",i],queryFn:({pageParam:c})=>X({filters:{...i,status:"trabajando",...L(c)},tasks_api:s,page:c}),staleTime:1e3*60*60*24,getNextPageParam:(c,p)=>p.length+1});return d.useEffect(()=>{var c;Object.keys(a).length>0&&x({...a,owner:{user:n.id,config:((c=a==null?void 0:a.owner)==null?void 0:c.config)??"yo_y_mis_equipos"},status:"trabajando"})},[a]),d.useEffect(()=>{t.invalidateQueries({queryKey:["working_tasks",i]})},[i]),d.useEffect(()=>{(async()=>{const p=await s.get("/api/listado_tareas",{params:{...i,status:"trabajando",...L(1),tasks_api:s,justCount:!0}});l(p.data.total)})()},[i,o==null?void 0:o.data]),{workingTasks:o,total:r}},ns=()=>{var a,r;const{workingTasks:t,total:s}=as(),n=[...((r=(a=t==null?void 0:t.data)==null?void 0:a.pages)==null?void 0:r.flat())??[]];return e.jsx(K,{total:s,title:"Trabajando",tasks:n,loadNextPage:()=>J(t),isFetching:t==null?void 0:t.isFetching})},rs=()=>{var m;const t=T.useQueryClient(),{user:s}=M(),{tasks_api:n}=S(),{filters:a}=E(),[r,l]=d.useState(0),[i,x]=d.useState({owner:{user:s.id,config:((m=a==null?void 0:a.owner)==null?void 0:m.config)??"yo_y_mis_equipos"},status:"completadas"}),o=T.useInfiniteQuery({initialPageParam:1,queryKey:["done_tasks",i],queryFn:({pageParam:c})=>X({filters:{...i,status:"completadas",...L(c)},tasks_api:n,page:c}),staleTime:1e3*60*60*24,getNextPageParam:(c,p)=>p.length+1});return d.useEffect(()=>{var c;Object.keys(a).length>0&&x({...a,owner:{user:s.id,config:((c=a==null?void 0:a.owner)==null?void 0:c.config)??"yo_y_mis_equipos"},status:"completadas"})},[a]),d.useEffect(()=>{t.invalidateQueries({queryKey:["done_tasks",i]})},[i]),d.useEffect(()=>{(async()=>{const p=await n.get("/api/listado_tareas",{params:{...i,status:"completadas",...L(1),justCount:!0,tasks_api:n}});l(p.data.total)})()},[o==null?void 0:o.data,i]),{doneTasks:o,total:r}},ls=()=>{var a,r;const{doneTasks:t,total:s}=rs(),n=[...((r=(a=t==null?void 0:t.data)==null?void 0:a.pages)==null?void 0:r.flat())??[]];return e.jsx(K,{title:"Completadas",tasks:n,loadNextPage:()=>J(t),isFetching:t==null?void 0:t.isFetching,total:s})};class R{static toSalesmanUsers(s){return{id:s.id,name:s.nombre}}}const is=()=>{const{tasks_api:t}=S(),{filters:s}=E(),{user:n}=M();return{getSalesmanAndProjects:async()=>{var o;const[i,x]=await Promise.all([t.get("/api/obtener-comerciales"),t.get("/api/listado_tareas",{params:{...s,owner:{user:n.id,config:((o=s==null?void 0:s.owner)==null?void 0:o.config)??"yo_y_mis_equipos"},justProjects:!0}})]);return{salesmanUsers:i.data.map(R.toSalesmanUsers),projects:x.data.map(R.toSalesmanUsers)}},getProjects:async()=>{var x;return(await t.get("/api/listado_tareas",{params:{...s,owner:{user:n.id,config:((x=s==null?void 0:s.owner)==null?void 0:x.config)??"yo_y_mis_equipos"},justProjects:!0}})).data.map(R.toSalesmanUsers)},getSalesmans:async()=>(await t.get("/api/obtener-comerciales")).data.map(R.toSalesmanUsers)}},os=[{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"}]}],cs=()=>{const{defineFields:t}=E(),{getSalesmanAndProjects:s}=is();return d.useEffect(()=>{(async()=>{let a=[...os],{salesmanUsers:r,projects:l}=await s();t(a.map(i=>(i.id==="project.id"&&(i.options=l),i.id==="salesman.name"&&(i.options=r),i)))})()},[]),e.jsxs("div",{className:"flex gap-4 w-full h-full min-h-[100%] relative ",children:[e.jsx(ts,{}),e.jsx(ns,{}),e.jsx(ls,{})]})},pe=d.createContext({}),ds=({children:t})=>{const[s,n]=d.useState([]);d.useEffect(()=>{console.log({selectedTasks:s})},[s]);const a=r=>{n(l=>l.includes(r)?l.filter(i=>i!==r):[...l,r])};return e.jsx(pe.Provider,{value:{selectedTasks:s,selectTask:a},children:t})},xs=()=>d.useContext(pe),us=()=>{const t=()=>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(t,{}),e.jsxs("div",{className:"pl-5 flex flex-col gap-m",children:[e.jsx(t,{}),e.jsx("div",{className:"pl-5",children:e.jsx(t,{})})]}),e.jsx(t,{}),e.jsxs("div",{className:"pl-5 flex flex-col gap-m",children:[e.jsx(t,{}),e.jsx("div",{className:"pl-5",children:e.jsx(t,{})})]})]})},he=({startDate:t,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(b.Icons,{icon:"calendar",size:"xs",strokeWidth:4,color:C.texts.subtext}),e.jsxs("p",{className:"text-sm",children:[" ",te(t)]})]}),e.jsx(b.Icons,{icon:"arrow_right",size:"xs",strokeWidth:4,color:C.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(b.Icons,{icon:"calendar",size:"xs",strokeWidth:4,color:C.texts.subtext}),e.jsxs("p",{className:"text-sm",children:[" ",te(s)]})]})]}),ms=({id:t})=>e.jsx(e.Fragment,{children:e.jsx("button",{onClick:()=>alert("pausar tarea "+t),children:e.jsx(b.Icons,{icon:"pause",size:"xs",strokeWidth:4,color:C.texts.subtext})})}),ge=({id:t,priority:s})=>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(b.Icons,{icon:"align_center",size:"xs",strokeWidth:4,color:C.texts.subtext})}),e.jsx("div",{className:"gap-s bg-success-medium border border-success-pastel rounded-md h-[30px] w-[30px] flex justify-center items-center",children:e.jsx(me,{id:t,priority:s})}),e.jsx("button",{className:"gap-s bg-danger-light border border-danger-regular rounded-md h-[30px] w-[30px] flex justify-center items-center",children:e.jsx(b.Icons,{icon:"difficulty",size:"xs",strokeWidth:4,color:C.danger.regular})})]}),ps=({id:t})=>{const{selectedTasks:s,selectTask:n}=xs();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:t.toString(),children:e.jsx("span",{className:`${s.includes(t)?"opacity-100":"opacity-0"} transition-opacity duration-500`,children:e.jsx(b.Icons,{icon:"check_outline",size:"xs",color:C.primary.regular,strokeWidth:6})})}),e.jsx("input",{className:"hidden",id:t.toString(),type:"checkbox",onChange:()=>n(t)})]})},fe=({task:t})=>e.jsx(b.Tooltip,{dispatch:e.jsx("p",{className:"text-sm text-texts-subtext max-w-[400px] truncate",children:t}),children:e.jsx("p",{className:"text-sm text-texts-subtext p-2 max-w-[400px]",children:t})}),hs=({id:t})=>{var a,r;const{tasksProject:s}=U(),n=(a=s==null?void 0:s.data)==null?void 0:a.find(l=>l.id===t);return e.jsxs("div",{className:"ml-[30px] mb-3 mt-1 flex flex-wrap items-center gap-xl",children:[!(n!=null&&n.nameRequiredTask)||(n==null?void 0:n.nameRequiredTask)!==""&&(n==null?void 0:n.statusRequiredTask)===2&&e.jsx(ps,{id:t}),e.jsx(de,{id:t,nameRequiredTask:(n==null?void 0:n.nameRequiredTask)??"",status:n==null?void 0:n.status,statusRequiredTask:(n==null?void 0:n.statusRequiredTask)??0},t),(n==null?void 0:n.willBePaused)&&e.jsx(ms,{id:t}),e.jsx(ue,{onClick:()=>{},responsible:n==null?void 0:n.responsible,users:((r=n==null?void 0:n.users)==null?void 0:r.map(G))??[]}),e.jsx(fe,{task:(n==null?void 0:n.task)??""}),e.jsx(ge,{id:t,priority:n==null?void 0:n.priority}),e.jsx(he,{startDate:n==null?void 0:n.startDate,endDate:n==null?void 0:n.endDate})]})},je=({id:t})=>{var l,i,x,o,m,c,p;const{tasksProject:s,openTasks:n,openTask:a}=U(),r=(l=s==null?void 0:s.data)==null?void 0:l.find(h=>h.id===t);return r?(console.log({task: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",children:[e.jsx("button",{className:`${n.includes(t)?"":"-rotate-90"} transition-all duration-300`,onClick:()=>a(t),children:e.jsx(b.Icons,{icon:"angle_down_outline",color:C.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:(x=r==null?void 0:r.tasks)==null?void 0:x.length})}),e.jsx(fe,{task:(r==null?void 0:r.task)??""}),e.jsx(ge,{id:t,priority:r==null?void 0:r.priority}),e.jsx(he,{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(b.Icons,{icon:"subtasks",size:"xs",strokeWidth:5,color:C.texts.subtext}),e.jsx("p",{children:((o=r==null?void 0:r.tasks)==null?void 0:o.length)===0?1:(m=r==null?void 0:r.tasks)==null?void 0:m.length})]})]}),n.includes(t)&&e.jsx("div",{className:"ml-[30px]",children:((c=r==null?void 0:r.tasks)==null?void 0:c.length)>0?(p=r==null?void 0:r.tasks)==null?void 0:p.map(h=>e.jsx(je,{id:h==null?void 0:h.id})):e.jsx(hs,{id:r==null?void 0:r.id})})]})):null},gs=()=>{var a;const{tasksProject:t,projectID:s}=U();if(t!=null&&t.isFetching||t!=null&&t.isLoading)return e.jsx(us,{});let n=[...(a=t==null?void 0:t.data)==null?void 0:a.filter(r=>r.isPrincipalTask)];return e.jsx("div",{className:"flex flex-col gap-m",children:e.jsx(ds,{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",children:e.jsx(je,{id:r.id})}))})})},fs=()=>{const[t,s]=d.useState([]),[n,a]=d.useState(0),[r,l]=d.useState(10),[i,x]=d.useState(0),[o,m]=d.useState("nombre"),{tasks_api:c}=S(),p=async(u,w)=>{try{const v=await c.get("/listado_campanias",{params:{"pagination[page]":u,"pagination[pageSize]":w,orderBy:o}}),N=$(v.data);s(N),x(v.data.meta.total)}catch(v){console.error("Error fetching data:",v)}};d.useEffect(()=>{const u=Math.floor(n/r)+1;p(u,r)},[n,r,o]);const h=u=>{a(u.first),l(u.rows)},j=[{label:"5",value:5},{label:"10",value:10},{label:"15",value:15},{label:"20",value:20}],g=u=>{u.value!==r&&(l(u.value),a(0))},f=u=>{m(w=>w===u?`${u}:desc`:u)},y=u=>o===u?"↑↓":o===`${u}:desc`?"↓↑":"↑↓";return e.jsxs("div",{className:"table-container",children:[e.jsxs("table",{className:"table",style:{borderCollapse:"collapse",width:"100%",borderSpacing:"0"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsxs("th",{onClick:()=>f("nombre"),children:[e.jsx("label",{style:{color:"#C4C4C4",fontSize:"10px"},children:y("nombre")}),"Campaña"]}),e.jsxs("th",{onClick:()=>f("inicia"),children:[e.jsx("label",{style:{color:"#C4C4C4",fontSize:"10px"},children:y("inicia")}),"Fecha Inicio"]}),e.jsxs("th",{onClick:()=>f("termina"),children:[e.jsx("label",{style:{color:"#C4C4C4",fontSize:"10px"},children:y("termina")}),"Fecha Fin"]}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Responsable"})]})}),e.jsx("tbody",{children:t==null?void 0:t.map((u,w)=>{var v,N,F,A,q,P,D,z;return e.jsxs("tr",{className:"table-row",children:[e.jsx("td",{children:(v=u==null?void 0:u.campania)==null?void 0:v.nombre}),e.jsx("td",{children:(N=u==null?void 0:u.campania)==null?void 0:N.inicia}),e.jsx("td",{children:(F=u==null?void 0:u.campania)==null?void 0:F.termina}),e.jsx("td",{style:{width:"20%"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"15px",padding:"none",fontSize:"12px",width:"auto"},children:[e.jsxs("label",{style:{width:"20px",minWidth:"50px",textAlign:"right",color:"#000"},children:[u==null?void 0:u.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:`${u.progreso}%`,backgroundColor:u.progreso===100?"#039B59":u.progreso>50?"#3658C1":u.progreso>0?"#DC8921":"#C4C4C4",borderRadius:"10px",transition:"width 0.3s ease-in-out"}})})]})}),e.jsx("td",{style:{width:"auto"},children:e.jsxs("div",{className:"avatar-container",children:[e.jsx(ye.Avatar,{className:"avatar",label:(P=(q=(A=u==null?void 0:u.campania)==null?void 0:A.responsable)==null?void 0:q.nombre)==null?void 0:P.charAt(0),shape:"circle"}),e.jsx("span",{style:{marginLeft:"8px",fontSize:"12px"},children:(z=(D=u==null?void 0:u.campania)==null?void 0:D.responsable)==null?void 0:z.nombre})]})})]},w)})})]}),e.jsxs("div",{className:"pagination",style:{background:"#FAFAFA",marginTop:"1rem",display:"flex",gap:"0.5rem"},children:[e.jsxs("span",{style:{alignItems:"center",fontSize:"10px",textAlign:"left",width:"auto",height:"auto",padding:"12px",whiteSpace:"nowrap"},children:[r," elementos de ",i]}),e.jsx(we.Paginator,{first:n,rows:r,totalRecords:i,rowsPerPageOptions:[5,10,20,50],onPageChange:h,className:"pagination",template:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",whiteSpace:"nowrap",padding:"0 1rem"},children:[e.jsx("span",{style:{fontSize:"12px"},children:"Filas por página:"}),e.jsx(Ne.Dropdown,{value:r,options:j,onChange:g,style:{minWidth:"5rem",width:"auto",height:"2rem",zIndex:"999999",transform:"translateY(-100%)"},className:"p-dropdown-sm",optionLabel:"label",optionValue:"value"})]})]})]})},js=({path:t,tab:s})=>{const n={"kanban-general":{kanban:e.jsx(cs,{})},"lista-campanias":{lista:e.jsx(fs,{}),gantt:e.jsx("div",{children:"gantt-campanias"})},"kanban-campania":{kanban:e.jsx(ke,{}),lista:e.jsx(gs,{}),gantt:e.jsx("div",{children:"kanban-campania-gantt"})}};return t==="kanban-campania"?e.jsx(Ee,{project:1839,children:n[t][s]}):n[t][s]},bs=({path:t})=>{const s=()=>{const[n,a]=d.useState("kanban"),[r,l]=d.useState(""),i=d.useRef(null);d.useEffect(()=>{a("kanban")},[t]);const x=c=>({"kanban-general":"Kanban General","lista-campanias":"Campanias","kanban-campania":"Kanban de Campania"})[c],o=["lista-campanias","kanban-campania"],m={"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:x(t)}),o.includes(t)&&e.jsx(Ce,{tabs:m[t],renderItem:c=>{a(c)}})]}),e.jsxs("div",{className:"flex items-center gap-s",children:[e.jsx("input",{onChange:le(c=>{var p;return l((p=c==null?void 0:c.target)==null?void 0:p.value)},1e3),type:"text",placeholder:"Buscar",className:"w-[200px] h-[30px] border-none bg-bg-card shadow-input border border-gray-200 rounded-lg px-l "}),e.jsx(_e,{filterChildren:i,children:e.jsx("div",{ref:i,className:"w-max max-w-[400px] h-fit bg-bg-card shadow-lg rounded-lg p-l",children:e.jsx(Te,{})})})]})]}),e.jsx("div",{className:"overflow-auto scrollbar-none",children:e.jsx(js,{path:t,tab:n})})]})};return e.jsx(Fe,{children:e.jsx(s,{})})},ys=()=>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"})]})})}),ws=()=>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"})]})})}),Ns=({path:t,user:s,url:n})=>{const a=new T.QueryClient;if(!s)return e.jsx(ys,{});if(!s.accessToken)return e.jsx(ws,{});let r={user:s,url:n};return e.jsx(Pe,{...r,children:e.jsx(qe,{...r,children:e.jsx("div",{className:"w-full h-full min-h-[100%] relative",children:e.jsx(T.QueryClientProvider,{client:a,children:e.jsx(bs,{path:t})})})})})};exports.AppTasks=Ns;
|
package/dist/tareas.es.js
CHANGED
|
@@ -822,11 +822,10 @@ function xt({ comment: a }) {
|
|
|
822
822
|
}
|
|
823
823
|
return /* @__PURE__ */ o("div", { children: [
|
|
824
824
|
/* @__PURE__ */ o("div", { className: "flex flex-row gap-2 items-start", children: [
|
|
825
|
-
/* @__PURE__ */ o(ee, { className: "w-
|
|
825
|
+
/* @__PURE__ */ o(ee, { className: "w-[2rem] h-[2rem]", children: [
|
|
826
826
|
/* @__PURE__ */ e(
|
|
827
827
|
te,
|
|
828
828
|
{
|
|
829
|
-
className: "w-8 h-8",
|
|
830
829
|
src: `${ht}${(l = (s = (n = (r = a == null ? void 0 : a.autor) == null ? void 0 : r.imagen) == null ? void 0 : n.formats) == null ? void 0 : s.thumbnail) == null ? void 0 : l.url}`,
|
|
831
830
|
alt: "@shadcn"
|
|
832
831
|
}
|
|
@@ -877,7 +876,7 @@ function gt({ currentUser: a, data: t, taskId: r, onNewComment: n }) {
|
|
|
877
876
|
/* @__PURE__ */ e(
|
|
878
877
|
te,
|
|
879
878
|
{
|
|
880
|
-
className: "w-
|
|
879
|
+
className: "w-[2rem] h-[2rem]",
|
|
881
880
|
src: `${pt}${(b = (x = (h = a == null ? void 0 : a.imagen) == null ? void 0 : h.formats) == null ? void 0 : x.thumbnail) == null ? void 0 : b.url}`,
|
|
882
881
|
alt: "@shadcn"
|
|
883
882
|
}
|
|
@@ -1022,8 +1021,8 @@ function yt({ isOpen: a, setIsOpen: t, taskId: r }) {
|
|
|
1022
1021
|
"section",
|
|
1023
1022
|
{
|
|
1024
1023
|
className: `fixed top-0 bottom-0 bg-white bg-opacity-50 flex justify-center items-center w-[40rem] h-screen z-50 overflow-hidden transition-all ease-in-out duration-500 shadow-2xl ${a ? "right-0 pointer-events-auto block" : "right-[-100%] pointer-events-none hidden"}`,
|
|
1025
|
-
children: /* @__PURE__ */ o("div", { className: "flex w-
|
|
1026
|
-
/* @__PURE__ */ o("div", { className: "w-
|
|
1024
|
+
children: /* @__PURE__ */ o("div", { className: "flex w-[100%] h-[100%] flex-col overflow-y-scroll bg-white border-none shadow-xl px-4 py-6", children: [
|
|
1025
|
+
/* @__PURE__ */ o("div", { className: "w-[100%] flex flex-row justify-between pb-4 gap-10 border-none", children: [
|
|
1027
1026
|
/* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-neutral-900", children: n == null ? void 0 : n.texto_corto }),
|
|
1028
1027
|
/* @__PURE__ */ e(
|
|
1029
1028
|
ge,
|
|
@@ -1036,12 +1035,12 @@ function yt({ isOpen: a, setIsOpen: t, taskId: r }) {
|
|
|
1036
1035
|
}
|
|
1037
1036
|
)
|
|
1038
1037
|
] }),
|
|
1039
|
-
/* @__PURE__ */ e("div", { className: "w-
|
|
1038
|
+
/* @__PURE__ */ e("div", { className: "w-[100%] flex flex-row justify-between", children: /* @__PURE__ */ o("span", { className: "text-neutral-600 text-sm", children: [
|
|
1040
1039
|
n == null ? void 0 : n.campania,
|
|
1041
1040
|
" / ",
|
|
1042
1041
|
n == null ? void 0 : n.nombre_medio
|
|
1043
1042
|
] }) }),
|
|
1044
|
-
/* @__PURE__ */ o("div", { className: "w-
|
|
1043
|
+
/* @__PURE__ */ o("div", { className: "w-[100%] flex flex-col gap-3 mt-4", children: [
|
|
1045
1044
|
/* @__PURE__ */ e("h6", { className: "text-neutral-900 font-semibold text-base", children: "Descripción" }),
|
|
1046
1045
|
/* @__PURE__ */ e("p", { className: "text-neutral-600 font-normal text-sm", children: (n == null ? void 0 : n.texto_largo) ?? "Sin descripción" })
|
|
1047
1046
|
] }),
|
|
@@ -1051,10 +1050,10 @@ function yt({ isOpen: a, setIsOpen: t, taskId: r }) {
|
|
|
1051
1050
|
type: "single",
|
|
1052
1051
|
collapsible: !0,
|
|
1053
1052
|
defaultValue: "item-1",
|
|
1054
|
-
className: "w-
|
|
1053
|
+
className: "w-[100%] flex flex-col border border-neutral-200 rounded-xl mt-4",
|
|
1055
1054
|
children: /* @__PURE__ */ o(Oe, { value: "item-1", className: "border-none", children: [
|
|
1056
|
-
/* @__PURE__ */ e(Ie, { className: "text-neutral-900 font-medium text-sm w-
|
|
1057
|
-
/* @__PURE__ */ e(Re, { className: "border-none", children: /* @__PURE__ */ o("div", { className: "w-
|
|
1055
|
+
/* @__PURE__ */ e(Ie, { className: "text-neutral-900 font-medium text-sm w-[100%] flex flex-row border-b border-neutral-200 p-4 ", children: "Detalles" }),
|
|
1056
|
+
/* @__PURE__ */ e(Re, { className: "border-none", children: /* @__PURE__ */ o("div", { className: "w-[100%] grid grid-cols-3 gap-4 p-4", children: [
|
|
1058
1057
|
/* @__PURE__ */ o("div", { className: "flex flex-col w-auto gap-2", children: [
|
|
1059
1058
|
/* @__PURE__ */ e("span", { className: "text-sm text-neutral-900 font-medium", children: "Responsable" }),
|
|
1060
1059
|
(g = n == null ? void 0 : n.responsable) != null && g.nombre ? /* @__PURE__ */ o("div", { className: "flex flex-row gap-2 items-center", children: [
|
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.11",
|
|
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",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"access": "public",
|
|
79
79
|
"registry": "https://registry.npmjs.org/@imjmedia"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "7924284ecd325a8c2386b952eead6f2e1291d48d"
|
|
82
82
|
}
|