![]() 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/appointments/ |
(()=>{"use strict";var t="#appointmentsTable";$(document).ready((function(){var e=moment().startOf("week"),n=moment().endOf("week"),a=$("#patientAppointmentDate");function o(t,e){a.html(t.format("YYYY-MM-DD")+" - "+e.format("YYYY-MM-DD"))}a.daterangepicker({startDate:e,endDate:n,ranges:{Today:[moment(),moment()],Yesterday:[moment().subtract(1,"days"),moment().subtract(1,"days")],"This Week":[moment().startOf("week"),moment().endOf("week")],"Last 30 Days":[moment().subtract(29,"days"),moment()],"This Month":[moment().startOf("month"),moment().endOf("month")],"Last Month":[moment().subtract(1,"month").startOf("month"),moment().subtract(1,"month").endOf("month")]}},o),o(e,n);var r=isEmpty(userRole)?route("appointments.index"):route("patients.appointments.index"),s=$(t).DataTable({deferRender:!0,processing:!0,serverSide:!0,searchDelay:500,language:{lengthMenu:"Show _MENU_"},order:[[1,"desc"]],ajax:{url:r,data:function(t){t.status=$("#patientAppointmentStatus").find("option:selected").val(),t.payment_type=$("#patientPaymentStatus").find("option:selected").val(),t.filter_date=a.val()}},columnDefs:[{targets:[0],width:"25%"},{targets:[1],width:"20%"},{targets:[2],width:"20%"},{targets:[3],searchable:!1},{targets:[4],orderable:!1,searchable:!1},{targets:[5],className:"text-center",orderable:!1}],columns:[{data:function(t){return'<div class="symbol symbol-circle symbol-50px overflow-hidden me-3">\n <div class="symbol-label">\n <img src="'.concat(t.doctor.user.profile_image,'" alt=""\n class="w-100 object-cover">\n </div>\n </div>\n <div class="d-inline-block align-top">\n <a class="text-primary-800 mb-1 d-block">').concat(t.doctor.user.full_name,'</a>\n <span class="d-block text-muted fw-bold">').concat(t.doctor.user.email,"</span>\n </div>")},name:"doctor.user.full_name"},{data:function(t){return'<div class="badge badge-light-info">\n <div class="mb-2">'.concat(t.from_time," ").concat(t.from_time_type," - ").concat(t.to_time," ").concat(t.to_time_type,'</div>\n <div class="">').concat(moment(t.date).format("Do MMM, Y "),"</div>\n </div>")},name:"date"},{data:function(t){return currencyIcon+" "+addCommas(t.payable_amount)},name:"payable_amount"},{data:function(t){return 2===t.payment_type?'<span class="badge badge-light-success">'.concat(paid,"</span>"):'<span class="badge badge-light-danger">'.concat(pending,'</span>\n <a href="javascript:void(0)" data-id="').concat(t.id,'" class="btn btn-icon btn-bg-light text-hover-primary btn-sm me-1 payment-btn" data-bs-custom-class="tooltip-dark" data-bs-placement="bottom" title="Appointment Payment">\n <i class="far fa-credit-card fs-4"></i>\n </a>')},name:"payment_type"},{data:function(t){var e=t.status;return'<div class="w-120px d-flex align-items-center">\n <span class="bg-'.concat(["danger","primary","success","warning","danger"][e],' rounded-circle h-10px w-10px me-2"></span>\n <span class="">').concat({1:"Booked",2:"Check In",3:"Check Out",4:"Cancelled"}[e],"</span>\n </div>")},name:"status"},{data:function(t){var e=[{id:t.id,role:userRole,canceled:t.status,showUrl:route("patients.appointment.detail",t.id)}];return prepareTemplateRender("#appointmentsTemplate",e)},name:"id"}],fnInitComplete:function(){$("#patientAppointmentStatus").change((function(){$("#filter").removeClass("show"),$("#filterBtn").removeClass("show"),$("#appointmentsTable").DataTable().ajax.reload(null,!0)})),$("#patientPaymentStatus").change((function(){$("#filter").removeClass("show"),$("#filterBtn").removeClass("show"),$("#appointmentsTable").DataTable().ajax.reload(null,!0)})),$("#patientAppointmentDate").change((function(){$("#appointmentsTable").DataTable().ajax.reload(null,!0)}))}});handleSearchDatatable(s),$(document).on("click","#resetFilter",(function(){$("#patientAppointmentStatus").val(book).trigger("change"),a.data("daterangepicker").setStartDate(moment().startOf("week").format("MM/DD/YYYY")),a.data("daterangepicker").setEndDate(moment().endOf("week").format("MM/DD/YYYY"))}))})),$(document).on("click",".delete-btn",(function(e){var n=$(e.currentTarget).data("id"),a=isEmpty(userRole)?route("appointments.destroy",n):route("patients.appointments.destroy",n);deleteItem(a,t,"Appointment")})),$(document).on("click",".cancel-appointment",(function(e){var n=$(e.currentTarget).data("id");cancelAppointment(route("patients.cancel-status"),t,"Appointment",n)})),window.cancelAppointment=function(t,e,n,a){Swal.fire({title:"Cancelled Appointment !",text:"Are you sure want to cancel this "+n+" ?",type:"warning",icon:"warning",showCancelButton:!0,closeOnConfirm:!1,confirmButtonColor:"#266CB0",showLoaderOnConfirm:!0,cancelButtonText:"No",confirmButtonText:"Yes"}).then((function(t){t.isConfirmed&&function(t,e,n,a){$.ajax({url:route("patients.cancel-status"),type:"POST",data:{appointmentId:a},success:function(t){t.success&&(1==$(e).DataTable().data().count()?$(e).DataTable().page("previous").draw("page"):$(e).DataTable().ajax.reload(null,!1)),Swal.fire({title:"Cancelled Appointment!",text:n+" has been Cancelled.",icon:"success",confirmButtonColor:"#266CB0",timer:2e3})},error:function(t){Swal.fire({title:"Error",icon:"error",text:t.responseJSON.message,type:"error",confirmButtonColor:"#266CB0",timer:5e3})}})}(0,e,n,a)}))},$(document).on("click",".payment-btn",(function(t){Swal.fire({title:"Appointment Payment !",text:"Are you sure want to payment this appointment ?",type:"warning",icon:"warning",showCancelButton:!0,closeOnConfirm:!1,confirmButtonColor:"#266CB0",showLoaderOnConfirm:!0,cancelButtonText:"No",confirmButtonText:"Yes"}).then((function(e){if(e.isConfirmed){var n=$(t.currentTarget).data("id");$.ajax({url:route("patients.appointment-payment"),type:"POST",data:{appointmentId:n},success:function(t){var e=t.data.sessionId;stripe.redirectToCheckout({sessionId:e}).then((function(t){manageAjaxErrors(t)}))}})}}))}))})();