%PDF- %PDF-
Direktori : /home/opti/public_html/startup-life/assets/ |
Current File : /home/opti/public_html/startup-life/assets/view-team-fff0b2b1.js |
import{u as F,F as P,j as t,C as w,Q as h}from"./index-5492fbe1.js";import{D as k}from"./dashboard-page-layout-2cec2413.js";import{D}from"./dashboard-footer-navigation-f658b457.js";import{P as R}from"./index-4de96b18.js";import{c as S}from"./copy-to-clipboard-ddf9ebff.js";import{u as I}from"./index-9f8785a2.js";import{C as d}from"./index-2c4b8b3c.js";import{u as q}from"./useQuery-0abbcf43.js";import{u as A}from"./post-notification.api-d7cee9b0.js";import"./motion-4a110d9b.js";import"./Box-263f925f.js";import"./joinClasses-adfcc520.js";import"./isNativeReflectConstruct-061ae640.js";import"./setPrototypeOf-0bb37fbe.js";import"./assertThisInitialized-081f9914.js";const Y=()=>{var g,j,v;const i=F(),l=P(),x=l.team_type,{client:f,decoded:p}=I(),s=JSON.parse(localStorage.getItem("user")),{mutateAsync:N}=A();async function _(){var o;try{const r={type:"messaging",members:{$in:[p.user_id]}},n=[{last_message_at:-1}],m=(await f.queryChannels(r,n,{watch:!0,state:!0,limit:30})).filter(a=>a.id===l.id);return m.length>0?m[0]:[]}catch(r){return console.log(r),(o=r.response)==null?void 0:o.data}}const{data:e,isPending:y,isLoading:u,isError:b}=q({queryFn:_,queryKey:["fetch_channel",l.id],enabled:!!f&&!!p});console.log(e);const C=async()=>{if(confirm("Are you sure you want to delete this team?")){const o=await e.delete();console.log(o),h.success("Project Team Deleted Successfully"),l.team_type==="startup-team"?i("/build-team/my-teams/startup"):i("/build-team/my-teams/project")}},T=async()=>{var o,r;if(confirm("Are you sure you wnt to dissolve this Team?")){const n=await e.queryMembers({},{created_at:-1},{});console.log(n);let c=[];for(let a=0;a<n.members.length;a++)c=[...c,n.members[a].user_id];console.log(c);const m=await e.removeMembers([...c]);if(console.log(m),m){const a=await e.truncate({hard_delete:!0,skip_push:!1,message:{text:"Dear Everyone. The channel has been truncated.",user_id:p.user_id}});N({message:`${(o=a==null?void 0:a.channel)==null?void 0:o.name} channel has been dissolved. Project team members and conversations will be deleted, but the channel is still very much live..`,email:[s==null?void 0:s.email],to:[s==null?void 0:s.id],fullName:[`${s==null?void 0:s.firstName} ${s==null?void 0:s.lastName}`],channelId:(r=e==null?void 0:e.data)==null?void 0:r.id}).then(()=>{console.log(a),h.success("Project team members and conversations will be deleted, but the channel is still very much live."),l.team_type==="startup-team"?i("/build-team/my-teams/startup"):i("/build-team/my-teams/project")}).catch(E=>{console.log(E),h.error("error while creating notification")})}}};return console.log(e),t.jsxs(k,{children:[t.jsx(d,{appear:u,children:t.jsx(w,{})}),t.jsxs(d,{appear:!u&&y,children:[t.jsx(w,{})," Resolving..."]}),t.jsx(d,{appear:b,children:t.jsx("div",{className:"px-[40px]",children:"ERR_INTERNET_CONNECTION_REFUSED"})}),t.jsx(d,{appear:e&&!u&&!y&&!b,children:t.jsxs("section",{className:"px-5",children:[t.jsxs("div",{className:"flex justify-between items-center mt-3",children:[t.jsx("header",{onClick:()=>i(-1),className:"text-[#537473] capitalize text-lg font-semibold cursor-pointer",children:(g=e==null?void 0:e.data)==null?void 0:g.name}),t.jsx("button",{onClick:()=>S(window.location.href),className:"!p-0 !bg-transparent flex gap-x-3 items-center text-[#A8CF45] underline font-semibold",children:"Copy link"})]}),t.jsxs("div",{className:"flex flex-col justify-center items-center gap-y-5",children:[t.jsx("div",{className:"rounded-full overflow-hidden w-[293px] h-[293px]",children:t.jsx(R,{imgUrl:(e==null?void 0:e.Image)??"",name:((j=e==null?void 0:e.data)==null?void 0:j.name)??"",className:"!w-full !h-full"})}),t.jsxs("div",{className:"max-w-[491px] text-center",children:[t.jsx("p",{children:(v=e==null?void 0:e.data)==null?void 0:v.description}),t.jsxs("div",{className:"mt-5 space-y-5",children:[t.jsxs("button",{onClick:T,className:"bg-[#EFF0F6] font-bold capitalize text-black px-5 py-2 w-full max-w-[317px]",children:["End"," ",x==="project-team"?"Project Team":"Startup Team"]}),t.jsxs("button",{onClick:C,className:"bg-[#EFF0F6] font-bold capitalize text-black px-5 py-2 w-full max-w-[317px]",children:["Dissolve"," ",x==="project-team"?"Project Team":"Startup Team"]})]})]})]})]})}),t.jsx(D,{hideContinueBtn:!0,backBtnText:"Back",cancelEventHandler:()=>i(-1),rowReverse:!0})]})};export{Y as default};