import{T as b,c as h,o as x,d as r,b as t,u as o}from"./app-fEKA3BkQ.js";import{_ as M}from"./SpinnerBtn-BezRkGQj.js";import{_ as y}from"./UserLayout-D_lxcpvH.js";import{_ as U}from"./AssetInput-EWE_Aw8o.js";import{_ as f}from"./InputField-C_K5Mgww.js";import{_ as v}from"./MultiSelect-D4amtqCA.js";import"./assetStore-BSVLrDIW.js";import"./PageHeader-DmRLoM5E.js";import"./ValidationErrors-B24rcOPH.js";const C={class:"card card-body mx-auto max-w-2xl"},E={class:"space-y-2"},$={class:"mb-2 grid grid-cols-3 place-items-end gap-3"},w={class:"flex flex-col gap-2"},N={class:"mt-2 flex w-full justify-end"},G=Object.assign({layout:y},{__name:"Edit",props:["groups","dialCodes","customer","groupIds"],setup(d){var i,n,m,u;const s=d,e=b({name:(i=s.customer)==null?void 0:i.name,picture:(n=s.customer)==null?void 0:n.picture,group_ids:s.groupIds??[],dial_code:(m=s.customer)==null?void 0:m.dial_code,phone:(u=s.customer)==null?void 0:u.phone,_method:"put"}),V=()=>{e.post(route("user.whatsapp.customers.update",s.customer))};return(k,a)=>{var p,c,_,g;return x(),h("div",C,[r("div",E,[t(f,{label:"Name",modelValue:o(e).name,"onUpdate:modelValue":a[0]||(a[0]=l=>o(e).name=l),placeholder:"Enter customer full name",validationMessage:(p=o(e).errors)==null?void 0:p.name},null,8,["modelValue","validationMessage"]),r("div",$,[t(v,{mode:"single","close-on-select":!1,searchable:!0,label:"Whatsapp Number","input-label":"name",modelValue:o(e).dial_code,"onUpdate:modelValue":a[1]||(a[1]=l=>o(e).dial_code=l),valueProp:"id",placeholder:"Dial Code",validationMessage:(c=o(e).errors)==null?void 0:c.dial_code,options:d.dialCodes},null,8,["modelValue","validationMessage","options"]),t(f,{classes:"col-span-2 ",type:"tel",modelValue:o(e).phone,"onUpdate:modelValue":a[2]||(a[2]=l=>o(e).phone=l),placeholder:"enter customer number (without country code)",validationMessage:(_=o(e).errors)==null?void 0:_.phone},null,8,["modelValue","validationMessage"])]),t(v,{label:"Select Group",modelValue:o(e).group_ids,"onUpdate:modelValue":a[3]||(a[3]=l=>o(e).group_ids=l),placeholder:"SELECT",validationMessage:(g=o(e).errors)==null?void 0:g.group_ids,options:d.groups,"value-prop":"value"},null,8,["modelValue","validationMessage","options"]),r("div",w,[t(U,{label:"Profile Image (Avatar)",modelValue:o(e).picture,"onUpdate:modelValue":a[4]||(a[4]=l=>o(e).picture=l)},null,8,["modelValue"])])]),r("div",N,[t(M,{onClick:V,processing:o(e).processing,"btn-text":"Update"},null,8,["processing"])])])}}});export{G as default};
