PageSourceSearch

https://isb.edu.vn/wp-content/themes/isb-child/efw/crm/assets/custom.js?ver=1790243731

js isb.edu.vn collected 2026-09-24 09:56:04 UTC 8,725 bytes, 308 lines download raw bytes

1jQuery(document).ready(function ($) {
2
3	$("#frmSubmitCustom select").each(function () {
4		$this = $(this);
5		$parent_box = $this.closest('.group-form-other');
6		if ($this.val().search("Khác") === 0 || $this.val().search("Khác (ghi rõ)") === 0) {
7			$parent_box.addClass('show-other');
8		}
9		else
10
11			$parent_box.removeClass('show-other');
12	});
13
14	$("#frmSubmitCustom").submit(function () {
15
16
17		$form = $(this);
18		var trackEmail = $form.find('input[name="lead[email]"]').val();
19		var trackPhone = $form.find('input[name="lead[phone_mobile]"]').val();
20		$form.find('.error-label').remove();
21		$form.find('.item-error').removeClass('item-error');
22		$telephone = $form.find('input[name="lead[phone_mobile]"]').val();
23		if ($telephone[0] != '0' || $telephone.length < 10) {
24			alert("Số điện thoại không hợp lệ");
25			return false;
26		}
27
28
29		if ($form.find('input[name="lead[year_12_gpa]"]').length) {
30			$year_12_gpa = $form.find('input[name="lead[year_12_gpa]"]').val();
31			if ($year_12_gpa != '') {
32				if (isNaN($year_12_gpa)) {
33
34					errorLabel($form.find('input[name="lead[year_12_gpa]"]'), 'Điểm trung bình năm/học kỳ gần nhất không hợp lệ. Vui lòng điền cụ thể 1 số thập phân (Ví dụ: 7.5)');
35					scrollError();
36					return false;
37
38
39				}
40				else {
41					if ($year_12_gpa < 0) {
42						errorLabel($form.find('input[name="lead[year_12_gpa]"]'), 'Điểm trung bình năm/học kỳ gần nhất không hợp lệ. Vui lòng điền cụ thể 1 số thập phân (Ví dụ: 7.5)');
43						scrollError();
44						return false;
45					}
46				}
47
48
49			}
50		}
51		if ($form.find('input[name="lead[english_total]"]').length) {
52			$english_total = $form.find('input[name="lead[english_total]"]').val();
53			if ($english_total != '') {
54				if (isNaN($english_total)) {
55
56					errorLabel($form.find('input[name="lead[english_total]"]'), 'Điểm tiếng Anh không hợp lệ. Vui lòng điền dưới dạng con số (Ví dụ: 7.5 hay 750)');
57					scrollError();
58					return false;
59
60
61				}
62				else {
63
64				}
65
66
67			}
68		}
69
70
71		$attend_time = $form.find('input[name="lead[attend_time]"]').val();
72		if ($attend_time) {
73			if (!validDateAttend($attend_time)) {
74				$date = new Date();
75				if ($date.getMonth() < 10)
76					$month = '0' + $date.getMonth();
77				else
78					$month = $date.getMonth();
79				errorLabel($form.find('input[name="lead[attend_time]"]'), 'Thời gian nhập học không hợp lệ (' + $month + '/' + $date.getFullYear() + ')');
80				scrollError();
81				return false;
82			}
83
84
85
86
87		}
88
89
90		$ot = 0;
91		$(".show-other").each(function () {
92			if ($(this).find('input').val() == "") {
93				errorLabel($(this).find('input'), 'Vui lòng nhập đầy đủ thông tin');
94				$ot++;
95				return false;
96			}
97		});
98		if ($ot) { scrollError(); return false; }
99
100		if (!$form.find('input[name="is_privacy_agreement"]').is(':checked')) {
101			errorLabel($form.find('input[name="is_privacy_agreement"]'), 'Vui lòng đồng ý với Chính sách bảo mật và Điều khoản sử dụng để tiếp tục.');
102			scrollError();
103			return false;
104		}
105
106		data_submit = $form.serialize() + "&action=cstcrmsync&type=cstcrmsync&tracking=" + window.location.href + "&cookie_id=" + getAsmUid() + "&page_title=" + document.title;
107		if (getURLParameter('cdp_test'))
108			data_submit += "&cdp_test=" + getURLParameter('cdp_test');
109		if (getURLParameter('utm_source'))
110			data_submit += "&utm_source=" + getURLParameter('utm_source');
111		if (getURLParameter('utm_medium'))
112			data_submit += "&utm_medium=" + getURLParameter('utm_medium');
113		if (getURLParameter('utm_term'))
114			data_submit += "&utm_term=" + getURLParameter('utm_term');
115
116
117
118		$.ajax({
119			url: flatsomeVars.ajaxurl,
120			type: "POST",
121			beforeSend: function () {
122
123				$form.find('button').after('<i class="fa fa-spin fa-spinner"></i>');
124				$form.find('button').hide();
125
126
127			},
128			dataType: "json",
129
130			data: data_submit,
131
132
133		})
134			.always(function (data) {
135				if (data.dims) {
136					if (typeof web_event !== 'undefined' && typeof web_event.track === 'function') {
137						web_event.track("user", "identify", {
138							dims: {
139								customers: {
140									customer_id: data.dims.customer_id,
141									name: data.dims.name,
142									phone: data.dims.phone
143								}
144							},
145							extra: {
146								identify_event: "user_identify",
147								identify_id: data.dims.customer_id
148							}
149						});
150					}
151				}
152				$form.find('button').next().remove();
153				$form.find('button').show();
154
155
156				$form.find('input[type="text"],textarea').each(function () {
157					$(this).val('');
158				});
159			})
160			.done(function (data) {
161				if (data && data.e == 0) {
162					var path = window.location.pathname;
163					var evt = null;
164					if (path.indexOf('cu-nhan-isb-asean-co-op') !== -1) evt = 'submit_form_aseancoop';
165					else if (path.indexOf('cu-nhan-tai-nang-ueh-isb') !== -1) evt = 'submit_form_bbus';
166					if (evt) {
167						window.dataLayer = window.dataLayer || [];
168						window.dataLayer.push({
169							event: evt,
170						        event_id: generateUUID(),
171							email: trackEmail,
172							phone: trackPhone
173						});
174					}
175				}
176				else
177					$("#frmSubmitCustom").html(data.msg);
178			});
179		return false;
180	});
181
182	$("#frmSubmitContact").submit(function () {
183
184
185		$form = $(this);
186		var trackEmail = $form.find('input[name="lead[email]"]').val();
187		var trackPhone = $form.find('input[name="lead[phone_mobile]"]').val();
188		$form.find('.error-label').remove();
189		$form.find('.item-error').removeClass('item-error');
190		$telephone = $form.find('input[name="lead[phone_mobile]"]').val();
191		if ($telephone[0] != '0' || $telephone.length < 10) {
192			alert("Số điện thoại không hợp lệ");
193			return false;
194		}
195
196		if (!$form.find('input[name="is_privacy_agreement"]').is(':checked')) {
197			errorLabel($form.find('input[name="is_privacy_agreement"]'), 'Vui lòng đồng ý với Chính sách bảo mật và Điều khoản sử dụng để tiếp tục.');
198			scrollError();
199			return false;
200		}
201
202		data_submit = $form.serialize() + "&action=cstcrmsynccontact&type=cstcrmsynccontact&tracking=" + window.location.href + "&cookie_id=" + getAsmUid() + "&page_title=" + document.title;
203		if (getURLParameter('cdp_test'))
204			data_submit += "&cdp_test=" + getURLParameter('cdp_test');
205		if (getURLParameter('utm_source'))
206			data_submit += "&utm_source=" + getURLParameter('utm_source');
207		if (getURLParameter('utm_medium'))
208			data_submit += "&utm_medium=" + getURLParameter('utm_medium');
209		if (getURLParameter('utm_term'))
210			data_submit += "&utm_term=" + getURLParameter('utm_term');
211
212
213
214		$.ajax({
215			url: flatsomeVars.ajaxurl,
216			type: "POST",
217			beforeSend: function () {
218
219				$form.find('button').after('<i class="fa fa-spin fa-spinner"></i>');
220				$form.find('button').hide();
221
222
223			},
224			dataType: "json",
225
226			data: data_submit,
227
228
229		})
230			.always(function (data) {
231				if (data.dims) {
232					if (typeof web_event !== 'undefined' && typeof web_event.track === 'function') {
233						web_event.track("user", "identify", {
234							dims: {
235								customers: {
236									customer_id: data.dims.customer_id,
237									name: data.dims.name,
238									phone: data.dims.phone
239								}
240							},
241							extra: {
242								identify_event: "user_identify",
243								identify_id: data.dims.customer_id
244							}
245						});
246					}
247				}
248				$form.find('button').next().remove();
249				$form.find('button').show();
250
251
252				$form.find('input[type="text"],textarea').each(function () {
253					$(this).val('');
254				});
255			})
256			.done(function (data) {
257				if (data && data.e == 0) {
258					window.dataLayer = window.dataLayer || [];
259					window.dataLayer.push({
260						event: 'submit_form_general',
261						event_id: generateUUID(),
262						email: trackEmail,
263						phone: trackPhone
264					});
265				}
266				$("#frmSubmitContact").html(data.msg);
267
268			});
269		return false;
270	});
271
272});
273
274function scrollError() {
275	jQuery("body,html").animate({ scrollTop: jQuery(".error-label:eq(0)").offset().top - jQuery("#masthead").height() }, 500);
276}
277
278function generateUUID() {
279    return crypto.randomUUID
280        ? crypto.randomUUID()
281        : 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
282                const r = (Math.random() * 16) | 0;
283                const v = c === 'x' ? r : (r & 0x3) | 0x8;
284                return v.toString(16);
285          });
286}
287
288function getAsmUid() {
289	const key = '_asm_uid';
290
291	// Hàm lấy cookie theo tên
292	function getCookie(name) {
293		const value = "; " + document.cookie;
294		const parts = value.split("; " + name + "=");
295		if (parts.length === 2) return parts.pop().split(";").shift();
296		return;
297	}
298
299	// 1. Ưu tiên Cookie
300	let asmUid = getCookie(key);
301
302	// 2. Nếu không có thì lấy từ LocalStorage
303	if (!asmUid) {
304		asmUid = localStorage.getItem(key);
305	}
306
307	return asmUid;
308}

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.