1import{r as n,s as Q,o as a,f as i,d,u as o,w as C,b as t,h as m,F as v,t as y,g as x,a as h,p,A as G,v as c,j as q,m as H,n as J,Q as X,E as Z,y as j}from"./runtime-dom.esm-bundler-BFbfmLfl.js";import{a as ee,h as te,l as V,r as O}from"./index.esm-C8-Okse2.js";import{_ as re}from"./ConsumerLayout-tjDWxGzL.js";import{A as R}from"./arrow-left-C_eslZG5.js";import{C as oe}from"./circle-check-big-By0smEjZ.js";import{L as se}from"./lock-BQyHxR7C.js";import{L as T}from"./loader-circle-BOF4Rcg5.js";import{M as le}from"./LoginModal-BMeMPme8.js";import{M as ae}from"./map-pin-7NBWNz8E.js";import{S as ie}from"./search-DRuNnyPk.js";import{B as de}from"./bed-QJSSLFd_.js";import{B as ne}from"./bath-BVk93Uiu.js";import{C as pe}from"./chevron-left-BqH44XVe.js";import{P as ue}from"./pound-sterling-DallvfDR.js";import{C as me}from"./check-CYOYuDcY.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./app-Dvzl3QXw.js";/* empty css */import"./echo-Cx0reEeH.js";import"./listingImageRemint-DdzXd0Qc.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./x-gRRgfAF8.js";import"./createLucideIcon-H8VPBXjN.js";import"./piggy-bank-C2v63urG.js";import"./chevron-down-CV0HnoXa.js";import"./sparkles-B9lXBQmj.js";import"./circle-alert-ByG7DPjo.js";import"./house-BnH-U5r3.js";import"./key-round-CDOVxIO1.js";import"./shield-xlcuWJAH.js";import"./SavePropertyModal-C2h6jxhG.js";import"./file-text-CxktRaAP.js";import"./AnimatedLogoMini-B6zedGia.js";/* empty css */import"./house-heart-BOl5N1QW.js";import"./clipboard-check-bysH7gwo.js";import"./arrow-left-right-CgpBd7hI.js";import"./calendar-clock-BpBm_Pbs.js";import"./bell-BnmfLsAP.js";import"./shield-check-CDldKyok.js";import"./file-key-D00z6oeF.js";import"./chevron-right-DQnPt1ZE.js";import"./menu-C8BKYvlP.js";import"./settings-kph8Slzw.js";import"./credit-card-Dn2M7EkH.js";import"./log-out-CydYSR5l.js";import"./ellipsis-pYE_Svwi.js";const ye={class:"max-w-2xl mx-auto px-4 sm:px-6 lg:px-8 py-6 sm:py-8"}
1,ce={class:"mb-6"},be={key:0,class:"bg-white border border-gray-200 rounded-2xl p-6"},xe={class:"text-center"},fe={class:"w-14 h-14 bg-emerald-50 rounded-2xl flex items-center justify-center mx-auto mb-4"},ge={class:"w-14 h-14 bg-amber-50 rounded-2xl flex items-center justify-center mx-auto mb-4"},ve={class:"text-gray-600 mt-2 max-w-md mx-auto"},he={key:0,class:"mt-4 bg-red-50 border border-red-200 rounded-xl p-3"},_e={class:"text-sm text-red-700"},we={class:"flex flex-col sm:flex-row items-center justify-center gap-3 mt-6"},ke=["disabled"],Ce={key:1,class:"bg-white border border-gray-200 rounded-2xl p-6"},Pe={class:"text-center mb-6"},Be={class:"w-14 h-14 bg-rose-50 rounded-2xl flex items-center justify-center mx-auto mb-4"},Ae={class:"space-y-4"},Se={class:"flex gap-2"},Me=["disabled"],Ue={key:0,class:"mt-2 text-sm text-amber-600"},Ve={key:0,class:"space-y-2"},qe={class:"max-h-64 overflow-y-auto space-y-2 border border-gray-200 rounded-xl p-2"},je=["onClick"],Re={class:"font-medium text-gray-900"},Te={class:"text-sm text-gray-500"},Ee={class:"bg-white border border-gray-200 rounded-2xl p-6"},Fe={class:"grid gap-4"},Le={key:0,class:"mt-1 text-sm text-red-600"},De={class:"grid sm:grid-cols-2 gap-4"},Ne={class:"bg-white border border-gray-200 rounded-2xl p-6"},Oe={class:"space-y-4"},$e={class:"grid sm:grid-cols-2 gap-3"},Ye=["onClick"],Ke={class:"font-medium text-gray-900"},We={class:"flex items-center gap-3 pt-2"},ze={class:"bg-white border border-gray-200 rounded-2xl p-6"},Ie={class:"grid gap-4"},Qe=["value"],Ge={class:"grid grid-cols-2 gap-4"},He={class:"relative"},Je={class:"relative"},Xe={class:"bg-white border border-gray-200 rounded-2xl p-6"},Ze={class:"grid sm:grid-cols-2 gap-4"},et={class:"relative"},tt={class:"relative"},rt={key:0,class:"bg-red-50 border border-red-200 rounded-xl p-4"},ot={class:"text-sm text-red-700"},st={class:"flex items-center justify-between pt-4"},lt=["disabled"],Zt={__name:"Create",props:{ownershipTypes:Object,propertyRoles:Object,propertyCount:{type:Number,default:0},maxProperties:{type:Number,default:10},limitReached:{type:Boolean,default:!1}},setup(_){const r=ee({address_line_1:"",address_line_2:"",town:"",county:"",postcode:"",uprn:null,ownership_type:"owner_occupied",property_role:"owner",property_type:"",bedrooms:null,bathrooms:null,purchase_date:"",purchase_price:null,is_primary_residence:!1}),f=n(""),P=n(!1),B=n([]),E=n(null),g=n(""),w=n(1),$=["Detached","Semi-detached","Terraced","Flat","Bungalow","Maisonette","End terrace","Town house","Cottage"],F=async()=>{var l;if(!f.value.trim()||f.value.trim().length<3){g.value="Please enter a valid postcode";return}P.value=!0,g.value="",B.value=[];try{const e=f.value.trim().replace(/\s+/g,""),s=await j.get(`/api/addresses/${encodeURIComponent(e)}`);(l=s.data)!=null&&l.length?B.value=s.data:g.value="No addresses found for this postcode. You can enter the address manually below."}catch(e){console.error("Address lookup error:",e),g.value="Could not find addresses. You can enter the address manually."}finally{P.value=!1}},Y=l=>{E.value=l,r.address_line_1=l.address_line_1||"",r.address_line_2=l.address_line_2||"",r.town=l.town_name||"",r.county="",r.postcode=l.postcode||f.value.toUpperCase(),r.uprn=l.property_token||null,l.bedrooms&&(r.bedrooms=l.bedrooms),l.bathrooms&&(r.bathrooms=l.bathrooms),l.property_type&&(r.property_type=l.property_type.charAt(0).toUpperCase()+l.property_type.slice(1)),w.value=2},K=()=>{r.postcode=f.value.toUpperCase(),w.value=2},W=()=>{w.value=1,E.value=null},A=n(!1),k=n(""),z=async()=>{var l,e,s,b,U,D;A.value=!0,k.value="";try{const u=await j.post(route("account.my-properties.store"),{address_line_1:r.address_line_1,address_line_2:r.address_line_2,town:r.town,county:r.county,postcode:r.postcode,uprn:r.uprn,ownership_type:r.ownership_type,property_role:r.property_role,property_type:r.property_type,bedrooms:r.bedrooms,bathrooms:r.bathrooms,purchase_date:r.purchase_date||null,purchase_price:r.purchase_price,is_primary_residence:r.is_primary_residence});(e=(l=u.data)==null?void 0:l.property)!=null&&e.id?O.visit(route("account.my-properties.show",u.data.property.id)):O.visit(route("account.my-properties.index"))}catch(u){console.error("Failed to create property:",u),(b=(s=u.response)==null?void 0:s.data)!=null&&b.message?k.value=u.response.data.message:(D=(U=u.response)==null?void 0:U.data)!=null&&D.errors?Object.keys(u.response.data.errors).forEac
1h(N=>{r.errors[N]=u.response.data.errors[N][0]}):k.value="Failed to add property. Please try again."}finally{A.value=!1}};Q(()=>r.ownership_type,l=>{l==="buy_to_let"||l==="investment"?r.property_role="landlord":r.property_role="owner"});const S=n(!1),L=n(!1),M=n(""),I=async()=>{var l,e;S.value=!0,M.value="";try{await j.post(route("account.my-properties.request-more")),L.value=!0}catch(s){console.error("Failed to request more properties:",s),M.value=((e=(l=s.response)==null?void 0:l.data)==null?void 0:e.message)||"Failed to submit request. Please try again."}finally{S.value=!1}};return(l,e)=>(a(),i(v,null,[d(o(te),{title:"Add Property"}),d(re,null,{default:C(()=>[t("div",ye,[t("div",ce,[d(o(V),{href:l.route("account.my-properties.index"),class:"inline-flex items-center gap-1 min-h-[44px] text-sm text-gray-600 hover:text-gray-900 mb-4"},{default:C(()=>[d(o(R),{class:"w-4 h-4"}),e[11]||(e[11]=m(" Back to My Properties ",-1))]),_:1},8,["href"]),e[12]||(e[12]=t("h1",{class:"text-xl sm:text-2xl font-bold text-gray-900"},"Add a Property",-1)),e[13]||(e[13]=t("p",{class:"mt-1 text-gray-600"},"Add a property you own to track its value and manage documents",-1))]),_.limitReached?(a(),i("div",be,[t("div",xe,[L.value?(a(),i(v,{key:0},[t("div",fe,[d(o(oe),{class:"w-7 h-7 text-emerald-600"})]),e[15]||(e[15]=t("h2",{class:"text-lg font-semibold text-gray-900"},"Request Submitted",-1)),e[16]||(e[16]=t("p",{class:"text-gray-600 mt-2 max-w-md mx-auto"}," Thank you for your request. Our team will review it and get back to you shortly to increase your property limit. ",-1)),d(o(V),{href:l.route("account.my-properties.index"),class:"inline-flex items-center gap-2 mt-6 px-6 py-2.5 min-h-[44px] bg-gray-900 hover:bg-gray-800 text-white font-medium rounded-xl transition-colors"},{default:C(()=>[d(o(R),{class:"w-4 h-4"}),e[14]||(e[14]=m(" Back to My Properties ",-1))]),_:1},8,["href"])],64)):(a(),i(v,{key:1},[t("div",ge,[d(o(se),{class:"w-7 h-7 text-amber-600"})]),e[19]||(e[19]=t("h2",{class:"text-lg font-semibold text-gray-900"},"Property Limit Reached",-1)),t("p",ve," You've added "+y(_.propertyCount)+" properties, which is the current maximum. To add more properties, please request an increase. ",1),M.value?(a(),i("div",he,[t("p",_e,y(M.value),1)])):x("",!0),t("div",we,[d(o(V),{href:l.route("account.my-properties.index"),class:"inline-flex items-center gap-2 px-5 py-2.5 min-h-[44px] text-gray-600 hover:text-gray-900 font-medium transition-colors"},{default:C(()=>[d(o(R),{class:"w-4 h-4"}),e[17]||(e[17]=m(" Back ",-1))]),_:1},8,["href"]),t("button",{onClick:I,disabled:S.value,class:"inline-flex items-center gap-2 px-6 py-2.5 min-h-[44px] bg-gradient-to-r from-pink-500 via-rose-500 to-orange-500 hover:shadow-md hover:shadow-pink-500/30 text-white font-medium rounded-xl transition-all disabled:opacity-50"},[S.value?(a(),h(o(T),{key:0,class:"w-4 h-4 animate-spin"})):(a(),h(o(le),{key:1,class:"w-4 h-4"})),e[18]||(e[18]=m(" Request More Properties ",-1))],8,ke)])],64))])])):x("",!0),!_.limitReached&&w.value===1?(a(),i("div",Ce,[t("div",Pe,[t("div",Be,[d(o(ae),{class:"w-7 h-7 text-rose-600"})]),e[20]||(e[20]=t("h2",{class:"text-lg font-semibold text-gray-900"},"Find your property",-1)),e[21]||(e[21]=t("p",{class:"text-gray-600 text-sm mt-1"},"Enter your postcode to find your address",-1))]),t("div",Ae,[t("div",null,[e[23]||(e[23]=t("label",{for:"postcode",class:"block text-sm font-medium text-gray-700 mb-1"}," Postcode ",-1)),t("div",Se,[p(t("input",{id:"postcode","onUpdate:modelValue":e[0]||(e[0]=s=>f.value=s),type:"text",placeholder:"e.g. SW1A 1AA",class:"flex-1 px-4 py-2.5 border border-gray-200 rounded-xl focus:ring-rose-500 focus:border-rose-500",onKeyup:G(F,["enter"])},null,544),[[c,f.value]]),t("button",{onClick:F,disabled:P.value,class:"px-4 py-2.5 min-h-[44px] bg-gray-900 hover:bg-gray-800 text-white font-medium rounded-xl transition-colors disabled:opacity-50 flex items-center gap-2"},[P.value?(a(),h(o(T),{key:0,class:"w-4 h-4 animate-spin"})):(a(),h(o(ie),{key:1,class:"w-4 h-4"})),e[22]||(e[22]=m(" Search ",-1))],8,Me)]),g.value?(a(),i("p",Ue,y(g.value),1)):x("",!0)]),B.value.length?(a(),i("div",Ve,[e[24]||(e[24]=t("p",{class:"text-sm font-medium text-gray-700"},"Select your address:",-1)),t("div",qe,[(a(!0),i(v,null,q(B.value,(s,b)=>(a(),i("button",{key:b,onClick:U=>Y(s),class:"w-full text-left px-4 py-3 min-h-[44px] hover:bg-gray-50 rounded-lg transition-colors border border-transparent hover:border-gray-200"},[t("p",Re,y(s.address_line_1),1),t("p",Te,y([s.address_line_2,s.town_name,s.postcode].filter(
1Boolean).join(", ")),1)],8,je))),128))])])):x("",!0),t("div",{class:"pt-4 border-t border-gray-200"},[t("button",{onClick:K,class:"w-full text-center py-2.5 min-h-[44px] text-sm text-gray-600 hover:text-gray-900 transition-colors"},[...e[25]||(e[25]=[m(" Can't find your address? ",-1),t("span",{class:"font-medium text-rose-600"},"Enter manually",-1)])])])])])):x("",!0),!_.limitReached&&w.value===2?(a(),i("form",{key:2,onSubmit:H(z,["prevent"]),class:"space-y-6"},[t("div",Ee,[t("div",{class:"flex items-center justify-between mb-4"},[e[26]||(e[26]=t("h2",{class:"font-semibold text-gray-900"},"Property Address",-1)),t("button",{type:"button",onClick:W,class:"text-sm text-rose-600 hover:text-rose-700 min-h-[44px] flex items-center"}," Change ")]),t("div",Fe,[t("div",null,[e[27]||(e[27]=t("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Address Line 1 *",-1)),p(t("input",{"onUpdate:modelValue":e[1]||(e[1]=s=>o(r).address_line_1=s),type:"text",required:"",class:"w-full px-4 py-2.5 border border-gray-200 rounded-xl focus:ring-rose-500 focus:border-rose-500"},null,512),[[c,o(r).address_line_1]]),o(r).errors.address_line_1?(a(),i("p",Le,y(o(r).errors.address_line_1),1)):x("",!0)]),t("div",null,[e[28]||(e[28]=t("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Address Line 2",-1)),p(t("input",{"onUpdate:modelValue":e[2]||(e[2]=s=>o(r).address_line_2=s),type:"text",class:"w-full px-4 py-2.5 border border-gray-200 rounded-xl focus:ring-rose-500 focus:border-rose-500"},null,512),[[c,o(r).address_line_2]])]),t("div",De,[t("div",null,[e[29]||(e[29]=t("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Town/City *",-1)),p(t("input",{"onUpdate:modelValue":e[3]||(e[3]=s=>o(r).town=s),type:"text",required:"",class:"w-full px-4 py-2.5 border border-gray-200 rounded-xl focus:ring-rose-500 focus:border-rose-500"},null,512),[[c,o(r).town]])]),t("div",null,[e[30]||(e[30]=t("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Postcode *",-1)),p(t("input",{"onUpdate:modelValue":e[4]||(e[4]=s=>o(r).postcode=s),type:"text",required:"",class:"w-full px-4 py-2.5 border border-gray-200 rounded-xl focus:ring-rose-500 focus:border-rose-500"},null,512),[[c,o(r).postcode]])])])])]),t("div",Ne,[e[33]||(e[33]=t("h2",{class:"font-semibold text-gray-900 mb-4"},"Ownership Details",-1)),t("div",Oe,[t("div",null,[e[31]||(e[31]=t("label",{class:"block text-sm font-medium text-gray-700 mb-2"},"What type of property is this? *",-1)),t("div",$e,[(a(!0),i(v,null,q(_.ownershipTypes,(s,b)=>(a(),i("button",{key:b,type:"button",onClick:U=>o(r).ownership_type=b,class:J(["px-4 py-3 border rounded-xl text-left transition-all",o(r).ownership_type===b?"border-rose-500 bg-rose-50 ring-1 ring-rose-500":"border-gray-200 hover:border-gray-300"])},[t("span",Ke,y(s),1)],10,Ye))),128))])]),t("div",We,[p(t("input",{id:"is_primary",type:"checkbox","onUpdate:modelValue":e[5]||(e[5]=s=>o(r).is_primary_residence=s),class:"w-5 h-5 text-rose-600 border-gray-300 rounded focus:ring-rose-500"},null,512),[[X,o(r).is_primary_residence]]),e[32]||(e[32]=t("label",{for:"is_primary",class:"text-sm text-gray-700"}," This is my primary residence ",-1))])])]),t("div",ze,[e[38]||(e[38]=t("h2",{class:"font-semibold text-gray-900 mb-4"},"Property Details",-1)),t("div",Ie,[t("div",null,[e[35]||(e[35]=t("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Property Type",-1)),p(t("select",{"onUpdate:modelValue":e[6]||(e[6]=s=>o(r).property_type=s),class:"w-full px-4 py-2.5 border border-gray-200 rounded-xl focus:ring-rose-500 focus:border-rose-500"},[e[34]||(e[34]=t("option",{value:""},"Select type...",-1)),(a(),i(v,null,q($,s=>t("option",{key:s,value:s},y(s),9,Qe)),64))],512),[[Z,o(r).property_type]])]),t("div",Ge,[t("div",null,[e[36]||(e[36]=t("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Bedrooms",-1)),t("div",He,[d(o(de),{class:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),p(t("input",{"onUpdate:modelValue":e[7]||(e[7]=s=>o(r).bedrooms=s),type:"number",min:"0",max:"20",class:"w-full pl-10 pr-4 py-2.5 border border-gray-200 rounded-xl focus:ring-rose-500 focus:border-rose-500"},null,512),[[c,o(r).bedrooms,void 0,{number:!0}]])])]),t("div",null,[e[37]||(e[37]=t("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Bathrooms",-1)),t("div",Je,[d(o(ne),{class:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),p(t("input",{"onUpdate:modelValue":e[8]||(e[8]=s=>o(r).bathrooms=s),type:"number",min:"0",max:"20",class:"w-full pl-10 pr-4 py-2.5 border border-gray-200 rounded-xl focus:ring-rose-500 focus:border-rose-500"},null,512),[[c,o(r).bathrooms,void 0,{number:!0}]])])])])])]),t("div",Xe,[e[41]||(e[41]=t("h2",{class:"font-semibold text-gray-900 mb-4"},[m("Purchase Details "),t("span",{class:"text-gray-400 font-normal"},"(Optional)")],-1)),t("div",Ze,[t("div",null,[e[39]||(e[39]=t("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Purchase Date",-1)),t("div",et,[d(o(pe),{class:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),p(t("input",{"onUpdate:modelValue":e[9]||(e[9]=s=>o(r).purchase_date=s),type:"date",class:"w-full pl-10 pr-4 py-2.5 border border-gray-200 rounded-xl focus:ring-rose-500 focus:border-rose-500"},null,512),[[c,o(r).purchase_date]])])]),t("div",null,[e[40]||(e[40]=t("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Purchase Price",-1)),t("div",tt,[d(o(ue),{class:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),p(t("input",{"onUpdate:modelValue":e[10]||(e[10]=s=>o(r).purchase_price=s),type:"number",min:"0",placeholder:"250000",class:"w-full pl-10 pr-4 py-2.5 border border-gray-200 rounded-xl focus:ring-rose-500 focus:border-rose-500"},null,512),[[c,o(r).purchase_price,void 0,{number:!0}]])])])])]),k.value?(a(),i("div",rt,[t("p",ot,y(k.value),1)])):x("",!0),t("div",st,[d(o(V),{href:l.route("account.my-properties.index"),class:"text-gray-600 hover:text-gray-900 min-h-[44px] flex items-center"},{default:C(()=>[...e[42]||(e[42]=[m(" Cancel ",-1)])]),_:1},8,["href"]),t("button",{type:"submit",disabled:A.value,class:"inline-flex items-center gap-2 px-6 py-2.5 min-h-[44px] bg-gradient-to-r from-pink-500 via-rose-500 to-orange-500 hover:shadow-md hover:shadow-
1pink-500/30 text-white font-medium rounded-xl transition-all disabled:opacity-50"},[A.value?(a(),h(o(T),{key:0,class:"w-4 h-4 animate-spin"})):(a(),h(o(me),{key:1,class:"w-4 h-4"})),e[43]||(e[43]=m(" Add Property ",-1))],8,lt)])],32)):x("",!0)])]),_:1})],64))}};export{Zt 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.