Advertisement
Guest User

Untitled

a guest
May 26th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. function doctorCalendar(){
  2. var schedule_used = ['00:00'];
  3. function initTime(){
  4. $('#time').datetimepicker({
  5. datepicker:false,
  6. format:'H:i',
  7. step:15,
  8. allowTimes: schedule_used,
  9. inline:true,
  10. });
  11. }
  12. initTime();
  13. function scheduleDay(){
  14. var dates = '';
  15. $('.work_date').each(function(){
  16. var date2 = $(this).find('.date').text();
  17. dates += date2 + ',';
  18. });
  19. return dates;
  20. }
  21. var global_date1 = [scheduleDay().split(',')];
  22. var global_date1_arr = global_date1[0].slice(0, -1)
  23. $('#date').datetimepicker({
  24. timepicker:false,
  25. format:'Y-m-d',
  26. inline:true,
  27. dayOfWeekStart: 1,
  28. minDate:0,
  29. scrollMonth: 0,
  30. scrollInput: 0,
  31. highlightedDates: global_date1_arr,
  32. onChangeDateTime:function(dp,$input){
  33. function scheduleDay(){
  34. var day = $('#date').val().toString();
  35. return day;
  36. }
  37. var global_schedule_time = '';
  38.  
  39. function times(){
  40. $('.work_date').each(function(){
  41. var date2 = $(this).find('.date').text();
  42. var date1 = scheduleDay();
  43. if(date1 == date2) {
  44. var time = $(this).find('.time').text();
  45. global_schedule_time += time + ',';
  46. }
  47. });
  48. return global_schedule_time;
  49. }
  50.  
  51. var time_arr = [times().split(',')];
  52. var times_schedule = time_arr[0].slice(0, -1);
  53. var global_date2 = '';
  54. $('.work_date').each(function(){
  55. var date2 = $(this).find('.date').text();
  56. var date1 = scheduleDay();
  57. if(date1 == date2) {
  58. global_date2 = date2;
  59. }
  60. });
  61. schedule_used = (global_date2 == scheduleDay()) ? times_schedule : ['00:00'];
  62. initTime();
  63. }
  64. });
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement