File: /var/www/html/hrms-production/storage/framework/views/223745f8afc113dcd04d53be476d3c52664a378d.php
<div class="modal fade" id="addAppCate">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Add Appointment Category</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<!-- Main content -->
<form id="addAppCateform">
<input type="hidden" name="_token" id="token_appcate" value="<?php echo e(csrf_token()); ?>">
<div class="card-body">
<div class="row">
<div class="col-md-12">
<div class="form-group mb-2">
<label class="mb-0" for="name">Category Name<span class="text-danger">*</label>
<input type="text" class="form-control form-control-sm" id="AppointmentCategoryName"
name="AppointmentCategoryName" onkeyup="checkDuplicateAppCate(this);" required>
</span><span id='CheckAppointmentCategory'></span>
</div>
</div>
</div>
<hr />
<div class="row">
<div class="col-12">
<div class="d-flex align-items-center justify-content-center">
<button type="button" class="btn btn-sm btn-outline-secondary mx-1"
data-dismiss="modal" aria-label="Close">Cancel</button>
<button type="submit" id="btn-save-new-appcate"
class="btn btn-sm btn-outline-info mx-1">Save & New</button>
<button type="submit" id="btn-save-appcate"
class="btn btn-sm btn-info mx-1">Save</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<div class="modal fade" id="updateAppCate">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Appointment Category <span id="AppCateName" class="text-info"></span></h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<!-- Main content -->
<form id="updateAppCateform">
<input type="hidden" name="_token" id="token_appcate_update" value="<?php echo e(csrf_token()); ?>">
<input type="hidden" id="AppointmentCategoryId" name="AppointmentCategoryId">
<div class="card-body">
<div class="row">
<div class="col-md-12">
<div class="form-group mb-2">
<label class="mb-0" for="name">Place Name<span class="text-danger">*</span></label>
<input type="text" class="form-control form-control-sm"
id="editAppointmentCategoryName" name="AppointmentCategoryName"
onkeyup="checkDuplicateAppCate(this);" required>
<span id='editCheckAppointmentCategory'></span>
</div>
</div>
</div>
<hr />
<div class="row">
<div class="col-12">
<div class="d-flex align-items-center justify-content-center">
<button type="button" class="btn btn-sm btn-outline-secondary mx-1"
data-dismiss="modal" aria-label="Close">Cancel</button>
<button type="button" id="btn-update-appcate" name="Update" value="Update"
class="btn btn-sm btn-info mx-1" disabled>Update</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<script>
function checkDuplicateAppCate(element, id){
var id = id;
var AppointmentCategory = $(element).val();
if (AppointmentCategory == "") {
$('span#CheckAppointmentCategory, #editCheckAppointmentCategory').css("display", "none");
} else {
$('span#CheckAppointmentCategory, #editCheckAppointmentCategory').css("display", "block");
}
//alert (AppointmentCategory);
$.ajax({
type: "GET",
url: '<?php echo e(url("/")); ?>/check-appointment-category/',
data: {AppointmentCategory:AppointmentCategory, id:id},
dataType: "json",
success: function(res) {
if(res.exists){
$('span#CheckAppointmentCategory, span#editCheckAppointmentCategory').html('<span class="text-danger">Category name is already exist!</span>');
$('#btn-save-new-appcate, #btn-save-appcate, #btn-update-appcate').attr('disabled', true);
} else {
$('span#CheckAppointmentCategory, span#editCheckAppointmentCategory').html('<span class="text-success">Category name is available!</span>');
$('#btn-save-new-appcate, #btn-save-appcate, #btn-update-appcate').attr('disabled', false);
}
},
error: function (jqXHR, exception) {
}
});
}
</script>
<script>
var reload = 0;
$(function () {
$.validator.setDefaults({
submitHandler: function () {
saveAppCateRecord();
}
});
// Reload page after data save
$('#btn-save-appcate').click(function(){
reload = 1;
});
// Validate Fields
$('#addAppCateform').validate({
rules: {
AppointmentCategoryName: {
required: true,
},
},
messages: {
AppointmentCategoryName: {
required: "Please enter the category name",
},
},
errorElement: 'span',
errorPlacement: function (error, element) {
error.addClass('invalid-feedback');
element.closest('.form-group').append(error);
},
highlight: function (element, errorClass, validClass) {
$(element).addClass('is-invalid');
},
unhighlight: function (element, errorClass, validClass) {
$(element).removeClass('is-invalid');
}
});
});
</script>
<script>
function saveAppCateRecord() {
event.preventDefault();
$.ajax({
type: "post",
url: "<?php echo e(url('store-appointment-category')); ?>",
dataType: "json",
data: $('form#addAppCateform').serialize(),
success: function(response) {
const Toast = Swal.mixin({
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 2000,
timerProgressBar: true,
didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
})
Toast.fire({
icon: 'success',
title: 'Category added successfully!'
});
$('form#addAppCateform').each(function() {
this.reset();
});
$('span#CheckAppointmentCategory').html('');
if(reload)
{
location.reload();
}
},
error: function(response) {
const Toast = Swal.mixin({
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 3000,
timerProgressBar: true,
didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
})
Toast.fire({
icon: 'error',
title: 'Sorry, Something went wrong!'
})
}
});
}
</script>
<script>
// Activate
function activateAppCate(AppointmentCategoryId) {
var AppointmentCategoryId = AppointmentCategoryId;
Swal.fire({
title: 'Activate Category?',
text: "Are you sure you want to activate Category!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, activate it!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "get",
url: "<?php echo e(url('/')); ?>/change-status-appointment-category/" + AppointmentCategoryId,
success: function(response) {
Swal.fire({
icon: 'success',
title: 'Category has been activated!',
showConfirmButton: false,
timer: 1500
}).then(function() {
location.reload();
});
}
});
}
});
}
// Deactivate
function deactivateAppCate(AppointmentCategoryId) {
var AppointmentCategoryId = AppointmentCategoryId;
Swal.fire({
title: 'De-activate Category?',
text: "Are you sure you want to De-activate Category!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, De-activate it!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "get",
url: "<?php echo e(url('/')); ?>/change-status-appointment-category/" + AppointmentCategoryId,
success: function(response) {
Swal.fire({
icon: 'success',
title: 'Category has been De-activated!',
showConfirmButton: false,
timer: 1500
}).then(function() {
location.reload();
});
}
});
}
});
}
</script>
<script>
function editAppCate(AppointmentCategoryId)
{
var AppointmentCategoryId = AppointmentCategoryId;
$('#updateAppCate').modal('show');
$.ajax({
type: "GET",
url: "<?php echo e(url('/')); ?>/edit-appointment-category/" +AppointmentCategoryId,
success: function (response) {
$('#editAppointmentCategoryName').val(response.AppointmentCategory.AppointmentCategoryName);
$('#AppointmentCategoryId').val(AppointmentCategoryId);
$('span#AppCateName').html('#' +response.AppointmentCategory.AppointmentCategoryName);
}
});
}
</script>
<script>
$("#btn-update-appcate").click(function (event) {
event.preventDefault();
var Name = $("#editAppointmentCategoryName").val();
if (Name == "") {
Swal.fire({
icon: "warning",
title: "Name is required!",
showConfirmButton: false,
timer: 2000,
});
} else {
$.ajax({
type: "post",
url: "<?php echo e(url('update-appointment-category')); ?>",
dataType: "json",
data: $("form#updateAppCateform").serialize(),
success: function (response) {
Swal.fire({
icon: "success",
title: "Category has been updated!",
showConfirmButton: false,
timer: 2000,
}).then(function () {
location.reload();
});
},
error: function (response) {
Swal.fire({
icon: "error",
title: "Some thing went wrong!",
showConfirmButton: false,
timer: 2000,
});
},
});
}
});
</script>
<script>
//Delete Appointment Category
function deleteAppCate(AppointmentCategoryId) {
var AppointmentCategoryId = AppointmentCategoryId;
$.ajax({
type: "GET",
url: "<?php echo e(url('/')); ?>/check-employee-appointment-category/" + AppointmentCategoryId,
success: function (response) {
if (response.exists) {
Swal.fire({
icon: "warning",
title: "Can't be deleted!",
text: "This Category is associated with empolyee(s)!",
showConfirmButton: true,
});
} else {
Swal.fire({
title: "Delete Category?",
text: "Are you sure you want to delete this Category?",
icon: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: "Yes, delete it!",
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "get",
url:
"<?php echo e(url('/')); ?>/delete-appointment-category/" +
AppointmentCategoryId,
success: function (response) {
Swal.fire({
icon: "success",
title: "Category has been deleted!",
showConfirmButton: false,
timer: 1500,
}).then(function () {
location.reload();
});
},
});
}
});
}
},
});
}
</script><?php /**PATH /var/www/html/hrms-production/resources/views/components/appointment-category-modal.blade.php ENDPATH**/ ?>