1var QuestionForm = function() { 2 var self = this; 3 4 this.validateNow = ko.observable(false); 5 6 this.ERRORS = { 7 required: 'ÐбÑзаÑелÑное поле', 8 phone: 'ÐведиÑе пÑавилÑнÑй ÑелеÑон', 9 min_length_2: 'Ðе должно ÑоÑÑоÑÑÑ Ð¸Ð· одной бÑквÑ', 10 max_length_100: 'ÐакÑималÑÐ½Ð°Ñ Ð´Ð»Ð¸Ð½Ð° - 100 Ñимволов' 11 }; 12 13 this.fio = ko.observable().extend({ 14 required: { 15 params: true, 16 message: self.ERRORS.required 17 }, 18 maxLength: { 19 params: 100, 20 message: self.ERRORS.max_length_100 21 }, 22 minLength: { 23 params: 2, 24 message: self.ERRORS.min_length_2 25 } 26 }); 27 this.email = ko.observable('').extend({ 28 email: { 29 params: true, 30 message: 'ÐведиÑе коÑÑекÑнÑй email' 31 }, 32 required: { 33 params: true, 34 message: 'ÐбÑзаÑелÑное поле' 35 } 36 }); 37 this.commentary = ko.observable('').extend({ 38 required: { 39 message: self.ERRORS.required, 40 params: true 41 } 42 }); 43 this.isUploading = ko.observable(false); 44 this.error = ko.observable(''); 45 this.errors = ko.validation.group(self, { deep: true }); 46}; 47 48QuestionForm.prototype.clear = function() { 49 this.validateNow(false); 50 this.fio(''); 51 this.email(''); 52 this.commentary(''); 53 this.isUploading(false); 54 this.error(''); 55 this.errors.showAllMessages(false); 56}; 57 58QuestionForm.prototype.submit = function() { 59 const self = this; 60 61 if (self.isUploading && self.isUploading()) return; 62 63 if (!self.fio()) self.fio(m_cabinet_personal.data.name()); 64 65 this.validateNow(true); 66 67 if (helper.hasErrors(this)) { 68 return; 69 } 70 71 helper.sendStats({ 72 fio: self.fio(), 73 commentary: self.commentary(), 74 phone: m_cabinet_personal.data.phone(), 75 email: self.email() 76 }); 77 78 this.error(''); 79 this.isUploading(true); 80 data = { 81 patient: m_record.ageStates[m_record.ageState()].label, 82 fio: self.fio(), 83 email: self.email(), 84 phone: m_cabinet_personal.data.phone(), 85 commentary: this.commentary(), 86 device: self.getMobileInfo() || '', 87 version: ((m_cabinet.is_app() || MOBILEWEB_APP) && APP_VERSION) ? APP_VERSION : '' 88 }; 89 90 helper.logEvent('HelpAdminSubmit', 'MobileForm', { 91 uid: m_cabinet_personal.chosenProfileId() == null ? undefined : m_cabinet_personal.chosenProfileId(), 92 device: mobileDetector.mobile() 93 }); 94 95 $.post({ 96 url: SERVER_URL + '/api/questioncreate/', 97 dataType: 'json', 98 data: JSON.stringify(data), 99 processData: false, 100 contentType: 'application/json' 101 }) 102 103 .done(function(response) { 104 if (typeof dataLayer != 'undefined') { 105 dataLayer.push({ event: 'homeRequestSubmit' }); 106 } 107 self.clear(); 108 109 window.history.back(); 110 m_modal.openGenericSmallModal('СпаÑибо!', 'ÐаÑе ÑообÑение оÑпÑавлено'); 111 }) 112 .fail(function(response) { 113 console.log(response); 114 self.error('ÐÑоизоÑла оÑибка. ÐопÑобÑйÑе повÑоÑиÑÑ Ð·Ð°Ð¿ÑÐ¾Ñ Ð¿Ð¾Ð·Ð´Ð½ÐµÐµ.'); 115 }) 116 .always(function(response) { 117 self.isUploading(false); 118 }); 119}; 120 121QuestionForm.prototype.getMobileInfo = function() { 122 const mobileInfo = m_cabinet.is_app() ? 123 `${mobileDetector.ua} /// ${MOBILEWEB_APP ? `AppVersion = ${APP_VERSION}` : ''}` : 124 mobileDetector.mobile(); 125 return mobileInfo; 126};
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.