PageSourceSearch

https://vendaflow-elite.lovable.app/assets/Home-BCbdLC9J.js

js vendaflow-elite.lovable.app collected 2026-10-03 03:45:33 UTC 10,195 bytes, 1 lines download raw bytes

1import{r as I,j as e,s as M}from"./index-C6S6M9rG.js";import{O as F,u as L,B as A}from"./useVendorData-_I9sSEIX.js";import{a as z,B as C,P as j,S as P,s as $}from"./PageContainer-BFEpeTVh.js";import{S as v,a as b}from"./Skeleton-CbbtZEel.js";import{C as a}from"./Card-CL_wsKjN.js";import{E as R}from"./EmptyStateIcon-6_KFJ0xQ.js";import{X as w}from"./App-anrHEjWR.js";import"./browser-D0QfQHEn.js";import"./compressImage-NEBel-1u.js";const N="var(--vf-border)",p="var(--vf-text)",O="var(--vf-gold)",S="color-mix(in srgb, var(--vf-text) 55%, transparent)",W="var(--vf-bg)",V=s=>({borderRadius:9999,padding:"4px 12px",fontSize:"0.8rem",cursor:"pointer",border:s?"none":`1px solid ${N}`,background:s?O:"transparent",color:s?W:p}),B=["fulfilled","cancelled"];function D({order:s,businessName:r,setOrders:l}){return e.jsxs(a,{padded:!1,className:"mb-3 p-4",style:{background:W},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:8,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontWeight:"bold",color:p},children:s.customer_name}),e.jsx("span",{style:{fontSize:"0.75rem",color:S},children:new Date(s.submitted_at).toLocaleDateString("en-NG")})]}),e.jsxs("div",{style:{color:O,fontSize:"0.9rem",marginTop:4},children:[s.product_name," × ",s.quantity]}),e.jsx("div",{style:{fontSize:"0.875rem",color:p,marginTop:4},children:e.jsx("a",{href:`tel:${s.customer_phone}`,style:{color:p},children:s.customer_phone})}),s.delivery_address&&e.jsx("div",{style:{fontSize:"0.8rem",color:S,marginTop:4},children:s.delivery_address}),s.note&&e.jsxs("div",{style:{fontSize:"0.8rem",color:S,fontStyle:"italic",marginTop:4},children:['"',s.note,'"']}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem",marginTop:"0.75rem",alignItems:"center",flexWrap:"wrap"},children:[e.jsx("select",{value:s.status,onChange:async i=>{const o=i.target.value;await M.from("orders").update({status:o}).eq("id",s.id),l(c=>c.map(d=>d.id===s.id?{...d,status:o}:d))},style:{background:"var(--vf-surface)",border:`1px solid ${N}`,color:p,borderRadius:"0.25rem",padding:"4px 8px",fontSize:"0.8rem"},children:F.map(i=>e.jsx("option",{value:i,children:i},i))}),e.jsx("button",{onClick:()=>{const i=s.customer_phone.replace(/\D/g,""),o=encodeURIComponent(`Hi ${s.customer_name}! This is ${r} on VendaFlow Elite. Thanks for your order — ${s.product_name} ×${s.quantity}. We're reaching out to confirm the details.`);window.open(`https://wa.me/${i}?text=${o}`,"_blank")},style:{background:"#16a34a",color:"#fff",borderRadius:9999,padding:"4px 12px",fontSize:"0.8rem",border:"none",cursor:"pointer"},children:"WhatsApp Customer"})]})]})}function G({orders:s,filteredOrders:r,orderFilter:l,setOrderFilter:i,newOrders:o,businessName:c,setOrders:d}){const[m,u]=I.useState(!1),x=l==="All",y=x?r.filter(t=>!B.includes(t.status)):r,n=x?r.filter(t=>B.includes(t.status)):[];return e.jsxs(a,{className:"mb-4",children:[e.jsx(z,{level:"h3",title:"Order Inbox",className:"mb-4"}),e.jsx("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginBottom:"1rem"},children:["All","New","Contacted","Fulfilled","Cancelled"].map(t=>e.jsxs("button",{onClick:()=>i(t),style:V(l===t),children:[t,t==="New"&&o>0?` (${o})`:""]},t))}),y.length===0?e.jsx(R,{type:"orders",label:n.length>0?"Nothing waiting on you. Every order has been handled.":"No orders yet. When customers fill the order form, they'll show up here."}):y.map(t=>e.jsx(D,{order:t,businessName:c,setOrders:d},t.id)),n.length>0&&e.jsxs("div",{style:{marginTop:"1rem",borderTop:`1px solid ${N}`,paddingTop:"0.75rem"},children:[e.jsxs("button",{onClick:()=>u(t=>!t),"aria-expanded":m,style:{width:"100%",background:"transparent",border:"none",cursor:"pointer",display:"flex",justifyContent:"space-between",alignItems:"center",color:p,fontSize:"0.85rem",fontWeight:600,padding:"4px 0"},children:[e.jsxs("span",{children:["History (",n.length,")"]}),e.jsx("span",{style:{color:O,transition:"transform 0.2s",transform:m?"rotate(180deg)":"rotate(0)"},children:"▾"})]}),m&&e.jsx("div",{style:{marginTop:"0.75rem"},children:n.map(t=>e.jsx(D,{order:t,businessName:c,setOrders:d},t.id))})]})]})}const f="var(--vf-text)",h="var(--vf-gold)",g="color-mix(in srgb, var(--vf-text) 55%, transparent)";function U({showPushCard:s,setShowPushCard:r,showBookmark:l,dismissBookmark:i,hasNewMilestone:o,dismissMilestone:c,totalTaps:d,todaysTip:m,tipDismissed:u,setTipDismissed:x}){const n=[{id:"push",show:s,priority:1},{id:"bookmark",show:l,priority:2},{id:"milestone",show:o,priority:3},{id:"tip",show:!u,priority:4}].filter(t=>t.show).sort((t,H)=>t.priority-H.priority)[0];return n?n.id==="push"?e.jsx(a,{className:"mb-4",style:{borderLeft:`4px solid ${h}`},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"0.75rem",flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{color:f,fontSize:"0.9rem",fontWeight:600},children:"Turn on order alerts"}),e.jsx("div",{style:{color:g,fontSize:"0.78rem",marginTop:4},children:"Get notified while VendaFlow is open in this tab. For alerts even when you're not looking at this page, orders also always show up in your Order Inbox on Home."})]}),e.jsx(C,{variant:"primary",size:"sm",onClick:()=>{"Notification"in window&&Notification.requestPermission().then(t=>{if(localStorage.setItem("vf_push_asked",t),r(!1),t==="granted")try{new Notification("VendaFlow Elite",{body:"Order alerts are on while this tab is open."})}catch{}})},children:"Yes, Alert Me"})]})}):n.id==="bookmark"?e.jsxs(a,{className:"mb-4",style:{borderLeft:`4px solid ${h}
1`,display:"flex",alignItems:"flex-start",gap:12},children:[e.jsx("span",{style:{fontSize:20},children:"📌"}),e.jsxs("p",{style:{flex:1,fontSize:13,lineHeight:1.5,color:f,margin:0},children:[e.jsx("strong",{children:"Bookmark this page"})," — it's how you come back to manage your shop."]}),e.jsx("button",{onClick:i,style:{color:g,background:"transparent",border:"none",cursor:"pointer"},children:e.jsx(w,{size:16})})]}):n.id==="milestone"?e.jsxs(a,{className:"mb-4",style:{borderLeft:`4px solid ${h}`,display:"flex",alignItems:"flex-start",gap:12},children:[e.jsx("span",{style:{fontSize:20},children:"✦"}),e.jsxs("p",{style:{flex:1,fontSize:13,lineHeight:1.5,color:f,margin:0},children:[e.jsx("strong",{children:"Milestone!"})," You've crossed ",d," order taps. Generate a shareable card from My Shop."]}),e.jsx("button",{onClick:c,style:{color:g,background:"transparent",border:"none",cursor:"pointer"},children:e.jsx(w,{size:16})})]}):e.jsxs(a,{className:"mb-4",style:{borderLeft:`4px solid ${h}`,display:"flex",alignItems:"flex-start",gap:12},children:[e.jsx("span",{style:{fontSize:20},children:"💡"}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:11,fontWeight:700,letterSpacing:"0.14em",textTransform:"uppercase",color:h,marginBottom:4},children:"Today's Tip"}),e.jsx("p",{style:{fontSize:13,lineHeight:1.55,color:f,margin:0},children:m})]}),e.jsx("button",{onClick:()=>x(!0),"aria-label":"Dismiss tip",style:{color:g,background:"transparent",border:"none",cursor:"pointer"},children:e.jsx(w,{size:16})})]}):null}const k="var(--vf-bg)",E="var(--vf-text)",T="var(--vf-gold)",_="color-mix(in srgb, var(--vf-text) 55%, transparent)";function te(){const s=L();return s.loading?e.jsx("div",{style:{background:k,minHeight:"100vh",paddingBottom:80},children:e.jsxs(j,{variant:"wide",children:[e.jsxs("div",{style:{padding:"2rem 0 1rem"},children:[e.jsx(v,{height:28,width:"60%"}),e.jsx(v,{height:16,width:"40%",style:{marginTop:10}})]}),e.jsx("div",{style:{display:"flex",gap:10,marginBottom:16},children:Array.from({length:3}).map((r,l)=>e.jsx(b,{height:64},l))}),e.jsx(b,{height:100}),e.jsx("div",{style:{marginTop:16},children:e.jsx(b,{height:280})})]})}):s.noShop?e.jsx("div",{style:{background:k,minHeight:"100vh",padding:"1.5rem"},children:e.jsx(j,{variant:"narrow",children:e.jsxs(a,{className:"mt-16 text-center",children:[e.jsx(z,{level:"h2",align:"center",title:"You haven't built your shop yet."}),e.jsx(C,{variant:"primary",size:"md",fullWidth:!0,className:"mt-6",onClick:()=>s.navigate("/builder"),children:"Build My Shop"})]})})}):s.formData?e.jsxs("div",{style:{background:k,minHeight:"100vh",color:E,paddingBottom:80},children:[e.jsx(P,{title:"Home — VendaFlow Elite",description:"Your VendaFlow vendor home."}),e.jsx(A,{}),e.jsxs(j,{variant:"wide",children:[e.jsxs("div",{style:{padding:"2rem 0 1rem"},children:[e.jsx(z,{level:"h1",title:s.welcomeMsg}),e.jsx("div",{style:{fontSize:"0.9rem",color:E,opacity:.7,marginTop:"0.25rem"},children:s.welcomeSub})]}),e.jsx("div",{style:{display:"flex",gap:10,marginBottom:16},children:[{v:s.newOrders,l:"New Orders Waiting"},{v:s.todayViews,l:"Views Today"},{v:s.totalTaps,l:"WhatsApp Order Taps"}].map(r=>e.jsxs(a,{padded:!1,className:"flex-1 p-3 text-center",children:[s.statsLoading?e.jsx(v,{height:22,width:"50%",style:{margin:"0 auto"}}):e.jsx("div",{style:{...$,fontSize:"var(--text-h3)",color:T,lineHeight:1.1},children:r.v}),e.jsx("div",{className:"text-xs",style:{color:_,textTransform:"uppercase",letterSpacing:"0.08em"},children:r.l})]},r.l))}),s.isAdmin&&e.jsxs(a,{className:"mb-4",style:{borderLeft:`4px solid ${T}`,display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:"0.75rem"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{...$,color:T,fontSize:"1.1rem"},children:"⚡ Admin Overlord"}),e.jsx("div",{style:{fontSize:"0.75rem",color:_,marginTop:"0.25rem"},children:"Platform management · Vendor tools · Broadcasts"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>window.open("/admin-overlord","_blank"),children:"Open Panel →"})]}),e.jsx(U,{showPushCard:s.showPushCard,setShowPushCard:s.setShowPushCard,showBookmark:s.showBookmark,dismissBookmark:s.dismissBookmark,hasNewMilestone:s.hasNewMilestone,dismissMilestone:s.dismissMilestone,totalTaps:s.totalTaps,todaysTip:s.todaysTip,tipDismissed:s.tipDismissed,setTipDismissed:s.setTipDismissed}),e.jsx(G,{orders:s.orders,filteredOrders:s.filteredOrders,orderFilter:s.orderFilter,setOrderFilter:s.setOrderFilter,newOrders:s.newOrders,businessName:s.formData.businessName||"",setOrders:s.setOrders})]})]}):null}export{te 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.