1import{jc as p,iZ as O,gT as e,ce as v,B as N,y as W,bN as L,bl as G,R as y,d4 as M,cL as T,hH as f,j8 as A,aS as $,eI as U,iU as R,g5 as H}from"./index-DfEzlclk.js";import{I as F}from"./image-plus-CNBNAU0d.js";import{G as V}from"./grid-2x2-1h6WD6JG.js";import{C as w}from"./CheckBoxMobile-BOVi-qDR.js";import{saveSharedTask as Z,editSharedTask as q}from"./utils-Qdz1axKP.js";import{D as z}from"./DeleteButtonMobile-83KagdUt.js";import{M as I}from"./ModalDeleteConfirm-XsWExhab.js";import"./circle-x-BVT64Xj0.js";const J=a=>[{value:"1",label:a("Puede ver")},{value:"2",label:a("Puede editar")},{value:"3",label:a("Acceso Total")},{value:"4",label:a("Eliminar")}];function K({shared:a,setStep:c,setUserSelect:n,creator:r}){const{t:x}=p(),m=O(),d=()=>{m(-1)},t=s=>{n(s),c("accessPermitted")},h=s=>{(r==null?void 0:r.id)!==(s==null?void 0:s.rel_id)&&t(s)};return e.jsx("div",{className:"flex h-full flex-col overflow-auto",children:e.jsx(v,{children:e.jsxs("div",{className:"flex flex-col gap-y-9",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 pt-1",children:[e.jsx(N,{onClick:d}),e.jsxs(W,{type:"button",className:"m-0 flex h-10 items-center justify-center gap-x-2 rounded-full border border-blancoBox bg-surface p-0 px-2 font-dm text-sm font-normal text-softBlack shadow-[0_0_4px_0_#00000033] hover:bg-surface",onClick:()=>c("share"),children:[e.jsx(L,{className:"h-6 min-h-6 w-6 min-w-6 text-softBlack",strokeWidth:1.5}),x("Invitar")]})]}),e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsx("div",{className:"flex h-12 items-center justify-start px-6 font-dm text-sm font-semibold text-slateGray",children:x("Usuarios con acceso")}),e.jsx("div",{className:"w-full border-[4px] border-b border-blancoForms"}),e.jsxs("div",{className:"flex min-h-12 items-center justify-between px-6 font-dm text-sm font-semibold text-slateGray",onClick:()=>c("guestsSelect"),children:[e.jsxs("div",{className:"flex items-center gap-x-4 font-dm text-sm font-normal text-slateGray",children:[e.jsx(G,{className:"h-6 min-h-6 w-6 min-w-6 text-softBlack",strokeWidth:1.5}),x("Solo los invitados")]}),e.jsx(y,{className:"h-5 min-h-5 w-5 min-w-5 text-softBlack",strokeWidth:2.5})]}),e.jsx("div",{className:"w-full border-[4px] border-b border-blancoForms"}),e.jsx("div",{className:"px-6",children:a==null?void 0:a.map((s,u)=>{var l;return e.jsxs("div",{className:"flex h-[93px] items-center gap-x-4 border-b border-blancoBox",onClick:()=>h(s),children:[e.jsx("div",{className:"h-10 min-h-10 w-10 min-w-10",children:s!=null&&s.rel_img&&(s==null?void 0:s.rel_img)!="N/A"?e.jsx("img",{src:s==null?void 0:s.rel_img,className:"h-full w-full rounded-full object-cover"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center rounded-full bg-blancoBox",children:e.jsx(F,{className:"h-5 w-5 text-softBlack",strokeWidth:1.2})})}),e.jsxs("div",{className:"flex flex-1 flex-col gap-y-1",children:[e.jsx("p",{className:"line-clamp-1 break-all font-dm text-sm font-semibold text-softBlack",children:s==null?void 0:s.rel_name}),e.jsx("p",{className:"font-dm text-xs font-normal text-slateGray",children:((l=J(x).find(i=>i.value===(s==null?void 0:s.type_access)))==null?void 0:l.label)||x("Dueño")})]}),(r==null?void 0:r.id)!==(s==null?void 0:s.rel_id)&&e.jsx(y,{className:"h-5 min-h-5 w-5 min-w-5 text-softBlack",strokeWidth:2.5})]},u)})})]})]})})})}const Q=a=>[{value:1,label:a("Usuarios"),description:a("Comparte con un usuario en especÃfico"),icon:M},{value:2,label:a("Puestos"),description:a("Comparte con un puesto completo"),icon:T},{value:3,label:a("Ãreas"),description:a("Comparte con un área completa"),icon:V}];function X({setStep:a,setStepShare:c,setSelectedValue:n}){var d;const{t:r}=p(),x=()=>{a("main")},m=t=>{n(t),c("select")};return e.jsx("div",{className:"flex h-full flex-col overflow-auto",children:e.jsx(v,{children:e.jsxs("div",{className:"flex flex-col gap-y-6",children:[e.jsx("div",{className:"flex items-center justify-between px-6 pt-1",children:e.jsx(N,{onClick:x})}),e.jsx("div",{className:"px-6",children:(d=Q(r))==null?void 0:d.map((t,h)=>e.jsxs("div",{className:"flex h-[93px] items-center gap-x-4 border-b border-blancoBox",onClick:()=>m(t==null?void 0:t.value),children:[e.jsx("div",{className:"flex h-10 min-h-10 w-10 min-w-10 items-center justify-center rounded border border-blancoBox",children:e.jsx(t.icon,{className:"h-6 min-h-6 w-6 min-w-6 text-softBlack",strokeWidth:1.3})}),e.jsxs("div",{className:"flex flex-1 flex-col gap-y-1",children:[e.jsx("p",{className:"line-clamp-1 break-all font-dm text-sm font-semibold text-softBlack",children:t==null?void 0:t.label}),e.jsx("p",{className:"font-dm text-xs font-normal text-slateGray",children:t==null?void 0:t.description})]}),e.jsx(y,{className:"h-5 min-h-5 w-5 min-w-5 text-softBlack",strokeWidth:2.5})]},h))})]})})})}function Y({selectedValue:a,users:c,positions:n,areas:r,setStepShare:x,setSelectedUsers:m}){const[d,t]=f.useState(c);f.useEffect(()=>{switch(Number(a)){case 1:t(c);break;case 2:t(n);break;case 3:t(r);break}},[a]);const h=s=>{m(s),x("permission")};return e.jsx("div",{className:"flex h-full flex-col overflow-auto",children:e.jsx(v,{children:e.jsxs("div",{className:"flex flex-col gap-y-6",children:[e.jsx("div",{className:"flex items-center justify-between px-6 pt-1",children:e.jsx(N,{onClick:()=>x("user")})}),e.jsx("div",{className:"px-6",children:d==null?void 0:d.map((s,u)=>e.jsxs("div",{className:"flex h-[93px] items-center gap-x-4 border-b border-blancoBox",onClick:()=>h(s),children:[a==1?e.jsx("div",{className:"flex h-10 min-h-10 w-10 min-w-10",children:s!=null&&s.user_image?e.jsx("img",{src:s==null?void 0:s.user_image,className:"h-full w-full rounded-full object-cover"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center rounded-full bg-blancoBox",children:e.jsx(F,{className:"h-5 w-5 text-softBlack",strokeWidth:1.2})})}):e.jsx("div",{className:"flex h-10 min-h-10 w-10 min-w-10 items-center justify-center rounded-full bg-blancoBox"}),e.jsx("div",{className:"flex flex-1 items-center",children:e.jsxs("p",{className:"line-clamp-1 break-all font-dm text-sm font-semibold text-softBlack",children:[a==1&&(s==null?void 0:s.name)+" "+(s==null?void 0:s.last_name),a==2&&(s==null?void 0:s.position_name),a==3&&(s==null?void 0:s.nombre)]})}),e.jsx(y,{className:"h-5 min-h-5 w-5 min-w-5 text-softBlack",strokeWidth:2.5})]},u))})]})})})}const ee=a=>[{value:1,label:a("Puede Ver"),description:a("Solo acceso a ver actividades y estadÃsitcas")},{value:2,label:a("Puede Editar"),description:a("Puede editar, agregar actividades y ver estadÃsitcas")}];function se({setStepShare:a,selectedValue:c,selectedUsers:n,id:r,setStep:x}){var l;const{t:m}=p(),[d,t]=f.useState(!1),[h,s]=f.useState(""),u=i=>{var j,g;if(d)return;t(!0);const o=new FormData;o.append("task_id",r),o.append("type_share",c),o.append("type_access",i),o.append("rel_id",n==null?void 0:n.id),(g=(j=Z(o))==null?void 0:j.then(()=>{x("main")}))==null||g.finally(()=>{t(!1)})};return e.jsx("div",{className:"flex h-full flex-col overflow-auto",children:e.jsx(v,{children:e.jsxs("div",{className:"flex flex-col gap-y-6",children:[e.jsx("div",{className:"flex items-center justify-between px-6 pt-1",children:e.jsx(N,{onClick:()=>a("select")})}),e.jsx("div",{className:"px-6",children:(l=ee(m))==null?void 0:l.map((i,o)=>e.jsxs("div",{className:"flex h-[93px] items-center gap-x-4 border-b border-blancoBox",children:[e.jsx(w,{checked:i.value==h,onChange:j=>{j&&(s(i.value),u(i.value))},disabled:d}),e.jsxs("div",{className:"flex flex-1 flex-col gap-y-1",children:[e.jsx("p",{className:"line-clamp-1 break-all font-dm text-sm font-semibold text-softBlack",children:i==null?void 0:i.label}),e.jsx("p",{className:"font-dm text-xs font-normal text-slateGray",children:i==null?void 0:i.description})]})]},o))})]})})})}function ae({step:a,setStep:c,users:n,positions:r,areas:x,id:m}){const[d,t]=f.useState("user"),[h,s]=f.useState(1),[u,l]=f.useState([]);return f.useEffect(()=>{a=="main"&&t("user")},[c]),e.jsx(f.Fragment,{children:d==="user"?e.jsx(X,{setStep:c,setStepShare:t,setSelectedValue:s}):d==="select"?e.jsx(Y,{selectedValue:h,setStepShare:t,users:n,positions:r,areas:x,setSelectedUsers:l}):d==="permission"&&e.jsx(se,{id:m,setStepShare:t,selectedUsers:u,selectedValue:h,setStep:c})})}const le=a=>[{value:1,label:a("Puede Ver"),description:a("Solo acceso a ver actividades y estadÃsitcas")},{value:2,label:a("Puede Editar"),description:a("Puede editar, agregar actividades y ver estadÃsitcas")},{value:3,label:a("Acceso total"),description:a("Comparte con usuarios seleccionados")}];function ce({setStep:a,userSelect:c}
1){var u;const{t:n}=p(),[r,x]=f.useState(!1),[m,d]=f.useState(!1),[t,h]=f.useState(c==null?void 0:c.type_access),s=l=>{var o,j;if(r)return;x(!0);const i=new FormData;i.append("id",c.id),i.append("type_access",l),(j=(o=q(i))==null?void 0:o.then(()=>{a("main")}))==null||j.finally(()=>{x(!1)})};return e.jsxs("div",{className:"flex h-full flex-col overflow-auto",children:[e.jsx(I,{modal:m,setModal:d,id:c.id,title:n("Eliminar acceso"),name:(c==null?void 0:c.rel_name)||"",handleConfirm:()=>s("4"),isLoading:r}),e.jsx(v,{children:e.jsxs("div",{className:"flex flex-col gap-y-6",children:[e.jsx("div",{className:"flex items-center justify-between px-6 pt-1",children:e.jsx(N,{onClick:()=>a("main")})}),e.jsxs("div",{className:"flex flex-col gap-y-4 px-6",children:[e.jsx("h2",{className:"font-dm text-sm font-semibold text-softBlack",children:n("Acceso permitido")}),e.jsxs("div",{className:"flex flex-col gap-y-4",children:[e.jsx("div",{children:(u=le(n))==null?void 0:u.map((l,i)=>e.jsxs("div",{className:"flex h-[93px] items-center gap-x-4 border-b border-blancoBox",children:[e.jsx(w,{checked:l.value==t,disabled:r,onChange:o=>{o&&(h(l.value),s(l.value))}}),e.jsxs("div",{className:"flex flex-1 flex-col gap-y-1",children:[e.jsx("p",{className:"line-clamp-1 break-all font-dm text-sm font-semibold text-softBlack",children:l==null?void 0:l.label}),e.jsx("p",{className:"font-dm text-xs font-normal text-slateGray",children:l==null?void 0:l.description})]})]},i))}),e.jsx(z,{onClick:()=>d(!0)})]})]})]})})]})}const te=a=>[{value:"invited",label:a("Solo los invitados"),description:a("Comparte con usuarios seleccionados"),icon:G},{value:"all",label:a("Todos los usuarios"),description:a("Disponible para todos los usuarios"),icon:$}],ie=a=>[{value:"show",label:a("Ver")},{value:"edit",label:a("Editar")}];function de({setStep:a,id:c}){var s,u;const{t:n}=p();A();const[r,x]=f.useState(!1),[m,d]=f.useState("invited"),[t,h]=f.useState("");return e.jsx("div",{className:"flex h-full flex-col overflow-auto",children:e.jsx(v,{children:e.jsxs("div",{className:"flex flex-col gap-y-6",children:[e.jsx("div",{className:"flex items-center justify-between px-6 pt-1",children:e.jsx(N,{onClick:()=>a("main")})}),e.jsxs("div",{className:"flex flex-col gap-y-4 px-6",children:[e.jsx("h2",{className:"font-dm text-sm font-semibold text-softBlack",children:n("Acceso permitido")}),e.jsxs("div",{className:"flex flex-col gap-y-10",children:[e.jsx("div",{children:(s=te(n))==null?void 0:s.map((l,i)=>e.jsxs("div",{className:"flex h-[93px] items-center gap-x-4 border-b border-blancoBox",children:[e.jsx(l.icon,{className:"h-6 w-6 text-softBlack",strokeWidth:1.3}),e.jsxs("div",{className:"flex flex-1 flex-col gap-y-1",children:[e.jsx("p",{className:"line-clamp-1 break-all font-dm text-sm font-semibold text-softBlack",children:l==null?void 0:l.label}),e.jsx("p",{className:"font-dm text-xs font-normal text-slateGray",children:l==null?void 0:l.description})]}),e.jsx(w,{checked:l.value==m,onChange:o=>{o&&d(l.value)}})]},i))}),m=="all"&&e.jsxs("div",{className:"px-2",children:[e.jsx("p",{className:"font-dm text-[13px] font-semibold text-softBlack",children:n("Acciones Permitidas")}),(u=ie(n))==null?void 0:u.map((l,i)=>e.jsxs("div",{className:"flex h-[50px] items-center gap-x-4 border-b border-blancoBox",children:[e.jsx("div",{className:"flex flex-1 flex-col gap-y-1",children:e.jsx("p",{className:"line-clamp-1 break-all font-dm text-xs font-semibold text-softBlack",children:l==null?void 0:l.label})}),e.jsx(w,{checked:l.value==t,onChange:o=>{o&&h(l.value)}})]},i))]})]})]})]})})})}function be({}){var l,i,o,j,g,B,S,C,_;const a=U(),{project:c,users:n,areas:r,positions:x}=R(),[m,d]=f.useState("main"),[t,h]=f.useState({}),[s,u]=f.useState(c);return f.useEffect(()=>{var P,D;u(c),a.subscribe(`private-pm-get-project.${(D=(P=c==null?void 0:c.data)==null?void 0:P.project)==null?void 0:D.id}`).bind("fill-pm-project",({project:b})=>{E(b)});async function E(b){const k=await H(b);u(k)}return()=>{var b,k;a.unsubscribe(`private-pm-get-project.${(k=(b=c==null?void 0:c.data)==null?void 0:b.project)==null?void 0:k.id}`)}},[]),e.jsx("div",{className:"relative flex h-full w-full flex-col gap-2 bg-[linear-gradient(0deg,#FFFFFF_90%,rgba(206,252,252,0.5)_100%)] pt-[calc(2.75rem+var(--sat,0px))] dark:bg-none",children:m==="main"?e.jsx(K,{id:(i=(l=s==null?void 0:s.data)==null?void 0:l.project)==null?void 0:i.id,shared:(o=s==null?void 0:s.data)==null?void 0:o.shared,setStep:d,setUserSelect:h,creator:(g=(j=s==null?void 0:s.data)==null?void 0:j.project)==null?void 0:g.creator}):m==="share"?e.jsx(ae,{step:m,setStep:d,users:n.data,positions:x.data,areas:r.data,id:(S=(B=s==null?void 0:s.data)==null?void 0:B.project)==null?void 0:S.id}):m==="accessPermitted"?e.jsx(ce,{setStep:d,userSelect:t}):m==="guestsSelect"&&e.jsx(de,{id:(_=(C=s==null?void 0:s.data)==null?void 0:C.project)==null?void 0:_.id,setStep:d})})}export{be as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.