![]() 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/resources/assets/js/clinic_schedule/ |
'use strict'; $(document).on('submit', '#saveForm', function (e) { e.preventDefault(); let data = new FormData($(this)[0]); $.ajax({ url: route('checkRecord'), type:'POST', data:$(this).serialize(), success: function (result) { saveUpdateForm(data) }, error: function (result) { Swal.fire({ title: 'Delete !', text: result.responseJSON.message, type: 'warning', icon: 'warning', showCancelButton: true, closeOnConfirm: true, confirmButtonColor: '#266CB0', showLoaderOnConfirm: true, cancelButtonText: 'No, Cancel', confirmButtonText: 'Yes, Update!', }).then(function (result) { if (result.isConfirmed) { saveUpdateForm(data) } }); }, }) }); function saveUpdateForm(data){ $.ajax({ url: $(this).attr('action'), type: 'POST', data: data, processData: false, contentType: false, success: function (result) { if (result.success) { displaySuccessMessage(result.message); setTimeout(function () { location.reload(); }, 1500); } }, error: function (result) { displayErrorMessage(result.responseJSON.message); }, complete: function () { }, }); } $(document).on('change', 'select[name^="startTimes"]', function (e) { let selectedIndex = $(this)[0].selectedIndex; let endTimeOptions = $(this).closest('.weekly-row').find('select[name^="endTimes"] option'); endTimeOptions.eq(selectedIndex + 1).prop('selected', true).trigger('change'); endTimeOptions.each(function (index) { if (index <= selectedIndex) { $(this).attr('disabled', true); }else{ $(this).attr('disabled', false); } }); });