1import{f as I,u as W,g as R,r as u,q as U,h as V,c as l,a as r,b as c,w as f,i as v,m as a,v as m,I as y,F as B,k as C,y as P,t as d,l as _,a2 as N,e as z,Q as H,o as n,d as x}from"#entry";import{u as q}from"./Dy9pVEbO.js";import{u as K}from"./D5HOP8m2.js";import"./DKLWY9DJ.js";const O={class:"container mx-auto px-4 py-8 max-w-4xl"},j={key:0,class:"text-center py-12"},J={key:1,class:"text-center py-12"},$={key:2,class:"text-center py-12"},Y={key:3},Q={class:"mb-8"},X={class:"bg-white rounded-lg shadow-sm border border-muted p-6"},Z={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},ee={class:"mt-6"},re={class:"mt-6"},te={class:"bg-white rounded-lg shadow-sm border border-muted p-6"},ie={class:"grid grid-cols-1 md:grid-cols-3 gap-6"},se=["value"],oe={class:"mt-6"},le=["value"],ne={class:"bg-white rounded-lg shadow-sm border border-muted p-6"},ae={class:"bg-white rounded-lg shadow-sm border border-muted p-6"},de={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},ue={class:"p-4 border border-muted rounded-lg"},me={class:"flex items-center justify-between"},ge={class:"p-4 border border-muted rounded-lg"},pe={class:"flex items-center justify-between"},be={key:0,class:"mt-2 text-xs text-secondary"},ce={class:"mt-6 p-4 bg-muted rounded-lg"},fe={class:"flex items-center justify-between"},ve={class:"text-lg font-bold text-dark"},ye={key:0,class:"bg-white rounded-lg shadow-sm border border-muted p-6"},xe={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},he={key:0,class:"border border-primary rounded-lg p-4 bg-primary bg-opacity-5"},ke={key:1,class:"border border-accent rounded-lg p-4 bg-accent bg-opacity-10"},Se={class:"flex justify-end gap-4"},we=["disabled"],Te={key:0},Be={key:1},Me=I({__name:"edit",setup(Ce){q({title:"Edit Dog Listing",description:"Edit your DogHealthy classifieds listing.",index:!1});const h=W(),g=R(),D=H(),k=N(),o=u(null),S=u(!0),p=u(!1),w=u([]),t=u({title:"",description:"",breed:"",gender:"",age_weeks:null,price_gbp:null,location:"",dog_id:"",status:"active"}),L=["Affenpinscher","Afghan Hound","Airedale Terrier","Akbash","Akita","Alaskan Malamute","American Bulldog","American Bully","American Eskimo Dog","American Foxhound","American Pit Bull Terrier","American Staffordshire Terrier","American Water Spaniel","Anatolian Shepherd Dog","Australian Cattle Dog","Australian Kelpie","Australian Shepherd","Australian Terrier","Basenji","Basset Hound","Beagle","Bearded Collie","Beauceron","Bedlington Terrier","Belgian Malinois","Belgian Sheepdog","Belgian Tervuren","Bernese Mountain Dog","Bichon Frise","Black and Tan Coonhound","Black Russian Terrier","Bloodhound","Bluetick Coonhound","Boerboel","Border Collie","Border Terrier","Borzoi","Boston Terrier","Bouvier des Flandres","Boxer","Boykin Spaniel","Briard","Brittany","Brussels Griffon","Bull Terrier","Bulldog","Bullmastiff","Cairn Terrier","Canaan Dog","Cane Corso","Cardigan Welsh Corgi","Catahoula Leopard Dog","Caucasian Shepherd Dog","Cavalier King Charles Spaniel","Chesapeake Bay Retriever","Chihuahua","Chinese Crested","Chinese Shar-Pei","Chinook","Chow Chow","Clumber Spaniel","Cocker Spaniel","Collie","Curly-Coated Retriever","Dachshund","Dalmatian","Dandie Dinmont Terrier","Doberman Pinscher","Dogue de Bordeaux","English Cocker Spaniel","English Setter","English Springer Spaniel","English Toy Spaniel","English Toy Terrier","Eurasier","Field Spaniel","Finnish Lapphund","Finnish Spitz","Flat-Coated Retriever","French Bulldog","German Pinscher","German Shepherd Dog","German Shorthaired Pointer","German Spitz","German Wirehaired Pointer","Giant Schnauzer","Glen of Imaal Terrier","Golden Retriever","Gordon Setter","Great Dane","Great Pyrenees","Greater Swiss Mountain Dog","Greyhound","Harrier","Havanese","Ibizan Hound","Icelandic Sheepdog","Irish Red and White Setter","Irish Setter","Irish Terrier","Irish Water Spaniel","Irish Wolfhound","Italian Greyhound","Jack Russell Terrier","Japanese Akita","Japanese Chin","Japanese Spitz","Keeshond","Kerry Blue Terrier","Komondor","Kuvasz","Labrador Retriever","Lagotto Romagnolo","Lakeland Terrier","Leonberger","Lhasa Apso","Lowchen","Maltese","Manchester Terrier","Mastiff","Miniature Bull Terrier","Miniature Pinscher","Miniature Schnauzer","Neapolitan Mastiff","Newfoundland","Norfolk Terrier","Norweg
1ian Buhund","Norwegian Elkhound","Norwegian Lundehund","Norwich Terrier","Nova Scotia Duck Tolling Retriever","Old English Sheepdog","Otterhound","Papillon","Parson Russell Terrier","Pekingese","Pembroke Welsh Corgi","Petit Basset Griffon Vendeen","Pharaoh Hound","Plott","Pointer","Polish Lowland Sheepdog","Pomeranian","Poodle (Miniature)","Poodle (Standard)","Poodle (Toy)","Portuguese Water Dog","Pug","Puli","Pumi","Pyrenean Shepherd","Rhodesian Ridgeback","Rottweiler","Russell Terrier","Saint Bernard","Saluki","Samoyed","Schipperke","Scottish Deerhound","Scottish Terrier","Sealyham Terrier","Shetland Sheepdog","Shiba Inu","Shih Tzu","Siberian Husky","Silky Terrier","Skye Terrier","Sloughi","Smooth Fox Terrier","Soft Coated Wheaten Terrier","Spinone Italiano","Staffordshire Bull Terrier","Standard Schnauzer","Sussex Spaniel","Swedish Vallhund","Tibetan Mastiff","Tibetan Spaniel","Tibetan Terrier","Toy Fox Terrier","Treeing Walker Coonhound","Vizsla","Weimaraner","Welsh Springer Spaniel","Welsh Terrier","West Highland White Terrier","Whippet","Wire Fox Terrier","Wirehaired Pointing Griffon","Xoloitzcuintli","Yorkshire Terrier","Other"],A=U(()=>o.value&&g.userId&&o.value.user_id===g.userId),M=s=>new Date(s).toLocaleDateString("en-GB",{year:"numeric",month:"long",day:"numeric"}),E=async()=>{try{S.value=!0;const{data:s,error:e}=await h.from("doghealthy_listings").select("*").eq("id",k.params.id).single();if(e)throw e;o.value=s,t.value={title:s.title,description:s.description,breed:s.breed,gender:s.gender,age_weeks:s.age_weeks,price_gbp:s.price_gbp,location:s.location,dog_id:s.dog_id||"",status:s.status}}catch(s){console.error("Error fetching listing:",s)}finally{S.value=!1}},G=async()=>{try{const{data:s,error:e}=await h.from("doghealthy_dogs").select("id, name, breed").eq("user_id",g.userId).order("name");if(e)throw e;w.value=s||[]}catch(s){console.error("Error fetching user dogs:",s)}},F=async()=>{try{p.value=!0;const s={title:t.value.title,description:t.value.description,breed:t.value.breed,gender:t.value.gender||null,age_weeks:t.value.age_weeks||null,price_gbp:t.value.price_gbp,location:t.value.location,dog_id:t.value.dog_id||null,status:t.value.status},{error:e}=await h.from("doghealthy_listings").update(s).eq("id",k.params.id).eq("user_id",g.userId);if(e)throw e;D.push(`/classifieds/${k.params.id}`)}catch(s){console.error("Error updating listing:",s),alert(s?.message||"Error updating listing. Please try again.")}finally{p.value=!1}},T=async s=>{try{const{createCheckoutSession:e}=K();await e(o.value.id,s)}catch(e){console.error("Error upgrading listing:",e),alert("Error processing payment. Please try again.")}};return V(async()=>{await Promise.all([E(),G()])}),(s,e)=>{const b=z;return n(),l("div",O,[S.value?(n(),l("div",j,[...e[11]||(e[11]=[r("div",{class:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto"},null,-1),r("p",{class:"text-secondary mt-4"},"Loading listing...",-1)])])):o.value?A.value?(n(),l("div",Y,[r("div",Q,[c(b,{to:"/classifieds/my-listings",class:"inline-flex items-center text-secondary hover:text-primary mb-4"},{default:f(()=>[...e[20]||(e[20]=[r("i",{class:"bi bi-arrow-left mr-2"},null,-1),x(" Back to My Listings ",-1)])]),_:1}),e[21]||(e[21]=r("h1",{class:"text-4xl font-bold text-dark mb-4"},"Edit Listing",-1)),e[22]||(e[22]=r("p",{class:"text-secondary text-lg"},"Update your dog breeding listing",-1))]),r("form",{onSubmit:_(F,["prevent"]),class:"space-y-8"},[r("div",X,[e[28]||(e[28]=r("h2",{class:"text-xl font-semibold text-dark mb-4"},"Basic Information",-1)),r("div",Z,[r("div",null,[e[23]||(e[23]=r("label",{class:"block text-sm font-medium text-dark mb-2"},"Title *",-1)),a(r("input",{"onUpdate:modelValue":e[0]||(e[0]=i=>t.value.title=i),type:"text",placeholder:"e.g., Beautiful Golden Retriever Puppies",class:"w-full border border-muted rounded-lg px-3 py-2 focus:ring-2 focus:ring-primary focus:border-primary",required:""},null,512),[[m,t.value.title]])]),r("div",null,[e[24]||(e[24]=r("label",{class:"block text-sm font-medium text-dark mb-2"},"Price (£) *",-1)),a(r("input",{"onUpdate:modelValue":e[1]||(e[1]=i=>t.value.price_gbp=i),type:"number",step:"0.01",min:"0",placeholder:"e.g., 800.00",class:"w-full border border-muted rounded-lg px-3 py-2 focus:ring-2 focus:ring-primary focus:border-primary",required:""},null,512),[[m,t.value.price_gbp]])])]),r("div",ee,[e[25]||(e[25]=r("label",{class:"block text-sm font-medium text-dark mb-2"},"Description *",-1)),a(r("textarea",{"onUpdate:modelValue":e[2]||(e[2]=i=>t.value.description=i),rows:"4",placeholder:"Tell potential buyers about your dog, their temperament, health, and any other important details...",class:"w-full border border-muted rounded-lg px-3 py-2 focus:ring-2 focus:ring-primary focus:border-primary",required:""},null,512),[[m,t.value.description]])]),r("div",re,[e[27]||(e[27]=r("label",{class:"block text-sm font-medium text-dark mb-2"},"Status",-1)),a(r("select",{"onUpdate:modelValue":e[3]||(e[3]=i=>t.value.status=i),class:"w-full border border-muted rounded-lg px-3 py-2 focus:ring-2 focus:ring-primary focus:border-primary"},[...e[26]||(e[26]=[r("option",{value:"active"},"Active",-1),r("option",{value:"pending"},"Pending",-1),r("option",{value:"sold"},"Sold",-1),r("option",{value:"inactive"},"Inactive",-1)])],512),[[y,t.value.status]])])]),r("div",te,[e[37]||(e[37]=r("h2",{class:"text-xl font-semibold text-dark mb-4"},"Dog Details",-1)),r("div",ie,[r("div",null,[e[30]||(e[30]=r("label",{class:"block text-sm font-medium text-dark mb-2"},"Breed *",-1)),a(r("select",{"onUpdate:modelValue":e[4]||(e[4]=i=>t.value.breed=i),class:"w-full border border-muted rounded-lg px-3 py-2 focus:ring-2 focus:ring-primary focus:border-primary",required:""},[e[29]||(e[29]=r("option",{value:""},"Select Breed",-1)),(n(),l(B,null,C(L,i=>r("option",{key:i,value:i},d(i),9,se)),64))],512),[[y,t.value.breed]])]),r("div",null,[e[32]||(e[32]=r("label",{class:"block text-sm font-medium text-dark mb-2"},"Gender",-1)),a(r("select",{"onUpdate:modelValue":e[5]||(e[5]=i=>t.value.gender=i),class:"w-full border border-muted rounded-lg px-3 py-2 focus:ring-2 focus:ring-primary focus:border-primary"},[...e[31]||(e[31]=[r("option",{value:""},"Select Gender",-1),r("option",{value:"Male"},"Male",-1),r("option",{value:"Female"},"Female",-1)])],512),[[y,t.value.gender]])]),r("div",null,[e[33]||(e[33]=r("label",{class:"block text-sm font-medium text-dark mb-2"},"Age (weeks)",-1)),a(r("input",{"onUpdate:modelValue":e[6]||(e[6]=i=>t.value.age_weeks=i),type:"number",min:"0",placeholder:"e.g., 8",class:"w-full border border-muted rounded-lg px-3 py-2 focus:ring-2 focus:ring-primary focus:border-primary"},null,512),[[m,t.value.age_weeks]])])]),r("div",oe,[e[35]||(e[35]=r("label",{class:"block text-sm font-medium text-dark mb-2"},"Link to Existing Dog (Optional)",-1)),a(r("select",{"onUpdate:modelValue":e[7]||
1(e[7]=i=>t.value.dog_id=i),class:"w-full border border-muted rounded-lg px-3 py-2 focus:ring-2 focus:ring-primary focus:border-primary"},[e[34]||(e[34]=r("option",{value:""},"No existing dog profile",-1)),(n(!0),l(B,null,C(w.value,i=>(n(),l("option",{key:i.id,value:i.id},d(i.name)+" ("+d(i.breed)+")",9,le))),128))],512),[[y,t.value.dog_id]]),e[36]||(e[36]=r("p",{class:"text-sm text-secondary mt-1"},"Link this listing to an existing dog in your profile for easier management",-1))])]),r("div",ne,[e[39]||(e[39]=r("h2",{class:"text-xl font-semibold text-dark mb-4"},"Location",-1)),r("div",null,[e[38]||(e[38]=r("label",{class:"block text-sm font-medium text-dark mb-2"},"Location *",-1)),a(r("input",{"onUpdate:modelValue":e[8]||(e[8]=i=>t.value.location=i),type:"text",placeholder:"e.g., London, UK or Worthing, West Sussex",class:"w-full border border-muted rounded-lg px-3 py-2 focus:ring-2 focus:ring-primary focus:border-primary",required:""},null,512),[[m,t.value.location]])])]),r("div",ae,[e[45]||(e[45]=r("h2",{class:"text-xl font-semibold text-dark mb-4"},"Current Status",-1)),r("div",de,[r("div",ue,[e[41]||(e[41]=r("h3",{class:"font-semibold text-dark mb-2"},"Premium Status",-1)),r("div",me,[e[40]||(e[40]=r("span",{class:"text-sm text-secondary"},"Premium Listing",-1)),r("span",{class:P(["px-3 py-1 rounded-full text-sm font-semibold",o.value.is_premium?"bg-accent text-white":"bg-muted text-secondary"])},d(o.value.is_premium?"Active":"Inactive"),3)])]),r("div",ge,[e[43]||(e[43]=r("h3",{class:"font-semibold text-dark mb-2"},"Featured Status",-1)),r("div",pe,[e[42]||(e[42]=r("span",{class:"text-sm text-secondary"},"Featured Listing",-1)),r("span",{class:P(["px-3 py-1 rounded-full text-sm font-semibold",o.value.is_featured?"bg-primary text-dark":"bg-muted text-secondary"])},d(o.value.is_featured?"Active":"Inactive"),3)]),o.value.featured_until?(n(),l("div",be," Expires: "+d(M(o.value.featured_until)),1)):v("",!0)])]),r("div",ce,[r("div",fe,[e[44]||(e[44]=r("span",{class:"text-sm text-secondary"},"Total Views",-1)),r("span",ve,d(o.value.view_count||0),1)])])]),!o.value.is_premium||!o.value.is_featured?(n(),l("div",ye,[e[52]||(e[52]=r("h2",{class:"text-xl font-semibold text-dark mb-4"},"Upgrade Options",-1)),r("div",xe,[o.value.is_premium?v("",!0):(n(),l("div",he,[e[46]||(e[46]=r("h3",{class:"font-semibold text-dark mb-2"},"Premium Listing - £9.99",-1)),e[47]||(e[47]=r("ul",{class:"text-sm text-secondary space-y-1 mb-4"},[r("li",null,"⢠Highlighted listing"),r("li",null,"⢠Premium badge"),r("li",null,"⢠Higher search ranking"),r("li",null,"⢠More views")],-1)),e[48]||(e[48]=r("div",{class:"text-2xl font-bold text-primary"},"£9.99",-1)),r("button",{onClick:e[9]||(e[9]=i=>T("premium")),class:"w-full mt-4 bg-primary hover:bg-accent text-dark py-2 px-4 rounded-lg font-semibold transition-colors"}," Upgrade to Premium ")])),o.value.is_featured?v("",!0):(n(),l("div",ke,[e[49]||(e[49]=r("h3",{class:"font-semibold text-dark mb-2"},"Featured Listing - £19.99",-1)),e[50]||(e[50]=r("ul",{class:"text-sm text-secondary space-y-1 mb-4"},[r("li",null,"⢠Top placement in search results"),r("li",null,"⢠Featured badge and highlighting"),r("li",null,"⢠Maximum visibility"),r("li",null,"⢠30-day featured period")],-1)),e[51]||(e[51]=r("div",{class:"text-2xl font-bold text-accent"},"£19.99",-1)),r("button",{onClick:e[10]||(e[10]=i=>T("featured")),class:"w-full mt-4 bg-accent hover:bg-primary text-dark py-2 px-4 rounded-lg font-semibold transition-colors"}," Upgrade to Featured ")]))])])):v("",!0),r("div",Se,[c(b,{to:"/classifieds/my-listings",class:"bg-secondary hover:bg-dark text-white px-6 py-3 rounded-lg font-semibold transition-colors"},{default:f(()=>[...e[53]||(e[53]=[x(" Cancel ",-1)])]),_:1}),r("button",{type:"submit",disabled:p.value,class:"bg-primary hover:bg-accent text-dark px-6 py-3 rounded-lg font-semibold transition-colors disabled:bg-muted disabled:cursor-not-allowed"},[p.value?(n(),l("span",Te,"Updating Listing...")):(n(),l("span",Be,"Update Listing"))],8,we)])],32)])):(n(),l("div",$,[e[17]||(e[17]=r("div",{class:"text-6xl mb-4"},"ð",-1)),e[18]||(e[18]=r("h3",{class:"text-xl font-semibold text-dark mb-2"},"Access Denied",-1)),e[19]||(e[19]=r("p",{class:"text-secondary mb-6"},"You can only edit your own listings.",-1)),c(b,{to:"/classifieds",class:"bg-primary hover:bg-accent text-dark px-6 py-3 rounded-lg font-semibold transition-colors"},{default:f(()=>[...e[16]||(e[16]=[x(" Browse Listings ",-1)])]),_:1})])):(n(),l("div",J,[e[13]||(e[13]=r("div",{class:"text-6xl mb-4"},"ðâ",-1)),e[14]||(e[14]=r("h3",{class:"text-xl font-semibold text-dark mb-2"},"Listing not found",-1)),e[15]||(e[15]=r("p",{class:"text-secondary mb-6"},"This listing may have been removed or doesn't exist.",-1)),c(b,{to:"/classifieds/my-listings",class:"bg-primary hover:bg-accent text-dark px-6 py-3 rounded-lg font-semibold transition-colors"},{default:f(()=>[...e[12]||(e[12]=[x(" Back to My Listings ",-1)])]),_:1})]))])}}});
1export{Me 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.