PageSourceSearch

https://mdtextile.com/_nuxt/CvzKq9dK.js

js mdtextile.com collected 2026-10-06 19:01:06 UTC 13,985 bytes, 1 lines download raw bytes

1import{_ as X}from"./CqOYuSjR.js";import{f as Z,j as ee,U as se,c as r,a as e,b as f,d as u,l,t as i,m,F as U,r as M,s as B,p as a,q as p,v as z,a5 as E,y as v,x as h,z as te,o as d,k as oe}from"./CmOKha68.js";import{u as le,a as ne}from"./D3FEOpJ1.js";import{u as re}from"./svhc8Pse.js";const de={class:"min-h-screen bg-gray-50 py-8"},ie={class:"mx-auto max-w-4xl px-4 sm:px-6 lg:px-8"},ae={class:"mb-6 flex items-center justify-between"},ue={key:0,class:"mb-6 bg-green-50 border border-green-200 rounded-md p-4"},ce={class:"flex"},me={class:"ml-3"},pe={class:"text-sm text-green-700"},ge={key:1,class:"mb-6 bg-red-50 border border-red-200 rounded-md p-4"},fe={class:"flex"},be={class:"ml-3"},xe={class:"text-sm text-red-700"},ye={key:2,class:"text-center py-12"},_e={key:3,class:"bg-white rounded-lg shadow-sm p-12 text-center"},ve={class:"mt-6"},he={key:4,class:"grid grid-cols-1 gap-4 sm:grid-cols-2"},we={class:"mb-3"},ke={class:"text-sm font-semibold text-gray-900"},Ae={class:"flex gap-2 mt-1"},Ce={key:0,class:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800"},Ve={key:1,class:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-purple-100 text-purple-800"},Se={class:"text-sm text-gray-600 space-y-1"},Ue={class:"font-medium text-gray-900"},Me={key:0},De={class:"mt-4 flex gap-2"},Ne=["onClick"],qe=["onClick"],Be={class:"bg-white rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto"},ze={class:"px-6 py-4 border-b border-gray-200"},Ee={class:"text-lg font-semibold text-gray-900"},Fe={key:0,class:"mb-4 bg-red-50 border border-red-200 rounded-md p-4"},Le={class:"flex"},je={class:"ml-3"},He={class:"text-sm text-red-700"},Te={class:"grid grid-cols-1 gap-4 sm:grid-cols-2"},$e={class:"sm:col-span-2"},Pe={class:"sm:col-span-2"},Oe={class:"sm:col-span-2"},Ye={class:"sm:col-span-2"},Ie={class:"block text-sm font-medium text-gray-700 mb-1"},Re={key:0,class:"text-red-500"},Ge=["value"],Je=["value"],Ke={class:"sm:col-span-2 space-y-2"},Qe={class:"flex items-center"},We={class:"flex items-center"},Xe={class:"mt-6 flex justify-end gap-3"},Ze=["disabled"],es={key:0,class:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",viewBox:"0 0 24 24"},rs=Z({__name:"addresses",setup(ss){const{addresses:w,loading:y,error:D,fetchAddresses:F,addAddress:L,updateAddress:j,deleteAddress:H}=le(),{shopSettings:T,fetchShopSettings:$}=re(),P=h(()=>T.value.supported_countries),{countries:O,getRegions:Y,getCountryName:N,defaultCountryCode:I}=ne(P),_=v(!1),b=v(null),k=h(()=>!!b.value),o=te({label:"",first_name:"",last_name:"",phone:"",address_line_1:"",address_line_2:"",city:"",state:"",postal_code:"",country:"MY",is_default_shipping:!1,is_default_billing:!1}),A=h(()=>Y(o.country)),R=h(()=>{const n=O.value;return o.country&&!n.some(s=>s.code===o.country)?[...n,{name:N(o.country),code:o.country}]:n}),c=v(null),x=v(null);function G(){o.state=""}ee(async()=>{await Promise.all([F(),$()])});function q(){C(),b.value=null,_.value=!0}function J(n){C(),b.value=n,Object.assign(o,{label:n.label||"",first_name:n.first_name,last_name:n.last_name,phone:n.phone,address_line_1:n.address_line_1,address_line_2:n.address_line_2||"",city:n.city,state:n.state,postal_code:n.postal_code,country:n.country,is_default_shipping:n.is_default_shipping,is_default_billing:n.is_default_billing}),_.value=!0}function C(){o.label="",o.first_name="",o.last_name="",o.phone="",o.address_line_1="",o.address_line_2="",o.city="",o.state="",o.postal_code="",o.country=I.value,o.is_default_shipping=!1,o.is_default_billing=!1,x.value=null}function V(){_.value=!1,b.value=null,C()}async function K(){c.value=null,x.value=null;try{k.value&&b.value?(await j(b.value.id,o),c.value="Address updated successfully!"):(await L(o),c.value="Address added successfully!"),V(),setTimeout(()=>{c.value=null},3e3)}catch(n){x.value=n.data?.message||n.message||"Failed to save address"}}async function Q(n){const S=n.is_default_shipping||n.is_default_billing?"This is your default shipping/billing address. Deleting it will promote another address as default. Continue?":"Are you sure you want to delete this address?";if(confirm(S)){c.value=null;try{await H(n.id),c.value="Address deleted successfully!",setTimeout(()=>{c.value=null},3e3)}catch{}}}return se().set([{label:"Home",to:"/"},{label:"Account",to:"/account/profile"},{label:"Addresses"}],"account"),(n,s)=>{const S=X,g=oe;return d(),r("div",de,[e("div",ie,[f(S),e("div",ae,[s[14]||(s[14]=e("div",null,[e("h1",{class:"text-2xl font-bold text-gray-900"}," My Addresses "),e("p",{class:"mt-1 text-sm text-gray-500"}," Manage your saved shipping and billing addresses ")],-1)),e("button",{onClick:q,class:"inline-flex items-center px-4 py-2 border border-transparent roun
1ded-md shadow-sm text-sm font-medium text-white bg-green-600 hover:bg-green-700"},[f(g,{name:"i-heroicons-plus",class:"h-5 w-5 mr-2"}),s[13]||(s[13]=u(" Add Address ",-1))])]),l(c)?(d(),r("div",ue,[e("div",ce,[f(g,{name:"i-heroicons-check-circle",class:"h-5 w-5 text-green-400 flex-shrink-0"}),e("div",me,[e("p",pe,i(l(c)),1)])])])):m("",!0),l(D)?(d(),r("div",ge,[e("div",fe,[f(g,{name:"i-heroicons-exclamation-circle",class:"h-5 w-5 text-red-400 flex-shrink-0"}),e("div",be,[e("p",xe,i(l(D)),1)])])])):m("",!0),l(y)&&l(w).length===0?(d(),r("div",ye,[...s[15]||(s[15]=[e("div",{class:"inline-flex items-center text-gray-500"},[e("svg",{class:"animate-spin h-5 w-5 mr-3",viewBox:"0 0 24 24"},[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4",fill:"none"}),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]),u(" Loading addresses... ")],-1)])])):l(w).length===0?(d(),r("div",_e,[f(g,{name:"i-heroicons-map-pin",class:"mx-auto h-12 w-12 text-gray-400"}),s[17]||(s[17]=e("h3",{class:"mt-2 text-sm font-semibold text-gray-900"}," No addresses saved ",-1)),s[18]||(s[18]=e("p",{class:"mt-1 text-sm text-gray-500"}," Add an address to speed up checkout. ",-1)),e("div",ve,[e("button",{onClick:q,class:"inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-green-600 hover:bg-green-700"},[f(g,{name:"i-heroicons-plus",class:"h-5 w-5 mr-2"}),s[16]||(s[16]=u(" Add Your First Address ",-1))])])])):(d(),r("div",he,[(d(!0),r(U,null,M(l(w),t=>(d(),r("div",{key:t.id,class:"bg-white rounded-lg shadow-sm p-6 relative"},[e("div",we,[e("h3",ke,i(t.label||"Untitled Address"),1),e("div",Ae,[t.is_default_shipping?(d(),r("span",Ce," Default Shipping ")):m("",!0),t.is_default_billing?(d(),r("span",Ve," Default Billing ")):m("",!0)])]),e("div",Se,[e("p",Ue,i(t.full_name||`${t.first_name} ${t.last_name}`),1),e("p",null,i(t.phone),1),e("p",null,i(t.address_line_1),1),t.address_line_2?(d(),r("p",Me,i(t.address_line_2),1)):m("",!0),e("p",null,i(t.city)+", "+i(t.state)+" "+i(t.postal_code),1),e("p",null,i(l(N)(t.country)),1)]),e("div",De,[e("button",{onClick:W=>J(t),class:"text-sm font-medium text-green-600 hover:text-green-700"}," Edit ",8,Ne),e("button",{onClick:W=>Q(t),class:"text-sm font-medium text-red-600 hover:text-red-700"}," Delete ",8,qe)])]))),128))]))]),l(_)?(d(),r("div",{key:0,class:"fixed inset-0 bg-gray-500 bg-opacity-75 flex items-center justify-center p-4 z-50",onClick:B(V,["self"])},[e("div",Be,[e("div",ze,[e("h2",Ee,i(l(k)?"Edit Address":"Add New Address"),1)]),e("form",{onSubmit:B(K,["prevent"]),class:"px-6 py-4"},[l(x)?(d(),r("div",Fe,[e("div",Le,[f(g,{name:"i-heroicons-exclamation-circle",class:"h-5 w-5 text-red-400 flex-shrink-0"}),e("div",je,[e("p",He,i(l(x)),1)])])])):m("",!0),e("div",Te,[e("div",$e,[s[19]||(s[19]=e("label",{class:"block text-sm font-medium text-gray-700 mb-1"}," Label (e.g., Home, Office) ",-1)),a(e("input",{"onUpdate:modelValue":s[0]||(s[0]=t=>l(o).label=t),type:"text",class:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500",placeholder:"Home"},null,512),[[p,l(o).label]])]),e("div",null,[s[20]||(s[20]=e("label",{class:"block text-sm font-medium text-gray-700 mb-1"},[u(" First Name "),e("span",{class:"text-red-500"},"*")],-1)),a(e("input",{"onUpdate:modelValue":s[1]||(s[1]=t=>l(o).first_name=t),type:"text",required:"",class:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500"},null,512),[[p,l(o).first_name]])]),e("div",null,[s[21]||(s[21]=e("label",{class:"block text-sm font-medium text-gray-700 mb-1"},[u(" Last Name "),e("span",{class:"text-red-500"},"*")],-1)),a(e("input",{"onUpdate:modelValue":s[2]||(s[2]=t=>l(o).last_name=t),type:"text",required:"",class:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500"},null,512),[[p,l(o).last_name]])]),e("div",Pe,[s[22]||(s[22]=e("label",{class:"block text-sm font-medium text-gray-700 mb-1"},[u(" Phone "),e("span",{class:"text-red-500"},"*")],-1)),a(e("input",{"onUpdate:modelValue":s[3]||(s[3]=t=>l(o).phone=t),type:"tel",required:"",class:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500"},null,512),[[p,l(o).phone]])]),e("div",Oe,[s[23]||(s[23]=e("label",{class:"block text-sm font-medium text-gray-700 mb-1"},[u(" Address Line 1 "),e("span",{class:"text-red-500"},"*")],-1)),a(e("input",{"onUpdate:modelValue":s[4]||(s[4]=t=>l(o).address_line_1=t),type:"text",required:"",class:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500"},null,512),[[p,l(o).address_line_1]])]),e("div",Ye,[s[24]||(s[24]=e("label",{class:"block text-sm font-medium text-gray-700 mb-1"}," Address Line 2 ",-1)),a(e("input",{"onUpdate:modelValue":s[5]||(s[5]=t=>l(o).address_line_2=t),type:"text",class:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500"},null,512),[[p,l(o).address_line_2]])]),e("div",null,[s[25]||(s[25]=e("label",{class:"block text-sm font-medium text-gray-700 mb-1"},[u(" City "),e("span",{class:"text-red-500"},"*")],-1)),a(e("input",{"onUpdate:modelValue":s[6]||(s[6]=t=>l(o).city=t),type:"text",required:"",class:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500"},null,512),[[p,l(o).city]])]),e("div",null,[e("label",Ie,[s[26]||(s[26]=u(" State ",-1)),l(A).length>0?(d(),r("span",Re,"*")):m("",!0)]),l(A).length>0?a((d(),r("select",{key:0,"onUpdate:modelValue":s[7]||(s[7]=t=>l(o).state=t),required:"",class:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500"},[s[27]||(s[27]=e("option",{value:"",disabled:""},"Select state",-1)),(d(!0),r(U,null,M(l(A),t=>(d(),r("option",{key:t.code,value:t.name},i(t.name),9,Ge))),128))],512)),[[z,l(o).state]]):a((d(),r("input",{key:1,"onUpdate:modelValue":s[8]||(s[8]=t=>l(o).state=t),type:"text",class:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500",placeholder:"State / Province"},null,512)),[[p,l(o).state]])]),e("div",null,[s[28]||(s[28]=e("label",{class:"block text-sm font-medium text-gray-700 mb-1"},[u(" Postal Code "),e("span",{class:"text-red-500"},"*")],-1)),a(e("input",{"onUpdate:modelValue":s[9]||(s[9]=t=>l(o).postal_code=t),type:"text",required:"",class:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500"},null,512),[[p,l(o).postal_code]])]),e("div",null,[s[30]||(s[30]=e("label",{class:"block text-sm font-medium text-gray-700 mb-1"},[u(" Country "),e("span",{class:"text-red-500"},"*")],-1)),a(e("select",{"onUpdate:modelValue":s[10]||(s[10]=t=>l(o).country=t),required:"",class:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500",onChange:G},[s[29]||(s[29]=e("option",{value:"",disabled:""},"Select country",-1)),(d(!0),r(U,null,M(l(R),t=>(d(),r("option",{key:t.code,value:t.code},i(t.name),9,Je))),128))],544),[[z,l(o).country]])]),e("div",Ke,[e("label",Qe,[a(e("input",{"onUpdate:modelValue":s[11]||(s[11]=t=>l(o).is_default_shipping=t),type:"checkbox",class:"rounded border-gray-300 text-green-600 focus:ring-green-500"},null,512),[[E,l(o).is_default_shipping]]),s[31]||(s[31]=e("span",{class:"ml-2 text-sm text-gray-700"},"Set as default shipping address",-1))]),e("label",We,[a(e("input",{"onUpdate:modelValue":s[12]||(s[12]=t=>l(o).is_default_billing=t),type:"checkbox",class:"rounded border-gray-300 text-green-600 focus:ring-green-500"},null,512),[[E,l(o).is_default_billing]]),s[32]||(s[32]=e("span",{class:"ml-2 text-sm text-gray-700"},"Set as default billing address",-1))])])]),e("div",Xe,[e("button",{type:"button",onClick:V,class:"px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50"}," Cancel "),e("button",{type:"submit",disabled:l(y),class:"inline-flex items-center px-4 py-2 border border-transparent roun
1ded-md shadow-sm text-sm font-medium text-white bg-green-600 hover:bg-green-700 disabled:opacity-50 disabled:cursor-not-allowed"},[l(y)?(d(),r("svg",es,[...s[33]||(s[33]=[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4",fill:"none"},null,-1),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},null,-1)])])):m("",!0),u(" "+i(l(y)?"Saving...":l(k)?"Update Address":"Add Address"),1)],8,Ze)])],32)])])):m("",!0)])}}});export{rs 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.