@imj_media/tareas 0.1.9 → 0.1.10
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 +111 -110
- package/package.json +3 -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",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",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-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;
|
package/dist/tareas.es.js
CHANGED
|
@@ -25,7 +25,7 @@ const He = ({ label: a, active: t, onClick: r, disabled: n }) => n ? /* @__PURE_
|
|
|
25
25
|
const l = (i) => {
|
|
26
26
|
s(i), t(i);
|
|
27
27
|
};
|
|
28
|
-
return /* @__PURE__ */ e("div", { className: "flex", children: a.map((i,
|
|
28
|
+
return /* @__PURE__ */ e("div", { className: "flex", children: a.map((i, m) => /* @__PURE__ */ e("div", { className: `${m === 0 ? "border-l-2" : ""} border-r-2 border-gray-200 px-m`, children: /* @__PURE__ */ e(
|
|
29
29
|
He,
|
|
30
30
|
{
|
|
31
31
|
onClick: () => l(i.toLowerCase()),
|
|
@@ -33,7 +33,7 @@ const He = ({ label: a, active: t, onClick: r, disabled: n }) => n ? /* @__PURE_
|
|
|
33
33
|
active: i.toLowerCase() === n,
|
|
34
34
|
disabled: ["gantt"].includes(i.toLowerCase())
|
|
35
35
|
},
|
|
36
|
-
|
|
36
|
+
m
|
|
37
37
|
) })) });
|
|
38
38
|
}, F = {
|
|
39
39
|
bg: {
|
|
@@ -105,8 +105,8 @@ const He = ({ label: a, active: t, onClick: r, disabled: n }) => n ? /* @__PURE_
|
|
|
105
105
|
//Methods
|
|
106
106
|
setElementPosition: (l) => {
|
|
107
107
|
var p;
|
|
108
|
-
let i = (p = l.current) == null ? void 0 : p.getBoundingClientRect(),
|
|
109
|
-
t(a ? null : { x:
|
|
108
|
+
let i = (p = l.current) == null ? void 0 : p.getBoundingClientRect(), m = (i == null ? void 0 : i.x) + ((i == null ? void 0 : i.width) ?? 0), c = (i == null ? void 0 : i.y) + (i == null ? void 0 : i.height);
|
|
109
|
+
t(a ? null : { x: m ?? 0, y: c ?? 0 });
|
|
110
110
|
},
|
|
111
111
|
getChildrenSize: (l) => {
|
|
112
112
|
var i;
|
|
@@ -118,12 +118,12 @@ const He = ({ label: a, active: t, onClick: r, disabled: n }) => n ? /* @__PURE_
|
|
|
118
118
|
};
|
|
119
119
|
}, Ge = ({ children: a, filterChildren: t }) => {
|
|
120
120
|
const { position: r, setElementPosition: n } = ne(), s = L(null), l = ({ children: i }) => {
|
|
121
|
-
const [
|
|
121
|
+
const [m, c] = y();
|
|
122
122
|
return v(() => {
|
|
123
123
|
var p, d;
|
|
124
124
|
t.current && c(((r == null ? void 0 : r.x) ?? 0) - (((d = (p = t.current) == null ? void 0 : p.getBoundingClientRect()) == null ? void 0 : d.width) ?? 0));
|
|
125
125
|
}, [t == null ? void 0 : t.current, r == null ? void 0 : r.x]), r && V.createPortal(
|
|
126
|
-
/* @__PURE__ */ e("div", { className: `absolute w-fit h-fit ${
|
|
126
|
+
/* @__PURE__ */ e("div", { className: `absolute w-fit h-fit ${m ? "block" : "hidden"}`, style: { top: `${r == null ? void 0 : r.y}px`, left: `${m}px` }, children: i }),
|
|
127
127
|
document.body
|
|
128
128
|
);
|
|
129
129
|
};
|
|
@@ -155,13 +155,13 @@ const He = ({ label: a, active: t, onClick: r, disabled: n }) => n ? /* @__PURE_
|
|
|
155
155
|
t[r] = n;
|
|
156
156
|
}), t;
|
|
157
157
|
}, fe = U({}), Ye = ({ children: a }) => {
|
|
158
|
-
const [t, r] = y({}), [n, s] = y({}), [l, i] = y([]),
|
|
158
|
+
const [t, r] = y({}), [n, s] = y({}), [l, i] = y([]), m = ({ name: d, value: h }) => {
|
|
159
159
|
function x(g) {
|
|
160
160
|
return !isNaN(g) && g !== null && g !== "" ? parseFloat(g) : null;
|
|
161
161
|
}
|
|
162
162
|
let b = x(h);
|
|
163
163
|
s((g) => {
|
|
164
|
-
let f = { ...g }, w = l == null ? void 0 : l.find((
|
|
164
|
+
let f = { ...g }, w = l == null ? void 0 : l.find((u) => u.label.toLowerCase().replace(/ /g, "_") === d);
|
|
165
165
|
return w ? f[w.id] = b ?? h : f[d] = b ?? h, f;
|
|
166
166
|
});
|
|
167
167
|
};
|
|
@@ -184,7 +184,7 @@ const He = ({ label: a, active: t, onClick: r, disabled: n }) => n ? /* @__PURE_
|
|
|
184
184
|
filters: t,
|
|
185
185
|
//methods
|
|
186
186
|
defineFields: i,
|
|
187
|
-
updateFilters:
|
|
187
|
+
updateFilters: m,
|
|
188
188
|
cleanFilters: c,
|
|
189
189
|
applyFilters: p,
|
|
190
190
|
initialFilters: n
|
|
@@ -193,8 +193,8 @@ const He = ({ label: a, active: t, onClick: r, disabled: n }) => n ? /* @__PURE_
|
|
|
193
193
|
function be(a, t = 300, r = { leading: !1, trailing: !0 }) {
|
|
194
194
|
let n, s = null;
|
|
195
195
|
return function(...l) {
|
|
196
|
-
const i = Date.now(),
|
|
197
|
-
clearTimeout(n),
|
|
196
|
+
const i = Date.now(), m = r.leading && !s;
|
|
197
|
+
clearTimeout(n), m && a(...l), s = i, n = setTimeout(() => {
|
|
198
198
|
r.trailing && (!r.leading || i - s >= t) && (a(...l), s = null);
|
|
199
199
|
}, t);
|
|
200
200
|
};
|
|
@@ -213,7 +213,7 @@ const Xe = () => {
|
|
|
213
213
|
/* @__PURE__ */ e("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: r, children: "Limpiar" })
|
|
214
214
|
] }),
|
|
215
215
|
/* @__PURE__ */ e("div", { className: "flex flex-col gap-m", children: a == null ? void 0 : a.map((l, i) => {
|
|
216
|
-
var
|
|
216
|
+
var m;
|
|
217
217
|
return /* @__PURE__ */ o("div", { children: [
|
|
218
218
|
/* @__PURE__ */ e("p", { className: "text-sm", children: l.label }),
|
|
219
219
|
(l == null ? void 0 : l.type) === "select" ? /* @__PURE__ */ e(
|
|
@@ -230,7 +230,7 @@ const Xe = () => {
|
|
|
230
230
|
className: "w-full h-[30px] shadow-input rounded-lg p-s",
|
|
231
231
|
name: l.id,
|
|
232
232
|
id: l.id,
|
|
233
|
-
children: (
|
|
233
|
+
children: (m = l == null ? void 0 : l.options) == null ? void 0 : m.map((c, p) => /* @__PURE__ */ e(
|
|
234
234
|
"option",
|
|
235
235
|
{
|
|
236
236
|
value: c.id,
|
|
@@ -276,11 +276,11 @@ const Xe = () => {
|
|
|
276
276
|
};
|
|
277
277
|
class Je {
|
|
278
278
|
static toCampaignTasks(t) {
|
|
279
|
-
var n, s, l, i,
|
|
279
|
+
var n, s, l, i, m, c, p, d, h, x, b, g;
|
|
280
280
|
let r = [];
|
|
281
|
-
return t != null && t.responsable && r.push({ id: t.responsable.id, name: t.responsable.nombre, image: (
|
|
282
|
-
var w,
|
|
283
|
-
r != null && r.find((_) => _.id === f.idUser.id) || f.idUser && r.push({ id: f.idUser.id, name: f.idUser.nombre, image: (T = (C = (
|
|
281
|
+
return t != null && t.responsable && r.push({ id: t.responsable.id, name: t.responsable.nombre, image: (m = (i = (l = (s = (n = t.responsable) == null ? void 0 : n.userOBP) == null ? void 0 : s.imagen) == null ? void 0 : l.formats) == null ? void 0 : i.thumbnail) == null ? void 0 : m.url }), console.log("task", t), (c = t == null ? void 0 : t.equipo) != null && c.miembros && t.equipo.miembros.forEach((f) => {
|
|
282
|
+
var w, u, C, T;
|
|
283
|
+
r != null && r.find((_) => _.id === f.idUser.id) || f.idUser && r.push({ id: f.idUser.id, name: f.idUser.nombre, image: (T = (C = (u = (w = f == null ? void 0 : f.userOBP) == null ? void 0 : w.imagen) == null ? void 0 : u.formats) == null ? void 0 : C.thumbnail) == null ? void 0 : T.url });
|
|
284
284
|
}), {
|
|
285
285
|
isPrincipalTask: (t == null ? void 0 : t.tarea_principal) ?? !1,
|
|
286
286
|
projectName: ((p = t == null ? void 0 : t.proyecto) == null ? void 0 : p.nombre) ?? null,
|
|
@@ -360,7 +360,7 @@ const Ze = async ({ filters: a, tasks_api: t, project: r }) => {
|
|
|
360
360
|
);
|
|
361
361
|
}, R = () => K(we), Ne = U({}), tt = ({ children: a, project: t }) => {
|
|
362
362
|
var w;
|
|
363
|
-
const r = W(), [n, s] = y([]), [l, i] = y([]), { tasks_api:
|
|
363
|
+
const r = W(), [n, s] = y([]), [l, i] = y([]), { tasks_api: m } = P(), { filters: c } = $(), { user: p } = R(), [d, h] = y({
|
|
364
364
|
owner: {
|
|
365
365
|
user: p.id,
|
|
366
366
|
config: ((w = c == null ? void 0 : c.owner) == null ? void 0 : w.config) ?? "yo_y_mis_equipos"
|
|
@@ -379,16 +379,16 @@ const Ze = async ({ filters: a, tasks_api: t, project: r }) => {
|
|
|
379
379
|
...d
|
|
380
380
|
},
|
|
381
381
|
project: t,
|
|
382
|
-
tasks_api:
|
|
382
|
+
tasks_api: m
|
|
383
383
|
})
|
|
384
384
|
});
|
|
385
385
|
v(() => {
|
|
386
|
-
var
|
|
386
|
+
var u;
|
|
387
387
|
Object.keys(c).length > 0 && h({
|
|
388
388
|
...c,
|
|
389
389
|
owner: {
|
|
390
390
|
user: p.id,
|
|
391
|
-
config: ((
|
|
391
|
+
config: ((u = c == null ? void 0 : c.owner) == null ? void 0 : u.config) ?? "yo_y_mis_equipos"
|
|
392
392
|
},
|
|
393
393
|
project: {
|
|
394
394
|
id: t
|
|
@@ -399,10 +399,10 @@ const Ze = async ({ filters: a, tasks_api: t, project: r }) => {
|
|
|
399
399
|
queryKey: ["tasksProject", t]
|
|
400
400
|
});
|
|
401
401
|
}, [d]);
|
|
402
|
-
const b = (
|
|
403
|
-
s((C) => [...C,
|
|
404
|
-
}, g = (
|
|
405
|
-
i((C) => C.includes(
|
|
402
|
+
const b = (u) => {
|
|
403
|
+
s((C) => [...C, u]);
|
|
404
|
+
}, g = (u) => {
|
|
405
|
+
i((C) => C.includes(u) ? C.filter((T) => T !== u) : [...C, u]);
|
|
406
406
|
}, f = t ?? null;
|
|
407
407
|
return /* @__PURE__ */ e(
|
|
408
408
|
Ne.Provider,
|
|
@@ -505,7 +505,7 @@ const Ze = async ({ filters: a, tasks_api: t, project: r }) => {
|
|
|
505
505
|
alt: t ?? "avatar",
|
|
506
506
|
className: "w-[28px] h-[28px] min-w-[28px] min-h-[28px] rounded-full bg-containers border-2 border-white"
|
|
507
507
|
}
|
|
508
|
-
),
|
|
508
|
+
), me = ({ trigger: a, user: t, showUser: r = !0 }) => /* @__PURE__ */ e(I, { dispatch: a, children: r && /* @__PURE__ */ o("div", { className: "flex items-center gap-2 bg-containers w-fit h-fit p-2 rounded-lg border-containers", children: [
|
|
509
509
|
/* @__PURE__ */ e(z, { imageUrl: t.image ?? "", alt: t.name }),
|
|
510
510
|
/* @__PURE__ */ e("p", { className: "text-xs font-bold content-text", children: t.name })
|
|
511
511
|
] }) }), rt = ({ options: a, onselect: t }) => {
|
|
@@ -585,7 +585,7 @@ function dt(a) {
|
|
|
585
585
|
const t = ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"], r = new Date(a).getDay();
|
|
586
586
|
return t[r];
|
|
587
587
|
}
|
|
588
|
-
const
|
|
588
|
+
const ue = (a) => {
|
|
589
589
|
let t = a || /* @__PURE__ */ new Date(), r = t.getDate(), n = Ce(t.getMonth()).slice(0, 3), s = t.getFullYear().toString().slice(-2), l = dt(t).slice(0, 3);
|
|
590
590
|
return `${l.charAt(0).toUpperCase() + l.slice(1)} ${r} ${n.charAt(0).toUpperCase() + n.slice(1)} ${s}`;
|
|
591
591
|
}, re = (a) => ({
|
|
@@ -597,7 +597,7 @@ const me = (a) => {
|
|
|
597
597
|
responsible: r
|
|
598
598
|
}) => {
|
|
599
599
|
let n = `button-assign-users-${Math.random().toString(36).substring(2, 15)}`;
|
|
600
|
-
const { setElementPosition: s, position: l, clearPosition: i } = ne(),
|
|
600
|
+
const { setElementPosition: s, position: l, clearPosition: i } = ne(), m = L(null);
|
|
601
601
|
console.log(a);
|
|
602
602
|
const c = () => r ? null : a.length > 3 && /* @__PURE__ */ e(
|
|
603
603
|
I,
|
|
@@ -614,7 +614,7 @@ const me = (a) => {
|
|
|
614
614
|
(b) => b.id === r
|
|
615
615
|
);
|
|
616
616
|
return /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
617
|
-
|
|
617
|
+
me,
|
|
618
618
|
{
|
|
619
619
|
trigger: /* @__PURE__ */ e(
|
|
620
620
|
z,
|
|
@@ -630,23 +630,23 @@ const me = (a) => {
|
|
|
630
630
|
) });
|
|
631
631
|
}
|
|
632
632
|
return (a == null ? void 0 : a.length) > 0 && a.slice(0, 3).map((x, b) => /* @__PURE__ */ e("div", { className: `${b === 0 ? "" : "ml-[-8px]"}`, children: /* @__PURE__ */ e(
|
|
633
|
-
|
|
633
|
+
me,
|
|
634
634
|
{
|
|
635
635
|
trigger: /* @__PURE__ */ e(z, { imageUrl: x.image, alt: x.name }, b),
|
|
636
636
|
user: x,
|
|
637
637
|
showUser: !(l != null && l.x)
|
|
638
638
|
}
|
|
639
639
|
) }));
|
|
640
|
-
}, d = ({ children: x }) => /* @__PURE__ */ e("label", { ref:
|
|
640
|
+
}, d = ({ children: x }) => /* @__PURE__ */ e("label", { ref: m, htmlFor: n, className: "cursor-pointer flex items-center", children: x });
|
|
641
641
|
if (a.length === 0)
|
|
642
642
|
return /* @__PURE__ */ e(d, { children: /* @__PURE__ */ e(N, { icon: "user", size: "xs", strokeWidth: 3 }) });
|
|
643
643
|
const h = () => {
|
|
644
644
|
var T;
|
|
645
|
-
const [x, b] = y(), [g, f] = y("team"), { teams: w } = lt(), { users:
|
|
645
|
+
const [x, b] = y(), [g, f] = y("team"), { teams: w } = lt(), { users: u } = ct();
|
|
646
646
|
v(() => {
|
|
647
647
|
var _, S;
|
|
648
|
-
|
|
649
|
-
}, [
|
|
648
|
+
m.current && b(((l == null ? void 0 : l.x) ?? 0) - (((S = (_ = m.current) == null ? void 0 : _.getBoundingClientRect()) == null ? void 0 : S.width) ?? 0));
|
|
649
|
+
}, [m == null ? void 0 : m.current, l == null ? void 0 : l.x]);
|
|
650
650
|
const C = () => {
|
|
651
651
|
const _ = [
|
|
652
652
|
{ id: "team", label: "Equipo" },
|
|
@@ -676,7 +676,7 @@ const me = (a) => {
|
|
|
676
676
|
id: _.id,
|
|
677
677
|
name: _.name,
|
|
678
678
|
image: ""
|
|
679
|
-
})) : (T =
|
|
679
|
+
})) : (T = u.data) == null ? void 0 : T.map(re),
|
|
680
680
|
onselect: (_) => {
|
|
681
681
|
i(), t && t(_);
|
|
682
682
|
}
|
|
@@ -698,12 +698,12 @@ const me = (a) => {
|
|
|
698
698
|
{
|
|
699
699
|
className: "hidden",
|
|
700
700
|
id: n,
|
|
701
|
-
onClick: () => s(
|
|
701
|
+
onClick: () => s(m)
|
|
702
702
|
}
|
|
703
703
|
),
|
|
704
704
|
/* @__PURE__ */ e(h, {})
|
|
705
705
|
] });
|
|
706
|
-
},
|
|
706
|
+
}, mt = () => {
|
|
707
707
|
const { tasks_api: a } = P(), t = W(), r = async ({ newData: l, id: i }) => (await a.put(`/api/tareas/${i}`, {
|
|
708
708
|
data: l
|
|
709
709
|
})).data, n = qe({
|
|
@@ -717,10 +717,10 @@ const me = (a) => {
|
|
|
717
717
|
});
|
|
718
718
|
return {
|
|
719
719
|
//* Methods
|
|
720
|
-
updateTask: async ({ id: l, data: i, user:
|
|
720
|
+
updateTask: async ({ id: l, data: i, user: m }) => {
|
|
721
721
|
let c = {
|
|
722
722
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
723
|
-
updated_by:
|
|
723
|
+
updated_by: m,
|
|
724
724
|
...i
|
|
725
725
|
};
|
|
726
726
|
try {
|
|
@@ -731,12 +731,12 @@ const me = (a) => {
|
|
|
731
731
|
}
|
|
732
732
|
};
|
|
733
733
|
}, Te = ({ priority: a, id: t }) => {
|
|
734
|
-
const { updateTask: r } =
|
|
734
|
+
const { updateTask: r } = mt(), n = Math.random().toString(36), [s, l] = y(null), i = (c) => ({
|
|
735
735
|
0: F.primary.regular,
|
|
736
736
|
1: F.success.regular,
|
|
737
737
|
2: F.warning.regular,
|
|
738
738
|
3: F.danger.regular
|
|
739
|
-
})[c],
|
|
739
|
+
})[c], m = () => {
|
|
740
740
|
if (!s) return null;
|
|
741
741
|
const c = ({ priority: p, text: d }) => /* @__PURE__ */ o("button", { onClick: () => {
|
|
742
742
|
r({ id: t, data: { prioridad: p }, user: 272 }), l(null);
|
|
@@ -779,10 +779,10 @@ const me = (a) => {
|
|
|
779
779
|
className: "hidden"
|
|
780
780
|
}
|
|
781
781
|
),
|
|
782
|
-
/* @__PURE__ */ e(
|
|
782
|
+
/* @__PURE__ */ e(m, {})
|
|
783
783
|
] });
|
|
784
784
|
};
|
|
785
|
-
function
|
|
785
|
+
function ut({ items: a }) {
|
|
786
786
|
var n;
|
|
787
787
|
const [t, r] = y(1);
|
|
788
788
|
return /* @__PURE__ */ o(A, { children: [
|
|
@@ -815,24 +815,25 @@ function se(a) {
|
|
|
815
815
|
}
|
|
816
816
|
const ht = "https://devobp.imjmedia.com.mx";
|
|
817
817
|
function xt({ comment: a }) {
|
|
818
|
-
var r, n, s, l, i,
|
|
818
|
+
var r, n, s, l, i, m;
|
|
819
819
|
function t(c) {
|
|
820
820
|
const p = Ee(c);
|
|
821
821
|
return Be(p, { locale: k, addSuffix: !0 });
|
|
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: "
|
|
825
|
+
/* @__PURE__ */ o(ee, { className: "w-8 h-8 max-w-8 max-h-8 min-w-8 min-h-8", children: [
|
|
826
826
|
/* @__PURE__ */ e(
|
|
827
827
|
te,
|
|
828
828
|
{
|
|
829
|
+
className: "w-8 h-8",
|
|
829
830
|
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}`,
|
|
830
831
|
alt: "@shadcn"
|
|
831
832
|
}
|
|
832
833
|
),
|
|
833
834
|
/* @__PURE__ */ e(ae, { children: se((i = a == null ? void 0 : a.autor) == null ? void 0 : i.nombre) })
|
|
834
835
|
] }),
|
|
835
|
-
/* @__PURE__ */ e("p", { className: "text-sm text-neutral-900 font-medium", children: (
|
|
836
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-neutral-900 font-medium", children: (m = a == null ? void 0 : a.autor) == null ? void 0 : m.nombre }),
|
|
836
837
|
/* @__PURE__ */ e("span", { className: "text-xs text-neutral-600 font-normal mt-[2px]", children: t(a == null ? void 0 : a.createdAt) })
|
|
837
838
|
] }),
|
|
838
839
|
/* @__PURE__ */ e("p", { className: "text-sm text-neutral-600 font-normal pl-10", children: a == null ? void 0 : a.comentario })
|
|
@@ -840,7 +841,7 @@ function xt({ comment: a }) {
|
|
|
840
841
|
}
|
|
841
842
|
function gt({ currentUser: a, data: t, taskId: r, onNewComment: n }) {
|
|
842
843
|
var h, x, b;
|
|
843
|
-
const { tasks_api: s } = P(), { register: l, handleSubmit: i, reset:
|
|
844
|
+
const { tasks_api: s } = P(), { register: l, handleSubmit: i, reset: m } = We(), [c, p] = y([]);
|
|
844
845
|
return v(() => {
|
|
845
846
|
if (t != null && t.comentarios) {
|
|
846
847
|
const g = [...t.comentarios].sort(
|
|
@@ -867,12 +868,12 @@ function gt({ currentUser: a, data: t, taskId: r, onNewComment: n }) {
|
|
|
867
868
|
comentario: g.comment,
|
|
868
869
|
tarea: r
|
|
869
870
|
}
|
|
870
|
-
}), n(!0), p((w) => [f, ...w]),
|
|
871
|
+
}), n(!0), p((w) => [f, ...w]), m();
|
|
871
872
|
} catch (f) {
|
|
872
873
|
console.error("Error al agregar comentario:", f);
|
|
873
874
|
}
|
|
874
875
|
}), className: "flex flex-row items-center gap-3", children: [
|
|
875
|
-
/* @__PURE__ */ o(ee, { className: "w-8 h-8", children: [
|
|
876
|
+
/* @__PURE__ */ o(ee, { className: "w-8 h-8 max-w-8 max-h-8 min-w-8 min-h-8", children: [
|
|
876
877
|
/* @__PURE__ */ e(
|
|
877
878
|
te,
|
|
878
879
|
{
|
|
@@ -921,14 +922,14 @@ function ft({ data: a }) {
|
|
|
921
922
|
/* @__PURE__ */ e("span", { className: "text-sm font-normal text-neutral-600 bg-[#E1EBF9] w-6 h-6 rounded-full flex items-center justify-center text-primary", children: a == null ? void 0 : a.length })
|
|
922
923
|
] }),
|
|
923
924
|
/* @__PURE__ */ e("div", { className: "flex flex-col gap-2 border border-neutral-200 rounded-lg mt-3", children: a == null ? void 0 : a.map((n) => {
|
|
924
|
-
var s, l, i,
|
|
925
|
+
var s, l, i, m, c;
|
|
925
926
|
return /* @__PURE__ */ o(
|
|
926
927
|
"div",
|
|
927
928
|
{
|
|
928
929
|
className: "flex flex-row w-full items-center justify-between gap-s border-b border-neutral-200 py-1 px-2",
|
|
929
930
|
children: [
|
|
930
931
|
/* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
|
|
931
|
-
/* @__PURE__ */ e(z, { imageUrl: (
|
|
932
|
+
/* @__PURE__ */ e(z, { imageUrl: (m = (i = (l = (s = n.responsable) == null ? void 0 : s.image) == null ? void 0 : l.formats) == null ? void 0 : i.thumbnail) == null ? void 0 : m.url }),
|
|
932
933
|
/* @__PURE__ */ e("p", { className: "text-sm font-normal w-[400px] text-nowrap text-ellipsis overflow-hidden", children: n == null ? void 0 : n.texto_corto })
|
|
933
934
|
] }),
|
|
934
935
|
/* @__PURE__ */ o("div", { className: "flex items-center gap-1", children: [
|
|
@@ -949,8 +950,8 @@ function ft({ data: a }) {
|
|
|
949
950
|
}
|
|
950
951
|
const bt = "https://devobp.imjmedia.com.mx";
|
|
951
952
|
function yt({ isOpen: a, setIsOpen: t, taskId: r }) {
|
|
952
|
-
var g, f, w,
|
|
953
|
-
const [n, s] = y(null), [l, i] = y(!1), [
|
|
953
|
+
var g, f, w, u, C, T, _, S, D, q, j;
|
|
954
|
+
const [n, s] = y(null), [l, i] = y(!1), [m, c] = y(null), { tasks_api: p } = P(), { user: d } = R();
|
|
954
955
|
v(() => {
|
|
955
956
|
if (a && r || l) {
|
|
956
957
|
const E = async () => {
|
|
@@ -997,7 +998,7 @@ function yt({ isOpen: a, setIsOpen: t, taskId: r }) {
|
|
|
997
998
|
gt,
|
|
998
999
|
{
|
|
999
1000
|
taskId: r,
|
|
1000
|
-
currentUser:
|
|
1001
|
+
currentUser: m,
|
|
1001
1002
|
data: n,
|
|
1002
1003
|
onNewComment: i
|
|
1003
1004
|
}
|
|
@@ -1061,7 +1062,7 @@ function yt({ isOpen: a, setIsOpen: t, taskId: r }) {
|
|
|
1061
1062
|
/* @__PURE__ */ e(
|
|
1062
1063
|
te,
|
|
1063
1064
|
{
|
|
1064
|
-
src: `${bt}${(C = (
|
|
1065
|
+
src: `${bt}${(C = (u = (w = (f = n == null ? void 0 : n.responsable) == null ? void 0 : f.imagen) == null ? void 0 : w.formats) == null ? void 0 : u.thumbnail) == null ? void 0 : C.url}`,
|
|
1065
1066
|
alt: "@shadcn"
|
|
1066
1067
|
}
|
|
1067
1068
|
),
|
|
@@ -1123,7 +1124,7 @@ function yt({ isOpen: a, setIsOpen: t, taskId: r }) {
|
|
|
1123
1124
|
] })
|
|
1124
1125
|
}
|
|
1125
1126
|
),
|
|
1126
|
-
/* @__PURE__ */ e(
|
|
1127
|
+
/* @__PURE__ */ e(ut, { items: b })
|
|
1127
1128
|
] })
|
|
1128
1129
|
}
|
|
1129
1130
|
)
|
|
@@ -1137,26 +1138,26 @@ const wt = ({
|
|
|
1137
1138
|
willBePaused: s,
|
|
1138
1139
|
nameProject: l,
|
|
1139
1140
|
idProject: i,
|
|
1140
|
-
comments:
|
|
1141
|
+
comments: m,
|
|
1141
1142
|
priority: c,
|
|
1142
1143
|
responsible: p,
|
|
1143
1144
|
nameRequiredTask: d,
|
|
1144
1145
|
statusRequiredTask: h,
|
|
1145
1146
|
status: x
|
|
1146
1147
|
}) => {
|
|
1147
|
-
const b = L(null), [g, f] = y(!1), { setElementPosition: w, position:
|
|
1148
|
+
const b = L(null), [g, f] = y(!1), { setElementPosition: w, position: u } = ne(), C = ({ children: _ }) => {
|
|
1148
1149
|
const [S, D] = y();
|
|
1149
1150
|
return v(() => {
|
|
1150
1151
|
var q, j;
|
|
1151
1152
|
b.current && D(
|
|
1152
|
-
((
|
|
1153
|
+
((u == null ? void 0 : u.x) ?? 0) - (((j = (q = b.current) == null ? void 0 : q.getBoundingClientRect()) == null ? void 0 : j.width) ?? 0)
|
|
1153
1154
|
);
|
|
1154
|
-
}, [b == null ? void 0 : b.current,
|
|
1155
|
+
}, [b == null ? void 0 : b.current, u == null ? void 0 : u.x]), u && V.createPortal(
|
|
1155
1156
|
/* @__PURE__ */ e(
|
|
1156
1157
|
"div",
|
|
1157
1158
|
{
|
|
1158
1159
|
className: `absolute w-fit h-fit ${S ? "block" : "hidden"}`,
|
|
1159
|
-
style: { top: `${
|
|
1160
|
+
style: { top: `${u == null ? void 0 : u.y}px`, left: `${S}px` },
|
|
1160
1161
|
children: _
|
|
1161
1162
|
}
|
|
1162
1163
|
),
|
|
@@ -1252,9 +1253,9 @@ const wt = ({
|
|
|
1252
1253
|
/* @__PURE__ */ e("p", { className: "text-sm font-regular text-texts-subtext", children: `${r.getDate()} ${Ce(r.getMonth()).slice(0, 3)}` })
|
|
1253
1254
|
] })
|
|
1254
1255
|
] }),
|
|
1255
|
-
|
|
1256
|
+
m > 0 && /* @__PURE__ */ e("div", { className: "border-t border-gray-200 mt-4 pt-2", children: /* @__PURE__ */ o("button", { className: "flex items-center gap-2", children: [
|
|
1256
1257
|
/* @__PURE__ */ e(N, { icon: "comment", size: "xs", strokeWidth: 4 }),
|
|
1257
|
-
/* @__PURE__ */ e("span", { className: "text-sm font-regular text-gray-400", children:
|
|
1258
|
+
/* @__PURE__ */ e("span", { className: "text-sm font-regular text-gray-400", children: m })
|
|
1258
1259
|
] }) })
|
|
1259
1260
|
] }),
|
|
1260
1261
|
/* @__PURE__ */ e(yt, { taskId: a, isOpen: g, setIsOpen: f })
|
|
@@ -1270,16 +1271,16 @@ const wt = ({
|
|
|
1270
1271
|
/* @__PURE__ */ e("div", { className: "w-full h-[30px] bg-gray-300" })
|
|
1271
1272
|
] })
|
|
1272
1273
|
] }), Y = ({ title: a, tasks: t, loadNextPage: r, isFetching: n, total: s }) => {
|
|
1273
|
-
const l = L(null), i = L(null),
|
|
1274
|
+
const l = L(null), i = L(null), m = L(!1);
|
|
1274
1275
|
v(() => {
|
|
1275
1276
|
var d;
|
|
1276
1277
|
l != null && l.current && (i != null && i.current) && (i.current.style.minHeight = `${((d = l == null ? void 0 : l.current) == null ? void 0 : d.clientHeight) - 50}px`);
|
|
1277
1278
|
}, [l == null ? void 0 : l.current]);
|
|
1278
1279
|
const c = (d) => {
|
|
1279
|
-
if (
|
|
1280
|
+
if (m.current) return;
|
|
1280
1281
|
const { scrollTop: h, clientHeight: x, scrollHeight: b } = d == null ? void 0 : d.target, g = h / (b - x) * 100;
|
|
1281
|
-
g <= 95 || g >= 95 && (
|
|
1282
|
-
|
|
1282
|
+
g <= 95 || g >= 95 && (m.current = !0, r && r(), setTimeout(() => {
|
|
1283
|
+
m.current = !1;
|
|
1283
1284
|
}, 200));
|
|
1284
1285
|
};
|
|
1285
1286
|
return /* @__PURE__ */ o(
|
|
@@ -1336,11 +1337,11 @@ const wt = ({
|
|
|
1336
1337
|
return ((i = l == null ? void 0 : l.tasks) == null ? void 0 : i.length) === 0;
|
|
1337
1338
|
}).reduce((l, i) => (l[i.status] = l[i.status] || [], l[i.status].push(i), l), {});
|
|
1338
1339
|
return /* @__PURE__ */ e("div", { className: "flex gap-4 w-full h-full min-h-[100%] relative ", children: ["Por hacer", "Trabajando", "Completadas"].map((l, i) => {
|
|
1339
|
-
var
|
|
1340
|
+
var m;
|
|
1340
1341
|
return /* @__PURE__ */ e(
|
|
1341
1342
|
Y,
|
|
1342
1343
|
{
|
|
1343
|
-
total: ((
|
|
1344
|
+
total: ((m = r == null ? void 0 : r[i]) == null ? void 0 : m.length) ?? 0,
|
|
1344
1345
|
title: l,
|
|
1345
1346
|
tasks: (r == null ? void 0 : r[i]) ?? [],
|
|
1346
1347
|
isFetching: t == null ? void 0 : t.isFetching,
|
|
@@ -1351,11 +1352,11 @@ const wt = ({
|
|
|
1351
1352
|
};
|
|
1352
1353
|
class Ct {
|
|
1353
1354
|
static toKanbanTasks(t) {
|
|
1354
|
-
var n, s, l, i,
|
|
1355
|
+
var n, s, l, i, m, c, p, d, h, x, b;
|
|
1355
1356
|
let r = [];
|
|
1356
|
-
return t != null && t.responsable && r.push({ id: t.responsable.id, name: t.responsable.nombre, image: (
|
|
1357
|
-
var f, w,
|
|
1358
|
-
r != null && r.find((T) => T.id === g.idUser.id) || g.idUser && r.push({ id: g.idUser.id, name: g.idUser.nombre, image: (C = (
|
|
1357
|
+
return t != null && t.responsable && r.push({ id: t.responsable.id, name: t.responsable.nombre, image: (m = (i = (l = (s = (n = t.responsable) == null ? void 0 : n.userOBP) == null ? void 0 : s.imagen) == null ? void 0 : l.formats) == null ? void 0 : i.thumbnail) == null ? void 0 : m.url }), (c = t == null ? void 0 : t.equipo) != null && c.miembros && t.equipo.miembros.forEach((g) => {
|
|
1358
|
+
var f, w, u, C;
|
|
1359
|
+
r != null && r.find((T) => T.id === g.idUser.id) || g.idUser && r.push({ id: g.idUser.id, name: g.idUser.nombre, image: (C = (u = (w = (f = g == null ? void 0 : g.userOBP) == null ? void 0 : f.imagen) == null ? void 0 : w.formats) == null ? void 0 : u.thumbnail) == null ? void 0 : C.url });
|
|
1359
1360
|
}), {
|
|
1360
1361
|
comments: 0,
|
|
1361
1362
|
nameProject: (p = t == null ? void 0 : t.proyecto) == null ? void 0 : p.nombre,
|
|
@@ -1394,7 +1395,7 @@ const le = async ({ filters: a, tasks_api: t }) => {
|
|
|
1394
1395
|
}
|
|
1395
1396
|
}), _t = () => {
|
|
1396
1397
|
var p;
|
|
1397
|
-
const a = W(), { tasks_api: t } = P(), { user: r } = R(), { filters: n } = $(), [s, l] = y(0), [i,
|
|
1398
|
+
const a = W(), { tasks_api: t } = P(), { user: r } = R(), { filters: n } = $(), [s, l] = y(0), [i, m] = y({
|
|
1398
1399
|
owner: {
|
|
1399
1400
|
user: r.id,
|
|
1400
1401
|
config: ((p = n == null ? void 0 : n.owner) == null ? void 0 : p.config) ?? "yo_y_mis_equipos"
|
|
@@ -1418,7 +1419,7 @@ const le = async ({ filters: a, tasks_api: t }) => {
|
|
|
1418
1419
|
});
|
|
1419
1420
|
return v(() => {
|
|
1420
1421
|
var d;
|
|
1421
|
-
Object.keys(n).length > 0 &&
|
|
1422
|
+
Object.keys(n).length > 0 && m({
|
|
1422
1423
|
...n,
|
|
1423
1424
|
owner: {
|
|
1424
1425
|
user: r.id,
|
|
@@ -1454,7 +1455,7 @@ const le = async ({ filters: a, tasks_api: t }) => {
|
|
|
1454
1455
|
return /* @__PURE__ */ e(Y, { total: t, title: "Por hacer", tasks: r, loadNextPage: () => ie(a), isFetching: a == null ? void 0 : a.isFetching, isLoadingData: a == null ? void 0 : a.isLoading });
|
|
1455
1456
|
}, Ft = () => {
|
|
1456
1457
|
var p;
|
|
1457
|
-
const a = W(), { tasks_api: t } = P(), { user: r } = R(), { filters: n } = $(), [s, l] = y(0), [i,
|
|
1458
|
+
const a = W(), { tasks_api: t } = P(), { user: r } = R(), { filters: n } = $(), [s, l] = y(0), [i, m] = y({
|
|
1458
1459
|
owner: {
|
|
1459
1460
|
user: r.id,
|
|
1460
1461
|
config: ((p = n == null ? void 0 : n.owner) == null ? void 0 : p.config) ?? "yo_y_mis_equipos"
|
|
@@ -1478,7 +1479,7 @@ const le = async ({ filters: a, tasks_api: t }) => {
|
|
|
1478
1479
|
});
|
|
1479
1480
|
return v(() => {
|
|
1480
1481
|
var d;
|
|
1481
|
-
Object.keys(n).length > 0 &&
|
|
1482
|
+
Object.keys(n).length > 0 && m({
|
|
1482
1483
|
...n,
|
|
1483
1484
|
owner: {
|
|
1484
1485
|
user: r.id,
|
|
@@ -1523,7 +1524,7 @@ const le = async ({ filters: a, tasks_api: t }) => {
|
|
|
1523
1524
|
);
|
|
1524
1525
|
}, At = () => {
|
|
1525
1526
|
var p;
|
|
1526
|
-
const a = W(), { user: t } = R(), { tasks_api: r } = P(), { filters: n } = $(), [s, l] = y(0), [i,
|
|
1527
|
+
const a = W(), { user: t } = R(), { tasks_api: r } = P(), { filters: n } = $(), [s, l] = y(0), [i, m] = y({
|
|
1527
1528
|
owner: {
|
|
1528
1529
|
user: t.id,
|
|
1529
1530
|
config: ((p = n == null ? void 0 : n.owner) == null ? void 0 : p.config) ?? "yo_y_mis_equipos"
|
|
@@ -1547,7 +1548,7 @@ const le = async ({ filters: a, tasks_api: t }) => {
|
|
|
1547
1548
|
});
|
|
1548
1549
|
return v(() => {
|
|
1549
1550
|
var d;
|
|
1550
|
-
Object.keys(n).length > 0 &&
|
|
1551
|
+
Object.keys(n).length > 0 && m({
|
|
1551
1552
|
...n,
|
|
1552
1553
|
owner: {
|
|
1553
1554
|
user: t.id,
|
|
@@ -1605,7 +1606,7 @@ const Dt = () => {
|
|
|
1605
1606
|
//methods
|
|
1606
1607
|
getSalesmanAndProjects: async () => {
|
|
1607
1608
|
var c;
|
|
1608
|
-
const [i,
|
|
1609
|
+
const [i, m] = await Promise.all([
|
|
1609
1610
|
a.get("/api/obtener-comerciales"),
|
|
1610
1611
|
a.get("/api/listado_tareas", {
|
|
1611
1612
|
params: {
|
|
@@ -1620,17 +1621,17 @@ const Dt = () => {
|
|
|
1620
1621
|
]);
|
|
1621
1622
|
return {
|
|
1622
1623
|
salesmanUsers: i.data.map(H.toSalesmanUsers),
|
|
1623
|
-
projects:
|
|
1624
|
+
projects: m.data.map(H.toSalesmanUsers)
|
|
1624
1625
|
};
|
|
1625
1626
|
},
|
|
1626
1627
|
getProjects: async () => {
|
|
1627
|
-
var
|
|
1628
|
+
var m;
|
|
1628
1629
|
return (await a.get("/api/listado_tareas", {
|
|
1629
1630
|
params: {
|
|
1630
1631
|
...t,
|
|
1631
1632
|
owner: {
|
|
1632
1633
|
user: r.id,
|
|
1633
|
-
config: ((
|
|
1634
|
+
config: ((m = t == null ? void 0 : t.owner) == null ? void 0 : m.config) ?? "yo_y_mis_equipos"
|
|
1634
1635
|
},
|
|
1635
1636
|
justProjects: !0
|
|
1636
1637
|
}
|
|
@@ -1760,7 +1761,7 @@ const Dt = () => {
|
|
|
1760
1761
|
/* @__PURE__ */ e(N, { icon: "calendar", size: "xs", strokeWidth: 4, color: F.texts.subtext }),
|
|
1761
1762
|
/* @__PURE__ */ o("p", { className: "text-sm", children: [
|
|
1762
1763
|
" ",
|
|
1763
|
-
|
|
1764
|
+
ue(a)
|
|
1764
1765
|
] })
|
|
1765
1766
|
] }),
|
|
1766
1767
|
/* @__PURE__ */ e(N, { icon: "arrow_right", size: "xs", strokeWidth: 4, color: F.texts.DEFAULT }),
|
|
@@ -1768,7 +1769,7 @@ const Dt = () => {
|
|
|
1768
1769
|
/* @__PURE__ */ e(N, { icon: "calendar", size: "xs", strokeWidth: 4, color: F.texts.subtext }),
|
|
1769
1770
|
/* @__PURE__ */ o("p", { className: "text-sm", children: [
|
|
1770
1771
|
" ",
|
|
1771
|
-
|
|
1772
|
+
ue(t)
|
|
1772
1773
|
] })
|
|
1773
1774
|
] })
|
|
1774
1775
|
] }), Lt = ({ id: a }) => /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e("button", { onClick: () => alert("pausar tarea " + a), children: /* @__PURE__ */ e(N, { icon: "pause", size: "xs", strokeWidth: 4, color: F.texts.subtext }) }) }), Ae = ({ id: a, priority: t }) => /* @__PURE__ */ o(A, { children: [
|
|
@@ -1808,12 +1809,12 @@ const Dt = () => {
|
|
|
1808
1809
|
/* @__PURE__ */ e(Se, { startDate: r == null ? void 0 : r.startDate, endDate: r == null ? void 0 : r.endDate })
|
|
1809
1810
|
] });
|
|
1810
1811
|
}, De = ({ id: a }) => {
|
|
1811
|
-
var l, i,
|
|
1812
|
+
var l, i, m, c, p, d, h;
|
|
1812
1813
|
const { tasksProject: t, openTasks: r, openTask: n } = G(), s = (l = t == null ? void 0 : t.data) == null ? void 0 : l.find((x) => x.id === a);
|
|
1813
1814
|
return s ? (console.log({ task: s }), /* @__PURE__ */ o("div", { className: "flex flex-col gap-m mb-2 ", children: [
|
|
1814
1815
|
/* @__PURE__ */ o("div", { className: "flex items-center gap-m flex-wrap hover:bg-gray-100", children: [
|
|
1815
1816
|
/* @__PURE__ */ e("button", { className: `${r.includes(a) ? "" : "-rotate-90"} transition-all duration-300`, onClick: () => n(a), children: /* @__PURE__ */ e(N, { icon: "angle_down_outline", color: F.texts.subtext }) }),
|
|
1816
|
-
/* @__PURE__ */ e("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: /* @__PURE__ */ e("p", { className: "text-sm text-primary", children: ((i = s == null ? void 0 : s.tasks) == null ? void 0 : i.length) === 0 ? 1 : (
|
|
1817
|
+
/* @__PURE__ */ e("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: /* @__PURE__ */ e("p", { className: "text-sm text-primary", children: ((i = s == null ? void 0 : s.tasks) == null ? void 0 : i.length) === 0 ? 1 : (m = s == null ? void 0 : s.tasks) == null ? void 0 : m.length }) }),
|
|
1817
1818
|
/* @__PURE__ */ e(Pe, { task: (s == null ? void 0 : s.task) ?? "" }),
|
|
1818
1819
|
/* @__PURE__ */ e(Ae, { id: a, priority: s == null ? void 0 : s.priority }),
|
|
1819
1820
|
/* @__PURE__ */ e(Se, { startDate: s == null ? void 0 : s.startDate, endDate: s == null ? void 0 : s.endDate }),
|
|
@@ -1831,37 +1832,37 @@ const Dt = () => {
|
|
|
1831
1832
|
let r = [...(n = a == null ? void 0 : a.data) == null ? void 0 : n.filter((s) => s.isPrincipalTask)];
|
|
1832
1833
|
return /* @__PURE__ */ e("div", { className: "flex flex-col gap-m", children: /* @__PURE__ */ e($t, { project: t, children: r == null ? void 0 : r.sort((s, l) => s.orden - l.orden).map((s) => /* @__PURE__ */ e("div", { className: "flex flex-col gap-m border-b border-gray-200 pb-m", children: /* @__PURE__ */ e(De, { id: s.id }) })) }) });
|
|
1833
1834
|
}, It = () => {
|
|
1834
|
-
const [a, t] = y([]), [r, n] = y(0), [s, l] = y(10), [i,
|
|
1835
|
+
const [a, t] = y([]), [r, n] = y(0), [s, l] = y(10), [i, m] = y(0), [c, p] = y("nombre"), { tasks_api: d } = P(), h = async (u, C) => {
|
|
1835
1836
|
try {
|
|
1836
1837
|
const T = await d.get("/listado_campanias", {
|
|
1837
1838
|
params: {
|
|
1838
|
-
"pagination[page]":
|
|
1839
|
+
"pagination[page]": u,
|
|
1839
1840
|
"pagination[pageSize]": C,
|
|
1840
1841
|
orderBy: c
|
|
1841
1842
|
// Agregar orderBy a los parámetros
|
|
1842
1843
|
}
|
|
1843
1844
|
}), _ = M(T.data);
|
|
1844
|
-
t(_),
|
|
1845
|
+
t(_), m(T.data.meta.total);
|
|
1845
1846
|
} catch (T) {
|
|
1846
1847
|
console.error("Error fetching data:", T);
|
|
1847
1848
|
}
|
|
1848
1849
|
};
|
|
1849
1850
|
v(() => {
|
|
1850
|
-
const
|
|
1851
|
-
h(
|
|
1851
|
+
const u = Math.floor(r / s) + 1;
|
|
1852
|
+
h(u, s);
|
|
1852
1853
|
}, [r, s, c]);
|
|
1853
|
-
const x = (
|
|
1854
|
-
n(
|
|
1854
|
+
const x = (u) => {
|
|
1855
|
+
n(u.first), l(u.rows);
|
|
1855
1856
|
}, b = [
|
|
1856
1857
|
{ label: "5", value: 5 },
|
|
1857
1858
|
{ label: "10", value: 10 },
|
|
1858
1859
|
{ label: "15", value: 15 },
|
|
1859
1860
|
{ label: "20", value: 20 }
|
|
1860
|
-
], g = (
|
|
1861
|
-
|
|
1862
|
-
}, f = (
|
|
1863
|
-
p((C) => C ===
|
|
1864
|
-
}, w = (
|
|
1861
|
+
], g = (u) => {
|
|
1862
|
+
u.value !== s && (l(u.value), n(0));
|
|
1863
|
+
}, f = (u) => {
|
|
1864
|
+
p((C) => C === u ? `${u}:desc` : u);
|
|
1865
|
+
}, w = (u) => c === u ? "↑↓" : c === `${u}:desc` ? "↓↑" : "↑↓";
|
|
1865
1866
|
return /* @__PURE__ */ o("div", { className: "table-container", children: [
|
|
1866
1867
|
/* @__PURE__ */ o(
|
|
1867
1868
|
"table",
|
|
@@ -1889,12 +1890,12 @@ const Dt = () => {
|
|
|
1889
1890
|
/* @__PURE__ */ e("th", { children: "Status" }),
|
|
1890
1891
|
/* @__PURE__ */ e("th", { children: "Responsable" })
|
|
1891
1892
|
] }) }),
|
|
1892
|
-
/* @__PURE__ */ e("tbody", { children: a == null ? void 0 : a.map((
|
|
1893
|
+
/* @__PURE__ */ e("tbody", { children: a == null ? void 0 : a.map((u, C) => {
|
|
1893
1894
|
var T, _, S, D, q, j, E, Q;
|
|
1894
1895
|
return /* @__PURE__ */ o("tr", { className: "table-row", children: [
|
|
1895
|
-
/* @__PURE__ */ e("td", { children: (T =
|
|
1896
|
-
/* @__PURE__ */ e("td", { children: (_ =
|
|
1897
|
-
/* @__PURE__ */ e("td", { children: (S =
|
|
1896
|
+
/* @__PURE__ */ e("td", { children: (T = u == null ? void 0 : u.campania) == null ? void 0 : T.nombre }),
|
|
1897
|
+
/* @__PURE__ */ e("td", { children: (_ = u == null ? void 0 : u.campania) == null ? void 0 : _.inicia }),
|
|
1898
|
+
/* @__PURE__ */ e("td", { children: (S = u == null ? void 0 : u.campania) == null ? void 0 : S.termina }),
|
|
1898
1899
|
/* @__PURE__ */ e("td", { style: { width: "20%" }, children: /* @__PURE__ */ o(
|
|
1899
1900
|
"div",
|
|
1900
1901
|
{
|
|
@@ -1917,7 +1918,7 @@ const Dt = () => {
|
|
|
1917
1918
|
color: "#000"
|
|
1918
1919
|
},
|
|
1919
1920
|
children: [
|
|
1920
|
-
|
|
1921
|
+
u == null ? void 0 : u.progreso,
|
|
1921
1922
|
"%"
|
|
1922
1923
|
]
|
|
1923
1924
|
}
|
|
@@ -1941,8 +1942,8 @@ const Dt = () => {
|
|
|
1941
1942
|
top: 0,
|
|
1942
1943
|
left: 0,
|
|
1943
1944
|
height: "100%",
|
|
1944
|
-
width: `${
|
|
1945
|
-
backgroundColor:
|
|
1945
|
+
width: `${u.progreso}%`,
|
|
1946
|
+
backgroundColor: u.progreso === 100 ? "#039B59" : u.progreso > 50 ? "#3658C1" : u.progreso > 0 ? "#DC8921" : "#C4C4C4",
|
|
1946
1947
|
borderRadius: "10px",
|
|
1947
1948
|
transition: "width 0.3s ease-in-out"
|
|
1948
1949
|
}
|
|
@@ -1958,11 +1959,11 @@ const Dt = () => {
|
|
|
1958
1959
|
Ue,
|
|
1959
1960
|
{
|
|
1960
1961
|
className: "avatar",
|
|
1961
|
-
label: (j = (q = (D =
|
|
1962
|
+
label: (j = (q = (D = u == null ? void 0 : u.campania) == null ? void 0 : D.responsable) == null ? void 0 : q.nombre) == null ? void 0 : j.charAt(0),
|
|
1962
1963
|
shape: "circle"
|
|
1963
1964
|
}
|
|
1964
1965
|
),
|
|
1965
|
-
/* @__PURE__ */ e("span", { style: { marginLeft: "8px", fontSize: "12px" }, children: (Q = (E =
|
|
1966
|
+
/* @__PURE__ */ e("span", { style: { marginLeft: "8px", fontSize: "12px" }, children: (Q = (E = u == null ? void 0 : u.campania) == null ? void 0 : E.responsable) == null ? void 0 : Q.nombre })
|
|
1966
1967
|
] }) })
|
|
1967
1968
|
] }, C);
|
|
1968
1969
|
}) })
|
|
@@ -2068,7 +2069,7 @@ const Dt = () => {
|
|
|
2068
2069
|
v(() => {
|
|
2069
2070
|
n("kanban");
|
|
2070
2071
|
}, [a]);
|
|
2071
|
-
const
|
|
2072
|
+
const m = (d) => ({
|
|
2072
2073
|
"kanban-general": "Kanban General",
|
|
2073
2074
|
"lista-campanias": "Campanias",
|
|
2074
2075
|
"kanban-campania": "Kanban de Campania"
|
|
@@ -2079,7 +2080,7 @@ const Dt = () => {
|
|
|
2079
2080
|
return /* @__PURE__ */ o("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: [
|
|
2080
2081
|
/* @__PURE__ */ o("div", { className: "w-full justify-between flex items-end border-b border-gray-200 pb-m px-l flex-wrap gap-l", children: [
|
|
2081
2082
|
/* @__PURE__ */ o("div", { className: "flex gap-xl", children: [
|
|
2082
|
-
/* @__PURE__ */ e("h2", { className: "text-texts font-medium", children:
|
|
2083
|
+
/* @__PURE__ */ e("h2", { className: "text-texts font-medium", children: m(a) }),
|
|
2083
2084
|
c.includes(a) && /* @__PURE__ */ e(
|
|
2084
2085
|
Ve,
|
|
2085
2086
|
{
|
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.10",
|
|
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",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"react-dom": "^18.3.1",
|
|
42
42
|
"react-hook-form": "^7.54.1",
|
|
43
43
|
"tailwind-scrollbar": "^3.1.0",
|
|
44
|
+
"tailwindcss-animate": "^1.0.7",
|
|
44
45
|
"vite-plugin-dts": "^4.4.0"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
@@ -77,5 +78,5 @@
|
|
|
77
78
|
"access": "public",
|
|
78
79
|
"registry": "https://registry.npmjs.org/@imjmedia"
|
|
79
80
|
},
|
|
80
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "cea43eed573bc804eaf440530f5ce9907feef273"
|
|
81
82
|
}
|