PageSourceSearch

https://orci72.ru/local/components/mendeleev/feedback/templates/re…/script.js?171938401410846

js orci72.ru collected 2026-10-06 05:28:40 UTC 10,846 bytes, 247 lines download raw bytes

1$(() => {
2
3    const initPage = () => {
4        const $form = $("#registration-rehabilitation-form");
5        const $formSuccessText = $form.closest('.js-form-cont').find(".js-form-success");
6        const $formErrorText = $form.closest('.js-form-cont').find(".js-form-error");
7        const $formContentGroup = $form.closest('.js-form-cont').find(".js-form-cont__group");
8        const $buttonSend = $form.find("button[type=submit]");
9
10        // Инициализация маски ввода для поля даты рождения
11        const inputPersonalBirthday = $("#personal-birthday");
12
13        inputPersonalBirthday.inputmask({"mask": "**.**.****"});
14        inputPersonalBirthday.on("input", (e) => {
15            const $message = inputPersonalBirthday.siblings(".form__message");
16            let value = $(e.currentTarget).val();
17            value = value.replace(/\D/g, '');
18            inputPersonalBirthday.removeClass("error");
19            $message.removeClass("error").html("");
20            if(value.length === 8){
21                const day = parseInt(value.slice(0, 2), 10);
22                const month = parseInt(value.slice(2, 4), 10) - 1;
23                const year = parseInt(value.slice(4, 8), 10);
24                const birthday = new Date(year, month, day);
25                const age = calculateAge(birthday);
26
27                if(age > 120){
28                    $message.addClass("error").html("Не верно заполнено поле");
29                    inputPersonalBirthday.addClass("error");
30                }
31            }
32
33            $(e.currentTarget).val(value);
34        });
35
36        function calculateAge(birthday){
37            const today = new Date();
38            let age = today.getFullYear() - birthday.getFullYear();
39            const m = today.getMonth() - birthday.getMonth();
40
41            if(m < 0 || (m === 0 && today.getDate() < birthday.getDate())){
42                age--;
43            }
44
45            return age;
46        }
47
48
49        // Инициализация маски ввода для поля телефона
50        $("#personal-phone").inputmask("+7 (999) 999-99-99");
51
52        // Селект
53        (() => {
54            $(".form__inp-line").on("click", function (){
55                const $this = $(this),
56                    $dropItems = $this.find(".form__inp-items"),
57                    $dropItem = $this.find(".form__inp-item"),
58                    $dropItemSelected = $this.find(".form__inp-item.selected");
59
60                if($dropItems.length > 0){
61                    $(".form__inp-items").hide();
62                    $dropItem.show();
63                    $dropItemSelected.hide();
64                    // Показать или скрыть выпадающий список
65                    $this.toggleClass("visible");
66                    if($this.hasClass("visible")){
67                        $dropItems.show();
68                    }else{
69                        $dropItems.hide();
70                    }
71                }
72            });
73
74            // Обработчик клика для каждого элемента списка
75            $(".form__inp-item").on("click", function (e){
76                e.stopPropagation(); // Предотвратить всплытие события
77                const $this = $(this);
78                $(".form__inp-line").removeClass("visible");
79                $(".form__inp-item").removeClass("selected");
80                $this.addClass("selected");
81                $this.closest(".form__inp-items").hide().removeClass("visible");
82                $this.closest(".form__inp-line").find("input:not(:hidden)").val($this.text());
83                $this.closest(".form__inp-line").find("input:hidden").val($this.data("type"));
84            });
85        })();
86
87        const initDatepicker = async () => {
88            try{
89                const response = await $.ajax({
90                    method: "post",
91                    dataType: "json",
92                    data: {
93                        IS_AJAX: "Y",
94                        IS_GET_RECORD: "Y",
95                    }
96                });
97                const $input = $('#mendeleevdatetimepicker');
98                $input.val("");
99
100                // Обработка ответа и инициализация datetimepicker
101                const dates = response.data.properties.datetime.value;
102                const firsrAvailableDay = new Date(Object.keys(dates)[0]);
103                let month = firsrAvailableDay.getMonth();
104
105                let mendeleevdatetimepicker = new MendeleevDateTimePicker('#mendeleevdatetimepicker', {
106                    title: "Дата и время первичного приема",
107                    emptyTimeMessage: "Выберите время первичного приема",
108                    emptyDayMessage: "Выберите дату первичного приема",
109                    items: dates,
110                    month: month,
111                    on: {
112                        onClickButton: function (status){
113                        },
114                        onChangeTime: function (el){
115                            const datetime = el.datetime;
116                            if(datetime){
117                                $input.val(datetime);
118                                $.ajax({
119                                    method: "post",
120                                    dataType: "json",
121                                    data: {
122                                        IS_AJAX: "Y",
123                                        IS_CHECK_DATETIME: "Y",
124                                        FIELDS: {
125                                            DATETIME_ID: datetime
126                                        }
127                                    },
128                                    beforeSend: function (jqXHR, settings){
129                                        $buttonSend.attr("disabled", true)
130                                    },
131                                    success: function (response){
132                                        $buttonSend.attr("disabled", false)
133                                        if(response.status === "error"){
134                                            $formContentGroup.hide();
135                                            $formErrorText.show();
136                                            $formErrorText.find(".form-success__text").html(" " + response.messages);
137                                            $formErrorText.find(".js-form-button").html(response.button.name);
138                                            $formErrorText.find(".js-form-button").attr("href", response.button.url);
139                                        }
140                                    }
141                                });
142                            }
143                        }
144                    }
145                });
146            }catch(error){
147                console.error("Ошибка при инициализации mendeleevdatetimepicker: ", error);
148                $form.data("reload", "true");
149                $formErrorText.find(".form-success__text");
150                $(".js-form-button").html("Перезагрузить");
151            }
152        };
153
154        const requiredInputs = $form.find("input.required");
155
156        requiredInputs.on("focusin", function (){
157            $(this).removeClass("error");
158        });
159
160        $form.on("submit", function (e){
161            e.preventDefault();
162            e.stopPropagation();
163
164            const requiredEmptyInputs = requiredInputs.filter(function (index, elem){
165                return $(elem).val() === "";
166            });
167
168            if(requiredEmptyInputs.length > 0){
169                requiredEmptyInputs.map(function (index, elem){
170                    $(elem).addClass("error");
171                });
172                return false;
173            }else{
174                requiredInputs.removeClass("error");
175
176                const formData = new FormData(this);
177
178                $formErrorText.hide();
179                $formSuccessText.hide();
180
181                formData.append("IS_AJAX", "Y");
182                formData.append("IS_SEND_FORM", "Y");
183
184                $.ajax({
185                    type: "post",
186                    dataType: "json",
187                    processData: false,
188                    contentType: false,
189                    data: formData,
190                    beforeSend: function (){
191                        $buttonSend.attr("disabled", true);
192                    },
193                    success: function (response){
194                        $buttonSend.attr("disabled", false);
195                        $formContentGroup.hide();
196                        if(response.status === "error"){
197                            $formErrorText.show();
198                            $formErrorText.find(".form-success__text").html(" " + response.messages);
199                            $formErrorText.find(".js-form-button").html(response.button.name);
200                            $formErrorText.find(".js-form-button").attr("href", response.button.url);
201                        }else{
202                            $form.data("reload", "true");
203                            $formSuccessText.show();
204                            $formSuccessText.find(".form-success__text").html(" " + response.messages);
205                            $formSuccessText.find(".js-form-button").html(response.button.name);
206                            $formSuccessText.find(".js-form-button").attr("href", response.button.url);
207
208                            localStorage.setItem("DAY", "");
209                            localStorage.setItem("DATETIME", "");
210                        }
211                    },
212                    error: function (){
213                        console.error("Error loading data");
214                    },
215                });
216            }
217        });
218
219        $(".js-form-button").on("click", function (e){
220            e.preventDefault();
221            if($(this).attr("href") === "/"){
222                window.location.href = "/";
223            }else{
224                $formSuccessText.hide();
225                $formErrorText.hide();
226                $formContentGroup.show();
227            }
228        });
229
230        $("#mendeleevdatetimepicker").on("click", initDatepicker);
231
232        $(".js-callback-rehab").on("click", function (e){
233            e.preventDefault();
234            $(".js-right-slider-rehab").addClass("active");
235            $("html, body").css({"overflow": "hidden"});
236        });
237
238        $('.js-right-slider__close').on('click', function (e){
239            e.preventDefault();
240            $(this).closest('.js-right-slider-rehab').removeClass('active');
241            $("#calendar").remove();
242            $("html, body").css({"overflow": "inherit"});
243        });
244    }
245
246    initPage();
247});

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.