1import{j as s}from"./vendor-ui-BNfWAQDI.js";import{c as e,a$ as a,i as t,o as i,p as r,aj as n,j as l,b0 as c,B as d,P as o,aI as m,aJ as x,aK as u,aL as h,s as j,m as p}from"./index-DWEu7ZWV.js";import{u as f,r as N}from"./vendor-react-BfLbNfU3.js";import{D as g}from"./DeleteBusinessDialog-DLTfQK1Q.js";import{T as b}from"./trash-2-BMjs_WLD.js";import{P as v}from"./package-CJJH_Oq3.js";import{a as w,C as y}from"./clock-tOGdQnbV.js";import{C}from"./circle-check-D7cBU4bu.js";import"./vendor-supabase-CaSwWmKt.js";import"./vendor-query-CP40yVf3.js";import"./vendor-charts-QQPWF0P_.js";import"./alert-dialog-BMuxQHux.js";import"./use-toast-B90OqXuI.js";import"./triangle-alert-YKuCWZXl.js"; 2/** 3 * @license lucide-react v0.462.0 - ISC 4 * 5 * This source code is licensed under the ISC license. 6 * See the LICENSE file in the root directory of this source tree. 7 */const k=e("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),D=()=>{var e;const D=f(),{businessProfiles:P,loading:_}=a(),[B,L]=N.useState({}),[M,S]=N.useState(null);if(N.useEffect(()=>{(async()=>{if(0===P.length)return;const s={};for(const e of P){const{count:a,error:t}=await j.from("business_products").select("*",{count:"exact",head:!0}).eq("business_id",e.id);t||null===a||(s[e.id]=a)}L(s)})()},[P]),_)return s.jsx("div",{className:"container mx-auto px-4 py-8",children:s.jsx("div",{className:"text-center",children:"Loading your businesses..."})});if(0===P.length)return s.jsx("div",{className:"container mx-auto px-4 py-8",children:s.jsxs(t,{children:[s.jsxs(i,{children:[s.jsx(r,{children:"Business Dashboard"}),s.jsx(n,{children:"You haven't created any business profiles yet"})]}),s.jsxs(l,{className:"text-center py-12",children:[s.jsx(c,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground"}),s.jsx("p",{className:"text-muted-foreground mb-6",children:"Create a business profile to get started with your vegan business presence"}),s.jsxs(d,{onClick:()=>D("/business-application"),children:[s.jsx(o,{className:"mr-2 h-4 w-4"}),"Create Business Profile"]})]})]})});const q=e=>{switch(e){case"active":return s.jsx(C,{className:"h-4 w-4 text-success"});case"pending":return s.jsx(y,{className:"h-4 w-4 text-warning"});default:return s.jsx(w,{className:"h-4 w-4 text-destructive"})}},E=(e,a)=>{if(!a)return s.jsx(p,{variant:"outline",className:"bg-yellow-50",children:"Pending Approval"});switch(e){case"active":return s.jsx(p,{variant:"outline",className:"bg-green-50",children:"Active"});case"pending":return s.jsx(p,{variant:"outline",className:"bg-yellow-50",children:"Pending Payment"});case"expired":return s.jsx(p,{variant:"outline",className:"bg-red-50",children:"Expired"});case"cancelled":return s.jsx(p,{variant:"outline",className:"bg-gray-50",children:"Cancelled"});default:return s.jsx(p,{variant:"outline",children:e})}};return s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h1",{className:"text-3xl font-bold mb-2",children:"My Businesses"}),s.jsx("p",{className:"text-muted-foreground",children:"Manage all your business profiles"})]}),s.jsxs("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-3",children:[P.map(e=>s.jsxs(t,{className:"hover:shadow-lg transition-shadow",children:[s.jsx(i,{children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(r,{className:"text-xl mb-2",children:e.business_name}),e.tagline&&s.jsx(n,{className:"line-clamp-2",children:e.tagline})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[q(e.subscription_status),s.jsxs(m,{children:[s.jsx(x,{asChild:!0,children:s.jsx(d,{variant:"ghost",size:"icon",className:"h-8 w-8",children:s.jsx(k,{className:"h-4 w-4"})})}),s.jsxs(u,{align:"end",children:[s.jsxs(h,{onClick:()=>D(`/business-dashboard/${e.id}`),children:[s.jsx(c,{className:"mr-2 h-4 w-4"}),"Manage Dashboard"]}),s.jsxs(h,{onClick:()=>S(e.id),className:"text-destructive focus:text-destructive",children:[s.jsx(b,{className:"mr-2 h-4 w-4"}),"Delete Business"]})]})]})]})]})}),s.jsx(l,{children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Status"}),E(e.subscription_status,e.is_approved)]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Products"}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(v,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("span",{className:"text-sm font-medium",children:B[e.id]??"..."})]})]}),e.location&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Location"}),s.jsx("span",{className:"text-sm font-medium",children:e.location})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Created"}),s.jsx("span",{className:"text-sm font-medium",children:new Date(e.created_at).toLocaleDateString()})]}),s.jsxs(d,{className:"w-full mt-4",onClick:()=>D(`/business-dashboard/${e.id}`),children:[s.jsx(c,{className:"mr-2 h-4 w-4"}),"Manage Dashboard"]})]})})]},e.id)),s.jsx(t,{className:"hover:shadow-lg transition-shadow border-dashed",children:s.jsxs(l,{className:"flex flex-col items-center justify-center h-full min-h-[300px] py-12",children:[s.jsx(o,{className:"h-12 w-12 mb-4 text-muted-foreground"}),s.jsx("p",{className:"text-center text-muted-foreground mb-4",children:"Create another business profile"}),s.jsx(d,{variant:"outline",onClick:()=>D("/business-application"),children:"New Business"})]})})]}),M&&s.jsx(g,{businessId:M,businessName:(null==(e=P.find(s=>
7s.id===M))?void 0:e.business_name)||"",productCount:B[M]||0,onClose:()=>S(null)})]})};export{D as default}; 8//# sourceMappingURL=BusinessDashboardListPage-DaQt0hGV.js.map
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.