File: /var/www/html/hrms-production/storage/framework/views/a5e2f3c9730554142408c6a5b29dacdbd9bbe5ec.php
<div class="modal fade" id="addAwardDetail">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Award Detail </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="addAwardDetailform">
<input type="hidden" name="_token" id="award_token" value="<?php echo e(csrf_token()); ?>">
<div class="card-body">
<div class="row">
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0" for="EmployeeCode">Employee Code. <span
class="text-danger">*</span></label>
<select class="form-control form-control-sm select2" style="width: 100%;"
aria-hidden="true" name="EmployeeCode" id="AwardEmployeeCode"
data-placeholder="Employee Code" required>
<option selected="selected" disabled>Employee Code</option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0" for="EmployeeName">Employee Name </label>
<input type="text" class="form-control form-control-sm" name="EmployeeName"
id="AwardEmployeeName" readonly>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0" for="Nature">Nature <span class="text-danger">*</span></label>
<select class="form-control form-control-sm select2" style="width: 100%;"
aria-hidden="true" name="AwardNature" id="AwardNature"
data-placeholder="Select Nature" required>
<option selected="selected" disabled>Select Nature</option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0" for="date">Award Date </label>
<div class="form-group mb-2">
<div class="input-group date" data-target-input="nearest">
<input type="text" id="AwardDate" name="AwardDate"
class="form-control form-control-sm datetimepicker-input"
data-target="#AwardDate" placeholder="DD/MM/YYYY" required />
<div class="input-group-append" data-target="#AwardDate"
data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group mt-0 mb-2">
<label for="AwardCertificate" class="mb-0">Upload Certificate</label>
<div class="input-group input-group-sm">
<div class="custom-file">
<input type="file" class="custom-file-input" name="AwardCertificate"
id="AwardCertificate" accept="image/*, .pdf">
<label class="custom-file-label" for="AwardCertificate">Choose
file</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group mt-0">
<label class="mb-0" for="AwardDescription">Award Description <span
class="text-danger">*</span></label>
<textarea name="AwardDescription" id="AwardDescription"
class="form-control form-control-sm" cols="30" rows="5"></textarea>
</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" name="Save" value="Save"
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="UpdateAwardDetail">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Award Detail <span id="EditAwardEmployeeName" 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="updateAwardDetailform">
<input type="hidden" name="_token" id="token_update_award" value="<?php echo e(csrf_token()); ?>">
<input type="hidden" name="AwardDetailId" id="AwardDetailId">
<div class="card-body">
<div class="row">
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0" for="Nature">Nature <span class="text-danger">*</span></label>
<select class="form-control form-control-sm select2" style="width: 100%;"
aria-hidden="true" name="AwardNature" id="EditAwardNature"
data-placeholder="Select Nature" required>
<option selected="selected" disabled>Select Nature</option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group mb-2">
<label class="mb-0" for="date">Award Date </label>
<div class="form-group mb-2">
<div class="input-group date" data-target-input="nearest">
<input type="text" id="EditAwardDate" name="AwardDate"
class="form-control form-control-sm datetimepicker-input"
data-target="#EditAwardDate" placeholder="DD/MM/YYYY" required />
<div class="input-group-append" data-target="#EditAwardDate"
data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group mt-0 mb-2">
<label for="AwardCertificate" class="mb-0">Upload Certificate</label>
<div class="input-group input-group-sm">
<div class="custom-file">
<input type="file" class="custom-file-input" name="AwardCertificate"
id="EditAwardCertificate" accept="image/*, .pdf">
<label class="custom-file-label" for="AwardCertificate">Choose
file</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group mt-0">
<label class="mb-0" for="AwardDescription">Award Description <span
class="text-danger">*</span></label>
<textarea name="AwardDescription" id="EditAwardDescription"
class="form-control form-control-sm" cols="30" rows="5"></textarea>
</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" name="Update" value="Update"
class="btn btn-sm btn-info mx-1">Update</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<script>
$(function() {
$("#emplaoyeeTable").DataTable({
"responsive": true,
"lengthChange": true,
"autoWidth": false,
"lengthMenu": [10, 20, 50, 100, 250, 500],
//"buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
}).buttons().container().appendTo('#userTable_wrapper .col-md-6:eq(0)');
});
</script>
<script>
$(document).ready(function() {
$.ajax({
type: "GET",
url: "<?php echo e(url('/employee-list')); ?>",
dataType: "json",
success: function(response) {
var json = response.EmployeeList;
$.each(json, function(i, employee) {
$("#AwardEmployeeCode").append("<option value='" + employee.EmployeeId + "'>" + employee.EmployeeCode + " (" + employee.EmployeeName + ") " + "</option>");
$('#AwardEmployeeCode').trigger('change');
});
}
});
});
// Get Employee Details
$('#AwardEmployeeCode').on('select2:select', function (e) {
var data = e.params.data;
var EmployeeId = data.id;
$('#EmpId').val('');
getEmployeeDetail(EmployeeId);
// Reset Form field on change Employee Code
$('#AwardNature').val(null).trigger('change');
});
function getEmployeeDetail(EmployeeId)
{
var EmployeeId = EmployeeId;
$.ajax({
type: "post",
url: "<?php echo e(url('/')); ?>/get-employee-current-detail",
dataType: "json",
data: {
_token: "<?php echo e(csrf_token()); ?>",
EmployeeId: EmployeeId,
},
success: function(response) {
var json = response.GetEmpCurrentDetail;
$('#AwardEmployeeId').val(json.EmployeeId);
$('#EmpCode').val(json.EmployeeCode);
$('#AwardEmployeeName').val(json.EmployeeName);
}
});
}
// Award Nature List
$(document).ready(function() {
$.ajax({
type: "GET",
url: "<?php echo e(url('/award-nature-list')); ?>",
dataType: "json",
success: function(response) {
var json = response.AwardNature;
$.each(json, function(i, award) {
$("#AwardNature, #EditAwardNature").append("<option value='" + award.AwardNatureId + "'>" + award.AwardNature + "</option>");
$('#AwardNature, #EditAwardNature').val(null).trigger('change');
// $('#EditAwardNature').trigger('change');
});
}
});
});
</script>
<script>
function editAwardDetail(AwardDetailId)
{
var AwardDetailId = AwardDetailId;
$('#UpdateAwardDetail').modal('show');
$.ajax({
type: "POST",
url: "<?php echo e(url('/')); ?>/edit-award-detail",
dataType: 'json',
data: {
AwardDetailId: AwardDetailId,
_token: "<?php echo e(csrf_token()); ?>",
},
success: function (response) {
$('span#EditAwardEmployeeName').html('#' +response.GetAwardDetail.EmployeeName);
$('#AwardDetailId').val(response.GetAwardDetail.AwardDetailId);
$('#EditAwardNature').val(response.GetAwardDetail.AwardNatureId);
$('#EditAwardNature').trigger('change');
// var date = response.GetAwardDetail.AwardDate;
// var AwardDate = date.split("-").join("/");
// $('#EditAwardDate').val(AwardDate);
var date = new Date(response.GetAwardDetail.AwardDate);
$('#EditAwardDate').val(((date.getDate() > 9) ? date.getDate() : ('0' + date.getDate())) + '/' + ((date.getMonth() > 8) ? (date.getMonth() + 1) : ('0' + (date.getMonth() + 1))) + '/' + date.getFullYear());
$('#EditAwardDescription').val(response.GetAwardDetail.AwardDescription);
}
});
}
</script>
<script>
$(function () {
$.validator.setDefaults({
submitHandler: function () {
event.preventDefault();
// Get Form Data
var token = $("#award_token").val();
var EmployeeId = $("#AwardEmployeeCode :selected").val();
var EmpCode = $('#AwardEmployeeCode').find('option:selected').text();
var EmployeeCode = EmpCode.split(' ')[0];
var AwardNature = $('#AwardNature').val();
var Date = $('#AwardDate').val();
var AwardDescription = $('#AwardDescription').val();
var AwardCertificate = $('#AwardCertificate')[0].files;
var fd = new FormData();
fd.append('_token',token);
fd.append('EmployeeId',EmployeeId);
fd.append('EmployeeCode',EmployeeCode);
fd.append('AwardNatureId',AwardNature);
fd.append('Date',Date);
fd.append('AwardDescription',AwardDescription);
// files data
fd.append('AwardCertificate',AwardCertificate[0]);
$.ajax({
type: "post",
url: "<?php echo e(url('store-award-detail')); ?>",
data: fd,
contentType: false,
processData: false,
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: 'Award added successfully!'
});
setTimeout(function(){
window.location.reload(1);
}, 2000);
},
error: function(data) {
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: 'error',
title: 'Something went wrong!'
});
}
});
}
});
$('#addAwardDetailform').validate({
rules: {
EmployeeCode: {
required: true,
},
AwardNature: {
required: true,
},
AwardDate: {
required: true,
},
AwardDescription: {
required: true,
},
AwardCertificate: {
accept: "image/*, pdf",
},
},
messages: {
EmployeeCode: {
required: "Employee Code is required.",
},
AwardDate: {
required: "Please select the date.",
},
},
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 () {
$.validator.setDefaults({
submitHandler: function () {
event.preventDefault();
// Get Form Data
var token = $("#token_update_award").val();
var AwardDetailId = $("#AwardDetailId").val();
var AwardNature = $('#EditAwardNature').val();
var Date = $('#EditAwardDate').val();
var AwardDescription = $('#EditAwardDescription').val();
var AwardCertificate = $('#EditAwardCertificate')[0].files;
var fd = new FormData();
fd.append('_token',token);
fd.append('AwardDetailId',AwardDetailId);
fd.append('AwardNatureId',AwardNature);
fd.append('Date',Date);
fd.append('AwardDescription',AwardDescription);
// files data
fd.append('AwardCertificate',AwardCertificate[0]);
$.ajax({
type: "post",
url: "<?php echo e(url('update-award-detail')); ?>",
data: fd,
contentType: false,
processData: false,
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: 'Award updated successfully!'
});
setTimeout(function(){
window.location.reload(1);
}, 2000);
},
error: function(data) {
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: 'error',
title: 'Something went wrong!'
});
}
});
}
});
$('#updateAwardDetailform').validate({
rules: {
AwardNature: {
required: true,
},
AwardDate: {
required: true,
},
AwardDescription: {
required: true,
},
AwardCertificate: {
accept: "image/*, pdf",
},
},
messages: {
AwardDate: {
required: "Please select the date.",
},
},
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 deleteAwardDetail(AwardDetailId) {
var AwardDetailId = AwardDetailId;
Swal.fire({
title: "Delete Record?",
text: "Are you sure you want to delete this Award?",
icon: "warning",
icon: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: "Yes, delete it!",
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "post",
url: "<?php echo e(url('/')); ?>/delete-award-detail",
dataType: "json",
data: {
_token: "<?php echo e(csrf_token()); ?>",
AwardDetailId: AwardDetailId,
},
success: function (response) {
Swal.fire({
icon: "success",
title: "Award has been deleted!",
showConfirmButton: false,
timer: 1500,
}).then(function () {
location.reload();
});
},
});
}
});
}
</script>
<?php /**PATH /var/www/html/hrms-production/resources/views/components/employee-award-detail-modal.blade.php ENDPATH**/ ?>