(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["app/convert-resellers-to-customers"],{1110:(e,t,s)=>{"use strict";s.r(t);var n=s(144);class i extends n.ConfirmationPopupManager.PopupForm{_initConfiguration(e){super._initConfiguration({locale:n.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="'.concat(this._formListItemsAreaId,'">')+"</tbody></table>";let e=!1;$H(this._response.resellers).each((({value:t})=>{0!==t.subscriptions.length&&(e=!0),this.addReseller(t)})),e&&(0,n.render)(document.getElementById(this._formDescriptionId),"&nbsp;".concat(this.lmsg("descriptionExtended")))}else this._addErrorMessage(this._response.message)}addReseller(e){if(0===e.subscriptions.length){this._itemClass="odd"===this._itemClass?"even":"odd";const t='<tr class="'.concat(this._itemClass,'">')+"<td><b>".concat((0,n.escapeHtml)(e.name),"</b></td>")+"<td>&nbsp;</td><td>&nbsp;</td></tr>";(0,n.render)(document.getElementById(this._formListItemsAreaId),t)}else{let t=e.name;$H(e.subscriptions).each((({value:e})=>{this.addSubscription(e,t),t=" "}))}}addSubscription(e,t){this._itemClass="odd"===this._itemClass?"even":"odd";const s='<tr class="'.concat(this._itemClass,'">')+"<td><b>".concat((0,n.escapeHtml)(t),"</b></td>")+"<td>".concat((0,n.escapeHtml)(e.name),"</td>")+"<td>".concat(this.getPlanSelectorHtml(e),"</td>")+"</tr>";(0,n.render)(document.getElementById(this._formListItemsAreaId),s)}getPlanSelectorHtml(e){let t='<select class="subscriptions" name="subscriptions['.concat(e.id,']" id="" title="').concat(e.id,'">');return $H(this._response.plans).each((({value:e})=>{t+='<option value="'.concat(e.id,'">').concat((0,n.escapeHtml)(e.name),"</option>")})),t+="</select>",t}_getAdditionalParams(e){return document.querySelectorAll(".subscriptions").forEach((({title:t,value:s})=>{e.set("subscriptions[".concat(t,"]"),s)})),e}}t.default=i}}]);
//# sourceMappingURL=convert-resellers-to-customers.js.map?366053e13d474edcd5ee