File: /var/www/html/hrms-production/storage/framework/views/b0c50dfeb8980f02c345b240126493a29f9e79de.php
<?php $__env->startSection('content'); ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<div class="container-fluid">
</div><!-- /.container-fluid -->
</section>
<!-- Main content -->
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h5>Add New Application</h5>
</div>
<!-- /.card-header -->
<div class="card-body">
<form id="leaveApplicationForm">
<input type="hidden" name="_token" id="token" value="<?php echo e(csrf_token()); ?>">
<input type="hidden" name="UserName" id="UserName" value="<?php echo e(session('UserName')); ?>">
<input type="hidden" name="PromotionTransferId" id="PromotionTransferId">
<input type="hidden" name="PayMatrixId" id="PayMatrixId">
<input type="hidden" name="EmployeesAddressId" id="EmployeesAddressId">
<div class="row">
<div class="col-md-6">
<div class="form-group row mb-0">
<label for="EmployeeCode"
class="col-sm-4 col-form-label text-right">Employee Code:</label>
<div class="col-sm-8">
<select class="form-control form-control-sm select2"
style="width: 100%;" aria-hidden="true" name="EmployeeId"
id="EmployeeId" data-placeholder="Select Employee Code" required>
<option selected="selected" disabled>Employee Code</option>
<?php $__currentLoopData = $EmployeesData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $AllEmployee): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($AllEmployee->EmployeeId); ?>">
<?php echo e($AllEmployee->EmployeeCode); ?>
(<?php echo e($AllEmployee->EmployeeName); ?>)</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
</div>
<div class="form-group row mb-0">
<label for="Department"
class="col-sm-4 col-form-label text-right">Department:</label>
<div class="col-sm-8">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-pen"></i></span>
</div>
<input type="text" class="form-control form-control-sm"
name="employeeDepartment" id="employeeDepartment"
readonly="readonly">
</div>
</div>
</div>
<div class="form-group row mb-0">
<label for="LeaveType" class="col-sm-4 col-form-label text-right">Leave
Type:</label>
<div class="col-sm-8">
<select class="form-control form-control-sm select2"
style="width: 100%;" aria-hidden="true" name="LeaveType"
id="LeaveType" data-placeholder="Select Employee Code" required>
<option selected="selected" disabled>Leave Type</option>
<?php $__currentLoopData = $LeaveTypes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $LeaveType): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($LeaveType->LeaveTypeId); ?>">
<?php echo e($LeaveType->LeaveTypeName); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
</div>
<div class="form-group row mb-0">
<label for="FromDate" class="col-sm-4 col-form-label text-right">From
Date:</label>
<div class="col-sm-8">
<div class="form-group mb-2">
<div class="input-group date" id="jobFromDate"
data-target-input="nearest">
<input type="text" id="fromDate" name="leaveStartDate"
class="form-control form-control-sm datetimepicker-input"
data-target="#fromDate" onblur="getDayFromDates()"
required />
<div class="input-group-append" data-target="#fromDate"
data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-group row mt-2">
<label class="col-sm-4 col-form-label text-right">Profile Name:</label>
<div class="col-sm-8">
<form method="GET" id="ProfileId">
<select class="form-control form-control-sm select2"
aria-hidden="true" name="ProfileName" id="ProfileName"
data-placeholder="Select Officer Name">
<option value="" disabled selected>Select Officer Name</option>
</select>
<input type="hidden" name="ProfileId" id="ProfileId">
</form>
</div>
</div>
<div class="form-group row mb-0">
<label for="NoOfDays" class="col-sm-4 col-form-label text-right">Approval
Authority:</label>
<div class="col-sm-8">
<select multiple="multiple" class="form-control form-control-sm select2"
style="width: 100%;" aria-hidden="true" name="Authority"
id="Authority" data-placeholder="Select Authority" required>
<!-- <option name="Authority" id="Authority"></option> -->
</select>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group row mb-0">
<label for="EmployeeName"
class="col-sm-4 col-form-label text-right">Employee Name:</label>
<div class="col-sm-8">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-pen"></i></span>
</div>
<input type="text" class="form-control form-control-sm"
name="EmployeeName" id="employeeName" readonly="readonly">
</div>
</div>
</div>
<div class="form-group row mb-0">
<label for="Designation"
class="col-sm-4 col-form-label text-right">Designation:</label>
<div class="col-sm-8">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-pen"></i></span>
</div>
<input type="text" class="form-control form-control-sm"
name="employeeDesignation" id="employeeDesignation"
readonly="readonly">
</div>
</div>
</div>
<div class="form-group row mb-0">
<label for="LeaveDay" class="col-sm-4 col-form-label text-right">Leave
Day:</label>
<div class="col-sm-8">
<div class="form-group mt-2">
<div class="form-group clearfix">
<div class="icheck-primary d-inline">
<input type="radio" id="addFull" value="FullPay"
name="LeaveDay" checked="">
<label class="mb-0" for="addFull">Full Pay</label>
</div>
<div class="icheck-primary d-inline">
<input type="radio" id="addHalf" value="HalfPay"
name="LeaveDay">
<label class="mb-0" for="addHalf">Half Pay</label>
</div>
</div>
</div>
</div>
</div>
<div class="form-group row mb-0">
<label for="ToDate" class="col-sm-4 col-form-label text-right">To
Date:</label>
<div class="col-sm-8">
<div class="form-group mb-2">
<div class="input-group date" id="leaveEndDate"
data-target-input="nearest">
<input type="text" id="toDate" name="leaveEndDate"
class="form-control form-control-sm datetimepicker-input"
data-target="#toDate" onblur="getDayFromDates()" required />
<div class="input-group-append" data-target="#toDate"
data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-group row mb-0">
<label for="NoOfDays" class="col-sm-4 col-form-label text-right">No. of
Day(s):</label>
<div class="col-sm-8">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-pen"></i></span>
</div>
<input type="text" class="form-control form-control-sm"
name="NoOfDays" id="NoOfDays" value="1" readonly>
</div>
</div>
</div>
<div class="form-group row mb-0">
<label for="Remarks"
class="col-sm-4 col-form-label text-right">Remarks:</label>
<div class="col-sm-8">
<textarea class="form-control form-control-sm" name="Remarks"
id="Remarks"></textarea>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group row mb-0">
<label for="LeaveDay"
class="col-sm-4 col-form-label text-right text-danger">Hometown
LTC:</label>
<div class="col-sm-8">
<div class="form-group mt-2">
<div class="form-group clearfix">
<div class="icheck-primary d-inline">
<input type="radio" id="NoHometownLTC" value="No"
name="HometownLTC" checked="">
<label class="mb-0" for="NoHometownLTC">No</label>
</div>
<div class="icheck-primary d-inline">
<input type="radio" id="YesHometownLTC" value="Yes"
name="HometownLTC">
<label class="mb-0" for="YesHometownLTC">Yes</label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row" id="HometownLTC_Row" style="display: none">
<div class="col-md-6">
<div class="form-group row mb-0">
<label for="LTCOrderNo" class="col-sm-4 col-form-label text-right">Order No:
<span class="text-danger">*</span></label>
<div class="col-sm-8">
<div class="input-group">
<input type="text" class="form-control form-control-sm"
name="LTCOrderNo" id="LTCOrderNo">
</div>
</div>
</div>
<div class="form-group row mb-0">
<label for="Designation" class="col-sm-4 col-form-label text-right">Order
Date: <span class="text-danger">*</span></label>
<div class="col-sm-8">
<div class="form-group mb-2">
<div class="input-group date" data-target-input="nearest">
<input type="text" id="OrderDate" name="OrderDate"
class="form-control form-control-sm datetimepicker-input"
data-target="#OrderDate" placeholder="DD/MM/YYYY" />
<div class="input-group-append" data-target="#OrderDate"
data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-group row mb-0">
<label for="Designation" class="col-sm-4 col-form-label text-right">Block
Year: <span class="text-danger">*</span></label>
<div class="col-sm-8">
<div class="input-group">
<select class="form-control form-control-sm select2"
style="width: 100%;" aria-hidden="true" name="HomeTownBlockYear"
id="HomeTownBlockYear" data-placeholder="Select Year">
<option value="" disabled selected>Select Year</option>
</select>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group row mb-0">
<label for="LTCDescription"
class="col-sm-4 col-form-label text-right">Description:</label>
<div class="col-sm-8">
<textarea class="form-control form-control-sm" name="LTCDescription"
rows="5" id="LTCDescription"></textarea>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 mt-3">
<div class="form-group row">
<button type="button" class="btn btn-warning text-white"
onclick="createLeave();">Send Application</button>
<button type="button" onclick="formReset();"
class="btn btn-warning text-white">Reset</button>
</div>
</div>
</div>
</form>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</section>
<!-- /.content -->
</div>
<script>
function formReset()
{
Swal.fire({
title: 'Do you want to reset form?',
text: "Are you sure you want to reset this form!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, reset it!'
}).then(function() {
$('form#leaveApplicationForm').each(function() {
this.reset();
});
});
}
</script>
<script>
$("input[name='HometownLTC']").change(function(){
if($(this).val()=="Yes") {
$("#HometownLTC_Row").css('display', '');
$("#LTCOrderNo, #OrderDate, #HomeTownBlockYear").prop('required', true);
}
else {
$("#HometownLTC_Row").css('display', 'none');
$("#LTCOrderNo, #OrderDate, #HomeTownBlockYear").prop('required', false);
}
});
</script>
<script>
function getDayFromDates(){
var start_date = $('#fromDate').val();
var end_date = $('#toDate').val();
var sDate = start_date;
var startDate = sDate.split("/").reverse().join("-");
var eDate = end_date;
var endDate = eDate.split("/").reverse().join("-");
// console.log(startDate+ "==" +endDate);
var leaveName = $("input[name='LeaveDay']:checked").val();
//alert(leaveName);
if (leaveName == "FullPay") {
var days = daysdifference(startDate, endDate);
//console.log(days);
$('#NoOfDays').val(days);
function daysdifference(startDate, endDate){
var startDay = new Date(startDate);
var endDay = new Date(endDate);
var millisBetween = endDay.getTime() - startDay.getTime();
if (millisBetween < 0) {
$('#toDate').val(start_date);
} else {
var days = millisBetween / (1000 * 3600 * 24);
return Math.round(Math.abs(days+1));
}
}
} else {
$('#leaveEndDate').val(start_date);
}
}
</script>
<script>
$( "#fromDate" ).blur(function()
{ var the_date = $('#fromDate').val();
// alert(the_date);
getDayFromDates();
});
$( "#toDate" ).blur(function()
{ var the_date = $('#toDate').val();
//alert(the_date);
const toTimestamp = (strDate) => {
const dt = Date.parse(strDate);
return dt / 1000;
}
var start_date = $('#fromDate').val();
var end_date = $('#toDate').val();
if(toTimestamp(start_date) > toTimestamp(end_date))
{
$('#toDate').val(start_date);
}
getDayFromDates();
});
//Add Record
$( "input[name='LeaveDay']" ).change(function(){
var leaveName = $("input[name='LeaveDay']:checked").val();
//alert(leaveName);
var days = 0;
if(leaveName == "HalfPay"){
$('#NoOfDays').val('0.5');
//alert(start_date);
var start_date = $('#fromDate').val();
$('#leaveEndDate').val(start_date);
$('#leaveEndDate').attr('readonly', true);
}
else
{
$('#leaveEndDate').removeAttr('readonly');
$('#NoOfDays').val(days);
}
getDayFromDates();
});
</script>
<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)');
});
$("#EmployeeId").change(function(){
loadEmaployeeDetails();
});
function loadEmaployeeDetails()
{
var employeeid = $('#EmployeeId').val();
var employeeCode = $("#EmployeeId option:selected").text();
$('#EmployeeCode').val(employeeCode);
$.get("<?php echo e(url('/')); ?>/ajax/employee/details/"+employeeid, function(data, status){
//alert("Data: " + data + "\nStatus: " + status);
if(data.error_code == '200')
{
var EmployeeData = data.EmployeeData;
var EmployeeName = EmployeeData.EmployeeName;
var DepartmentName = EmployeeData.DepartmentName;
var DesignationName = EmployeeData.DesignationName;
var PromotionTransferId = EmployeeData.PromotionTransferId;
var PayMatrixId = EmployeeData.PayMatrixId;
var EmployeesAddressId = EmployeeData.EmployeesAddressId;
$('#employeeName').val(EmployeeName);
$('#employeeDepartment').val(DepartmentName);
$('#employeeDesignation').val(DesignationName);
$('#PromotionTransferId').val(PromotionTransferId);
$('#PayMatrixId').val(PayMatrixId);
$('#EmployeesAddressId').val(EmployeesAddressId);
}
});
//tblBodyQualification
$.get("<?php echo e(url('/')); ?>/ajax/employee/qualification/list/"+employeeid, function(data, status){
//alert("Data: " + data + "\nStatus: " + status);
$('#tblBodyQualification').empty();
if(data)
{
$('#tblBodyQualification').append(data);
}
});
}
function createLeave()
{
event.preventDefault();
var EmployeeId = $("#EmployeeId").val();
var LeaveType = $("#LeaveType").val();
var ProfileName = $("#ProfileName").val();
var Authority = $("#Authority").val();
if(EmployeeId == null) {
Swal.fire({
icon: 'warning',
title: 'EmployeeCode is required!',
showConfirmButton: false,
timer: 2000
});
}
else if(LeaveType == null) {
Swal.fire({
icon: 'warning',
title: 'LeaveType is required!',
showConfirmButton: false,
timer: 2000
});
}
else if(ProfileName == null) {
Swal.fire({
icon: 'warning',
title: 'ProfileName is required!',
showConfirmButton: false,
timer: 2000
});
}
else if(Authority == "") {
Swal.fire({
icon: 'warning',
title: 'Authority is required!',
showConfirmButton: false,
timer: 2000
});
}
else{
var token = $('#token').val();
var EmployeeId = $('#EmployeeId').val();
var EmpCode = $('#EmployeeId').find('option:selected').text();
var EmployeeCode = EmpCode.split(' ')[0];
var employeeDepartment = $('#employeeDepartment').val();
var LeaveType = $('#LeaveType').val();
var leaveStartDate = $('#fromDate').val();
var leaveEndDate = $('#toDate').val();
var Remarks = $('#Remarks').val();
var UserName = $('#UserName').val();
var Authority = $('#Authority').val();
var LeaveDay = $('input[name=LeaveDay]:checked').val();
var EmployeeName = $('#employeeName').val();
var NoOfDays = $('#NoOfDays').val();
var employeeDesignation = $('#employeeDesignation').val();
var PromotionTransferId = $('#PromotionTransferId').val();
var PayMatrixId = $('#PayMatrixId').val();
var EmployeesAddressId = $('#EmployeesAddressId').val();
var HometownLTC = $('input[name=HometownLTC]:checked').val();
if (HometownLTC == 'Yes') {
var LTCOrderNo = $('#LTCOrderNo').val();
var OrderDate = $('#OrderDate').val();
var HomeTownBlockYear = $("#HomeTownBlockYear option:selected").val();
var LTCDescription = $('textarea[name="LTCDescription"]').val();
} else {
var LTCOrderNo = '';
var OrderDate = '';
var HomeTownBlockYear = '';
var LTCDescription = '';
}
var formData = new FormData();
formData.append('_token', token);
formData.append('EmployeeId', EmployeeId);
formData.append('EmployeeCode', EmployeeCode);
formData.append('employeeDepartment', employeeDepartment);
formData.append('LeaveType', LeaveType);
formData.append('leaveStartDate', leaveStartDate);
formData.append('leaveEndDate', leaveEndDate);
formData.append('Remarks', Remarks);
formData.append('UserName', UserName);
formData.append('Authority', Authority);
formData.append('EmployeeName', EmployeeName);
formData.append('employeeDesignation', employeeDesignation);
formData.append('LeaveDay', LeaveDay);
formData.append('NoOfDays', NoOfDays);
formData.append('PromotionTransferId', PromotionTransferId);
formData.append('PayMatrixId', PayMatrixId);
formData.append('EmployeesAddressId', EmployeesAddressId);
// Hometown LTC
formData.append('HometownLTC', HometownLTC);
formData.append('LTCOrderNo', LTCOrderNo);
formData.append('OrderDate', OrderDate);
formData.append('HomeTownBlockYear', HomeTownBlockYear);
formData.append('LTCDescription', LTCDescription);
$.ajax({
type: "post",
url: "<?php echo e(url('ajax/leave/create')); ?>",
//data: $('form#addEmpQualificationForm').serialize(),
data : formData,
processData: false,
contentType: 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: 'Application sent successfully!'
});
// $('form#addEmpQualificationForm').each(function() {
// this.reset();
// });
// $('span#CheckActualWorkPlace').html('');
location.href="<?php echo e(url('/all-application')); ?>";
},
error: 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: 'error',
title: 'Something went wrong!'
})
}
});
}
}
</script>
<script>
$(document).ready(function() {
$.ajax({
type: "GET",
url: "<?php echo e(url('/officer-name-list')); ?>",
dataType: "json",
success: function(response) {
var json = response.officerNameList;
$.each(json, function(i, ProfileName) {
if(ProfileName.ProfileName != "User"){
$("#ProfileName").append("<option value='" + ProfileName.ProfileId + "'>" + ProfileName.ProfileName + "</option>");
$('#ProfileName').trigger('change');
}
});
}
});
});
$(document).ready(function(e) {
$('#ProfileName').change(function(e) {
var ProfileId = $(this).val();
if (ProfileId == null) {
return false;
}
else{
$("#Authority").empty();
$.ajax({
type: "GET",
url: "<?php echo e(url('/profile-wise-officer/')); ?>/"+ProfileId,
dataType: "json",
success: function(response) {
var json = response.officerWiseName;
$("#Authority").empty();
$.each(json, function(i, UserDetails) {
var firstname = UserDetails.FirstName;
var middlename = UserDetails.MiddleName;
if (middlename) {
var middlename = UserDetails.MiddleName;
} else {
var middlename = '';
}
var lastname = UserDetails.LastName;
if (lastname) {
var lastname = UserDetails.LastName;
} else {
var lastname = '';
}
$("#Authority").append("<option value='" + UserDetails.UserId + "'>" + firstname +' '+ middlename + ' ' + lastname + "</option>");
$('#Authority').trigger('change');
});
}
});
}
e.preventDefault();
});
});
</script>
<!-- /.content-wrapper -->
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.include.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/hrms/resources/views/admin/LeaveManagement/new-application.blade.php ENDPATH**/ ?>