PageSourceSearch

https://drhemajajoo.com/wp-content/themes/pregnancy/functions/js/reservation.js?ver=6.7.9

js drhemajajoo.com collected 2026-09-24 12:38:57 UTC 14,576 bytes, 489 lines download raw bytes

1//appointment type2
2jQuery(window).on('load', function(){
3	if(jQuery('#appointment-step-checker').val() != 'false') {
4		jQuery('#appointment-step').val(1);
5	} else {
6		jQuery('#appointment-step').val(2);	
7	}
8});
9// appointment type2
10
11jQuery(document).ready(function($){
12
13	$(".dt-select-service").change(function(){
14		var $id = $(this).val();
15		$.ajax({
16			method:'POST',
17			url: dttheme_urls.ajaxurl,
18			type: 'html',
19			data:{ action: 'pregnancy_dt_fill_staffs', service_id :$id },
20			complete: function(response){
21				if( response.status === 200 ) {
22					var $append = "";
23					if( $.trim(response.responseText).length > 0 ) {
24						$append += response.responseText;
25						$(".dt-select-staff").empty().append($append);
26					}
27				}
28			}
29		});
30	});
31
32	$('#datepicker').datepicker({
33		minDate: 0,
34		dateFormat : 'yy-mm-dd'
35	})
36	
37	
38	//appointment type2
39	if($('body').hasClass('page-template-tpl-reservation-type2-php') ){
40		$("body").delegate(".appointment-goback","click",function(e){
41			
42			$('.steps').hide();
43			
44			var curr_step_val = $('#appointment-step').val();
45			var step_to_show = parseInt(curr_step_val, 10) - 1;
46			
47			$('.dt-sc-schedule-progress-wrapper .step'+curr_step_val).removeClass('dt-sc-current-step');
48			$('.dt-sc-schedule-progress-wrapper .step'+step_to_show).removeClass('dt-sc-completed-step');
49			$('.dt-sc-schedule-progress-wrapper .step'+step_to_show).addClass('dt-sc-current-step');
50			
51			$('.step' + step_to_show).fadeIn(800);
52			
53			$('#appointment-step').val(step_to_show);
54			
55			if(step_to_show == 1) {
56				$('.dt-sc-goback-box').hide();
57			}
58			
59		});
60	
61		function pregnancy_calculate_step_value() {
62			
63			$('.dt-sc-goback-box').show();
64			
65			var curr_step_val = $('#appointment-step').val();
66			var updated_step_val = parseInt(curr_step_val, 10) + 1;
67			
68			$('.dt-sc-schedule-progress-wrapper .dt-sc-schedule-progress').removeClass('dt-sc-current-step');
69			$('.dt-sc-schedule-progress-wrapper .step'+curr_step_val).addClass('dt-sc-completed-step');
70			$('.dt-sc-schedule-progress-wrapper .step'+updated_step_val).addClass('dt-sc-current-step');
71			
72			$('#appointment-step').val(updated_step_val);
73			if(updated_step_val == 4 || updated_step_val == 1) { $('.appointment-goback').hide(); $('.dt-sc-goback-box').hide(); }
74			
75		}
76	
77		$('form[name="dt-sc-appointment-contactdetails-form"]').on('submit', function () {	
78			
79			var $firstname = $('#firstname').val();
80			var $lastname = $('#lastname').val();
81			var $phone = $('#phone').val();
82			var $emailid = $('#emailid').val();
83			var $address = $('#address').val();
84			var $about_your_project = $('#about_your_project').val();
85			
86			$('#hid_firstname').val($firstname);
87			$('#hid_lastname').val($lastname);
88			$('#hid_phone').val($phone);
89			$('#hid_emailid').val($emailid);
90			$('#hid_address').val($address);
91			$('#hid_about_your_project').val($about_your_project);
92			
93			var contact_details = '<ul>';
94					if($firstname != '') { contact_details += '<li><span>Name:</span><p>' + $firstname + ' ' + $lastname + '</p></li>'; }
95					if($phone != '') { contact_details += '<li><span>Phone:</span><p>' + $phone + '</p></li>'; }
96					if($emailid != '') { contact_details += '<li><span>Email:</span><p>' + $emailid + '</p></li>'; }
97					if($address != '') { contact_details += '<li><span>Address:</span><p>' + $address + '</p></li>'; }
98					if($about_your_project != '') { contact_details += '<li><span>Message:</span><p>' + $about_your_project + '</p></li>'; }
99				contact_details += '</ul>';
100				
101			$('#dt-sc-contact-info').html(contact_details);	
102			
103			$('.dt-sc-contactdetails-box').hide();
104			$('.dt-sc-aboutproject-box').show();
105			$('.dt-sc-notification-box').show();
106			
107			pregnancy_calculate_step_value();
108			
109			return false;
110	
111		});
112	
113		$("body").delegate(".generate-schedule","click",function(e){
114			
115			var $serviceid = $('#serviceid').val();
116			var $staffid = $('#staffid').val();
117			var $staffids = $('#staffids').val();
118			var $aptdatepicker = $('#datepicker').val();
119			
120			if( $aptdatepicker == "Select Date" || $serviceid.length == "" ){
121				alert(dtAppointmentCustom.eraptdatepicker);
122				return false;
123			}
124			
125			$.ajax({
126				method:'POST',
127				url: dttheme_urls.ajaxurl,
128				type: 'html',
129				data:{ action: 'pregnancy_dt_generate_schedule', serviceid :$serviceid, staffid :$staffid, staffids :$staffids, datepicker :$aptdatepicker },
130				beforeSend: function(){
131					$(".dt-sc-timeslot-box").hide();
132				},
133				complete: function(response){
134					$(".appointment-ajax-holder").html(response.responseText);
135					$(".dt-sc-timeslot-box").fadeIn(800);
136					
137					$('html, body').animate({
138						scrollTop: $('.dt-sc-timeslot-box').offset().top - 200
139					},2000);
140				}
141			});
142			
143		});
144	
145		 $("body").delegate("a.time-slot","click",function(e){
146			
147			e.preventDefault();
148			
149			var $daydate = $(this).data('daydate'),
150				$time = $(this).data('time'),
151				$service = $('*[name=serviceid] :selected').text(),
152				$staff = $(this).data('staffname');
153			
154			var schedule_details = '<ul>';
155					if($service != '') { schedule_details += '<li><span>Department:</span><p>' + $service + '</p></li>'; }
156					if($staff != '') { schedule_details += '<li><span>Staff:</span><p>' + $staff + '</p></li>'; }
157					if($daydate != '') { schedule_details += '<li><span>Date:</span><p>' + $daydate + '</p></li>'; }
158					if($time != '') { schedule_details += '<li><span>Time:</span><p>' + $time + '</p></li>'; }
159				schedule_details += '</ul>';
160				
161			$('#dt-sc-schedule-details').html(schedule_details);	
162			
163			$('.dt-sc-schedule-box').hide();
164			$('.dt-sc-contactdetails-box').fadeIn(800);
165			
166			$("a.time-slot").removeClass('selected');
167			$(this).addClass('selected');
168			
169			$("ul.time-table").find('li,ul.time-slots').removeClass('selected'); 
170			$(this).parentsUntil("ul.time-table").addClass('selected'); 
171			
172			pregnancy_calculate_step_value();
173			
174		 });
175	
176	
177		 $(".dt-sc-about-project-form .schedule-it").click(function(e){
178			
179			e.preventDefault();
180	
181			$staffid = $('a.time-slot.selected').data('staffid');
182			$serviceid = $('a.time-slot.selected').data('serviceid');
183			$start = $('a.time-slot.selected').data('start');
184			$end = $('a.time-slot.selected').data('end');
185			$date = $('a.time-slot.selected').data('date');
186			$time = $('a.time-slot.selected').data('time');
187	
188			$firstname = $(".dt-sc-aboutproject-box #hid_firstname").val();
189			$lastname = $(".dt-sc-aboutproject-box #hid_lastname").val();
190			$phone = $(".dt-sc-aboutproject-box #hid_phone").val();
191			$emailid = $(".dt-sc-aboutproject-box #hid_emailid").val();
192			$address = $(".dt-sc-aboutproject-box #hid_address").val();
193			$about_your_project = $(".dt-sc-aboutproject-box #hid_about_your_project").val();
194			
195			
196			if( typeof($start) != 'undefined' ) {
197				$.ajax({
198					method: 'POST',
199					url: 	dttheme_urls.ajaxurl,
200					data: 	{ 
201						action: "pregnancy_dttheme_new_reservation",
202						staffid: $staffid,
203						serviceid: $serviceid,
204						start: $start,
205						end: $end,
206						date: $date,
207						time: $time,
208						
209						firstname: $firstname,
210						lastname: $lastname,
211						phone: $phone,
212						emailid: $emailid,
213						address: $address,
214						
215						aboutyourproject: $about_your_project,
216					},
217					dataType: 'json',
218					beforeSend: function(){
219						$('#dt-sc-ajax-load-image').show();
220					},
221					success: function( response ){
222						$('.dt-sc-notification-box').show();
223						if(response == 'Success') {
224							$('.dt-sc-apt-success-box').fadeIn(800);
225						} else {
226							$('.dt-sc-apt-error-box').fadeIn(800);
227						}
228					},
229					complete: function(){
230						$('#dt-sc-ajax-load-image').hide();
231						pregnancy_calculate_step_value();
232					} 
233				});
234			} else {
235				$("a.schedule-it").hide();
236			}
237		 });
238		}
239
240	
241	//dt_admin.js
242	jQuery('.select_start').on('change', function(){
243		var $row = jQuery(this).parent(),
244		$start_select = jQuery(this),
245		$end_select = jQuery('.select_end', $row);
246		
247		if( $start_select.val() ){
248			$end_select.show();
249		}else{
250			$end_select.hide();
251			$start_select.find('option[selected="selected"]').removeAttr('selected');
252			$end_select.find('option[selected="selected"]').removeAttr('selected');
253		}
254
255        jQuery('option', $end_select).each(function () {
256            jQuery(this).show();
257        });
258
259		var start_time = $start_select.val();
260		$current = $end_select.data('current');
261		
262		jQuery('option', $end_select).each(function(){
263			if (jQuery(this).val() <= start_time) {
264				jQuery(this).hide();
265				jQuery(this).removeAttr('selected');
266				if( $current < jQuery(this).val() ){
267					jQuery('option:visible:first', $end_select).attr('selected', 'selected');
268				}
269			} else if( !$current || $current == '00:00' ){
270				jQuery('option:visible:first', $end_select).attr('selected', 'selected');
271			}
272		});
273	}).each(function(){
274		var $row = jQuery(this).parent(),
275		$start_select = jQuery(this),
276		$end_select = jQuery('.select_end', $row);
277
278		if( !jQuery(this).val() ){
279			$end_select.hide();
280			$start_select.find('option[selected="selected"]').removeAttr('selected');
281			$end_select.find('option[selected="selected"]').removeAttr('selected');
282		}
283	}).trigger('change');
284	
285	
286	
287	//appointment type2
288	
289	
290
291	$(".start-time").change(function(){
292		var $s_time = $(this).val(),
293		$last = $('option:last', $(this));
294		
295		$(".end-time").empty();
296
297		if($(this)[0].selectedIndex < $last.index() ){
298			$('option', this).each(function () {
299				if ($(this).val() > $s_time) {
300					$(".end-time").append($(this).clone());
301                }
302            });
303		} else {
304			$(".end-time").append($last.clone()).val($last.val());
305		}
306	});
307	
308	/* V */
309	$(".show-time-shortcode").click(function(e){
310		$date = $("*[name=date]").val();
311		$stime = $('*[name=start-time]').val();
312		$etime = $('*[name=end-time]').val();
313		$staff = $('*[name=staff]').val();
314		$service = $('*[name=services]').val();
315		
316		//alert($date.length);
317		if( ($staff.length > 0 || $service.length > 0) && ($date.length > 0) ) {
318			$(".dt-sc-reservation-form").submit();
319		}else{
320			alert("Please Select Service and date");
321			return false;
322		}
323		
324	});
325	
326	function pregnancy_staff_reservation(){
327		$date = $("*[name=date]").val();
328		$stime = $('*[name=start-time]').val();
329		$etime = $('*[name=end-time]').val();
330		$staff = $('*[name=staff]').val();
331		$service = $('*[name=services]').val();
332
333		if( $staff.length > 0 || $service.length > 0 ) {
334				$.ajax({
335					method:'POST',
336					url: dttheme_urls.ajaxurl,
337					type: 'html',
338					data:{ action: 'pregnancy_dt_available_times', 
339						date :$date,
340						stime:$stime,
341						etime:$etime,
342						staffid:$staff,
343						staff: $('*[name=staff] :selected').text(),
344						serviceid:$service,
345						service:$('*[name=services] :selected').text()
346					},
347					complete: function(response){
348						if( response.status === 200 ) {
349							var $append = "";
350							if( $.trim(response.responseText).length > 0 ) {
351								$append += response.responseText;
352								$(".available-times").empty().append($append);
353							}
354						}
355					}
356				});
357		}else{
358			alert("Please choose Service");
359		}	
360	}
361	
362	$(".start-time").each(function(){
363		
364		$service = $('*[name=services]').val();
365		if( $service.length > 0 ) {
366			pregnancy_staff_reservation();
367		}
368	});
369	/* V */
370	
371	$(".show-time").click(function(e){
372		pregnancy_staff_reservation();
373		e.preventDefault();
374	});
375	
376	/* Time Slot Click */
377	
378	if($('body').hasClass('page-template-tpl-reservation-type1-php') ){
379		$("body").delegate("a.time-slot","click",function(e){
380			e.preventDefault();
381			$("div.personal-info").show();
382			$('html, body').animate({
383				scrollTop: $('#personalinfo').offset().top + 500
384			},2000);
385			
386			$("div.choose-payment").show();
387			$("a.time-slot").removeClass('selected');
388			$(this).addClass('selected');
389			
390			$("ul.time-table").find('li,ul.time-slots').removeClass('selected');
391			$(this).parentsUntil("ul.time-table").addClass('selected');
392		});
393	}
394	
395	$("body").delegate("select[name='payment_type']",'change',function(e){
396		$val = $(this).val();
397		if( $val.length > 0 ) {
398			$("a.schedule-it").show();
399		} else {
400			$("a.schedule-it").hide();
401		}
402	});
403
404	/* Book Schedule */
405	$("a.schedule-it").click(function(e){ 
406		e.preventDefault();
407
408		$staff = $('a.time-slot.selected').data('sid');
409		$service = $('*[name=services]').val();
410		$start = $('a.time-slot.selected').data('start');
411		$end = $('a.time-slot.selected').data('end');
412		$date = $('a.time-slot.selected').data('date');
413		$time = $('a.time-slot.selected').data('time');
414
415		$name = $("div.personal-info").find('input[name=name]').val();
416		$email = $("div.personal-info").find('input[name=email]').val();
417		$phone = $("div.personal-info").find('input[name=phone]').val();
418		$body = $("div.personal-info").find('textarea[name=note]').val();
419		
420		$captcha = $("div.personal-info").find('input[name=captcha]').val();
421		$hcaptcha = $("div.personal-info").find('input[name=hiddencaptcha]').val();
422		
423		
424		
425		if( $name.length == "" ){
426			alert("Please enter name");
427			return false;
428		}
429		
430		if( $email.length == "" ){ 
431			var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
432            if( emailReg.test( $email ) ) { 
433                alert('Please enter valid email');
434				return false;
435            } 
436		}
437		
438		if( $phone.length < 5 ){
439			alert("Please enter Phone number");
440			return false;
441		}
442		
443		if( $captcha.length <= 0 ){
444			alert("Please enter captcha");
445			return false;
446		}
447		
448		if( $captcha !== $hcaptcha){
449			alert("Please verify entered captcha");
450			return false;
451		}
452		
453		$payment = $("select[name='payment_type']").val();
454
455		$action  = "pregnancy_dt_new_reservation";
456
457		if( typeof($start) != 'undefined' ) {
458			$.ajax({
459				method: 'POST',
460				url: 	dttheme_urls.ajaxurl,
461				data: 	{ 
462					action: $action,
463					staff: 	$staff,
464					service:$service,
465					start: 	$start,
466					end: 	$end,
467					name: 	$name,
468					email: 	$email,
469					phone: 	$phone,
470					body: 	$body,
471					date:  $date,
472					time:  $time
473				},
474				dataType: 'json',
475				success: function( response ){
476					window.location = response.url;
477				}
478			});
479		} else {
480			$("a.schedule-it").hide();
481		}
482
483	});
484	
485	/* Book Schedule */
486	
487	
488
489});

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.