%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/opti/www/startup-life/assets/
Upload File :
Create Path :
Current File : /home/opti/www/startup-life/assets/create-project-team-7035fcd0.js

import{u as E,r as d,j as e,Q as a}from"./index-5492fbe1.js";import{u as D}from"./index.esm-1be9f6a3.js";import{I as b}from"./index-fbb310b5.js";import{D as T}from"./dashboard-page-layout-2cec2413.js";import{F as R}from"./index-5e112d84.js";import{C as $}from"./index-935ad37b.js";import{b as V}from"./base64-converter-db95817a.js";import{C as N}from"./index-2c4b8b3c.js";import{C as k,r as z}from"./render-base64-img-23cb2682.js";import{u as K}from"./index-9f8785a2.js";import{u as L}from"./post-notification.api-d7cee9b0.js";import{v as M}from"./v4-4a60fe23.js";import"./Menu-c26e62ae.js";import"./useFormControl-45c447f9.js";import"./useForkRef-ff55d5c8.js";import"./TransitionGroupContext-29effe25.js";import"./setPrototypeOf-0bb37fbe.js";import"./Modal-01a2ce69.js";import"./useTheme-0dfa0cbc.js";import"./useSlotProps-b42d44e4.js";import"./index-e5978b8b.js";import"./Paper-26f2abc8.js";import"./useControlled-967f9278.js";import"./createSvgIcon-6a373a0a.js";import"./joinClasses-adfcc520.js";import"./motion-4a110d9b.js";import"./Box-263f925f.js";import"./FileIcon-23592c30.js";import"./styled-components.browser.esm-ee37ee23.js";import"./tslib.es6-ace8e431.js";import"./index.esm-b6fe913b.js";import"./iconBase-4b2ba95c.js";import"./Button-e32596e7.js";import"./ButtonBase-0400401d.js";import"./assertThisInitialized-081f9914.js";import"./isNativeReflectConstruct-061ae640.js";import"./useQuery-0abbcf43.js";const ve=()=>{const y={projectName:"",projectPurpose:"",image:""},C=E(),{control:f,handleSubmit:_,setValue:w}=D(y),{client:h,decoded:s}=K(),{mutateAsync:F}=L(),[I,g]=d.useState(!1),t=JSON.parse(localStorage.getItem("user")),P=async o=>{var x,j;const{projectName:r,projectPurpose:i,image:m}=o;if(!r||!i||!m){a.error("fill all input fields");return}try{g(!0);const p={type:"messaging",members:{$in:[s.user_id]}},A=[{last_message_at:-1}];if((await h.queryChannels(p,A,{watch:!0,state:!0,limit:30})).filter(u=>u.data.name===r).length>0){a.error("Team name already exist");return}const B=M(),l=h.channel("messaging","build_team_"+B,{name:r,Image:m??"",description:i,members:[s==null?void 0:s.user_id],private:!0,channelType:"build_team",identifier:"build_team"}),n=await l.watch();console.log("Channel created successfully:",n),F({message:`${(x=n==null?void 0:n.channel)==null?void 0:x.name} channel created successfully. Kindly proceed to add members.`,email:[t==null?void 0:t.email],to:[t==null?void 0:t.id],fullName:[`${t==null?void 0:t.firstName} ${t==null?void 0:t.lastName}`],channelId:(j=l==null?void 0:l.data)==null?void 0:j.id}).then(()=>{a.success("channel created successfully."),a.success("Note: that channel will not be recreated if channel name already exist."),g(!1),C("/build-team/my-teams/project")}).catch(u=>{console.log(u),a.error("error while creating notification")})}catch(p){console.error("Error creating channel:",p)}},v=d.useRef(null),[c,S]=d.useState("");return e.jsx(T,{children:e.jsx("section",{className:"px-5",children:e.jsxs("div",{children:[e.jsx("header",{className:"text-[#537473] text-2xl font-semibold",children:"New Team"}),e.jsxs("form",{onSubmit:_(P),className:"space-y-10 mt-10 max-w-lg",children:[e.jsx(b,{name:"projectName",label:"Project Name",control:f,rules:{}}),e.jsx(b,{name:"projectPurpose",label:"Purpose of Project",control:f,rules:{}}),e.jsx("p",{className:"!mb-0 text-[#404B7C] font-light",children:"Upload team Image (optional)"}),e.jsx(R,{name:"upload-picture",inputRef:v,handleFileChange:o=>{const r=o.target.files[0];console.log(r);const i=40;if(r){if(r.size>i*1024){console.log("processed"),a.error("Error: File size exceeds the allowed 40kb limit.");return}w("image",r),V({selectedFile:o.target.files[0],callback:m=>{S(m)}})}},component:e.jsxs("div",{className:"w-[204px] h-[204px] border border-[#BDBDBD] rounded-xl flex justify-center items-center",children:[e.jsx(N,{appear:!c,children:e.jsx(k,{color:"#A8CF45",className:"text-[#A8CF45] scale-150"})}),e.jsx(N,{appear:!!c,children:e.jsx("img",{src:z(c),className:"w-full h-full object-cover",alt:"image"})})]})}),e.jsx($,{loading:I,type:"submit",className:"!bg-[#A8CF45] text-white !py-4 w-full max-w-xs",children:"Add Team"})]})]})})})};export{ve as default};

Zerion Mini Shell 1.0