PageSourceSearch

https://app.odorbn.gov.ng/chunks/index.cc55ac7c.js

js odorbn.gov.ng collected 2026-10-08 07:27:39 UTC 14,748 bytes, 1 lines download raw bytes

1import{u as L,x as $,r as d,j as e,L as k,as as T,I as i,af as _,ad as V}from"./remita.0ace2f64.js";import{u as H,f as E,S as O}from"./index.88ad5a1f.js";import{s as I}from"./store-api.1fe31e2f.js";import"./base.ddf4fee2.js";import"../main.js";function U({product:t}){var j,n;const x=L(),{addItem:v,setDrawerOpen:a}=H(),{showSuccessMessage:w,showErrorMessage:S}=$(),[f,h]=d.useState(!1),b=t.selling_price||t.price,g=t.selling_price&&parseFloat(t.price.replace(/,/g,""))>parseFloat(t.selling_price.replace(/,/g,"")),p=(j=t.inputs)==null?void 0:j.some(o=>o.required),u=async()=>{var o,c;if(p){x(`/store/products/${t.id}`);return}h(!0);try{await v(t.id,1),w("Added to cart!"),a(!0)}catch(m){S(((c=(o=m==null?void 0:m.response)==null?void 0:o.data)==null?void 0:c.message)||"Failed to add to cart")}finally{h(!1)}};return e.jsxs("div",{className:"group bg-white rounded-2xl border border-gray-100 overflow-hidden hover:shadow-lg transition-all duration-200 flex flex-col",children:[e.jsxs(k,{to:`/store/products/${t.id}`,className:"relative block aspect-[4/3] bg-gray-50 overflow-hidden no-underline",children:[(n=t.images)!=null&&n[0]?e.jsx("img",{src:T(t.images[0]),alt:t.name,className:"w-full h-full object-contain p-4 group-hover:scale-105 transition-transform duration-300"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(i,{icon:"mdi:image-outline",className:"text-gray-200 text-5xl"})}),g&&e.jsx("span",{className:"absolute top-3 left-3 bg-red-500 text-white text-[11px] font-bold px-2 py-0.5 rounded-lg",children:"SALE"})]}),e.jsxs("div",{className:"p-4 flex flex-col flex-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1",children:[e.jsx(k,{to:`/store/products/${t.id}`,className:"text-sm font-bold text-gray-900 line-clamp-2 no-underline hover:text-primary transition-colors flex-1",children:t.name}),e.jsxs("span",{className:"text-sm font-bold text-primary whitespace-nowrap",children:[_,E(b)]})]}),e.jsxs("p",{className:"text-xs text-gray-400 mb-3 capitalize",children:[t.product_type,t.vendor&&e.jsx("span",{className:"text-gray-300",children:" · "}),t.vendor&&t.vendor.name]}),g&&e.jsxs("p",{className:"text-xs text-gray-400 line-through mb-2",children:[_,E(t.price)]}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-400 mt-auto mb-3",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(i,{icon:t.product_type==="digital"?"mdi:cloud-download-outline":"mdi:package-variant-closed",className:"text-sm"}),t.product_type==="digital"?"Digital":"Physical"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(i,{icon:"mdi:shield-check-outline",className:"text-sm"}),"Secure"]})]}),e.jsx("button",{onClick:u,disabled:f,className:"w-full py-2.5 bg-primary text-white rounded-lg text-xs font-semibold text-center hover:bg-primary/90 transition disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-1.5",children:f?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3 h-3 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Adding..."]}):e.jsxs(e.Fragment,{children:[e.jsx(i,{icon:"mdi:cart-plus",className:"text-sm"}),"Add to Cart"]})})]})]})}function B({products:t}){return t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx("div",{className:"w-20 h-20 rounded-full bg-gray-100 flex items-center justify-center mb-4",children:e.jsx(i,{icon:"mdi:store-search-outline",className:"text-3xl text-gray-300"})}),e.jsx("p",{className:"text-gray-500 font-medium",children:"No products found"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"Try adjusting your filters or search terms"})]}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6",children:t.map(x=>e.jsx(U,{product:x},x.id))})}const M=[{label:"All Products",value:""},{label:"Physical",value:"physical"},{label:"Digital",value:"digital"}],z=[{icon:"mdi:shield-check-outline",title:"Secure Payments",desc:"All transactions secured via Remita"},{icon:"mdi:truck-fast-outline",title:"Fast Delivery",desc:"Physical products delivered to your doorstep"},{icon:"mdi:cloud-download-outline",title:"Instant Access",desc:"Digital products available immediately"}];
1function q(){const[t,x]=V(),v=L(),[a,w]=d.useState(null),[S,f]=d.useState([]),[h,b]=d.useState(!0),[g,p]=d.useState(null),[u,j]=d.useState(""),n=parseInt(t.get("page")||"1"),o=t.get("search")||"",c=t.get("type")||"",m=t.get("vendor")||"",N=t.get("sort")||"",P=d.useCallback(async()=>{var s,l;b(!0),p(null);try{const r=await I.getProducts({page:n,page_size:12,search:o||void 0,product_type:c||void 0,vendor_id:m||void 0,sort:N||void 0});r.status==="success"?w(r.data):p(r.message||"Failed to load products")}catch(r){p(((l=(s=r==null?void 0:r.response)==null?void 0:s.data)==null?void 0:l.message)||"Failed to load products")}finally{b(!1)}},[n,o,c,m,N]),A=d.useCallback(async()=>{try{const s=await I.getVendors();s.status==="success"&&f(s.data||[])}catch{}},[]);d.useEffect(()=>{P()},[P]),d.useEffect(()=>{A()},[A]);const y=(s,l)=>{const r=new URLSearchParams(t);l?r.set(s,l):r.delete(s),s!=="page"&&r.delete("page"),x(r)},F=()=>x({}),C=!!(o||c||m||N),R=s=>{s.preventDefault(),u.trim()&&v(`/store?search=${encodeURIComponent(u.trim())}`)};return e.jsxs("div",{children:[e.jsxs("section",{className:"relative bg-gradient-to-br from-primary via-primary/90 to-primary/80 overflow-hidden",children:[e.jsxs("div",{className:"absolute inset-0 opacity-10",children:[e.jsx("div",{className:"absolute top-10 left-10 w-72 h-72 bg-white rounded-full blur-3xl"}),e.jsx("div",{className:"absolute bottom-10 right-10 w-96 h-96 bg-white rounded-full blur-3xl"})]}),e.jsx("div",{className:"relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16 md:py-24",children:e.jsxs("div",{className:"max-w-2xl",children:[e.jsxs("h1",{className:"text-3xl md:text-5xl font-bold text-white leading-tight",children:["Professional Resources",e.jsx("br",{}),e.jsx("span",{className:"text-white/80",children:"at Your Fingertips"})]}),e.jsx("p",{className:"mt-4 text-base md:text-lg text-white/70 max-w-lg",children:"Browse and purchase certificates, publications, and professional resources from ODORBN and verified vendors."}),e.jsxs("form",{onSubmit:R,className:"mt-8 flex items-center bg-white rounded-xl shadow-lg overflow-hidden max-w-md",children:[e.jsx("input",{type:"text",value:u,onChange:s=>j(s.target.value),placeholder:"Search for products...",className:"flex-1 px-5 py-3.5 text-sm text-gray-900 placeholder-gray-400 border-none focus:outline-none focus:ring-0"}),e.jsx("button",{type:"submit",className:"px-5 py-3.5 bg-primary text-white hover:bg-primary/90 transition flex-shrink-0",children:e.jsx(i,{icon:"mdi:magnify",className:"text-xl"})})]})]})})]}),e.jsx("section",{className:"border-b border-gray-100",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-6",children:z.map(s=>e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center flex-shrink-0",children:e.jsx(i,{icon:s.icon,className:"text-2xl text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:s.title}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:s.desc})]})]},s.title))})})}),e.jsx("section",{className:"bg-white sticky top-[72px] z-30 border-b border-gray-100",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:M.map(s=>e.jsx("button",{onClick:()=>y("type",s.value),className:`px-4 py-2 rounded-full text-sm font-medium transition-colors border ${c===s.value?"bg-primary text-white border-primary":"bg-white text-gray-600 border-gray-200 hover:border-primary hover:text-primary"}`,children:s.label},s.value))}),e.jsx("div",{className:"hidden sm:block w-px h-6 bg-gray-200"}),e.jsxs("select",{value:N,onChange:s=>y("sort",s.target.value),className:"px-3 py-2 rounded-lg border border-gray-200 bg-white text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition",children:[e.jsx("option",{value:"",children:"Newest First"}),e.jsx("option",{value:"price",children:"Price: Low → High"}),e.jsx("option",{value:"-price",children:"Price: High → Low"}),e.jsx("option",{value:"name",children:"Name: A → Z"}),e.jsx("option",{value:"-name",children:"Name: Z → A"})]}),C&&e.jsxs("button",{onClick:F,className:"text-sm text-primary hover:underline flex items-center gap-1 ml-auto",children:[e.jsx(i,{icon:"mdi:close-circle-outline",className:"text-base"}),"Clear"]}),a&&!h&&e.jsxs("span",{className:"text-sm text-gray-400 ml-auto",children:[a.total," result",a.total!==1?"s":"",o&&e.jsxs("span",{children:[" ",'for "',e.jsx("strong",{className:"text-gray-600",children:o}),'"']})]})]})})}),e.jsx("section",{className:"bg-gray-50/50",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-10 md:py-14",children:[e.jsx("div",{className:"flex items-end justify-between mb-8",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-gray-900",children:o?"Search Results":c?`${c.charAt(0).toUpperCase()+c.slice(1)} Products`:"Browse Products"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Find professional resources, certificates, and publications"})]})}),h?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[e.jsx("div",{className:"w-10 h-10 border-4 border-primary/20 border-t-primary rounded-full animate-spin mb
1-4"}),e.jsx("span",{className:"text-sm text-gray-400",children:"Loading products..."})]}):g?e.jsxs("div",{className:"text-center py-20",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-red-50 flex items-center justify-center mx-auto mb-4",children:e.jsx(i,{icon:"mdi:alert-circle-outline",className:"text-3xl text-red-400"})}),e.jsx("p",{className:"text-gray-600 font-medium mb-2",children:"Something went wrong"}),e.jsx("p",{className:"text-sm text-gray-400 mb-4",children:g}),e.jsx("button",{onClick:P,className:"text-sm text-primary font-medium hover:underline",children:"Try again"})]}):e.jsxs(e.Fragment,{children:[!(a!=null&&a.items)||a.items.length===0?e.jsxs("div",{className:"text-center py-20",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-gray-100 flex items-center justify-center mx-auto mb-4",children:e.jsx(i,{icon:"mdi:package-variant-remove",className:"text-3xl text-gray-300"})}),e.jsx("p",{className:"text-gray-600 font-medium mb-1",children:"No products found"}),e.jsx("p",{className:"text-sm text-gray-400 mb-4",children:C?"Try adjusting your search or filters":"Products will appear here once they are added"}),C&&e.jsx("button",{onClick:F,className:"text-sm text-primary font-medium hover:underline",children:"Clear all filters"})]}):e.jsx(B,{products:(a==null?void 0:a.items)||[]}),a&&a.page_count>1&&e.jsxs("div",{className:"flex justify-center mt-12 gap-2",children:[e.jsx("button",{disabled:n<=1,onClick:()=>y("page",(n-1).toString()),className:"px-4 py-2.5 rounded-lg border border-gray-200 bg-white text-sm font-medium text-gray-600 hover:bg-gray-50 transition disabled:opacity-40 disabled:cursor-not-allowed",children:e.jsx(i,{icon:"mdi:chevron-left",className:"text-lg"})}),Array.from({length:a.page_count},(s,l)=>l+1).filter(s=>s===1||s===a.page_count||Math.abs(s-n)<=2).reduce((s,l,r,D)=>(r>0&&l-D[r-1]>1&&s.push("ellipsis"),s.push(l),s),[]).map((s,l)=>s==="ellipsis"?e.jsx("span",{className:"px-2 py-2.5 text-sm text-gray-400",children:"..."},`e-${l}`):e.jsx("button",{onClick:()=>y("page",s.toString()),className:`min-w-[40px] py-2.5 rounded-lg text-sm font-medium transition ${s===n?"bg-primary text-white shadow-sm":"border border-gray-200 bg-white text-gray-600 hover:bg-gray-50"}`,children:s},s)),e.jsx("button",{disabled:n>=a.page_count,onClick:()=>y("page",(n+1).toString()),className:"px-4 py-2.5 rounded-lg border border-gray-200 bg-white text-sm font-medium text-gray-600 hover:bg-gray-50 transition disabled:opacity-40 disabled:cursor-not-allowed",children:e.jsx(i,{icon:"mdi:chevron-right",className:"text-lg"})})]})]})]})}),a&&!h&&e.jsx("section",{className:"bg-primary",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-10",children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6 text-center",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-3xl md:text-4xl font-bold text-white",children:[a.total,"+"]}),e.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Products Available"})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-3xl md:text-4xl font-bold text-white",children:[S.length,"+"]}),e.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Verified Vendors"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-3xl md:text-4xl font-bold text-white",children:"24/7"}),e.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Online Access"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-3xl md:text-4xl font-bold text-white",children:"100%"}),e.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Secure Payments"})]})]})})}),e.jsx("section",{className:"bg-gray-50",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16",children:e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm p-8 md:p-12 text-center",children:[e.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-gray-900 mb-3",children:"Need Help Finding Something?"}),e.jsx("p",{className:"text-gray-500 max-w-lg mx-auto mb-6",children:"Can't find what you're looking for? Contact us and our team will assist you in finding the right products and resources."}),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-3",children:[e.jsxs(k,{to:"/store",className:"inline-flex items-center gap-2 px-6 py-3 bg-primary text-white rounded-lg text-sm font-semibold hover:bg-primary/90 transition no-underline",children:[e.jsx(i,{icon:"mdi:store-outline",className:"text-lg"}),"Browse All Products"]}),e.jsxs("a",{href:"https://odorbn.gov.ng",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 px-6 py-3 border-2 border-gray-200 text-gray-700 rounded-lg text-sm font-semibold hover:border-primary hover:text-primary transition no-underline",children:[e.jsx(i,{icon:"mdi:open-in-new",className:"text-lg"}),"Visit Main Website"]})]})]})})})]})}q.Layout=O;export{q 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.