You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
758 lines
30 KiB
758 lines
30 KiB
<!DOCTYPE html>
|
|
<html lang="en" dir="">
|
|
<html xmlns:th="http://www.thymeleaf.org">
|
|
<head th:replace="~{fragments/modules/base/head :: head}"></head>
|
|
<style>
|
|
.required{
|
|
color: red;
|
|
}
|
|
#modalBody h4 {
|
|
font-weight: bold;
|
|
margin-top: 15px;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
#modalBody p {
|
|
margin: 5px 0;
|
|
}
|
|
|
|
#modalBody hr {
|
|
margin: 15px 0;
|
|
}
|
|
.comment {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.comment p {
|
|
margin: 0;
|
|
}
|
|
|
|
hr {
|
|
border: 1px solid #ccc;
|
|
margin-top: 20px;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
h5 {
|
|
|
|
font-size: bold;
|
|
}
|
|
|
|
/* Limit the height of the dropdown menu and make it scrollable */
|
|
.dropdown-menu {
|
|
max-height: 200px; /* Adjust this value as needed */
|
|
overflow-y: auto;
|
|
}
|
|
|
|
|
|
.col-4 {
|
|
font-weight: bold;
|
|
text-align: right;
|
|
}
|
|
|
|
.col-8 {
|
|
padding-left: 20px;
|
|
}
|
|
|
|
.comment {
|
|
padding: 10px 0;
|
|
}
|
|
|
|
.comment .text-muted {
|
|
font-size: 0.9em;
|
|
color: #6c757d;
|
|
}
|
|
|
|
.comment hr {
|
|
border-top: 1px solid #ccc;
|
|
}
|
|
|
|
.comment .btn-link {
|
|
font-size: 0.9em;
|
|
text-decoration: underline;
|
|
color: #007bff;
|
|
}
|
|
/* Make the modal body scrollable */
|
|
#detailsModal .modal-body {
|
|
max-height: 70vh; /* Limit the height to 70% of the viewport */
|
|
overflow-y: auto; /* Enable vertical scrolling */
|
|
}
|
|
|
|
.card-box {
|
|
border-radius: 20px;
|
|
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px;
|
|
}
|
|
|
|
#followupCard {
|
|
transition: transform 0.2s ease; /* Smooth scaling transition */
|
|
cursor: pointer; /* Default cursor change */
|
|
}
|
|
|
|
#followupCard:hover {
|
|
transform: scale(1.05); /* Slightly scale up on hover */
|
|
cursor: pointer; /* Change cursor to hand symbol */
|
|
}
|
|
|
|
.card-block {
|
|
padding: 20px;
|
|
}
|
|
|
|
.form-label {
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
input.form-control {
|
|
padding: 10px;
|
|
}
|
|
.form-select {
|
|
padding: 10px;
|
|
height: 40px;
|
|
}
|
|
|
|
#employeeCard label{
|
|
padding-top: 2%;
|
|
}
|
|
|
|
</style>
|
|
<body>
|
|
<!--[if lt IE 8]>
|
|
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
|
|
<![endif]-->
|
|
|
|
<div class="wrapper">
|
|
<!-- header top menu Start -->
|
|
<header th:replace="~{fragments/modules/base/header :: header}"></header>
|
|
<!-- header top menu end -->
|
|
|
|
<div class="page-wrap">
|
|
<!--=============== Left Menu side Start ================-->
|
|
<div th:replace="~{fragments/modules/base/menu :: menu}"></div>
|
|
<!--=============== Left side End ================-->
|
|
<div class="main-content">
|
|
<div class="container-fluid">
|
|
<div class="page-header mb-2">
|
|
<div class="row align-items-end">
|
|
<div class="col-lg-8">
|
|
<div class="page-header-title">
|
|
<i class="fa fa-list-alt bg-blue"></i>
|
|
<div class="d-inline">
|
|
<h5>Department Entries</h5>
|
|
<span>Pendency</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-4">
|
|
<nav class="breadcrumb-container" aria-label="breadcrumb">
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li>
|
|
<li class="breadcrumb-item" aria-current="page">Department Entries</li>
|
|
<li class="breadcrumb-item" aria-current="page">NewEntry</li>
|
|
<li class="breadcrumb-item active" aria-current="page">Pendency</li>
|
|
</ol>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row mt-4" >
|
|
|
|
<div class="col-md-12">
|
|
<div class="card">
|
|
<div class="card-block">
|
|
|
|
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5><span th:text="${filecategory}" id="filecategory" style="display:none"></span>
|
|
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span> New Entry - Pendency</h5>
|
|
<span th:text="${userId}" id="userId" style="display:none"></span>
|
|
<div class="row mb-4">
|
|
|
|
<div class="col-md-4" >
|
|
<label for="empCode" class="form-label fw-bold">Search by Employee No <span class="text-danger">*</span></label>
|
|
|
|
<div class="dropdown">
|
|
<input type="number" id="empCode" class="form-control" pattern="^[A-Za-z0-9]+$" placeholder="Enter Employee No" required>
|
|
<small id="employeenoHelp" class="form-text text-muted">Only numeric characters (numbers) are allowed.</small>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-4 mt-20">
|
|
<button id="searchButton" class="btn btn-primary mt-2" Style="height:38px;">Search</button>
|
|
<!-- <button id="resetButton" class="btn btn-secondary mt-2">Reset</button> -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="row mb-4" id="employeeCard" style="display: none;">
|
|
<div class="col-md-12">
|
|
<div class="card">
|
|
<div class="card-block">
|
|
<h5 style="font-weight:bold;">New Entry - Pendency - <span id="EmployeeCode"></span></h5>
|
|
<hr>
|
|
<div class="row">
|
|
<!-- Employee No -->
|
|
<div class="col-md-6">
|
|
<label for="employeeno" class="form-label fw-bold">Employee No <span class="text-danger">*</span></label>
|
|
<div class="dropdown">
|
|
<input type="number" id="employeeno" class="form-control" readonly>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Employee Name -->
|
|
<div class="col-md-6">
|
|
<label for="employeename" class="form-label fw-bold">Employee Name <span class="text-danger">*</span></label>
|
|
<div class="dropdown">
|
|
<input type="text" id="employeename" class="form-control" readonly>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label for="Department" class="form-label fw-bold">Department <span class="text-danger">*</span></label>
|
|
<div class="dropdown">
|
|
<input type="text" id="department" class="form-control" readonly>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label for="Designation" class="form-label fw-bold">Designation<span class="text-danger">*</span></label>
|
|
<div class="dropdown">
|
|
<input type="text" id="designation" class="form-control" readonly>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label for="classes" class="form-label fw-bold">Class<span class="text-danger">*</span></label>
|
|
<div class="dropdown" >
|
|
<input type="text" id="classes" class="form-control" readonly>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-sm-6">
|
|
<label for="retirementdate" class="form-label fw-bold">Retirement Date <span class="text-danger">*</span></label>
|
|
<input type="date" id="retirementdate" class="form-control" readonly>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-md-6">
|
|
<label for="retirement" class="form-label fw-bold">Type Of Retirement<span class="text-danger">*</span></label>
|
|
<select id="retirement" class="form-select" style="width: 100%;height: 40px;" required>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
|
|
<!-- pending duration-->
|
|
<div class="col-md-6">
|
|
<label for="pendingDuration" class="form-label fw-bold">
|
|
Pending Duration
|
|
<span class="text-danger">*</span>
|
|
</label>
|
|
<div class="d-flex align-items-center">
|
|
<div class="form-check" style="padding-right:10px;">
|
|
<input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input">
|
|
<label for="yes" class="form-check-label">Yes</label>
|
|
</div>
|
|
<div class="form-check">
|
|
<input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input">
|
|
<label for="no" class="form-check-label">No</label>
|
|
</div>
|
|
</div>
|
|
<div class="dropdown" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;">
|
|
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" placeholder="Enter details for pending duration">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<label for="Audit File" class="form-label fw-bold">Date file sent to Audit<span class="text-danger">*</span></label>
|
|
<div class="dropdown">
|
|
<input type="text" id="filesentdate" class="form-control" readonly>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-12">
|
|
<label for="remarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label>
|
|
<div class="dropdown">
|
|
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here" required></textarea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="row mt-4">
|
|
<div class="col-12 d-flex justify-content-center">
|
|
<button id="lfauditButton" class="btn btn-primary mt-2 mx-2">Mark as sent Audit</button>
|
|
<button id="cancelButton" class="btn btn-secondary mt-2">Cancel</button>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;">
|
|
<div style="position: relative; top: 50%; transform: translateY(-50%);">
|
|
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
|
|
<span class="sr-only">Loading...</span>
|
|
</div>
|
|
<!-- Add the 'Please wait' text below the spinner -->
|
|
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
|
|
</div>
|
|
</div>
|
|
|
|
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
|
|
|
|
<script th:replace="~{fragments/modules/base/script :: script}"></script>
|
|
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
|
|
<!-- Bootstrap 5 JS -->
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
|
|
<script>
|
|
|
|
|
|
|
|
$(document).ready(function (){
|
|
|
|
$('#searchButton').on('click', function () {
|
|
const empCode = $('#empCode').val().trim(); // Trim any extra spaces
|
|
console.log("empCode:", empCode);
|
|
|
|
// If empCode is missing, show a warning and abort.
|
|
if (!empCode) {
|
|
Swal.fire({
|
|
icon: "warning",
|
|
title: "Missing Employee Number",
|
|
text: "Please enter an employee number to proceed.",
|
|
confirmButtonText: "OK",
|
|
customClass: {
|
|
confirmButton: "btn btn-primary"
|
|
}
|
|
});
|
|
console.log("No Employee Code provided. Aborting search.");
|
|
return;
|
|
}
|
|
|
|
// Show loader and hide any previously displayed cards
|
|
$('#pageLoader').show();
|
|
$('#employeeCard').hide();
|
|
$('#newemployeeCard').hide();
|
|
|
|
// Clear/reset form fields
|
|
$('#typeofcategory').val('');
|
|
$('#retirement').val('');
|
|
$('#pendingDurationInput').val('');
|
|
$('#remarks').val('');
|
|
$('input[name="pendingDuration"]').prop('checked', false);
|
|
document.getElementById("pendingDurationInputContainer").style.display = "none";
|
|
|
|
// STEP 1: Check if the employee already exists in the database.
|
|
$.ajax({
|
|
url: '/gcc/api/department/newentry/prexists', // Endpoint to check existence
|
|
type: 'GET',
|
|
data: { empCode: empCode },
|
|
success: function (existsResponse) {
|
|
console.log("Exists API Response:", existsResponse);
|
|
$('#pageLoader').hide();
|
|
|
|
// If the employee exists, show a warning and stop processing.
|
|
if (existsResponse && existsResponse.exists) {
|
|
Swal.fire({
|
|
icon: "warning",
|
|
title: "Already Exists",
|
|
text: "This employee number already exists.",
|
|
confirmButtonText: "OK",
|
|
customClass: {
|
|
confirmButton: "btn btn-primary"
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
|
|
// STEP 2: If the employee does not exist, fetch employee details.
|
|
$('#pageLoader').show(); // Show loader for the second API call
|
|
$.ajax({
|
|
url: '/gcc/api/department/newentry/employeedetails', // Correct API URL for employee details
|
|
type: 'GET',
|
|
data: { empCode: empCode },
|
|
success: function (response) {
|
|
$('#pageLoader').hide();
|
|
console.log("Employee Details API Response:", response.list);
|
|
|
|
if (response.list && response.list.length > 0) {
|
|
// Retrieve the first (and presumably only) employee details record.
|
|
let employeeDetails = response.list[0];
|
|
console.log("Employee Details:", employeeDetails);
|
|
// Optional: Validate department ID if needed.
|
|
const loggedInDeptId = $('#deptId').text().trim();
|
|
const currentDate = $('#filesentdate').val().trim();
|
|
|
|
if(employeeDetails.RETIREMENT_DATE >= currentDate){
|
|
|
|
Swal.fire({
|
|
icon: "warning",
|
|
title: "Not Applicable",
|
|
text: "This employee not applicable for this pendency.",
|
|
confirmButtonText: "OK",
|
|
customClass: {
|
|
confirmButton: "btn btn-primary"
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
|
|
// If the returned data is invalid, show a warning.
|
|
if (!employeeDetails || !employeeDetails.EMPLOYEE_CODE) {
|
|
Swal.fire({
|
|
icon: "warning",
|
|
title: "No Data Found",
|
|
text: "No details found for this employee number.",
|
|
confirmButtonText: "OK",
|
|
customClass: {
|
|
confirmButton: "btn btn-primary"
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
|
|
|
|
if (employeeDetails.ID_DEPT !== loggedInDeptId) {
|
|
Swal.fire({
|
|
icon: "error",
|
|
title: "Access Denied",
|
|
text: "This employee does not belong to your department. Please try again with a valid employee code.",
|
|
confirmButtonText: "OK",
|
|
customClass: {
|
|
confirmButton: "btn btn-danger"
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
|
|
// Populate the form fields with the fetched employee details.
|
|
$('#employeeno').val(employeeDetails.EMPLOYEE_CODE);
|
|
$('#employeename').val(employeeDetails.EMPLOYEE_NAME);
|
|
$('#department').val(employeeDetails.DEPARTMENT);
|
|
$('#designation').val(employeeDetails.DESIGNATION);
|
|
$('#classes').val(employeeDetails.GROUP_TYPE);
|
|
$('#retirementdate').val(employeeDetails.RETIREMENT_DATE);
|
|
$('#EmployeeCode').text(empCode);
|
|
|
|
// Finally, display the employee card/modal.
|
|
$('#employeeCard').show();
|
|
} else {
|
|
$('#pageLoader').hide();
|
|
Swal.fire({
|
|
icon: "warning",
|
|
title: "No Data Found",
|
|
text: "No details found for this employee number.",
|
|
confirmButtonText: "OK",
|
|
customClass: {
|
|
confirmButton: "btn btn-primary"
|
|
}
|
|
});
|
|
}
|
|
},
|
|
error: function () {
|
|
$('#pageLoader').hide();
|
|
Swal.fire({
|
|
icon: "error",
|
|
title: "Error",
|
|
text: "An error occurred while fetching data. Please try again.",
|
|
confirmButtonText: "OK"
|
|
});
|
|
}
|
|
});
|
|
},
|
|
error: function () {
|
|
$('#pageLoader').hide();
|
|
Swal.fire({
|
|
icon: "error",
|
|
title: "Error",
|
|
text: "An error occurred while checking the employee. Please try again.",
|
|
confirmButtonText: "OK"
|
|
});
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
/* document.getElementById('lfauditButton').addEventListener('click', function () {
|
|
// Trigger the save function when the button is clicked
|
|
saveEntryDetails();
|
|
}); */
|
|
|
|
//$('#lfauditButton').one('click', saveEntryDetails);
|
|
|
|
$('#lfauditButton').off('click').on('click', saveEntryDetails);
|
|
})
|
|
|
|
|
|
// Handle close button click
|
|
$('#cancelButton').click(function () {
|
|
// Clear the input field value
|
|
$('#empCode').val('');
|
|
|
|
// Hide the card
|
|
$('#employeeCard').hide();
|
|
});
|
|
|
|
|
|
// Handle close button click
|
|
$('#cancelButtonnew').click(function () {
|
|
// Clear the input field value
|
|
$('#empCode').val('');
|
|
|
|
// Hide the card
|
|
$('#newemployeeCard').hide();
|
|
});
|
|
|
|
|
|
// Trigger search on pressing Enter key
|
|
$('#empCode').on('keydown', function (event) {
|
|
if (event.key === 'Enter') {
|
|
event.preventDefault(); // Prevent default form submission or page reload
|
|
|
|
const empCode = $('#empCode').val(); // Get the value of empCode
|
|
if (!empCode) {
|
|
// Show Swal alert if the employee number is missing
|
|
Swal.fire({
|
|
icon: "warning", // Display a warning icon
|
|
title: "Missing Employee Number",
|
|
text: "Please enter an employee number to proceed.",
|
|
confirmButtonText: "OK",
|
|
customClass: {
|
|
confirmButton: "btn btn-primary" // Optional styling for the button
|
|
}
|
|
});
|
|
return; // Stop further execution
|
|
}
|
|
|
|
$('#searchButton').click(); // Trigger the click event of the search button
|
|
}
|
|
});
|
|
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
function loadRetirementTypes() {
|
|
$.ajax({
|
|
url: "/gcc/api/getRetrimentTypes",
|
|
type: "GET",
|
|
success: function (data) {
|
|
var dropdown = $("#retirement");
|
|
dropdown.empty();
|
|
dropdown.append('<option value="" selected>-- Select Option --</option>');
|
|
|
|
$.each(data, function (key, entry) {
|
|
if (entry.retriment_type !== "Provisional") { // Exclude "Provisional"
|
|
dropdown.append($('<option></option>').attr('value', entry.retriment_type).text(entry.retriment_type));
|
|
}
|
|
});
|
|
},
|
|
error: function () {
|
|
console.log("Error loading dropdown data.");
|
|
}
|
|
});
|
|
}
|
|
|
|
// Call function on page load
|
|
loadRetirementTypes();
|
|
});
|
|
|
|
|
|
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
// Get today's date
|
|
const today = new Date();
|
|
|
|
// Format the date as DD-MM-YYYY for display
|
|
const day = String(today.getDate()).padStart(2, '0');
|
|
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based
|
|
const year = today.getFullYear();
|
|
|
|
// Combine into DD-MM-YYYY format for display
|
|
const formattedDateDisplay = `${day}-${month}-${year}`;
|
|
|
|
// Set the value of the input field to the current date (in DD-MM-YYYY format for display)
|
|
document.getElementById("filesentdate").value = formattedDateDisplay;
|
|
|
|
|
|
});
|
|
|
|
|
|
function convertDateFormat(dateString) {
|
|
if (!dateString) return '';
|
|
let [day, month, year] = dateString.split('-');
|
|
return `${year}-${month}-${day}`;
|
|
}
|
|
|
|
|
|
function saveEntryDetails() {
|
|
|
|
let pendingDuration= $('input[name="pendingDuration"]:checked').val();
|
|
let pendingDurationReason=null;
|
|
if (pendingDuration === 'yes' ) {
|
|
pendingDurationReason = $('#pendingDurationInput').val(); // Retrieve the amount if available, else null
|
|
if (!pendingDurationReason) {
|
|
Swal.fire({
|
|
icon: 'warning',
|
|
title: 'Validation Error',
|
|
text: 'Please Enter Pending Reason',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
return; // Stop further execution if validation fails
|
|
}
|
|
}
|
|
|
|
//pendencyCategory:$('#typeofcategory').val(),
|
|
|
|
let entryDetails = {
|
|
|
|
empNo: $('#employeeno').val(),
|
|
empName: $('#employeename').val(),
|
|
deptName: $('#department').val(),
|
|
designation: $('#designation').val(),
|
|
retirementclass: $('#classes').val(),
|
|
typeOfRetirement: $('#retirement').val(),
|
|
retirementDate:$('#retirementdate').val(),
|
|
pendingDuration: pendingDuration,
|
|
reasonPending: pendingDurationReason,
|
|
dateToAudit: convertDateFormat($('#filesentdate').val()?.trim()),
|
|
remarks: $('#remarks').val(),
|
|
deptId:$('#deptId').text().trim(),
|
|
filemovedby:$('#userId').text().trim(),
|
|
filecategory:$('#filecategory').text().trim()
|
|
};
|
|
|
|
console.log("entrydetails..",entryDetails);
|
|
|
|
|
|
|
|
if (!entryDetails.pendingDuration) {
|
|
Swal.fire({
|
|
icon: 'warning',
|
|
title: 'Validation Error!',
|
|
text: 'Pending Duration.',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
return;
|
|
}
|
|
|
|
|
|
if (!entryDetails.typeOfRetirement) {
|
|
Swal.fire({
|
|
icon: 'warning',
|
|
title: 'Validation Error!',
|
|
text: 'Type of Retirement.',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!entryDetails.remarks) {
|
|
Swal.fire({
|
|
icon: 'warning',
|
|
title: 'Validation Error!',
|
|
text: 'Remarks are required.',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
return;
|
|
}
|
|
|
|
|
|
$('#lfauditButton').prop('disabled', true).text('Processing...');
|
|
|
|
$.ajax({
|
|
url: '/gcc/api/department/newentry/savePendecnyDetails',
|
|
type: 'POST',
|
|
contentType: 'application/json',
|
|
data: JSON.stringify(entryDetails),
|
|
success: function (response) {
|
|
$('#lfauditButton').prop('disabled', false).text('Mark as sent Audit');
|
|
Swal.fire({
|
|
icon: 'success',
|
|
title: 'Success',
|
|
text: response,
|
|
allowOutsideClick: false,
|
|
allowEscapeKey: false,
|
|
allowEnterKey: false,
|
|
confirmButtonText: 'OK'
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
$('#lfauditButton').prop('disabled', false).text('Mark as sent Audit');
|
|
window.location.href = "/gcc/department/newentry/pendency";
|
|
console.log("Continue clicked");
|
|
}
|
|
});
|
|
},
|
|
error: function (xhr, status, error) {
|
|
$('#lfauditButton').prop('disabled', false).text('Mark as sent Audit');
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Error',
|
|
text: 'Failed to save details. Please try again.',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
console.error('Error:', xhr.responseText);
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
function handleCategoryChange() {
|
|
const categoryDropdown = document.getElementById('typeofcategory');
|
|
const retirementDetailsContainer = document.getElementById('retirementDetailsContainer');
|
|
|
|
// Show or hide the retirement details dropdown based on the selection
|
|
if (categoryDropdown.value === 'Retirement') {
|
|
retirementDetailsContainer.style.display = 'block'; // Show retirement dropdown
|
|
} else {
|
|
retirementDetailsContainer.style.display = 'none'; // Hide retirement dropdown
|
|
}
|
|
}
|
|
|
|
|
|
document.querySelectorAll('input[name="pendingDuration"]').forEach(radio => {
|
|
radio.addEventListener('change', function () {
|
|
const pendingDurationInputContainer = document.getElementById('pendingDurationInputContainer');
|
|
if (this.value === 'yes') {
|
|
pendingDurationInputContainer.style.display = 'block'; // Show the input field
|
|
} else {
|
|
pendingDurationInputContainer.style.display = 'none'; // Hide the input field
|
|
document.getElementById('pendingDurationInput').value = ''; // Clear the input field
|
|
}
|
|
});
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
</body>
|
|
</html>
|