Skip to content

Commit

Permalink
Major Commit: Updated code to properly display the Add Immigration an…
Browse files Browse the repository at this point in the history
…d Client Details.
  • Loading branch information
mahi-mullapudi committed Sep 13, 2018
1 parent 0ba6489 commit 8c05afd
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ public class ApplicationConstants implements Serializable {
.build();

public static final Map<String, String> invoiceFrequencyMap = ImmutableMap.<String, String>builder()
.put("weekly", "Weekly")
.put("biweekly", "Bi-weekly")
.put("monthly", "Monthly")
.put(TIMESHEET_TYPE_WEEKLY, TIMESHEET_TYPE_WEEKLY)
.put(TIMESHEET_TYPE_BIWEEKLY, TIMESHEET_TYPE_BIWEEKLY)
.put(TIMESHEET_TYPE_MONTHLY, TIMESHEET_TYPE_MONTHLY)
.build();

public static final Map<String, String> immiStatusMap = ImmutableMap.<String, String>builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ public String submitClientDetails(
clientDetailsValidator.validate(clientDetails, result);
if (result.hasErrors()) {
log.warn("Validation errors: " + result.toString());
model.addAttribute("showDivFlag", true);
model.addAttribute("empId", clientDetails.getEmployee().getEmployeeId());
model.addAttribute("css", "danger");
model.addAttribute("msg", "Invalid / Missing Information. Please correct the Client details information below!!");
return "staff/clientDetails";
Expand Down Expand Up @@ -202,6 +204,8 @@ public String submitImmigrationDetails(
}
immigrationDetailsValidator.validate(immigrationDetails, result);
if (result.hasErrors()) {
model.addAttribute("showDivFlag", true);
model.addAttribute("empId", immigrationDetails.getEmployee().getEmployeeId());
model.addAttribute("css", "danger");
model.addAttribute("msg", "Invalid / Missing Information. Please correct the information entered below!!");
return "staff/immigrationDetails";
Expand Down
31 changes: 30 additions & 1 deletion src/main/resources/static/js/clientDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ $(document).ready(function () {
//$('.phone_us').mask('(000)000-0000');

fetchClientData();
$('#viewClientDetailsDiv').hide();

/*$('.datepicker').datepicker();
$('.date_format').datetimepicker({
Expand All @@ -19,6 +18,10 @@ $(document).ready(function () {
});*/
});

function hideClientDetailsDiv(showFlag) {
if (!showFlag) $('#viewClientDetailsDiv').hide();
}

/**
* Retrieve Client Details Summary from the database and populate the datatable with corresponding columns.
*
Expand Down Expand Up @@ -129,4 +132,30 @@ function populateClientDetail(clientDetailObj) {
$('#invoiceContactEmail').val(clientDetailObj.invoiceContactEmail);
$('#invoiceFrequency').val(clientDetailObj.invoiceFrequency);
$('#comments').val(clientDetailObj.comments);
}

/**
* Add Immigration Details by clearing the existing Immigration information.
*/
function addClientDetails() {
$('#viewClientDetailsDiv').show();
$('#clientDetailsId').val(0);
$('#clientName').val('');
$('#clientStreet').val('');
$('#clientCity').val('');
$('#clientState').val('');
$('#clientZip').val('');
$('#contractCompany').val('');
$('#vendorCompany').val('');
$('#contractStartDate').val('');
$('#contractEndDate').val('');
$('#vendorContactName').val('');
$('#vendorPhone').val('');
$('#vendorEmail').val('');
$('#paymentTerms').val('');
$('#invoiceContactName').val('');
$('#invoiceContactPhone').val('');
$('#invoiceContactEmail').val('');
$('#invoiceFrequency').val('');
$('#comments').val('');
}
19 changes: 18 additions & 1 deletion src/main/resources/static/js/immiDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ $(document).ready(function () {
//$('.phone_us').mask('(000)000-0000');

fetchImmigrationDetails();
$('#viewImmigrationDetailsDiv').hide();
});

function hideImmiDiv(showFlag) {
if (!showFlag) $('#viewImmigrationDetailsDiv').hide();
}

/**
* Retrieve Immigration Details Summary from the database and populate the datatable with corresponding columns.
*
Expand Down Expand Up @@ -94,4 +97,18 @@ function populateImmigrationDetails(immigrationDetailObj) {
$('#currentWage').val(immigrationDetailObj.currentWage);
$('#startDate').val(moment(immigrationDetailObj.startDate).format("MM/DD/YYYY"));
$('#endDate').val(moment(immigrationDetailObj.endDate).format("MM/DD/YYYY"));
}

/**
* Add Immigration Details by clearing the existing Immigration information.
*/
function addImmigrationDetails() {
$('#viewImmigrationDetailsDiv').show();
$('#immiDetailsId').val(0);
$('#currentStatus').val('');
$('#receiptNumber').val('');
$('#lcaNumber').val('');
$('#currentWage').val(0.0);
$('#startDate').val('');
$('#endDate').val('');
}
18 changes: 15 additions & 3 deletions src/main/webapp/WEB-INF/jsp/staff/clientDetails.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<link href="./css/style.css" rel="stylesheet">
</head>

<body>
<body onload="hideClientDetailsDiv(${showDivFlag})">
<div class="container-fluid" id="wrapper">
<div class="row">
<jsp:include page="../sideNavbar.jsp"/>
Expand Down Expand Up @@ -60,7 +60,7 @@
<div class="clear"></div>
</header>

<ul class="nav nav-pills nav-fill">
<ul class="nav nav-pills nav-fill col-lg-11 col-md-12">
<li class="nav-item">
<a class="nav-link" href="/employeeManagement/employeeDetails?empId=${empId}">
Personal Details
Expand All @@ -81,7 +81,7 @@
<section class="row">
<div class="col-lg-11 col-md-12">
<section class="row">
<div id="accordionClientDetails">
<div id="accordionClientDetails" class="col-sm-12">
<div class="card">

<div class="card-header panel-title" id="headingTwo">
Expand All @@ -105,6 +105,18 @@

<div class="card-body">
<br>
<div class="col-md-12 row">
<div class="col-md-12 col-lg-8">
<p>Click on the button to add new Client Information.</p>
</div>
<div class="col-md-12 col-lg-4">
<a id="addImmiLink" class="btn btn-sm btn-success"
onclick="addClientDetails()">
Add Client Details
</a>
</div>
</div>
<hr>
<div class="col-md-12" id="viewClientDetailsDiv">
<c:if test="${not empty msg}">
<div class="col-md-12">
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/WEB-INF/jsp/staff/employeeDetails.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<div class="clear"></div>
</header>

<ul class="nav nav-pills nav-fill">
<ul class="nav nav-pills nav-fill col-lg-11 col-md-12">
<li class="nav-item">
<a class="nav-link active" href="/employeeManagement/employeeDetails?empId=${empId}">
Personal Details
Expand All @@ -81,7 +81,7 @@
<section class="row">
<div class="col-lg-11 col-md-12">
<section class="row">
<div id="accordionEmployeeDetails">
<div id="accordionEmployeeDetails" class="col-sm-12">
<div class="card">
<div class="card-header panel-title" id="headingOne">
<div class="row">
Expand Down
23 changes: 17 additions & 6 deletions src/main/webapp/WEB-INF/jsp/staff/immigrationDetails.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<link href="./css/style.css" rel="stylesheet">
</head>

<body>
<body onload="hideImmiDiv(${showDivFlag})">
<div class="container-fluid" id="wrapper">
<div class="row">
<jsp:include page="../sideNavbar.jsp"/>
Expand Down Expand Up @@ -60,7 +60,7 @@
<div class="clear"></div>
</header>

<ul class="nav nav-pills nav-fill">
<ul class="nav nav-pills nav-fill col-lg-11 col-md-12">
<li class="nav-item">
<a class="nav-link" href="/employeeManagement/employeeDetails?empId=${empId}">
Personal Details
Expand All @@ -81,7 +81,7 @@
<section class="row">
<div class="col-lg-11 col-md-12">
<section class="row">
<div id="accordionImmiDetails">
<div id="accordionImmiDetails" class="col-sm-12">
<div class="card">
<div class="card-header panel-title" id="headingThree">
<div class="row">
Expand All @@ -104,6 +104,18 @@

<div class="card-body">
<br>
<div class="col-md-12 row">
<div class="col-md-12 col-lg-8">
<p>Click on the button to add new Immigration Information.</p>
</div>
<div class="col-md-12 col-lg-4">
<a id="addImmiLink" class="btn btn-sm btn-success"
onclick="addImmigrationDetails()">
Add Immigration Details
</a>
</div>
</div>
<hr>
<div class="col-md-12" id="viewImmigrationDetailsDiv">
<c:if test="${not empty msg}">
<div class="col-md-12">
Expand All @@ -112,7 +124,8 @@
aria-label="Close">
<span aria-hidden="true">X</span>
</button>
<i class="fa fa-info-circle faa-flash animated"></i><strong> ${msg}</strong>
<i class="fa fa-info-circle faa-flash animated"></i>
<strong> ${msg}</strong>
</div>
</div>
</c:if>
Expand All @@ -125,7 +138,6 @@
<input type="hidden" id="employeeId" name="employee.employeeId"
value="${empId}">
<div class="row">

<spring:bind path="currentStatus">
<div class="form-group required col-md-6 ${status.error ? 'has-danger' : ''} snears-vendor-info">
<label class="form-control-label" for="currentStatus">Current
Expand Down Expand Up @@ -227,7 +239,6 @@
</div>
</div>
</spring:bind>

</div>

<div class="d-flex justify-content-around">
Expand Down

0 comments on commit 8c05afd

Please sign in to comment.