import{_ as E}from"./BlueButton.vue_vue_type_script_setup_true_lang-CY8chwQm.js";import{_ as k}from"./InputText-B7svPZWH.js";import{_ as A}from"./InputSelect.vue_vue_type_script_setup_true_lang-DDGr1dhD.js";import{_ as y}from"./MessageInfo.vue_vue_type_script_setup_true_lang-C44lULuw.js";import{am as T,u as U,r as c,g as n,l as j,o as v,c as O,a as u,m as $,i as J,b as d,w as F,f as H}from"./index-Bb2UEb_P.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./IconChevronDown-NfcUpI8U.js";import"./index-Dax_IkAt.js";import"./HtmlContent-DrkJBX3e.js";const P={class:"md:tw-w-[500px] tw-flex-1 tw-flex tw-flex-col tw-justify-between tw-gap-4"},W={class:"tw-flex tw-flex-col md:tw-flex-row tw-gap-4 tw-mt-4"},q={class:"tw-flex tw-justify-end"},et={__name:"ModalWindowCreateContact",emits:["modalClose"],setup(z,{emit:_}){const w=T(),s=U(),C=_,r=c(""),a=c(""),x=c({}),g=c({Name:"",Sign:""}),o=n(()=>s.userInfo),l=n(()=>w.data.Notifies?.Methods),f=n(()=>l.value?.[a.value]?.Message||""),h=n(()=>Object.keys(o.value?.Contacts).map(t=>{if(!o.value?.Contacts?.[t]?.IsHidden)return o.value?.Contacts?.[t]}).filter(Boolean)),S=n(()=>Object.keys(l.value).filter(t=>l.value[t].IsActive==="1").map(t=>({name:l.value[t].Name,value:t})));function I(t){switch(t){case"Email":return"Электронная почта";case"SMS":return"Номер телефона";case"Jabber":return"Jabber ID";default:return"почта/телефон"}}function V(){C("modalClose")}function p(){let t={};h.value.forEach((e,i)=>{t[i]={...e,oldValue:e.Address}}),x.value=t,M()}function M(){g.value={Name:o.value?.Name,Email:o.value?.Email,Sign:o.value?.Sign}}p();function N(){const t={MethodID:a.value,Address:r.value,TimeBegin:"00",TimeEnd:"00",IsActive:"yes",ContactID:"0"};s.userEditContact(t).then(e=>{e.response==="SUCCESS"&&(s.fetchUserData().then(()=>{p()}),V())})}return j(()=>{s.OAuth()}),(t,e)=>{const i=y,b=A,B=k,D=E;return v(),O("div",P,[u("div",null,[e[2]||(e[2]=u("div",{class:"tw-text-2xl"},"Новый контакт",-1)),f.value?(v(),$(i,{key:0,class:"tw-mt-4",content:f.value},null,8,["content"])):J("",!0),u("div",W,[d(b,{modelValue:a.value,"onUpdate:modelValue":e[0]||(e[0]=m=>a.value=m),options:S.value,placeholder:"Тип адреса",class:"tw-min-w-60"},null,8,["modelValue","options"]),d(B,{modelValue:r.value,"onUpdate:modelValue":e[1]||(e[1]=m=>r.value=m),placeholder:I(a.value),class:"tw-w-full"},null,8,["modelValue","placeholder"])])]),u("div",q,[d(D,{onClick:N},{default:F(()=>e[3]||(e[3]=[H("Добавить контакт",-1)])),_:1,__:[3]})])])}}};export{et as default};
