PageSourceSearch

https://doghealthy.netlify.app/_nuxt/B28KYdf_.js

js doghealthy.netlify.app collected 2026-10-03 10:41:16 UTC 8,837 bytes, 1 lines download raw bytes

1import{f as V,u as F,g as N,r as y,q as D,h as E,c as i,a as e,t as d,b as g,m as I,I as M,A as P,w as p,F as q,k as A,e as $,o as a,d as l,i as u,y as B,B as T,_ as j}from"#entry";import{u as U}from"./Dy9pVEbO.js";import{u as z}from"./D5HOP8m2.js";import"./DKLWY9DJ.js";const G={class:"container mx-auto px-4 py-8"},H={class:"grid grid-cols-1 md:grid-cols-4 gap-6 mb-8"},K={class:"bg-white rounded-lg shadow-sm border border-muted p-6"},Y={class:"flex items-center"},J={class:"ml-4"},O={class:"text-2xl font-bold text-dark"},Q={class:"bg-white rounded-lg shadow-sm border border-muted p-6"},R={class:"flex items-center"},W={class:"ml-4"},X={class:"text-2xl font-bold text-dark"},Z={class:"bg-white rounded-lg shadow-sm border border-muted p-6"},ee={class:"flex items-center"},te={class:"ml-4"},se={class:"text-2xl font-bold text-dark"},oe={class:"bg-white rounded-lg shadow-sm border border-muted p-6"},re={class:"flex items-center"},ie={class:"ml-4"},ae={class:"text-2xl font-bold text-dark"},de={class:"flex justify-between items-center mb-6"},ne={class:"flex gap-4"},le={key:0,class:"text-center py-12"},ce={key:1,class:"text-center py-12"},ue={key:2,class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"},me={key:0,class:"bg-primary text-dark px-3 py-1 text-sm font-semibold text-center"},xe={class:"h-48 bg-muted flex items-center justify-center"},ge={key:1,class:"text-4xl text-secondary"},pe={class:"p-4"},be={class:"flex items-start justify-between mb-2"},ve={class:"font-semibold text-dark text-lg line-clamp-2"},ye={key:0,class:"bg-accent text-white px-2 py-1 rounded text-xs font-semibold ml-2"},fe={class:"text-secondary text-sm mb-3 line-clamp-2"},_e={class:"space-y-1 text-sm text-secondary mb-3"},he={key:0,class:"flex items-center"},we={key:1,class:"flex items-center"},ke={class:"flex items-center"},Ce={class:"flex items-center justify-between mb-4"},Se={class:"text-2xl font-bold text-primary"},Le={class:"text-sm text-secondary"},Ve={class:"flex gap-2"},Fe=["onClick"],Ne={key:0,class:"mt-4 pt-4 border-t border-muted"},De={class:"flex gap-2"},Ee=["onClick"],Ie=["onClick"],Me=V({__name:"my-listings",setup(Pe){U({title:"My Classified Listings",description:"Manage your DogHealthy dog classifieds listings in the UK.",path:"/classifieds/my-listings",index:!1});const f=F(),b=N(),n=y([]),v=y(!0),m=y(""),x=D(()=>{const o=n.value.length,t=n.value.reduce((c,L)=>c+(L.view_count||0),0),r=n.value.filter(c=>c.is_featured).length;return{total:o,totalViews:t,featured:r,messages:0}}),w=o=>{switch(o){case"active":return"bg-green-100 text-green-800";
1case"pending":return"bg-yellow-100 text-yellow-800";case"sold":return"bg-blue-100 text-blue-800";case"inactive":return"bg-gray-100 text-gray-800";default:return"bg-gray-100 text-gray-800"}},k=o=>{switch(o){case"active":return"Active";case"pending":return"Pending";case"sold":return"Sold";case"inactive":return"Inactive";default:return"Unknown"}},C=o=>new Date(o).toLocaleDateString("en-GB",{year:"numeric",month:"short",day:"numeric"}),_=async()=>{try{v.value=!0;let o=f.from("doghealthy_listings").select("*").eq("user_id",b.userId).order("created_at",{ascending:!1});m.value&&(o=o.eq("status",m.value));const{data:t,error:r}=await o;if(r)throw r;n.value=t||[]}catch(o){console.error("Error fetching listings:",o)}finally{v.value=!1}},S=async o=>{if(b.userId&&confirm("Are you sure you want to delete this listing? This action cannot be undone."))try{const{error:t}=await f.from("doghealthy_listings").delete().eq("id",o).eq("user_id",b.userId);if(t)throw t;n.value=n.value.filter(r=>r.id!==o)}catch(t){console.error("Error deleting listing:",t),alert(t?.message||"Error deleting listing. Please try again.")}},h=async(o,t)=>{try{const{createCheckoutSession:r}=z();await r(o,t)}catch(r){console.error("Error upgrading listing:",r),alert("Error processing payment. Please try again.")}};return E(()=>{_()}),(o,t)=>{const r=$;return a(),i("div",G,[t[21]||(t[21]=e("div",{class:"mb-8"},[e("h1",{class:"text-4xl font-bold text-dark mb-4"},"My Listings"),e("p",{class:"text-secondary text-lg"},"Manage your dog breeding listings")],-1)),e("div",H,[e("div",K,[e("div",Y,[t[2]||(t[2]=e("div",{class:"p-3 bg-primary rounded-lg"},[e("i",{class:"bi bi-list-ul text-dark text-xl"})],-1)),e("div",J,[e("p",O,d(x.value.total),1),t[1]||(t[1]=e("p",{class:"text-secondary"},"Total Listings",-1))])])]),e("div",Q,[e("div",R,[t[4]||(t[4]=e("div",{class:"p-3 bg-secondary rounded-lg"},[e("i",{class:"bi bi-eye text-white text-xl"})],-1)),e("div",W,[e("p",X,d(x.value.totalViews),1),t[3]||(t[3]=e("p",{class:"text-secondary"},"Total Views",-1))])])]),e("div",Z,[e("div",ee,[t[6]||(t[6]=e("div",{class:"p-3 bg-accent rounded-lg"},[e("i",{class:"bi bi-star text-white text-xl"})],-1)),e("div",te,[e("p",se,d(x.value.featured),1),t[5]||(t[5]=e("p",{class:"text-secondary"},"Featured",-1))])])]),e("div",oe,[e("div",re,[t[8]||(t[8]=e("div",{class:"p-3 bg-dark rounded-lg"},[e("i",{class:"bi bi-chat-dots text-white text-xl"}
1)],-1)),e("div",ie,[e("p",ae,d(x.value.messages),1),t[7]||(t[7]=e("p",{class:"text-secondary"},"Messages",-1))])])])]),e("div",de,[e("div",ne,[I(e("select",{"onUpdate:modelValue":t[0]||(t[0]=s=>m.value=s),onChange:_,class:"border border-muted rounded-lg px-3 py-2 focus:ring-2 focus:ring-primary focus:border-primary"},[...t[9]||(t[9]=[P('<option value="" data-v-c9ee6573>All Status</option><option value="active" data-v-c9ee6573>Active</option><option value="pending" data-v-c9ee6573>Pending</option><option value="sold" data-v-c9ee6573>Sold</option><option value="inactive" data-v-c9ee6573>Inactive</option>',5)])],544),[[M,m.value]])]),g(r,{to:"/classifieds/new",class:"bg-primary hover:bg-accent text-dark px-6 py-3 rounded-lg font-semibold transition-colors"},{default:p(()=>[...t[10]||(t[10]=[e("i",{class:"bi bi-plus-lg mr-2"},null,-1),l(" Create New Listing ",-1)])]),_:1})]),v.value?(a(),i("div",le,[...t[11]||(t[11]=[e("div",{class:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto"},null,-1),e("p",{class:"text-secondary mt-4"},"Loading your listings...",-1)])])):n.value.length===0?(a(),i("div",ce,[t[13]||(t[13]=e("div",{class:"text-6xl mb-4"},"📝",-1)),t[14]||(t[14]=e("h3",{class:"text-xl font-semibold text-dark mb-2"},"No listings yet",-1)),t[15]||(t[15]=e("p",{class:"text-secondary mb-6"},"Create your first listing to start selling your dogs.",-1)),g(r,{to:"/classifieds/new",class:"bg-primary hover:bg-accent text-dark px-6 py-3 rounded-lg font-semibold transition-colors"},{default:p(()=>[...t[12]||(t[12]=[l(" Create Your First Listing ",-1)])]),_:1})])):(a(),i("div",ue,[(a(!0),i(q,null,A(n.value,s=>(a(),i("div",{key:s.id,class:"bg-white rounded-lg shadow-sm border border-muted overflow-hidden hover:shadow-md transition-shadow"},[e("div",{class:B(["px-4 py-2 text-sm font-semibold text-center",w(s.status)])},d(k(s.status)),3),s.is_featured?(a(),i("div",me," ⭐ Featured ")):u("",!0),e("div",xe,[s.images&&s.images.length>0?(a(),i("div",{key:0,class:"w-full h-full bg-cover bg-center",style:T({backgroundImage:`url(${s.images[0]})`})},null,4)):(a(),i("div",ge,"🐕"))]),e("div",pe,[e("div",be,[e("h3",ve,d(s.title),1),s.is_premium?(a(),i("span",ye,"Premium")):u("",!0)]),e("p",fe,d(s.description),1),e("div",_e,[s.breed?(a(),i("div",he,[t[16]||(t[16]=e("i",{class:"bi bi-tag mr-2"},null,-1)),l(" "+d(s.breed),1)])):u("",!0),s.location?(a(),i("div",we,[t[17]||(t[17]=e("i",{class:"bi bi-geo-alt mr-2"},null,-1)),l(" "+d(s.location),1)])):u("",!0),e("div",ke,[t[18]||(t[18]=e("i",{class:"bi bi-eye mr-2"},null,-1)),l(" "+d(s.view_count||0)+" views ",1)])]),e("div",Ce,[e("div",Se," £"+d(s.price_gbp?.toFixed(2)||"Contact"),1),e("div",Le,d(C(s.created_at)),1)]),e("div",Ve,[g(r,{to:`/classifieds/${s.id}`,class:"flex-1 bg-primary hover:bg-accent text-dark px-3 py-2 rounded text-center text-sm font-semibold transition-colors"},{default:p(()=>[...t[19]||(t[19]=[l(" View ",-1)])]),_:1},8,["to"]),g(r,{to:`/classifieds/${s.id}/edit`,class:"flex-1 bg-secondary hover:bg-dark text-white px-3 py-2 rounded text-center text-sm font-semibold transition-colors"},{default:p(()=>[...t[20]||(t[20]=[l(" Edit ",-1)])]),_:1},8,["to"]),e("button",{onClick:c=>S(s.id),class:"flex-1 bg-red-100 hover:bg-red-200 text-red-600 px-3 py-2 rounded text-sm font-semibold transition-colors"}," Delete ",8,Fe)]),s.status==="active"&&!s.is_premium?(a(),i("div",Ne,[e("div",De,[e("button",{onClick:c=>h(s.id,"premium"),class:"flex-1 bg-accent hover:bg-primary text-dark px-3 py-2 rounded text-sm font-semibold transition-colors"}," Premium (£9.99) ",8,Ee),e("button",{onClick:c=>h(s.id,"featured"),class:"flex-1 bg-primary hover:bg-accent text-dark px-3 py-2 rounded text-sm font-semibold transition-colors"}," Featured (£19.99) ",8,Ie)])])):u("",!0)])]))),128))]))])}}}),Te=j(Me,[["__scopeId","data-v-c9ee6573"]]);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.