%PDF- %PDF-
Direktori : /home/opti/www/startup-life/assets/ |
Current File : /home/opti/www/startup-life/assets/view-fundraising-campaign-f5ba10e9.js |
import{e as p,d as F,u as w,r as f,j as e,Q as N,F as C}from"./index-5492fbe1.js";import{u as E}from"./useQuery-0abbcf43.js";import{S}from"./FileIcon-23592c30.js";import{a as A}from"./index.esm-c5b2c2cb.js";import{C as i}from"./index-2c4b8b3c.js";import{M as I}from"./index-2496c884.js";import{u as k}from"./useToggle-85ca1b00.js";import{B as a}from"./Button-e32596e7.js";import{B as T}from"./Box-263f925f.js";import"./iconBase-4b2ba95c.js";import"./Modal-01a2ce69.js";import"./useTheme-0dfa0cbc.js";import"./useForkRef-ff55d5c8.js";import"./TransitionGroupContext-29effe25.js";import"./setPrototypeOf-0bb37fbe.js";import"./useSlotProps-b42d44e4.js";import"./ButtonBase-0400401d.js";import"./assertThisInitialized-081f9914.js";const q=({id:s})=>E({queryFn:async()=>{var d;try{return(await p.get(`/raise-fund/${s}`)).data}catch(t){return(d=t.response)==null?void 0:d.data}},queryKey:["GET_SINGLE_FUNDRAISING_CAMPAIGN",s]}),M=s=>F({mutationFn:async d=>{var t;try{return(await p.post(`/raise-fund/fund-campaign/${s}`,d)).data}catch(o){return(t=o.response)==null?void 0:t.data}}}),O=({campaign:s})=>{var c,m,j,b;const l=w(),r=JSON.parse(localStorage.getItem("user")),[d,t]=k(!1),[o,h]=f.useState(""),{isPending:u,mutateAsync:v}=M(s==null?void 0:s.id);console.log(s);const y=()=>{v({amount:o}).then(n=>{console.log(n),n.data.message==="success"&&(N.success("You will be redirected to fund campaign"),setTimeout(()=>{window.open(n.info.authorization_url,"_blank")},3e3))})},x=f.useMemo(()=>{var n;if(!(!s||!r))return((n=s==null?void 0:s.created_by)==null?void 0:n.id)===(r==null?void 0:r.id)},[r,s]);return console.log(x),e.jsxs("div",{className:"flex w-full justify-between",children:[e.jsxs("div",{className:"bg-white max-w-[761px] w-full space-y-5 p-4",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("h4",{className:"font-bold text-[#537473]",children:"Funding in exchange for equity"}),e.jsx("p",{children:"4-20-2023"})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-dashed border-[#E0E0E0]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"",children:"My startup"}),e.jsx("h4",{className:"font-bold text-[#212121] mt-1",children:(c=s==null?void 0:s.startup)==null?void 0:c.name})]}),e.jsxs("div",{className:"text-end",children:[e.jsx("p",{children:"Valuation"}),e.jsx("h4",{className:"text-[#212121] font-bold mt-1 ",children:s==null?void 0:s.valuation})]})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-dashed border-[#E0E0E0]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"",children:"Owner"}),e.jsx("h4",{className:"font-bold text-[#212121] mt-1"})]}),e.jsxs("div",{className:"text-end font-[600]",children:[e.jsx("p",{children:(m=s==null?void 0:s.created_by)==null?void 0:m.email}),e.jsxs("p",{children:[(j=s==null?void 0:s.created_by)==null?void 0:j.firstName," ",(b=s==null?void 0:s.created_by)==null?void 0:b.lastName]})]})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-dashed border-[#E0E0E0]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"",children:"Total number of shares"}),e.jsx("h4",{className:"font-bold text-[#212121] mt-1",children:s==null?void 0:s.total_number_of_shares})]}),e.jsxs("div",{className:"text-end",children:[e.jsx("p",{children:"Number of shares to be sold"}),e.jsxs("h4",{className:"text-[#212121] font-bold mt-1 ",children:[" ",s==null?void 0:s.number_of_shared_to_be_sold]})]})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-dashed border-[#E0E0E0]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"",children:"Minimum Investment per investor"}),e.jsxs("h4",{className:"font-bold text-[#212121] mt-1",children:[" ",s==null?void 0:s.minimum_investment_per_investor]})]}),e.jsxs("div",{className:"text-end",children:[e.jsx("p",{children:"Purpose"}),e.jsx("h4",{className:"text-[#212121] font-bold mt-1 ",children:s==null?void 0:s.purpose})]})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 ",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"",children:"Price per share"}),e.jsx("h4",{className:"font-bold text-[#A8CF45] mt-1",children:s==null?void 0:s.price_per_share})]}),e.jsxs("div",{className:"text-end",children:[e.jsx("p",{children:"Minimum shares to be taken up"}),e.jsx("h4",{className:"text-[#A8CF45] font-bold mt-1 ",children:s==null?void 0:s.minimum_shares_taken_up})]})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 ",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"",children:"Percentage of Shares to be Sold"}),e.jsxs("h4",{className:"font-bold text-[#A8CF45] mt-1",children:[s==null?void 0:s.percentageOfSharesTakenUp,"%"]})]}),e.jsxs("div",{className:"text-end",children:[e.jsx("p",{children:"Fundraising Target"}),e.jsx("h4",{className:"text-[#A8CF45] font-bold mt-1 ",children:s==null?void 0:s.value_of_shares_to_be_sold})]})]})]}),e.jsxs("div",{className:"flex-1 max-w-[450px]",children:[e.jsxs("div",{className:" bg-white p-3",children:[e.jsx("h2",{className:"font-bold text-[#537473]",children:"Uploaded Documents"}),Array(3).fill(null).map((n,_)=>e.jsxs("div",{className:"flex items-center gap-x-3 mt-4",children:[e.jsx(S,{}),e.jsxs("div",{children:[e.jsx("p",{children:"Pitch deck"}),e.jsx("p",{className:"text-xs",children:"jpg,png 2mb"})]}),e.jsx(A,{className:"text-green-500"})]},_))]}),e.jsx(i,{appear:!!x,children:e.jsx(a,{type:"button",className:"!bg-[#A8CF45]",fullWidth:!0,onClick:()=>{l(`/fundraising-campaign/edit-campaign/${s.id}`)},variant:"contained",children:"Edit"})}),e.jsx(i,{appear:!x,children:e.jsx(a,{type:"button",className:"!bg-[#A8CF45]",fullWidth:!0,disabled:!!u,onClick:t,variant:"contained",children:u?"Funding":"Fund This StartUp"})})]}),e.jsx(I,{isOpen:d,handleIsOpen:t,children:e.jsxs("div",{className:"bg-white p-[20px] rounded-[10px]",children:[e.jsx("div",{className:"font-[600] text-[1.2rem] text-center mb-[20px]",children:"You will be redirected to fund this campaign"}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"amount",children:"Enter amount"}),e.jsx("input",{onChange:n=>h(n.target.value),name:"amount",type:"number",className:"border-[2px] border-gray-400 block mt-[5px] p-[10px] w-full rounded-[10px] mb-[10px]"})]}),e.jsx(a,{type:"button",className:"!bg-[#A8CF45]",fullWidth:!0,onClick:()=>{if(o===""){N.error("Input cannot be empty");return}t(),y()},variant:"contained",children:"Fund Campaign"})]})})]})},g=()=>{const s=C(),{data:l,isLoading:r,isError:d}=q({id:s.id}),t=l==null?void 0:l.data;return console.log(t),e.jsxs(T,{pl:"1.94rem",pt:"1rem",pr:"3.25rem",pb:"15rem",width:"100%",children:[e.jsx(i,{appear:r,children:e.jsx("div",{children:"Loading campaigns..."})}),e.jsx(i,{appear:d,children:e.jsx("div",{children:"Error: INTERNET_CONNECTION_REFUSED"})}),e.jsx(i,{appear:!r&&!d,children:e.jsx(O,{campaign:t})})]})};export{g as default};