PageSourceSearch

https://ritmopractik.ru/js/beeJS/widgets.js?_=988160

js ritmopractik.ru collected 2026-10-09 04:39:52 UTC 305,869 bytes, 5,604 lines download raw bytes

1(function(){if (!('Widget' in BeeJS.package('materials.ui.content')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("common");var materials = BeeJS.package("materials");var ui = BeeJS.package("materials.ui");
2class Widget extends common.ui.widget.Widget {
3constructor(data, service) {
4super();
5this._css = "materials-content";
6this._data = data;
7this._service = service;
8this.setTemplate(new beeJS.Template(0, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let material = model.data.material; html.push("\n<div class=\"");html.push(css);html.push("\">\n	<div class=\"");html.push(css);html.push("__title\">");html.push(material.name);html.push("</div>\n	<div>\n		");let type = material.type; html.push("\n		");if (type == 1539) { html.push("\n			<div class=\"");html.push(css);html.push("__player\">\n                <iframe src=\"");html.push(material.source.player);html.push("\"></iframe>\n            </div>\n		");} else if (type == 1540) { html.push("\n			<div class=\"");html.push(css);html.push("__player\">\n                <iframe src=\"");html.push(material.source.player);html.push("\"></iframe>\n            </div>		\n		");} else if (type == 1541) { html.push("\n			<div>\n				<a href=\"");html.push(material.source.download);html.push("\" download>\n					<button class=\"");html.push(css);html.push("__download\">Скачать</button>\n				</a>\n			</div>\n		");} else if (type == 1548) { html.push("\n			<div class=\"");html.push(css);html.push("__survey\" id=\"");html.push(bindInfo.registerInBindInfo('survey'));html.push("\"></div>\n		");} else if (type == 0) { html.push("\n			<div>\n        		<p>Поздравляем с завершением!</p>\n				<div class=\"");html.push(css);html.push("__pdf\" id=\"");html.push(bindInfo.registerInBindInfo('pdf'));html.push("\"></div>\n			</div>\n		");} else { html.push("\n			");console.log("Тип материала не поддерживается"); html.push("\n		");} html.push("\n	</div>\n	<div class=\"");html.push(css);html.push("__footer\" id=\"");html.push(bindInfo.registerInBindInfo('footer'));html.push("\">\n		<button type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('back'));html.push("\">Назад</button>\n		<button type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('forward'));html.push("\">Далее</button>\n	</div>\n</div>\n");return html.join('');}), {
9css: this._css,
10data: this._data,
11service: this._service
12});
13}
14_initControls() {
15this.onClick(this._bind._back, (item, i) => {
16this._setPrev();
17});
18this.onClick(this._bind._forward, (item, i) => {
19this._setNext();
20});
21}
22_initContent() {
23if (this._data.material.type == 1548) {
24this._initAnketa();
25} else if (this._data.material.type == 0) {
26this._initPDF();
27this._initFooter();
28} else {
29this._initFooter();
30}
31}
32_initAnketa() {
33let element = this._bind._survey;
34let uuid = this._data.material.source.player;
35let token = this._service.model.getValue("token");
36AnketaClient.init(element, uuid, token, (api) => {
37this._service.model.setValue("anketa", api, true);
38this._api = api;
39this._handleParams();
40this._initFooter();
41api.addEventHandler("INIT_PAGE_VIEW", () => {
42this._handleParams();
43this._initFooter();
44this._clearError();
45});
46});
47}
48_initFooter() {
49let el = this._bind._footer;
50let p = {};
51let m = {};
52if(this._api) {
53p.current = this._api.getCurrentPage();
54p.length = this._api.getAnketa().getPagesList().length;
55p.next = p.length > 1 && p.current != p.length-1;
56p.prev = p.length > 1 && p.current != 0;
57}
58m.current = this._data.index;
59m.length = this._service.model.getValue("materials").length;
60m.next = !p.next && m.length > 1 && m.current != m.length-1;
61m.prev = !p.prev && m.length > 1 && m.current != 0;
62el.classList.remove("next");
63el.classList.remove("prev");
64el.dataset.next = false;
65el.dataset.prev = false;
66if(p.next || m.next) {
67el.classList.add("next");
68el.dataset.next = p.next;
69}
70if(p.prev || m.prev) {
71el.classList.add("prev");
72el.dataset.prev = p.prev;
73}
74}
75_setPrev() {
76let el = this._bind._footer;
77if(this._api && el.dataset.prev === "true") {
78let pages = this._api.getAnketa().getPagesList();
79let current = this._api.getCurrentPage();
80this._api.gotoPage(pages[current-1].getUUID());
81} else {
82this._service.setMaterial(this._data.index - 1);
83}
84}
85_setNext() {
86let el = this._bind._footer;
87if(this._api && el.dataset.next === "true") {
88let pages = this._api.getAnketa().getPagesList();
89let current = this._api.getCurrentPage();
90if(this._api.checkRequiredQuestions()) {
91this._api.gotoPage(pages[current+1].getUUID());
92}
93} else {
94this._service.setMaterial(this._data.index + 1);
95}
96}
97_clearError() {
98document.getElementsByClassName("anketa-client__anketa-error")[0].innerHTML = "";
99}
100_handleParams() {
101let elements = this._bind._survey.getElementsByClassName("content__param");
102beeJS.ArrayUtil.forEach(elements, (c) => {
103let data = {
104id: {
105params: (c.dataset.param) ? c.dataset.param.split(",").map((p) => p.trim()) : [],
106except: (c.dataset.except) ? c.dataset.except.split(",").map((p) => p.trim()) : []
107},
108list: this._service.model.getValue("params"),
109hasButton: c.dataset.button,
110position: c.dataset.position
111};
112let widget = new ui.params.Widget(data, this._service);
113this._initWidget(c, widget);
114});
115}
116_initPDF() {
117(async () =>{
118let pdf = await this._service.loadPDF();
119if(pdf) {
120let a = document.createElement("a");
121a.innerHTML = "Скачать рабочую тетрадь";
122a.href = this._service.getLinkToPDF(pdf);
123a.target = "_blank";
124this._bind._pdf.appendChild(a);
125}
126})();
127}
128}
129;Widget.__pN='materials.ui.content';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('materials.ui.content'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('materials.ui.pages')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("common");var materials = BeeJS.package("materials");var ui = BeeJS.package("materials.ui");
130class Widget extends common.ui.widget.Widget {
131constructor(data, service) {
132super();
133this._css = "materials-pages";
134this._data = data;
135this._service = service;
136this.setTemplate(new beeJS.Template(1, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let api = model.data; html.push("\n");let pages = api.getAnketa().getPagesList();let current = api.getCurrentPage();html.push("\n");if(pages.length > 1) { html.push("\n    <div class=\"");html.push(css);html.push("\">\n        <div class=\"");html.push(css);html.push("__scale\" id=\"");html.push(bindInfo.registerInBindInfo('progress'));html.push("\">\n            ");let width = (current + 1) / pages.length * 100 + "%";let style = `style="width: ${width}"`;html.push("\n            <div class=\"progress\" ");html.push(style);html.push("></div>\n        </div>\n        <ul class=\"");html.push(css);html.push("__list\">\n            ");for(let page of pages) { html.push("\n                ");let uuid = page.getUUID();let order = page.getOrder();let title = (page.getText()) ? page.getText() : order + 1;let isActive = (current >= order) ? "active" : "";html.push("\n                <li class=\"");html.push(css);html.push("__title ");html.push(isActive);html.push("\" data-uuid=\"");
136html.push(uuid);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('page'));html.push("\">\n                    ");html.push(title);html.push("\n                </li>\n            ");} html.push("\n        </ul>\n    </div>\n");} html.push("\n");return html.join('');}), {
137css: this._css,
138data: this._data,
139service: this._service
140});
141}
142_initControls() {
143let api = this._data;
144this.forEach(this._bind._page, (item, i) => {
145item.onclick = () => {
146api.gotoPage(item.dataset.uuid);
147};
148});
149}
150}
151;Widget.__pN='materials.ui.pages';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('materials.ui.pages'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('materials.ui.nav')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("common");var materials = BeeJS.package("materials");var ui = BeeJS.package("materials.ui");var user = BeeJS.package("user");
152class Widget extends common.ui.widget.Widget {
153constructor(data, service) {
154super();
155this._css = "materials-nav";
156this._data = data;
157this._service = service;
158this.setTemplate(new beeJS.Template(2, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data.materials; html.push("\n<div class=\"");html.push(css);html.push("\">\n\n    <div id=\"");html.push(bindInfo.registerInBindInfo('changeAnketaTokenDiv'));html.push("\" style=\"display: none\">\n        <div style=\"margin-bottom: 5px;\">\n            Если у вас был заполнен опросник, а сейчас он пуст, пожалуйста, нажмите на кнопку “Восстановить информацию“\n        </div>\n        <button class=\"");html.push(css);html.push("__button\" id=\"");html.push(bindInfo.registerInBindInfo('useDefaultAnketaToken'));html.push("\">Восстановить информацию</button>\n    </div>\n    \n    ");if (data.length > 0) { html.push("\n        ");let accessDate = (new Date(data[0].time.end)).toLocaleString("ru", {"day": "numeric", "month": "long", hour: "numeric", minute: "numeric", timeZone: "Europe/Moscow"}).replace(new RegExp(" ",'g'), "&nbsp;").replace(new RegExp("в&nbsp;",'g'), ""); html.push("\n        <div class=\"");html.push(css);html.push("__access-date\">Доступ до ");html.push(accessDate);html.push("&nbsp;мск</div>\n    ");} html.push("\n    ");for(let item of data) { html.push("\n        <div>\n            <div class=\"");html.push(css);html.push("__item\"  id=\"");html.push(bindInfo.registerInBindInfo('item'));html.push("\" title=\"");html.push(item.name);html.push("\">\n                ");html.push(item.name);html.push("\n            </div>\n        </div>\n    ");} html.push("\n    ");if (model.data.ritmolog) { html.push("\n        <div class=\"");html.push(css);html.push("__ritmolog\">\n            ");let background = 'style="background-image:url('+ model.data.ritmolog.image+')"'; html.push("\n            <div class=\"ritmolog__image\" ");html.push(background);html.push("></div>\n            <div>\n                <div class=\"ritmolog__name\">");html.push(model.data.ritmolog.name);html.push("</div>\n                <div class=\"ritmolog__type\">");html.push(model.data.ritmolog.type);html.push("</div>\n            </div>\n        </div>\n        <button class=\"");html.push(css);html.push("__button\" id=\"");html.push(bindInfo.registerInBindInfo('contact'));html.push("\">Связаться с ритмологом</button>\n    ");} html.push("\n</div>\n");return html.join('');}), {
159css: this._css,
160data: this._data,
161service: this._service
162});
163}
164_initListeners() {
165this._service.model.addHandler("material", (value) => {
166this.forEach(this._bind._item, (item, i) => {
167item.classList.toggle("active", i === value.index);
168});
169});
170this._service.model.addHandler("anketa", (value) => {
171this._initPages(value);
172value.addEventHandler("INIT_PAGE_VIEW", () => {
173this._initPages(value);
174});
175});
176}
177_initControls() {
178this.onClick(this._bind._contact, (item, i) => {
179this._initModal();
180});
181this.onClick(this._bind._item, (item, i) => {
182this._service.setMaterial(i);
183});
184this._bind._item[0].click();
185this._handleToken();
186}
187_initPages(data) {
188let div = document.createElement("div");
189let index = this._service.model.getValue("material").index;
190this._bind._item[index].parentNode.appendChild(div);
191const widget = new ui.pages.Widget(data, this._service);
192this._initWidget(div, widget);
193if(this._activePages) {
194this._activePages.remove();
195}
196this._activePages = div;
197}
198_handleToken() {
199let start = "2025-12-15"
200if (this._data.materials !== null && this._data.materials.length > 0) {
201start = this._data.materials[0].time.start;
202}
203if (start < '2025-12-15') {
204let lsKey = "useDefaultAnketaToken_" + this._getKey();
205let useDefaultAnketaToken = localStorage.getItem(lsKey) === "true";
206if (!useDefaultAnketaToken) {
207this._bind._changeAnketaTokenDiv.style.display = "block";
208this._bind._useDefaultAnketaToken.onclick = () => {
209localStorage.setItem(lsKey, "true");
210location.reload();
211};
212}
213}
214}
215_initModal() {
216this._data.ritmolog.photo = this._data.ritmolog.image;
217const modal = this._service.modal.build();
218const data = {
219id: modal.id,
220title: "Связаться с ритмологом",
221widget: new user.consultations.ui.contact.Widget({modal: modal.id, data: this._data}, this._service)
222};
223const widget = new user.consultations.ui.modal.Widget(data, this._service.modal);
224widget.start(modal); 
225}
226}
227;Widget.__pN='materials.ui.nav';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('materials.ui.nav'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('materials.ui.shell')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("common");var materials = BeeJS.package("materials");var ui = BeeJS.package("materials.ui");
228class Widget extends common.ui.widget.Widget {
229constructor(data, service) {
230super();
231this._css = "materials-shell";
232this._data = service.model.getValue("data");
233this._service = service;
234this.setTemplate(new beeJS.Template(3, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__grid\" id=\"");html.push(bindInfo.registerInBindInfo('grid'));html.push("\">\n		<div>\n			<div class=\"");html.push(css);html.push("__header\">\n				<div class=\"");html.push(css);html.push("__breadcrumbs\" id=\"");html.push(bindInfo.registerInBindInfo('breadcrumbs'));html.push("\"></div>\n				<div class=\"");html.push(css);html.push("__button\" id=\"");html.push(bindInfo.registerInBindInfo('button'));html.push("\"></div>\n			</div>\n			<div id=\"");html.push(bindInfo.registerInBindInfo('content'));html.push("\"></div>\n		</div>\n        <div id=\"");html.push(bindInfo.registerInBindInfo('nav'));html.push("\"></div>\n    </div>\n</div>\n");return html.join('');}), {
235css: this._css,
236data: this._data,
237service: this._service
238});
239}
240_isPreload() {
241return true;
242}
243_preload() {
244return this._service.loadData();
245}
246_initListeners() {
247this._service.model.addHandler("material", (value) => {
248this._initMaterial(value);
249this._bind._grid.classList.remove("active");
250});
251}
252_initControls() {
253this.onClick(this._bind._button, (item, i) => {
254this._bind._grid.classList.toggle("active");
255});
256}
257_initContent() {
258let error = this._service.model.getValue("error");
259let data = [];
260data.materials = this._service.model.getValue("materials");
261data.ritmolog = this._service.model.getValue("ritmolog");
262if(error) {
263this._bind._content.innerHTML = error;
264} else {
265if (data.materials.length > 0) {
266this._initNav(data);
267} else {
268this._bind._content.innerHTML = "Нет доступных материалов";
269}
270}
271}
272_initNav(data) {
273const widget = new ui.nav.Widget(data, this._service);
274this._initWidget(this._bind._nav, widget);
275}
276_initMaterial(data) {
277this._bind._breadcrumbs.innerHTML = data.material.group.name;
278const widget = new ui.content.Widget(data, this._service);
279this._initWidget(this._bind._content, widget);
280}
281}
282;Widget.__pN='materials.ui.shell';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('materials.ui.shell'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('materials.ui.params')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("common");var materials = BeeJS.package("materials");var ui = BeeJS.package("materials.ui");
283class Widget extends common.ui.widget.Widget {
284constructor(data, service) {
285super();
286this._css = "materials-params";
287this._data = data;
288this._service = service;
289this.setTemplate(new beeJS.Template(4, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n");let ids = data.id.params;let list = (data.list) ? data.list : [];let params = list.filter((p) => ids.includes(p.id)).sort((a, b) => ids.indexOf(a.id) - ids.indexOf(b.id));for(let item of params) {if(data.position) {item.value = item.value.split("<br>")[data.position];}}html.push("\n<div class=\"");html.push(css);html.push("\">\n    ");if(params.length === ids.length) { html.push("\n        ");for(let item of params) { html.push("\n            <div class=\"");html.push(css);html.push("__item\">\n                <div>");html.push(item.name);html.push("</div>\n                <div>");html.push(item.value);html.push("</div>\n            </div>\n        ");} html.push("\n    ");} else { html.push("\n        <button type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('action'));html.push("\">Получить/показать параметры</button>\n    ");} html.push("\n</div>\n");return html.join('');}), {
290css: this._css,
291data: this._data
292});
293}
294_initControls() {
295this.onClick(this._bind._action, async (item, i) => {
296this._data.list = await this._service.loadParamsByIds(this._data.id.params, this._getExceptValues());
297this.restart();
298});
299}
300_getExceptValues() {
301let result = [];
302let list = (this._data.list) ? this._data.list : [];
303if (this._data.id.except) {
304result = list.filter((p) => this._data.id.except.includes(p.id)).map((p) => p.value);
305}
306return result;
307}
308}
309;Widget.__pN='materials.ui.params';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('materials.ui.params'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Service' in BeeJS.package('materials.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("common");
310class Service extends common.service.Service {
311constructor(model) {
312super();
313this.model = (model) ? model : new common.model.Model();
314this.config = {
315action: {
316list: 'integramma:materials.Material.getByLinkCode',
317pdf: 'integramma:materials.Material.getGroupConfig'
318},
319params: {
320list: "/cache/users/",
321get: "/personal/materials/getParams.php?paramId="
322},
323hostname: (window.location.hostname.includes("com")) ? "survey.rithm-time.com" : "survey.edlm.ru"
324};
325this.modal = new common.service.Modal();
326}
327async loadData() {
328let key = this.model.getValue("data").key;
329let json = await BX.ajax.runAction(this.config.action.list, {data: { code: key, expired: true }}
329);
330await this._loadAnketaClient();
331await this._loadAnketaToken();
332this._loadParams();
333if (json.status === "success") {
334if (json.data.Success === false) {
335this._handleError(json.data.message);
336} else {
337this._handleMaterials(json.data.accesses);
338this._handleTimer();
339this.model.setValue("ritmolog", json.data.ritmolog);
340}
341}
342}
343async loadPDF() {
344let id = this.model.getValue("materials")[0].group.id;
345let json = await BX.ajax.runAction(this.config.action.pdf, {method: 'GET', getParameters: { groupId: id }});
346return (!json.data.error) ? json.data: false;
347}
348async loadParamsByIds(paramIds, exceptValues) {
349let url = this.config.params.get+paramIds.join(",");
350if(exceptValues != "") {
351url += "&exceptValue="+exceptValues.join("|");
352}
353let data = await beeJS.Ajax.get(url);
354return JSON.parse(data);
355}
356_handleTimer() {
357let data = this.model.getValue("materials");
358let end = new Date(data[0].time.end);
359setInterval(() => {
360let current = new Date();
361if(current > end) {
362window.location.reload();
363}
364}, 60000);
365}
366_handleError(value) {
367let error = "";
368switch(value) {
369case "Link not found or expired":
370error = "Материалы не найдены или время просмотра закочилось";
371break
372case "code is missing":
373error = "Не указан ключ доступа";
374break
375case "Invalid code format":
376error = "Указан не существующий ключ доступа";
377break
378default:
379error = value;
380break
381}
382this.model.setValue("error", error, true);
383}
384_handleMaterials(data) {
385let list = Object.values(data);
386list.forEach(a => a.material.group = a.group);
387let result = list.map(a => a.material);
388result.forEach(m => {
389if (m.source && beeJS.ArrayUtil.isArray(m.source.player) && m.source.player.length > 0) {
390m.source.player = m.source.player[0];
391}
392});
393result.push({
394name: "Завершение",
395type: 0,
396group: result[0].group
397});
398this.model.setValue("materials", result, true);
399}
400setMaterial(index) {
401let materials = this.model.getValue("materials");
402let data = {
403index: index,
404material: materials[index]
405};
406this.model.setValue("material", data, true);
407}
408getLinkToPDF(path, name) {
409let data = {
410token: this.model.getValue("token"),
411path: path,
412};
413let title = (name) ? name: this.model.getValue("materials")[0].group.name;
414let json = Base64.encode(JSON.stringify(data));
415let hostname = this.config.hostname;
416let file = this._translit(title);
417let base = window.location.host+"/pdf/";
418let r = Math.floor(Math.random() * 99999);
419return "//"+hostname+":8086/waitPDF?fileName="+file+".pdf&readyMarkerId=readyToPrint&fromHtml=https://"+base+"?_="+r+"%26data=Y"+json;
420}
421async _loadAnketaClient() {
422if (typeof(AnketaClient) === "undefined") {
423const hostname = this.config.hostname;
424let url = "//"+hostname+"/js/build/client-all/anketa-client.js";
425await loadScript(url);
426AnketaClient.serverAddress = hostname;
427}
428}
429async _loadAnketaToken() {
430let token = this.model.getValue("data")?.anketa?.token;
431if(!token) {
432let json = await beeJS.Ajax.post("/personal/materials/token.php", {}); 
433let data = JSON.parse(json);
434token = data.data;
435}
436this.model.setValue("token", token, true);
437}
438async _loadParams() {
439let uuid = this.model.getValue("data")?.user?.uuid;
440let url = this.config.params.list + uuid + "/newParamsList.js?_=" + Math.random();
441let json = await beeJS.Ajax.get(url);
442let data = JSON.parse(json.replace(new RegExp("'",'g'),'"'));
443let result = [];
444for(let i in data) {
445result.push({
446id: data[i].PARAM_ID,
447name: data[i].PARAM,
448value: data[i].VALUE
449});
450};
451this.model.setValue("params", result);
452}
453_translit(str) {
454const map = {
455'а':'a','б':'b','в':'v','г':'g','д':'d','е':'e','ё':'yo','ж':'zh','з':'z',
456'и':'i','й':'y','к':'k','л':'l','м':'m','н':'n','о':'o','п':'p','р':'r',
457'с':'s','т':'t','у':'u','ф':'f','х':'kh','ц':'ts','ч':'ch','ш':'sh',
458'щ':'sch','ъ':'','ы':'y','ь':'','э':'e','ю':'yu','я':'ya'
459};
460return str.split('').map(ch => {
461const lower = ch.toLowerCase();
462if (map[lower] === undefined) return ch;
463const res = map[lower];
464return ch === lower ? res : res.charAt(0).toUpperCase() + res.slice(1);
465}).join('');
466}
467}
468;Service.__pN='materials.service';return Service;};var i=false;var o=null;Object.defineProperty(BeeJS.package('materials.service'),'Service',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Init' in BeeJS.package('materials.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var model = BeeJS.package("common.model");var ui = BeeJS.package("materials.ui");var service = BeeJS.package("materials.service");
469class Init {
470constructor(element, data) {
471this.model = new model.Model();
472this.model.setValue("data", data);
473this.service = new service.Service(this.model);
474this.widget = new ui.shell.Widget({}, this.service);
475this.widget.start(element);
476}
477}
478;Init.__pN='materials.service';return Init;};var i=false;var o=null;Object.defineProperty(BeeJS.package('materials.service'),'Init',{get:function(){if(!i){i=true;o=f();}return o;}});})();var materials = BeeJS.package('materials');if (!('Widget' in BeeJS.package('common.ui.error')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");
479class Widget extends beeJS.widget.Widget {
480constructor(data, service) {
481super();
482this._css = "common-error";
483this._data = data;
484this._service = service;
485this.setTemplate(new beeJS.Template(5, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let text = model.data.text; html.push("\n<div class=\"");html.push(css);html.push("\">\n    ");html.push(text);html.push("\n</div>\n");return html.join('');}), {css: this._css, data: this._data});
486}
487}
488;Widget.__pN='common.ui.error';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('common.ui.error'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('common.ui.widget')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");
489class Widget extends beeJS.widget.Widget {
490constructor(data, service) {
491super();
492this._css = "common-widget";
493this._data = data;
494this._service = service;
495this.setTemplate(new beeJS.Template(6, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n<div class=\"");html.push(css);html.push("\">\n</div>\n");return html.join('');}), {css: this._css});
496}
497_init() {
498this._initListeners();
499this._initControls();
500this._initContent();
501}
502_initListeners() {
503}
504_initControls() {
505}
506_initContent() {
507}
508_initWidget(parent, widget) {
509const div = document.createElement("div");
510parent.innerHTML = "";
511parent.appendChild(div);
512widget.start(div);
513}
514onClick(bind, action) {
515beeJS.ArrayUtil.asArray(bind).forEach((item, i) => {
516item.onclick = (e) => {
517action(item, i);
518};
519});
520}
521onInput(bind, action) {
522beeJS.ArrayUtil.asArray(bind).forEach((item, i) => {
523item.oninput = (e) => {
524action(item, i);
525};
526});
527}
528onKeyup(bind, action) {
529beeJS.ArrayUtil.asArray(bind).forEach((item, i) => {
530item.onkeyup = (e) => {
531action(item, i, e);
532};
533});
534}
535forEach(bind, action) {
536beeJS.ArrayUtil.asArray(bind).forEach((item, i) => {
537action(item, i);
538});
539}
540}
541;Widget.__pN='common.ui.widget';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('common.ui.widget'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('common.ui.popup')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("common");
542class Widget extends common.ui.widget.Widget {
543constructor(data, service) {
544super();
545this._css = "common-popup";
546this._data = data;
547this._service = service;
548this.setTemplate(new beeJS.Template(7, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('block'));html.push("\" style=\"top:");html.push(data.coord.y);html.push("px;left:");html.push(data.coord.x);html.push("px\">\n    <div class=\"");html.push(css);html.push("__body\" id=\"");html.push(bindInfo.registerInBindInfo('body'));html.push("\">\n        <div class=\"");html.push(css);html.push("__content\" id=\"");html.push(bindInfo.registerInBindInfo('content'));html.push("\"></div>\n        <div class=\"");html.push(css);html.push("__aside\">\n            <button class=\"");html.push(css);html.push("__close\" id=\"");html.push(bindInfo.registerInBindInfo('close'));html.push("\">&times;</button>\n        </div>\n    </div>\n</div>\n");return html.join('');}), {css: this._css, data: this._data});
549}
550_initControls() {
551this._bind._block.onclick = () => {
552this._service.descruct(this._data.id);
553};
554this._bind._body.onclick = (e) => {
555e.stopPropagation();
556};
557this._bind._closes = beeJS.ArrayUtil.asArray(this._bind._close);
558this._bind._closes.forEach((item, i) => {
559item.onclick = () => {
560this._service.descruct(this._data.id);
561};
562});
563}
564_initContent() {
565const div = document.createElement("div");
566this._bind._content.appendChild(div);
567if(this._data.widget) {
568this._data.widget.start(div); 
569} else if(this._data.html) {
570div.appendChild(this._data.html); 
571} 
572}
573}
574;Widget.__pN='common.ui.popup';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('common.ui.popup'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('common.ui.modal')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("common");
575class Widget extends common.ui.widget.Widget {
576constructor(data, service) {
577super();
578this._css = "common-modal";
579this._data = data;
580this._service = service;
581this.setTemplate(new beeJS.Template(8, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('block'));html.push("\">\n    <div class=\"");html.push(css);html.push("__body\" id=\"");html.push(bindInfo.registerInBindInfo('body'));html.push("\">\n        <div class=\"");html.push(css);html.push("__header\">\n            <h2 class=\"");html.push(css);html.push("__title\">");html.push(data.title);html.push("</h2>\n            <button class=\"");html.push(css);html.push("__close\" id=\"");html.push(bindInfo.registerInBindInfo('close'));html.push("\"></button>\n        </div>\n        <div class=\"");html.push(css);html.push("__content\" id=\"");html.push(bindInfo.registerInBindInfo('content'));html.push("\"></div>\n        <div class=\"");html.push(css);html.push("__footer\">\n            <button class=\"");html.push(css);html.push("__button\" id=\"");html.push(bindInfo.registerInBindInfo('close'));html.push("\">Закрыть</button>\n        </div>\n    </div>\n</div>\n");return html.join('');}), {css: this._css, data: this._data});
582}
583_initControls() {
584this._bind._block.onclick = () => {
585this._service.descruct(this._data.id);
586};
587this._bind._body.onclick = (e) => {
588e.stopPropagation();
589};
590this._bind._closes = beeJS.ArrayUtil.asArray(this._bind._close);
591this._bind._closes.forEach((item, i) => {
592item.onclick = () => {
593this._service.descruct(this._data.id);
594};
595});
596}
597_initContent() {
598const div = document.createElement("div");
599this._bind._content.appendChild(div);
600if(this._data.widget) {
601this._data.widget.start(div); 
602} 
603}
604_destruct() {
605if(this._data.modal) {
606this._service.descruct(this._data.modal);
607}
608}
609}
610;Widget.__pN='common.ui.modal';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('common.ui.modal'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Model' in BeeJS.package('common.model')))(function(){var f=function(){
611class Model {
612constructor(model) {
613this.values = {};
614this.handlers = {};
615}
616_initHandler(name, fireEvents) {
617if(this.handlers[name]) {
618for(var i in this.handlers[name]) {
619if(fireEvents) {
620this.handlers[name][i].action(this.values[name]);
621} else if (this.handlers[name][i].fireEvents) {
622this.handlers[name][i].action(this.values[name]);
623};
624};
625};
626}
627getValue(name) {
628return this.values[name];
629}
630setValue(name, value, fireEvents) {
631this.values[name] = value;
632this._initHandler(name, fireEvents);
633}
634addHandler(name, action, fireEvents) {
635var handler = {
636fireEvents: (fireEvents) ? true : false,
637action: action
638};
639if(!this.handlers[name]) {
640this.handlers[name] = [];
641};
642this.handlers[name].push(handler);
643}
644removeHandler(name, action) {
645if(this.handlers[name]) {
646for(var i in this.handlers[name]) {
647if(JSON.stringify(this.handlers[name][i].handler) === JSON.stringify(action)) {
648this.handlers[name].splice(i, 1);
649};
650};
651};
652}
653clearHandler(name) {
654this.handlers[name] = [];
655}
656}
657;Model.__pN='common.model';return Model;};var i=false;var o=null;Object.defineProperty(BeeJS.package('common.model'),'Model',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Popup' in BeeJS.package('common.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");
658class Popup {
659constructor() {
660}
661build() {
662this.descruct();
663const div = document.createElement("div");
664div.id = "srt-popup"+Math.floor(Math.random()*1000000);
665div.classList.add("rtv-popup");
666document.body.appendChild(div);
667document.body.onclick = () => {
668this.descruct(div.id);
669};
670return div;
671}
672descruct() {
673if(document.getElementsByClassName("srt-popup")[0]) {
674document.body.removeChild(document.getElementsByClassName("srt-popup")[0]);
675}
676}
677}
678;Popup.__pN='common.service';return Popup;};var i=false;var o=null;Object.defineProperty(BeeJS.package('common.service'),'Popup',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Service' in BeeJS.package('common.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("common");
679class Service {
680constructor(model) {
681this.config = {};
682this.model = (model) ? model : new common.model.Model();
683}
684initError(e) {
685let result = "<p>Ошибка!</p><ul>";
686for(let error of e.errors) {
687result += `<li>${error.message}</li>`;
688}
689result += "</ul>";
690this.model.setValue("error", result, true);
691}
692closeModal(id) {
693this.model.setValue("closeModal", id, true);
694}
695}
696;Service.__pN='common.service';return Service;};var i=false;var o=null;Object.defineProperty(BeeJS.package('common.service'),'Service',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Modal' in BeeJS.package('common.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");
697class Modal {
698constructor() {
699}
700build() {
701const div = document.createElement("div");
702div.id = "srt-modal"+Math.floor(Math.random()*1000000);
703div.classList.add("srt-modal");
704document.body.appendChild(div);
705document.body.style.overflow = "hidden";
706return div;
707}
708descruct(id) {
709document.body.removeChild(document.getElementById(id));
710if(!document.getElementsByClassName("srt-modal")[0]) {
711document.body.style.overflow = "auto";
712}
713if(document.getElementsByClassName("srt-popup")[0]) {
714document.body.removeChild(document.getElementsByClassName("srt-popup")[0]);
715}
716}
717}
718;Modal.__pN='common.service';return Modal;};var i=false;var o=null;Object.defineProperty(BeeJS.package('common.service'),'Modal',{get:function(){if(!i){i=true;o=f();}return o;}});})();var common = BeeJS.package('common');if (!('Widget' in BeeJS.package('user.themes.ui.shell')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");
719class Widget extends common.ui.widget.Widget {
720constructor(data, service) {
721super();
722this._css = "user-themes-shell";
723this._data = service.model.getValue("data");
724this._service = service;
725this.setTemplate(new beeJS.Template(9, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__header\">\n        <h2>Консультации по темам</h2>\n    </div>\n    <div class=\"");html.push(css);html.push("__list\">\n        <div>\n            <a class=\"");html.push(css);html.push("__item\" href=\"/catalog/online_education/?ELEMENT_ID=123232\">\n                <h3>Самостоятельное ознакомление с материалами</h3>\n            </a>\n        </div>\n        <div>\n            <a class=\"");html.push(css);html.push("__item\" href=\"/catalog/consultation/?filter=ritmomera\">\n                <h3>Ритмомеры (online)</h3>\n            </a>\n        </div>\n        <div>\n            <a class=\"");html.push(css);html.push("__item\" href=\"/catalog/consultation/?sectionID=1037\">\n                <h3>Ритм возврата (online)</h3>\n            </a>\n        </div>\n        <div>\n            <a class=\"");html.push(css);html.push("__item\" href=\"/catalog/online_education/materials.p
725hp\">\n                <h3>Ритмологическая нить (online)</h3>\n            </a>\n        </div>\n    </div>\n</div>\n");return html.join('');}), {
726css: this._css,
727data: this._data,
728service: this._service
729});
730}
731}
732;Widget.__pN='user.themes.ui.shell';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.themes.ui.shell'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Init' in BeeJS.package('user.themes.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.themes.ui");var model = BeeJS.package("user.common.model");var service = BeeJS.package("user.common.service");
733class Init {
734constructor(element, data) {
735this.model = new model.Model();
736this.model.setValue("data", data);
737this.service = new service.Service(this.model);
738this.widget = new ui.shell.Widget({}, this.service);
739this.widget.start(element);
740}
741}
742;Init.__pN='user.themes.service';return Init;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.themes.service'),'Init',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.meeting.ui.shell')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var payment = BeeJS.package("user.payment");var ui = BeeJS.package("user.meeting.ui");
743class Widget extends common.ui.widget.Widget {
744constructor(data, service) {
745super();
746this._css = "user-meeting-shell";
747this._data = service.model.getValue("data");
748this._service = service;
749this.setTemplate(new beeJS.Template(10, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div id=\"");html.push(bindInfo.registerInBindInfo('content'));html.push("\"></div>\n</div>\n");return html.join('');}), {
750css: this._css,
751data: this._data
752});
753}
754_initContent() {
755if(this._data?.anketa?.uuid) {
756this._initAnketa();
757} else {
758this._initPayment();
759}
760}
761async _initAnketa() {
762const uuid = this._data.anketa.uuid;
763const token = this._data.anketa.token;
764const element = this._bind._content;
765await this._loadAnketaClient();
766if(uuid) {
767let api = await AnketaClient.initAPI(uuid, token);
768if(!api.isAnketaComplete()) {
769this._initTextAnketa(element);
770AnketaClient.init(element, uuid, token, (api) => {
771setTimeout(() => {
772this._handleAnketa(element);
773}, 1000);
774});
775} else {
776this._initPayment();
777}
778}
779}
780async _loadAnketaClient() {
781let js = "/js/build/client-all/anketa-client.js?_=4";
782let isCom = (window.location.hostname === "rithm-time.com");
783if (typeof(AnketaClient) === "undefined") {
784const url = (isCom) ? "//survey.rithm-time.com/"+js : "//survey.edlm.ru/"+js;
785await loadScript(url);
786if(isCom) {
787AnketaClient.serverAddress = "survey.rithm-time.com";
788} else {
789AnketaClient.serverAddress = "survey.edlm.ru";
790};
791};
792}
793_initPayment() {
794const data = {
795product: {
796id: this._data.product.id,
797price: this._data.product.price,
798quantity: 1,
799name: this._data.product.name
800}
801}
802const service = new payment.service.Service();
803service.model.setValue("data", data);
804const widget = new payment.ui.shell.Widget(data, service);
805this._initWidget(this._bind._content, widget);
806}
807_handleAnketa(element) {
808var list = element.getElementsByTagName("button");
809for(var i=0; i<list.length; i++) {
810if(list[i]) {
811list[i].addEventListener("click", (e) => {
812if(e.target.innerText === "Завершить") {
813setTimeout(() => {
814this.restart();
815}, 1000);
816} else {
817setTimeout(() => {
818this._handleAnketa(element);
819}, 1000);
820}
821});
822};
823};
824}
825_initTextAnketa(element) {
826let div = document.createElement("div");
827div.innerHTML = "Оплата участия в мероприятии будет доступна после заполнения этого опроса";
828element.parentNode.insertBefore(div, element);
829}
830}
831;Widget.__pN='user.meeting.ui.shell';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.meeting.ui.shell'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Service' in BeeJS.package('user.meeting.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var meeting = BeeJS.package("user.meeting");var payment = BeeJS.package("user.payment");
832class Service extends payment.service.Service {
833constructor(model) {
834super();
835this.config = {};
836this.model = (model) ? model : new payment.model.Model();
837this.modal = new common.service.Modal();
838this.popup = new common.service.Popup();
839}
840async createOrder(psID, params, coupon) {
841let param = this._getParams(psID, params);
842if(coupon) {
843param.data.paymentSystemId = "39";
844}
845let json = await BX.ajax.runAction('integramma:extsale.ajax.orders.create', param);
846if(coupon) {
847await BX.ajax.runAction('integramma:extsale.ajax.orders.coupon', {
848data: {
849orderId: json.data.orderId,
850coupon: coupon
851}
852});
853param.data.orderId = json.data.orderId;
854param.data.paymentSystemId = psID;
855json = await BX.ajax.runAction('integramma:extsale.ajax.orders.pay', param);
856}
857this._goToPay(json);
858}
859_getParams(psID, params) {
860let product = this.model.getValue("data").product.id;
861let quantity = this.model.getValue("data").product.quantity;
862return {
863data: {
864products: [product],
865paymentSystemId: psID,
866payParams: {
867successUrl: "/personal/?filter_payed=Y&filter_history=Y&section=orders",
868failUrl: "/personal/?filter_payed=Y&filter_history=Y&section=orders"
869},
870userFields: {},
871orderProperties: params,
872productCount: quantity
873}
874}
875}
876_goToPay(json) {
877if (json.data && json.data.payJSON) {
878window.location.href = order.data.payJSON.paymentURL;
879} else {
880var div = document.createElement("div");
881div.innerHTML = json.data.payTempl;
882div.children[0].removeAttribute("target");
883document.body.appendChild(div);
884if(div.getElementsByTagName("a")[0]) {
885window.location.href = div.getElementsByTagName("a")[0].href;
886} else if(div.getElementsByTagName("form")[0]) {
887$(div.getElementsByTagName("form")[0]).submit();
888} else {
889document.getElementById("app").innerHTML = "";
890document.getElementById("app").appendChild(div);
891}
892}
893}
894}
895;Service.__pN='user.meeting.service';return Service;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.meeting.service'),'Service',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Init' in BeeJS.package('user.meeting.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.meeting.ui");var model = BeeJS.package("user.payment.model");var service = BeeJS.package("user.meeting.service");
896class Init {
897constructor(element, data) {
898this.model = new model.Model();
899this.model.setValue("data", data);
900this.service = new service.Service(this.model);
901this.widget = new ui.shell.Widget({}, this.service);
902this.widget.start(element);
903}
904}
905;Init.__pN='user.meeting.service';return Init;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.meeting.service'),'Init',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.datepicker.ui.shell')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");
906class Widget extends common.ui.widget.Widget {
907constructor(data, service) {
908super();
909this._css = "user-datepicker-shell";
910this._data = data;
911this._service = service;
912this.setTemplate(new beeJS.Template(11, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n");let week = ["Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"]; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__calendar\">\n        <div class=\"");html.push(css);html.push("__header\">\n            <h4 class=\"");html.push(css);html.push("__title\">");html.push(data.title);html.push("</h4>\n            <button type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('prev'));html.push("\"></button>\n            <button type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('next'));html.push("\"></button>\n        </div>\n        <table class=\"");html.push(css);html.push("__table\">\n            <tr class=\"");html.push(css);html.push("__row ");html.push(css);html.push("__row_header\">\n                ");for(let day of week) { html.push("\n                    <td class=\"");html.push(css);html.push("__cell\">");html.push(day);html.push("</td>\n                ");} html.push("\n            </tr>\n            ");for(let week of data.month) { html.push("\n                <tr class=\"");html.push(css);html.push("__row\">\n                    ");for(let day of week) { html.push("\n                        <td class=\"");html.push(css);html.push("__cell\">\n                            ");let status = day.type; html.push("\n                            ");status = (new Date(data.start) < new Date(day.date) && new Date(data.end) > new Date(day.date)) ? "claimed" : status; html.push("\n                            ");status = (data.start === day.date || data.end === day.date) ? "choosed" : status; html.push("\n                            <button type=\"button\" class=\"");html.push(status);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('button'));html.push("\" data-date=\"");html.push(day.date);html.push("\">");html.push(day.id);html.push("</button>\n                        </td>\n                    ");} html.push("\n                </tr>\n            ");} html.push("\n        </table>\n    </div>\n    <div class=\"");html.push(css);html.push("__tags\">\n        <button type=\"button\" class=\"");html.push(css);html.push("__tag\" id=\"");html.push(bindInfo.registerInBindInfo('tag'));html.push("\" data-id=\"today\">Сегодня</button>\n        <button type=\"button\" class=\"");html.push(css);html.push("__tag\" id=\"");html.push(bindInfo.registerInBindInfo('tag'));html.push("\" data-id=\"week\">На этой неделе</button>\n        <button type=\"button\" class=\"");html.push(css);html.push("__tag\" id=\"");html.push(bindInfo.registerInBindInfo('tag'));html.push("\" data-id=\"nextweek\">На следующей неделе</button>\n        <button type=\"button\" class=\"");html.push(css);html.push("__tag\" id=\"");html.push(bindInfo.registerInBindInfo('tag'));html.push("\" data-id=\"weekend\">На выходных</button>\n    </div>\n</div>\n");return html.join('');}), {
913css: this._css,
914data: {
915title: this._getTitle(),
916month: this._getMonth()
917},
918});
919}
920_initControls() {
921this._bind._prev.onclick = () => {
922this._modifier--;
923this._viewModel.data.title = this._getTitle();
924this._viewModel.data.month = this._getMonth();
925this.restart();
926};
927this._bind._next.onclick = () => {
928this._modifier++;
929this._viewModel.data.title = this._getTitle();
930this._viewModel.data.month = this._getMonth();
931this.restart();
932};
933this._bind._buttons = beeJS.ArrayUtil.asArray(this._bind._button);
934this._bind._buttons.forEach((item, i) => {
935item.onclick = (e) => {
936if(!item.classList.contains("disabled")) {
937this._setDate(item.dataset.date);
938this.restart();
939}
940};
941});
942this._bind._tags = beeJS.ArrayUtil.asArray(this._bind._tag);
943this._bind._tags.forEach((item, i) => {
944item.onclick = (e) => {
945this._setTag(item.dataset.id);
946this.restart();
947};
948});
949}
950_getTitle() {
951let date = new Date();
952let y = date.getFullYear();
953let m = date.getMonth();
954let d = 1;
955this._modifier = (this._modifier) ? this._modifier : 0;
956m += this._modifier;
957let header = (new Date(y, m, d)).toLocaleString("ru", {year: 'numeric', month: 'long'});
958header = (header[0].toUpperCase() + header.slice(1)).split("г.")[0];
959return header;
960}
961_getMonth() {
962let date = new Date();
963let m = date.getMonth();
964let y = date.getFullYear();
965let d = date.getDate();
966this._modifier = (this._modifier) ? this._modifier : 0;
967m += this._modifier;
968let firstDayOfMonth = new Date(y, m, 7).getDay();
969let lastDateOfMonth = new Date(y, m+1, 0).getDate();
970let lastDayOfLastMonth = m == 0 ? new Date(y-1, 11, 0).getDate() : new Date(y, m, 0).getDate();
971let count = 1;
972let dow = new Date(y, m, count).getDay();
973let before = lastDayOfLastMonth - firstDayOfMonth + 1;
974let result = [];
975for(let w = 0; w < 6; w++) {
976let week = [];
977for(let c = 0; c < 7; c++) {
978if(dow != 1 && count == 1 && c < firstDayOfMonth) {
979let param = y+"-"+((m > 9) ? m: "0"+(m))+"-"+((before > 9) ? before: "0"+before);
980week.push({id: before, type: "disabled", date: param});
981before++;
982} else if ( count > lastDateOfMonth) {
983let after = count - lastDateOfMonth
984let param = y+"-"+((m >= 8) ? m+2: "0"+(m+2))+"-"+((after > 9) ? after: "0"+after);
985week.push({id: count - lastDateOfMonth, type: "", date: param});
986count++;
987} else {
988let param = y+"-"+((m >= 9) ? m+1: "0"+(m+1))+"-"+((count > 9) ? count: "0"+count);
989let status = (new Date(param+"T23:59") < new Date()) ? "disabled" : "active"; 
990week.push({id: count, type: status, date: param});
991count++;
992}
993}
994result.push(week);
995}
996return result;
997}
998_setDate(value) {
999let start = this._viewModel.data.start;
1000if(!start) {
1001this._viewModel.data.start = value;
1002this._viewModel.data.end = value;
1003} else {
1004if(start != value) {
1005if(new Date(start) <= new Date(value)) {
1006this._viewModel.data.end = value;
1007} else {
1008this._viewModel.data.start = value;
1009}
1010} else {
1011this._viewModel.data.start = false;
1012this._viewModel.data.end = false;
1013}
1014}
1015if(!value) {
1016this._viewModel.data.start = value;
1017this._viewModel.data.end = value;
1018} else {
1019this._setValue(this._viewModel.data.start, this._viewModel.data.end);
1020}
1021}
1022_setTag(value) {
1023let d = 86400000;
1024let today = new Date();
1025let lweek = new Date(today.valueOf() + ((7 - (today.getDay())) * d));
1026let nextweek = new Date(lweek.valueOf() + d);
1027let lnextweek = new Date(lweek.valueOf() + d * 7);
1028let saturday = new Date(today.getFullYear(), today.getMonth(), today.getDate() + ((13 - today.getDay()) % 7));
1029let sunday = new Date(saturday.valueOf() + d);
1030this._setDate();
1031switch(value) {
1032case "today":
1033this._setDate(this._formatDate(today));
1034break;
1035case "week":
1036this._setDate(this._formatDate(today));
1037this._setDate(this._formatDate(lweek));
1038break;
1039case "nextweek":
1040this._setDate(this._formatDate(nextweek));
1041this._setDate(this._formatDate(lnextweek));
1042break;
1043case "weekend":
1044this._setDate(this._formatDate(saturday));
1045this._setDate(this._formatDate(sunday));
1046break;
1047default:
1048break;
1049}
1050}
1051_setValue(start, end) {
1052this.domElement.dataset.start = new Date(start).valueOf();
1053this.domElement.dataset.end = new Date(end).valueOf();
1054this.domElement.dispatchEvent(new Event("input"));
1055}
1056_formatDate(date) {
1057const year = date.getFullYear();
1058const month = String(date.getMonth() + 1).padStart(2, '0');
1059const day = String(date.getDate()).padStart(2, '0');
1060return `${year}-${month}-${day}`;
1061}
1062}
1063;Widget.__pN='user.datepicker.ui.shell';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.datepicker.ui.shell'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Init' in BeeJS.package('user.datepicker.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.datepicker.ui");
1064class Init {
1065constructor(element, data) {
1066this.widget = new ui.shell.Widget();
1067this.widget.start(element);
1068}
1069}
1070;Init.__pN='user.datepicker.service';return Init;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.datepicker.service'),'Init',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.authform.ui.shell')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.authform.ui");
1071class Widget extends common.ui.widget.Widget {
1072constructor(data, service) {
1073super();
1074this._css = "user-authform-shell";
1075this._data = data;
1076this._service = service;
1077this.setTemplate(new beeJS.Template(12, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n");let style = model.data.style; html.push("\n<div class=\"");html.push(css);html.push(" ");html.push(style);html.push("\">\n	<section>\n		<h2>Войти в личный кабинет</h2>\n	</section>\n	<form>\n		<div class=\"");html.push(css);html.push("__grid\">\n			<input type=\"text\" name=\"USER_LOGIN\" value=\"\" placeholder=\"Логин\" id=\"");html.push(bindInfo.registerInBindInfo('login'));html.push("\">\n			<input type=\"password\" name=\"USER_PASSWORD\" autocomplete=\"off\" placeholder=\"Пароль\" id=\"");html.push(bindInfo.registerInBindInfo('password'));html.push("\">\n			<div class=\"");html.push(css);html.push("__error\" id=\"");html.push(bindInfo.registerInBindInfo('error'));html.push("\"></div>\n			<input type=\"button\" name=\"Login\" value=\"Войти\" id=\"");html.push(bindInfo.registerInBindInfo('button'));html.push("\">\n			<div class=\"");html.push(css);html.push("__links\">\n				<a href=\"/auth/registration.php\" rel=\"nofollow\">Регистрация</a>\n				<a href=\"/auth/?forgot_password=yes&forgot_password=yes\" rel=\"nofollow\">Забыли пароль?</a>\n			</div>\n		</div>\n	</form>\n</div>\n");return html.join('');}), {
1078css: this._css,
1079data: this._data
1080});
1081}
1082_initListeners() {
1083this._service.model.addHandler("error", (value) => {
1084this._bind._error.innerHTML = value;
1085});
1086}
1087_initControls() {
1088const submit = () => {
1089this._service.authorize(this._bind._login.value, this._bind._password.value);
1090};
1091this.onClick(this._bind._button, submit);
1092this.onKeyup([this._bind._login, this._bind._password], (item, i, e) => {
1093if (e.key === "Enter") {
1094submit();
1095}
1096});
1097}
1098}
1099;Widget.__pN='user.authform.ui.shell';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.authform.ui.shell'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Service' in BeeJS.package('user.authform.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var authform = BeeJS.package("user.authform");
1100class Service extends common.service.Service {
1101constructor(model) {
1102super();
1103this.config = {
1104url: {
1105auth: "/auth/ajax.php",
1106}
1107};
1108this.model = (model) ? model : new common.model.Model();
1109}
1110async authorize(login, password) {
1111let json = await beeJS.Ajax.post(this.config.url.auth, {
1112"login": login,
1113"password": password
1114}); 
1115let data = JSON.parse(json);
1116if(data.success) {
1117location.reload();
1118}
1119if(data.error) {
1120this.model.setValue("error", data.error, true);
1121}
1122}
1123}
1124;Service.__pN='user.authform.service';return Service;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.authform.service'),'Service',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Init' in BeeJS.package('user.authform.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.authform.ui");var service = BeeJS.package("user.authform.service");var model = BeeJS.package("user.common.model");
1125class Init {
1126constructor(element, data) {
1127this.model = new model.Model();
1128this.model.setValue("data", data);
1129this.service = new service.Service(this.model);
1130this.widget = new ui.shell.Widget(data, this.service);
1131this.widget.start(element);
1132}
1133}
1134;Init.__pN='user.authform.service';return Init;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.authform.service'),'Init',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.materials.ui.shell')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var materials = BeeJS.package("materials");var common = BeeJS.package("user.common");var user = BeeJS.package("user");var ui = BeeJS.package("user.materials.ui");
1135class Widget extends common.ui.widget.Widget {
1136constructor(data, service) {
1137super();
1138this._css = "ip-materials-shell";
1139this._data = service.model.getValue("data");
1140this._service = service;
1141this.setTemplate(new beeJS.Template(13, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n<div class=\"");html.push(css);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('content'));html.push("\"></div>\n");return html.join('');}), {
1142css: this._css,
1143data: this._data,
1144service: this._service
1145});
1146}
1147_initListeners() {
1148this._service.model.addHandler("materials", (value) => {
1149new materials.service.Init(this._bind._content, value);
1150});
1151}
1152_init() {
1153this._initListeners();
1154this._service._initMaterial();
1155}
1156}
1157;Widget.__pN='user.materials.ui.shell';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.materials.ui.shell'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Service' in BeeJS.package('user.materials.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var materials = BeeJS.package("user.materials");
1158class Service extends common.service.Service {
1159constructor(model) {
1160super();
1161this.model = (model) ? model : new personal.model.Model();
1162}
1163_initMaterial() {
1164const data = this.model.getValue("data");
1165let key = data.key;
1166let useDefaultAnketaToken = localStorage.getItem("useDefaultAnketaToken_" + data.key) === "true";
1167if (useDefaultAnketaToken) {
1168data.anketaToken = data.anketaToken2;
1169}
1170let materials = {
1171key: key,
1172anketa: {
1173token: data.anketaToken,
1174},
1175user: {
1176uuid: data.uuid
1177}
1178};
1179this.model.setValue("materials", materials, true);
1180}
1181}
1182;Service.__pN='user.materials.service';return Service;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.materials.service'),'Service',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Init' in BeeJS.package('user.materials.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var model = BeeJS.package("user.common.model");var ui = BeeJS.package("user.materials.ui");var service = BeeJS.package("user.materials.service");
1183class Init {
1184constructor(element, data) {
1185this.model = new model.Model();
1186this.model.setValue("data", data);
1187this.service = new service.Service(this.model);
1188this.widget = new ui.shell.Widget({}, this.service);
1189this.widget.start(element);
1190}
1191}
1192;Init.__pN='user.materials.service';return Init;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.materials.service'),'Init',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.contact')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("consultations.ui");
1193class Widget extends common.ui.widget.Widget {
1194constructor(data, service) {
1195super();
1196this._css = "user-consultations-contact";
1197this._data = data;
1198this._service = service;
1199this.setTemplate(new beeJS.Template(14, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data.data; html.push("\n<div class=\"");html.push(css);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('block'));html.push("\">\n    <div class=\"");html.push(css);html.push("__info\">\n        ");if (data.title && data.date) { html.push("\n            <div>\n                ");
1199let date = new Date(data.date.started).toLocaleString("ru", {day: 'numeric', month: 'numeric', year: 'numeric'});html.push("\n                <h3 class=\"");html.push(css);html.push("__title\">");html.push(((data.title.length > 37) ? data.title.substring(0, 37)+"..." : data.title ));html.push("</h3>\n                <h3 class=\"");html.push(css);html.push("__date\">");html.push(date);html.push("</h3>\n            </div>\n        ");} html.push("\n        <div>\n            <div class=\"");html.push(css);html.push("__ritmolog\">\n                <div class=\"");html.push(css);html.push("__image\" style=\"background-image: url(");html.push(data.ritmolog.photo);html.push(");\"></div>\n                <div>\n                    <div class=\"");html.push(css);html.push("__name\">");html.push(data.ritmolog.name);html.push("</div>\n                    <div class=\"");html.push(css);html.push("__type\">");html.push(data.ritmolog.type);html.push("</div>\n                </div>\n            </div>\n        </div> \n    </div>\n    <ul class=\"");html.push(css);html.push("__list\">\n        ");let contact = data.ritmolog.contact; html.push("\n        ");for(let item in contact) { html.push("\n            ");if (contact[item]) { html.push("\n                ");let h = "";let href = "";let text = "";switch(item) {case "phone":href = "tel:"+contact[item];text = contact[item];break;case "email":href = "mailto:"+contact[item];text = contact[item];break;case "telegram":let telegram = contact[item];text = contact[item];if (telegram.match(/^[0-9+\(\)\s-]+$/)) {h = telegram.replace(/[^0-9]/g, '');href = 'tg://resolve?phone=' + h;} else {h = telegram.replace('@','');href = "https://t.me/"+h;}break;case "whatsapp":let whatsapp = contact[item];if (whatsapp && whatsapp.trim() !== '') {h = whatsapp.replace(/[^0-9]/g, '');href = 'https://wa.me/' + h;text = contact[item];}break;case "max":let max = contact[item];if (max && max.trim() !== '') {h = max;href = 'https://max.ru/u/' + h;text = "max";}break;default:break;}html.push("\n                <li><a class=\"");html.push(css);html.push("__contact ");html.push(css);html.push("__contact_");html.push(item);html.push("\" href=\"");html.push(href);html.push("\">");html.push(text);html.push("</a></li>\n            ");} html.push("\n        ");} html.push("\n    </ul>\n</div>\n");return html.join('');}), {css: this._css, data: this._data});
1200}
1201}
1202;Widget.__pN='user.consultations.ui.contact';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.contact'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.section.orders')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.consultations.ui");
1203class Widget extends ui.section.default.Widget {
1204constructor(data, service) {
1205super();
1206this._css = "user-consultations-section-rec-orders";
1207this._data = data;
1208this._service = service;
1209this.setTemplate(new beeJS.Template(15, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__title\">\n        <h3>Рекомендации</h3>\n        <button class=\"");html.push(css);html.push("__info\" id=\"");html.push(bindInfo.registerInBindInfo('info'));html.push("\"></button>\n        <div class=\"");html.push(css);html.push("__popup\" id=\"");html.push(bindInfo.registerInBindInfo('popup'));html.push("\">\n            <p>Консультации, рекомендованные вашим ритмологом.</p>\n        </div>\n    </div>\n    <div class=\"");html.push(css);html.push("__list\" id=\"");html.push(bindInfo.registerInBindInfo('list'));html.push("\">\n        ");for(let item of data) { html.push("\n            <div class=\"");html.push(css);html.push("__item\" id=\"");html.push(bindInfo.registerInBindInfo('item'));html.push("\">\n                ");let style = (item.ritmolog.photo) ? 'style="background-image: url('+item.ritmolog.photo+');"' : ""; html.push("\n                <div class=\"");html.push(css);html.push("__header\">\n                    <div class=\"");html.push(css);html.push("__title\">");html.push(item.title);html.push("</div>\n                    <div class=\"");html.push(css);html.push("__tag\">\n                        ");html.push(item.price);html.push(" ₽\n                    </div>\n                </div>\n                <div class=\"");html.push(css);html.push("__body\">\n                    <div class=\"");html.push(css);html.push("__flex\">\n                        <a class=\"");html.push(css);html.push("__ritmolog\" href=\"");html.push(item.ritmolog.link);html.push("\" target=\"_blank\">\n                                <div class=\"");html.push(css);html.push("__photo\" ");html.push(style);html.push("></div>\n                            <div>\n                                <div class=\"");html.push(css);html.push("__name\">");html.push(item.ritmolog.name);html.push("</div>\n                                <div class=\"");html.push(css);html.push("__type\">");html.push(item.ritmolog.type);html.push("</div>\n                            </div>\n                        </a>\n                        ");html.push(item.payment.link);html.push("\n                    </div>\n                </div>\n            </div>\n		");} html.push("\n    </div>\n    ");if(data.length > 2) { html.push("\n        <button class=\"");html.push(css);html.push("__expand\" id=\"");html.push(bindInfo.registerInBindInfo('expand'));html.push("\">Показать всё</button>\n    ");} html.push("\n</div>\n");return html.join('');}), {
1210css: this._css,
1211data: this._data
1212});
1213}
1214_initControls() {
1215this._initPopupControls();
1216beeJS.ArrayUtil.asArray(this._bind._expand).forEach((expand, i) => {
1217expand.onclick = (e) => {
1218let items = beeJS.ArrayUtil.asArray(this._bind._item);
1219items.forEach((item, i) => {
1220item.classList.add("expanded");
1221});
1222this._bind._expand.remove();
1223};
1224});
1225}
1226}
1227;Widget.__pN='user.consultations.ui.section.orders';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.section.orders'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.section.events')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.consultations.ui");
1228class Widget extends ui.section.default.Widget {
1229constructor(data, service) {
1230super();
1231this._css = "user-consultations-section-events";
1232this._data = data;
1233this._service = service;
1234this.setTemplate(new beeJS.Template(16, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__title\">\n        <h3>Мои Мероприятия</h3>\n    </div>\n    <div class=\"");html.push(css);html.push("__list\" id=\"");html.push(bindInfo.registerInBindInfo('list'));html.push("\">\n        ");for(let item of data.list) { html.push("\n            <div class=\"");html.push(css);html.push("__item\">\n                ");let access = (new Date(item.date.ended)).toLocaleString("ru", {"day": "numeric", "month": "long", hour: "numeric", minute: "numeric", timeZone: "Europe/Moscow"}).replace(new RegExp(" ",'g'), "&nbsp;").replace(new RegExp("в&nbsp;",'g'), "");let style = (item.ritmolog.photo) ? 'style="background-image: url('+item.ritmolog.photo+');"' : "";const renewAccessStyle = (item.isRenew) ? css + '__access--end' : '';html.push("\n                <div>\n                    <div class=\"");html.push(css);html.push("__title\">");html.push(item.title);html.push("</div>\n                    <div class=\"");html.push(css);html.push("__access ");html.push(renewAccessStyle);html.push("\">Доступ&nbsp;до&nbsp;");html.push(access);html.push("&nbsp;мск</div>\n                </div>\n                <div>\n                    <a href=\"javascript:void(0)\" class=\"");html.push(css);html.push("__event\" id=\"");html.push(bindInfo.registerInBindInfo('eventInfo'));html.push("\" data-id=\"");html.push(item.orderId);html.push("\">Подробнее о мероприятии</a>\n                </div>\n                <div>\n                    <div class=\"");html.push(css);html.push("__ritmolog\">\n                        <div class=\"");html.push(css);html.push("__photo\" ");html.push(style);html.push("></div>\n                        <div>\n                            <div class=\"");html.push(css);html.push("__name\">");html.push(item.ritmolog.name);html.push("</div>\n                            <div class=\"");html.push(css);html.push("__type\">");html.push(item.ritmolog.type);html.push("</div>\n                        </div>\n                    </div>\n                    ");if(item.isRenew) {html.push("\n                        <button type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('renewButton'));html.push("\" data-key=\"");html.push(item.accessKey);html.push("\">Продлить</button>\n                    ");} else if (item.accessKey) { html.push("\n                        <a href=\"/personal/materials?key=");html.push(item.accessKey);html.push("\" target=\"_blank\" class=\"");html.push(css);html.push("__start-link\"><button>Пройти</button></a>\n                    ");} html.push("\n                </div>\n            </div>\n		");} html.push("\n    </div>\n</div>\n");return html.join('');}), {
1235css: this._css,
1236data: this._data
1237});
1238}
1239_initControls() {
1240this._initRenewButton();
1241this._initEventInfoButton();
1242}
1243_initRenewButton() {
1244let buttons = beeJS.ArrayUtil.asArray(this._bind._renewButton);
1245buttons.forEach((item, i) => {
1246item.onclick = async (e) => {
1247const item = e.target;
1248const key = item.dataset.key;
1249item.disabled = true;
1250item.style.opacity = 0.5;
1251if(key) {
1252const products = await this._service.getRenewProductsByKey(key);
1253const modal = this._service.modal.build();
1254const data = {
1255id: modal.id
1256};
1257data.title = "Продление доступа";
1258data.widget = new ui.renewProduct.Widget({
1259modal: modal.id,
1260key: key,
1261data: products,
1262}, this._service);
1263const widget = new ui.modal.Widget(data, this._service.modal);
1264widget.start(modal);
1265item.disabled = false;
1266item.style.opacity = 1;
1267}
1268};
1269});
1270}
1271_initEventInfoButton() {
1272let buttons = beeJS.ArrayUtil.asArray(this._bind._eventInfo);
1273buttons.forEach((item, i) => {
1274item.onclick = async (e) => {
1275const item = e.target;
1276const orderId = item.dataset.id;
1277if(orderId) {
1278const event = await this._service.getEventTicketByOrderId(orderId);
1279const modal = this._service.modal.build();
1280const data = {
1281id: modal.id
1282};
1283data.title = "Подробнее о мероприятии";
1284data.widget = new ui.eventDescription.Widget({
1285modal: modal.id,
1286data: event[orderId]
1287}, this._service);
1288const widget = new ui.modal.Widget(data, this._service.modal);
1289widget.start(modal);
1290}
1291};
1292});
1293}
1294}
1295;Widget.__pN='user.consultations.ui.section.events';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.section.events'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.section.current')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.consultations.ui");
1296class Widget extends ui.section.default.Widget {
1297constructor(data, service) {
1298super();
1299this._css = "user-consultations-section-current";
1300this._data = data;
1301this._service = service;
1302this.setTemplate(new beeJS.Template(17, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__title\">\n        <h3>Активные консультации</h3>\n        <button class=\"");html.push(css);html.push("__info\" id=\"");html.push(bindInfo.registerInBindInfo('info'));html.push("\"></button>\n        <div class=\"");html.push(css);html.push("__popup\" id=\"");html.push(bindInfo.registerInBindInfo('popup'));html.push("\">\n            <p>Здесь отображаются заказы ритмоконсалтинга, по которым еще не проведены консультации.</p>\n        </div>\n    </div>\n    <div class=\"");html.push(css);html.push("__list\" id=\"");html.push(bindInfo.registerInBindInfo('list'));html.push("\">\n        ");for(let item of data.list) { html.push("\n            <div class=\"");html.push(css);html.push("__item\" id=\"");html.push(bindInfo.registerInBindInfo('item'));html.push("\">\n                ");let style = (item.ritmolog.photo) ? 'style="background-image: url('+item.ritmolog.photo+');"' : "";let date = new Date(item.date.started).toLocaleString("ru", {day: 'numeric', month: 'numeric', year: 'numeric'});let planedDate = new Date(item.date.planed).toLocaleString("ru", {day: 'numeric', month: 'numeric', year: 'numeric'});let planedTime = new Date(item.date.planed).toLocaleString("ru", {hour: '2-digit', minute: '2-digit'});html.push("\n                <div class=\"");html.push(css);html.push("__header\">\n                    <div class=\"");html.push(css);html.push("__title\">");html.push(item.title);html.push("</div>\n                    <div class=\"");html.push(css);html.push("__tag\">\n                        <button class=\"");html.push(css);html.push("__copy\" data-tooltip=\"Скопировано\" data-id=\"");html.push(item.order.id);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('copy'));html.push("\">№");html.push(item.order.id);html.push("</button>&nbsp;");html.push(date);html.push("\n                    </div>\n                </div>        \n                <div class=\"");html.push(css);html.push("__body\">\n                    <div class=\"");html.push(css);html.push("__flex\">\n                        <a class=\"");html.push(css);html.push("__ritmolog\" href=\"");html.push(item.ritmolog.link);html.push("\" target=\"_blank\">\n                            <div class=\"");html.push(css);html.push("__photo\" ");html.push(style);html.push("></div>\n                            <div>\n                                <div class=\"");html.push(css);html.push("__name\">");html.push(item.ritmolog.name);html.push("</div>\n                                <div class=\"");html.push(css);html.push("__type\">");html.push(item.ritmolog.type);html.push("</div>\n                            </div>\n                        </a>\n                        <button class=\"");html.push(css);html.push("__button\" data-id=\"");html.push(item.id);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('contact'));html.push("\">Связаться</button>\n                    </div>\n                    <div class=\"");html.push(css);html.push("__progress\">\n                        ");let total = item.progress.total;let done = item.progress.done;let planed = item.progress.planed;let pDone = (done / total * 100);let pPlaned = (planed / total * 100);pDone = (pDone > 100) ? 100 : pDone;pPlaned = (pPlaned > 100 - pDone) ? 100 - pDone : pPlaned;let d = `style="width: ${pDone + 1}%"`;let p = `style="width: ${pPlaned}%; left: ${pDone}%"`;let t = (pDone < 30) ? ((pDone) ? "" : `style="left: 0%"`) : ((pDone < 75) ? `style="left: ${pDone}%"` : `style="left: unset; right: 0"`);html.push("\n                        <div class=\"bar total\"></div>\n                        <div class=\"progress total\">Всего ");html.push(model.widget._timening(total));html.push("</div>\n                        ");if(item.progress.done) { html.push("\n                            <div class=\"bar done\" ");html.push(d);html.push("></div>\n                            <div class=\"progress done\">Проведено ");html.push(model.widget._timening(done));html.push("</div>\n                        ");} html.push("\n                        ");if(item.progress.planed) { html.push("\n                            <div class=\"bar planed\"");html.push(p);html.push("></div>\n                            <div class=\"progress planed\"");html.push(t);html.push(">Запланировано ");html.push(model.widget._timening(planed));html.push("</div>\n                        ");} html.push("\n                    </div>\n                    ");if(item.status == "AVAILABLE") { html.push("\n                        <div class=\"");html.push(css);html.push("__flex\">\n                            <p></p>\n                            <button class=\"");html.push(css);html.push("__button action\" data-id=\"");html.push(item.id);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('action'));html.push("\">Запланировать</button>\n                        </div>\n                    ");} else if(item.status == "LOCKED") { html.push(" \n                        <div class=\"");html.push(css);html.push("__flex\">\n                            <p>Запланирована консультация: ");html.push(planedDate);html.push(" в ");html.push(planedTime);html.push("&nbsp;мск</p>\n                            <button class=\"");html.push(css);html.push("__button cancel\" data-id=\"");html.push(item.id);html.push("\" id=\"");
1302html.push(bindInfo.registerInBindInfo('cancel'));html.push("\">Отменить</button>\n                        </div>\n                    ");} else if(item.status == "ACTIVE") { html.push("   \n                        <div class=\"");html.push(css);html.push("__flex\">\n                            <p>Запланирована консультация: ");html.push(planedDate);html.push(" в ");html.push(planedTime);html.push("&nbsp;мск</p>\n                            <button class=\"");html.push(css);html.push("__button cancel disabled\" data-id=\"");html.push(item.id);html.push("\" data-tooltip=\"Отменить консультацию можно не позднее 12 часов до начала\">Отменить</button>\n                        </div>\n                    ");} html.push("     \n                </div>\n            </div>\n        ");} html.push("\n    </div>\n    ");if(data.list.length > 2) { html.push("\n        <button class=\"");html.push(css);html.push("__expand\" id=\"");html.push(bindInfo.registerInBindInfo('expand'));html.push("\">Показать всё</button>\n    ");} html.push("\n</div>\n");return html.join('');}), {
1303css: this._css,
1304data: this._data,
1305widget: this
1306});
1307}
1308_initControls() {
1309this._initPopupControls();
1310beeJS.ArrayUtil.asArray(this._bind._expand).forEach((expand, i) => {
1311expand.onclick = (e) => {
1312let items = beeJS.ArrayUtil.asArray(this._bind._item);
1313items.forEach((item, i) => {
1314item.classList.add("expanded");
1315});
1316this._bind._expand.remove();
1317};
1318});
1319beeJS.ArrayUtil.asArray(this._bind._contact).forEach((item, i) => {
1320item.onclick = (e) => {
1321let contact = this._data.list.find((i) => i.id === item.dataset.id);
1322this._initModal("contact", contact)
1323};
1324});
1325beeJS.ArrayUtil.asArray(this._bind._copy).forEach((item, i) => {
1326item.onclick = (e) => {
1327this._copy(item.dataset.id);
1328this._tooltip(item);
1329e.stopPropagation();
1330};
1331});
1332beeJS.ArrayUtil.asArray(this._bind._action).forEach((item, i) => {
1333item.onclick = (e) => {
1334let params = this._data.list.find((i) => i.id === item.dataset.id);
1335this._initModal("claim", {ritmolog: params.ritmolog.uid, hours: params.progress.item, order: params.id})
1336};
1337});
1338beeJS.ArrayUtil.asArray(this._bind._cancel).forEach((item, i) => {
1339item.onclick = (e) => {
1340let params = this._data.list.find((i) => i.id === item.dataset.id);
1341this._initModal("cancel", {id: params.consultation.id})
1342};
1343});
1344}
1345_initModal(type, param) {
1346const modal = this._service.modal.build();
1347const data = {
1348id: modal.id
1349};
1350switch(type) {
1351case "contact":
1352data.title = "Связаться с ритмологом";
1353data.widget = new ui.contact.Widget({modal: modal.id, data: param}, this._service);
1354break;
1355case "claim":
1356data.title = "Запланировать консультацию";
1357data.footer = "hidden";
1358data.widget = new ui.claim.Widget({modal: modal.id, data: param}, this._service.slots);
1359break;
1360case "cancel":
1361data.title = "Отменить консультацию";
1362data.footer = "absolute";
1363data.widget = new ui.cancel.Widget({modal: modal.id, data: param}, this._service.slots);
1364break;
1365default:
1366break;
1367}
1368const widget = new ui.modal.Widget(data, this._service.modal);
1369widget.start(modal); 
1370}
1371_timening(value) {
1372const template = {
13730.25: '15',
13740.5: '30',
13750.75: '45'
1376};
1377const days = Math.floor(value / 24);
1378const remainingHours = value % 24;
1379const wholePart = Math.floor(remainingHours);
1380const fractionalPart = remainingHours - wholePart;
1381let result = '';
1382if (days > 0) {
1383result += `${days} д. `;
1384}
1385if (wholePart > 0) {
1386result += `${wholePart} ч. `;
1387}
1388if (fractionalPart > 0) {
1389const minute = template[fractionalPart];
1390if (minute) {
1391result += `${minute} мин.`;
1392}
1393}
1394if (!result) {
1395result = '0 мин.';
1396}
1397return result.trim();
1398}
1399_copy(text) {
1400if (!text) {
1401console.warn('Нечего копировать');
1402return;
1403}
1404if (navigator.clipboard && navigator.clipboard.writeText) {
1405navigator.clipboard.writeText(text)
1406.then(() => console.log('Текст скопирован'))
1407.catch((err) => console.error('Ошибка при копировании: ', err));
1408} else {
1409const tmp = document.createElement('input');
1410const focus = document.activeElement;
1411tmp.value = text;
1412document.body.appendChild(tmp);
1413tmp.select();
1414try {
1415document.execCommand('copy');
1416console.log('Текст скопирован (через execCommand)');
1417} catch (err) {
1418console.error('Ошибка при копировании (execCommand): ', err);
1419}
1420document.body.removeChild(tmp);
1421if (focus) focus.focus();
1422}
1423}
1424_tooltip(item) {
1425item.classList.add("active");
1426let actionOut = (event) => {
1427item.classList.remove("active");
1428document.removeEventListener("click", actionOut);
1429};
1430document.addEventListener("click", actionOut);
1431setTimeout(() => {actionOut()}, 3000);
1432}
1433}
1434;Widget.__pN='user.consultations.ui.section.current';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.section.current'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.section.materials')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.consultations.ui");
1435class Widget extends ui.section.default.Widget {
1436constructor(data, service) {
1437super();
1438this._css = "user-consultations-section-materials";
1439this._data = data;
1440this._service = service;
1441this.setTemplate(new beeJS.Template(18, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__title\">\n        <h3>Доступные материалы</h3>\n        <button class=\"");html.push(css);html.push("__info\" id=\"");html.push(bindInfo.registerInBindInfo('info'));html.push("\"></button>\n        <div class=\"");html.push(css);html.push("__popup\" id=\"");html.push(bindInfo.registerInBindInfo('popup'));html.push("\">\n            <p>Здесь отображаются материалы ритмомер, которые были рекомендованы вам ритмологом. Проходить ритмомеру можно как самостоятельно, так и с ритмологом.</p>\n            <p><strong>Доступ к материалам ограничен</strong>.</p>\n        </div>\n    </div>\n    <div class=\"");html.push(css);html.push("__list\" id=\"");html.push(bindInfo.registerInBindInfo('list'));html.push("\">\n        ");for(let item of data.list) { html.push("\n            <div class=\"");html.push(css);html.push("__item\">\n                ");
1441let access = (new Date(item.date.ended)).toLocaleString("ru", {"day": "numeric", "month": "long", hour: "numeric", minute: "numeric"}).replace(new RegExp(" ",'g'), "&nbsp;").replace(new RegExp("в&nbsp;",'g'), "");let style = (item.ritmolog.photo) ? 'style="background-image: url('+item.ritmolog.photo+');"' : "";let text = (item.active) ? "Пройти" : "Активировать";const renewAccessStyle = (item.isRenew) ? css + '__access--end' : '';html.push("\n                <div>\n                    <div class=\"");html.push(css);html.push("__title\">");html.push(item.title);html.push("</div>\n                    ");if (item.active || item.isRenew) { html.push("\n                        <div class=\"");html.push(css);html.push("__access ");html.push(renewAccessStyle);html.push("\">Доступ&nbsp;до&nbsp;");html.push(access);html.push("&nbsp;мск</div>\n                    ");} html.push("\n                </div>        \n                <div>\n                    <div class=\"");html.push(css);html.push("__ritmolog\">\n                        <div class=\"");html.push(css);html.push("__photo\" ");html.push(style);html.push("></div>\n                        <div>\n                            <div class=\"");html.push(css);html.push("__name\">");html.push(item.ritmolog.name);html.push("</div>\n                            <div class=\"");html.push(css);html.push("__type\">");html.push(item.ritmolog.type);html.push("</div>\n                        </div>\n                    </div>\n                    ");if(item.isRenew && item.accessKey) {html.push("\n                        <button type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('renewButton'));html.push("\" data-key=\"");html.push(item.accessKey);html.push("\">Продлить</button>\n                    ");} else if (item.accessKey) { html.push("\n                    	<a href=\"/personal/materials?key=");html.push(item.accessKey);html.push("\" target=\"_blank\"><button>");html.push(text);html.push("</button></a>\n                    ");} else { html.push("\n                    	<a href=\"/online_education/user/index2.php?order_id=");html.push(item.order.id);html.push("\" target=\"_blank\"><button>Пройти</button></a>\n                    ");} html.push("\n                </div>\n            </div>\n		");} html.push("\n    </div>\n</div>\n");return html.join('');}), {
1442css: this._css,
1443data: this._data
1444});
1445}
1446_initControls() {
1447this._initPopupControls();
1448this._initRenewButton();
1449}
1450_initRenewButton() {
1451let buttons = beeJS.ArrayUtil.asArray(this._bind._renewButton);
1452buttons.forEach((item, i) => {
1453item.onclick = async (e) => {
1454const item = e.target;
1455const key = item.dataset.key;
1456item.disabled = true;
1457item.style.opacity = 0.5;
1458if(key) {
1459const products = await this._service.getRenewProductsByKey(key);
1460this._initModal(products, key);
1461item.disabled = false;
1462item.style.opacity = 1;
1463}
1464};
1465});
1466}
1467_initModal(products, key) {
1468const modal = this._service.modal.build();
1469const data = {
1470id: modal.id
1471};
1472data.title = "Продление доступа";
1473data.widget = new ui.renewProduct.Widget({
1474modal: modal.id,
1475key: key,
1476data: products,
1477}, this._service);
1478const widget = new ui.modal.Widget(data, this._service.modal);
1479widget.start(modal);
1480}
1481}
1482;Widget.__pN='user.consultations.ui.section.materials';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.section.materials'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.section.recomendations.item')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.consultations.ui");
1483class Widget extends ui.section.default.Widget {
1484constructor(data, service) {
1485super();
1486this._css = "user-consultations-section-recomendations-item";
1487this._data = data;
1488this._service = service;
1489this.setTemplate(new beeJS.Template(19, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let item = model.data.data; html.push("\n");let modal = (model.data.modal) ? "modal" : ""; html.push("\n<div class=\"");html.push(css);html.push(" ");html.push(modal);html.push("\">\n    ");
1489let date = new Date(item.date.started).toLocaleString("ru", {day: 'numeric', month: 'numeric', year: 'numeric'});let next = (item.date.next) ? new Date(item.date.next).toLocaleString("ru", {day: 'numeric', month: 'numeric', year: 'numeric'}) : "";let style = (item.ritmolog.photo) ? 'style="background-image: url('+item.ritmolog.photo+');"' : "";html.push("\n    <div class=\"");html.push(css);html.push("__header\">\n        <div>\n            <div class=\"");html.push(css);html.push("__title\">");html.push(item.title);html.push("</div>\n            <div class=\"");html.push(css);html.push("__date\">");html.push(date);html.push("</div>\n        </div>\n        <div>\n            <div class=\"");html.push(css);html.push("__ritmolog\">\n                <div class=\"img\" ");html.push(style);html.push("></div>\n                <div>\n                    <div class=\"name\">");html.push(item.ritmolog.name);html.push("</div>\n                    <div class=\"type\">");html.push(item.ritmolog.type);html.push("</div>\n                </div>\n            </div>\n        </div> \n    </div>        \n    <div class=\"");html.push(css);html.push("__body\">\n        <h3>Рекомендации ритмолога</h3>\n        ");if(item.materials) { html.push("\n            <div class=\"");html.push(css);html.push("__grid\">\n                ");for(let material of item.materials) { html.push("\n                    ");let islong = (model.data.modal) ? 'long' : "";html.push("\n                    <div class=\"");html.push(css);html.push("__material active\">\n                        <span class=\"");html.push(islong);html.push("\">");html.push(material.name);html.push("</span>\n                    </div>\n                    <a href=\"");html.push(material.link);html.push("\" target=\"_blank\"><button>Открыть</button></a>\n                ");} html.push("\n            </div> \n        ");} html.push("\n        ");console.log(modal); html.push("\n        ");if(modal === "modal") { html.push("\n            <div class=\"");html.push(css);html.push("__text ");html.push(css);html.push("__text--big\">\n                <p>");html.push(item.recomendation);html.push("</p>\n            </div>\n        ");} else { html.push("\n            <div class=\"");html.push(css);html.push("__text\">\n                <p>");html.push(item.recomendation);html.push("</p>\n            </div>\n        ");} html.push("\n        ");if(next) { html.push("\n            <div class=\"");html.push(css);html.push("__message\">Рекомендуем следующую консультацию <a>");html.push(next);html.push("</a></div>\n        ");} html.push("  \n    </div>\n    <div class=\"");html.push(css);html.push("__footer\"> \n        <button id=\"");html.push(bindInfo.registerInBindInfo('feedback'));html.push("\">Оставить отзыв</button>\n        ");if(!modal) { html.push("\n            <button id=\"");html.push(bindInfo.registerInBindInfo('recomendation'));html.push("\">Открыть рекомендацию</button>\n        ");} else { html.push("\n            <a href=\"/catalog/consultation/\">Перейти в каталог</a>\n        ");} html.push("\n    </div> \n</div>\n");return html.join('');}), {
1490css: this._css,
1491data: this._data,
1492widget: this
1493});
1494}
1495_initControls() {
1496this._initPopupControls();
1497this._bind._feedback.onclick = (e) => {
1498this._initModal("feedback", this._data.data)
1499};
1500let recomendations = beeJS.ArrayUtil.asArray(this._bind._recomendation);
1501recomendations.forEach((item, i) => {
1502item.onclick = (e) => {
1503this._initModal("recomendation", this._data.data)
1504};
1505});
1506}
1507_initModal(type, param) {
1508const modal = this._service.modal.build();
1509const data = {
1510id: modal.id
1511};
1512switch(type) {
1513case "feedback":
1514data.title = "Оставьте отзыв";
1515data.footer = "absolute";
1516data.widget = new ui.feedback.Widget({modal: modal.id, data: param}, this._service);
1517break;
1518case "recomendation":
1519data.title = "Рекомендация ритмолога";
1520data.footer = "hidden";
1521data.widget = new ui.section.recomendations.item.Widget({modal: modal.id, data: param}, this._service);
1522break;
1523default:
1524break;
1525}
1526const widget = new ui.modal.Widget(data, this._service.modal);
1527widget.start(modal); 
1528}
1529}
1530;Widget.__pN='user.consultations.ui.section.recomendations.item';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.section.recomendations.item'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.section.recomendations.block')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.consultations.ui");
1531class Widget extends ui.section.default.Widget {
1532constructor(data, service) {
1533super();
1534this._css = "user-consultations-section-recomendations-block";
1535this._data = data;
1536this._service = service;
1537this.setTemplate(new beeJS.Template(20, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__title\">\n        <h3>
1537Активные рекомендации</h3>\n        <button class=\"");html.push(css);html.push("__info\" id=\"");html.push(bindInfo.registerInBindInfo('info'));html.push("\"></button>\n        <div class=\"");html.push(css);html.push("__popup\" id=\"");html.push(bindInfo.registerInBindInfo('popup'));html.push("\">\n            <p>После консультации ритмолог может оставить вам дополнительные рекомендации — они могут быть в текстовом варианте, а также доступ к материалам рекомендованной ритмомеры. <strong>Рекомендации будут отображаться 2 недели после консультации.</strong></p><p>Потом вы их сможете найти в блоке История консультаций.</p>\n        </div>\n    </div>\n    <div class=\"");html.push(css);html.push("__list\" id=\"");html.push(bindInfo.registerInBindInfo('list'));html.push("\"></div>\n</div>\n");return html.join('');}), {
1538css: this._css,
1539data: this._data,
1540widget: this
1541});
1542}
1543_initControls() {
1544this._initPopupControls();
1545}
1546_initContent() {
1547this._bind._list.innerHTML = "";
1548for(let item of this._data.list) {
1549const div = document.createElement("div");
1550const widget = new ui.section.recomendations.item.Widget({data: item}, this._service);
1551this._bind._list.appendChild(div);
1552widget.start(div);
1553}
1554}
1555}
1556;Widget.__pN='user.consultations.ui.section.recomendations.block';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.section.recomendations.block'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.section.faq')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.consultations.ui");
1557class Widget extends ui.section.default.Widget {
1558constructor(data, service) {
1559super();
1560this._css = "user-consultations-section-faq";
1561this._data = data;
1562this._service = service;
1563this.setTemplate(new beeJS.Template(21, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\"></div>\n    <div class=\"");html.push(css);html.push("__title\">\n        <h3>Частые вопросы<h3>\n    </div>\n    <div class=\"");html.push(css);html.push("__grid\" id=\"");html.push(bindInfo.registerInBindInfo('grid'));html.push("\">\n        <div class=\"");html.push(css);html.push("__item\" id=\"");html.push(bindInfo.registerInBindInfo('item'));html.push("\">\n            <h4>Как перенести консультацию?</h4>\n            <div>\n                <p>Вы можете перенести консультацию, уведомив ритмолога не позднее чем за 4 часа до её начала. Для этого свяжитесь с ним удобным вам способом (через мессенджер или по телефону) и согласуйте новое время. Если вы не уверены, когда сможете пройти консультацию, её можно отложить на будущее — в таком случае вы сможете вернуться к ней, когда будете готовы. Главное, заранее предупредить ритмолога, чтобы он мог скорректировать своё расписание.</p>\n            </div>\n        </div>\n        <div class=\"");html.push(css);html.push("__item\" id=\"");html.push(bindInfo.registerInBindInfo('item'));html.push("\">\n            <h4>Когда могу отменить?</h4>\n            <div>\n                <p>Вы можете отменить консультацию, предупредив ритмолога не позднее чем за 4 часа до её начала. Если вы хотите перенести консультацию на другого специалиста или заменить её на другой товар, пожалуйста, свяжитесь с нашей службой поддержки. Мы поможем вам внести необходимые изменения в заказ и подобрать подходящий вариант.</p>\n            </div>\n        </div>		\n        <div class=\"");html.push(css);html.push("__item\" id=\"");html.push(bindInfo.registerInBindInfo('item'));html.push("\">\n            <h4>Как выглядит процесс консультации?</h4>\n            <div>\n                <p><strong>1. Онлайн-консультация</strong></p>\n                <p>Онлайн-консультация проходит через видеосвязь на платформе, о которой вы договоритесь заранее (Skype, Zoom, Telegram или любая другая удобная для вас программа). Подключиться можно как с телефона, так и с компьютера. Важно, чтобы вам было комфортно: выбирайте тихое место, где вы сможете свободно говорить, не отвлекаясь на посторонних. Идеальная обстановка — уединённое и уютное пространство, где вы сможете легко делиться своими мыслями и чувствами.</p>\n                <p>Иногда для консультации могут понадобиться книги. Если у вас их нет, ритмолог пришлёт вам ссылки или предложит другие варианты, чтобы вы могли получить нужные материалы.</p>\n                <p><strong>2. Очная консультация</strong></p>\n                <p>В случае очной консультации вы встретитесь с ритмологом лично. Место встречи обсуждается заранее — это может быть офис, специально оборудованное помещение или любое другое удобное место, где можно спокойно поговорить.</p>\n            </div>\n        </div>\n        <div class=\"");html.push(css);html.push("__item\" id=\"");html.push(bindInfo.registerInBindInfo('item'));html.push("\">\n            <h4>Надо ли мне что-то подготовить?</h4>    \n            <div>\n                <p>В большинстве случаев вам не нужно ничего специально готовить для консультации — ритмолог сам направит беседу в нужное русло. Если потребуется какая-то дополнительная информация или материалы, ритмолог заранее сообщит вам об этом и даст все необходимые инструкции.</p>\n                <p>Главное — правильно организовать пространство и связь. Если консультация проходит онлайн, убедитесь, что у вас стабильное интернет-соединение и подходящее устройство (телефон или компьютер). Выберите удобное и уединённое место, где вас никто не будет отвлекать, чтобы вы могли свободно говорить и комфортно делиться мыслями. Для очных встреч — важна такая же обстановка, где будет легко сосредоточиться на разговоре.</p>\n                <p>Если у вас возникнут какие-либо вопросы или сомнения, ритмолог всегда будет на связи, чтобы помочь вам подготовиться.</p>\n            </div>\n        </div>\n    </div>\n</div>\n");return html.join('');}), {
1564css: this._css,
1565data: this._data
1566});
1567}
1568_initControls() {
1569let grid = this._bind._grid;
1570let items = beeJS.ArrayUtil.asArray(this._bind._item);
1571items.forEach((item) => {
1572let actionOut = (event) => {
1573if (!item.contains(event.target)) {
1574item.classList.remove("active");
1575grid.classList.remove("active");
1576document.removeEventListener("click", actionOut);
1577}
1578};
1579item.addEventListener("click", (e) => {
1580let isActive = item.classList.contains("active");
1581items.forEach((j) => j.classList.remove("active"));
1582if (!isActive) {
1583item.classList.add("active");
1584grid.classList.add("active");
1585document.addEventListener("click", actionOut);
1586} else {
1587grid.classList.remove("active");
1588}
1589e.stopPropagation();
1590});
1591});
1592this._initPopupControls();
1593}
1594}
1595;Widget.__pN='user.consultations.ui.section.faq';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.section.faq'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.section.orderhistory.table')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.consultations.ui");
1596class Widget extends ui.section.default.Widget {
1597constructor(data, service) {
1598super();
1599this._css = "user-consultations-section-history-order-table";
1600this._data = data;
1601this._service = service;
1602this.setTemplate(new beeJS.Template(22, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<table class=\"");html.push(css);html.push("\">\n    <tbody>\n        <tr>\n            <th class=\"order\">Заказ</th>\n            <th>Дата создания</th>\n            <th>Название</th>\n            <th>Сумма</th>\n            <th>Статус</th>\n            <th>Способ оплаты</th>\n            <th class=\"action\">Действие</th>\n        </tr>\n        ");for(let item of data) { html.push("\n            <tr data-id=\"");html.push(item.id);html.push("\">\n                <td class=\"order\">\n                    <div>");html.push(item.id);html.push("</div>\n                </td>\n                <td class=\"datetime\">\n                    <div>");html.push(item.dateInsert);html.push("</div>\n                </td>\n                <td class=\"title\">\n                    <div>");html.push(item.productName);html.push("</div>\n                </td>\n                <td class=\"sum\">\n                    <div>Сумма: ");html.push(item.price);html.push("₽</div>\n                    ");if(item.payed === 'N' && item.canceled === 'N') { html.push("\n                        <div>Осталось: ");html.push(item.price - item.sumPaid);html.push("₽</div>\n                    ");} html.push("\n                </td>\n                <td class=\"status\">\n                    ");if(item.payed === 'N' && item.canceled === 'N') { html.push("\n                        <div>Не оплачен</div>\n                    ");} html.push("\n                    ");if(item.payed === 'Y' && item.canceled === 'N') { html.push("\n                        <div>Оплачен</div>\n                        <div> ");html.push(item.datePayed);html.push(" </div>\n                    ");} html.push("\n                    ");if(item.payed === 'N' && item.canceled === 'Y') { html.push("\n                        <div>Отменён</div>\n                        <div> ");html.push(item.dateCanceled);html.push(" </div>\n                    ");} html.push("\n                </td>\n                <td>\n                    <div class=\"payment\">\n                        ");for(const payment of item.payments) { html.push("\n                            ");if(!payment.isBonusPay) { html.push("\n                                ");if(payment.name) { html.push("\n                                    <div class=\"name\"> ");html.push(payment.name);html.push(" ");html.push(payment.paid ? '(' + payment.sum + '₽)' : '');html.push(" </div>\n                                ");} html.push("\n                            ");} else { html.push("\n                                <div class=\"name\">");html.push(payment.name);html.push(": ");html.push(payment.sum);html.push("₽</div>\n                            ");} html.push("\n                        ");} html.push("\n                    </div>\n                </td>\n                <td class=\"action\">\n                    ");
1602if(item.payed == 'Y') { html.push("\n                        ");for(const action of item.actions) { html.push("\n                            <div class=\"buy\">\n                                ");if(action.html) { html.push("\n                                ");html.push(action.html);html.push("\n                                ");} else { html.push("\n                                <a href=\"");html.push(action.href);html.push("\" title=\"");html.push(action.text);html.push("\" onlick=\"");html.push(action.click);html.push("\" ");html.push(action.attr);html.push(" >");html.push(action.text);html.push("</a>\n                                ");} html.push("\n                            </div>\n                        ");} html.push("\n                    ");} else { html.push("\n                        ");for(const key in item.payments) { html.push("\n                            ");const payment = item.payments[key]; html.push("\n                            ");if(!payment.isBonusPay) { html.push("\n                                ");if(item.payed === 'N' && item.canceled === 'N') { html.push("\n                                    ");if(key == 0) { html.push("\n                                        ");if(payment.link) { html.push("\n                                            ");html.push(payment.link);html.push("\n                                        ");} html.push("\n                                        <button class=\"button cancel\" id=\"");html.push(bindInfo.registerInBindInfo('cancel'));html.push("\" data-id=\"");html.push(item.id);html.push("\">Отменить</button>\n                                    ");} html.push("\n                                ");} html.push("\n                            ");} html.push("\n                        ");} html.push("\n                    ");} html.push("\n                </td>\n            </tr>\n        ");} html.push("\n    </tbody>\n</table>\n");return html.join('');}), {
1603css: this._css,
1604data: this._data,
1605widget: this
1606});
1607}
1608_initControls() {
1609this._initCancelButtons();
1610}
1611_initCancelButtons() {
1612let buttons = beeJS.ArrayUtil.asArray(this._bind._cancel);
1613buttons.forEach((item, i) => {
1614item.onclick = async (e) => {
1615const item = e.target;
1616const id = item.dataset.id;
1617item.disabled = true;
1618if (id) {
1619const response = await this._service.cancelOrder(id);
1620if (response?.status === true) {
1621const row = document.querySelector(`tr[data-id="${id}"]`);
1622if (row) {
1623item.remove();
1624const statusCell = row.querySelector('.status');
1625if (statusCell) {
1626statusCell.innerHTML = '<div>Отменён</div>';
1627}
1628const sumCell = row.querySelector('.sum div:nth-child(2)');
1629if (sumCell) {
1630sumCell.remove();
1631}
1632const paymentCell = row.querySelector('.action');
1633if (paymentCell) {
1634const children = Array.from(paymentCell.children);
1635children.forEach(child => {
1636if (!child.classList.contains('name')) {
1637child.remove();
1638}
1639});
1640}
1641}
1642}
1643}
1644};
1645});
1646}
1647}
1648;Widget.__pN='user.consultations.ui.section.orderhistory.table';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.section.orderhistory.table'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.section.orderhistory.block')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.consultations.ui");
1649class Widget extends ui.section.default.Widget {
1650constructor(data, service) {
1651super();
1652this._css = "user-consultations-section-history-order-block";
1653this._data = data;
1654this._service = service;
1655this.setTemplate(new beeJS.Template(23, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__filter\">\n        <div class=\"");html.push(css);html.push("__select\">\n            <select id=\"");html.push(bindInfo.registerInBindInfo('select'));html.push("\">\n                <option value=\"\" disabled=\"\" selected=\"\" id=\"");html.push(bindInfo.registerInBindInfo('option'));html.push("\">Статус</option>\n                <option value=\"active\" id=\"");html.push(bindInfo.registerInBindInfo('option'));html.push("\">Не оплачен</option>\n                <option value=\"payed\" id=\"");html.push(bindInfo.registerInBindInfo('option'));html.push("\">Оплачен</option>\n                <option value=\"canceled\" id=\"");html.push(bindInfo.registerInBindInfo('option'));html.push("\">Отменён</option>\n            </select>\n        </div>\n    </div>\n    <div class=\"");html.push(css);html.push("__table\" id=\"");html.push(bindInfo.registerInBindInfo('table'));html.push("\"></div>\n    <div class=\"");html.push(css);html.push("__pager\">\n        <button class=\"limit\" id=\"");html.push(bindInfo.registerInBindInfo('minus'));html.push("\"></button>\n        <div class=\"");html.push(css);html.push("__count\" id=\"");html.push(bindInfo.registerInBindInfo('count'));html.push("\"></div>\n        <button class=\"\" id=\"");html.push(bindInfo.registerInBindInfo('plus'));html.push("\"></button>\n        <div>из</div>\n        <div class=\"");html.push(css);html.push("__total\" id=\"");html.push(bindInfo.registerInBindInfo('total'));html.push("\"></div>\n    </div>\n</div>\n");return html.join('');}), {
1656css: this._css,
1657data: this._data
1658});
1659}
1660_initControls() {
1661this._initTable();
1662this._initSelector();
1663this._initPagerControls();
1664}
1665_initTable() {
1666this._bind._table.innerHTML = "";
1667if(this._data?.items?.length > 0) {
1668const div = document.createElement("div");
1669const widget = new ui.section.orderhistory.table.Widget(this._data.items, this._service);
1670this._bind._table.appendChild(div);
1671widget.start(div); 
1672} else if(this._data?.error) {
1673this._bind._table.innerHTML = `<div class="${this._css}__empty"><p>${this._data?.error}</p></div>`;
1674} else {
1675this._bind._table.innerHTML = `<div class="${this._css}__empty"><div></div><p>По вашему запросу ничего не найдено</p></div>`;
1676}
1677}
1678_initSelector() {
1679let lastSentValue = null;
1680const currentStatus = this._data?.filter?.status ?? null;
1681this._bind._select.addEventListener('change', (e) => {
1682e.stopPropagation();
1683const backendStatus = e.target.value;
1684if (backendStatus === lastSentValue) {
1685return;
1686}
1687this._bind._table.innerHTML = '';
1688lastSentValue = backendStatus;
1689this._service.loadOrderHistory(
16901, lastSentValue
1691);
1692});
1693this._setFilter(currentStatus);
1694}
1695_setFilter(status = null) {
1696if(status) {
1697const options = beeJS.ArrayUtil.asArray(this._bind?._option ?? []);
1698if (!Array.isArray(options) || !options.length) {
1699return;
1700}
1701options.forEach((item) => {
1702item.selected = false;
1703});
1704if (!status) {
1705return;
1706}
1707const match = options.find(item => item.value === status);
1708if (match) {
1709match.selected = true;
1710}
1711}
1712}
1713_initPagerControls() {
1714const currentStatus = this._data?.filter?.status ?? null;
1715this._bind._minus.onclick = (e) => {
1716this._bind._table.innerHTML = '';
1717this._service.loadOrderHistory(
1718this._data.page - 1,
1719currentStatus
1720);
1721};
1722this._bind._plus.onclick = (e) => {
1723this._bind._table.innerHTML = '';
1724this._service.loadOrderHistory(
1725this._data.page + 1,
1726currentStatus
1727);
1728};
1729this._setPager()
1730}
1731_setPager() {
1732const value = this._data.page ?? 1;
1733const max = this._data.total ?? 1;
1734this._bind._count.innerText = value;
1735this._bind._total.innerText = max;
1736this._bind._minus.classList.remove("disabled");
1737this._bind._plus.classList.remove("disabled");
1738this._bind._minus.disabled = false;
1739this._bind._plus.disabled = false;
1740if(value === 1) {
1741this._bind._minus.classList.add("disabled");
1742this._bind._minus.disabled = true;
1743};
1744if(value === max) {
1745this._bind._plus.classList.add("disabled");
1746this._bind._plus.disabled = true;
1747};
1748}
1749}
1750;Widget.__pN='user.consultations.ui.section.orderhistory.block';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.section.orderhistory.block'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.section.history.table')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.consultations.ui");
1751class Widget extends ui.section.default.Widget {
1752constructor(data, service) {
1753super();
1754this._css = "user-consultations-section-history-table";
1755this._data = data;
1756this._service = service;
1757this.setTemplate(new beeJS.Template(24, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<table class=\"");html.push(css);html.push("\">\n    <tbody>\n        ");for(let item of data.list) { html.push("\n            <tr>\n                ");let date = new Date(item.date.started).toLocaleString("ru", {day: 'numeric', month: 'numeric', year: 'numeric'});html.push("\n                <td class=\"datetime\">\n                    <div>");html.push(date);html.push("</div>\n                    <div>");html.push(model.widget._formatHours(item.progress.total));html.push("</div>\n                </td>\n                <td class=\"order\">");html.push(item.order.id);html.push("</td>\n                <td class=\"product\">\n                    <div>");html.push(item.ritmolog.type);html.push("</div>\n                    <div>");html.push(item.title);html.push("</div>\n                </td>\n                <td class=\"ritmolog\">");html.push(item.ritmolog.name);html.push("</td>\n                <td class=\"feedback\">\n                    <button id=\"");html.push(bindInfo.registerInBindInfo('feedback'));html.push("\" data-id=\"");html.push(item.id);html.push("\">Оставить отзыв</button>\n                </td>\n                <td class=\"recomendation\">\n                    ");if(item.recomendation) { html.push("\n                        <button id=\"");html.push(bindInfo.registerInBindInfo('recomendation'));html.push("\" data-id=\"");html.push(item.id);html.push("\">Рекомендация</button>\n                    ");} html.push("\n                </td>\n            </tr>\n        ");} html.push("\n    </tbody>\n</table>\n");return html.join('');}), {
1758css: this._css,
1759data: this._data,
1760widget: this
1761});
1762}
1763_initControls() {
1764this._initPopupControls();
1765let feedbacks = beeJS.ArrayUtil.asArray(this._bind._feedback);
1766feedbacks.forEach((item, i) => {
1767item.onclick = (e) => {
1768let data = this._data.list.find((i) => i.id === item.dataset.id);
1769this._initModal("feedback", data)
1770};
1771});
1772let recomendations = beeJS.ArrayUtil.asArray(this._bind._recomendation);
1773recomendations.forEach((item, i) => {
1774item.onclick = (e) => {
1775let data = this._data.list.find((i) => i.id === item.dataset.id);
1776this._initModal("recomendation", data)
1777};
1778});
1779}
1780_initModal(type, param) {
1781const modal = this._service.modal.build();
1782const data = {
1783id: modal.id
1784};
1785switch(type) {
1786case "feedback":
1787data.title = "Оставьте отзыв";
1788data.footer = "absolute";
1789data.widget = new ui.feedback.Widget({modal: modal.id, data: param}, this._service);
1790break;
1791case "recomendation":
1792data.title = "Рекомендация ритмолога";
1793data.footer = "hidden";
1794data.widget = new ui.section.recomendations.item.Widget({modal: modal.id, data: param}, this._service);
1795break;
1796default:
1797break;
1798}
1799const widget = new ui.modal.Widget(data, this._service.modal);
1800widget.start(modal); 
1801}
1802_formatHours(hours) {
1803const days = Math.floor(hours / 24);
1804const remainingHours = hours % 24;
1805let result = '';
1806if (days > 0) {
1807result += `${days} ${this._declineWord(days, 'сутки', 'суток', 'суток')}`;
1808}
1809if (remainingHours > 0 || days === 0) {
1810if (result) result += ' ';
1811result += `${remainingHours} ${this._declineWord(remainingHours, 'час', 'часа', 'часов')}`;
1812}
1813return result;
1814}
1815_declineWord(number, one, two, five) {
1816const lastDigit = number % 10;
1817const lastTwoDigits = number % 100;
1818if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
1819return five;
1820}
1821if (lastDigit === 1) {
1822return one;
1823}
1824if (lastDigit > 1 && lastDigit <= 4) {
1825return two;
1826}
1827return five;
1828}
1829}
1830;Widget.__pN='user.consultations.ui.section.history.table';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.section.history.table'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.section.history.block')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.consultations.ui");
1831class Widget extends ui.section.default.Widget {
1832constructor(data, service) {
1833super();
1834this._css = "user-consultations-section-history-block";
1835this._data = data;
1836this._service = service;
1837this.setTemplate(new beeJS.Template(25, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__filter\">\n        <div class=\"");html.push(css);html.push("__search\">\n            <input type=\"text\" placeholder=\"Введите ФИО специалиста\" data-id=\"ritmolog\" id=\"");html.push(bindInfo.registerInBindInfo('input'));html.push("\">\n            <div class=\"tips\"></div>\n            <button class=\"clear\" id=\"");html.push(bindInfo.registerInBindInfo('clear'));html.push("\"></button>\n        </div>\n        <div class=\"");html.push(css);html.push("__dropdown\" data-icon=\"products\" data-id=\"title\" id=\"");html.push(bindInfo.registerInBindInfo('dropdown'));html.push("\">\n            <button type=\"button\" class=\"value\"></button>\n            <div>\n                ");let titles = [];for(let item of data.list) {if(!titles.includes(item.title)) {titles.push(item.title);}} html.push("\n                ");for(let title of titles) { html.push("\n                    <button type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('value'));html.push("\">");html.push(title);html.push("</button>\n                ");} html.push("\n            </div>\n            <button class=\"clear\" id=\"");html.push(bindInfo.registerInBindInfo('clear'));html.push("\"></button>\n            <div class=\"placeholder\">Название товара</div>\n        </div>\n        <div class=\"");html.push(css);html.push("__dropdown\" data-icon=\"sections\" data-id=\"type\" id=\"");html.push(bindInfo.registerInBindInfo('dropdown'));html.push("\">\n            <button type=\"button\" class=\"value\"></button>\n            <div>\n                ");let types = [];for(let item of data.list) {if(!types.includes(item.ritmolog.type)) {types.push(item.ritmolog.type);}} html.push("\n                ");for(let type of types) { html.push("\n                    <button type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('value'));html.push("\">");html.push(type);html.push("</button>\n                ");} html.push("\n            </div>\n            <button class=\"clear\" id=\"");html.push(bindInfo.registerInBindInfo('clear'));html.push("\"></button>\n            <div class=\"placeholder\">Направление</div>\n        </div>\n        <div class=\"");html.push(css);html.push("__search\" data-icon=\"orders\">\n            <input type=\"text\" placeholder=\"Номер заказа\" data-id=\"order\" id=\"");html.push(bindInfo.registerInBindInfo('input'));html.push("\">\n            <div class=\"tips\"></div>\n            <button class=\"clear\" id=\"");html.push(bindInfo.registerInBindInfo('clear'));html.push("\"></button>\n        </div>\n        <button class=\"");html.push(css);html.push("__button\">Фильтры</button>\n    </div>\n    <div class=\"");html.push(css);html.push("__table\" id=\"");html.push(bindInfo.registerInBindInfo('table'));html.push("\"></div>\n    <div class=\"");html.push(css);html.push("__pager\">\n        <button class=\"limit\" id=\"");html.push(bindInfo.registerInBindInfo('minus'));html.push("\"></button>\n        <div class=\"");html.push(css);html.push("__count\" id=\"");html.push(bindInfo.registerInBindInfo('count'));html.push("\"></div>\n        <button class=\"\" id=\"");html.push(bindInfo.registerInBindInfo('plus'));html.push("\"></button>\n        <div>из</div>\n        <div class=\"");html.push(css);html.push("__amount\" id=\"");html.push(bindInfo.registerInBindInfo('amount'));html.push("\"></div>\n    </div>\n</div>\n");return html.join('');}), {
1838css: this._css,
1839data: this._data
1840});
1841}
1842_initControls() {
1843this._initPopupControls();
1844this._initPagerControls();
1845this._initSearchControls();
1846this._initDropdownControls();
1847let clears = beeJS.ArrayUtil.asArray(this._bind._clear);
1848clears.forEach((item, i) => {
1849item.onclick = (e) => {
1850$(item).parent().removeClass("valued");
1851if($(item).parent().find(".value").length > 0) {
1852$(item).parent().find(".value").html("");
1853} else {
1854$(item).parent().find("input")[0].value = "";
1855}
1856this._setFilter();
1857e.stopPropagation();
1858};
1859});
1860}
1861_initPagerControls() {
1862this._bind._minus.onclick = (e) => {
1863let value = parseInt(this._bind._count.innerText, 10);
1864if(value > 1) {
1865this._setPage(--value);
1866};
1867this._bind._count.innerText = value;
1868};
1869this._bind._plus.onclick = (e) => {
1870let value = parseInt(this._bind._count.innerText, 10);
1871let max = parseInt(this._bind._amount.innerText, 10);
1872if(value < max) {
1873this._setPage(++value);
1874};
1875this._bind._count.innerText = value;
1876};
1877}
1878_initDropdownControls() {
1879let dropdowns = beeJS.ArrayUtil.asArray(this._bind._dropdown);
1880dropdowns.forEach((item, i) => {
1881let actionOut = (event) => {
1882if (!item.contains(event.target)) {
1883item.classList.remove("active");
1884document.removeEventListener("click", actionOut);
1885}
1886};
1887item.onclick = (e) => {
1888item.classList.toggle("active");
1889document.addEventListener("click", actionOut);
1890};
1891});
1892let values = beeJS.ArrayUtil.asArray(this._bind._value);
1893values.forEach((item, i) => {
1894item.onclick = (e) => {
1895$(item).parent().find("button").removeClass("active");
1896$(item).addClass("active");
1897$(item).parent().parent().addClass("valued");
1898$(item).parent().parent().find(".value").html(item.innerHTML);
1899this._setFilter();
1900};
1901});
1902}
1903_initSearchControls() {
1904let inputs = beeJS.ArrayUtil.asArray(this._bind._input);
1905inputs.forEach((item, i) => {
1906item.onkeyup = (e) => {
1907$(item).parent().addClass("active");
1908let tips = [];
1909switch(item.dataset.id) {
1910case "ritmolog":
1911tips = Array.from(new Set(this._data.list.map((i) => i.ritmolog.name)));
1912break;
1913case "order":
1914tips = Array.from(new Set(this._data.list.map((i) => i.id)));
1915break;
1916default:
1917break;
1918}
1919this._tipsSearch(item, tips);
1920};
1921item.onblur = (e) => {
1922$(item).parent().addClass("hidden");
1923setTimeout(() => {
1924$(item).parent().removeClass("hidden");
1925$(item).parent().removeClass("active");
1926}, 1000);
1927};
1928});
1929}
1930_initContent() {
1931this._setFilter();
1932}
1933_initTable(data) {
1934this._bind._table.innerHTML = "";
1935if(data.length > 0) {
1936const div = document.createElement("div");
1937const widget = new ui.section.history.table.Widget({list: data}, this._service);
1938this._bind._table.appendChild(div);
1939widget.start(div); 
1940} else {
1941this._bind._table.innerHTML = `<div class="${this._css}__empty"><div></div><p>По вашему запросу ничего не найдено</p></div>`;
1942}
1943}
1944_setFilter() {
1945this._data.filtered = this._data.list;
1946let dropdowns = beeJS.ArrayUtil.asArray(this._bind._dropdown);
1947dropdowns.forEach((item, i) => {
1948let p = $(item).find(".value").html();
1949if(p) {
1950switch(item.dataset.id) {
1951case "title":
1952this._data.filtered = this._data.filtered.filter((i) => i.title === p);
1953break;
1954case "type":
1955this._data.filtered = this._data.filtered.filter((i) => i.ritmolog.type === p);
1956break;
1957default:
1958break;
1959}
1960}
1961});
1962let inputs = beeJS.ArrayUtil.asArray(this._bind._input);
1963inputs.forEach((item, i) => {
1964let p = item.value;
1965if(p) {
1966switch(item.dataset.id) {
1967case "ritmolog":
1968this._data.filtered = this._data.filtered.filter((i) => i.ritmolog.name === p);
1969break;
1970case "order":
1971this._data.filtered = this._data.filtered.filter((i) => i.id === p);
1972break;
1973default:
1974break;
1975}
1976}
1977});
1978this._setPage(1)
1979}
1980_setPager(value, max) {
1981this._bind._count.innerText = value;
1982this._bind._amount.innerText = max;
1983this._bind._minus.classList.remove("disabled");
1984this._bind._plus.classList.remove("disabled");
1985if(value === 1) {
1986this._bind._minus.classList.add("disabled");
1987};
1988if(value === max) {
1989this._bind._plus.classList.add("disabled");
1990};
1991}
1992_setPage(value) {
1993let max = Math.ceil(this._data.filtered.length / 6);
1994let list = [];
1995for(var i=value*6-6; i<value*6; i++) {
1996if(this._data.filtered[i]) {
1997list.push(this._data.filtered[i]);
1998}
1999}
2000this._setPager(value, max);
2001this._initTable(list);
2002}
2003_tipsSearch(input, tips) {
2004let list = input.parentNode.children[1];
2005let element = input.parentNode;
2006let value = this._convertKeyboardLayout(input.value);
2007if(value.length > 0) {
2008let tipsFound = tips.filter((i) => i.toLowerCase().indexOf(value.toLowerCase()) != -1);
2009list.innerHTML = "";
2010if(tipsFound.length > 0) {
2011for(let i in tipsFound) {
2012let button = document.createElement("button");
2013button.type = "button";
2014button.innerText = tipsFound[i];
2015button.onclick = (e) => {
2016element.classList.add("valued");
2017input.value = button.innerText;
2018this._setFilter();
2019e.stopPropagation();
2020};
2021list.appendChild(button);
2022};
2023} else {
2024list.innerHTML = "Ничего не найдено";
2025};
2026} else {
2027element.classList.remove("search");
2028};
2029}
2030_convertKeyboardLayout(input) {
2031const layoutMap = {
2032q: "й", w: "ц", e: "у", r: "к", t: "е", y: "н", u: "г", i: "ш", o: "щ", p: "з",
2033"[": "х", "]": "ъ", a: "ф", s: "ы", d: "в", f: "а", g: "п", h: "р", j: "о",
2034k: "л", l: "д", ";": "ж", "'": "э", z: "я", x: "ч", c: "с", v: "м", b: "и",
2035n: "т", m: "ь", ",": "б", ".": "ю"
2036};
2037return input.split("").map(char => layoutMap[char] || char).join("");
2038}
2039}
2040;Widget.__pN='user.consultations.ui.section.history.block';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.section.history.block'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.section.default')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.consultations.ui");
2041class Widget extends common.ui.widget.Widget {
2042constructor(data, service) {
2043super();
2044this._css = "user-consultations-section-default";
2045this._data = data;
2046this._service = service;
2047this.setTemplate(new beeJS.Template(26, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n</div>\n");return html.join('');}), {
2048css: this._css,
2049data: this._data
2050});
2051}
2052_initPopupControls() {
2053let info = this._bind._info;
2054let popup = this._bind._popup;
2055if(info && popup) {
2056let actionOut = (event) => {
2057if (!popup.contains(event.target)) {
2058popup.classList.remove("active");
2059document.removeEventListener("click", actionOut);
2060}
2061};
2062info.onclick = (e) => {
2063popup.classList.toggle("active");
2064document.addEventListener("click", actionOut);
2065e.stopPropagation();
2066};
2067}
2068}
2069}
2070;Widget.__pN='user.consultations.ui.section.default';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.section.default'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.eventDescription')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.consultations.ui");var service = BeeJS.package("user.consultations.service");var model = BeeJS.package("user.consultations.model");
2071class Widget extends common.ui.widget.Widget {
2072constructor(data, service) {
2073super();
2074this._css = "user-consultations-event-description";
2075this._data = data;
2076this._service = service;
2077this.setTemplate(
2078new beeJS.Template(27, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data.data; html.push("\n\n<div class=\"");html.push(css);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('block'));html.push("\">\n    <div class=\"");html.push(css);html.push("__info\">\n        <div>\n            ");
2078const startDate = new Date(data.DATE_START).toLocaleString("ru", {day: 'numeric', month: 'numeric', year: 'numeric'});const endDate = new Date(data.DATE_FINISH).toLocaleString("ru", {day: 'numeric', month: 'numeric', year: 'numeric'});html.push("\n            <h3 class=\"");html.push(css);html.push("__title\">");html.push(((data.EVENT_NAME.length > 37) ? data.EVENT_NAME.substring(0, 37)+"..." : data.EVENT_NAME ));html.push("</h3>\n            <h3 class=\"");html.push(css);html.push("__date\">");html.push(startDate);html.push(" - ");html.push(endDate);html.push("</h3>\n        </div>        \n        <div>\n            <div class=\"");html.push(css);html.push("__ritmolog\">\n                <div class=\"");html.push(css);html.push("__image\" style=\"background-image: url(");html.push(data.RITMOLOG.IMAGE);html.push(");\"></div>\n                <div>\n                    <div class=\"");html.push(css);html.push("__name\">");html.push(data.RITMOLOG.NAME);html.push("</div>\n                </div>\n            </div>\n        </div> \n    </div>\n    ");if(data.DESCRIPTION) { html.push("\n        <div class=\"");html.push(css);html.push("__dropdown\">\n            <div class=\"");html.push(css);html.push("__dropdown-header\" id=\"");html.push(bindInfo.registerInBindInfo('dropdown'));html.push("\">\n                <span class=\"");html.push(css);html.push("__dropdown-title\">Описание</span>\n                <span class=\"");html.push(css);html.push("__dropdown-arrow\">\n                    <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n                        <path d=\"M6 9L12 15L18 9\" stroke=\"#00A170\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n                    </svg>\n                </span>\n            </div>\n            <div class=\"");html.push(css);html.push("__dropdown-content\">\n                <p>");html.push(data.DESCRIPTION || "Описание не найдено...");html.push("</p>\n            </div>\n        </div>\n    ");} html.push("\n    <h3>Контакты</h3>\n    <ul class=\"");html.push(css);html.push("__list\">\n        ");let href = ""; html.push("\n        ");if(data.RITMOLOG.EMAIL) { html.push("\n            ");href = "mailto:" + data.RITMOLOG.EMAIL; html.push("\n            <li><a class=\"");html.push(css);html.push("__contact ");html.push(css);html.push("__contact_email\" href=\"");html.push(href);html.push("\">");html.push(data.RITMOLOG.EMAIL);html.push("</a></li>\n        ");} html.push("\n        ");if(data.RITMOLOG.PHONE) { html.push("\n            ");href = "tel:" + data.RITMOLOG.PHONE; html.push("\n            <li><a class=\"");html.push(css);html.push("__contact ");html.push(css);html.push("__contact_phone\" href=\"");html.push(href);html.push("\">");html.push(data.RITMOLOG.PHONE);html.push("</a></li>\n        ");} html.push("\n        ");if(data.RITMOLOG.TELEGRAM) { html.push("\n            ");let telegram = data.RITMOLOG.TELEGRAM;if (telegram.match(/^[0-9+\(\)\s-]+$/)) {href = 'tg://resolve?phone=' + telegram.replace(/[^0-9]/g, '');} else {href = "https://t.me/" + telegram.replace('@','');}html.push("\n            <li><a class=\"");html.push(css);html.push("__contact ");html.push(css);html.push("__contact_telegram\" href=\"");html.push(href);html.push("\">");html.push(data.RITMOLOG.TELEGRAM);html.push("</a></li>\n        ");} html.push("\n    </ul>\n    <h3>Список модулей</h3>\n    <ul class=\"");html.push(css);html.push("__modules\">\n        ");const modules = data.MODULES; html.push("\n        ");if(modules.length > 0) { html.push("\n            ");for(let module of modules) { html.push("\n                ");const startDate = new Date(module.DATE_START).toLocaleString("ru", {day: 'numeric', month: 'numeric', year: 'numeric'});const endDate = new Date(module.DATE_FINISH).toLocaleString("ru", {day: 'numeric', month: 'numeric', year: 'numeric'});html.push("\n                <li>");html.push(module.NAME);html.push(". Даты: ");html.push(startDate);html.push(" - ");html.push(endDate);html.push("</li>\n            ");} html.push("\n        ");} html.push("\n    </ul>\n    <h3>Ссылки</h3>\n    <ul class=\"");html.push(css);html.push("__modules\">\n        ");const links = data.LINKS; html.push("\n        ");if(links.length > 0) { html.push("\n            ");for(let link of links) { html.push("\n                <li>");html.push(link);html.push("</li>\n            ");} html.push("\n        ");} html.push("\n    </ul>\n</div>\n");return html.join('');}),
2079{
2080css: this._css,
2081data: this._data
2082}
2083);
2084}
2085_initControls () {
2086let dropdowns = beeJS.ArrayUtil.asArray(this._bind._dropdown);
2087dropdowns.forEach((item) => {
2088item.onclick = () => {
2089const parent = item.closest('.' + this._css + '__dropdown');
2090if (parent) {
2091parent.classList.toggle('is-active');
2092}
2093};
2094});
2095}
2096}
2097;Widget.__pN='user.consultations.ui.eventDescription';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.eventDescription'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.renewProduct')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.consultations.ui");var service = BeeJS.package("user.consultations.service");var model = BeeJS.package("user.consultations.model");var payment = BeeJS.package("user.payment");
2098class Widget extends common.ui.widget.Widget {
2099constructor(data, service) {
2100super();
2101this._css = "user-consultations-renew";
2102this._data = data;
2103this._service = service;
2104this.setTemplate(
2105new beeJS.Template(28, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data.data; html.push("\n");let widget = model.widget; html.push("\n<div class=\"");html.push(css);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('block'));html.push("\">\n    ");for(let id in data.products) { html.push("\n        ");const item = data.products[id]; html.push("\n        <button type=\"button\" data-day=\"");html.push(item.durationDays);html.push("\" data-id=\"");html.push(item.id);html.push("\" id=\"");
2105html.push(bindInfo.registerInBindInfo('renewDayButton'));html.push("\">\n            ");html.push(item.durationDays + ' ' + widget._createLabel(item.durationDays, ['день', 'дня', 'дней']));html.push(" — ");html.push(item.price);html.push(" ₽\n        </button>\n    ");} html.push("\n</div>\n");return html.join('');}),
2106{
2107css: this._css,
2108data: this._data,
2109widget: this
2110}
2111);
2112}
2113_initControls() {
2114let buttons = beeJS.ArrayUtil.asArray(this._bind._renewDayButton);
2115buttons.forEach((item) => {
2116item.onclick = async (e) => {
2117const item = e.target;
2118item.disabled = true;
2119const id = item.dataset.id;
2120const product = this._data.data.products[id];
2121const data = {
2122modal: this._data.modal,
2123key: this._data.key,
2124product: {
2125id: product.id,
2126price: product.price,
2127quantity: 1,
2128name: product.name
2129}
2130}
2131const service = new payment.service.RenewProductService();
2132service.model.setValue("data", data);
2133const widget = new payment.ui.shell.Widget(data, service);
2134this._initWidget(this._bind._block, widget);
2135};
2136});
2137}
2138_createLabel(number, titles) {
2139const cases = [2, 0, 1, 1, 1, 2];
2140return `${titles[number % 100 > 4 && number % 100 < 20 ? 2 : cases[number % 10 < 5 ? number % 10 : 5]]}`;
2141}
2142}
2143;Widget.__pN='user.consultations.ui.renewProduct';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.renewProduct'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.feedback')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("consultations.ui");
2144class Widget extends common.ui.widget.Widget {
2145constructor(data, service) {
2146super();
2147this._css = "user-consultations-feedback";
2148this._data = data;
2149this._service = service;
2150this.setTemplate(new beeJS.Template(29, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data.data; html.push("\n<div class=\"");html.push(css);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('block'));html.push("\">\n    <div class=\"");html.push(css);html.push("__info\">\n        <div>\n            ");let date = new Date(data.date.started).toLocaleString("ru", {day: 'numeric', month: 'numeric', year: 'numeric'});html.push("\n            <h3 class=\"");html.push(css);html.push("__title\">");html.push(((data.title.length > 37) ? data.title.substring(0, 37)+"..." : data.title ));html.push("</h3>\n            <h3 class=\"");html.push(css);html.push("__date\">");html.push(date);html.push("</h3>\n        </div>        \n        <div>\n            <div class=\"");html.push(css);html.push("__ritmolog\">\n                <div class=\"");html.push(css);html.push("__image\" style=\"background-image: url(");html.push(data.ritmolog.photo);html.push(");\"></div>\n                <div>\n                    <div class=\"");html.push(css);html.push("__name\">");html.push(data.ritmolog.name);html.push("</div>\n                    <div class=\"");html.push(css);html.push("__type\">");html.push(data.ritmolog.type);html.push("</div>\n                </div>\n            </div>\n        </div> \n    </div>\n    ");if(data.anketa) { html.push("\n        <div class=\"");html.push(css);html.push("__anketa\" id=\"");html.push(bindInfo.registerInBindInfo('anketa'));html.push("\" ");html.push(data.anketa.data);html.push("</div>\n    ");} html.push("\n</div>\n");return html.join('');}), {css: this._css, data: this._data});
2151}
2152_initContent() {
2153this._initFeedback();
2154}
2155async _initFeedback() {
2156let item = this._data.data;
2157console.log(item);
2158if(item.anketa) {
2159this._initAnketa();
2160} else {
2161let id = item.orderId;
2162if(item.id <= 620373) {
2163id = item.id;
2164}
2165this._viewModel.data.data.anketa = await this._service.getFeedback(id);
2166console.log(this._viewModel.data.data);
2167this.restart();
2168}
2169}
2170_initAnketa() {
2171let element = document.createElement("div");
2172let uuid = "c8398de4-7d15-4ccb-9b43-f9e6e34070e7";
2173let answers = {};
2174this._bind._anketa.innerHTML = "";
2175this._bind._anketa.append(element);
2176if(window.location.hostname === "irlem.practice.com") {
2177AnketaClient.serverAddress = "survey.rithm-time.com";
2178} else {
2179AnketaClient.serverAddress = "survey.edlm.ru";
2180}
2181for (var i in this._bind._anketa.dataset) {
2182answers[i] = this._bind._anketa.dataset[i];
2183}
2184AnketaClient.init(element, uuid, this._data.data.anketa.token, function(api) {
2185if (answers) {
2186for(var a in answers) {
2187api.setAnswerByAlias(a, answers[a]);
2188}
2189}
2190});
2191}
2192}
2193;Widget.__pN='user.consultations.ui.feedback';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.feedback'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.cancel')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("consultations.ui");
2194class Widget extends common.ui.widget.Widget {
2195constructor(data, service) {
2196super();
2197this._css = "user-consultations-cancel";
2198this._data = data;
2199this._service = service;
2200this.setTemplate(new beeJS.Template(30, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <p>Вы уверены что хотите отменить консультацию?</p>\n    <p>После отмены вы сможете выбрать другое свободное время для консультации</p>\n    <div>\n        <button type=\"button\" class=\"");html.push(css);html.push("__button\" id=\"");html.push(bindInfo.registerInBindInfo('action'));html.push("\">Отменить</button>\n    </div>\n</div>\n");return html.join('');}), {css: this._css, data: this._data});
2201}
2202_initControls() {
2203this._bind._action.onclick = (e) => {
2204this._service.cancelConsultation(this._data.data.id);
2205e.stopPropagation();
2206};
2207}
2208}
2209;Widget.__pN='user.consultations.ui.cancel';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.cancel'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.shell')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.consultations.ui");
2210class Widget extends common.ui.widget.Widget {
2211constructor(data, service) {
2212super();
2213this._css = "user-consultations-shell";
2214this._data = service.model.getValue("data");
2215this._service = service;
2216this._visibleForTab = {
2217'consultations': ['orders', 'events', 'materials', 'recomendations', 'current', 'faq'],
2218'history-consultations': ['history'],
2219'orders': ['orderhistory'],
2220'history-materials': ['materialhistory']
2221};
2222this._loadedTabs = {};
2223this.setTemplate(new beeJS.Template(31, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <h2 class=\"");html.push(css);html.push("__title\">\n        <span id=\"");html.push(bindInfo.registerInBindInfo('tab'));html.push("\" class=\"tab\" data-tab=\"consultations\">Мои консультации</span>\n        <span class=\"point\">•</span>\n        <span id=\"");html.push(bindInfo.registerInBindInfo('tab'));html.push("\" class=\"tab nonactive\" data-tab=\"history-consultations\">
2223История консультаций</span>\n        <span class=\"point\">•</span>\n        <span id=\"");html.push(bindInfo.registerInBindInfo('tab'));html.push("\" class=\"tab nonactive\" data-tab=\"orders\">Мои заказы</span>\n        <span class=\"point\">•</span>\n        <span id=\"");html.push(bindInfo.registerInBindInfo('tab'));html.push("\" class=\"tab nonactive\" data-tab=\"history-materials\">Мои материалы</span>\n    </h2>\n    <div class=\"");html.push(css);html.push("__content\" id=\"");html.push(bindInfo.registerInBindInfo('block'));html.push("\">\n        <div id=\"");html.push(bindInfo.registerInBindInfo('orders'));html.push("\">\n            <div class=\"");html.push(css);html.push("__loader\"></div>\n        </div>\n        <div id=\"");html.push(bindInfo.registerInBindInfo('events'));html.push("\">\n            <div class=\"");html.push(css);html.push("__loader\"></div>\n        </div>\n        <div id=\"");html.push(bindInfo.registerInBindInfo('materials'));html.push("\">\n            <div class=\"");html.push(css);html.push("__loader\"></div>\n        </div>\n        <div id=\"");html.push(bindInfo.registerInBindInfo('recomendations'));html.push("\">\n            <div class=\"");html.push(css);html.push("__loader\"></div>\n        </div>\n        <div id=\"");html.push(bindInfo.registerInBindInfo('current'));html.push("\">\n            <div class=\"");html.push(css);html.push("__loader\"></div>\n        </div>\n        <div id=\"");html.push(bindInfo.registerInBindInfo('history'));html.push("\">\n            <div class=\"");html.push(css);html.push("__loader\"></div>\n        </div>\n        <div id=\"");html.push(bindInfo.registerInBindInfo('orderhistory'));html.push("\">\n            <div class=\"");html.push(css);html.push("__loader\"></div>\n        </div>\n        <div id=\"");html.push(bindInfo.registerInBindInfo('materialhistory'));html.push("\">\n            <div class=\"");html.push(css);html.push("__loader\"></div>\n        </div>\n        <div id=\"");html.push(bindInfo.registerInBindInfo('faq'));html.push("\"></div>\n    </div>\n</div>\n");return html.join('');}), {
2224css: this._css,
2225data: this._data
2226});
2227}
2228_init() {
2229this._initControls();
2230this._initListeners();
2231const tabFromUrl = this._getTabFromUrl();
2232const validTabs = Object.keys(this._visibleForTab);
2233let activeTab = 'consultations';
2234if (tabFromUrl && validTabs.includes(tabFromUrl)) {
2235activeTab = tabFromUrl;
2236}
2237this._activateTab(activeTab);
2238if (!this._loadedTabs[activeTab]) {
2239this._loadedTabs[activeTab] = true;
2240this._service.loadData(activeTab);
2241}
2242this._initContent();
2243}
2244_initControls() {
2245const tabs = beeJS.ArrayUtil.asArray(this._bind._tab);
2246tabs.forEach(tab => {
2247tab.onclick = async (e) => {
2248e.stopPropagation();
2249const tabName = tab.dataset.tab;
2250if (!tabName || this._loadedTabs[tabName] && tab.classList.contains('active')) {
2251return;
2252}
2253this._activateTab(tabName);
2254this._setTabInUrl(tabName);
2255if (!this._loadedTabs[tabName]) {
2256this._loadedTabs[tabName] = true;
2257this._service.loadData(tabName);
2258}
2259};
2260});
2261}
2262_activateTab(tabName) {
2263const tabs = beeJS.ArrayUtil.asArray(this._bind._tab);
2264const allBlocks = Array.from(this._bind._block.children);
2265tabs.forEach(t => {
2266t.classList.remove('active');
2267t.classList.add('nonactive');
2268});
2269const currentTab = tabs.find(t => t.dataset.tab === tabName);
2270if (currentTab) {
2271currentTab.classList.remove('nonactive');
2272currentTab.classList.add('active');
2273}
2274allBlocks.forEach(b => b.style.display = 'none');
2275const visibleBlocks = this._visibleForTab[tabName] || [];
2276visibleBlocks.forEach(name => {
2277const block = this._bind['_' + name];
2278if (block) {
2279block.style.display = '';
2280}
2281});
2282}
2283_getTabFromUrl() {
2284const url = new URL(window.location.href);
2285return url.searchParams.get('tab');
2286}
2287_setTabInUrl(tabName) {
2288const url = new URL(window.location.href);
2289url.searchParams.set('tab', tabName);
2290window.history.replaceState({}, '', url.toString());
2291}
2292_initListeners() {
2293this._service.model.addHandler("orders", (value) => {
2294this._initRecommendationOrders(value);
2295});
2296this._service.model.addHandler("events", (value) => {
2297this._initEvents(value);
2298});
2299this._service.model.addHandler("materials", (value) => {
2300this._initMaterials(value);
2301});
2302this._service.model.addHandler("recomendations", (value) => {
2303this._initRecomendations(value);
2304});
2305this._service.model.addHandler("current", (value) => {
2306this._initCurrent(value);
2307});
2308this._service.model.addHandler("history", (value) => {
2309this._initHistory(value);
2310});
2311this._service.model.addHandler("orderhistory", (value) => {
2312this._initOrderHistory(value);
2313});
2314this._service.model.addHandler("materialhistory", (value) => {
2315this._initMaterialHistory(value);
2316});
2317this._service.slots.model.addHandler("message", (value) => {
2318this._service.loadCurrent();
2319this._service.modal.descruct();
2320});
2321}
2322_initContent() {
2323this._initFAQ();
2324}
2325_initRecommendationOrders(data) {
2326this._bind._orders.innerHTML = "";
2327if(data.length > 0) {
2328const div = document.createElement("div");
2329const widget = new ui.section.orders.Widget(data, this._service);
2330this._bind._orders.innerHTML = "";
2331this._bind._orders.appendChild(div);
2332widget.start(div);
2333}
2334}
2335_initEvents(data) {
2336this._bind._events.innerHTML = "";
2337if(data.length > 0) {
2338const div = document.createElement("div");
2339const widget = new ui.section.events.Widget({list: data}, this._service);
2340this._bind._events.appendChild(div);
2341widget.start(div); 
2342}
2343}
2344_initMaterials(data) {
2345this._bind._materials.innerHTML = "";
2346if(data.length > 0) {
2347const div = document.createElement("div");
2348const widget = new ui.section.materials.Widget({list: data}, this._service);
2349this._bind._materials.appendChild(div);
2350widget.start(div);
2351}
2352}
2353_initCurrent(data) {
2354this._bind._current.innerHTML = "";
2355if(data.length > 0) {
2356const div = document.createElement("div");
2357const widget = new ui.section.current.Widget({list: data}, this._service);
2358this._bind._current.appendChild(div);
2359widget.start(div); 
2360}
2361}
2362_initRecomendations(data) {
2363this._bind._recomendations.innerHTML = "";
2364if(data.length > 0) {
2365const div = document.createElement("div");
2366const widget = new ui.section.recomendations.block.Widget({list: data}, this._service);
2367this._bind._recomendations.appendChild(div);
2368widget.start(div); 
2369}
2370}
2371_initHistory(data) {
2372this._bind._history.innerHTML = "";
2373if(data.length > 0) {
2374const div = document.createElement("div");
2375const widget = new ui.section.history.block.Widget({list: data}, this._service);
2376this._bind._history.appendChild(div);
2377widget.start(div); 
2378}
2379}
2380_initOrderHistory(data) {
2381this._bind._orderhistory.innerHTML = "";
2382if(data) {
2383const div = document.createElement("div");
2384const widget = new ui.section.orderhistory.block.Widget(data, this._service);
2385this._bind._orderhistory.appendChild(div);
2386widget.start(div);
2387}
2388}
2389_initMaterialHistory(data) {
2390this._bind._materialhistory.innerHTML = "";
2391if(data) {
2392const widget = new ui.tabs.materials.shell.Widget(data, this._service);
2393this._initWidget(this._bind._materialhistory, widget);
2394}
2395}
2396_initFAQ() {
2397const div = document.createElement("div");
2398const widget = new ui.section.faq.Widget({}, this._service);
2399this._bind._faq.innerHTML = "";
2400this._bind._faq.appendChild(div);
2401widget.start(div); 
2402}
2403}
2404;Widget.__pN='user.consultations.ui.shell';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.shell'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.claim')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var SOAPayment = BeeJS.package("user").SOAPayment;var ui = BeeJS.package("user.consultations.ui");
2405class Widget extends common.ui.widget.Widget {
2406constructor(data, service) {
2407super();
2408this._css = "user-consultations-claim";
2409this._data = data;
2410this._service = service;
2411this.setTemplate(new beeJS.Template(32, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\"v id=\"");html.push(bindInfo.registerInBindInfo('block'));html.push("\">\n    <div id=\"");
2411html.push(bindInfo.registerInBindInfo('calendar'));html.push("\"></div>\n    <div id=\"");html.push(bindInfo.registerInBindInfo('slots'));html.push("\"></div>\n    <div class=\"");html.push(css);html.push("__message\">Время соответствует часовому поясу на вашем устройстве</div>\n    <div>\n        <button type=\"button\" class=\"");html.push(css);html.push("__button hidden\" id=\"");html.push(bindInfo.registerInBindInfo('action'));html.push("\">Назначить</button>\n    </div>\n</div>\n");return html.join('');}), {
2412css: this._css,
2413data: this._data
2414});
2415}
2416_isPreload() {
2417return true;
2418}
2419_preload() {
2420return this._service.loadData(this._data.data);
2421}
2422_initControls() {
2423this._bind._action.onclick = (e) => {
2424this._service.claimSlots();
2425e.stopPropagation();
2426};
2427}
2428_initListeners() {
2429this._service.model.addHandler("date", (value) => {
2430this._initSlots(value);
2431});
2432this._service.model.addHandler("formdata", (value) => {
2433this._initForm(value);
2434});
2435}
2436_initContent() {
2437if(Object.keys(this._service.getSlots()).length) {
2438this._initCalendar();
2439} else {
2440this._initMessage();
2441}
2442}
2443_initCalendar() {
2444const div = document.createElement("div");
2445let widget = new SOAPayment.ui.slots.calendar.Widget({}, this._service);
2446this._bind._calendar.innerHTML = "";
2447this._bind._calendar.appendChild(div);
2448widget.start(div); 
2449}
2450_initSlots(value) {
2451if(document.body.contains(this._bind._slots)) {
2452const div = document.createElement("div");
2453let widget = new SOAPayment.ui.slots.list.Widget(this._service.getSlots()[value], this._service);
2454this._bind._slots.innerHTML = "";
2455this._bind._slots.appendChild(div);
2456widget.start(div); 
2457}
2458}
2459_initMessage() {
2460if(document.body.contains(this._bind._block)) {
2461this._bind._block.innerHTML = "У консультанта запись по запросу";
2462this._bind._block.classList.add("block");
2463}
2464}
2465_initForm(value) {
2466this._bind._action.classList.remove("hidden");
2467}
2468}
2469;Widget.__pN='user.consultations.ui.claim';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.claim'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.tabs.materials.table')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.consultations.ui");
2470class Widget extends ui.section.default.Widget {
2471constructor(data, service) {
2472super();
2473this._css = "user-consultations-tabs-materials-table";
2474this._data = data;
2475this._service = service;
2476this.setTemplate(new beeJS.Template(33, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n\n<div class=\"");html.push(css);html.push("\">\n    <table class=\"");html.push(css);html.push("\">\n        <tbody>\n            ");for(let item of data) { html.push("\n                ");let condition = {available: item.ACTIVE === "Y",active: item.ACCESS_TYPE === "1"};condition.renew = item.IS_RENEW && !condition.available;condition.pdf = item.PDF && condition.active;let style = {available: (condition.available) ? 'available' : '',renew: (condition.renew) ? 'renew' : '',image: (item.RITMOLOG.PICTURE) ? 'style="background-image: url('+item.RITMOLOG.PICTURE+');"' : ""};let text = {link: (condition.active) ? "Пройти" : "Активировать",access: (new Date(item.DATE.END)).toLocaleString("ru", {"day": "numeric", "month": "long", hour: "numeric", minute: "numeric"}).replace(new RegExp(" ",'g'), "&nbsp;").replace(new RegExp("в&nbsp;",'g'), "")};html.push("\n                <tr data-id=\"");html.push(item.id);html.push("\">\n                    <td>\n                        ");if(condition.active) { html.push("\n                            <div class=\"");html.push(css);html.push("__access ");html.push(style.available);html.push(" ");html.push(style.renew);html.push("\">Доступ&nbsp;до&nbsp;");html.push(text.access);html.push("&nbsp;мск</div>\n                        ");} html.push("\n                    </td>\n                    <td>\n                        <div class=\"");html.push(css);html.push("__title\">\n                            <div>");html.push(item.SECTION);html.push("</div>\n                            <div>");html.push(item.NAME);html.push("</div>\n                        </div>\n                    </td>\n                    <td>\n                        <div class=\"");html.push(css);html.push("__ritmolog\">\n                            <div class=\"photo\" ");html.push(style.image);html.push("></div>\n                            <div class=\"name\">");html.push(item.RITMOLOG.NAME);html.push("</div>\n                        </div>\n                    </td>\n                    <td>\n                        <div class=\"");html.push(css);html.push("__action\">\n                            ");if(condition.available) { html.push("\n                                <a class=\"button\" href=\"/personal/materials?key=");html.push(item.KEY);html.push("\" target=\"_blank\">");html.push(text.link);html.push("</a>\n                            ");} html.push("\n                            \n                            ");if(condition.renew) { html.push("\n                                <button class=\"button\" type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('renew'));html.push("\" data-key=\"");html.push(item.KEY);html.push("\">Продлить</button>\n                            ");} html.push("\n                            \n                            ");if(condition.pdf) { html.push("\n                                <a class=\"link\" id=\"");html.push(bindInfo.registerInBindInfo('pdf'));html.push("\" data-pdf=\"");html.push(item.PDF);html.push("\" data-name=\"");html.push(item.NAME);html.push("\" target=\"_blank\">Скачать тетрадь</a>\n                            ");} html.push("\n                        </div>\n                    </td>\n                </tr>\n            ");} html.push("\n        </tbody>\n    </table>\n</div>\n");return html.join('');}), {
2477css: this._css,
2478data: this._data
2479});
2480}
2481_initControls() {
2482this.onClick(this._bind._renew, async (item) => {
2483const key = item.dataset.key;
2484item.disabled = true;
2485if(key) {
2486const products = await this._service.getRenewProductsByKey(key);
2487this._initModal(products, key);
2488item.disabled = false;
2489}
2490});
2491this.forEach(this._bind._pdf, async (item) => {
2492item.href = this._service.materials.getLinkToPDF({file: item.dataset.pdf}, item.dataset.name);
2493});
2494}
2495_initModal(products, key) {
2496const modal = this._service.modal.build();
2497const data = {
2498id: modal.id
2499};
2500data.title = "Продление доступа";
2501data.widget = new ui.renewProduct.Widget({
2502modal: modal.id,
2503key: key,
2504data: products,
2505}, this._service);
2506this._initWidget(modal, new ui.modal.Widget(data, this._service.modal));
2507}
2508}
2509;Widget.__pN='user.consultations.ui.tabs.materials.table';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.tabs.materials.table'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.tabs.materials.shell')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var user = BeeJS.package("user");var ui = BeeJS.package("user.consultations.ui");
2510class Widget extends ui.section.default.Widget {
2511constructor(data, service) {
2512super();
2513this._css = "user-consultations-tabs-materials-shell";
2514this._data = data;
2515this._service = service;
2516this.setTemplate(new beeJS.Template(34, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n\n<div class=\"");html.push(css);html.push("\">\n    <div id=\"");html.push(bindInfo.registerInBindInfo('table'));html.push("\"></div>\n    <div class=\"");html.push(css);html.push("__pager\" id=\"");html.push(bindInfo.registerInBindInfo('pager'));html.push("\">\n        <button id=\"");html.push(bindInfo.registerInBindInfo('prev'));html.push("\"></button>\n        <div id=\"");html.push(bindInfo.registerInBindInfo('count'));html.push("\">1</div>\n        <button id=\"");html.push(bindInfo.registerInBindInfo('next'));html.push("\"></button>\n        <div>из</div>\n        <div id=\"");html.push(bindInfo.registerInBindInfo('total'));html.push("\">");html.push(data.total);html.push("</div>\n    </div>\n</div>\n");return html.join('');}), {
2517css: this._css,
2518data: this._data
2519});
2520}
2521_initControls() {
2522this.onClick(this._bind._prev, (e) => {
2523this._initPage(-1);
2524});
2525this.onClick(this._bind._next, (e) => {
2526this._initPage(1);
2527});
2528}
2529_initContent() {
2530this._initPage(0);
2531}
2532_initPage(mod) {
2533let value = this._bind._count.innerText - 0 + mod;
2534let container = this._bind._table;
2535let widget = {};
2536if(this._data.total) {
2537widget = new ui.tabs.materials.table.Widget(this._data.pages[value-1], this._service);
2538} else {
2539widget = new user.empty.ui.shell.Widget({}, this._service);
2540this._bind._pager.innerHTML = "";
2541}
2542container.innerHTML = '';
2543this._initWidget(container, widget);
2544this._initPager(value);
2545}
2546_initPager(value) {
2547const max = this._data.total ?? 1;
2548const prev = this._bind._prev;
2549const next = this._bind._next;
2550const count = this._bind._count;
2551count.innerText = value;
2552prev.classList.toggle("disabled", value === 1);
2553prev.disabled = (value === 1);
2554next.classList.toggle("disabled", value === max);
2555next.disabled = (value === max);
2556}
2557}
2558;Widget.__pN='user.consultations.ui.tabs.materials.shell';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.tabs.materials.shell'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.consultations.ui.modal')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");
2559class Widget extends common.ui.modal.Widget {
2560constructor(data, service) {
2561super();
2562this._css = "user-consultation-modal";
2563this._data = data;
2564this._service = service;
2565this.setTemplate(new beeJS.Template(35, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('block'));html.push("\">\n    <div class=\"");html.push(css);html.push("__body\" id=\"");html.push(bindInfo.registerInBindInfo('body'));html.push("\">\n        <div class=\"");html.push(css);html.push("__header\">\n            <h2 class=\"");html.push(css);html.push("__title\">");html.push(data.title);html.push("</h2>\n            <button class=\"");html.push(css);html.push("__close\" id=\"");html.push(bindInfo.registerInBindInfo('close'));html.push("\"></button>\n        </div>\n        <div class=\"");html.push(css);html.push("__content\" id=\"");html.push(bindInfo.registerInBindInfo('content'));html.push("\" data-footer=\"");html.push(data.footer);html.push("\"></div>\n        <div class=\"");html.push(css);html.push("__footer\" data-footer=\"");html.push(data.footer);html.push("\">\n            <button class=\"");html.push(css);html.push("__button\" data-footer=\"");html.push(data.footer);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('close'));html.push("\">Закрыть</button>\n        </div>\n    </div>\n</div>\n");return html.join('');}), {css: this._css, data: this._data});
2566}
2567}
2568;Widget.__pN='user.consultations.ui.modal';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.ui.modal'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Model' in BeeJS.package('user.consultations.model')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");
2569class Model extends common.model.Model {
2570constructor() {
2571super();
2572this.values = {};
2573this.handlers = {};
2574this.config = {}
2575}
2576setRecommendationOrders(json) {
2577let result = [];
2578for(let i in json['RECOMMENDATION_ORDERS']) {
2579let item = json['RECOMMENDATION_ORDERS'][i];
2580result.push({
2581id: item["ORDER_ID"],
2582title: item["PRODUCT_NAME"],
2583price: parseInt(item["BASKET_PRICE"]),
2584payment: {
2585link: item["PAYMENT_LINK"]
2586},
2587ritmolog: {
2588id: item["RITMOLOG_ID"],
2589name: item["RITMOLOG_NAME"],
2590photo: item["RITMOLOG_PHOTO"],
2591link: item["RITMOLOG_LINK"],
2592contact: {
2593phone: item["RITMOLOG_PHONE"],
2594email: item["RITMOLOG_EMAIL"],
2595telegram: item["RITMOLOG_TELEGRAM"],
2596max: item["RITMOLOG_MAX"]
2597}
2598},
2599})
2600};
2601this.setValue("orders", result, true);
2602}
2603setEvents(data) {
2604let result = [];
2605for(let key in data) {
2606let item = data[key];
2607let value = {
2608accessKey: key,
2609title: this._clipping(item["EVENT"]["NAME"]),
2610date: {
2611started: item["DATE_START"],
2612ended: item["DATE_FINISH"],
2613},
2614orderId: item["ORDER"]["ID"],
2615ritmolog: {
2616name: (item["RITMOLOG"]) ? item["RITMOLOG"]["NAME"] : "",
2617photo: (item["RITMOLOG"]) ? item["RITMOLOG"]["IMAGE"] : "",
2618link: (item["RITMOLOG"]) ? "/catalog/consultation/ritmolog/?ID="+item["RITMOLOG"]["ID"] : "",
2619},
2620isRenew: item['IS_RENEW']
2621};
2622result.push(value);
2623}
2624this.setValue("events", result, true);
2625}
2626setMaterials(json) {
2627let result = [];
2628for(let i in json["ACTIVE_MATERIALS"]) {
2629let item = json["ACTIVE_MATERIALS"][i];
2630let value = {
2631active: (item["ACCESS_TYPE"] === "1"),
2632id: item["ID"],
2633title: this._clipping(item["NAME"]),
2634date: {
2635started: item["SUB_START_DATE"],
2636ended: item["SUB_FINISH_DATE"],
2637},
2638ritmolog: {
2639name: (item["RITMOLOG"]) ? item["RITMOLOG"]["NAME"] : "",
2640type: item["MAIN_SECTION"],
2641photo: (item["RITMOLOG"]) ? item["RITMOLOG"]["PICTURE"] : "",
2642link: (item["RITMOLOG"]) ? "/catalog/consultation/ritmolog/?ID="+item["RITMOLOG"]["ID"] : "",
2643},
2644order: {
2645id: item["ID"]
2646},
2647isRenew: item['IS_RENEW']
2648};
2649if (!item.old) {
2650value.accessKey = i;
2651}
2652result.push(value);
2653};
2654this.setValue("materials", result, true);
2655}
2656setRecomendations(json) {
2657let result = [];
2658for(let i in json) {
2659let item = json[i];
2660let materials = [];
2661if(item["ACTIVE_MATERIALS"]) {
2662for(let j in item["ACTIVE_MATERIALS"]) {
2663let i = item["ACTIVE_MATERIALS"][j];
2664materials.push({
2665id: i["ID"],
2666name: i["NAME"],
2667link: "/online_education/user/index2.php?order_id="+i["ID"]
2668});
2669};
2670};
2671result.push({
2672id: item["id"],
2673title: this._clipping(item["title"]),
2674orderId: item["orderId"],
2675date: {
2676started: item["date"],
2677next: item["nextConsultationDate"],
2678},
2679ritmolog: {
2680name: item["ritmolog"]["name"],
2681type: item["ritmolog"]["direction"],
2682photo: item["ritmolog"]["picture"],
2683link: "/catalog/consultation/ritmolog/?ID="+item["ritmolog"]["id"],
2684},
2685recomendation: item["recommendation"]["TEXT"],
2686materials: materials
2687});
2688};
2689this.setValue("recomendations", result, true);
2690}
2691setCurrent(json) {
2692let result = [];
2693for(let i in json["CONSULTATIONS"]) {
2694let item = json["CONSULTATIONS"][i];
2695let consultations = item["ITEMS"][item["ORDER"]["ID"]];
2696let consultation = {};
2697if(consultations) {
2698consultation = {
2699id: consultations[consultations.length - 1]["CONSULTATION_ID"]
2700}
2701}
2702result.push({
2703id: item["ORDER"]["ID"],
2704title: this._clipping(item["ORDER"]["NAME"]),
2705date: {
2706started: item["ORDER"]["DATE"],
2707planed: item["ORDER"]["NEAREST_CONSULTATION"]
2708},
2709ritmolog: {
2710id: item["RITMOLOG"]["ID"],
2711uid: item["RITMOLOG"]["USER_ID"],
2712name: item["RITMOLOG"]["NAME"],
2713type: item["ORDER"]["MAIN_SECTION"],
2714photo: item["RITMOLOG"]["PICTURE"],
2715link: "/catalog/consultation/ritmolog/?ID="+item["RITMOLOG"]["ID"],
2716contact: {
2717phone: item["RITMOLOG"]["PHONE_VALUE"],
2718email: item["RITMOLOG"]["RITMOLOG_EMAIL"],
2719whatsapp: item["RITMOLOG"]["WHATSAPP_VALUE"],
2720telegram: item["RITMOLOG"]["RITMOLOG_TELEGRAM"],
2721max: item["RITMOLOG"]["RITMOLOG_MAX"]
2722}
2723},
2724progress: {
2725done: item["ORDER"]["ORDER_HOURS_DONE"],
2726planed: item["ORDER"]["ORDER_HOURS_PLANED"],
2727total: item["ORDER"]["ORDER_HOURS_TOTAL"],
2728item: item["ORDER"]["ORDER_HOURS_ITEM"]
2729},
2730order: {
2731id: item["ORDER"]["ID"]
2732},
2733status: item["ORDER"]["STATUS_PLANED_CONSULTATION"],
2734consultation: consultation
2735})
2736};
2737result.sort((a, b) => new Date(b.date.started) - new Date(a.date.started));
2738this.setValue("current", result, true);
2739}
2740setHistory(json) {
2741let result = [];
2742for(let i in json["CONSULTATIONS_HISTORY"]) {
2743let item = json["CONSULTATIONS_HISTORY"][i];
2744let materials = [];
2745if(item["ACTIVE_MATERIALS"]) {
2746for(let j in item["ACTIVE_MATERIALS"]) {
2747let i = item["ACTIVE_MATERIALS"][j];
2748materials.push({
2749id: i["ID"],
2750name: i["NAME"],
2751link: "/online_education/user/index2.php?order_id="+i["ID"]
2752});
2753};
2754};
2755result.push({
2756id: item["ORDER"]["ID"],
2757orderId: item["ORDER"]["ORDER_ID"],
2758title: this._clipping(item["ORDER"]["NAME"]),
2759date: {
2760started: item["ORDER"]["DATE"]
2761},
2762ritmolog: {
2763name: item["RITMOLOG"]["NAME"],
2764type: item["ORDER"]["MAIN_SECTION"],
2765photo: item["RITMOLOG"]["PICTURE"],
2766link: "/catalog/consultation/ritmolog/?ID="+item["RITMOLOG"]["ID"]
2767},
2768order: {
2769id: item["ORDER"]["ID"]
2770},
2771progress: {
2772total: item["ORDER"]["ORDER_HOURS_TOTAL"]
2773},
2774recomendation: (item["ORDER"]["RECOMMENDATION"]) ? item["ORDER"]["RECOMMENDATION"]["TEXT"] : false,
2775anketa: item["ANSWERS"],
2776materials: materials
2777})
2778};
2779result.sort((a, b) => new Date(b.date.started) - new Date(a.date.started));
2780this.setValue("history", result, true);
2781}
2782setOrderHistory(json) {
2783this.setValue("orderhistory", json, true);
2784}
2785setMaterialHistory(json) {
2786let data = json.sort((a, b) => new Date(b.DATE.END).valueOf() - new Date(a.DATE.END).valueOf());
2787let result = {
2788pages: [],
2789total: Math.ceil(json.length / 10),
2790};
2791let page = [];
2792for(let i in data) {
2793if(i % 10 === 0) {
2794page = [];
2795result.pages.push(page);
2796}
2797page.push(data[i]);
2798}
2799this.setValue("materialhistory", result, true);
2800}
2801_clipping(name) {
2802const delimiters = [' (', '. '];
2803delimiters.forEach(delimiter => {
2804const pos = name.lastIndexOf(delimiter);
2805if (pos !== -1) {
2806name = name.substring(0, pos);
2807}
2808});
2809return name;
2810}
2811}
2812;Model.__pN='user.consultations.model';return Model;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.model'),'Model',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Slots' in BeeJS.package('user.consultations.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var user = BeeJS.package("user");var common = BeeJS.package("user.common");var SOAPayment = BeeJS.package("user").SOAPayment;
2813class Slots extends common.service.Service {
2814constructor(model) {
2815super();
2816this.config = {};
2817this.model = (model) ? model : new SOAPayment.model.Model();
2818}
2819async loadData(param) {
2820this.model.setValue("data", param);
2821await this.loadSlots();
2822}
2823async loadSlots() {
2824let id = this.model.getValue("data").ritmolog;
2825let count = this.model.getValue("data").hours / 0.5;
2826const json = await BX.ajax.runComponentAction('integramma.slots:client.ritmolog.list', 'getRitmologSlotsGroups', {mode:'class', data:{'ritmolog_id': id, 'slots_count': count, timeStart: Date.now()}});
2827this.model.setSlots(json.data);
2828}
2829async claimSlots() {
2830let id = this.model.getValue("data").order;
2831let formdata = this.model.getValue("formdata")["SLOTS"];
2832await BX.ajax.runComponentAction('integramma.slots:ritmolog.slots.list', 'claimSlots', {mode: 'class', data:{
2833slots: formdata,
2834orderId: id
2835}});
2836this.model.setValue("message", "success", true);
2837}
2838async cancelConsultation(id) {
2839await BX.ajax.runComponentAction('integramma.slots:ritmolog.slots.list', 'freeSlotsByConsultationId', {mode:'class', data:{'id': id}});
2840this.model.setValue("message", "cancel", true);
2841}
2842getSlot(id) {
2843return {consultation: {id: id}};
2844}
2845getSlots() {
2846return this.model.getValue("slots");
2847}
2848setFormData(id, value) {
2849let data = this.model.getValue("formdata");
2850data = (data) ? data : {};
2851data[id] = value;
2852this.model.setValue("formdata", data, true);
2853}
2854closeForm() {
2855window.parent.location.href = "/order-list/private_consulting/report/ritmolog_table_full.php";
2856}
2857}
2858;Slots.__pN='user.consultations.service';return Slots;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.service'),'Slots',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Service' in BeeJS.package('user.consultations.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var consultations = BeeJS.package("user.consultations");var materials = BeeJS.package("materials");
2859class Service extends common.service.Service {
2860constructor(model) {
2861super();
2862this.config = {};
2863this.model = (model) ? model : new consultations.model.Model();
2864this.modal = new common.service.Modal();
2865this.popup = new common.service.Popup();
2866this.slots = new consultations.service.Slots();
2867this.materials = new materials.service.Service();
2868}
2869async loadData(tabName) {
2870switch (tabName) {
2871case "consultations":
2872this.loadRecommendationOrders();
2873this.loadEvents();
2874this.loadMaterials();
2875this.loadCurrent();
2876this.loadRecomendations();
2877break;
2878case "history-consultations":
2879this.loadHistory();
2880break;
2881case "orders":
2882this.loadOrderHistory();
2883break;
2884case "history-materials":
2885this.loadMaterialsHistory();
2886break;
2887}
2888}
2889async loadRecommendationOrders() {
2890const json = await BX.ajax.runComponentAction('integramma:personal.order.list', 'getRecommendationOrders', {mode:'class'});
2891this.model.setRecommendationOrders(json.data);
2892}
2893async loadEvents() {
2894const response = await BX.ajax.runAction('integramma:materials.Event.getActiveEvents', {});
2895this.model.setEvents(response.data);
2896}
2897async loadMaterials() {
2898const [json, json2] = await Promise.all([
2899BX.ajax.runComponentAction('integramma:personal.order.list', 'getActiveMaterials', {mode:'class'}),
2900BX.ajax.runComponentAction('integramma:personal.order.list', 'getActiveMaterialsOld', {mode:'class'})
2901]);
2902for(let i in json2.data["ACTIVE_MATERIALS"]) {
2903json2.data["ACTIVE_MATERIALS"][i].old = true;
2904if (!("ACTIVE_MATERIALS" in json.data)) {
2905json.data["ACTIVE_MATERIALS"] = {};
2906}
2907json.data["ACTIVE_MATERIALS"][i] = json2.data["ACTIVE_MATERIALS"][i];
2908}
2909this.model.setMaterials(json.data);
2910}
2911async loadRecomendations() {
2912const json = await BX.ajax.runComponentAction('integramma:personal.order.list', 'getRecommendations', {mode:'class'});
2913this.model.setRecomendations(json.data);
2914}
2915async loadCurrent() {
2916const json = await BX.ajax.runComponentAction('integramma:personal.order.list', 'getActiveConsultations', {mode:'class'});
2917this.model.setCurrent(json.data);
2918}
2919async loadHistory() {
2920const json = await BX.ajax.runComponentAction('integramma:personal.order.list', 'getConsultationsHistory', {mode:'class'});
2921this.model.setHistory(json.data);
2922}
2923async loadOrderHistory(page, status) {
2924try {
2925const response = await BX.ajax.runAction('integramma:orderhistory.OrderHistory.Controller.getOrders',
2926{
2927getParameters: {
2928page: page ?? null,
2929status: status ?? null
2930},
2931method: "GET"
2932}
2933)
2934response.data.filter = {
2935status: status ?? null
2936};
2937this.model.setOrderHistory(response.data);
2938} catch (errorResponse) {
2939console.error('Ошибка загрузки истории заказов: ', errorResponse.errors[0].message);
2940this.model.setOrderHistory({
2941error: errorResponse.errors[0].message
2942});
2943}
2944}
2945async loadMaterialsHistory() {
2946const json = await BX.ajax.runComponentAction('integramma:personal.order.list', 'getMaterials', {mode:'class'});
2947await this.materials._loadAnketaToken();
2948this.model.setMaterialHistory(json.data);
2949}
2950async cancelOrder(id) {
2951const json = await BX.ajax.runAction('integramma:orderhistory.OrderHistory.Controller.cancelOrder',
2952{
2953data: {
2954orderId: id
2955}
2956}
2957);
2958return json.data;
2959}
2960async getFeedback(id) {
2961const json = await BX.ajax.runComponentAction('integramma:personal.order.list', 'getAnketa', {mode: 'class', data: {orderId: id}});
2962return json.data;
2963}
2964async getRenewProductsByKey(key) {
2965const json = await BX.ajax.runAction('integramma:renewproduct.RenewProduct.Controller.getByKey',
2966{
2967getParameters: {
2968accessKey: key
2969},
2970method: "GET"
2971}
2972);
2973return json.data;
2974}
2975async getEventTicketByOrderId(orderId) {
2976const response = await BX.ajax.runAction('integramma:materials.Event.getTicket', {
2977data: { orderId },
2978});
2979return response.data;
2980}
2981}
2982;Service.__pN='user.consultations.service';return Service;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.service'),'Service',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Init' in BeeJS.package('user.consultations.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.consultations.ui");var model = BeeJS.package("user.consultations.model");var service = BeeJS.package("user.consultations.service");
2983class Init {
2984constructor(element, data) {
2985this.model = new model.Model();
2986this.model.setValue("data", data);
2987this.service = new service.Service(this.model);
2988this.widget = new ui.shell.Widget({}, this.service);
2989this.widget.start(element);
2990}
2991}
2992;Init.__pN='user.consultations.service';return Init;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.consultations.service'),'Init',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.common.ui.error')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");
2993class Widget extends beeJS.widget.Widget {
2994constructor(data, service) {
2995super();
2996this._css = "common-error";
2997this._data = data;
2998this._service = service;
2999this.setTemplate(new beeJS.Template(36, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let text = model.data.text; html.push("\n<div class=\"");html.push(css);html.push("\">\n    ");html.push(text);html.push("\n</div>\n");return html.join('');}), {css: this._css, data: this._data});
3000}
3001}
3002;Widget.__pN='user.common.ui.error';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.common.ui.error'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.common.ui.widget')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");
3003class Widget extends beeJS.widget.Widget {
3004constructor(data, service) {
3005super();
3006this._css = "common-widget";
3007this._data = data;
3008this._service = service;
3009this.setTemplate(new beeJS.Template(37, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n<div class=\"");html.push(css);html.push("\">\n</div>\n");return html.join('');}), {css: this._css});
3010}
3011_init() {
3012this._initListeners();
3013this._initControls();
3014this._initContent();
3015}
3016_initListeners() {
3017}
3018_initControls() {
3019}
3020_initContent() {
3021}
3022_initWidget(parent, widget) {
3023const div = document.createElement("div");
3024parent.innerHTML = "";
3025parent.appendChild(div);
3026widget.start(div);
3027}
3028onClick(bind, action) {
3029beeJS.ArrayUtil.asArray(bind).forEach((item, i) => {
3030item.onclick = (e) => {
3031action(item, i);
3032};
3033});
3034}
3035onInput(bind, action) {
3036beeJS.ArrayUtil.asArray(bind).forEach((item, i) => {
3037item.oninput = (e) => {
3038action(item, i);
3039};
3040});
3041}
3042onKeyup(bind, action) {
3043beeJS.ArrayUtil.asArray(bind).forEach((item, i) => {
3044item.onkeyup = (e) => {
3045action(item, i, e);
3046};
3047});
3048}
3049forEach(bind, action) {
3050beeJS.ArrayUtil.asArray(bind).forEach((item, i) => {
3051action(item, i);
3052});
3053}
3054}
3055;Widget.__pN='user.common.ui.widget';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.common.ui.widget'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.common.ui.popup')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("common");
3056class Widget extends common.ui.widget.Widget {
3057constructor(data, service) {
3058super();
3059this._css = "common-popup";
3060this._data = data;
3061this._service = service;
3062this.setTemplate(new beeJS.Template(38, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('block'));html.push("\" style=\"top:");html.push(data.coord.y);html.push("px;left:");html.push(data.coord.x);html.push("px\">\n    <div class=\"");html.push(css);html.push("__body\" id=\"");html.push(bindInfo.registerInBindInfo('body'));html.push("\">\n        <div class=\"");html.push(css);html.push("__content\" id=\"");html.push(bindInfo.registerInBindInfo('content'));html.push("\"></div>\n        <div class=\"");html.push(css);html.push("__aside\">\n            <button class=\"");html.push(css);html.push("__close\" id=\"");html.push(bindInfo.registerInBindInfo('close'));html.push("\">&times;</button>\n        </div>\n    </div>\n</div>\n");return html.join('');}), {css: this._css, data: this._data});
3063}
3064_initControls() {
3065this._bind._block.onclick = () => {
3066this._service.descruct(this._data.id);
3067};
3068this._bind._body.onclick = (e) => {
3069e.stopPropagation();
3070};
3071this._bind._closes = beeJS.ArrayUtil.asArray(this._bind._close);
3072this._bind._closes.forEach((item, i) => {
3073item.onclick = () => {
3074this._service.descruct(this._data.id);
3075};
3076});
3077}
3078_initContent() {
3079const div = document.createElement("div");
3080this._bind._content.appendChild(div);
3081if(this._data.widget) {
3082this._data.widget.start(div); 
3083} else if(this._data.html) {
3084div.appendChild(this._data.html); 
3085} 
3086}
3087}
3088;Widget.__pN='user.common.ui.popup';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.common.ui.popup'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.common.ui.modal')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");
3089class Widget extends common.ui.widget.Widget {
3090constructor(data, service) {
3091super();
3092this._css = "common-modal";
3093this._data = data;
3094this._service = service;
3095this.setTemplate(new beeJS.Template(39, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('block'));html.push("\">\n    <div class=\"");html.push(css);html.push("__body\" id=\"");html.push(bindInfo.registerInBindInfo('body'));html.push("\">\n        <div class=\"");html.push(css);html.push("__header\">\n            <h2 class=\"");html.push(css);html.push("__title\">");html.push(data.title);html.push("</h2>\n            <button class=\"");html.push(css);html.push("__close\" id=\"");html.push(bindInfo.registerInBindInfo('close'));html.push("\"></button>\n        </div>\n        <div class=\"");html.push(css);html.push("__content\" id=\"");html.push(bindInfo.registerInBindInfo('content'));html.push("\"></div>\n        <div class=\"");html.push(css);html.push("__footer\">\n            <button class=\"");html.push(css);html.push("__button\" id=\"");html.push(bindInfo.registerInBindInfo('close'));html.push("\">Закрыть</button>\n        </div>\n    </div>\n</div>\n");return html.join('');}), {css: this._css, data: this._data});
3096}
3097_initControls() {
3098this._bind._block.onclick = () => {
3099this._service.descruct(this._data.id);
3100};
3101this._bind._body.onclick = (e) => {
3102e.stopPropagation();
3103};
3104this._bind._closes = beeJS.ArrayUtil.asArray(this._bind._close);
3105this._bind._closes.forEach((item, i) => {
3106item.onclick = () => {
3107this._service.descruct(this._data.id);
3108};
3109});
3110}
3111_initContent() {
3112const div = document.createElement("div");
3113this._bind._content.appendChild(div);
3114if(this._data.widget) {
3115this._data.widget.start(div); 
3116} 
3117}
3118descruct() {
3119if(this._data.modal) {
3120this._service.descruct(this._data.modal);
3121}
3122}
3123}
3124;Widget.__pN='user.common.ui.modal';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.common.ui.modal'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Model' in BeeJS.package('user.common.model')))(function(){var f=function(){var Model = function() {
3125this.values = {};
3126this.handlers = {};
3127};
3128Model.prototype._initHandler = function(name, fireEvents) {
3129if(this.handlers[name]) {
3130for(var i in this.handlers[name]) {
3131if(fireEvents) {
3132this.handlers[name][i].action(this.values[name]);
3133} else if (this.handlers[name][i].fireEvents) {
3134this.handlers[name][i].action(this.values[name]);
3135};
3136};
3137};
3138};
3139Model.prototype.getValue = function(name) {
3140return this.values[name];
3141};
3142Model.prototype.setValue = function(name, value, fireEvents) {
3143this.values[name] = value;
3144this._initHandler(name, fireEvents);
3145};
3146Model.prototype.addHandler = function(name, action, fireEvents) {
3147var handler = {
3148fireEvents: (fireEvents) ? true : false,
3149action: action
3150};
3151if(!this.handlers[name]) {
3152this.handlers[name] = [];
3153};
3154this.handlers[name].push(handler);
3155};
3156Model.prototype.removeHandler = function(name, action) {
3157if(this.handlers[name]) {
3158for(var i in this.handlers[name]) {
3159if(JSON.stringify(this.handlers[name][i].handler) === JSON.stringify(action)) {
3160this.handlers[name].splice(i, 1);
3161};
3162};
3163};
3164};
3165Model.prototype.clearHandler = function(name) {
3166this.handlers[name] = [];
3167};
3168;Model.__pN='user.common.model';return Model;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.common.model'),'Model',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Popup' in BeeJS.package('user.common.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var model = BeeJS.package("calendar.model");
3169class Popup {
3170constructor() {
3171}
3172build() {
3173this.descruct();
3174const div = document.createElement("div");
3175div.id = "popup"+Math.floor(Math.random()*1000000);
3176div.classList.add("popup");
3177document.body.appendChild(div);
3178document.body.onclick = () => {
3179this.descruct(div.id);
3180};
3181return div;
3182}
3183descruct() {
3184if(document.getElementsByClassName("popup")[0]) {
3185document.body.removeChild(document.getElementsByClassName("popup")[0]);
3186}
3187}
3188}
3189;Popup.__pN='user.common.service';return Popup;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.common.service'),'Popup',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Service' in BeeJS.package('user.common.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");
3190class Service {
3191constructor(model) {
3192this.config = {};
3193this.model = (model) ? model : new common.model.Model();
3194}
3195initError(e) {
3196let result = "<p>Ошибка!</p><ul>";
3197for(let error of e.errors) {
3198result += `<li>${error.message}</li>`;
3199}
3200result += "</ul>";
3201this.model.setValue("error", result, true);
3202}
3203closeModal(id) {
3204this.model.setValue("closeModal", id, true);
3205}
3206}
3207;Service.__pN='user.common.service';return Service;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.common.service'),'Service',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Modal' in BeeJS.package('user.common.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var model = BeeJS.package("calendar.model");
3208class Modal {
3209constructor() {
3210}
3211build() {
3212const div = document.createElement("div");
3213div.id = "modal"+Math.floor(Math.random()*1000000);
3214div.classList.add("ip-user-modal");
3215document.body.appendChild(div);
3216document.body.style.overflow = "hidden";
3217return div;
3218}
3219descruct(id) {
3220if(id) {
3221document.body.removeChild(document.getElementById(id));
3222} else {
3223let c = document.getElementsByClassName("ip-user-modal");
3224for(let i=0; i<c.length; i++) {
3225document.body.removeChild(c[i]);
3226};
3227}
3228if(!document.getElementsByClassName("ip-user-modal")[0]) {
3229document.body.style.overflow = "auto";
3230}
3231if(document.getElementsByClassName("ip-user-popup")[0]) {
3232document.body.removeChild(document.getElementsByClassName("ip-user-popup")[0]);
3233}
3234}
3235}
3236;Modal.__pN='user.common.service';return Modal;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.common.service'),'Modal',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.SOAPayment.ui.slots.calendar')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.SOAPayment.ui");
3237class Widget extends common.ui.widget.Widget {
3238constructor(data, service) {
3239super();
3240this._css = "user-soa-slots-calendar";
3241this._data = data;
3242this._service = service;
3243this.setTemplate(new beeJS.Template(40, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n");let week = ["Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"]; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__header\">\n        <h4 class=\"");html.push(css);html.push("__title\">");html.push(data.title);html.push("</h4>\n        <button type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('prev'));html.push("\"></button>\n        <button type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('next'));html.push("\"></button>\n    </div>\n    <table class=\"");html.push(css);html.push("__table\">\n        <tr class=\"");html.push(css);html.push("__row ");html.push(css);html.push("__row_header\">\n            ");for(let day of week) { html.push("\n                <td class=\"");html.push(css);html.push("__cell\">");html.push(day);html.push("</td>\n            ");} html.push("\n        </tr>\n        ");for(let week of data.month) { html.push("\n            <tr class=\"");html.push(css);html.push("__row\">\n                ");for(let day of week) { html.push("\n                    <td class=\"");html.push(css);html.push("__cell\">\n                        ");let obj = data.slots[day.date]; html.push("\n                        ");if(obj) { html.push("\n                            ");let status = (data.date === day.date) ? "active" : ""; html.push("\n                            <button type=\"button\" class=\"");html.push(status);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('button'));html.push("\" data-date=\"");html.push(day.date);html.push("\">");html.push(day.id);html.push("</button>\n                        ");} else { html.push("\n                            <div>");html.push(day.id);html.push("</div>\n                        ");} html.push("\n                    </td>\n                ");} html.push("\n            </tr>\n        ");} html.push("\n    </table>\n</div>\n");return html.join('');}), {
3244css: this._css,
3245data: {
3246slots: this._service.getSlots(),
3247date: this._service.model.getValue("date"),
3248title: this._getTitle(),
3249month: this._getMonth()
3250},
3251});
3252}
3253_initControls() {
3254this._bind._prev.onclick = () => {
3255this._modifier--;
3256this._viewModel.data.title = this._getTitle();
3257this._viewModel.data.month = this._getMonth();
3258this.restart();
3259};
3260this._bind._next.onclick = () => {
3261this._modifier++;
3262this._viewModel.data.title = this._getTitle();
3263this._viewModel.data.month = this._getMonth();
3264this.restart();
3265};
3266this._bind._buttons = beeJS.ArrayUtil.asArray(this._bind._button);
3267this._bind._buttons.forEach((item, i) => {
3268item.onclick = (e) => {
3269this._service.model.setValue("date", item.dataset.date, true);
3270this._viewModel.data.date = item.dataset.date;
3271this.restart();
3272};
3273if(item.classList.contains("active")) {
3274this._service.model.setValue("date", item.dataset.date, true);
3275}
3276}
3276);
3277}
3278_getTitle() {
3279let date = new Date();
3280let y = date.getFullYear();
3281let m = date.getMonth();
3282let d = 1;
3283this._modifier = (this._modifier) ? this._modifier : 0;
3284m += this._modifier;
3285let header = (new Date(y, m, d)).toLocaleString("ru", {year: 'numeric', month: 'long'});
3286header = (header[0].toUpperCase() + header.slice(1)).split("г.")[0];
3287return header;
3288}
3289_getMonth() {
3290let date = new Date();
3291let m = date.getMonth();
3292let y = date.getFullYear();
3293let d = date.getDate();
3294this._modifier = this._modifier || 0;
3295m += this._modifier;
3296y += Math.floor(m / 12);
3297m = (m % 12 + 12) % 12;
3298let firstDayOfMonth = new Date(y, m, 1).getDay();
3299firstDayOfMonth = (firstDayOfMonth + 6) % 7;
3300let lastDateOfMonth = new Date(y, m + 1, 0).getDate();
3301let lastDayOfLastMonth = m === 0 ? new Date(y - 1, 11, 0).getDate() : new Date(y, m, 0).getDate();
3302let count = 1;
3303let before = lastDayOfLastMonth - firstDayOfMonth + 1;
3304let result = [];
3305for (let w = 0; w < 6; w++) {
3306let week = [];
3307for (let c = 0; c < 7; c++) {
3308if (count === 1 && c < firstDayOfMonth) {
3309week.push({ id: before, type: "prev", date: this._getDate(y, m - 1, before) });
3310before++;
3311} else if (count > lastDateOfMonth) {
3312week.push({ id: count - lastDateOfMonth, type: "next", date: this._getDate(y, m + 1, count - lastDateOfMonth) });
3313count++;
3314} else {
3315week.push({ id: count, type: "active", date: this._getDate(y, m, count) });
3316count++;
3317}
3318}
3319result.push(week);
3320}
3321return result;
3322}
3323_getDate(y, m, d) {
3324if (m < 0) { y -= 1; m = 11; } 
3325if (m > 11) { y += 1; m = 0; }
3326return y + "-" + ((m >= 9) ? m + 1 : "0" + (m + 1)) + "-" + ((d > 9) ? d : "0" + d);
3327}
3328}
3329;Widget.__pN='user.SOAPayment.ui.slots.calendar';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.SOAPayment.ui.slots.calendar'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.SOAPayment.ui.slots.list')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.SOAPayment.ui");
3330class Widget extends common.ui.widget.Widget {
3331constructor(data, service) {
3332super();
3333this._css = "user-soa-slots-list";
3334this._data = data;
3335this._service = service;
3336this.setTemplate(new beeJS.Template(41, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n	");for(let item of data) { html.push("\n        <button type=\"button\" class=\"");html.push(css);html.push("__item\" id=\"");html.push(bindInfo.registerInBindInfo('item'));html.push("\" data-ids=\"");html.push(item.ids.join(','));html.push("\">");html.push(item.start);html.push("</button>\n	");} html.push("\n</div>\n");return html.join('');}), {
3337css: this._css,
3338data: this._data
3339});
3340}
3341_initControls() {
3342this._bind._items = beeJS.ArrayUtil.asArray(this._bind._item);
3343this._bind._items.forEach((item, i) => {
3344item.onclick = (e) => {
3345this._bind._items.forEach((item, i) => {
3346item.classList.remove("active");
3347});
3348item.classList.add("active");
3349this._service.setFormData("SLOTS", item.dataset.ids.split(","));
3350};
3351});
3352}
3353}
3354;Widget.__pN='user.SOAPayment.ui.slots.list';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.SOAPayment.ui.slots.list'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.SOAPayment.ui.slots.block')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.SOAPayment.ui");
3355class Widget extends common.ui.widget.Widget {
3356constructor(data, service) {
3357super();
3358this._css = "user-soa-slots-block";
3359this._data = data;
3360this._service = service;
3361this.setTemplate(new beeJS.Template(42, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__warning\">Время бронируется на 2 часа. Если заказ не будет оплачен - время освободится и после оплаты вы сможете выбрать другое время или связаться с ритмологом</div>\n    <div class=\"");html.push(css);html.push("__grid\">\n        <div id=\"");
3361html.push(bindInfo.registerInBindInfo('calendar'));html.push("\"></div>\n        <div id=\"");html.push(bindInfo.registerInBindInfo('slots'));html.push("\"></div>\n        <div class=\"");html.push(css);html.push("__message\">Время соответствует часовому поясу на вашем устройстве</div>\n    </div>\n</div>\n");return html.join('');}), {
3362css: this._css,
3363data: this._data
3364});
3365}
3366_initListeners() {
3367this._service.model.addHandler("date", (value) => {
3368this._initSlots(value);
3369});
3370}
3371_initContent() {
3372this._initCalendar();
3373}
3374_initCalendar() {
3375const div = document.createElement("div");
3376let widget = new ui.slots.calendar.Widget({}, this._service);
3377this._bind._calendar.innerHTML = "";
3378this._bind._calendar.appendChild(div);
3379widget.start(div); 
3380}
3381_initSlots(value) {
3382if(document.body.contains(this._bind._slots)) {
3383const div = document.createElement("div");
3384let widget = new ui.slots.list.Widget(this._service.getSlots()[value], this._service);
3385this._bind._slots.innerHTML = "";
3386this._bind._slots.appendChild(div);
3387widget.start(div); 
3388}
3389}
3390}
3391;Widget.__pN='user.SOAPayment.ui.slots.block';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.SOAPayment.ui.slots.block'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.SOAPayment.ui.steps')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.SOAPayment.ui");
3392class Widget extends common.ui.widget.Widget {
3393constructor(data, service) {
3394super();
3395this._css = "user-soa-steps";
3396this._data = data;
3397this._service = service;
3398this.setTemplate(new beeJS.Template(43, function (model, bindInfo) {var html=[];html.push("");var css = model.css; html.push("\n");var data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__section\" data-id=\"1\" id=\"");html.push(bindInfo.registerInBindInfo('item'));html.push("\">\n        <h3 data-id=\"1\">Заполните контактные данные</h3>\n        <div>\n            <div id=\"");html.push(bindInfo.registerInBindInfo('first'));html.push("\"></div>\n            <div class=\"");html.push(css);html.push("__buttons\">\n                <div></div>\n                <button type=\"button\" data-id=\"2\" id=\"");html.push(bindInfo.registerInBindInfo('next'));html.push("\">Далее</button>\n            </div>\n        </div>\n        <div class=\"info\">\n            <div class=\"info__customer\" id=\"");html.push(bindInfo.registerInBindInfo('customer'));html.push("\"></div>\n            <div id=\"");html.push(bindInfo.registerInBindInfo('text'));html.push("\"></div>\n            <div class=\"info__contact\" id=\"");html.push(bindInfo.registerInBindInfo('contact'));html.push("\"></div>\n        </div>\n    </div>\n    <div class=\"");html.push(css);html.push("__section\" data-id=\"2\" id=\"");html.push(bindInfo.registerInBindInfo('item'));html.push("\">\n        <h3 data-id=\"2\">Выберите дату и время</h3>\n        <div>\n            <div id=\"");html.push(bindInfo.registerInBindInfo('second'));html.push("\"></div>\n            <div class=\"");html.push(css);html.push("__buttons\">\n                <button type=\"button\" data-id=\"3\" id=\"");html.push(bindInfo.registerInBindInfo('skip'));html.push("\">Пропустить выбор даты</button>\n                <button type=\"button\" data-id=\"3\" id=\"");html.push(bindInfo.registerInBindInfo('next'));html.push("\">Далее</button>\n            </div>\n        </div>\n        <div class=\"info\">\n            <div id=\"");html.push(bindInfo.registerInBindInfo('date'));html.push("\"></div>\n            <div class=\"info__warning\" id=\"");html.push(bindInfo.registerInBindInfo('warning'));html.push("\">Отменить консультацию можно <strong>за 12 часов</strong> до ее начала</div>\n        </div>\n    </div>\n    <div class=\"");html.push(css);html.push("__section\" data-id=\"3\" id=\"");html.push(bindInfo.registerInBindInfo('item'));html.push("\">\n        <h3 data-id=\"3\">Оплатите консультацию</h3>\n        <div id=\"");html.push(bindInfo.registerInBindInfo('third'));html.push("\"></div>\n    </div>\n</div>\n");return html.join('');}), {
3399css: this._css,
3400data: this._data
3401});
3402}
3403_initControls() {
3404let nexts = beeJS.ArrayUtil.asArray(this._bind._next);
3405nexts.forEach((item, i) => {
3406item.onclick = (e) => {
3407this._checkStep(item.dataset.id);
3408e.stopPropagation();
3409};
3410});
3411let skips = beeJS.ArrayUtil.asArray(this._bind._skip);
3412skips.forEach((item, i) => {
3413item.onclick = (e) => {
3414this._checkStep(item.dataset.id);
3415e.stopPropagation();
3416};
3417});
3418}
3419_initContent() {
3420this._initStep("1");
3421}
3422_initInfo() {
3423let formdata = this._service.model.getValue("formdata");
3424if(formdata["CUSTOMER"] === "gift") {
3425this._bind._customer.innerText = "Оформлено в подарок:";
3426this._bind._text.innerText = formdata["NAME"];
3427this._bind._customer.style.display = "block";
3428} else if(formdata["TYPE_MEETING"] != "ONLINE") {
3429this._bind._text.innerText = formdata["CITY"];
3430this._bind._customer.style.display = "none";
3431} else {
3432this._bind._text.innerText = "Онлайн";
3433this._bind._customer.style.display = "none";
3434}
3435this._bind._contact.innerText = formdata[formdata["TYPE_CONTACT"]];
3436this._bind._contact.dataset.type = formdata["TYPE_CONTACT"];
3437if(formdata["SLOTS"]) {
3438let choosed = formdata["SLOTS"].toString();
3439let date = this._service.model.getValue("date");
3440let time = this._service.getSlots()[date].find((item) => item.ids.toString() == choosed).start;
3441this._bind._date.innerText = (date && time) ? (new Date(date+" "+time)).toLocaleString("ru", {"day": "numeric", "month": "long", "year": "numeric", "hour": "numeric", "minute": "numeric"}) : "";
3442this._bind._warning.style.display = "block";
3443} else {
3444let date = formdata["DATE"];
3445let time = formdata["TIME"];
3446this._bind._date.innerText = (date && time) ? date+" "+time : "";
3447this._bind._warning.style.display = "none";
3448}
3449}
3450_initStep(id) {
3451let element = {};
3452let widget = new common.ui.widget.Widget();
3453const div = document.createElement("div");
3454switch(id) {
3455case "1":
3456this._data.fields.formdata = this._service.model.getValue("formdata");
3457this._data.fields.product = this._service.model.getValue("data").product;
3458widget = new ui.fields.Widget(this._data.fields, this._service);
3459element = this._bind._first;
3460break;
3461case "2":
3462widget = new ui.slots.block.Widget(this._data, this._service);
3463element = this._bind._second;
3464this._setSkip(true);
3465break;
3466case "3":
3467widget = new ui.confirm.Widget(this._data, this._service);
3468element = this._bind._third;
3469break;
3470case "4":
3471id = "2";
3472widget = new ui.datepicker.Widget(this._data, this._service);
3473element = this._bind._second;
3474this._setSkip(false);
3475break;
3476default:
3477break;
3478}
3479element.innerHTML = "";
3480element.appendChild(div);
3481widget.start(div);
3482this._setItemActive(id);
3483}
3484_checkStep(id) {
3485switch(id) {
3486case "1":
3487this._initStep("1");
3488break;
3489case "2":
3490if(this._checkFields()) {
3491this._setItemSuccess("1");
3492this._initInfo();
3493this._initChooseTime();
3494};
3495break;
3496case "3":
3497this._setItemSuccess("2");
3498this._initInfo();
3499this._initStep("3");
3500break;
3501default:
3502break;
3503}
3504}
3505_checkFields() {
3506let result = this._service.checkFields();
3507for(let item of result) {
3508$("input[data-id="+item+"]").parent().addClass("error");
3509$("button[data-id="+item+"]").parent().parent().addClass("error");
3510};
3511let actionOut = () => {
3512$(".error").removeClass("error");
3513document.removeEventListener("click", actionOut);
3514};
3515document.addEventListener("click", actionOut);
3516return result.length === 0;
3517}
3518_setItemActive(id) {
3519let items = beeJS.ArrayUtil.asArray(this._bind._item);
3520items.forEach((item, i) => {
3521if(item.dataset.id === id) {
3522item.classList.add("active");
3523item.classList.remove("success");
3524} else {
3525item.classList.remove("active");
3526}
3527});
3528}
3529_setItemSuccess(id) {
3530let items = beeJS.ArrayUtil.asArray(this._bind._item);
3531items.forEach((item, i) => {
3532if(item.dataset.id === id) {
3533item.classList.add("success");
3534item.onclick = (e) => {
3535item.onclick = (e) => {};
3536this._checkStep(item.dataset.id);
3537}
3538}
3539});
3540}
3541_initChooseTime() {
3542this._service.clearFormData("time");
3543(async () => {
3544await this._service.loadSlots();
3545let slots = Object.keys(this._service.getSlots());
3546let ritmolog = this._service.model.getValue("data")["ritmolog"];
3547if(slots.length != 0 && ritmolog.group.includes(169)) {
3548this._initStep("2");
3549} else {
3550this._initStep("4");
3551}
3552})(); 
3553}
3554_setSkip(isHide) {
3555if(isHide) {
3556this._bind._skip.classList.remove("hide");
3557this._bind._skip.removeAttribute('disabled');
3558} else {
3559this._bind._skip.classList.add("hide");
3560this._bind._skip.setAttribute('disabled', 'true');
3561}; 
3562}
3563}
3564;Widget.__pN='user.SOAPayment.ui.steps';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.SOAPayment.ui.steps'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.SOAPayment.ui.paysystems')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.SOAPayment.ui");
3565class Widget extends common.ui.widget.Widget {
3566constructor(data, service) {
3567super();
3568this._css = "user-soa-paysystems";
3569this._data = data;
3570this._service = service;
3571this.setTemplate(new beeJS.Template(44, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('block'));html.push("\">\n    <div class=\"");html.push(css);html.push("__header\">\n        <h4>Выберите способ оплаты</h4>\n    </div>\n    <div class=\"");html.push(css);html.push("__list\">\n        ");for(let paysystem of data) { html.push("\n            <div class=\"");html.push(css);html.push("__item\">\n                <label>\n                    <div>");html.push(paysystem.name);html.push("</div>\n                    <input type=\"radio\" id=\"");html.push(bindInfo.registerInBindInfo('paysystem'));html.push("\" name=\"paysystem\" value=\"");html.push(paysystem.id);html.push("\">\n                    ");if(paysystem.image) { html.push("\n                        <div>\n                            <img src='");html.push(paysystem.image);html.push("' alt='");html.push(paysystem.name);html.push("' />\n                        </div>\n                    ");} html.push("\n                </label>\n            </div>\n        ");} html.push("\n    </div>\n</div>\n");return html.join('');}), {
3572css: this._css,
3573data: this._data
3574});
3575}
3576_initControls() {
3577if(this._bind._block) {
3578let paysystems = beeJS.ArrayUtil.asArray(this._bind._paysystem);
3579paysystems.forEach((item, i) => {
3580item.onchange = (e) => {
3581paysystems.forEach((j, i) => {
3582j.parentNode.classList.remove("active");
3583});
3584item.parentNode.classList.add("active");
3585this._service.setFormData("PAYSYSTEM", item.value);
3586};
3587});
3588this._presetControls();
3589}
3590}
3591_presetControls() {
3592let input = document.querySelector("."+this._css+"__item > label > input");
3593input.setAttribute("checked", true);
3594input.dispatchEvent(new Event("change"));
3595}
3596}
3597;Widget.__pN='user.SOAPayment.ui.paysystems';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.SOAPayment.ui.paysystems'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.SOAPayment.ui.fields')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.SOAPayment.ui");
3598class Widget extends common.ui.widget.Widget {
3599constructor(data, service) {
3600super();
3601this._css = "user-soa-fields";
3602this._data = data;
3603this._service = service;
3604this.setTemplate(new beeJS.Template(45, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n");let isGift = data.customer === "gift"; html.push("\n");let switchText = (isGift) ? "Оформить на себя" : "Оформить в подарок"; html.push("\n");let contacts = [{id: "PHONE", title: "Телефон", placeholder: "Номер телефона", },{id: "TELEGRAM", title: "Telegram", placeholder: "Номер телефона или логин Telegram"},{id: "MAX", title: "MAX", placeholder: "Ваш контакт в MAX"}];let meetings = [{id: "ALL", title: "Все подходит"},{id: "ONLINE", title: "Онлайн"},{id: "OFFLINE", title: "Встретиться лично"}];html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__header\">\n        <h4>Личные данные</h4>\n        ");if(data.product.isGiftAllowed) { html.push("\n            <button type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('type'));html.push("\">");html.push(switchText);html.push("</button>\n        ");} html.push("\n    </div>\n    <div class=\"");html.push(css);html.push("__body\">\n        ");if(isGift) { html.push("\n            <div class=\"");html.push(css);html.push("__input ");html.push(css);html.push("__input_large\">\n                <input type=\"text\" placeholder=\"Имя\" data-id=\"NAME\" id=\"");html.push(bindInfo.registerInBindInfo('input'));html.push("\">\n            </div>\n        ");} html.push("\n        <div class=\"");html.push(css);html.push("__dropdown\" id=\"");html.push(bindInfo.registerInBindInfo('dropdown'));html.push("\">\n            <button type=\"button\" class=\"value\">Где связаться</button>\n            <div>\n                ");for(let contact of contacts) { html.push("\n                    <button type=\"button\" data-id=\"TYPE_CONTACT\" data-value=\"");html.push(contact.id);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('value'));html.push("\">");html.push(contact.title);html.push("</button>\n                ");} html.push("\n            </div>\n        </div>\n        <div class=\"");html.push(css);html.push("__input\">\n            ");for(let contact of contacts) { html.push("\n                <input type=\"text\" placeholder=\"");html.push(contact.placeholder);html.push("\" data-id=\"");html.push(contact.id);html.push("\" data-reaction=\"TYPE_CONTACT\" id=\"");html.push(bindInfo.registerInBindInfo('input'));html.push("\">\n            ");} html.push("\n        </div>\n        ");if(!isGift) { html.push("\n            <div class=\"");html.push(css);html.push("__dropdown\" id=\"");html.push(bindInfo.registerInBindInfo('dropdown'));html.push("\">\n                <button type=\"button\" class=\"value\">Онлайн или встретиться лично</button>\n                <div>\n                    ");for(let meeting of meetings) { html.push("\n                        <button type=\"button\" data-id=\"TYPE_MEETING\" data-value=\"");html.push(meeting.id);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('value'));html.push("\">");html.push(meeting.title);html.push("</button>\n                    ");} html.push("\n                </div>\n            </div>\n            <div class=\"");html.push(css);html.push("__input\">\n                <div class=\"");html.push(css);html.push("__search\" data-reaction=\"TYPE_MEETING\" data-id=\"ALL,OFFLINE\" id=\"");html.push(bindInfo.registerInBindInfo('reaction'));html.push("\">\n                    <input type=\"text\" placeholder=\"Город\" data-id=\"CITY\" autocomplete=\"off\" id=\"");html.push(bindInfo.registerInBindInfo('city'));html.push("\">\n                    <div class=\"tips\" id=\"");html.push(bindInfo.registerInBindInfo('tips'));html.push("\"></div>\n                </div>\n            </div>\n        ");} html.push("\n    </div>\n</div>\n");return html.join('');}), {
3605css: this._css,
3606data: this._data
3607});
3608}
3609_initControls() {
3610this.onClick(this._bind._type, (e) => {
3611let customer = this._viewModel.data.customer;
3612if(customer === "gift") {
3613this._viewModel.data.customer = "self";
3614} else {
3615this._viewModel.data.customer = "gift";
3616}
3617this._service.clearFormData("fields");
3618this._service.setFormData("CUSTOMER", this._viewModel.data.customer);
3619this.restart();
3620});
3621let dropdowns = beeJS.ArrayUtil.asArray(this._bind._dropdown);
3622dropdowns.forEach((item, i) => {
3623let actionOut = (event) => {
3624if (!item.contains(event.target)) {
3625item.classList.remove("active");
3626document.removeEventListener("click", actionOut);
3627}
3628};
3629item.onclick = (e) => {
3630item.classList.toggle("active");
3631document.addEventListener("click", actionOut);
3632};
3633});
3634let values = beeJS.ArrayUtil.asArray(this._bind._value);
3635values.forEach((item, i) => {
3636item.onclick = (e) => {
3637$(item).parent().find("button").removeClass("active");
3638$(item).addClass("active");
3639$(item).parent().parent().find(".value").html(item.innerText);
3640this._service.setFormData(item.dataset.id, item.dataset.value);
3641this._triggerDropdown(item.dataset.id, item.dataset.value);
3642};
3643});
3644let inputs = beeJS.ArrayUtil.asArray(this._bind._input);
3645inputs.forEach((item, i) => {
3646item.onkeyup = (e) => {
3647this._service.setFormData(item.dataset.id, item.value);
3648};
3649});
3650let city = beeJS.ArrayUtil.asArray(this._bind._city);
3651city.forEach((item, i) => {
3652let input = item;
3653let element = input.parentNode;
3654let actionOut = (event) => {
3655if (!input.contains(event.target)) {
3656element.classList.remove("search");
3657document.removeEventListener("click", actionOut);
3658}
3659};
3660item.onclick = (e) => {
3661if(input.dataset.search === "true") {
3662element.classList.remove("search");
3663input.dataset.search = "false";
3664} else {
3665if(input.value.length > 0) {
3666element.classList.remove("search");
3667};
3668this._tipsSearch(input, this._data.city.tips);
3669}
3670document.addEventListener("click", actionOut);
3671e.stopPropagation();
3672};
3673item.onkeyup = (e) => {
3674this._tipsSearch(input, this._data.city.tips);
3675this._service.setFormData(item.dataset.id, item.value);
3676document.addEventListener("click", actionOut);
3677};
3678});
3679this._presetControls();
3680}
3681_presetControls() {
3682if(this._data.formdata) {
3683$("."+this._css+"__dropdown > div > button[data-value="+this._data.formdata['TYPE_CONTACT']+"]").click();
3684$("."+this._css+"__dropdown > div > button[data-value="+this._data.formdata['TYPE_MEETING']+"]").click();
3685} else {
3686$("."+this._css+"__dropdown > div > button[data-value="+this._data.contact.preferred+"]").click();
3687}
3688let inputs = beeJS.ArrayUtil.asArray(this._bind._input);
3689inputs.forEach((item, i) => {
3690if(item.dataset.reaction === "TYPE_CONTACT" && this._viewModel.data.customer != "gift") {
3691item.value = (this._data.formdata && this._data.formdata[item.dataset.id]) ? this._data.formdata[item.dataset.id] : this._data.contact[item.dataset.id];
3692item.dispatchEvent(new Event("keyup"));
3693}
3694});
3695let city = beeJS.ArrayUtil.asArray(this._bind._city);
3696city.forEach((item, i) => {
3697item.value = (this._data.formdata && this._data.formdata["CITY"]) ? this._data.formdata["CITY"] : this._data.city.value;
3698item.dispatchEvent(new Event("keyup"));
3699});
3700}
3701_triggerDropdown(id, value) {
3702let action = (item) => {
3703if(item.dataset.reaction === id) {
3704if(item.dataset.id && item.dataset.id.split(",").includes(value)) {
3705item.classList.add("active");
3706} else {
3707item.classList.remove("active");
3708}
3709}
3710}
3711let inputs = beeJS.ArrayUtil.asArray(this._bind._input);
3712inputs.forEach((item, i) => {
3713action(item);
3714});
3715let reactions = beeJS.ArrayUtil.asArray(this._bind._reaction);
3716reactions.forEach((item, i) => {
3717action(item);
3718});
3719}
3720_tipsSearch(input, tips) {
3721let list = input.parentNode.children[1];
3722let element = input.parentNode;
3723let value = input.value;
3724if(value.length > 0) {
3725let tipsFound = tips.filter((i) => i.toLowerCase().indexOf(value.toLowerCase()) != -1);
3726element.classList.add("search");
3727list.innerHTML = "";
3728if(tipsFound.length > 0) {
3729for(let i in tipsFound) {
3730let button = document.createElement("button");
3731button.type = "button";
3732button.innerText = tipsFound[i];
3733button.onclick = () => {
3734element.classList.remove("search");
3735input.value = button.innerText;
3736input.dataset.search = true;
3737};
3738list.appendChild(button);
3739};
3740} else {
3741list.innerHTML = "Ничего не найдено";
3742};
3743} else {
3744element.classList.remove("search");
3745};
3746}
3747}
3748;Widget.__pN='user.SOAPayment.ui.fields';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.SOAPayment.ui.fields'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.SOAPayment.ui.datepicker')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.SOAPayment.ui");
3749class Widget extends common.ui.widget.Widget {
3750constructor(data, service) {
3751super();
3752this._css = "user-soa-datepicker";
3753this._data = data;
3754this._service = service;
3755this.setTemplate(new beeJS.Template(46, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n<div class=\"");html.push(css);html.push("\">\n	<h4>У консультанта запись по запросу</h4>\n	<p>Напишите ваши пожелания и с вами свяжутся<br> в течение суток для выбора времени консультации<
3755/p>\n	<div class=\"");html.push(css);html.push("__grid\">\n		<div class=\"");html.push(css);html.push("__input ");html.push(css);html.push("__input_date\">\n			<input class=\"date\" type=\"text\" placeholder=\"Желаемая дата\" autocomplete=\"off\" id=\"");html.push(bindInfo.registerInBindInfo('date'));html.push("\">\n		</div>\n		<div class=\"");html.push(css);html.push("__input\">\n			<input type=\"text\" placeholder=\"Предпочтения по времени\" autocomplete=\"off\" id=\"");html.push(bindInfo.registerInBindInfo('time'));html.push("\">\n		</div>\n	</div>\n</div>\n");return html.join('');}), {
3756css: this._css,
3757data: this._data
3758});
3759}
3760_initControls() {
3761if(!jQuery.datepicker) {
3762this._initDatePicker();
3763} else {
3764$(this._bind._date).datepicker({dateFormat: "dd.mm.yy"});
3765}
3766this._bind._date.onchange = (e) => {
3767this._service.setFormData("DATE", this._bind._date.value);
3768e.stopPropagation();
3769};
3770this._bind._time.onchange = (e) => {
3771this._service.setFormData("TIME", this._bind._time.value);
3772e.stopPropagation();
3773};
3774}
3775async _initDatePicker() {
3776await loadScript("/lib/jquery-ui/jquery-ui.js");
3777(( factory ) => {
3778if ( typeof define === "function" && define.amd ) {
3779define( [ "../widgets/datepicker" ], factory );
3780} else {
3781factory( jQuery.datepicker );
3782}
3783this._initControls();
3784})( function( datepicker ) {
3785datepicker.regional.ru = {
3786closeText: "Закрыть",
3787prevText: "&#x3C;",
3788nextText: "&#x3E;",
3789currentText: "Сегодня",
3790monthNames: [ "Январь","Февраль","Март","Апрель","Май","Июнь",
3791"Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь" ],
3792monthNamesShort: [ "Янв","Фев","Мар","Апр","Май","Июн",
3793"Июл","Авг","Сен","Окт","Ноя","Дек" ],
3794dayNames: [ "воскресенье","понедельник","вторник","среда","четверг","пятница","суббота" ],
3795dayNamesShort: [ "вск","пнд","втр","срд","чтв","птн","сбт" ],
3796dayNamesMin: [ "Вс","Пн","Вт","Ср","Чт","Пт","Сб" ],
3797weekHeader: "Нед",
3798dateFormat: "dd.mm.yy",
3799firstDay: 1,
3800isRTL: false,
3801showMonthAfterYear: false,
3802yearSuffix: "",
3803minDate: 0
3804};
3805datepicker.setDefaults( datepicker.regional.ru );
3806return datepicker.regional.ru;
3807});
3808}
3809}
3810;Widget.__pN='user.SOAPayment.ui.datepicker';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.SOAPayment.ui.datepicker'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.SOAPayment.ui.confirm')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.SOAPayment.ui");
3811class Widget extends common.ui.widget.Widget {
3812constructor(data, service) {
3813super();
3814this._css = "user-soa-confirm";
3815this._data = data;
3816this._service = service;
3817this.setTemplate(new beeJS.Template(47, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n");let summary = model.data.summary; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__paysystems\" id=\"");html.push(bindInfo.registerInBindInfo('paysystems'));html.push("\"></div>\n    <div class=\"");html.push(css);html.push("__coupone\" id=\"");html.push(bindInfo.registerInBindInfo('coupone'));html.push("\"></div>\n    <div class=\"");html.push(css);html.push("__bonuses\" id=\"");html.push(bindInfo.registerInBindInfo('bonuses'));html.push("\"></div>\n    <div class=\"");html.push(css);html.push("__form\">\n        <div>\n            <h3>К оплате</h3>\n            <div class=\"");html.push(css);html.push("__price\">\n                <div id=\"");html.push(bindInfo.registerInBindInfo('price'));html.push("\">");html.push(summary.price);html.push(" ₽</div>\n                <div id=\"");html.push(bindInfo.registerInBindInfo('old'));html.push("\"></div>\n            </div>\n        </div>\n        <div>\n            <form class=\"");html.push(css);html.push("\" name='");html.push(data.id);html.push("' method='post' action=''>\n                <input class='");html.push(css);html.push("__button' type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('pay'));html.push("\" value='Оплатить'/>\n                <label class='");html.push(css);html.push("__argee'>\n                    <input type=\"checkbox\" name='agree' required><span>Я согласен с&nbsp;</span><a href='/docs/offer' target='_blank'>условиями оплаты</a>\n                </label>\n                <div id=\"");html.push(bindInfo.registerInBindInfo('hidden'));html.push("\"></div>\n            </form>\n        </div>\n    </div>\n</div>\n");return html.join('');}), {
3818css: this._css,
3819data: this._data
3820});
3821}
3822_initListeners() {
3823this._service.model.addHandler("paysystems", (value) => {
3824this._initPaySystems(value);
3825});
3826this._service.model.addHandler("price", (value) => {
3827this._bind._old.innerHTML = this._data.summary.price+" ₽";
3828this._bind._price.innerHTML = value+" ₽";
3829});
3830this._service.model.addHandler("bonuses", (value) => {
3831if(value.active) {
3832this._initBonuses(value);
3833}
3834}
3834);
3835}
3836_initControls() {
3837this._bind._pay.onclick = (e) => {
3838if(this._checkAgree()) {
3839this._sendForm();
3840};
3841e.stopPropagation();
3842};
3843}
3844_initContent() {
3845let data = this._service.model.getValue("data");
3846this._initCoupone();
3847this._service.loadBonuses();
3848this._service.initPaySystems();
3849}
3850_initCoupone() {
3851const div = document.createElement("div");
3852const widget = new ui.coupone.Widget({}, this._service);
3853this._bind._coupone.innerHTML = "";
3854this._bind._coupone.appendChild(div);
3855widget.start(div); 
3856}
3857_initBonuses(bonuses) {
3858const div = document.createElement("div");
3859const widget = new ui.bonuses.Widget(bonuses, this._service);
3860this._bind._bonuses.innerHTML = "";
3861this._bind._bonuses.appendChild(div);
3862widget.start(div); 
3863}
3864_initPaySystems(paysystems) {
3865const div = document.createElement("div");
3866const widget = new ui.paysystems.Widget(paysystems, this._service);
3867this._bind._paysystems.innerHTML = "";
3868this._bind._paysystems.appendChild(div);
3869widget.start(div); 
3870}
3871_initForm() {
3872let formdata = this._service.model.getValue("formdata");
3873let data = {};
3874data.PERSON_TYPE = 1;
3875data.PERSON_TYPE_OLD = 1;
3876data.confirmorder = "Y";
3877data.AJAX_CALL = "Y";
3878if(formdata["CUSTOMER"] === "gift") {
3879data.ORDER_PROP_149 = "Y";
3880} else {
3881data.ORDER_PROP_148 = formdata["TYPE_MEETING"];
3882if(formdata["CITY"]) {
3883data.ORDER_PROP_22 = formdata["CITY"];
3884}
3885}
3886data.ORDER_PROP_26 = (formdata["NAME"]) ? formdata["NAME"] : this._data.fields.name;
3887let contacts = {
3888"PHONE": "ORDER_PROP_23",
3889"TELEGRAM": "ORDER_PROP_153",
3890"MAX": "ORDER_PROP_166"
3891};
3892for(let i in contacts) {
3893data[contacts[i]] = formdata[i];
3894}
3895data.ORDER_PROP_147 = formdata["TYPE_CONTACT"];
3896data.PAY_SYSTEM_ID = formdata["PAYSYSTEM"];
3897if(formdata["SLOTS"]) {
3898data.ORDER_PROP_163 = formdata["SLOTS"];
3899data.SLOTS = formdata["SLOTS"];
3900} else if(formdata["DATE"]) {
3901data.ORDER_PROP_25 = formdata["DATE"];
3902if(formdata["TIME"]) {
3903data.ORDER_PROP_150 = formdata["TIME"];
3904}
3905}
3906if(formdata["COUPON"]) {
3907data.COUPON = formdata["COUPON"];
3908}
3909if(formdata["BONUSES"]) {
3910data.ORDER_PROP_164 = formdata["BONUSES"];
3911}
3912this._bind._hidden.innerHTML = "";
3913for(let i in data) {
3914const input = document.createElement("input");
3915input.type = "hidden";
3916input.name = i;
3917input.value = data[i];
3918this._bind._hidden.appendChild(input);
3919}; 
3920}
3921_checkAgree() {
3922let result = true;
3923if(!$("[name=agree]")[0].checked) {
3924$("[name=agree]").parent().addClass("error");
3925result = false;
3926};
3927let actionOut = () => {
3928$(".error").removeClass("error");
3929document.removeEventListener("click", actionOut);
3930};
3931document.addEventListener("click", actionOut);
3932return result;
3933}
3934_getFormData() {
3935let result = {
3936param: [],
3937flag: false
3938};
3939const formData = new FormData($('[name='+this._data.id+']')[0]);
3940for (const pair of formData.entries()) {
3941console.log(pair[0], pair[1]);
3942if(pair[0].includes("_PROP_")) {
3943let propId = pair[0].split("_PROP_")[1];
3944result.param.push({"ID": propId, "VALUE": pair[1]});
3945result.flag = (propId == "164") ? true : result.flag;
3946}
3947if(pair[0].includes("PAY_SYSTEM_ID")) {
3948result.paymentSystemId = pair[1];
3949}
3950}
3951return result;
3952}
3953async _sendForm() {
3954this._initForm();
3955this._bind._pay.setAttribute("disabled", true);
3956if(await this._service.checkForm()) {
3957let formData = this._getFormData();
3958if(formData.flag) {
3959this._service.createOrder(formData.paymentSystemId, formData.param);
3960} else {
3961$('[name='+this._data.id+']').submit();
3962}
3963} else {
3964this._bind._pay.removeAttribute("disabled");
3965}
3966}
3967}
3968;Widget.__pN='user.SOAPayment.ui.confirm';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.SOAPayment.ui.confirm'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.SOAPayment.ui.product')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.SOAPayment.ui");
3969class Widget extends common.ui.widget.Widget {
3970constructor(data, service) {
3971super();
3972this._css = "user-soa-product";
3973this._data = data;
3974this._service = service;
3975this.setTemplate(new beeJS.Template(48, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <h2 class=\"");html.push(css);html.push("__type\">");html.push(data.type);html.push("</h2>\n    <div class=\"");html.push(css);html.push("__item\">\n        <div class=\"");html.push(css);html.push("__info ");if(!data.theme) { html.push(" ");html.push(css);html.push("__info_long ");} html.push("\">\n            <h3 class=\"");html.push(css);html.push("__title\">");html.push(data.title);html.push("</h3>\n            ");if (data.description) { html.push("\n                <button class=\"");html.push(css);html.push("__button\" id=\"");html.push(bindInfo.registerInBindInfo('button'));html.push("\"></button>\n                <div class=\"");html.push(css);html.push("__description\" id=\"");html.push(bindInfo.registerInBindInfo('description'));html.push("\">");html.push(data.description);html.push("</div>\n            ");} html.push("\n        </div>\n        ");if(data.theme) { html.push("\n            <div>");html.push(data.theme);html.push("</div>\n        ");} html.push("\n        <div class=\"");html.push(css);html.push("__hours\">");html.push(data.quantity * data.hours);html.push("</div>\n        <div class=\"");html.push(css);html.push("__price\">");html.push(data.price);html.push(" ₽</div>\n    </div>\n</div>\n");return html.join('');}), {
3976css: this._css,
3977data: this._data
3978});
3979}
3980_initControls() {
3981let b = this._bind._button;
3982let d = this._bind._description;
3983if(d) {
3984let actionOut = (event) => {
3985if (!d.contains(event.target) && !b.contains(event.target)) {
3986d.classList.remove("active");
3987document.removeEventListener("click", actionOut);
3988}
3989};
3990b.onclick = (e) => {
3991d.classList.toggle("active");
3992document.addEventListener("click", actionOut);
3993};
3994}
3995}
3996}
3997;Widget.__pN='user.SOAPayment.ui.product';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.SOAPayment.ui.product'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.SOAPayment.ui.warning')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.calendar.ui");
3998class Widget extends common.ui.widget.Widget {
3999constructor(data, service) {
4000super();
4001this._css = "user-soa-warning";
4002this._data = data;
4003this._service = service;
4004this.setTemplate(new beeJS.Template(49, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n	<div class=\"");html.push(css);html.push("__body\">\n		<div class=\"");html.push(css);html.push("__text\">\n			");html.push(data.html);html.push("\n		</div>\n	</div>\n	<div class=\"");html.push(css);html.push("__footer\">\n		<button class=\"");html.push(css);html.push("__button\" type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('action'));html.push("\">");html.push(data.button);html.push("</button>\n	</div>\n</div>\n");return html.join('');}), {css: this._css, data: this._data});
4005}
4006_initControls() {
4007this._bind._action.onclick = async () => {
4008if(this._data.action) {
4009this._data.action();
4010}
4011};
4012}
4013}
4014;Widget.__pN='user.SOAPayment.ui.warning';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.SOAPayment.ui.warning'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.SOAPayment.ui.bonuses')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.SOAPayment.ui");
4015class Widget extends common.ui.widget.Widget {
4016constructor(data, service) {
4017super();
4018this._css = "user-soa-bonuses";
4019this._data = data;
4020this._service = service;
4021this.setTemplate(new beeJS.Template(50, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__header\">\n        <h4>Использовать бонусные баллы</h4>\n        <p>У вас на счёте <strong>");html.push(data.value);html.push(" баллов</strong></p>\n        <p>Вы можете потратить до <strong>");html.push(data.max);html.push(" баллов</strong> в этом заказе</p>\n    </div>\n    <div class=\"");html.push(css);html.push("__form\">\n        <div class=\"");html.push(css);html.push("__input\">\n            <input type=\"text\" placeholder=\"\" autocomplete=\"off\" id=\"");html.push(bindInfo.registerInBindInfo('input'));html.push("\">\n        </div>\n        <button type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('action'));html.push("\">Применить</button>\n    </div>\n    <div class=\"");html.push(css);html.push("__error\" id=\"");html.push(bindInfo.registerInBindInfo('error'));html.push("\"></div>\n</div>\n");return html.join('');}), {
4022css: this._css,
4023data: this._data
4024});
4025}
4026_initControls() {
4027beeJS.ArrayUtil.asArray(this._bind._action).forEach((item, i) => {
4028item.onclick = async (e) => {
4029this._bind._error.innerHTML = "";
4030let value = this._bind._input.value;
4031if(this._validate(value) && await this._check(value)) {
4032this._apply(this._bind._input.value);
4033}
4034}
4035});
4036}
4037_initError(text) {
4038this._bind._error.innerHTML = text;
4039}
4040_validate(value) {
4041if(!/^\d+$/.test(value)) {
4042this._initError("Некорректное значение количества баллов");
4043return false;
4044}
4045if(parseInt(value, 10) > this._data.max) {
4046this._initError("Указано больше баллов, чем доступно для оплаты");
4047return false;
4048}
4049if(this._service.model.getValue("hasDiscount")) {
4050this._initError("Нельзя применить купон на скидку и оплатить заказ баллами одновременно");
4051return false;
4052}
4053return true;
4054}
4055_apply(value) {
4056this._service.applyBonuses(value);
4057}
4058async _check(value) {
4059let data = {
4060"E01": "Нет бонусных баллов",
4061"E02": "Недостаточно баллов для оплаты",
4062"E03": "Превышено кол-во баллов, доступное для оплаты заказа",
4063"E04": "Некорректное значение количества баллов"
4064}
4065let result = true;
4066let response = await this._service.checkBonuses(value);
4067if(response.Result === "Error") {
4068this._initError(data[response.Code]);
4069result = false;
4070}
4071return result;
4072}
4073}
4074;Widget.__pN='user.SOAPayment.ui.bonuses';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.SOAPayment.ui.bonuses'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.SOAPayment.ui.shell')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.SOAPayment.ui");
4075class Widget extends common.ui.widget.Widget {
4076constructor(data, service) {
4077super();
4078this._css = "user-soa-shell";
4079this._data = service.model.getValue("data");
4080this._service = service;
4081this.setTemplate(new beeJS.Template(51, function (model, bindInfo) {var html=[];html.push("");var css = model.css; html.push("\n");var data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div>\n        <a href=\"");html.push(data.config.url.back);html.push("\"><button class=\"");html.push(css);html.push("__back\">Назад</button></a>\n    </div>\n    <div></div>\n    <div>\n        <div class=\"");html.push(css);html.push("__aside\">\n            <h2 class=\"");html.push(css);html.push("__name\">");html.push(data.ritmolog.name);html.push("</h2>\n            <div class=\"");html.push(css);html.push("__photo\"><img src=\"");html.push(data.ritmolog.image);html.push("\"></div>\n        </div>\n    </div>\n    <div>\n        <div id=\"");html.push(bindInfo.registerInBindInfo('product'));html.push("\"></div>\n        <div id=\"");html.push(bindInfo.registerInBindInfo('steps'));html.push("\"></div>\n    </div>\n</div>\n");return html.join('');}), {
4082css: this._css,
4083data: this._data
4084});
4085}
4086_initListeners() {
4087this._service.model.addHandler("error", (value) => {
4088this._initModal("error", value);
4089});
4090}
4091_initContent() {
4092this._initProduct();
4093this._initSteps();
4094}
4095_initProduct() {
4096const div = document.createElement("div");
4097const widget = new ui.product.Widget(this._data.product, this._service);
4098this._bind._product.innerHTML = "";
4099this._bind._product.appendChild(div);
4100widget.start(div); 
4101}
4102_initSteps() {
4103const div = document.createElement("div");
4104const widget = new ui.steps.Widget(this._data.form, this._service);
4105this._bind._steps.innerHTML = "";
4106this._bind._steps.appendChild(div);
4107widget.start(div); 
4108}
4109_initModal(type, param) {
4110const modal = this._service.modal.build();
4111const data = {
4112id: modal.id
4113};
4114switch(type) {
4115case "error":
4116let html = "<p>К сожалению, выбранное Вами время уже занято.</p><p>Попробуйте указать другое время.</p>";
4117let button = "Указать другое время";
4118let action = () => {
4119this._service.model.setValue("step", "2", true);
4120this._service.modal.descruct(modal.id);
4121};
4122data.title = "Ошибка";
4123data.widget = new ui.warning.Widget({html: html, button: button, action: action}, this._service);
4124break;
4125default:
4126break;
4127}
4128const widget = new common.ui.modal.Widget(data, this._service.modal);
4129widget.start(modal); 
4130}
4131}
4132;Widget.__pN='user.SOAPayment.ui.shell';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.SOAPayment.ui.shell'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.SOAPayment.ui.coupone')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.SOAPayment.ui");
4133class Widget extends common.ui.widget.Widget {
4134constructor(data, service) {
4135super();
4136this._css = "user-soa-coupone";
4137this._data = data;
4138this._service = service;
4139this.setTemplate(new beeJS.Template(52, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__header\">\n        <h4>Использовать купон на скидку</h4>\n    </div>\n    <div class=\"");html.push(css);html.push("__form\">\n        <div class=\"");html.push(css);html.push("__input\">\n            <input type=\"text\" placeholder=\"Введите купон\" autocomplete=\"off\" id=\"");html.push(bindInfo.registerInBindInfo('input'));html.push("\">\n        </div>\n        <button type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('action'));html.push("\">Применить купон</button>\n    </div>\n    <div class=\"");html.push(css);html.push("__error\" id=\"");html.push(bindInfo.registerInBindInfo('error'));html.push("\"></div>\n</div>\n");return html.join('');}), {
4140css: this._css,
4141data: this._data
4142});
4143}
4144_initControls() {
4145beeJS.ArrayUtil.asArray(this._bind._action).forEach((item, i) => {
4146item.onclick = (e) => {
4147if(!item.classList.contains("disabled")) {
4148this._bind._input.value = this._validateCoupone(this._bind._input.value);
4149item.classList.add("disabled");
4150if(this._service.model.getValue("hasDiscount")) {
4151this._initError("Нельзя применить купон на скидку и оплатить заказ баллами одновременно");
4152} else if(this._bind._input.value != "") {
4153this._checkCoupone(this._bind._input.value);
4154} else {
4155this._initError("Купон не введён");
4156}
4157item.classList.remove("disabled");
4158}
4159};
4160});
4161}
4162_validateCoupone(value) {
4163let result = "";
4164for(i = 0; i < value.length; i++) {
4165if(value[i].match(/[a-z0-9_\-\+]+/i)) {
4166result += value[i];
4167}
4168}
4169return result;
4170}
4171async _checkCoupone(value) {
4172let result = await this._service.checkCoupone(value);
4173if(result.status) {
4174this._initSuccess(result.text);
4175} else {
4176this._initError(result.text);
4177}
4178}
4179_initSuccess() {
4180this._bind._action.innerHTML = "Купон применен";
4181this._bind._action.classList.add("disabled");
4182this._bind._input.setAttribute("disabled", "disabled");
4183}
4184_initError(text) {
4185this._bind._error.innerHTML = text;
4186}
4187}
4188;Widget.__pN='user.SOAPayment.ui.coupone';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.SOAPayment.ui.coupone'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Model' in BeeJS.package('user.SOAPayment.model')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");
4189class Model extends common.model.Model {
4190constructor() {
4191super();
4192this.values = {};
4193this.handlers = {};
4194this.config = {}
4195}
4196setSlots(groups) {
4197let result = {};
4198groups = groups.sort((a, b) => new Date(a[0]["TIME_START"]) - new Date(b[0]["TIME_START"]));
4199for(let items of groups) {
4200let data = new Date(items[0]["TIME_START"]);
4201let date = this._formatDate(data);
4202let start = this._formatTime(data);
4203result[date] = (result[date]) ? result[date] : [];
4204result[date].push({ids: items.map((i) => i["ID"]), start: start});
4205};
4206this.setValue("slots", result, true);
4207}
4208setBonuses(data) {
4209let result = {
4210active: data.payment_enable,
4211value: data.amount,
4212max: data.max
4213};
4214this.setValue("bonuses", result, true);
4215}
4216checkSlots() {
4217if(!(this.getValue("formdata") && this.getValue("formdata")["SLOTS"])) {
4218return true;
4219}
4220let result = false;
4221let list = this.getValue("slots");
4222let date = this.getValue("date");
4223let choosed = this.getValue("formdata")["SLOTS"];
4224if(list[date]) {
4225for(let item of list[date]) {
4226if(item["ids"].toString() === choosed.toString()) {
4227result = true;
4228break;
4229}
4230}
4231}
4232return result;
4233}
4234_formatDate(date) {
4235const year = date.getFullYear();
4236const month = String(date.getMonth() + 1).padStart(2, '0');
4237const day = String(date.getDate()).padStart(2, '0');
4238return `${year}-${month}-${day}`;
4239}
4240_formatTime(date) {
4241const month = String(date.getHours()).padStart(2, '0');
4242const day = String(date.getMinutes()).padStart(2, '0');
4243return `${month}:${day}`;
4244}
4245}
4246;Model.__pN='user.SOAPayment.model';return Model;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.SOAPayment.model'),'Model',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Service' in BeeJS.package('user.SOAPayment.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var SOAPayment = BeeJS.package("user").SOAPayment;
4247class Service extends common.service.Service {
4248constructor(model) {
4249super();
4250this.config = {};
4251this.model = (model) ? model : new payment.model.Model();
4252this.modal = new common.service.Modal();
4253this.popup = new common.service.Popup();
4254}
4255async loadSlots() {
4256let id = this.model.getValue("data").ritmolog.uid;
4257let count = this.model.getValue("data").product.hours / 0.5;
4258const json = await BX.ajax.runComponentAction('integramma.slots:client.ritmolog.list', 'getRitmologSlotsGroups', {mode:'class', data:{'ritmolog_id': id, 'slots_count': count, timeStart: Date.now() + 7200000}});
4259this.model.setSlots(json.data);
4260}
4261async loadBonuses() {
4262let id = this.model.getValue("data").product.id;
4263let quantity = this.model.getValue("data").product.quantity;
4264let result = {};
4265const jsonU = await BX.ajax.runComponentAction('integramma.bonuspoint:user.points', 'getUserBonuses', {mode:"class"});
4266const jsonM = await BX.ajax.runComponentAction('integramma.bonuspoint:user.points', 'getMaxBonus', {mode:"class", data:{productId: id, quantity: quantity}});
4267result = jsonU.data;
4268result.max = (jsonM.data > result.amount) ? result.amount : jsonM.data;
4269this.model.setBonuses(result);
4270}
4271async checkForm() {
4272let result = true;
4273await this.loadSlots();
4274if(!this.model.checkSlots()) {
4275this.model.setValue("error", {}, true);
4276result = false;
4277}
4278return result;
4279}
4280async checkCoupone(value) {
4281let id = this.model.getValue("data").product.id;
4282let quantity = this.model.getValue("data").product.quantity;
4283let url = `/sale/coupone_info.php?COUPONE=${value}&product_id=${id}&quantity=${quantity}`;
4284let result = {};
4285let responce = await beeJS.Ajax.get(url);
4286let sum = Number(responce);
4287if(sum == '0') {
4288this.initPaySystems("39");
4289this.setPrice(sum);
4290result.status = true;
4291this.model.setValue("hasDiscount", true);
4292} else if(!isNaN(sum) ) {
4293this.setFormData("COUPON", value);
4294this.setPrice(sum);
4295result.status = true;
4296this.model.setValue("hasDiscount", true);
4297} else {
4298result.status = false;
4299result.text = responce;
4300}
4301return result;
4302}
4303async checkBonuses(value) {
4304let id = this.model.getValue("data").product.id;
4305let quantity = this.model.getValue("data").product.quantity;
4306const json = await BX.ajax.runComponentAction('integramma.bonuspoint:user.points', 'checkBonuspointPayment', {mode:"class", data:{
4307productId: id,
4308quantity: quantity,
4309amount: value
4310}});
4311return json.data;
4312}
4313async createOrder(psID, params) {
4314let product = this.model.getValue("data").product.id;
4315let quantity = this.model.getValue("data").product.quantity;
4316var param = {
4317data: {
4318products: [product],
4319paymentSystemId: psID,
4320payParams: {
4321successUrl: "/personal/?filter_payed=Y&filter_history=Y&section=orders",
4322failUrl: "/personal/?filter_payed=Y&filter_history=Y&section=orders"
4323},
4324userFields: {},
4325orderProperties: params,
4326productCount: quantity
4327}
4328};
4329var json = await BX.ajax.runAction('integramma:extsale.ajax.orders.create', param);
4330if (json.data && json.data.payJSON) {
4331window.location.href = order.data.payJSON.paymentURL;
4332} else {
4333var div = document.createElement("div");
4334div.innerHTML = json.data.payTempl;
4335div.children[0].removeAttribute("target");
4336document.body.appendChild(div);
4337if(div.getElementsByTagName("a")[0]) {
4338window.location.href = div.getElementsByTagName("a")[0].href;
4339} else if(div.getElementsByTagName("form")[0]) {
4340$(div.getElementsByTagName("form")[0]).submit();
4341} else {
4342document.getElementById("app").innerHTML = "";
4343document.getElementById("app").appendChild(div);
4344}
4345}
4346}
4347applyBonuses(value) {
4348let price = this.model.getValue("data")["product"]["price"];
4349if(value > 0) {
4350this.setFormData("BONUSES", value);
4351this.model.setValue("hasDiscount", true);
4352} else {
4353this.deleteFormData("BONUSES");
4354}
4355this.setPrice(price - value);
4356}
4357getSlots() {
4358return this.model.getValue("slots");
4359}
4360setFormData(id, value) {
4361let data = this.model.getValue("formdata");
4362data = (data) ? data : {};
4363data[id] = value;
4364this.model.setValue("formdata", data);
4365}
4366deleteFormData(id) {
4367let data = this.model.getValue("formdata");
4368data = (data) ? data : {};
4369delete data[id];
4370this.model.setValue("formdata", data);
4371}
4372clearFormData(selection) {
4373if(selection) {
4374let data = this.model.getValue("data");
4375let items = [];
4376switch(selection) {
4377case "fields":
4378items = ["NAME", "TYPE_CONTACT", "TYPE_MEETING", "CITY"];
4379items = items.concat(Object.keys(data.form.fields.contact));
4380break;
4381case "time":
4382items = ["DATE", "TIME", "SLOTS"];
4383break;
4384default:
4385break;
4386}
4387for(let item of items) {
4388this.deleteFormData(item);
4389}
4390} else {
4391this.model.setValue("formdata", {});
4392}
4393}
4394checkFields() {
4395let result = [];
4396let data = this.model.getValue("formdata");
4397let required = {
4398"gift": ["NAME", "TYPE_CONTACT", data["TYPE_CONTACT"]],
4399"self": ["TYPE_CONTACT", data["TYPE_CONTACT"], "TYPE_MEETING"],
4400};
4401if(data["TYPE_MEETING"] != "ONLINE") {
4402required.self.push("CITY")
4403}
4404let fields = (data["CUSTOMER"]) ? required[data["CUSTOMER"]] : required["self"];
4405for(var item of fields) {
4406if(!data[item] || data[item] === "") {
4407result.push(item);
4408}
4409}
4410return result;
4411}
4412initPaySystems(id) {
4413let data = this.model.getValue("data")["form"]["paysystems"];
4414if(id) {
4415let result = data.filter((i) => i.id === id);
4416this.model.setValue("paysystems", result, true);
4417} else {
4418let result = data.filter((i) => i.id != "39");
4419this.model.setValue("paysystems", result, true);
4420}
4421}
4422setPrice(price) {
4423this.model.setValue("price", price, true);
4424}
4425}
4426;Service.__pN='user.SOAPayment.service';return Service;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.SOAPayment.service'),'Service',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Init' in BeeJS.package('user.SOAPayment.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.SOAPayment.ui");var model = BeeJS.package("user.SOAPayment.model");var service = BeeJS.package("user.SOAPayment.service");
4427class Init {
4428constructor(element, data) {
4429this.model = new model.Model();
4430this.model.setValue("data", data);
4431this.service = new service.Service(this.model);
4432this.widget = new ui.shell.Widget({}, this.service);
4433this.widget.start(element);
4434}
4435}
4436;Init.__pN='user.SOAPayment.service';return Init;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.SOAPayment.service'),'Init',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.taplink.ui.shell')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.taplink.ui");
4437class Widget extends common.ui.widget.Widget {
4438constructor(data, service) {
4439super();
4440this._css = "user-taplink-shell";
4441this._data = service.model.getValue("data");
4442this._service = service;
4443this.setTemplate(new beeJS.Template(53, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n");let handlers = model.service.model; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__header\">\n        <h2 class=\"");html.push(css);html.push("__name\">");html.push(data.ritmolog.name);html.push("</h2>\n        <div class=\"");html.push(css);html.push("__tags\">\n            <div>");html.push(data.ritmolog.experience);html.push("&nbsp;опыта</div>\n            <div class=\"hours\">");html.push(data.ritmolog.hours);html.push("+ часов</div>\n        </div>\n    </div>\n    <div class=\"");html.push(css);html.push("__aside\">\n        <div class=\"");html.push(css);html.push("__photo\">\n            <img src=\"");html.push(data.ritmolog.image);html.push("\">\n        </div>\n        <div class=\"");html.push(css);html.push("__slots hide\">\n            <p>Ближайшее время</p>\n            <p id=\"");html.push(bindInfo.registerInBindInfo('slots'));html.push("\"></p>\n        </div>\n        <div class=\"");html.push(css);html.push("__price\">\n            <p>");html.push(((data.product.price * data.product.quantity)+"").replace(/\B(?=(\d{3})+(?!\d))/g, ' '));html.push(" ₽</p>\n            <p>Продолжительность консультации - ");html.push(handlers.pluralHours(data.product.hours * data.product.quantity));html.push("</p>\n        </div>\n        <div class=\"");html.push(css);html.push("__buttons\">\n            <a href=\"/order.php?PRODUCT_ID=");html.push(data.product.id);html.push("&section=");html.push(data.product.section);html.push("&QTY=");html.push(data.product.quantity);html.push("\"><button>
4443Оплатить</button></a>\n        </div>\n    </div>\n    <div class=\"");html.push(css);html.push("__body\">\n        ");if(data.ritmolog.description) { html.push("\n            <div class=\"");html.push(css);html.push("__description\">\n                <h4>О ритмологе</h4>\n                ");if(data.ritmolog.description.length > 200) { html.push("\n                    <div class=\"collapsed\" id=\"");html.push(bindInfo.registerInBindInfo('collapsed'));html.push("\">\n                        ");html.push(data.ritmolog.description);html.push("\n                    </div>\n                    <button id=\"");html.push(bindInfo.registerInBindInfo('expand'));html.push("\">Развернуть</button>\n                ");} else { html.push("\n                    <div>");html.push(data.ritmolog.description);html.push("</div>\n                ");} html.push("\n            </div>\n        ");} html.push("\n        <div class=\"");html.push(css);html.push("__reviews hide\">\n            <h3>Отзывы</h3>\n            <div id=\"");html.push(bindInfo.registerInBindInfo('reviews'));html.push("\"></div>\n        </div>\n        ");if(data.ritmolog.education) { html.push("\n            <div class=\"");html.push(css);html.push("__education\">\n                <h3>Образование</h3>\n                <div>");html.push(data.ritmolog.education);html.push("</div>\n            </div>\n        ");} html.push("\n        ");if(data.ritmolog.solutions.length > 0) { html.push("\n            <div class=\"");html.push(css);html.push("__solutions\">\n                <h3>Запросы</h3>\n                <ul>\n                    ");for(let item of data.ritmolog.solutions) { html.push("\n                        <li>");html.push(item);html.push("</li>\n                    ");} html.push("\n                </ul>\n            </div>\n        ");} html.push("\n    </div>\n</div>\n");return html.join('');}), {
4444css: this._css,
4445data: this._data,
4446service: this._service
4447});
4448}
4449_initControls() {
4450let expand = this._bind._expand;
4451let collapsed = this._bind._collapsed;
4452if(expand) {
4453expand.onclick = (e) => {
4454var status = collapsed.classList.contains("expanded");
4455collapsed.classList.toggle("expanded", !status);
4456expand.innerHTML = (status) ? "Развернуть" : "Cвернуть";
4457e.stopPropagation();
4458};
4459}
4460}
4461_initContent() {
4462if($("#reviews .ritmolog-reviews .item")[0]) {
4463let html = $("#reviews")[0];
4464this._bind._reviews.appendChild(html);
4465this._bind._reviews.parentNode.classList.remove("hide");
4466}
4467(async () => {
4468await this._service.loadSlots();
4469let slots = this._service.getSlots();
4470for(let i in slots) {
4471let date = this._formatDate(i);
4472let time = slots[i][0].start;
4473this._bind._slots.innerHTML = `${date} в ${time}`;
4474this._bind._slots.parentNode.classList.remove("hide");
4475break;
4476}
4477}
4477)();
4478}
4479_formatDate(date) {
4480const inputDate = new Date(date);
4481const now = new Date();
4482inputDate.setHours(0, 0, 0, 0);
4483now.setHours(0, 0, 0, 0);
4484const diff = (inputDate - now) / (1000 * 60 * 60 * 24);
4485if (diff === 0) {
4486return "Сегодня";
4487} else if (diff === 1) {
4488return "Завтра";
4489} else {
4490const day = inputDate.getDate().toString().padStart(2, '0');
4491const month = (inputDate.getMonth() + 1).toString().padStart(2, '0');
4492const year = inputDate.getFullYear();
4493return `${day}.${month}.${year}`;
4494}
4495}
4496}
4497;Widget.__pN='user.taplink.ui.shell';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.taplink.ui.shell'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Model' in BeeJS.package('user.taplink.model')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var payment = BeeJS.package("user.payment");
4498class Model extends payment.model.Model {
4499constructor() {
4500super();
4501this.values = {};
4502this.handlers = {};
4503this.config = {}
4504}
4505pluralHours(number) {
4506number = Math.abs(parseFloat(number));
4507const lastDigit = number % 10;
4508const lastTwoDigits = number % 100;
4509if (lastTwoDigits >= 11 && lastTwoDigits <= 14) {
4510return `${number} часов`;
4511}
4512if (lastDigit === 1) {
4513return `${number} час`;
4514} else if (lastDigit >= 2 && lastDigit <= 4) {
4515return `${number} часа`;
4516} else {
4517return `${number} часов`;
4518}
4519}
4520}
4521;Model.__pN='user.taplink.model';return Model;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.taplink.model'),'Model',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Service' in BeeJS.package('user.taplink.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var taplink = BeeJS.package("user.taplink");
4522class Service extends common.service.Service {
4523constructor(model) {
4524super();
4525this.config = {};
4526this.model = (model) ? model : new taplink.model.Model();
4527this.modal = new common.service.Modal();
4528this.popup = new common.service.Popup();
4529}
4530async loadSlots() {
4531let id = this.model.getValue("data").ritmolog.uid;
4532let count = this.model.getValue("data").product.hours / 0.5;
4533const json = await BX.ajax.runComponentAction('integramma.slots:client.ritmolog.list', 'getRitmologSlotsGroups', {mode:'class', data:{'ritmolog_id': id, 'slots_count': count, timeStart: Date.now() + 7200000}});
4534this.model.setSlots(json.data);
4535}
4536getSlots() {
4537return this.model.getValue("slots");
4538}
4539}
4540;Service.__pN='user.taplink.service';return Service;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.taplink.service'),'Service',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Init' in BeeJS.package('user.taplink.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.taplink.ui");var model = BeeJS.package("user.taplink.model");var service = BeeJS.package("user.taplink.service");
4541class Init {
4542constructor(element, data) {
4543this.model = new model.Model();
4544this.model.setValue("data", data);
4545this.service = new service.Service(this.model);
4546this.widget = new ui.shell.Widget({}, this.service);
4547this.widget.start(element);
4548}
4549}
4550;Init.__pN='user.taplink.service';return Init;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.taplink.service'),'Init',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.auth.ui.steps.password')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.auth.ui");
4551class Widget extends common.ui.widget.Widget {
4552constructor(data, service) {
4553super();
4554this._css = "user-auth-password";
4555this._data = data;
4556this._service = service;
4557this.setTemplate(new beeJS.Template(54, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"back\">\n        <button id=\"");html.push(bindInfo.registerInBindInfo('back'));html.push("\">Назад</button>\n    </div>\n    <h2>Войдите<br>чтобы продолжить</h2>\n    <p class=\"text\">Мы отправили код подтверждения на вашу почту. Проверьте почту и введите код ниже</p>\n    <div class=\"repeat\">\n        <input class=\"input\" type=\"text\" value=\"\" placeholder=\"Введите код из письма\" id=\"");html.push(bindInfo.registerInBindInfo('code'));html.push("\">\n        <button class=\"button secondary disabled\" id=\"");html.push(bindInfo.registerInBindInfo('repeat'));html.push("\">⟳</button>\n    </div>\n    <div class=\"comment\" id=\"");html.push(bindInfo.registerInBindInfo('comment'));html.push("\"></div>\n    <button class=\"button disabled\" id=\"");html.push(bindInfo.registerInBindInfo('action'));html.push("\">Отправить</button>\n    <div class=\"error\" id=\"");html.push(bindInfo.registerInBindInfo('error'));html.push("\"></div>\n</div>\n");return html.join('');}), {
4558css: this._css,
4559data: this._data,
4560service: this._service
4561});
4562}
4563_initListeners() {
4564this._service.model.addHandler("error", (value) => {
4565this._initError(value);
4566});
4567}
4568_initControls() {
4569this.onClick(this._bind._action, (item, i) => {
4570let value = this._bind._code.value;
4571if(!item.classList.contains("disabled") && this._validate(value)) {
4572this._apply(value);
4573}
4574});
4575this.onClick(this._bind._repeat, (item, i) => {
4576if(!item.classList.contains("disabled")) {
4577this._repeat()
4578}
4579});
4580this.onClick(this._bind._back, (item, i) => {
4581URLManager.removeURLParam("step", true);
4582});
4583this.onInput(this._bind._code, (item, i) => {
4584this._clearError();
4585this._bind._action.classList.toggle("disabled", !this._validate(item.value));
4586});
4587this. _initTimer();
4588}
4589_initTimer() {
4590let time = 60;
4591let timeout = setInterval(() => {
4592if (time <= 0) {
4593clearTimeout(timeout)
4594this._bind._comment.innerHTML = ``;
4595this._bind._repeat.classList.remove("disabled");
4596} else {
4597this._bind._comment.innerHTML = `Отправить код повторно можно через ${time--} сек.`;
4598}
4599}, 1000);
4600}
4601_initError(text) {
4602this._bind._error.innerHTML = text;
4603}
4604_clearError() {
4605this._bind._error.innerHTML = "";
4606}
4607_validate(value) {
4608if(!/^\d{4}$/.test(value)) {
4609this._initError("Код должен содержать только цифры и быть длиной 4 символа");
4610return false;
4611}
4612return true;
4613}
4614_apply(value) {
4615this._service.requestAuth(this._data.email, value);
4616}
4617_repeat() {
4618this._service.requestCode(this._data.email, true);
4619}
4620}
4621;Widget.__pN='user.auth.ui.steps.password';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.auth.ui.steps.password'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.auth.ui.steps.register')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.auth.ui");
4622class Widget extends common.ui.widget.Widget {
4623constructor(data, service) {
4624super();
4625this._css = "user-auth-register";
4626this._data = data;
4627this._service = service;
4628this.setTemplate(new beeJS.Template(55, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"back\">\n        <button id=\"");html.push(bindInfo.registerInBindInfo('back'));html.push("\">Назад</button>\n    </div>\n    <h2>Зарегистрируйтесь<br>чтобы начать</h2>\n    <input class=\"input\" type=\"text\" value=\"\" placeholder=\"Имя\" id=\"");html.push(bindInfo.registerInBindInfo('name'));html.push("\">\n    <input class=\"input\" type=\"text\" value=\"\" placeholder=\"Фамилия\" id=\"");html.push(bindInfo.registerInBindInfo('lastname'));html.push("\">\n    <input class=\"input\" type=\"text\" value=\"");html.push(data.email);html.push("\" disabled>\n    <input class=\"input\" type=\"text\" value=\"\" placeholder=\"Номер телефона (не обязательно)\" id=\"");html.push(bindInfo.registerInBindInfo('phone'));html.push("\">\n    <div class=\"line\"></div>\n    <p class=\"text\">Мы отправили код подтверждения на вашу почту. Проверьте почту и введите код ниже</p>\n    <div class=\"repeat\">\n        <input class=\"input\" type=\"text\" value=\"\" placeholder=\"Введите код из письма\" id=\"");html.push(bindInfo.registerInBindInfo('code'));html.push("\">\n        <button class=\"button secondary disabled\" id=\"");html.push(bindInfo.registerInBindInfo('repeat'));html.push("\">⟳</button>\n    </div>\n    <div class=\"comment\" id=\"");html.push(bindInfo.registerInBindInfo('comment'));html.push("\"></div>\n    <button class=\"button disabled\" id=\"");html.push(bindInfo.registerInBindInfo('action'));html.push("\">Зарегистрироваться</button>\n    <div class=\"error\" id=\"");html.push(bindInfo.registerInBindInfo('error'));html.push("\"></div>\n    <div>\n        <p>Нажимая Зарегистрироваться, вы соглашаетесь с <a href=\"/docs/agreements/personal.pdf\" rel=\"nofollow\">Политикой обработки персональных данных</a> и соглашаюсь с получением электронных писем</p>\n    </div>\n</div>\n");return html.join('');}), {
4629css: this._css,
4630data: this._data,
4631service: this._service
4632});
4633}
4634_initListeners() {
4635this._service.model.addHandler("error", (value) => {
4636this._initError(value);
4637});
4638}
4639_initControls() {
4640this.onClick(this._bind._action, (item, i) => {
4641let name = this._bind._name.value;
4642let lastname = this._bind._lastname.value;
4643let phone = this._bind._phone.value;
4644let code = this._bind._code.value;
4645if(!item.classList.contains("disabled") && this._isValid()) {
4646this._apply(name, lastname, phone, code);
4647}
4648});
4649this.onClick(this._bind._repeat, (item, i) => {
4650if(!item.classList.contains("disabled")) {
4651item.classList.add("disabled");
4652this._repeat()
4653this._initTimer();
4654}
4655});
4656this.onClick(this._bind._back, (item, i) => {
4657URLManager.removeURLParam("step", true);
4658});
4659this.onInput(this._bind._name, (item, i) => {
4660this._clearError();
4661this._validate(item.value, "name");
4662this._bind._action.classList.toggle("disabled", !this._isValid());
4663});
4664this.onInput(this._bind._lastname, (item, i) => {
4665this._clearError();
4666this._validate(item.value, "lastname");
4667this._bind._action.classList.toggle("disabled", !this._isValid());
4668});
4669this.onInput(this._bind._phone, (item, i) => {
4670this._clearError();
4671this._validate(item.value, "phone");
4672this._bind._action.classList.toggle("disabled", !this._isValid());
4673});
4674this.onInput(this._bind._code, (item, i) => {
4675this._clearError();
4676this._validate(item.value, "code");
4677this._bind._action.classList.toggle("disabled", !this._isValid());
4678});
4679this. _initTimer();
4680}
4681_initTimer() {
4682let time = 60;
4683let timeout = setInterval(() => {
4684if (time <= 0) {
4685clearTimeout(timeout)
4686this._bind._comment.innerHTML = ``;
4687this._bind._repeat.classList.remove("disabled");
4688} else {
4689this._bind._comment.innerHTML = `Отправить код повторно можно через ${time--} сек.`;
4690}
4691}, 1000);
4692}
4693_initError(text) {
4694this._bind._error.innerHTML = text;
4695this._bind._error.classList.add("active");
4696}
4697_clearError() {
4698this._bind._error.innerHTML = "";
4699this._bind._error.classList.remove("active");
4700}
4701_validate(value, type, silent) {
4702if(type == "name" ) {
4703if(value.length < 2) {
4704if(!silent) {
4705this._initError("Имя должно содержать минимум 2 буквы");
4706}
4707return false;
4708}
4709if(/\d/.test(value)) {
4710if(!silent) {
4711this._initError("Имя должно содержать только буквы");
4712}
4713return false;
4714}
4715}
4716if(type == "lastname") {
4717if(value.length < 2) {
4718if(!silent) {
4719this._initError("Фамилия должна содержать минимум 2 буквы");
4720}
4721return false;
4722}
4723if(/\d/.test(value)) {
4724if(!silent) {
4725this._initError("Фамилия должна содержать только буквы");
4726}
4727return false;
4728}
4729}
4730const regex = /^(\+7|8)[\s\-]?\(?\d{3}\)?[\s\-]?\d{3}[\s\-]?\d{2}[\s\-]?\d{2}$/;
4731if(type == "phone" && (value && !regex.test(value))) {
4732if(!silent) {
4733this._initError("Введите корректный номер телефона");
4734}
4735return false;
4736}
4737if(type == "code") {
4738if(!/^\d{4}$/.test(value)) {
4739if(!silent) {
4740this._initError("Код должен содержать только цифры и быть длиной 4 символа");
4741}
4742return false;
4743}
4744}
4745return true;
4746}
4747_isValid() {
4748let name = this._bind._name.value;
4749let lastname = this._bind._lastname.value;
4750let phone = this._bind._phone.value;
4751let code = this._bind._code.value;
4752return this._validate(name, "name", true) && this._validate(lastname, "lastname", true) && this._validate(phone, "phone", true) && this._validate(code, "code", true);
4753}
4754_apply(name, lastname, phone, code) {
4755this._service.requestRegister(name, lastname, this._data.email, phone, code);
4756}
4757_repeat() {
4758this._service.requestCode(this._data.email, true);
4759}
4760}
4761;Widget.__pN='user.auth.ui.steps.register';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.auth.ui.steps.register'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.auth.ui.steps.login')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.auth.ui");
4762class Widget extends common.ui.widget.Widget {
4763constructor(data, service) {
4764super();
4765this._css = "user-auth-login";
4766this._data = data;
4767this._service = service;
4768this.setTemplate(new beeJS.Template(56, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n");let s = (window.location.search.length > 1) ? "&" : "?";let url = window.location.href + s + "AUTH=Y";html.push("\n<div class=\"");html.push(css);html.push("\">\n    <h2>Войдите<br>чтобы продолжить</h2>\n    <input type=\"text\" value=\"\" placeholder=\"Введите адрес электронной почты\" id=\"");html.push(bindInfo.registerInBindInfo('email'));html.push("\">\n    <button id=\"");html.push(bindInfo.registerInBindInfo('action'));html.push("\">Продолжить</button>\n    <div class=\"error\" id=\"");html.push(bindInfo.registerInBindInfo('error'));html.push("\"></div>\n    <div class=\"line\"></div>\n    <a class=\"button\" href=\"");html.push(url);html.push("\" rel=\"nofollow\">Войти с паролем</a>\n    <div>\n        <p>Нажимая Продолжить, вы соглашаетесь с <a href=\"/docs/agreements/personal.pdf\" rel=\"nofollow\" target=\"_blank\">Политикой обработки персональных данных</a> и получением электронных писем</p>\n    </div>\n</div>\n");return html.join('');}), {
4769css: this._css,
4770data: this._data,
4771service: this._service
4772});
4773}
4774_initListeners() {
4775this._service.model.addHandler("error", (value) => {
4776this._initError(value);
4777});
4778}
4779_initControls() {
4780this.onClick(this._bind._action, (item, i) => {
4781let value = this._bind._email.value;
4782if(this._validate(value)) {
4783this._apply(value);
4784}
4785});
4786this.onInput(this._bind._email, (item, i) => {
4787this._clearError();
4788this._validate(item.value);
4789});
4790}
4791_initError(text) {
4792this._bind._error.innerHTML = text;
4793this._bind._error.classList.add("active");
4794}
4795_clearError() {
4796this._bind._error.innerHTML = "";
4797this._bind._error.classList.remove("active");
4798}
4799_validate(value) {
4800if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
4801this._initError("Введите корректный адрес электронной почты");
4802return false;
4803}
4804return true;
4805}
4806_apply(value) {
4807this._service.requestCode(value);
4808}
4809}
4810;Widget.__pN='user.auth.ui.steps.login';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.auth.ui.steps.login'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.auth.ui.shell')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.auth.ui");
4811class Widget extends common.ui.widget.Widget {
4812constructor(data, service) {
4813super();
4814this._css = "user-auth-shell";
4815this._data = service.model.getValue("data");
4816this._service = service;
4817this.setTemplate(new beeJS.Template(57, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n<div class=\"");html.push(css);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('content'));html.push("\"></div>\n");return html.join('');}), {
4818css: this._css,
4819data: this._data,
4820service: this._service
4821});
4822}
4823_initListeners() {
4824this._service.model.addHandler("step", (value) => {
4825switch(value) {
4826case "code":
4827this._initCode();
4828break
4829case "register":
4830this._initRegister();
4831break
4832default:
4833this._initEmail();
4834break
4835}
4836});
4837}
4838_initContent() {
4839this._initEmail();
4840}
4841_initEmail() {
4842const widget = new ui.steps.login.Widget({}, this._service);
4843this._initWidget(this._bind._content, widget);
4844}
4845_initCode() {
4846let email = this._service.getEmail();
4847const widget = new ui.steps.password.Widget({email: email}, this._service);
4848this._initWidget(this._bind._content, widget);
4849}
4850_initRegister() {
4851let email = this._service.getEmail();
4852const widget = new ui.steps.register.Widget({email: email}, this._service);
4853this._initWidget(this._bind._content, widget);
4854}
4855}
4856;Widget.__pN='user.auth.ui.shell';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.auth.ui.shell'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Model' in BeeJS.package('user.auth.model')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");
4857class Model extends common.model.Model {
4858constructor() {
4859super();
4860this.values = {};
4861this.handlers = {};
4862this.config = {}
4863}
4864setAnswer(data, email, isRepeat) {
4865this.setValue("email", email, true);
4866if(data === "User not active") {
4867this.model.setValue("error", "Пожалуйста, обратитесь в Техподдержку.", true);
4868return false
4869}
4870switch(data.action) {
4871case "Login":
4872URLManager.setURLParam("step", "code", !isRepeat);
4873break
4874case "Register":
4875URLManager.setURLParam("step", "register", !isRepeat);
4876break
4877default:
4878break
4879}
4880if("codeSendStatus" in data && !data.codeSendStatus) {
4881this.setValue("error", "Не удалось отправить письмо. Пожалуйста, попробуйте снова или обратитесь в Техподдержку.");
4882}
4883}
4884}
4885;Model.__pN='user.auth.model';return Model;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.auth.model'),'Model',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Service' in BeeJS.package('user.auth.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var auth = BeeJS.package("user.auth");
4886class Service extends common.service.Service {
4887constructor(model) {
4888super();
4889this.config = {};
4890this.model = (model) ? model : new auth.model.Model();
4891this.modal = new common.service.Modal();
4892this.popup = new common.service.Popup();
4893URLManager.removeURLParam("step");
4894this._initURLParams();
4895}
4896async requestCode(email, isRepeat) {
4897let json;
4898try {
4899json = await BX.ajax.runComponentAction('integramma:fast.login', 'sendCode', {mode:'class', data: {email: email}});
4900} catch (e) {
4901this._handleError(e?.errors[0]?.message);
4902}
4903if(json) {
4904this.model.setAnswer(json.data, email, isRepeat);
4905}
4906}
4907async requestAuth(email, code) {
4908let json = await BX.ajax.runComponentAction('integramma:fast.login', 'login', {mode:'class', data:{email: email, code: code}});
4909this._checkAuth(json.data);
4910}
4911async requestRegister(name, lastname, email, phone, code) {
4912try {
4913let json = await BX.ajax.runComponentAction('integramma:fast.login', 'register', {mode:'class', data:{email: email, name: name, lastName: lastname, secondName: "", phone: phone, code: code}});
4914this._checkRegister(json.data);
4915} catch (e) {
4916this.model.setValue("error", e?.errors[0]?.message, true);
4917}
4918}
4919getEmail() {
4920return this.model.getValue("email");
4921}
4922_checkAuth(value) {
4923if(value === "Invalid Code" || value) {
4924this._handleError(value);
4925} else {
4926window.location.reload();
4927}
4928}
4929_checkRegister(value) {
4930if(value === "Invalid Code" || value === "User is exist") {
4931this._handleError(value);
4932} else {
4933window.location.reload();
4934}
4935}
4936_handleError(value) {
4937let error = "";
4938switch(value) {
4939case "Invalid Code":
4940error = "Неверный код. Пожалуйста, проверьте код и попробуйте снова.";
4941break
4942case "User is exist":
4943error = "Пожалуйста, обратитесь в Техподдержку.";
4944break
4945case "User not active":
4946error = "Учётная запись не активна. Обратитесь в техподдержку.";
4947break
4948case "Отправка кода повторно будет возможна через #TIME# сек.":
4949error = "Отправить код повторно можно через 60 секунд";
4950break
4951default:
4952error = value;
4953break
4954}
4955this.model.setValue("error", error, true);
4956}
4957_initURLParams() {
4958URLManager.addHashChangeHandler(() => {
4959var params = URLManager.getURLParams();
4960this.model.setValue("step", params["step"], true);
4961});
4962}
4963}
4964;Service.__pN='user.auth.service';return Service;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.auth.service'),'Service',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Init' in BeeJS.package('user.auth.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.auth.ui");var model = BeeJS.package("user.auth.model");var service = BeeJS.package("user.auth.service");
4965class Init {
4966constructor(element, data) {
4967this.model = new model.Model();
4968this.model.setValue("data", data);
4969this.service = new service.Service(this.model);
4970this.widget = new ui.shell.Widget({}, this.service);
4971this.widget.start(element);
4972}
4973}
4974;Init.__pN='user.auth.service';return Init;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.auth.service'),'Init',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.empty.ui.shell')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");
4975class Widget extends common.ui.widget.Widget {
4976constructor(data, service) {
4977super();
4978this._css = "user-empty-shell";
4979this._data = data;
4980this._service = service;
4981this.setTemplate(new beeJS.Template(58, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div></div>\n    <div>\n        <p>Здесь ещё ничего нет</p>\n    </div>\n    <div>\n        <a href=\"/catalog/consultation/\">Перейти в каталог</a>\n    </div>\n</div>\n");return html.join('');}), {
4982css: this._css,
4983data: this._data
4984});
4985}
4986}
4987;Widget.__pN='user.empty.ui.shell';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.empty.ui.shell'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.payment.ui.paysystems')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.payment.ui");
4988class Widget extends common.ui.widget.Widget {
4989constructor(data, service) {
4990super();
4991this._css = "user-payment-paysystems";
4992this._data = data;
4993this._service = service;
4994this.setTemplate(new beeJS.Template(59, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n\n<div class=\"");html.push(css);html.push("\" id=\"");html.push(bindInfo.registerInBindInfo('block'));html.push("\">\n    <div class=\"");html.push(css);html.push("__header\">\n        <h4>Выберите способ оплаты</h4>\n    </div>\n    <div class=\"");html.push(css);html.push("__list\">\n        ");for(let paysystem of data) { html.push("\n            <div class=\"");html.push(css);html.push("__item\">\n                <label>\n                    <div>");html.push(paysystem.name);html.push("</div>\n                    <input type=\"radio\" id=\"");html.push(bindInfo.registerInBindInfo('paysystem'));html.push("\" name=\"paysystem\" value=\"");html.push(paysystem.id);html.push("\">\n                    ");if(paysystem.image) { html.push("\n                        <div>\n                            <img src='");html.push(paysystem.image);html.push("' alt='");html.push(paysystem.name);html.push("' />\n                        </div>\n                    ");} html.push("\n                </label>\n            </div>\n        ");} html.push("\n    </div>\n</div>\n");return html.join('');}), {
4995css: this._css,
4996data: this._data
4997});
4998}
4999_initControls() {
5000if (this._bind._block) {
5001let paysystems = beeJS.ArrayUtil.asArray(this._bind._paysystem);
5002paysystems.forEach((item, i) => {
5003item.onchange = (e) => {
5004paysystems.forEach((j, i) => {
5005j.parentNode.classList.remove("active");
5006});
5007item.parentNode.classList.add("active");
5008this._service.model.setActivePayment(item.value);
5009};
5010});
5011this._presetControls();
5012}
5013}
5014_presetControls() {
5015let input = document.querySelector("." + this._css + "__item > label > input");
5016input.setAttribute("checked", true);
5017input.dispatchEvent(new Event("change"));
5018}
5019}
5020;Widget.__pN='user.payment.ui.paysystems';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.payment.ui.paysystems'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.payment.ui.form')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.payment.ui");
5021class Widget extends common.ui.widget.Widget {
5022constructor(data, service) {
5023super();
5024this._css = "user-payment-form";
5025this._data = data;
5026this._service = service;
5027this.setTemplate(new beeJS.Template(60, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__wrap\">\n        <div>\n            <h3>К оплате</h3>\n            <div class=\"");html.push(css);html.push("__price\">\n                <div id=\"");html.push(bindInfo.registerInBindInfo('price'));html.push("\">");html.push(data.price);html.push(" ₽</div>\n                <div id=\"");html.push(bindInfo.registerInBindInfo('old'));html.push("\"></div>\n            </div>\n        </div>\n        <div>\n            <form name='");html.push(data.id);html.push("' method='post' action=''>\n                <input class='");html.push(css);html.push("__button' type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('pay'));html.push("\" value='Оплатить'/>\n                <label class='");html.push(css);html.push("__argee'>\n                    <input type=\"checkbox\" name='agree' required>\n                    <span>Я согласен с&nbsp;</span>\n                    <a href='/docs/offer' target='_blank'>условиями оплаты</a>\n                </label>\n            </form>\n        </div>\n    </div>\n</div>\n");return html.join('');}), {
5028css: this._css,
5029data: this._data
5030});
5031}
5032_initListeners() {
5033this._service.model.addHandler("activeDiscount", (value) => {
5034this._bind._old.innerHTML = this._data.price+" ₽";
5035this._bind._price.innerHTML = (this._data.price - value)+" ₽";
5036});
5037}
5038_initControls() {
5039this._bind._pay.onclick = (e) => {
5040if (this._checkAgree()) {
5041this._sendForm();
5042}
5043e.stopPropagation();
5044};
5045}
5046_checkAgree() {
5047let result = true;
5048if (!$("[name=agree]")[0].checked) {
5049$("[name=agree]").parent().addClass("error");
5050result = false;
5051}
5052let actionOut = () => {
5053$(".error").removeClass("error");
5054document.removeEventListener("click", actionOut);
5055};
5056document.addEventListener("click", actionOut);
5057return result;
5058}
5059async _sendForm() {
5060this._bind._pay.setAttribute("disabled", true);
5061this._service.createOrder();
5062}
5063}
5064;Widget.__pN='user.payment.ui.form';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.payment.ui.form'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.payment.ui.bonuses')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.payment.ui");
5065class Widget extends common.ui.widget.Widget {
5066constructor(data, service) {
5067super();
5068this._css = "user-payment-bonuses";
5069this._data = data;
5070this._service = service;
5071this.setTemplate(new beeJS.Template(61, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__header\">\n        <h4>Использовать бонусные баллы</h4>\n        <p>У вас на счёте <strong>");html.push(data.value);html.push(" баллов</strong></p>\n        <p>Вы можете потратить до <strong>");html.push(data.max);html.push(" баллов</strong> в этом заказе</p>\n    </div>\n    <div class=\"");html.push(css);html.push("__form\">\n        <div class=\"");html.push(css);html.push("__input\">\n            <input type=\"text\" placeholder=\"\" autocomplete=\"off\" id=\"");html.push(bindInfo.registerInBindInfo('input'));html.push("\">\n        </div>\n        <button type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('action'));html.push("\">Применить</button>\n    </div>\n    <div class=\"");html.push(css);html.push("__error\" id=\"");html.push(bindInfo.registerInBindInfo('error'));html.push("\"></div>\n</div>\n");return html.join('');}), {
5072css: this._css,
5073data: this._data
5074});
5075}
5076_initControls() {
5077const item = this._bind._action;
5078item.onclick = async (e) => {
5079this._bind._error.innerHTML = "";
5080let value = this._bind._input.value;
5081if(this._validate(value) && await this._check(value)) {
5082this._apply(this._bind._input.value);
5083}
5084}
5085}
5086_initError(text) {
5087this._bind._error.innerHTML = text;
5088}
5089_validate(value) {
5090if(!/^\d+$/.test(value)) {
5091this._initError("Некорректное значение количества баллов");
5092return false;
5093}
5094if(parseInt(value, 10) > this._data.max) {
5095this._initError("Указано больше баллов, чем доступно для оплаты");
5096return false;
5097}
5098if(this._service.isCouponActive()) {
5099this._initError("Нельзя применить купон на скидку и оплатить заказ баллами одновременно");
5100return false;
5101}
5102return true;
5103}
5104_apply(value) {
5105if(value > 0) {
5106this._service.useBonuses(value);
5107}
5108}
5109async _check(value) {
5110let data = {
5111"E01": "Нет бонусных баллов",
5112"E02": "Недостаточно баллов для оплаты",
5113"E03": "Превышено кол-во баллов, доступное для оплаты заказа",
5114"E04": "Некорректное значение количества баллов"
5115}
5116let result = true;
5117let response = await this._service.checkBonuses(value);
5118if(response.Result === "Error") {
5119this._initError(data[response.Code]);
5120result = false;
5121}
5122return result;
5123}
5124}
5125;Widget.__pN='user.payment.ui.bonuses';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.payment.ui.bonuses'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.payment.ui.shell')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.payment.ui");
5126class Widget extends common.ui.widget.Widget {
5127constructor(data, service) {
5128super();
5129this._css = "user-payment-shell";
5130this._data = data;
5131this._service = service;
5132this.setTemplate(new beeJS.Template(62, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n\n<div class=\"");html.push(css);html.push(" ");html.push(data.modal ? '' : css + '--long');html.push("\">\n    <div class=\"");html.push(css);html.push("__error\" id=\"");html.push(bindInfo.registerInBindInfo('error'));html.push("\"></div>\n    <div class=\"");html.push(css);html.push("__wrap\" id=\"");html.push(bindInfo.registerInBindInfo('block'));html.push("\">\n        <div class=\"");html.push(css);html.push("__paysystems\" id=\"");html.push(bindInfo.registerInBindInfo('paysystems'));html.push("\"></div>\n        <div class=\"");html.push(css);html.push("__coupon\" id=\"");html.push(bindInfo.registerInBindInfo('coupon'));html.push("\"></div>\n        <div class=\"");html.push(css);html.push("__bonuses\" id=\"");html.push(bindInfo.registerInBindInfo('bonuses'));html.push("\"></div>\n        <div class=\"");html.push(css);html.push("__form\" id=\"");html.push(bindInfo.registerInBindInfo('form'));html.push("\"></div>\n    </div>\n</div>\n");return html.join('');}), {
5133css: this._css,
5134data: this._data,
5135});
5136}
5137_init() {
5138this._initListeners();
5139this._service.initDefault();
5140this._service.initProduct();
5141this._service.loadPaySystems();
5142this._service.loadBonuses();
5143}
5144_initListeners() {
5145this._service.model.addHandler("product", (data) => {
5146this._initForm(data);
5147});
5148this._service.model.addHandler("paySystems", (data) => {
5149this._initPaySystems(data);
5150});
5151this._service.model.addHandler("couponPaySystem", (status) => {
5152if(status === true) {
5153this._initCoupon();
5154}
5155});
5156this._service.model.addHandler("bonuses", (data) => {
5157this._initBonuses(data);
5158});
5159this._service.model.addHandler("error", (data) => {
5160this._initError(data);
5161});
5162}
5163_initForm(data) {
5164const widget = new ui.form.Widget(data, this._service);
5165this._initWidget(this._bind._form, widget);
5166}
5167_initPaySystems(data) {
5168const widget = new ui.paysystems.Widget(data, this._service);
5169this._initWidget(this._bind._paysystems, widget);
5170}
5171_initBonuses(data) {
5172const widget = new ui.bonuses.Widget(data, this._service);
5173this._initWidget(this._bind._bonuses, widget);
5174}
5175_initCoupon(data) {
5176const widget = new ui.coupon.Widget(data, this._service);
5177this._initWidget(this._bind._coupon, widget);
5178}
5179_initError(data) {
5180if(data.message) {
5181const div = document.createElement("div");
5182let widget = new ui.error.Widget(data.message, this._service);
5183this._bind._error.appendChild(div);
5184widget.start(div);
5185}
5186if (data.broken) {
5187this._bind._block.innerHTML = "";
5188}
5189}
5190}
5191;Widget.__pN='user.payment.ui.shell';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.payment.ui.shell'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.payment.ui.error')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.payment.ui");
5192class Widget extends common.ui.widget.Widget {
5193constructor(data, service) {
5194super();
5195this._css = "user-payment-error";
5196this._data = data;
5197this._service = service;
5198this.setTemplate(new beeJS.Template(63, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__error\">");html.push(data);html.push("</div>\n</div>\n");return html.join('');}), {
5199css: this._css,
5200data: this._data
5201});
5202}
5203}
5204;Widget.__pN='user.payment.ui.error';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.payment.ui.error'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.payment.ui.coupon')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var ui = BeeJS.package("user.payment.ui");
5205class Widget extends common.ui.widget.Widget {
5206constructor(data, service) {
5207super();
5208this._css = "user-payment-coupon";
5209this._data = data;
5210this._service = service;
5211this.setTemplate(new beeJS.Template(64, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n");let data = model.data; html.push("\n\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__header\">\n        <h4>Использовать купон на скидку</h4>\n    </div>\n    <div class=\"");html.push(css);html.push("__form\">\n        <div class=\"");html.push(css);html.push("__input\">\n            <input type=\"text\" placeholder=\"Введите купон\" autocomplete=\"off\" id=\"");html.push(bindInfo.registerInBindInfo('input'));html.push("\">\n        </div>\n        <button type=\"button\" id=\"");html.push(bindInfo.registerInBindInfo('action'));html.push("\">Применить купон</button>\n    </div>\n    <div class=\"");html.push(css);html.push("__error\" id=\"");html.push(bindInfo.registerInBindInfo('error'));html.push("\"></div>\n</div>\n");return html.join('');}), {
5212css: this._css,
5213data: this._data
5214});
5215}
5216_initControls() {
5217const item = this._bind._action;
5218item.onclick = () => {
5219if(!item.classList.contains("disabled")) {
5220this._bind._input.value = this._validateCoupon(this._bind._input.value);
5221item.classList.add("disabled");
5222if(this._service.isDiscountActive()) {
5223this._initError("Нельзя применить купон на скидку и оплатить заказ баллами одновременно");
5224} else if(this._bind._input.value != "") {
5225this._checkCoupon(this._bind._input.value);
5226} else {
5227this._initError("Купон не введён");
5228}
5229item.classList.remove("disabled");
5230}
5231};
5232}
5233_validateCoupon(value) {
5234let result = "";
5235for(let i = 0; i < value.length; i++) {
5236if(value[i].match(/[a-z0-9_\-\+]+/i)) {
5237result += value[i];
5238}
5239}
5240return result;
5241}
5242async _checkCoupon(value) {
5243let result = await this._service.checkCoupon(value);
5244if(result.status) {
5245this._initSuccess(result.text);
5246} else {
5247this._initError(result.text);
5248}
5249}
5250_initSuccess() {
5251this._bind._action.innerHTML = "Купон применен";
5252this._bind._action.classList.add("disabled");
5253this._bind._input.setAttribute("disabled", "disabled");
5254}
5255_initError(text) {
5256this._bind._error.innerHTML = text;
5257}
5258}
5259;Widget.__pN='user.payment.ui.coupon';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.payment.ui.coupon'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Model' in BeeJS.package('user.payment.model')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");
5260class Model extends common.model.Model {
5261constructor() {
5262super();
5263this.values = {};
5264this.handlers = {};
5265this.config = {}
5266}
5267setProduct(data = {}) {
5268if (!data?.product?.id) {
5269this.setError("В платежную форму не передан айди продукта", true);
5270}
5271if (!data?.product?.price) {
5272this.setError("В платежную форму не передана цена продукта", true);
5273}
5274if (!data?.product?.quantity) {
5275this.setError("В платежную форму не передано количество продукта", true);
5276}
5277if (!data?.product?.name) {
5278this.setError("В платежную форму не передано имя продукта", true);
5279}
5280this.setValue("product", data.product, true);
5281}
5282setActiveDiscount(discountPrice = 0) {
5283this.setValue("activeDiscount", discountPrice, true);
5284}
5285setActiveCoupon(coupon = "") {
5286this.setValue("activeCoupon", coupon, true);
5287}
5288setActivePayment(id = 0) {
5289this.setValue("activePaySystem", id, true);
5290}
5291getCouponPaySystemId() {
5292return "39";
5293}
5294setError(message = "", broken = false) {
5295const data = {
5296message,
5297broken
5298}
5299this.setValue("error", data, true);
5300}
5301setCouponPaySystem(status = false) {
5302this.setValue("couponPaySystem", status, true);
5303}
5304setPaySystems(data = {}) {
5305let paySystems = [];
5306for (let id in data) {
5307const paySystem = data[id];
5308if (paySystem.PS_ID === this.getCouponPaySystemId()) {
5309this.setCouponPaySystem(true);
5310continue;
5311}
5312paySystems.push({
5313id: paySystem.PS_ID,
5314name: paySystem.NAME,
5315image: paySystem.LOGO,
5316})
5317}
5318paySystems.sort((a, b) => a.name.localeCompare(b.name, 'ru'));
5319this.setValue("paySystems", paySystems, true);
5320}
5321setBonuses(data = {}) {
5322const bonuses = {
5323active: data.payment_enable,
5324value: data.amount,
5325max: data.max
5326};
5327this.setValue("bonuses", bonuses, true);
5328}
5329}
5330;Model.__pN='user.payment.model';return Model;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.payment.model'),'Model',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Service' in BeeJS.package('user.payment.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");var payment = BeeJS.package("user.payment");
5331class Service extends common.service.Service {
5332constructor(model) {
5333super();
5334this.config = {};
5335this.model = (model) ? model : new payment.model.Model();
5336this.modal = new common.service.Modal();
5337this.popup = new common.service.Popup();
5338}
5339initDefault() {
5340this.model.setError();
5341this.model.setActiveDiscount();
5342this.model.setActiveCoupon();
5343this.model.setActivePayment();
5344}
5345initProduct() {
5346const data = this.model.getValue("data");
5347this.model.setProduct(data);
5348}
5349isDiscountActive() {
5350return this.model.getValue("activeDiscount") > 0;
5351}
5352isCouponActive() {
5353return this.model.getValue("activeCoupon") !== "";
5354}
5355useBonuses(value = 0) {
5356this.model.setActiveDiscount(value);
5357}
5358useCoupon(value = 0, coupon = "") {
5359if (!this.isCouponActive()) {
5360this.model.setActiveDiscount(value);
5361this.model.setActiveCoupon(coupon);
5362}
5363}
5364async createOrder() {
5365const product = this.model.getValue("product");
5366const discount = this.model.getValue("activeDiscount");
5367const coupon = this.model.getValue("activeCoupon");
5368const psID = this.model.getValue("activePaySystem");
5369let properties = [];
5370if (this.isDiscountActive() && !this.isCouponActive()) {
5371properties.push({ "ID": "164", "VALUE": discount });
5372}
5373let response = {};
5374if (this.isCouponActive()) {
5375response = await BX.ajax.runAction('integramma:extsale.ajax.orders.createWithCoupon', {
5376data: {
5377products: [ product.id ],
5378paymentSystemId: psID,
5379payParams: {
5380successUrl: "/personal/?filter_payed=Y&filter_history=Y&section=orders",
5381failUrl: "/personal/?filter_payed=Y&filter_history=Y&section=orders"
5382},
5383userFields: {},
5384orderProperties: properties,
5385productCount: product.quantity,
5386coupon: coupon
5387}
5388});
5389} else {
5390let params = {
5391data: {
5392products: [ product.id ],
5393paymentSystemId: psID,
5394payParams: {
5395successUrl: "/personal/?filter_payed=Y&filter_history=Y&section=orders",
5396failUrl: "/personal/?filter_payed=Y&filter_history=Y&section=orders"
5397},
5398userFields: {},
5399orderProperties: properties,
5400productCount: product.quantity,
5401}
5402};
5403response = await BX.ajax.runAction('integramma:extsale.ajax.orders.create', params);
5404}
5405this.goToPay(response);
5406this.closeModal();
5407}
5408goToPay(json) {
5409if (json.data && json.data.payJSON) {
5410window.location.href = order.data.payJSON.paymentURL;
5411} else {
5412let div = document.createElement("div");
5413div.innerHTML = json.data.payTempl;
5414div.children[0]?.removeAttribute("target");
5415document.body.appendChild(div);
5416if (div.getElementsByTagName("a")[0]) {
5417window.location.href = div.getElementsByTagName("a")[0].href;
5418} else if (div.getElementsByTagName("form")[0]) {
5419$(div.getElementsByTagName("form")[0]).submit();
5420}
5421}
5422}
5423closeModal() {
5424const modalId = this.model.getValue("data").modal;
5425if(modalId) {
5426this.modal.descruct(modalId);
5427}
5428}
5429async loadPaySystems() {
5430const product = this.model.getValue("product");
5431const param = {
5432data: {
5433products: [ product.id ],
5434}
5435};
5436const response = await BX.ajax.runAction('integramma:extsale.ajax.orders.paymentSystemList', param);
5437if (response.status !== "success") {
5438this.model.setError("При загрузке платежной системы, произошла ошибка", true);
5439}
5440if (!response.data.PAY_SYSTEMS) {
5441this.model.setError("При загрузке платежной системы, произошла ошибка");
5442}
5443this.model.setPaySystems(response.data.PAY_SYSTEMS);
5444}
5445async loadBonuses() {
5446const product = this.model.getValue("product");
5447const userBonusesResponse = await BX.ajax.runComponentAction('integramma.bonuspoint:user.points', 'getUserBonuses', {
5448mode: "class"
5449});
5450const maxBonusesResponse = await BX.ajax.runComponentAction('integramma.bonuspoint:user.points', 'getMaxBonus', {
5451mode: "class",
5452data: { productId: product.id, quantity: product.quantity }
5453});
5454if (userBonusesResponse.status !== "success" || maxBonusesResponse.status !== "success") {
5455return;
5456}
5457if (!userBonusesResponse.data || !maxBonusesResponse.data) {
5458return;
5459}
5460let bonuses = userBonusesResponse.data;
5461let max = maxBonusesResponse.data;
5462bonuses.max = (max > bonuses.amount) ? bonuses.amount : max;
5463this.model.setBonuses(bonuses);
5464}
5465async checkBonuses(value) {
5466const product = this.model.getValue("product");
5467const response = await BX.ajax.runComponentAction('integramma.bonuspoint:user.points', 'checkBonuspointPayment', {
5468mode: "class",
5469data: {
5470productId: product.id,
5471quantity: product.quantity,
5472amount: value
5473}
5474});
5475if (response.status !== "success") {
5476this.model.setError("При проверке бонусов, произошла ошибка", true);
5477}
5478return response.data
5479}
5480async checkCoupon(coupon) {
5481const product = this.model.getValue("product");
5482let url = `/sale/coupone_info.php?COUPONE=${coupon}&product_id=${product.id}&quantity=${product.quantity}`;
5483let result = {};
5484let responce = await beeJS.Ajax.get(url);
5485let sum = Number(responce);
5486if (sum == '0') {
5487console.error("Нельзя оплатить всю сумму купоном")
5488result.status = true;
5489} else if (!isNaN(sum)) {
5490this.useCoupon(product.price - sum, coupon);
5491result.status = true;
5492} else {
5493result.status = false;
5494result.text = responce;
5495}
5496return result;
5497}
5498}
5499;Service.__pN='user.payment.service';return Service;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.payment.service'),'Service',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Init' in BeeJS.package('user.payment.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var model = BeeJS.package("user.payment.model");var service = BeeJS.package("user.payment.service");var ui = BeeJS.package("user.payment.ui");
5500class Init {
5501constructor(element, data) {
5502this.model = new model.Model();
5503this.model.setValue("data", data);
5504this.service = new service.Service(this.model);
5505this.widget = new ui.shell.Widget({}, this.service);
5506this.widget.start(element);
5507}
5508}
5509;Init.__pN='user.payment.service';return Init;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.payment.service'),'Init',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('RenewProductService' in BeeJS.package('user.payment.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var payment = BeeJS.package("user.payment");
5510class RenewProductService extends payment.service.Service {
5511constructor(model) {
5512super();
5513this.config = {};
5514this.model = (model) ? model : new payment.model.Model();
5515this.modal = new common.service.Modal();
5516this.popup = new common.service.Popup();
5517}
5518async createOrder() {
5519const product = this.model.getValue("product");
5520const discount = this.model.getValue("activeDiscount");
5521const coupon = this.model.getValue("activeCoupon");
5522const psID = this.model.getValue("activePaySystem");
5523let properties = [];
5524if (this.isDiscountActive() && !this.isCouponActive()) {
5525properties.push({ "ID": "164", "VALUE": discount });
5526}
5527let response = {};
5528if (this.isCouponActive()) {
5529response = await BX.ajax.runAction('integramma:extsale.ajax.orders.createWithCoupon', {
5530data: {
5531products: [ product.id ],
5532paymentSystemId: psID,
5533payParams: {
5534successUrl: "/personal/?filter_payed=Y&filter_history=Y&section=orders",
5535failUrl: "/personal/?filter_payed=Y&filter_history=Y&section=orders"
5536},
5537userFields: {},
5538orderProperties: properties,
5539productCount: product.quantity,
5540coupon: coupon
5541}
5542});
5543} else {
5544let params = {
5545data: {
5546products: [ product.id ],
5547paymentSystemId: psID,
5548payParams: {
5549successUrl: "/personal/?filter_payed=Y&filter_history=Y&section=orders",
5550failUrl: "/personal/?filter_payed=Y&filter_history=Y&section=orders"
5551},
5552userFields: {},
5553orderProperties: properties,
5554productCount: product.quantity,
5555}
5556};
5557response = await BX.ajax.runAction('integramma:extsale.ajax.orders.create', params);
5558}
5559if(response.data && response.data.orderId) {
5560const isAdded = await this.saveAccessKeyForExtend(response.data.orderId);
5561if(isAdded) {
5562this.goToPay(response);
5563this.closeModal();
5564}
5565}
5566}
5567async saveAccessKeyForExtend(orderId) {
5568const data = this.model.getValue("data");
5569if (orderId && data.key) {
5570const response = await BX.ajax.runAction('integramma:renewproduct.RenewAccess.Controller.rememberRenewAccess',{
5571data: {
5572orderId: orderId,
5573accessKey: data.key,
5574}
5575});
5576return !!(response && response.data.success);
5577}
5578}
5579}
5580;RenewProductService.__pN='user.payment.service';return RenewProductService;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.payment.service'),'RenewProductService',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Widget' in BeeJS.package('user.main.ui.shell')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var common = BeeJS.package("user.common");
5581class Widget extends common.ui.widget.Widget {
5582constructor(data, service) {
5583super();
5584this._css = "user-main-shell";
5585this._data = service.model.getValue("data");
5586this._service = service;
5587this.setTemplate(new beeJS.Template(65, function (model, bindInfo) {var html=[];html.push("");let css = model.css; html.push("\n<div class=\"");html.push(css);html.push("\">\n    <div class=\"");html.push(css);html.push("__header\"></div>\n    <div class=\"");html.push(css);html.push("__list\">\n        <div>\n            <a class=\"");html.push(css);html.push("__item\" href=\"/catalog/consultation/?sectionID=250\">\n                <h3>Ритмология<br>консультирования</h3>\n                <p>Ритмология индивидуального консультирования помогает добраться до сути проблем и понять, как зарождается то или иное желание. Консультант поможет в реализации истинных целей человека…</p>\n            </a>\n        </div>\n        <div>\n            <a class=\"");html.push(css);html.push("__item\" href=\"/catalog/consultation/?sectionID=84\">\n                <h3>Ритмология<br>сопровождения</h3>\n                <p>Ритмологическое сопровождение помогает обнаружить и раскрыть внутренние таланты и природные способности. Формируется целостная картина собственной жизни в конкретных условиях…</p>\n            </a>\n        </div>\n        <div>\n            <a class=\"");html.push(css);html.push("__item\" href=\"/catalog/consultation/?sectionID=87\">\n                <h3>Ритмология<br>предприятий</h3>\n                <p>Работа консультанта заключается в ритмологической поддержке при организации и ведении бизнес-проектов, в более полном видении процессов внутри коллектива и выходе предприятия на новый уровень.</p>\n            </a>\n        </div>\n        <div>\n            <a class=\"");html.push(css);html.push("__item\" href=\"/catalog/consultation/?sectionID=302\">\n                <h3>Ритмология<br>здоровья</h3>\n                <p>Ритмолог-консультант поможет найти гармоничную связь между мозгом и телом и получить импульс на активизацию здорового образа жизни…</p>\n            </a>\n        </div>\n        <div>\n            <a class=\"");html.push(css);html.push("__item\" href=\"/catalog/consultation/?sectionID=404\">\n                <h3>Ритмология<br>любви и результата</h3>\n                <p>Серия консультаций по теме «ритмологии любви и результата» способствует раскрытию внутреннего неиссякаемого источника любви, позволяет определить негативные установки, связанные с чувством любви...</p>\n            </a>\n        </div>\n        <div>\n            <a class=\"");html.push(css);html.push("__item\" href=\"/catalog/consultation/?sectionID=408\">\n                <h3>Ритмология<br>гармонии и красоты</h3>\n                <p>Ритмолог-консультант поможет в достижении гармонии и красоты в различных сферах жизни, через активизацию сильных сторон клиента и снижение помеховых факторов…</p>\n            </a>\n        </div>\n        <div>\n            <a class=\"");html.push(css);html.push("__item\" href=\"/catalog/consultation/?sectionID=272\">\n                <h3>Ритмология<br>личности</h3>\n                <p>Ритмолог личности помогает провести анализ собственной жизни, разобраться в происходящих событиях, выявить закономерности своих поступков и выйти Ð
5587º желаемому уровню жизни…</p>\n            </a>\n        </div>\n        <div>\n            <a class=\"");html.push(css);html.push("__item\" href=\"/catalog/consultation/?sectionID=591\">\n                <h3>Ритмология<br>Живых книг</h3>\n                <p>Задача ритмолога живых книг - в ходе консультации определить наиболее актуальное направление на данном этапе жизни человека, для раскрытия и достижения через соответствующую методику… </p>\n            </a>\n        </div>\n    </div>\n    <div class=\"");html.push(css);html.push("__footer\">\n        <a href='/catalog/consultation/themes'>\n            <h3>Консультации по темам</h3>\n        </a>\n    </div>\n</div>\n");return html.join('');}), {
5588css: this._css,
5589data: this._data,
5590service: this._service
5591});
5592}
5593}
5594;Widget.__pN='user.main.ui.shell';return Widget;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.main.ui.shell'),'Widget',{get:function(){if(!i){i=true;o=f();}return o;}});})();if (!('Init' in BeeJS.package('user.main.service')))(function(){var f=function(){var beeJS = BeeJS.package("beeJS");var ui = BeeJS.package("user.main.ui");var model = BeeJS.package("user.common.model");var service = BeeJS.package("user.common.service");
5595class Init {
5596constructor(element, data) {
5597this.model = new model.Model();
5598this.model.setValue("data", data);
5599this.service = new service.Service(this.model);
5600this.widget = new ui.shell.Widget({}, this.service);
5601this.widget.start(element);
5602}
5603}
5604;Init.__pN='user.main.service';return Init;};var i=false;var o=null;Object.defineProperty(BeeJS.package('user.main.service'),'Init',{get:function(){if(!i){i=true;o=f();}return o;}});})();var user = BeeJS.package('user');})();

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.