"use strict";(globalThis.webpackChunkPlesk=globalThis.webpackChunkPlesk||[]).push([["app/convert-resellers-to-customers"],{3213(e,s,t){t.r(s),t.d(s,{default:()=>r});var i=t(95);class n extends i.ConfirmationPopupManager.PopupForm{_initConfiguration(e){super._initConfiguration({locale:i.Locale.getSection("admin.components.confirmations.reseller"),...e})}_onSuccessPreparePopup(e){if(this._clearMessages(),this._response=e,"success"===this._response.status){document.getElementById(this._formBoxAreaId).innerHTML="",document.getElementById(this._formListAreaId).innerHTML=`<table cellspacing="0" width="100%"><tbody id="${this._formListItemsAreaId}"></tbody></table>`;let e=!1;$H(this._response.resellers).each(({value:s})=>{0!==s.subscriptions.length&&(e=!0),this.addReseller(s)}),e&&(0,i.render)(document.getElementById(this._formDescriptionId),`&nbsp;${this.lmsg("descriptionExtended")}`)}else this._addErrorMessage(this._response.message)}addReseller(e){if(0===e.subscriptions.length){this._itemClass="odd"===this._itemClass?"even":"odd";const s=`<tr class="${this._itemClass}"><td><b>${(0,i.escapeHtml)(e.name)}</b></td><td>&nbsp;</td><td>&nbsp;</td></tr>`;(0,i.render)(document.getElementById(this._formListItemsAreaId),s)}else{let s=e.name;$H(e.subscriptions).each(({value:e})=>{this.addSubscription(e,s),s=" "})}}addSubscription(e,s){this._itemClass="odd"===this._itemClass?"even":"odd";const t=`<tr class="${this._itemClass}"><td><b>${(0,i.escapeHtml)(s)}</b></td><td>${(0,i.escapeHtml)(e.name)}</td><td>${this.getPlanSelectorHtml(e)}</td></tr>`;(0,i.render)(document.getElementById(this._formListItemsAreaId),t)}getPlanSelectorHtml(e){let s=`<select class="subscriptions" name="subscriptions[${e.id}]" id="" title="${e.id}">`;return $H(this._response.plans).each(({value:e})=>{s+=`<option value="${e.id}">${(0,i.escapeHtml)(e.name)}</option>`}),s+="</select>",s}_getAdditionalParams(e){return document.querySelectorAll(".subscriptions").forEach(({title:s,value:t})=>{e.set(`subscriptions[${s}]`,t)}),e}}const r=n}}]);
//# sourceMappingURL=convert-resellers-to-customers.js.map?4d3f520838e492c52785