PageSourceSearch

https://dinstom.ru/local/components/stom/form.modal.vacancies/templates/.default/script.js

js dinstom.ru collected 2026-10-06 11:12:54 UTC 3,854 bytes, 103 lines download raw bytes

1$(function(){
2	$('.js-form-modal-vacancies').each(function(i, form){
3        (new StomFormModalVacancies(form)).init();
4    });
5});
6
7class StomFormModalVacancies {
8    constructor(form) {
9        this.$form = form;
10        this.$form_phone = $(this.$form).find("#FORMMODALVACANCIES[PHONE]");
11        this.form_alert = '.js-form-alert';
12        this.answer_title = $(this.$form).data('answertitle');
13        this.answer_text = $(this.$form).data('answertext');
14        this.extendtext = '.js-form-extend-text';
15        this.message_metric = "";
16    }
17
18    submitForm(form) {
19                let sessid = $(form).find('input[name="od_sessid"]').val() || '';
20        $(form).find('.js-ftok').val(sessid.split('').reverse().join(''));
21        let form_data = new FormData(form);
22        let self = this;
23
24        BX.ajax.runComponentAction(
25            'stom:form.modal.vacancies',
26            'submit', 
27            { 
28                mode: 'class',
29                data: form_data,  
30            },
31        ).then(function(response) {
32            if (response.status === 'success') {
33                self.paintSuccess(response);
34
35                let ct_data = {
36                    fio: response.data.result.NAME,
37                    phoneNumber: response.data.result.PHONE,
38                    file: response.data.result.FILE,
39                    subject: 'Заявка с dinstom.ru: Отклик на вакансию',
40                    requestUrl: location.href,
41                    sessionId: window.call_value
42                };
43                jQuery.ajax({
44                    url: 'https://api.calltouch.ru/calls-service/RestAPI/requests/_1111_/register/',
45                    dataType: 'json',
46                    type: 'POST',
47                    data: ct_data
48                });
49
50                // ym('_1111_','reachGoal','lead');
51
52                console.log('Отправили данные в аналитику');
53            }
54        }, function (response) {
55            console.log(response);
56            $(self.$form).find('.invalid-feedback').text('');
57            $(self.$form).find('.is-invalid').removeClass('is-invalid');
58            
59            if (response.errors.length > 0){
60                response.errors.forEach((element) => {
61                    let $node = $(self.$form).find('.js-validate-node-' + element.code);
62                    $node.find('.form-control').addClass('is-invalid');
63                    $node.find('.input-checkbox').addClass('is-invalid');
64                    $node.find('.invalid-feedback').text(element.message);
65                });
66            }           
67        });
68    }
69
70    paintSuccess(response) {
71        let html = `<div class="block-formModalPhone__alert-title">${this.answer_title}, ${this.answer_text}</div><button type="button" class="btn btn-second btn-small btn-noMinWidth" data-bs-dismiss="modal">Вернуться назад</button>`;
72
73        $(this.$form).find(this.form_alert).html(html);
74        $(this.$form).find('form').addClass('d-none');
75        $(this.$form).find('.block-formModalPhone__title').addClass('d-none');
76        $(this.$form).find('.block-formModalPhone__subtitle').addClass('d-none');
77    }
78
79    init() {
80
81        let $phone =  $(this.$form).find(".js-validate-node-PHONE input");
82
83        //$phone.mask("+7 (999) 999 99 99");
84
85        let phone = new Cleave($phone, {
86            numericOnly: true,
87            prefix: '+7',
88            noImmediatePrefix: true,
89            delimiters: [' (', ') ', '-', '-'],
90            blocks: [2, 3, 3, 2, 2],
91        });
92
93        if ($phone.val().length > 0){
94            phone.setRawValue($phone.val());
95        }
96
97        $(this.$form).find('form').on('submit', (event) => {
98            event.preventDefault();
99            event.stopPropagation();
100            this.submitForm(event.target);
101        });
102    }
103}

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.