%PDF- %PDF-
Direktori : /home/opti/www/startup-life/assets/ |
Current File : /home/opti/www/startup-life/assets/index-3d3d5ecc.js |
import{r as c,u as U,e as k,Q as p,j as e,C as D,J as Q}from"./index-5492fbe1.js";import{s as R}from"./styled-components.browser.esm-ee37ee23.js";import{C as P}from"./JobAvatar-8acabbf6.js";import{S as W}from"./index-9063cbde.js";import{M as q}from"./index.esm-41e7e6ec.js";import{u as K}from"./index-9f8785a2.js";import{u as X}from"./get-all-startuplife-users.api-644aad92.js";import{C as Y}from"./index-2c4b8b3c.js";import{u as ee}from"./update-stream-user.api-f76bb8dc.js";import{u as te}from"./post-notification.api-d7cee9b0.js";import{B as a}from"./Box-263f925f.js";import{G as H}from"./Grid-edacc4c9.js";import"./tslib.es6-ace8e431.js";import"./index-935ad37b.js";import"./Button-e32596e7.js";import"./ButtonBase-0400401d.js";import"./assertThisInitialized-081f9914.js";import"./TransitionGroupContext-29effe25.js";import"./setPrototypeOf-0bb37fbe.js";import"./useForkRef-ff55d5c8.js";import"./Success-380da55b.js";import"./Modal-01a2ce69.js";import"./useTheme-0dfa0cbc.js";import"./useSlotProps-b42d44e4.js";import"./Paper-26f2abc8.js";import"./iconBase-4b2ba95c.js";import"./isNativeReflectConstruct-061ae640.js";import"./useQuery-0abbcf43.js";const G=R.div` position: relative; .pageContain { padding-left: 1.94rem !important; padding-top: 1rem; padding-right: 3.25rem; padding-bottom: 15rem; } .Page-Title { color: var(--Secondary, #537473); font-size: 1.5rem; font-style: normal; font-weight: 600; line-height: normal; padding-bottom: 1.75rem; } .Text-subhead { font-size: 1.5rem; font-weight: 700; line-height: 1.6875rem; } .CompanyName { color: var(--Grey-2, #C5C5C5); font-size: 0.9375rem; font-style: normal; font-weight: 500; line-height: 1rem; letter-spacing: -0.0375rem; margin-bottom: .25rem } .JobTitle { color: var(--dark-icon, #121212); font-size: 1.125rem; font-style: normal; font-weight: 600; line-height: 1rem; letter-spacing: -0.045rem; } .JobDesc { text-align: justify; font-weight: 500; line-height: 1.34375rem; letter-spacing: -0.04rem; margin-bottom: 1.2rem; } .iconContain { width: 2.025rem; height: 2.025rem; display: flex; justify-content: center; align-items: center; border-radius: 100%; border: 1px solid var(--Grey1, #828282); cursor: pointer; } `,w={padding:".62rem",borderRadius:"0.9375rem",background:"#E0E0E0",fontSize:".85rem",fontWeight:500,lineHeight:"1rem",color:"#333"},se=o=>c.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o},c.createElement("path",{d:"M1.6724 14.3289H2.54257L12.0351 4.84455L11.1567 3.96613L1.6724 13.4587V14.3289ZM14.1007 4.14446L11.8568 1.90058L12.7628 0.994575C12.948 0.809316 13.1791 0.718891 13.4559 0.723298C13.7328 0.727691 13.9653 0.824006 14.1535 1.01224L15.0105 1.8692C15.1932 2.05192 15.2846 2.2795 15.2846 2.55194C15.2846 2.82438 15.1907 3.05444 15.003 3.24213L14.1007 4.14446ZM1.32445 15.303C1.1455 15.303 0.996393 15.2434 0.877133 15.1242C0.757872 15.005 0.698242 14.856 0.698242 14.6772V13.3098C0.698242 13.2285 0.712552 13.1535 0.741173 13.0847C0.769793 13.0159 0.817123 12.9457 0.883164 12.8742L11.1782 2.58744L13.4138 4.82308L3.12707 15.1181C3.05552 15.1841 2.98379 15.2315 2.91188 15.2601C2.83997 15.2887 2.76695 15.303 2.69281 15.303H1.32445ZM11.5959 4.39708L11.1567 3.96613L12.0351 4.84455L11.5959 4.39708Z",fill:"black"})),ae=o=>c.createElement("svg",{width:14,height:16,viewBox:"0 0 14 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o},c.createElement("path",{d:"M2.84318 15.303C2.50359 15.303 2.21113 15.1804 1.96577 14.935C1.72042 14.6896 1.59775 14.3972 1.59775 14.0576V2.30899H1.21081C1.07175 2.30899 0.955338 2.26174 0.861591 2.16723C0.767828 2.07272 0.720947 1.95537 0.720947 1.8152C0.720947 1.67501 0.767828 1.55897 0.861591 1.46708C0.955338 1.3752 1.07175 1.32926 1.21081 1.32926H4.41407C4.41407 1.15877 4.4734 1.01514 4.59206 0.898349C4.71072 0.781546 4.85343 0.723145 5.02018 0.723145H9.37423C9.54097 0.723145 9.68368 0.782474 9.80236 0.901134C9.92102 1.01981 9.98035 1.16252 9.98035 1.32926H13.1836C13.3227 1.32926 13.4391 1.37651 13.5328 1.47103C13.6266 1.56552 13.6735 1.68286 13.6735 1.82305C13.6735 1.96324 13.6266 2.07928 13.5328 2.17115C13.4391 2.26305 13.3227 2.30899 13.1836 2.30899H12.7967V14.0576C12.7967 14.3972 12.674 14.6896 12.4286 14.935C12.1833 15.1804 11.8908 15.303 11.5512 15.303H2.84318ZM11.817 2.30899H2.57746V14.0576C2.57746 14.1351 2.60375 14.1987 2.65634 14.2486C2.70894 14.2984 2.77122 14.3233 2.84318 14.3233H11.5512C11.6232 14.3233 11.6855 14.2984 11.7381 14.2486C11.7907 14.1987 11.817 14.1351 11.817 14.0576V2.30899ZM5.06504 12.5H6.04475V4.11072H5.06504V12.5ZM8.34966 12.5H9.32937V4.11072H8.34966V12.5Z",fill:"black"})),ie=()=>{const o=U(),[J,b]=c.useState(!1),[f,$]=c.useState([]),{client:j,decoded:r}=K(),{data:h}=X(),C=JSON.parse(localStorage.getItem("user")),{mutateAsync:_}=te(),{mutateAsync:N}=ee();c.useEffect(()=>{s()},[]);const s=async()=>{b(!0),await k.get("https://startuplife.api.cube700.net/api/v1/job").then(t=>{var l;console.log(t),b(!1),$((l=t==null?void 0:t.data)==null?void 0:l.data)}).catch(()=>{p.error("error fetching jobs!")})},n=async(t,l)=>{var g;try{const i=(g=h==null?void 0:h.data)==null?void 0:g.filter(y=>y.email===t)[0];console.log(i.id.toString()),console.log(r.user_id);const m=i.id.toString();N({userId:m}).then(async y=>{var A,I,E,V,B,Z;const L={type:"messaging",members:{$in:[r.user_id]}},S=[{last_message_at:-1}],v=await j.queryChannels(L,S,{watch:!0,state:!0,limit:30});console.log(m),console.log(r.user_id),console.log(v);const u=v.filter(x=>x.id.includes(r==null?void 0:r.user_id)&&x.id.includes(m)&&x.id.includes("chat_with_profile_user"));if(console.log(u),u.length>0){p.success("you will be redirected to the previous chat channel established with this user");const z=await(await j.channel("messaging",(I=(A=u[0])==null?void 0:A.data)==null?void 0:I.id,{name:(E=u==null?void 0:u.data)==null?void 0:E.name,private:!0})).watch();console.log(z),o(`/startup-messaging-channel/${z.channel.id}`);return}const M=await j.channel("messaging","chat_with_profile_user_"+m+"_"+r.user_id,{name:i.email,Image:"",members:[r.user_id],private:!0,channelType:"chat_with_profile_user"}),d=await M.watch(),F=await j.channel("messaging",(V=d==null?void 0:d.channel)==null?void 0:V.id,{name:(B=d==null?void 0:d.channel)==null?void 0:B.name});let T=[];for(const x in y.users)T=[...T,y.users[parseInt(x)].id];const O=await F.addMembers([...T]);console.log(O),console.log("Channel created successfully:",d),console.log(d),_({message:`${C==null?void 0:C.email} sent you message regarding the ${l} job you posted.`,email:[i==null?void 0:i.email],to:[m],fullName:[`${i==null?void 0:i.firstName} ${i==null?void 0:i.lastName}`],channelId:(Z=M==null?void 0:M.data)==null?void 0:Z.id}).then(()=>{p.success("private channel created successfully."),p.success("Note: that channel will not be recreated if channel name already exist."),o(`/startup-messaging-channel/${d.channel.id}`)}).catch(x=>{console.log(x),p.error("error while creating channel")})}).catch(()=>{p.error("error messaging job poster")})}catch(i){console.error("Error creating channel:",i)}};return e.jsx(G,{children:e.jsxs("div",{className:"pageContain",children:[e.jsx("h2",{className:"Page-Title",children:"Available Opportunities"}),e.jsx(a,{sx:{paddingTop:"40px"},children:J?e.jsx(a,{sx:{width:"100%",minHeight:"60vh",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(D,{size:30})}):e.jsx(a,{children:e.jsx(H,{container:!0,spacing:4,children:f==null?void 0:f.sort((t,l)=>t.id-l.id).map(t=>{var l,g,i;return e.jsxs(H,{item:!0,xs:12,md:10,sx:{mb:"3.65rem",ml:"4.94rem"},children:[e.jsxs(a,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:".56rem"},children:[e.jsxs(a,{sx:{display:"flex",gap:".94rem",cursor:"pointer"},onClick:()=>o(`/job-board/${t.id}`),children:[e.jsx("img",{src:P,alt:"logo"}),e.jsxs(a,{children:[e.jsx("p",{className:"CompanyName",children:t.company}),e.jsx("p",{className:"JobTitle",children:t.title})]})]}),e.jsx(Y,{appear:(r==null?void 0:r.user_id)!==((l=h==null?void 0:h.data)==null?void 0:l.filter(m=>m.email===t.email)[0].id),children:e.jsx(a,{sx:{display:"flex",alignItems:"center",gap:".94rem"},children:e.jsx("div",{className:"iconContain",onClick:()=>n(t.email,t.title),children:e.jsx(q,{})})})})]}),e.jsx(a,{sx:{cursor:"pointer"},onClick:()=>o(`/job-board/${t.id}`),children:e.jsx("p",{className:"JobDesc",children:t.description})}),e.jsxs(a,{sx:{display:"flex",gap:".94rem",cursor:"pointer"},onClick:()=>o(`/job-board/${t.id}`),children:[e.jsx(a,{sx:w,children:(g=t.employmentType)==null?void 0:g.replaceAll("_"," ")}),e.jsx(a,{sx:w,children:(i=t.type)==null?void 0:i.replaceAll("_"," ")}),t.salary&&e.jsxs(a,{sx:w,children:["₦",t.salary," per month"]})]})]},t.id)})})})})]})})},ke=()=>{const o=U(),[J,b]=c.useState(!1),[f,$]=c.useState([]),[j,r]=c.useState(null),[h,C]=c.useState(!1);c.useEffect(()=>{N()},[]);const _=async s=>{console.log(Q+`/${s}`),C(!0),await k.delete(`https://startuplife.api.cube700.net/api/v1/job/user-listed-jobs/${s}`).then(n=>{var t;console.log(n),C(!1),N(),r(null),p.success((t=n.data)==null?void 0:t.message)}).catch(n=>{var t,l,g,i,m,y,L,S,v;console.log("working"),C(!1),(l=(t=n.response)==null?void 0:t.data)!=null&&l.message&&(typeof((i=(g=n.response)==null?void 0:g.data)==null?void 0:i.message)=="string"?p.error((y=(m=n.response)==null?void 0:m.data)==null?void 0:y.message):(v=(S=(L=n.response)==null?void 0:L.data)==null?void 0:S.message)==null||v.map(u=>{p.error(u)}))})},N=async()=>{b(!0),await k.get("https://startuplife.api.cube700.net/api/v1/job/user-listed-jobs").then(s=>{var n;console.log(s),b(!1),$((n=s==null?void 0:s.data)==null?void 0:n.data)}).catch(()=>{})};return e.jsx(e.Fragment,{children:e.jsxs(G,{children:[e.jsx(W,{open:j!==null,handleClose:()=>r(null),infoText:"Are you sure you want to delete this job?",btntext1:"Delete",btntext2:"Cancel",btnFunc1:_,btnFunc2:()=>r(null),isLoading:h}),e.jsxs("div",{className:"pageContain",children:[e.jsx("h2",{className:"Page-Title",children:"My Published Jobs"}),e.jsx(a,{sx:{paddingTop:"2.94rem"},children:J?e.jsx(a,{sx:{width:"100%",minHeight:"60vh",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(D,{size:30})}):e.jsx(a,{children:e.jsx(H,{container:!0,spacing:4,children:f==null?void 0:f.sort((s,n)=>n.id-s.id).map(s=>{var n,t;return e.jsxs(H,{item:!0,xs:12,md:10,sx:{mb:"3.65rem",ml:"4.94rem"},children:[e.jsxs(a,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(a,{sx:{display:"flex",gap:".94rem",cursor:"pointer"},onClick:()=>o(`/job-board/${s.id}`),children:[e.jsx("img",{src:P,alt:"logo"}),e.jsxs(a,{children:[e.jsx("p",{className:"CompanyName",children:s.company}),e.jsx("p",{className:"JobTitle",children:s.title})]})]}),e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:".94rem"},children:[e.jsx("div",{className:"iconContain",onClick:()=>_(s.id),children:e.jsx(ae,{})}),e.jsx("div",{className:"iconContain",onClick:()=>o(`/edit-job/${s.id}`),children:e.jsx(se,{})})]})]}),e.jsx(a,{sx:{cursor:"pointer"},onClick:()=>o(`/job-board/${s.id}`),children:e.jsx("p",{className:"JobDesc",children:s.description})}),e.jsxs(a,{sx:{display:"flex",gap:".94rem",cursor:"pointer"},onClick:()=>o(`/job-board/${s.id}`),children:[e.jsx(a,{sx:w,children:(n=s.employmentType)==null?void 0:n.replaceAll("_"," ")}),e.jsx(a,{sx:w,children:(t=s.type)==null?void 0:t.replaceAll("_"," ")}),s.salary&&e.jsxs(a,{sx:w,children:["₦",s.salary," per month"]})]})]},s.id)})})})}),e.jsx(ie,{})]})]})})};export{ke as default};