import{_ as V}from"./ButtonDefault-CghIUDY0.js";import{m as L}from"./bootstrap-vue-next-3DpAa4tb.js";import{_ as P}from"./BlockSelectProfile-CSxCGNF6.js";import{Q as x,r,d as $,x as B,f as p,H as w,s as N,c as T,o as M,a as d,t as R,b as u,w as U,e as j}from"./index-CipWZKo_.js";import{u as A}from"./contracts-CILh9uSu.js";import{_ as F}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./multiselect-DWCHRlfT.js";const W={class:"modal__body"},H={class:"list-item__title"},K={class:"modal__input-row"},Q={class:"modal__input-row"},h={class:"modal__buttons-wrap"},q={__name:"ModalWindowDomainSelectOwner",props:["data"],emits:["modalClose","buttonClicked"],setup(m,{emit:k}){const c=x(),g=A(),n=r(null),a=r(!1),_=r(!1);r("Natural"),$();const v=B("emitter"),l=m,C=k,s=p(()=>{const t=Object.values(c.domainsList);return l.data.OrderID!==void 0&&l.data.OrderID!==null?t.filter(e=>e.OrderID===l.data.OrderID):null}),i=p(()=>g?.profileList),y=p(()=>Object.keys(i?.value).map(t=>({value:i.value?.[t]?.ID,name:i.value?.[t]?.Name})));w(()=>{y?.value.length<1&&v.emit("open-modal",{component:"NewProfile"})});function D(){C("modalClose")}function E(){v.emit("open-modal",{component:"AcceptCreateProfile"})}function b(){_.value=!0;let t;s.value&&s.value!==void 0?t=s.value[0].ID:t=l.data.DomainOrderID;const e={DomainOrderID:t,OwnerTypeID:"Profile",ProfileID:i.value[n.value]?.ID,Agree:a.value?"yes":"no"};c.DomainSelectOwner(e).then(({result:f,resultData:O})=>{f==="SUCCESS"&&D(),_.value=!1})}const I=t=>{t.key==="Enter"&&b()};return w(()=>{document.addEventListener("keyup",I),c.fetchDomainOrders()}),N(()=>{document.removeEventListener("keyup",I)}),(t,e)=>{const f=P,O=L,S=V;return M(),T("div",W,[d("div",H,"Владелец домена "+R(m.data?.Domain?m.data?.Domain:s.value?.[0]?.Domain),1),d("div",K,[u(f,{title:"",modelValue:n.value,"onUpdate:modelValue":e[0]||(e[0]=o=>n.value=o),domainOwner:!0,onButtonClicked:e[1]||(e[1]=o=>D())},null,8,["modelValue"])]),d("div",Q,[u(O,{modelValue:a.value,"onUpdate:modelValue":e[2]||(e[2]=o=>a.value=o)},{default:U(()=>e[5]||(e[5]=[j(" Согласен на передачу моих персональных данных регистратору ",-1)])),_:1,__:[5]},8,["modelValue"])]),d("div",h,[u(S,{class:"select-contract__button modal__button",label:"Создать новый профиль",onClick:e[3]||(e[3]=o=>E())}),u(S,{class:"modal__button",label:"Сохранить",disabled:!a.value||n.value===null,"is-loading":_.value,onClick:e[4]||(e[4]=o=>b())},null,8,["disabled","is-loading"])])])}}},te=F(q,[["__scopeId","data-v-4e9018f3"]]);export{te as default};
