1import{T as m,J as y,U as b,a1 as k,L as v,_ as C,t as D,c,o,b as s,u as i,v as a,e as _,x as d,N as I,F as x,D as B,O as A,w as L,d as w}from"./index-ae80RWzP.js";const E={name:"EditAccountsOrderModal",components:{BaseButton:v,DeleteIcon:k},props:{accounts:{type:Array,required:!0}},data(){return{reorderedAccounts:[...this.accounts],draggedItemIndex:null,selectedAccount:null,error:"",loading:!1}},computed:{hasAvailableAccounts(){return this.reorderedAccounts.some(e=>e.account)}},methods:{...m(b,["close"]),...m(y,["fetchUserProfile"]),onDragStart(e){this.draggedItemIndex=e},onDragOver(e){},onDrop(e){if(this.draggedItemIndex!==null){const t=this.reorderedAccounts[this.draggedItemIndex];this.reorderedAccounts.splice(this.draggedItemIndex,1),this.reorderedAccounts.splice(e,0,t),this.draggedItemIndex=null}},async removeAccount(){try{this.loading=!0;const{data:e}=await this.$axiosApi.delete(`gazprom-app/user/facility/${this.selectedAccount}`);e&&(await this.fetchUserProfile(),this.close())}catch(e){console.error("ÐÑибка пÑи оÑвÑзке лиÑевого ÑÑеÑа:",e),this.error="ÐÑоизоÑла оÑибка пÑи оÑвÑзке лиÑевого ÑÑеÑа"}this.loading=!1},async applyChanges(){this.loading=!0;const e=this.reorderedAccounts.map(t=>t.account);try{await this.$axiosApi.post("gazprom-app/user/facility/updateOrder",{facilities:e}).then(({data:t})=>{t&&(this.fetchUserProfile(),this.close())})}catch(t){console.error("ÐÑибка пÑи обновлении поÑÑдка ÑÑеÑов:",t),this.error="ÐÑоизоÑла оÑибка пÑи обновлении поÑÑдка ÑÑеÑов"}this.loading=!1}}},O={class:"edit-accounts"},N={class:"title"},S={key:0},U={key:1},M={key:2,class:"error-msg"},V={key:3,class:"delete-acc-modal"},F={key:0},P={key:1,style:{"margin-top":"10px"}},T=["onDragstart","onDragover","onDrop"],z={class:"edit-info"},W={key:0,class:"edit-acc"},q={class:"edit-address"},J={class:"btns"};function Y(e,t,$,j,n,l){const h=I,f=D("DeleteIcon"),g=v;return o(),c("div",O,[s("div",N,a(e.$t("modals.accountList.title")),1),l.hasAvailableAccounts?(o(),c("p",U,a(e.$t("modals.accountList.description")),1)):(o(),c("p",S,a(e.$t("modals.accountList.noAccounts")),1)),n.error?(o(),c("span",M,a(n.error),1)):i("",!0),n.selectedAccount?(o(),c("div",V,[s("span",null,[_(a(e.$t("modals.accountList.doYouWantToDelete"))+" ",1),s("b",null,a(n.selectedAccount),1),t[2]||(t[2]=_("?"))]),n.loading?(o(),c("div",P,[d(h)])):(o(),c("div",F,[s("button",{class:"operation",onClick:t[0]||(t[0]=(...r)=>l.removeAccount&&l.removeAccount(...r))},a(e.$t("modals.accountList.buttons.delete")),1),s("button",{class:"operation cancel",onClick:t[1]||(t[1]=r=>n.selectedAccount=null)},a(e.$t("modals.accountList.buttons.cancel")),1)]))])):i("",!0),s("ul",null,[(o(!0),c(x,null,B(n.reorderedAccounts.filter(r=>r.account),(r,u)=>(o(),c("li",{key:r.id,draggable:"true",onDragstart:p=>l.onDragStart(u),onDragover:A(p=>l.onDragOver(u),["prevent"]),onDrop:p=>l.onDrop(u)},[s("div",z,[s("div",null,[r.account?(o(),c("span",W,"ÐС: "+a(r.account),1)):i("",!0),s("span",q,a(r.address),1)]),s("div",null,[d(f,{fill:"#FC4E3C",width:"24",height:"24",class:"delete-icon",onClick:A(p=>n.selectedAccount=r.account,["prevent"])},null,8,["onClick"])])])],40,T))),128))]),s("div",J,[d(g,{onClick:e.close,text:"ÐÑмена",bgColor:"transparent",textColor:"#1852E0",style:{"align-self":"center !important"},class:"cancel-btn"},null,8,["onClick"]),d(g,{onClick:l.applyChanges,"disabled-btn":!l.hasAvailableAccounts,text:n.loading?"":e.$t("modals.accountList.buttons.apply"),bgColor:"#1852E0",style:{"margin-top":"30px !important","align-self":"stretch"}},{btnContent:L(()=>[n.loading?(o(),w(h,{key:0,loaderWidth:"10px",color:"white"})):i("",!0)]),_:1},8,["onClick","disabled-btn","text"])])])}const H=C(E,[["render",Y]]);export{H 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.