Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #197 from AppliedIS/bug-prodmeasure
Browse files Browse the repository at this point in the history
Fixed missing radio buttons on Employee Productivity Measure.
  • Loading branch information
jefferey committed Dec 1, 2016
2 parents bd764d4 + ec4eaa0 commit a415435
Show file tree
Hide file tree
Showing 11 changed files with 223 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public EmployeeValidator()
RuleFor(e => e.AvgWeeklyHours).NotNull();
RuleFor(e => e.AvgHourlyEarnings).NotNull();
RuleFor(e => e.PrevailingWage).NotNull();
RuleFor(e => e.ProductivityMeasure).NotNull();
RuleFor(e => e.CommensurateWageRate).NotEmpty();
RuleFor(e => e.TotalHours).NotNull();
RuleFor(e => e.WorkAtOtherSite).NotNull();
Expand Down
1 change: 0 additions & 1 deletion DOL.WHD.Section14c.DataAccess/ApplicationDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ protected override void OnModelCreating(DbModelBuilder modelBuilder)
modelBuilder.Entity<Employee>().Property(a => a.AvgWeeklyHours).IsRequired();
modelBuilder.Entity<Employee>().Property(a => a.AvgHourlyEarnings).IsRequired();
modelBuilder.Entity<Employee>().Property(a => a.PrevailingWage).IsRequired();
modelBuilder.Entity<Employee>().Property(a => a.ProductivityMeasure).IsRequired();
modelBuilder.Entity<Employee>().Property(a => a.CommensurateWageRate).IsRequired();
modelBuilder.Entity<Employee>().Property(a => a.TotalHours).IsRequired();
modelBuilder.Entity<Employee>().Property(a => a.WorkAtOtherSite).IsRequired();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace DOL.WHD.Section14c.DataAccess.Migrations
{
using System;
using System.Data.Entity.Migrations;

public partial class ProductivityMeasureNotRequired : DbMigration
{
public override void Up()
{
DropForeignKey("dbo.EmployerInfoes", "MailingAddress_Id", "dbo.Addresses");
DropIndex("dbo.EmployerInfoes", new[] { "MailingAddress_Id" });
AddColumn("dbo.EmployerInfoes", "ProvidingFacilitiesDeductionTypeOther", c => c.String());
AlterColumn("dbo.Employees", "ProductivityMeasure", c => c.Double());
DropColumn("dbo.EmployerInfoes", "HasMailingAddress");
DropColumn("dbo.EmployerInfoes", "MailingAddress_Id");
}

public override void Down()
{
AddColumn("dbo.EmployerInfoes", "MailingAddress_Id", c => c.Guid());
AddColumn("dbo.EmployerInfoes", "HasMailingAddress", c => c.Boolean());
AlterColumn("dbo.Employees", "ProductivityMeasure", c => c.Double(nullable: false));
DropColumn("dbo.EmployerInfoes", "ProvidingFacilitiesDeductionTypeOther");
CreateIndex("dbo.EmployerInfoes", "MailingAddress_Id");
AddForeignKey("dbo.EmployerInfoes", "MailingAddress_Id", "dbo.Addresses", "Id");
}
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public void Should_Require_PrevailingWage()
}

[TestMethod]
public void Should_Require_ProductivityMeasure()
public void Should_Not_Require_ProductivityMeasure()
{
EmployeeValidator.ShouldHaveValidationErrorFor(e => e.ProductivityMeasure, null as double?);
EmployeeValidator.ShouldNotHaveValidationErrorFor(e => e.ProductivityMeasure, null as double?);
EmployeeValidator.ShouldNotHaveValidationErrorFor(e => e.ProductivityMeasure, 15.32);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ module.exports = function(ngModule) {
return undefined;
}

this.workerProductivityChanged = function(study) {
if (!study && vm.activeWorker) {
vm.activeWorker.productivityMeasure = undefined;
}
}


// convenience methods to avoid lenghty template statements
this.validateActiveWorksiteProperty = function(prop) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,19 @@ <h4>Number of Employees: <strong>{{ vm.activeWorksite.numEmployees ? vm.activeWo
<td>
<div ng-class="vm.validateActiveWorkerProperty('productivityMeasure') ? 'usa-input-error' : ''">
<span class="usa-input-error-message" role="alert" ng-show="vm.validateActiveWorkerProperty('productivityMeasure')">{{ vm.validateActiveWorkerProperty('productivityMeasure') }}</span>
<input id="workerProductivity" name="workerProductivity" type="number" class="wage-rate" min="0" step="0.1" ng-model="vm.activeWorker.productivityMeasure">

<ul class="usa-unstyled-list">
<li>
<input id="workerProductivityNA" type="radio" name="workerProductivityToggle" ng-value="undefined" ng-model="vm.activeWorker.hasProductivityMeasure" ng-change="vm.workerProductivityChanged()">
<label for="workerProductivityNA">n/a - piece rate</label>
</li>
<li>
<input id="workerProductivityStudy" type="radio" name="workerProductivityToggle" ng-value="true" ng-model="vm.activeWorker.hasProductivityMeasure" ng-change="vm.workerProductivityChanged(true)">
<label for="workerProductivityStudy">Time Study,</label>
</li>
</ul>

<input id="workerProductivity" name="workerProductivity" type="number" class="wage-rate" min="0" step="0.1" ng-model="vm.activeWorker.productivityMeasure" ng-disabled="!vm.activeWorker.hasProductivityMeasure">
</div>
</td>
<td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ module.exports = function(ngModule) {
}

this.checkRequiredMultipleChoice("employer.pca", "Please indicate if the employer manufactures items under the PCA");

let sca = this.checkRequiredMultipleChoice("employer.scaId", "Please indicate if the employer holds any SCA-covered contracts");
if (sca === _constants.responses.sca.yes) {
let scaCount = this.checkRequiredNumber("employer.scaCount", "Please provide the total number of workers employed under SCA-covered contracts", 0);
Expand Down Expand Up @@ -471,7 +471,11 @@ module.exports = function(ngModule) {
this.checkRequiredNumber(subprefix + ".avgWeeklyHours", "Please provide the average number of hours per week the employee worked on all jobs", 0);
this.checkRequiredNumber(subprefix + ".avgHourlyEarnings", "Please provide the average earings per hour for this employee", 0);
this.checkRequiredNumber(subprefix + ".prevailingWage", "Please provide the prevailing wage rate for the job identified", 0);
this.checkRequiredNumber(subprefix + ".productivityMeasure", "Please provide the productivity measure for the job identified", 0);

if (this.getFormValue(subprefix + ".hasProductivityMeasure")) {
this.checkRequiredNumber(subprefix + ".productivityMeasure", "Please provide the productivity measure for the job identified", 0);
}

this.checkRequiredNumber(subprefix + ".commensurateWageRate", "Please provide the commensurage wage rate for the job identified", 0);
this.checkRequiredNumber(subprefix + ".totalHours", "Please provide the employee's total hours worked on the job identified", 0);
this.checkRequiredMultipleChoice(subprefix + ".workAtOtherSite", "Please indicate if the employee also performed work at another site included with this application");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ describe('validationService', function() {
"avgWeeklyHours": 40,
"avgHourlyEarnings": 5,
"prevailingWage": 5,
"hasProductivityMeasure": true,
"productivityMeasure": 50,
"commensurateWageRate": 102.1,
"totalHours": 40,
Expand Down Expand Up @@ -85,6 +86,7 @@ describe('validationService', function() {
"avgWeeklyHours": 40,
"avgHourlyEarnings": 5,
"prevailingWage": 5,
"hasProductivityMeasure": true,
"productivityMeasure": 50,
"commensurateWageRate": 102.1,
"totalHours": 40,
Expand Down
18 changes: 11 additions & 7 deletions DOL.WHD.Section14c.Web/src/styles/forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@
}
}

// Form input sizing
// Form input sizing
input.phoneno {
max-width: 18.2rem;
}

input.ein,
input.ein,
input.certificateno {
max-width: 15.4rem;
}
Expand Down Expand Up @@ -297,7 +297,7 @@ span.example {
max-width: 10rem;
}

// Styling for upload button/input combos
// Styling for upload button/input combos
.upload-label {
margin-right: 0px;
border-top-right-radius: 0px;
Expand Down Expand Up @@ -366,6 +366,10 @@ span.example {
font-weight: 400;
}
}

.wage-data-table li > input[type="radio"] {
width: auto;
}
}

table {
Expand Down Expand Up @@ -482,7 +486,7 @@ span.example {
}
}

// Custom form tabs (as seen in Wage Data section)
// Custom form tabs (as seen in Wage Data section)
.form-tabbed-section {
@include clearfix;

Expand All @@ -497,7 +501,7 @@ span.example {
font-weight: 700;
cursor: pointer;
margin-right: 0px;


&:not(:first-of-type) {
border-left: 1px solid #aeb0b5;
Expand Down Expand Up @@ -619,7 +623,7 @@ span.example {
@media (min-width: 37.5em) {
.form-tabbed-section {
.form-tab {
font-size: 2.4rem;
font-size: 2.4rem;

.circle {
font-size: 1.7rem;
Expand Down Expand Up @@ -682,4 +686,4 @@ span.example {
display: block;
}
}
}
}

0 comments on commit a415435

Please sign in to comment.