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

Commit

Permalink
Merge branch 'master' into feature-ui-design-2
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Linden committed Nov 30, 2016
2 parents f6a0590 + 886c1d6 commit fa9924a
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = function(ngModule) {

vm.setNextTabQuery = function(id) {
if (id === 1) {
navService.setNextQuery({ t: 2 }, "Next: Add Piece Rate");
navService.setNextQuery({ t: 2 }, "Next: Add Piece Rate", "wagedata_tab_box");
}
else {
navService.clearNextQuery();
Expand All @@ -47,7 +47,7 @@ module.exports = function(ngModule) {
vm.setNextTabQuery(vm.activeTab);
});

$scope.$watch('formData.payType', function(value) {
$scope.$watch('formData.payTypeId', function(value) {
if (value === 23 && vm.activeTab === 1) {
vm.setNextTabQuery(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h2>Wage Data</h2>
</fieldset>
</div>

<div class="form-tabbed-section" ng-show="formData.payTypeId === 23">
<div id="wagedata_tab_box" class="form-tabbed-section" ng-show="formData.payTypeId === 23">
<div class="form-tab {{ vm.activeTab === 1 ? 'active' : '' }}" ng-click="vm.onTabClick(1)"><div class="circle">1</div> Hourly</div>
<div class="form-tab {{ vm.activeTab === 2 ? 'active' : '' }}" ng-click="vm.onTabClick(2)"><div class="circle">2</div> Piece Rate</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ module.exports = function(ngModule) {
vm.activeTab = tab;

if (tab === 1 && vm.notInitialApp()) {
navService.setNextQuery({ t: 2 }, "Next: Add Employee(s)");
navService.setNextQuery({ t: 2 }, "Next: Add Employee(s)", "worksite_tab_box");
navService.setBackQuery({ doCancel: true }, "Cancel");
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ <h2>Work Sites &amp; Employees</h2>
<button ng-click="vm.addWorkSite()" ng-hide="vm.addingWorkSite">Add Work Site &amp; Employee(s)</button>
</div>

<div class="form-tabbed-section" ng-show="vm.notInitialApp() && vm.addingWorkSite">
<div class="form-tab {{ vm.activeTab === 1 ? 'active' : '' }}" ng-click="vm.setActiveTab(1)"><div class="circle">1</div> <span>Add</span> Work Site</div>
<div class="form-tab {{ vm.activeTab === 2 ? 'active' : '' }}" ng-click="vm.setActiveTab(2)"><div class="circle">2</div> <span>Add</span> Employees</div>

<div class="form-tabbed-section" ng-show="vm.addingWorkSite">
<div id="worksite_tab_box" class="form-tabbed-section" ng-show="vm.notInitialApp() && vm.addingWorkSite">
<div class="form-tab {{ vm.activeTab === 1 ? 'active' : '' }}" ng-click="vm.setActiveTab(1)"><div class="circle">1</div> <span>Add</span> Work Site</div>
<div class="form-tab {{ vm.activeTab === 2 ? 'active' : '' }}" ng-click="vm.setActiveTab(2)"><div class="circle">2</div> <span>Add</span> Employees</div>
</div>
Expand Down
31 changes: 26 additions & 5 deletions DOL.WHD.Section14c.Web/src/modules/services/navService.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import findIndex from 'lodash/findIndex';

module.exports = function(ngModule) {
ngModule.service('navService', function($location, $route, autoSaveService, stateService, _constants) {
ngModule.service('navService', function($location, $route, $window, $anchorScroll, autoSaveService, stateService, _constants) {
'ngInject';
'use strict';

Expand Down Expand Up @@ -106,6 +106,18 @@ module.exports = function(ngModule) {
return state.backStack.length > 0 || this.getPreviousSection();
}

this.scrollPage = function(anchor) {
if (anchor) {
$location.hash(anchor);
$anchorScroll();
}
else {
$window.scrollTo(0, 0);
}

$location.hash("");
}

this.goNext = function() {
this.clearBackQuery();

Expand All @@ -115,10 +127,12 @@ module.exports = function(ngModule) {
if (state.nextQuery) {
this.pushToBack(current, $location.search());
$location.search(state.nextQuery.query);
this.scrollPage(state.nextQuery.scrollAnchor);
}
else if (next) {
state.backStack.length = 0;
$location.path("/section/" + next).search({});
this.scrollPage();
}

autoSaveService.save();
Expand All @@ -133,6 +147,7 @@ module.exports = function(ngModule) {

if (state.backQuery) {
$location.search(state.backQuery.query);
this.scrollPage(back.query.scrollAnchor);
}
else {
if (state.backStack.length > 0) {
Expand All @@ -141,14 +156,17 @@ module.exports = function(ngModule) {
if (back && back.section) {
if (back.query) {
$location.path("/section/" + back.section).search(back.query);
this.scrollPage(back.query.scrollAnchor);
}
else {
$location.path("/section/" + back.section).search({});
this.scrollPage();
}
}
}
else if (previous) {
$location.path("/section/" + previous).search({});
this.scrollPage();
}
}

Expand All @@ -170,14 +188,17 @@ module.exports = function(ngModule) {
if (stateService.isAdmin) {
if (stateService.appData.id) {
$location.path("/admin/" + stateService.appData.id + "/section/" + section).search({});
this.scrollPage();
}
else {
// no application loaded so redirect back to the dashboard
$location.path("/admin").search({});
this.scrollPage();
}
}
else {
$location.path("/section/" + section).search({});
this.scrollPage();
}

autoSaveService.save();
Expand All @@ -191,16 +212,16 @@ module.exports = function(ngModule) {
state.backStack.push({ section: section, query: query });
}

this.setNextQuery = function(query, label) {
state.nextQuery = { query: query, label: label };
this.setNextQuery = function(query, label, scrollAnchor) {
state.nextQuery = { query: query, label: label, scrollAnchor: scrollAnchor };
}

this.clearNextQuery = function() {
state.nextQuery = undefined;
}

this.setBackQuery = function(query, label) {
state.backQuery = { query: query, label: label };
this.setBackQuery = function(query, label, scrollAnchor) {
state.backQuery = { query: query, label: label, scrollAnchor: scrollAnchor};
}

this.clearBackQuery = function() {
Expand Down
3 changes: 2 additions & 1 deletion DOL.WHD.Section14c.Web/src/styles/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
margin: 1rem 0;

.certificate-type:after {
content: "\A"
content: "\A";
white-space: pre;
}

thead > tr > th {
Expand Down

0 comments on commit fa9924a

Please sign in to comment.