-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Manish Jain
committed
May 4, 2017
1 parent
a6a9fe8
commit 44e069f
Showing
44 changed files
with
1,973 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1. Run this code using any server (node or tomcat) | ||
2. Main view file is index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
angular.module('supervisorApp',['ui.router']) | ||
.config(['routesProvider', function(routesProvider){ | ||
|
||
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
angular.module('supervisorApp') | ||
.controller('homeController',['$scope','$rootScope','workersJson',function($scope,$rootScope,workersJson){ | ||
var vm = {} | ||
this.vm = vm; | ||
vm.page = {} | ||
vm.page.data = {}; | ||
vm.page.data.supervisorName = 'John'; | ||
vm.page.data.workers = workersJson.workers; | ||
vm.page.data.selectedIndex = -1; | ||
var resetInfo = function(){ | ||
vm.page.data.taskName = undefined; | ||
vm.page.data.taskDuration = undefined; | ||
vm.page.data.selectedIndex = - 1; | ||
vm.page.data.selectedAvailableWorker = undefined; | ||
} | ||
vm.selectWorker = function(worker,selectedIndex){ | ||
resetInfo(); | ||
if(worker.taskAssigned === ''){ | ||
vm.page.data.selectedAvailableWorker = worker.name; | ||
vm.page.data.selectedIndex = selectedIndex; | ||
} | ||
} | ||
vm.assignTask = function(){ | ||
vm.page.data.workers[8]['taskAssigned'] = vm.page.data.taskName; | ||
vm.page.data.workers[8]['taskDuration'] = vm.page.data.taskDuration; | ||
resetInfo(); | ||
|
||
} | ||
vm.ringTheBell = function(){ | ||
ringWorker.postMessage(vm.page.data.workers); | ||
} | ||
}]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
angular.module('supervisorApp') | ||
.directive('workersListView',[function(){ | ||
var config = {}; | ||
config.restrict = 'E'; | ||
config.templateUrl = function(){ | ||
return '/views/partial/workersListView.html' | ||
} | ||
config.scope = { | ||
worker : '=', | ||
selectedWorker : '&', | ||
assignTask : '&' | ||
} | ||
config.compile = function($element,$attrs){ | ||
return { | ||
pre : function(scope,element,attrs){ | ||
element.on('click',function(e){ | ||
if(scope.worker.taskAssigned === ''){ | ||
angular.element(element[0].querySelector('div.panel-body')).css('background-color', '#FFB6C1'); | ||
scope.$apply(function(){ | ||
scope.selectedWorker(); | ||
}); | ||
}else{ | ||
alert('Please Select Available Worker'); | ||
} | ||
}); | ||
}, | ||
post : function(scope,element,attrs){ | ||
scope.$watch(function(){ | ||
return scope.worker.taskAssigned; | ||
},function(){ | ||
angular.element(element[0].querySelector('div.panel-body')).css('background-color', 'transparent'); | ||
}) | ||
} | ||
} | ||
|
||
} | ||
return config; | ||
}]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
angular.module('supervisorApp') | ||
.service('clientService', ['$http','$q', function($http,$q){ | ||
this.getWorkersJson = function(){ | ||
return $http.get('/data/workersJson.json'); | ||
} | ||
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
angular.module('supervisorApp') | ||
.provider('routes', ['$stateProvider','$urlRouterProvider',function($stateProvider, $urlRouterProvider) { | ||
$stateProvider.state('home',{ | ||
url : '/home', | ||
templateUrl : function($stateParams){ | ||
return 'views/home.html' | ||
}, | ||
controller : 'homeController as homectrl', | ||
resolve : { | ||
workersJson : ['clientService',function(clientService){ | ||
return clientService.getWorkersJson().then(response => response.data); | ||
}] | ||
} | ||
}); | ||
$urlRouterProvider.otherwise('/home'); | ||
this.$get = function(){ | ||
return {}; | ||
}; | ||
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.text-bold { | ||
font-weight: bold;; | ||
} | ||
.offsetT20{ | ||
margin-top: 20px; | ||
} | ||
.offsetT10{ | ||
margin-top: 10px; | ||
} | ||
.offsetL5{ | ||
margin-left: 5px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"workers": [ | ||
{ | ||
"name": "Tim Dowd", | ||
"mobileNumber": "+122-7485964152", | ||
"taskAssigned": "Manage files", | ||
"taskDuration": 5 | ||
}, | ||
{ | ||
"name": "Jane Mistro", | ||
"mobileNumber": "+122-1527485964", | ||
"taskAssigned": "Verify machine status", | ||
"taskDuration": 10 | ||
}, | ||
{ | ||
"name": "Jerry Lucas", | ||
"mobileNumber": "+122-9641527485", | ||
"taskAssigned": "Monitor power management", | ||
"taskDuration": 3 | ||
}, | ||
{ | ||
"name": "Tyra Kindo", | ||
"mobileNumber": "+122-5964157482", | ||
"taskAssigned": "" | ||
}, | ||
{ | ||
"name": "Cesar Monk", | ||
"mobileNumber": "+122-4152748596", | ||
"taskAssigned": "Order Management", | ||
"taskDuration": 5 | ||
}, | ||
{ | ||
"name": "Zed Mills", | ||
"mobileNumber": "+122-6415274859", | ||
"taskAssigned": "" | ||
}, | ||
{ | ||
"name": "Kera Hoadely", | ||
"mobileNumber": "+122-7596415482", | ||
"taskAssigned": "" | ||
}, | ||
{ | ||
"name": "Craig Hoadely", | ||
"mobileNumber": "+122-5967484152", | ||
"taskAssigned": "Insert Cotton", | ||
"taskDuration": 7 | ||
}, | ||
{ | ||
"name": "Dee Sather", | ||
"mobileNumber": "+122-9647485152", | ||
"taskAssigned": "" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<html ng-app = "supervisorApp"> | ||
<head> | ||
<title>Supervisor Portal</title> | ||
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css"> | ||
<link rel="stylesheet" type="text/css" href="css/style.css"/> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> | ||
<script type="text/javascript" src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script> | ||
<script type="text/javascript" src = "https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.4.2/angular-ui-router.min.js"></script> | ||
</head> | ||
<body ng-cloak> | ||
<div ui-view></div> | ||
<script type="text/javascript" src = "web-worker/worker.js"></script> | ||
<script type="text/javascript" src = "app/app.js"></script> | ||
<script type="text/javascript" src = "app/services/routes.js"></script> | ||
<script type="text/javascript" src = "app/services/clientService.js"></script> | ||
<script type="text/javascript" src = "app/controllers/homeController.js"></script> | ||
<script type="text/javascript" src = "app/directives/workers-list-view.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<div class="row page-header"> | ||
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-8"> | ||
<h2 class="">Welcome, {{homectrl.vm.page.data.supervisorName}}</h2> | ||
</div> | ||
<div class=" col-lg-4 col-md-4 col-sm-4 col-xs-4"> | ||
<button type="button" class="btn btn-primary offsetT20 pull-right" ng-click = "homectrl.vm.ringTheBell()"><i class="fa fa-bell" aria-hidden="true"></i><span class = "offsetL5">Ring the bell</span></button> | ||
</div> | ||
</div> | ||
<section class=""> | ||
<article class="row" ng-repeat = "worker in homectrl.vm.page.data.workers"> | ||
<workers-list-view worker = "worker" selected-worker = "homectrl.vm.selectWorker(worker,$index)"></workers-list-view> | ||
</article> | ||
</section> | ||
<section class="" ng-if = "homectrl.vm.page.data.selectedIndex !== -1"> | ||
<div class="row"> | ||
<div class="col-md-8 col-sm-8"> | ||
<h2 class="">Assign task to '{{homectrl.vm.page.data.selectedAvailableWorker}}'</h2> | ||
</div> | ||
</div> | ||
<form name = "assignTaskForm"> | ||
<div class="row"> | ||
<div class="col-md-5 col-sm-5"> | ||
<div class="form-group"> | ||
<label for="taskName" class="cols-sm-2 control-label">Task Name</label> | ||
<input type="text" class="form-control" name="taskName" id="taskName" placeholder="Enter task Name" ng-model = "homectrl.vm.page.data.taskName" ng-required = "true"/> | ||
</div> | ||
<div class="form-group"> | ||
<label for="taskDuration" class="cols-sm-2 control-label">Task duration (In Seconds)</label> | ||
<input type="text" class="form-control" name="taskDuration" id="taskDuration" placeholder="Enter task duration (In Seconds)" ng-model = "homectrl.vm.page.data.taskDuration" ng-required = "true" ng-pattern="/^[0-9]{1,7}$/"/> | ||
</div> | ||
<div class="form-group "> | ||
<button type="button" class="btn btn-primary" ng-disabled = "assignTaskForm.$invalid" ng-click = "homectrl.vm.assignTask()"><i class="fa fa-bars" aria-hidden="true"></i><span class = "offsetL5">Assign Task</span></button> | ||
</div> | ||
</div> | ||
</div> | ||
</form> | ||
</section> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<div class="col-md-12 col-sm-12"> | ||
<div class="panel panel-default"> | ||
<div class="panel-body"> | ||
<header class="text-left"> | ||
<div class="pull-left text-bold">{{worker.name}}</div> | ||
<div class="pull-right">{{worker.mobileNumber}}</div> | ||
</header> | ||
<div class="clearfix"></div> | ||
<div class="text-muted"> | ||
<p class="offsetT10"> | ||
{{worker.taskAssigned ? worker.taskAssigned : 'Available'}} | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
self.onmessage = function(e) { | ||
var workers = e.data; | ||
for(var i = 0; i < workers.length; i++){ | ||
if(!workers[i]['taskAssigned'] && !workers[i]['taskDuration']){ | ||
self.postMessage(workers[i]); | ||
break; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const ringWorker = new Worker('../web-worker/ring-the-bell.js'); | ||
|
||
ringWorker.addEventListener('message',function(e){ | ||
alert('Name : ' +e.data.name + ' , '+'Mobile Number : '+e.data.mobileNumber) | ||
},false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"name": "hc-ui", | ||
"version": "0.0.0", | ||
"dependencies": { | ||
"angular": "1.4.4", | ||
"json3": "~3.3.1", | ||
"es5-shim": "~3.1.0", | ||
"jquery-ui": "~1.11.2", | ||
"bootstrap": "3.3.5", | ||
"checklist-model": "~0.1.3", | ||
"angular-route": "~1.3.0", | ||
"angular-ui-slider": "https://github.com/vaibhavguptaIITD/ui-slider.git", | ||
"jquery": "2.1.3", | ||
"angular-bootstrap": "1.2.5", | ||
"jquery.customSelect": "https://github.com/vaibhavguptaIITD/jquery.customSelect.git", | ||
"multiple-select": "https://github.com/wenzhixin/multiple-select.git#12658641871b6c672ece4e2e4f0b5337faa17d2d", | ||
"flexslider": "*", | ||
"jquery-mousewheel": "~3.1.12", | ||
"datatables": "1.10.12", | ||
"datatable-fixedColumns": "3.2.1", | ||
"angular-ui-utils": "3.0.0", | ||
"angular-ui-utils-jq": "angular-ui-utils#jq-0.1.1", | ||
"angular-animate": "1.4.4", | ||
"blueimp-file-upload": "~9.8.0", | ||
"awsaccordion": "https://github.com/hcentive/awsAccordion.git", | ||
"jquery.numeric": "./libs/jquery.numeric/jquery.numeric.js", | ||
"jquery.rotaterator": "./libs/jquery.rotaterator/jquery.rotaterator.js", | ||
"hc-utils": "https://github.com/hcentive/hc-utils.git#1.0.15", | ||
"jquery.maskedinput": "~1.4.1", | ||
"angular-datatables": "0.5.0", | ||
"angular-ui-router": "~0.2.11", | ||
"moment": "~2.8.3", | ||
"angular-sanitize": "~1.3.2", | ||
"angular-input-modified": "2.0.1", | ||
"ui-router-extras": "https://github.com/vaibhavguptaIITD/ui-router-extras.git#master", | ||
"angular-messages": "~1.3.5", | ||
"angular-translate": "~2.5.2", | ||
"ng-idle": "https://github.com/vladgurovich/ng-idle.git#develop", | ||
"angular-promise-tracker": "~2.1.0", | ||
"angular-unsavedChanges": "https://github.com/kuldeepkeshwar/angular-unsavedChanges.git#develop", | ||
"jquery-placeholder": "~2.1.1", | ||
"bootstrap-switch": "~3.3.2", | ||
"jquery.nicescroll": "https://github.com/abhi05b/jquery.nicescroll.git#master", | ||
"angular-scroll": "~0.7.0", | ||
"autoNumeric": "1.9.30", | ||
"highcharts-release": "4.1.9", | ||
"lodash": "~3.10.1", | ||
"Read-More-Directive": "https://github.com/hcentive/Read-More-Directive.git", | ||
"ng-tags-input": "3.0.0", | ||
"angular-utf8-base64": "0.0.5", | ||
"angular-vertilize" : "1.0.1", | ||
"password-sheriff" : "./libs/password.sheriff/password.sheriff.js", | ||
"he": "^1.1.0", | ||
"full-calendar" : "./libs/full-calendar/fullCalendar.js", | ||
"angular-ui-calendar" : "latest", | ||
"tinymce": "~4.5.1", | ||
"angular-ui-tinymce" : "0.0.18" | ||
}, | ||
"devDependencies": { | ||
"angular-mocks": "~1.3.0", | ||
"angular-scenario": "~1.2.0" | ||
}, | ||
"appPath": "app", | ||
"resolutions": { | ||
"angular": "1.4.4", | ||
"jquery-ui": "1.11.4", | ||
"angular-ui-validate": "1.2.2", | ||
"ui-indeterminate": "1.0.0", | ||
"ui-mask": "1.6.6", | ||
"ui-event": "1.0.0", | ||
"ui-scrollpoint": "2.0.1", | ||
"ui-scroll": "1.3.2", | ||
"ui-uploader": "1.1.3", | ||
"datatables": ">=1.8.0", | ||
"jquery": "2.1.3", | ||
"moment": ">=2.5.0" | ||
} | ||
} |
Oops, something went wrong.