PageSourceSearch

https://myzylo.com/assets/Opportunities-DEbAPKBs.js

js myzylo.com collected 2026-10-02 01:37:03 UTC 13,348 bytes, 16 lines download raw bytes

1import{c as M,u as de,b as le,r,s as d,j as e,S as O,C as ce,B as b,L as B,o as T,ad as w,F as me,I as ue,a as m}from"./index-CNQf121E.js";import{A as U,v as pe,w as xe,x as he,y as q}from"./AppLayout-DdDyuptZ.js";import{S as z,a as P,b as R,c as E,d as h}from"./select-7RFhhHsU.js";import{C as fe,U as ge,W as ye,u as be,R as je}from"./opportunities-CLbUcZwZ.js";import{B as L}from"./badge-check-BKufFHa4.js";import{P as W}from"./plus-B9clo1UC.js";import{E as Ne}from"./ellipsis-vertical-Gcqx1dvk.js";import{P as ve}from"./pencil-D0PAwCcq.js";import{T as ke}from"./trash-2-Dv8XMN2m.js";import{E as _e}from"./external-link-Dl06BmhM.js";import{M as we}from"./message-square-CLw9ZVFq.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Ce=M("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Se=M("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const qe=M("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]),l="__all__",Be=()=>{const{user:i}=de(),D=le(),[Q,V]=r.useState(!0),[f,$]=r.useState([]),[G,Y]=r.useState({}),[H,K]=r.useState(!1),[j,J]=r.useState(l),[N,X]=r.useState(l),[v,Z]=r.useState(l),[k,ee]=r.useState(""),[C,F]=r.useState(!1),[se,te]=r.useState(!0),[A,g]=r.useState(!1),[y,re]=r.useState(!1),[ze,ae]=r.useState(!1);r.useEffect(()=>{const s=document.createElement("script");return s.src="https://checkout.razorpay.com/v1/checkout.js",s.async=!0,document.body.appendChild(s),()=>{document.body.removeChild(s)}},[]),r.useEffect(()=>{i&&(async()=>{var u;const[s,a]=await Promise.all([d.from("b2b_subscriptions").select("id").eq("user_id",i.id).eq("status","active").eq("plan","opportunities").gte("expires_at",new Date().toISOString()).maybeSingle(),d.from("user_roles").select("role").eq("user_id",i.id).in("role",["admin","sub_admin"])]),n=((u=a.data)==null?void 0:u.map(o=>o.role))||[],t=n.includes("admin"),c=n.includes("sub_admin");re(t),ae(c),F(!!s.data||t||c),te(!1)})()},[i]);const ie=async()=>{var s;if(i){g(!0);try{const a=await d.functions.invoke("razorpay-order",{body:{action:"create_order",plan:"opp_monthly"}});if(a.error||!((s=a.data)!=null&&s.order)){m.error("Failed to create payment order"),g(!1);return}const{order:n,key_id:t}=a.data,c={key:t,amount:n.amount,currency:n.currency,name:"Myzylo",description:"Find Opportunities — Monthly",order_id:n.id,handler:async o=>{var x;const p=await d.functions.invoke("razorpay-order",{body:{action:"verify_payment",payment_id:o.razorpay_payment_id,order_id:o.razorpay_order_id,plan:"opp_monthly"}});p.error||!((x=p.data)!=null&&x.success)?m.error("Payment verification failed. Please contact support."):(F(!0),m.success("Welcome to Find Opportunities! 🎉")),g(!1)},prefill:{email:i.email},theme:{color:"#ea580c"},modal:{ondismiss:()=>g(!1)}};new window.Razorpay(c).open()}catch{m.error("Payment failed. Please try again."),g(!1)}}},S=async()=>{var u;if(!i)return;V(!0);let s=d.from("requirements").select(je).order("created_at",{ascending:!1});y||(s=s.in("status",["open","paused"]));const[a,n]=await Promise.all([s,d.from("profiles").select("is_verified_vendor").eq("user_id",i.id).maybeSingle()]),t=a.data||[],c=y?t:t.filter(o=>o.status==="open"||o.posted_by===i.id);if($(c),K(!!((u=n.data)!=null&&u.is_verified_vendor)),c.length){const o=c.map(_=>_.id),{data:p}=await d.from("vendor_proposals").select("requirement_id").in("requirement_id",o),x={};p==null||p.forEach(_=>{x[_.requirement_id]=(x[_.requirement_id]||0)+1}),Y(x)}V(!1)};r.useEffect(()=>{!i||!C||S()},[i,C,y]);const ne=async s=>{const a=s.status==="paused"?"open":"paused",{error:n}=await d.from("requirements").update({status:a}).eq("id",s.id);if(n){m.error("Failed to update status");return}m.success(a==="paused"?"Requirement paused":"Requirement resumed"),S()},oe=async s=>{if(!confirm("Delete this requirement permanently? This cannot be undone."))return;const{error:a}=await d.from("requirements").delete().eq("id",s.id);if(a){m.error("Failed to delete");return}m.success("Requirement deleted"),S()},I=r.useMemo(()=>f.filter(s=>!(j!==l&&s.category!==j||N!==l&&s.urgency!==N||v!==l&&s.work_mode!==v||k.trim()&&!(s.budget||"").toLowerCase().includes(k.trim().toLowerCase()))),[f,j,N,v,k]);return!se&&!C&&!y?e.jsx(U,{children:e.jsx("div",{className:"max-w-3xl mx-auto",children:e.jsxs("div",{className:"rounded-3xl border border-primary/30 bg-gradient-to-br from-primary/10 via-card to-card p-8 md:p-12 text-center shadow-lg",children:[e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-primary/15 text-primary text-xs font-bold uppercase tracking-wider mb-5 border border-primary/30",children:[e.jsx(O,{size:14})," Premium · Find Opportunities"]}),e.jsxs("h1",{className:"font-heading font-bold text-3xl md:text-4xl leading-tight mb-3",children:["Skip the cold pitch.",e.jsx("br",{}),"Meet buyers who are ready to talk."]}),e.jsx("p",{className:"text-muted-foreground text-base md:text-lg max-w-xl mx-auto mb-8",children:"Verified companies post live requirements. You respond, schedule, and close — without the 6-touch sales cycle."}),e.jsx("ul",{className:"grid sm:grid-cols-2 gap-3 text-left max-w-xl mx-auto mb-8 text-sm",children:["Unlimited live requirements","Submit unlimited proposals","Schedule meetings in-app","Verified buyer companies"].map(s=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(ce,{size:16,className:"text-primary mt-0.5 flex-shrink-0"})," ",e.jsx("span",{children:s})]},s))}),e.jsxs("div",{className:"inline-flex items-baseline gap-1 mb-5",children:[e.jsx("span",{className:"text-4xl md:text-5xl font-bold font-heading",children:"₹1,000"}),e.jsx("span",{className:"text-muted-foreground",children:"/ month"})]}),e.jsx("div",{children:e.jsx(b,{size:"lg",onClick:ie,disabled:A,className:"px-8",children:A?e.jsxs(e.Fragment,{children:[e.jsx(B,{className:"animate-spin mr-2",size:16})," Processing..."]}):e.jsx(e.Fragment,{children:"Subscribe — ₹1,000/month"})})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-4",children:"Cancel anytime · Renews monthly"})]})})}):e.jsx(U,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 rounded-xl bg-primary/10 border border-primary/20 text-sm",children:[e.jsx(O,{size:14,className:"text-primary flex-shrink-0"}
16),e.jsx("span",{className:"text-foreground/90",children:"Skip the cold pitch — meet buyers ready to talk."})]}),e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl md:text-3xl font-heading font-bold flex items-center gap-2",children:[e.jsx(T,{className:"text-primary"})," Find Opportunities"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Open requirements from companies looking for vendors and partners."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[H?e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-primary/15 text-primary text-xs font-semibold border border-primary/30",children:[e.jsx(L,{size:14})," Verified Vendor"]}):e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>D("/opportunities/dashboard"),children:[e.jsx(L,{size:14,className:"mr-1.5"})," Become a Vendor"]}),e.jsx(b,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(w,{to:"/opportunities/dashboard",children:[e.jsx(qe,{size:14,className:"mr-1.5"})," Dashboard"]})}),e.jsx(b,{size:"sm",asChild:!0,children:e.jsxs(w,{to:"/opportunities/post",children:[e.jsx(W,{size:14,className:"mr-1.5"})," Post a Requirement"]})})]})]}),e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3 text-sm font-medium text-muted-foreground",children:[e.jsx(me,{size:14})," Filters"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsxs(z,{value:j,onValueChange:J,children:[e.jsx(P,{children:e.jsx(R,{placeholder:"Category"})}),e.jsxs(E,{children:[e.jsx(h,{value:l,children:"All categories"}),fe.map(s=>e.jsx(h,{value:s,children:s},s))]})]}),e.jsxs(z,{value:N,onValueChange:X,children:[e.jsx(P,{children:e.jsx(R,{placeholder:"Urgency"})}),e.jsxs(E,{children:[e.jsx(h,{value:l,children:"Any urgency"}),ge.map(s=>e.jsx(h,{value:s,children:s},s))]})]}),e.jsxs(z,{value:v,onValueChange:Z,children:[e.jsx(P,{children:e.jsx(R,{placeholder:"Work mode"})}),e.jsxs(E,{children:[e.jsx(h,{value:l,children:"Any mode"}),ye.map(s=>e.jsx(h,{value:s,children:s},s))]})]}),e.jsx(ue,{placeholder:"Budget contains...",value:k,onChange:s=>ee(s.target.value)})]})]}),Q?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(B,{className:"animate-spin text-primary"})}):I.length===0?e.jsxs("div",{className:"rounded-2xl border border-dashed border-border bg-card p-10 text-center",children:[e.jsx(T,{className:"mx-auto text-muted-foreground mb-3",size:32}),e.jsx("h3",{className:"font-semibold text-lg",children:f.length===0?"No requirements right now.":"No requirements match your filters."}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 mb-4",children:f.length===0?"Check back soon — or post your own requirement.":"Try clearing filters to see more."}),f.length===0&&e.jsx(b,{asChild:!0,children:e.jsxs(w,{to:"/opportunities/post",children:[e.jsx(W,{size:14,className:"mr-1.5"})," Post a Requirement"]})})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:I.map(s=>{const a=s.posted_by===(i==null?void 0:i.id),n=a||y;return e.jsxs(w,{to:`/opportunities/${s.id}`,className:"relative block rounded-2xl border border-border bg-card p-5 hover:border-primary/50 transition-colors",children:[e.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-1.5",children:[s.status==="paused"&&e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider bg-muted text-muted-foreground px-2 py-1 rounded-full",children:"Paused"}),a&&e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider bg-primary text-primary-foreground px-2 py-1 rounded-full",children:"Posted by you"}),n&&e.jsxs(pe,{children:[e.jsx(xe,{asChild:!0,onClick:t=>{t.preventDefault(),t.stopPropagation()},children:e.jsx("button",{className:"p-1 rounded-md hover:bg-muted","aria-label":"Manage",children:e.jsx(Ne,{size:14})})}),e.jsxs(he,{align:"end",onClick:t=>t.stopPropagation(),children:[e.jsxs(q,{onClick:t=>{t.preventDefault(),D(`/opportunities/post?edit=${s.id}`)},children:[e.jsx(ve,{size:14,className:"mr-2"})," Edit"]}),e.jsx(q,{onClick:t=>{t.preventDefault(),ne(s)},children:s.status==="paused"?e.jsxs(e.Fragment,{children:[e.jsx(Se,{size:14,className:"mr-2"})," Resume"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{size:14,className:"mr-2"})," Pause"]})}),e.jsxs(q,{className:"text-destructive focus:text-destructive",onClick:t=>{t.preventDefault(),oe(s)},children:[e.jsx(ke,{size:14,className:"mr-2"})," Delete"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-2",children:[e.jsx("span",{className:"font-semibold text-foreground",children:s.company}),e.jsx(L,{size:14,className:"text-primary"}),s.is_curated&&e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider bg-muted text-muted-foreground px-1.5 py-0.5 rounded",children:"Curated"})]}),e.jsx("h3",{className:"font-heading font-semibold text-lg leading-snug mb-2 pr-24",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:s.description}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[e.jsx("span",{className:"px-2 py-1 rounded-full bg-muted text-muted-foreground",children:s.category}),e.jsx("span",{className:`px-2 py-1 rounded-full border ${be(s.urgency)}`,children:s.urgency}),e.jsx("span",{className:"px-2 py-1 rounded-full bg-muted text-muted-foreground",children:s.work_mode}),s.budget&&e.jsx("span",{className:"px-2 py-1 rounded-full bg-muted text-muted-foreground",children:s.budget}),s.source_url&&e.jsxs("button",{type:"button",onClick:t=>{t.preventDefault(),t.stopPropagation(),window.open(s.source_url,"_blank","noopener,noreferrer")},className:"inline-flex items-center gap-1 px-2 py-1 rounded-full bg-primary/10 text-primary hover:bg-primary/20",children:[e.jsx(_e,{size:11})," Original"]}),e.jsxs("span",{className:"ml-auto inline-flex items-center gap-1 text-muted-foreground",children:[e.jsx(we,{size:12})," ",G[s.id]||0]})]})]},s.id)})})]})})};export{Be as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.