File: /var/www/html/hrms-production/storage/framework/views/0bed3b9a8c230bb535c218954936cbbd029a6b4b.php
<div class="modal fade" id="addPayBand">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Add Pay Band</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="addPayBandform">
<input type="hidden" name="_token" id="token_payband" value="<?php echo e(csrf_token()); ?>">
<div class="card-body">
<div class="row">
<div class="col-md-6">
<div class="form-group mb-">
<label class="mb-0" for="Pay Scale">Pay Scale/Pay Commision</label>
<select class="form-control form-control-sm select2" style="width: 100%;" aria-hidden="true" name="PayScaleId" id="PayScaleIdPayBand" data-placeholder="Select PayScale">
<option value="" disabled selected>Select PayScale</option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0" for="name">PayBand Name<span class="text-danger">*</label>
<input type="text" class="form-control form-control-sm" id="PayBandName"
name="PayBandName" required>
</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-payband"
class="btn btn-sm btn-outline-info mx-1">Save & New</button>
<button type="submit" id="btn-save-payband"
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="updatePayBand">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Pay Band <span id="PayBandName" 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="updatePayBandform">
<input type="hidden" name="_token" id="token_payband_update" value="<?php echo e(csrf_token()); ?>">
<input type="hidden" id="PayBandId" name="PayBandId">
<div class="card-body">
<div class="row">
<div class="col-md-12">
<div class="form-group mb-2">
<label class="mb-0" for="name">PayBand Name<span class="text-danger">*</span></label>
<input type="text" class="form-control form-control-sm"
id="editPayBandName" name="PayBandName"
onkeyup="checkDuplicatePayBand(this);" required>
<span id='editCheckPayBand'></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-payband" 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>
$(document).ready(function() {
$.ajax({
type: "GET",
url: "<?php echo e(url('/payscale-list')); ?>",
dataType: "json",
success: function(response) {
var json = response.PayScale;
$.each(json, function(i, payscale) {
$("#PayScaleIdPayBand").append("<option value='" + payscale.PayScaleId + "'>" + payscale.PayScaleName + "</option>");
$('#PayScaleIdPayBand').trigger('change');
});
}
});
});
</script>
<script>
function checkDuplicatePayBand(element, id){
var id = id;
var PayBand = $(element).val();
if (PayBand == "") {
$('span#CheckPayBand, #editCheckPayBand').css("display", "none");
} else {
$('span#CheckPayBand, #editCheckPayBand').css("display", "block");
}
//alert (PayBand);
$.ajax({
type: "GET",
url: '<?php echo e(url("/")); ?>/check-pay-band/',
data: {PayBand:PayBand, id:id},
dataType: "json",
success: function(res) {
if(res.exists){
$('span#CheckPayBand, span#editCheckPayBand').html('<span class="text-danger">PayBand name is already exist!</span>');
$('#btn-save-new-payband, #btn-save-payband, #btn-update-payband').attr('disabled', true);
} else {
$('span#CheckPayBand, span#editCheckPayBand').html('<span class="text-success">PayBand name is available!</span>');
$('#btn-save-new-payband, #btn-save-payband, #btn-update-payband').attr('disabled', false);
}
},
error: function (jqXHR, exception) {
}
});
}
</script>
<script>
var reload = 0;
$(function () {
$.validator.setDefaults({
submitHandler: function () {
savePayBandRecord();
}
});
// Reload page after data save
$('#btn-save-payband').click(function(){
reload = 1;
});
// Validate Fields
$('#addPayBandform').validate({
rules: {
PayBandName: {
required: true,
remote: {
type: "POST",
url:'<?php echo e(url("/")); ?>/check-duplicate-payband',
data: {
PayBandName: function() {
return $( "#PayBandName" ).val();
},
PayScaleId: function() {
return $('#PayScaleIdPayBand').find(":selected").val();
},
'_token':$('meta[name="csrf-token"]').attr('content')
}
},
},
},
messages: {
PayBandName: {
required: "Please enter the PayBand name",
remote: "The Payband already exists in the selected scale.",
},
},
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 savePayBandRecord() {
event.preventDefault();
$.ajax({
type: "post",
url: "<?php echo e(url('store-pay-band')); ?>",
dataType: "json",
data: $('form#addPayBandform').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: 'PayBand added successfully!'
});
$('#PayScaleIdPayBand').val(null).trigger('change');
$('form#addPayBandform').each(function() {
this.reset();
});
$('span#CheckPayBand').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 activatePayBand(PayBandId) {
var PayBandId = PayBandId;
Swal.fire({
title: 'Activate PayBand?',
text: "Are you sure you want to activate PayBand!",
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-pay-band/" + PayBandId,
success: function(response) {
Swal.fire({
icon: 'success',
title: 'PayBand has been activated!',
showConfirmButton: false,
timer: 1500
}).then(function() {
location.reload();
});
}
});
}
});
}
// Deactivate
function deactivatePayBand(PayBandId) {
var PayBandId = PayBandId;
Swal.fire({
title: 'De-activate PayBand?',
text: "Are you sure you want to De-activate PayBand!",
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-pay-band/" + PayBandId,
success: function(response) {
Swal.fire({
icon: 'success',
title: 'PayBand has been De-activated!',
showConfirmButton: false,
timer: 1500
}).then(function() {
location.reload();
});
}
});
}
});
}
</script>
<script>
function editPayBand(PayBandId)
{
var PayBandId = PayBandId;
$('#updatePayBand').modal('show');
$.ajax({
type: "GET",
url: "<?php echo e(url('/')); ?>/edit-pay-band/" +PayBandId,
success: function (response) {
$('#editPayBandName').val(response.PayBand.PayBandName);
$('#PayBandId').val(PayBandId);
$('span#PayBandName').html('#' +response.PayBand.PayBandName);
}
});
}
</script>
<script>
$("#btn-update-payband").click(function (event) {
event.preventDefault();
var Name = $("#editPayBandName").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-pay-band')); ?>",
dataType: "json",
data: $("form#updatePayBandform").serialize(),
success: function (response) {
Swal.fire({
icon: "success",
title: "PayBand 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 Pay Band
function deletePayBand(PayBandId) {
var PayBandId = PayBandId;
$.ajax({
type: "GET",
url: "<?php echo e(url('/')); ?>/check-employee-pay-band/" +PayBandId,
success: function (response) {
if (response.exists) {
Swal.fire({
icon: "warning",
title: "Can't be deleted!",
text: "This PayBand is associated with empolyee(s)!",
showConfirmButton: true,
});
} else {
Swal.fire({
title: "Delete PayBand?",
text: "Are you sure you want to delete this PayBand?",
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-pay-band/" +
PayBandId,
success: function (response) {
Swal.fire({
icon: "success",
title: "PayBand has been deleted!",
showConfirmButton: false,
timer: 1500,
}).then(function () {
location.reload();
});
},
});
}
});
}
},
});
}
</script><?php /**PATH /var/www/html/hrms-production/resources/views/components/pay-band-modal.blade.php ENDPATH**/ ?>