![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/clinic.corals.io/public/assets/js/doctor_sessions/ |
(()=>{"use strict";$(document).ready((function(){1==!isEdit&&($(".startTimeSlot").prop("disabled",!0),$(".endTimeSlot").prop("disabled",!0)),$("#selGap").change((function(){$(".startTimeSlot").prop("disabled",!1),$(".endTimeSlot").prop("disabled",!1)}))})),$(document).on("click",".add-session-time",(function(){if(1==!isEdit&&""==$("#selGap").val())return!1;var e=0;$(this).parent().prev().children(".session-times").find(".timeSlot:last-child").length>0&&(e=$(this).parent().prev().children(".session-times").find(".timeSlot:last-child").children(".add-slot").find('select[name^="endTimes"] option:selected')[0].index);var t=$(this).closest(".weekly-content").attr("data-day"),s=$(this),n=$(this).closest(".weekly-content"),i=$("#selGap").val();$.ajax({url:getSlotByGapUrl,data:{gap:i,day:t},success:function(t){n.find(".unavailable-time").html(""),n.find('input[name="checked_week_days[]"').prop("checked",!0).prop("disabled",!1),s.closest(".weekly-content").find(".session-times").append(t.data),n.find('select[data-control="select2"]').select2(),$(".add-session-time").parent().prev().children(".session-times").find(".timeSlot:last-child").children(".add-slot").find('select[name^="startTimes"] option').each((function(t){t<=e?$(this).attr("disabled",!0):$(this).attr("disabled",!1)}))}})})),$(document).on("click",".copy-btn",(function(){$(this).closest(".copy-card").removeClass("show");var e=$(this).closest(".weekly-content").find(".session-times").find("select");if(0==e.length)$(this).closest(".menu-content").find(".copy-label .form-check-input:checked").each((function(){var e=$('.weekly-content[data-day="'.concat($(this).val(),'"]'));$(e).find(".session-times").html(""),e.find(".weekly-row").find(".unavailable-time").remove(),e.find(".weekly-row").append('<div class="unavailable-time">Unavailable</div>'),$(e).find(".weekly-row").find('input[name="checked_week_days[]"').prop("checked",!1).prop("disabled",!0)}));else{e.each((function(){$(this).select2("destroy")}));var t=$(this).closest(".weekly-content").find(".session-times").find("select"),s=$(this).closest(".weekly-content").find(".session-times").clone();$(this).closest(".menu-content").find(".copy-label .form-check-input:checked").each((function(){var e=s,n=$(this).val(),i='.weekly-content[data-day="'.concat(n,'"]');e.find('select[name^="startTimes"]').attr("name","startTimes[".concat(n,"][]")),e.find('select[name^="endTimes"]').attr("name","endTimes[".concat(n,"][]")),$(i).find(".unavailable-time").html(""),e.find(".error-msg").html(""),$(i).find(".session-times").html(e.html()),$(i).find(".session-times select").select2(),$(i).find('input[name="checked_week_days[]"').prop("disabled",!1).prop("checked",!0),$(t).each((function(e){$(i).find(".session-times").find("select").eq(e).val($(this).val()).trigger("change")}))})),$(this).closest(".weekly-content").find(".session-times").find("select").each((function(){$(this).select2()})),$(".copy-check-input").prop("checked",!1)}})),$(document).on("click",".deleteBtn",(function(){var e=0;($(this).closest(".timeSlot").prev().length>0&&(e=$(this).closest(".timeSlot").prev().children(".add-slot").find('select[name^="endTimes"] option:selected')[0].index),2==$(this).closest(".weekly-row").find(".session-times").find("select").length)&&($(this).closest(".weekly-row").find('input[name="checked_week_days[]"').prop("checked",!1).prop("disabled",!0),$(this).closest(".weekly-row").append('<div class="unavailable-time">Unavailable</div>'));$(this).closest(".timeSlot").next().children(".add-slot").find('select[name^="startTimes"] option').each((function(t){t<=e?$(this).attr("disabled",!0):$(this).attr("disabled",!1)})),$(this).parent().siblings(".error-msg").remove(),$(this).parent().closest(".timeSlot").remove(),$(this).parent().remove()})),$(document).on("submit","#saveForm",(function(e){if(e.preventDefault(),!$('input[name="checked_week_days[]"]:checked').length)return displayErrorMessage("Please select any one day"),!1;$(".weekly-content").find(".error-msg").text(""),$.ajax({url:$(this).attr("action"),type:"POST",data:new FormData($(this)[0]),processData:!1,contentType:!1,success:function(e){e.success&&(displaySuccessMessage(e.message),setTimeout((function(){location.href=$("#btnBack").attr("href")}),1500))},error:function(e){var t=e.responseJSON.message,s=t.day,n=t.key;$('.weekly-content[data-day="'.concat(s,'"]')).find(".error-msg").text(""),$('.weekly-content[data-day="'.concat(s,'"]')).find(".error-msg").eq(n).text("Slot timing is overlap with other slot timing")},complete:function(){}})})),$(document).ready((function(){$('select[name^="startTimes"]').each((function(){var e=$(this)[0].selectedIndex,t=$(this).closest(".add-slot").find('select[name^="endTimes"] option:selected')[0].index,s=$(this).closest(".add-slot").find('select[name^="endTimes"] option');e>=t&&s.eq(e+1).prop("selected",!0).trigger("change"),s.each((function(t){t<=e?$(this).attr("disabled",!0):$(this).attr("disabled",!1)}))}))})),$(document).on("change",'select[name^="startTimes"]',(function(e){var t=$(this)[0].selectedIndex,s=$(this).closest(".add-slot").find('select[name^="endTimes"] option'),n=$(this).closest(".add-slot").find('select[name^="endTimes"] option:selected')[0].index;t>=n&&s.eq(t+1).prop("selected",!0).trigger("change"),s.each((function(e){e<=t?$(this).attr("disabled",!0):$(this).attr("disabled",!1)}))})),$(document).ready((function(){$('select[name^="endTimes"]').each((function(){var e=$(this)[0].selectedIndex;$(this).closest(".timeSlot").next().find('select[name^="startTimes"] option').each((function(t){t<=e?$(this).attr("disabled",!0):$(this).attr("disabled",!1)}))}))})),$(document).on("change",'select[name^="endTimes"]',(function(e){var t=$(this)[0].selectedIndex;$(this).closest(".timeSlot").next().find('select[name^="startTimes"] option').each((function(e){e<=t?$(this).attr("disabled",!0):$(this).attr("disabled",!1)}))}))})();