%PDF- %PDF-
Direktori : /home/opti/public_html/startup-life/assets/ |
Current File : /home/opti/public_html/startup-life/assets/OffShelfBarter-77aa1a25.js |
import{u as j,r as E,j as s,Q as u,C as y,P as o}from"./index-5492fbe1.js";import{D as C}from"./dashboard-page-layout-2cec2413.js";import{e as S}from"./index.esm-b6fe913b.js";import{j as T}from"./joinClasses-adfcc520.js";import{u as R}from"./post-notification.api-d7cee9b0.js";import{u as O}from"./accept-barter-service-request.api-47d07dae.js";import{C as p}from"./index-2c4b8b3c.js";import{T as _}from"./index-9340f0a7.js";import{u as k}from"./barter-service-request.api-464deb98.js";import{B as w}from"./Button-e32596e7.js";import"./motion-4a110d9b.js";import"./Box-263f925f.js";import"./iconBase-4b2ba95c.js";import"./index.esm-690e6bd0.js";import"./TableRow-4b138891.js";import"./useQuery-0abbcf43.js";import"./ButtonBase-0400401d.js";import"./assertThisInitialized-081f9914.js";import"./TransitionGroupContext-29effe25.js";import"./setPrototypeOf-0bb37fbe.js";import"./useForkRef-ff55d5c8.js";const Z=()=>{const{data:c,isLoading:m,isPending:f,isError:d}=k(),n=j(),a=c==null?void 0:c.data;console.log(a.filter(e=>e.requestType==="OFF_THE_SHELF_SERVICE_REQUEST"));const r=JSON.parse(localStorage.getItem("user")),{mutateAsync:h}=O(),{mutateAsync:x}=R(),[g,N]=E.useState(null),t=["SN","Service to offer","Service Needed","Location","Value of service($)","Action"],i=a==null?void 0:a.filter(e=>e.requestType==="OFF_THE_SHELF_SERVICE_REQUEST").map(e=>({...e,[t[0]]:e.id,[t[1]]:e.serviceOffer,[t[2]]:e.serviceNeeded,[t[3]]:e.location,[t[4]]:e.value,[t[5]]:s.jsxs("button",{className:"text-black px-0 bg-transparent !border-none relative",onClick:l=>{l.stopPropagation(),N(e.id)},children:[s.jsx(S,{}),s.jsx("div",{className:T("bg-white shadow-sm border w-[100px] absolute top-0 left-full rounded-lg",g===e.id?"block":"hidden"),children:s.jsxs("ul",{className:"!text-xs !space-y-2 text-start px-2",children:[s.jsx("li",{className:"border-b !py-2",onClick:()=>{n(`/services/barter-service/general-request/${e.id}`)},children:"View More"}),s.jsx("li",{className:"!py-2",onClick:()=>v(e),children:"Accept"})]})})]})})),v=e=>{confirm("Are you sure you want to accept this offer?")&&h({id:e.id}).then(l=>{console.log(l),x({message:`Hi ${r==null?void 0:r.firstName} ${r==null?void 0:r.lastName}, ${e.serviceOffer} service offer accepted successfully`,email:[r==null?void 0:r.email],to:[r.id],fullName:[`${r==null?void 0:r.firstName} ${r==null?void 0:r.lastName}`],channelId:""}).then(()=>{u.success("offer accepted successfully"),n(-1)}).catch(b=>{console.log(b),u.error("error while creating channel")})})};return s.jsx(C,{children:s.jsxs("section",{className:"px-5",children:[s.jsxs("div",{className:"flex justify-between mb-[40px]",children:[s.jsx("header",{className:"font-semibold text-[#537473]",children:"Off-the-shelf-bartering-service"}),s.jsx(w,{className:"!bg-primary !normal-case text-white !px-5",onClick:()=>n("/services/barter-service/create-off-shelf"),children:"Create off shelf service"})]}),s.jsx(p,{appear:m||f,children:s.jsx(y,{})}),s.jsx(p,{appear:d,children:"ERROR: INTERNET_CONNECTION_REFUSED"}),s.jsx(p,{appear:!m&&!f&&!d&&(i==null?void 0:i.length)>0,children:s.jsx(_,{header:t,element:i})})]})})};o.string,o.string,o.string,o.string,o.string,o.number;export{Z as default};