import{O as h,k as V,p as b,c as _,o as g,b as t,t as u,f as x,T as y,a as m,u as o,e as w,h as $,j as M}from"./app-B4kV47qU.js";import{_ as N}from"./SpinnerBtn-B3fjBeDL.js";import{_ as U}from"./UserLayout-DG2qUs8x.js";import{_ as k}from"./MultiSelect-Ba8gY0R1.js";import{_ as I}from"./InputField-DXo1g-Zb.js";import"./sharedComposable-VJJUONp6.js";import"./toastComposable-CvcyPmJb.js";import"./Modal-ChMy0A7y.js";import"./modalStore-BgORG3Nn.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./ToastrContainer-Cfx6wOd2.js";import"./AssetModal-vtiWQmiY.js";import"./IntersectionObserver-DbdokySM.js";import"./assetStore-cDK0Afhq.js";import"./multiselect-Bn1369QT.js";const S={class:"flex gap-x-2 items-center"},T=["href"],j=["src","alt"],B=h({__name:"ImageInput",props:["label","modelValue"],emits:["update:modelValue"],setup(d,{emit:r}){const e=d,c=r,a=V("");b(()=>{typeof e.modelValue=="string"&&(a.value=e.modelValue)});const p=i=>{const s=new FileReader;s.readAsDataURL(i),s.onload=()=>{a.value=s.result},c("update:modelValue",i)};return(i,s)=>(g(),_("div",null,[t("label",null,u(d.label),1),t("div",S,[a.value&&typeof a.value=="string"?(g(),_("a",{key:0,href:a.value,target:"_blank"},[t("img",{src:a.value,alt:a.value,class:"h-8"},null,8,j)],8,T)):x("",!0),t("input",{type:"file",accept:"image/*",class:"input",onInput:s[0]||(s[0]=l=>p(l.target.files[0]))},null,32)])]))}}),C={class:"card mx-auto max-w-2xl"},D={class:"card-body"},E={class:"grid grid-cols-1 gap-4"},P={class:"mb-2"},A={class:"mt-1 text-sm"},F={class:"alert-danger mt-1 rounded px-1"},O={class:"text-red-600"},R={class:"flex flex-col gap-2"},L={class:"mt-6 flex w-full justify-end"},ae=Object.assign({layout:U},{__name:"Edit",props:["groups","customer","groupIds"],setup(d){var a,p,i;const r=d,e=y({name:(a=r.customer)==null?void 0:a.name,picture:(p=r.customer)==null?void 0:p.picture,group_ids:r.groupIds??[],phone:(i=r.customer)==null?void 0:i.uuid,_method:"put"}),c=()=>{e.post(route("user.whatsapp-web.customers.update",r.customer))};return(s,l)=>{var f,v;return g(),_("div",C,[t("div",D,[t("div",E,[m(I,{label:"Name",modelValue:o(e).name,"onUpdate:modelValue":l[0]||(l[0]=n=>o(e).name=n),placeholder:"Enter customer full name",validationMessage:(f=o(e).errors)==null?void 0:f.name},null,8,["modelValue","validationMessage"]),t("div",P,[t("label",null,u(s.trans("Whatsapp Number")),1),w(t("input",{"onUpdate:modelValue":l[1]||(l[1]=n=>o(e).phone=n),class:"input",placeholder:"ex: 880 1234567890"},null,512),[[$,o(e).phone]]),t("p",A,[M(u(s.trans(" Note:"))+" ",1),t("span",F,u(s.trans("The number should start with country code")),1)]),t("p",O,u(o(e).errors.phone),1)]),m(k,{label:"Select groups",modelValue:o(e).group_ids,"onUpdate:modelValue":l[2]||(l[2]=n=>o(e).group_ids=n),placeholder:"Select groups",validationMessage:(v=o(e).errors)==null?void 0:v.group_ids,options:d.groups,valueProp:"value"},null,8,["modelValue","validationMessage","options"]),t("div",R,[t("label",null,u(s.trans("Profile Image (Avatar)")),1),m(B,{modelValue:o(e).picture,"onUpdate:modelValue":l[3]||(l[3]=n=>o(e).picture=n)},null,8,["modelValue"])])]),t("div",L,[m(N,{onClick:c,processing:o(e).processing,"btn-text":"Update"},null,8,["processing"])])])])}}});export{ae as default};
