%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/opti/public_html/startup-life/assets/
Upload File :
Create Path :
Current File : /home/opti/public_html/startup-life/assets/SingleAdvert-42b7793e.js

import{d as j,e as w,F as N,u as y,j as t,r as C,C as E,Q as x}from"./index-5492fbe1.js";import{u as F}from"./get-one-advert.api-31302f89.js";import{s as A}from"./style.module-d249dcf0.js";import{D as I}from"./dashboard-page-layout-2cec2413.js";import{D as T}from"./dashboard-footer-navigation-f658b457.js";import{j as l}from"./joinClasses-adfcc520.js";import{C as c}from"./index-2c4b8b3c.js";import"./useQuery-0abbcf43.js";import"./motion-4a110d9b.js";import"./Box-263f925f.js";const B=n=>j({mutationFn:async()=>{var s;try{return(await w.post(`https://startuplife.api.cube700.net/api/v1/advert/re-initialize-payment/${n}`)).data}catch(o){return(s=o.response)==null?void 0:s.data}}}),q=()=>{var m,u;const n=N(),r=y(),{mutateAsync:p}=B(n.id),{data:s,isLoading:o,isError:d,refetch:f}=F(n.id),i=JSON.parse(localStorage.getItem("user")),e=s==null?void 0:s.data;console.log(e);const h=[{title:"Title",info:e==null?void 0:e.title},{title:"Description",info:t.jsx("p",{className:"bg-[#EBECFE] text-[#27AE60] !py-1 text-sm !px-4 w-fit rounded-full",children:e==null?void 0:e.description})},{title:"Image",info:t.jsx("img",{className:"h-50 w-full object-cover",src:(e==null?void 0:e.banner)??"",alt:"service-img"})}],g=n.id;return C.useEffect(()=>{f()},[g]),o?t.jsx(E,{}):d?t.jsx("div",{children:"Error: INTERNET_CONNECTION_REFUSED"}):(console.log(s),t.jsx("div",{className:A["advert-page"],children:t.jsx(I,{children:t.jsxs("section",{className:"px-5",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("header",{className:"text-[#537473] font-bold !mb-5",children:"Advert"}),t.jsx(c,{appear:(e==null?void 0:e.paidFor)===!0&&(e==null?void 0:e.status)==="ACTIVE"&&((m=e==null?void 0:e.postedBy)==null?void 0:m.id)===(i==null?void 0:i.id),children:t.jsx("button",{disabled:!0,className:l("bg-[#A8CF45] font-bold capitalize  text-white px-5 py-2 w-full max-w-[317px]"),children:"This Advert Is Live"})}),t.jsx(c,{appear:(e==null?void 0:e.paidFor)===!1&&(e==null?void 0:e.postedBy.id)===(i==null?void 0:i.id),children:t.jsx("button",{className:l("bg-[#A8CF45] font-bold capitalize  text-white px-5 py-2 w-full max-w-[317px]"),onClick:()=>{p().then(a=>{if(console.log(a),a.info){x.success("You will be redirected to fund campaign"),setTimeout(()=>{window.open(a.info.authorization_url,"_blank")},3e3);return}else{x.error("Something went wrong!. Try again later");return}})},children:"Pay For Advert"})}),t.jsx(c,{appear:(e==null?void 0:e.paidFor)===!0&&(e==null?void 0:e.status)==="INACTIVE"&&(e==null?void 0:e.postedBy.id)===(i==null?void 0:i.id),children:t.jsx("button",{disabled:!0,className:l("bg-[#A8CF45] font-bold capitalize  text-white px-5 py-2 w-full max-w-[317px]"),children:"This advert is still under review by the admin"})})]}),t.jsx("div",{className:"grid grid-cols-2 !gap-5 !mt-5 place-items-start",children:h.map((a,b)=>t.jsxs("div",{className:"bg-white space-y-3 rounded-xl max-w-[326px] w-full !p-5",children:[t.jsx("h4",{className:"text-[#828282]",children:a.title}),t.jsx("p",{className:"font-semibold",children:a.info})]},b))}),t.jsx(T,{backBtnText:"Back",continueBtnText:"Update",hideContinueBtn:(i==null?void 0:i.id)!==((u=e==null?void 0:e.postedBy)==null?void 0:u.id),continueEventHandler:()=>r(`/advert/edit-advert/${e==null?void 0:e.id}`),cancelEventHandler:()=>{r(-1)}})]})})}))};export{q as default};

Zerion Mini Shell 1.0