PageSourceSearch

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

js doghealthy.netlify.app collected 2026-10-03 10:40:46 UTC 14,403 bytes, 1 lines download raw bytes

1import{f as F,D as I,u as T,g as Y,r as i,h as R,c as n,a as e,i as u,b as W,w as Z,j as l,d as S,F as H,k as G,t as d,l as J,m as c,v as p,n as K,e as O,o as a}from"#entry";import{u as Q}from"./Dy9pVEbO.js";import{u as j}from"./Z8EQgydt.js";import"./DKLWY9DJ.js";const X={class:"min-h-screen bg-gray-50 py-8"},ee={class:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"},te={key:0,class:"text-center py-12"},se={key:1,class:"grid md:grid-cols-2 gap-6"},oe={class:"flex justify-between items-start mb-4"},le={class:"flex items-start"},re={class:"text-xl font-semibold text-gray-900"},ne={key:0,class:"text-gray-600"},ae={key:1,class:"inline-block mt-1 px-2 py-1 bg-blue-100 text-blue-800 text-xs font-semibold rounded"},ie={class:"flex space-x-2"},de=["onClick"],ue=["onClick"],me={class:"space-y-3 text-sm"},ce={key:0,class:"flex items-start"},pe=["href"],be={key:1,class:"flex items-start"},fe=["href"],ge={key:2,class:"flex items-start"},xe={class:"text-gray-700"},ve={key:3,class:"flex items-start"},ye=["href"],he={key:4,class:"flex items-start pt-2 border-t border-gray-200"},we={class:"text-gray-600 text-sm"},ke={key:2,class:"bg-white rounded-lg shadow-md p-12 text-center"},_e={key:0,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50"},Ce={class:"bg-white rounded-lg max-w-2xl w-full max-h-[90vh] overflow-y-auto"},Ve={class:"p-6"},Me={class:"flex justify-between items-center mb-6"},je={class:"text-2xl font-bold text-gray-900"},De={class:"space-y-4"},Ae={class:"flex items-center"},Be={key:0,class:"mt-4 p-4 bg-red-50 border border-red-200 rounded-lg"},Ne={class:"text-red-800"},Se={class:"mt-6 flex justify-end space-x-4"},He=["disabled"],Ue={key:1,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50"},ze={class:"bg-white rounded-lg max-w-md w-full p-6"},Le={class:"flex justify-end space-x-4"},Ee=["disabled"],Te=F({__name:"vets",setup($e){const U=I(),f=T(),D=Y(),A=U.params.id,b=i("");Q(()=>({title:b.value?`Vets — ${b.value}`:"Dog Veterinarians",description:b.value?`Manage veterinary contacts linked to ${b.value} on DogHealthy.`:"Manage veterinary contacts for your dogs on DogHealthy.",index:!1}));const g=i([]),C=i(!0),B=i(!1),x=i(!1),w=i(!1),m=i(null),k=i(null),v=i(!1),_=i(!1),y=i(""),r=i({name:"",clinic_name:"",phone:"",email:"",address:"",website:"",notes:"",is_primary:!1}),z=async()=>{const{data:o}=await f.from("doghealthy_dogs").select("name").eq("id",A).single();o&&(b.value=o.name)},V=async(o=!1)=>{try{o?B.value=!0:C.value=!0;const{data:t,error:h}=await f.from("doghealthy_vets").select("*").eq("user_id",D.userId).order("is_primary",{ascending:!1}).order("name");if(h)throw h;g.value=t||[]}catch(t){console.error("Error fetching vets:",t)}finally{C.value=!1,B.value=!1}},L=o=>{m.value=o,r.value={name:o.name,clinic_name:o.clinic_name||"",phone:o.phone||"",email:o.email||"",address:o.address||"",website:o.website||"",notes:o.notes||"",is_primary:o.is_primary},x.value=!0},M=()=>{x.value=!1,m.value=null,r.value={name:"",clinic_name:"",phone:"",email:"",address:"",website:"",notes:"",is_primary:!1},y.value=""},N=async()=>{const{ensureCanCreate:o}=j();await o("vets",g.value.length)&&(m.value=null,x.value=!0)},E=async()=>{try{if(v.value=!0,y.value="",!m.value){const{ensureCanCreate:t}=j();if(!await t("vets",g.value.length)){v.value=!1;return}}const o={user_id:D.userId,name:r.value.name,clinic_name:r.value.clinic_name||null,phone:r.value.phone||null,email:r.value.email||null,address:r.value.address||null,website:r.value.website||null,notes:r.value.notes||null,is_primary:r.value.is_primary};if(m.value){const{error:t}=await f.from("doghealthy_vets").update(o).eq("id",m.value.id);if(t)throw t}else{const{error:t}=await f.from("doghealthy_vets").insert(o);if(t)throw t}M(),await V(!0)}catch(o){console.error("Error saving vet:",o),y.value=o.message||"Failed to save vet"}finally{v.value=!1}},$=o=>{k.value=o,w.value=!0},P=async()=>{if(k.value)try{_.value=!0;const{error:o}=await f.from("doghealthy_vets").delete().eq("id",k.value.id);if(o)throw o;await V(!0),w.value=!1,k.value=null}catch(o){console.error("Error deleting vet:",o),alert("Failed to delete vet")}finally{_.value=!1}};return R(async()=>{z(),V();const{resumeAddUi:o}=j();await o(()=>{m.value=null,x.value=!0})}),(o,t)=>{const h=O;return a(),n(H,null,[e("div",X,[e("div",ee,[W(h,{to:`/dogs/${l(A)}`,class:"text-blue-600 hover:text-blue-700 font-medium mb-6 inline-flex items-center"},{default:Z(()=>[t[9]||(t[9]=e("svg",{class:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 19l-7-7m0 0l7-7m-7 7h18"})],-1)),S(" Back to "+d(l(b)||"Dog"),1)]),_:1},8,["to"]),e("div",{class:"mb-8 flex justify-between items-center"},[t[11]||(t[11]=e("div",null,[e("h1",{class:"text-3xl font-bold text-gray-900"},"Veterinarians"),e("p",{class:"text-gray-600 mt-2"}
1,"Manage vet contacts and clinic information")],-1)),e("button",{onClick:N,class:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-3 rounded-lg font-semibold transition-colors inline-flex items-center"},[...t[10]||(t[10]=[e("svg",{class:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})],-1),S(" Add Vet ",-1)])])]),l(C)?(a(),n("div",te,[...t[12]||(t[12]=[e("div",{class:"inline-block animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"},null,-1),e("p",{class:"mt-4 text-gray-600"},"Loading vets...",-1)])])):l(g).length>0?(a(),n("div",se,[(a(!0),n(H,null,G(l(g),s=>(a(),n("div",{key:s.id,class:"bg-white rounded-lg shadow-md p-6"},[e("div",oe,[e("div",le,[t[13]||(t[13]=e("div",{class:"w-12 h-12 bg-red-100 rounded-full flex items-center justify-center text-2xl mr-4"}," 🏥 ",-1)),e("div",null,[e("h3",re,d(s.name),1),s.clinic_name?(a(),n("p",ne,d(s.clinic_name),1)):u("",!0),s.is_primary?(a(),n("span",ae," Primary Vet ")):u("",!0)])]),e("div",ie,[e("button",{onClick:q=>L(s),class:"text-blue-600 hover:text-blue-700 p-2",title:"Edit"},[...t[14]||(t[14]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})],-1)])],8,de),e("button",{onClick:q=>$(s),class:"text-red-600 hover:text-red-700 p-2",title:"Delete"},[...t[15]||(t[15]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1)])],8,ue)])]),e("div",me,[s.phone?(a(),n("div",ce,[t[16]||(t[16]=e("svg",{class:"w-5 h-5 text-gray-400 mr-3 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z"})],-1)),e("a",{href:`tel:${s.phone}`,class:"text-blue-600 hover:underline"},d(s.phone),9,pe)])):u("",!0),s.email?(a(),n("div",be,[t[17]||(t[17]=e("svg",{class:"w-5 h-5 text-gray-400 mr-3 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})],-1)),e("a",{href:`mailto:${s.email}`,class:"text-blue-600 hover:underline"},d(s.email),9,fe)])):u("",!0),s.address?(a(),n("div",ge,[t[18]||(t[18]=e("svg",{class:"w-5 h-5 text-gray-400 mr-3 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})],-1)),e("p",xe,d(s.address),1)])):u("",!0),s.website?(a(),n("div",ve,[t[19]||(t[19]=e("svg",{class:"w-5 h-5 text-gray-400 mr-3 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})],-1)),e("a",{href:s.website,target:"_blank",rel:"noopener noreferrer",class:"text-blue-600 hover:underline"},d(s.website),9,ye)])):u("",!0),s.notes?(a(),n("div",he,[t[20]||(t[20]=e("svg",{class:"w-5 h-5 text-gray-400 mr-3 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})],-1)),e("p",we,d(s.notes),1)])):u("",!0)])]))),128))])):(a(),n("div",ke,[t[21]||(t[21]=e("div",{class:"text-6xl mb-4"}
1,"🏥",-1)),t[22]||(t[22]=e("h3",{class:"text-xl font-semibold text-gray-900 mb-2"},"No Vets Added Yet",-1)),t[23]||(t[23]=e("p",{class:"text-gray-600 mb-6"},"Add your veterinarian's contact information to keep everything organized",-1)),e("button",{onClick:N,class:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-3 rounded-lg font-semibold transition-colors"}," Add Your First Vet ")]))])]),l(x)?(a(),n("div",_e,[e("div",Ce,[e("div",Ve,[e("div",Me,[e("h2",je,d(l(m)?"Edit Veterinarian":"Add Veterinarian"),1),e("button",{onClick:M,class:"text-gray-400 hover:text-gray-600"},[...t[24]||(t[24]=[e("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),e("form",{onSubmit:J(E,["prevent"])},[e("div",De,[e("div",null,[t[25]||(t[25]=e("label",{for:"name",class:"block text-sm font-medium text-gray-700 mb-2"}," Veterinarian Name * ",-1)),c(e("input",{id:"name","onUpdate:modelValue":t[0]||(t[0]=s=>l(r).name=s),type:"text",required:"",class:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Dr. Smith"},null,512),[[p,l(r).name]])]),e("div",null,[t[26]||(t[26]=e("label",{for:"clinic_name",class:"block text-sm font-medium text-gray-700 mb-2"}," Clinic Name ",-1)),c(e("input",{id:"clinic_name","onUpdate:modelValue":t[1]||(t[1]=s=>l(r).clinic_name=s),type:"text",class:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Happy Paws Veterinary Clinic"},null,512),[[p,l(r).clinic_name]])]),e("div",null,[t[27]||(t[27]=e("label",{for:"phone",class:"block text-sm font-medium text-gray-700 mb-2"}," Phone Number ",-1)),c(e("input",{id:"phone","onUpdate:modelValue":t[2]||(t[2]=s=>l(r).phone=s),type:"tel",class:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"+1 (555) 123-4567"},null,512),[[p,l(r).phone]])]),e("div",null,[t[28]||(t[28]=e("label",{for:"email",class:"block text-sm font-medium text-gray-700 mb-2"}," Email Address ",-1)),c(e("input",{id:"email","onUpdate:modelValue":t[3]||(t[3]=s=>l(r).email=s),type:"email",class:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"[email protected]"},null,512),[[p,l(r).email]])]),e("div",null,[t[29]||(t[29]=e("label",{for:"address",class:"block text-sm font-medium text-gray-700 mb-2"}," Address ",-1)),c(e("textarea",{id:"address","onUpdate:modelValue":t[4]||(t[4]=s=>l(r).address=s),rows:"2",class:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"123 Main St, City, State, ZIP"},null,512),[[p,l(r).address]])]),e("div",null,[t[30]||(t[30]=e("label",{for:"website",class:"block text-sm font-medium text-gray-700 mb-2"}," Website ",-1)),c(e("input",{id:"website","onUpdate:modelValue":t[5]||(t[5]=s=>l(r).website=s),type:"url",class:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"https://www.example.com"},null,512),[[p,l(r).website]])]),e("div",null,[t[31]||(t[31]=e("label",{for:"notes",class:"block text-sm font-medium text-gray-700 mb-2"}," Notes ",-1)),c(e("textarea",{id:"notes","onUpdate:modelValue":t[6]||(t[6]=s=>l(r).notes=s),rows:"3",class:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Additional information..."},null,512),[[p,l(r).notes]])]),e("div",Ae,[c(e("input",{id:"is_primary","onUpdate:modelValue":t[7]||(t[7]=s=>l(r).is_primary=s),type:"checkbox",class:"w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"},null,512),[[K,l(r).is_primary]]),t[32]||(t[32]=e("label",{for:"is_primary",class:"ml-2 text-sm font-medium text-gray-700"}," Set as primary veterinarian ",-1))])]),l(y)?(a(),n("div",Be,[e("p",Ne,d(l(y)),1)])):u("",!0),e("div",Se,[e("button",{type:"button",onClick:M,class:"px-6 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 transition-colors"}," Cancel "),e("button",{type:"submit",disabled:l(v),class:"px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50"},d(l(v)?"Saving...":l(m)?"Update":"Add"),9,He)])],32)])])])):u("",!0),l(w)?(a(),n("div",Ue,[e("div",ze,[t[33]||(t[33]=e("h3",{class:"text-xl font-bold text-gray-900 mb-4"},"Delete Veterinarian",-1)),t[34]||(t[34]=e("p",{class:"text-gray-600 mb-6"},"Are you sure you want to delete this vet? This action cannot be undone.",-1)),e("div",Le,[e("button",{onClick:t[8]||(t[8]=s=>w.value=!1),class:"px-6 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 transition-colors"}," Cancel "),e("button",{onClick:P,disabled:l(_),class:"px-6 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors disabled:opacity-50"},d(l(_)?"Deleting...":"Delete"),9,Ee)])])])):u("",!0)],64)}}});
1export{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.