init project
This commit is contained in:
204
resources/views/layout/common_script.blade.php
Normal file
204
resources/views/layout/common_script.blade.php
Normal file
@@ -0,0 +1,204 @@
|
||||
|
||||
<script>
|
||||
/**
|
||||
* Commons
|
||||
*/
|
||||
|
||||
// routes url
|
||||
|
||||
let csrf_token = "{{ csrf_token() }}";
|
||||
|
||||
let get_refs_base_url = "{{url('refs')}}";
|
||||
let sample_redir_url = "{{url('sample')}}";
|
||||
let patient_base_url = "{{url('patient')}}";
|
||||
let inventory_base_url = "{{url('inventory')}}";
|
||||
var vaccination_base_url = "{{url('vaccination')}}";
|
||||
var sample_base_url = "{{url('sample')}}";
|
||||
let queue_redir_url = "{{url('queue')}}";
|
||||
|
||||
|
||||
let confirm_delete_record = "{{__('general.confirm_delete_record')}}";
|
||||
let confirm_ok_delete = "{{__('general.confirm_ok_delete')}}";
|
||||
let delete_success = "{{__('general.delete_success')}}";
|
||||
let delete_failed = "{{__('general.delete_failed')}}";
|
||||
let choose_option = "{{__('general.choose_option')}}";
|
||||
let confirm_cancel = "{{__('general.confirm_cancel')}}";
|
||||
|
||||
let confirm_restore_record = "{{__('general.confirm_restore_record')}}";
|
||||
let confirm_ok_restore = "{{__('general.confirm_ok_restore')}}";
|
||||
let confirm_cancel_restore = "{{__('general.confirm_cancel_restore')}}";
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script src="{{url(env("APP_URL").'storage/assets/vendors/js/vendor.bundle.base.js')}}"></script>
|
||||
<script src="{{url(env("APP_URL").'storage/assets/vendors/chart.js/Chart.min.js')}}"></script>
|
||||
<script src="{{url(env("APP_URL").'storage/assets/js/off-canvas.js')}}"></script>
|
||||
<script src="{{url(env("APP_URL").'storage/assets/js/hoverable-collapse.js')}}"></script>
|
||||
<script src="{{url(env("APP_URL").'storage/assets/js/template.js')}}"></script>
|
||||
<script src="{{url(env("APP_URL").'storage/assets/js/settings.js')}}"></script>
|
||||
<script src="{{url(env("APP_URL").'storage/assets/js/todolist.js')}}"></script>
|
||||
<script src="{{url(env("APP_URL").'storage/assets/vendors/select2/select2.min.js')}}"></script>
|
||||
<script src="{{url(env("APP_URL").'storage/assets/libs/alertifyjs/build/alertify.min.js')}}"></script>
|
||||
<script src="{{url(env("APP_URL").'storage/assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script src="{{url(env("APP_URL").'storage/assets/js/admin/global_funs.js')}}"></script>
|
||||
|
||||
<script>
|
||||
|
||||
$(".select2, .select2-multiple").select2({
|
||||
placeholder: '{{__('general.select2_tag_placeholder')}}',
|
||||
"language": {
|
||||
"noResults": function(){
|
||||
return "{{__('general.select2_no_result')}}!";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
$(".select2-tags").select2({
|
||||
placeholder: '{{__('general.select2_tag_placeholder')}}',
|
||||
tags:true
|
||||
});
|
||||
|
||||
|
||||
var url = document.location.toString();
|
||||
if (url.match('#')) {
|
||||
$('.nav-tabs a[href="#' + url.split('#')[1] + '-tab"]').tab('show');
|
||||
} //add a suffix
|
||||
|
||||
// Change hash for page-reload
|
||||
$('.nav-tabs a').on('shown.bs.tab', function (e) {
|
||||
window.location.hash = e.target.hash;
|
||||
})
|
||||
|
||||
alertify.set('notifier','position', 'top-right');
|
||||
|
||||
var $loading = $('#loadingDiv').hide();
|
||||
$(document)
|
||||
|
||||
$('form').attr('autocomplete','off')
|
||||
|
||||
.ajaxStart(function () {
|
||||
$loading.fadeIn();
|
||||
})
|
||||
.ajaxStop(function () {
|
||||
$loading.fadeOut()
|
||||
});
|
||||
|
||||
|
||||
function toggleElements(elementShow, elementHide){
|
||||
$(elementHide).toggle()
|
||||
$(elementShow).toggle()
|
||||
}
|
||||
|
||||
function showPreviewSignature(event){
|
||||
if(event.target.files.length > 0){
|
||||
var src = URL.createObjectURL(event.target.files[0]);
|
||||
var preview = document.getElementById("signature-preview");
|
||||
preview.src = src;
|
||||
preview.style.display = "block";
|
||||
$('#signature-upload-form').submit();
|
||||
}
|
||||
}
|
||||
|
||||
$('#signature-upload-form').submit(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = new FormData(this);
|
||||
$.ajax({
|
||||
url: '{{'user/profile/signature/upload'}}',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function (response) {},
|
||||
error: function (xhr, status, error) {}
|
||||
});
|
||||
});
|
||||
|
||||
$('#btn-remove-signature').click(function(e) {
|
||||
$.ajax({
|
||||
url: '{{'user/profile/signature/remove'}}',
|
||||
type: 'POST',
|
||||
data: {"_token": "{{ csrf_token() }}"},
|
||||
success:function(res){
|
||||
$('#signature-preview').attr('src',"")
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.btn-change-password').click(function () {
|
||||
$.ajax({
|
||||
url: "{{url('user/password/change')}}",
|
||||
type:"POST",
|
||||
data :{
|
||||
"_token": "{{ csrf_token() }}",
|
||||
current_password : $('#cur-password').val(),
|
||||
new_password: $('#new-password').val(),
|
||||
new_password_confirmation: $('#confirm-password').val()
|
||||
},
|
||||
success:function(res){
|
||||
console.log(res)
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$.ajax({
|
||||
url: "{{ route('alert-notifications') }}",
|
||||
type: "GET",
|
||||
success: function(res){
|
||||
if(res.success){
|
||||
let notify = $('#notify');
|
||||
notify.addClass('rounded-bottom-right-15')
|
||||
notify.addClass('rounded-bottom-left-15')
|
||||
notify.empty();
|
||||
notify.append('<p class="mb-0 font-weight-normal font-13 float-left dropdown-header text-muted" style="margin-right: 150px">{{__('general.notification')}}</p>');
|
||||
res.data.forEach(function(appointment){
|
||||
notify.append('<a class="dropdown-item preview-item app-modal" data-info="Patient: '+appointment.patient.name_en+', Phone: '+appointment.patient.phone_number+', Description: '+appointment.description+', Date: '+appointment.appointment_date+', Doctor: '+appointment.doctor.name_en+', Ap-Type: ' + appointment.appointment_type+'" href="#"><span class="mdi mdi-bell-outline fa"></span><div class="preview-item-content flex-grow"><p class="font-weight-light small-text text-success mb-0">'+appointment.patient.name_en+' - '+appointment.appointment_date+'</p></div></a>');
|
||||
})
|
||||
}
|
||||
$('#app_notify').text(res.count > 0 ? res.count : '').toggleClass('d-none', res.count < 1);
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<div class="modal" id="appointment-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">{{__('general.notification')}}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body" id="confirmation-modal-body">
|
||||
<h5 class="text-muted font-14">{{__('appointment.date')}} : <span id="modal-appointment-date" class="text-dark pull-right"></span></h5>
|
||||
<h5 class="text-muted font-14">{{__('appointment.patient')}} : <span id="modal-patient-name" class="text-dark pull-right"></span></h5>
|
||||
<h5 class="text-muted font-14">{{__('patient.table_phon')}} : <span id="modal-patient-phone" class="text-dark pull-right"></span></h5>
|
||||
<h5 class="text-muted font-14">{{__('appointment.type')}} : <span id="modal-ap-type" class="text-dark pull-right"></span></h5>
|
||||
<h5 class="text-muted font-14">{{__('appointment.doctor')}} : <span id="modal-doctor-name" class="text-dark pull-right"></span></h5>
|
||||
<h5 class="text-muted font-14">{{__('appointment.description')}} <br><br> <span id="modal-description" class="text-dark"></span></h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).on('click', '.app-modal', function(e){
|
||||
e.preventDefault();
|
||||
let info = $(this).data('info');
|
||||
let infoArr = info.split(', ');
|
||||
$('#modal-patient-name').text(infoArr[0].split(': ')[1]);
|
||||
$('#modal-patient-phone').text(infoArr[1].split(': ')[1]);
|
||||
$('#modal-description').text(infoArr[2].split(': ')[1]);
|
||||
$('#modal-appointment-date').text(infoArr[3].split(': ')[1]);
|
||||
$('#modal-doctor-name').text(infoArr[4].split(': ')[1]);
|
||||
$('#modal-ap-type').text(infoArr[5].split(': ')[1]);
|
||||
$('#appointment-modal').modal('show');
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user