PageSourceSearch

https://www.6262.com.ua/assets/4c4fed9c/js/payments/cisPaymentForm.js?v=1789825603

js 6262.com.ua collected 2026-10-02 10:50:47 UTC 3,853 bytes, 116 lines download raw bytes

1/**
2 * @param {BasePaymentWidget} widget
3 * @param {CisPaymentSettings} settings
4 * @constructor
5 */
6var CisPaymentForm = function (widget, settings) {
7    this._widget = widget;
8    this._settings = settings;
9    this._isActiveFormReady = false;
10    this._isProcessingClass = settings.getOption("isProcessingClass", "is-processing");
11
12    this.$form = widget.$element.closest("form");
13    if (0 === this.$form.length) {
14        this.$form = widget.$element.find("form");
15    }
16    this.$submitButton = $("button:submit", this.$form);
17
18    this.disableSubmitButton();
19    this.showSubmitButtonSpinner();
20
21    this.$disabledBeforeSubmit = $(settings.getElement("disabledBeforeSubmit"), widget.$element);
22    this.$disabledEmptyBeforeSubmit = $(settings.getElement("disabledEmptyBeforeSubmit"), widget.$element);
23
24    _initHandlers(this);
25
26    /**
27     * @param {CisPaymentForm} form
28     */
29    function _initHandlers(form) {
30        var widget = form._widget,
31            settings = form._settings;
32
33        form.$form
34            .on("beforeSubmit", function () {
35                if (form.$submitButton.prop("disabled")) {
36                    return false;
37                }
38                form.disableSubmitButton();
39                form.showSubmitButtonSpinner();
40                widget.userSchedule.stopScheduledTasks();
41                form.$disabledBeforeSubmit.prop("disabled", true);
42                form.$disabledEmptyBeforeSubmit.each(function () {
43                    var $this = $(this);
44                    if (!$this.val()) {
45                        $this.prop("disabled", true);
46                    }
47                });
48            })
49            .on("beforeValidate", function () {
50                form.disableSubmitButton();
51                form.showSubmitButtonSpinner();
52                widget.userSchedule.stopScheduledTasks();
53            })
54            .on("beforeValidateAttribute", function (event, attribute, messages, deferreds) {
55                widget.validateAttribute(event, attribute, messages, deferreds);
56            })
57            .on("afterValidate", function () {
58                form.hideSubmitButtonSpinner();
59                form.updateSubmitButton();
60                widget.userSchedule.startScheduledTasks();
61            })
62            .on("afterInit", function () {
63                form._isActiveFormReady = true;
64                $(settings.getElement("enabledAfterFormInit"), widget.$element).prop("disabled", false);
65                settings.getOption("extraAttributes", []).forEach(function (attribute) {
66                    form.$form.yiiActiveForm("add", attribute);
67                });
68                widget.userSchedule.startScheduledTasks();
69                form.hideSubmitButtonSpinner();
70                form.updateSubmitButton();
71            });
72    }
73};
74$.extend(CisPaymentForm.prototype, {
75    /**
76     * @this CisPaymentForm
77     */
78    updateSubmitButton: function () {
79        if (!this._widget.paymentGrid.hasSelectedServices()) {
80            this.disableSubmitButton();
81        } else {
82            this.enableSubmitButton();
83        }
84    },
85    /**
86     * @this CisPaymentForm
87     */
88    disableSubmitButton: function () {
89        this.$submitButton.prop("disabled", true);
90    },
91    /**
92     * @this CisPaymentForm
93     */
94    enableSubmitButton: function () {
95        this.$submitButton.prop("disabled", false);
96    },
97    /**
98     * @this CisPaymentForm
99     */
100    showSubmitButtonSpinner: function () {
101        this.$submitButton.addClass(this._isProcessingClass);
102    },
103    /**
104     * @this CisPaymentForm
105     */
106    hideSubmitButtonSpinner: function () {
107        this.$submitButton.removeClass(this._isProcessingClass);
108    },
109    /**
110     * @this CisPaymentForm
111     * @return {boolean}
112     */
113    isFormReady: function () {
114        return this._isActiveFormReady;
115    }
116});

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.