Commit 8af003c8 authored by Prayas Jain's avatar Prayas Jain

Updated_NavBar

parent fd34d593
...@@ -5,6 +5,7 @@ myApp.controller("leftmenuController",function($scope, myFactory, $compile){ ...@@ -5,6 +5,7 @@ myApp.controller("leftmenuController",function($scope, myFactory, $compile){
$scope.role = myFactory.getEmpRole(); $scope.role = myFactory.getEmpRole();
$scope.menuItems = myFactory.getMenuItems(); $scope.menuItems = myFactory.getMenuItems();
$scope.manageGroup = []; $scope.manageGroup = [];
$scope.reportsGroup = [];
$scope.nonManageGroup = []; $scope.nonManageGroup = [];
$scope.setTemplateUrl = function(path){ $scope.setTemplateUrl = function(path){
var element = document.getElementById('main'); var element = document.getElementById('main');
...@@ -24,20 +25,34 @@ myApp.controller("leftmenuController",function($scope, myFactory, $compile){ ...@@ -24,20 +25,34 @@ myApp.controller("leftmenuController",function($scope, myFactory, $compile){
if($scope.menuItems[i].menu.indexOf('Manage') !== -1) { if($scope.menuItems[i].menu.indexOf('Manage') !== -1) {
$scope.manageGroup.push($scope.menuItems[i]); $scope.manageGroup.push($scope.menuItems[i]);
} }
else if($scope.menuItems[i].menu.indexOf('Report') !== -1) {
$scope.reportsGroup.push($scope.menuItems[i]);
}
else{ else{
$scope.nonManageGroup.push($scope.menuItems[i]); $scope.nonManageGroup.push($scope.menuItems[i]);
} }
} }
$scope.custom = true; $scope.custom = true;
$scope.customReport = true;
$scope.toggleManage = function(){ $scope.toggleManage = function(){
$scope.custom = $scope.custom === false ? true: false; $scope.custom = $scope.custom === false ? true: false;
if(!$scope.customReport){
$scope.customReport = true;
}
} }
$scope.toggleReport = function(){
$scope.customReport = $scope.customReport ===false ? true : false;
if(!$scope.custom){
$scope.custom = true;
}
}
$scope.togglenonManage = function(){ $scope.togglenonManage = function(){
if(!$scope.custom){ if(!$scope.custom){
$scope.custom = true; $scope.custom = true;
} }
else if(!$scope.customReport){
$scope.customReport = true;
}
} }
}); });
\ No newline at end of file
...@@ -605,9 +605,9 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor ...@@ -605,9 +605,9 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
//$scope.isSecondTab = ($scope.projectId == 'Nisum0000'); //$scope.isSecondTab = ($scope.projectId == 'Nisum0000');
var employeeModel = $scope.employeeModel; var employeeModel = $scope.employeeModel;
var getCellTemplate1 = '<p class="col-lg-12"><i ng-show="!row.entity.editrow" class="fa fa-pencil-square-o fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.edit(row.entity)"></i>'+ var getCellTemplate1 = '<p class="col-lg-12"><i ng-show="!row.entity.editrow" class="fa fa-pencil-square-o fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.edit(row)"></i>'+
'<i ng-show="row.entity.editrow" class="fa fa-save fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.saveRow(row.entity,\'Update\')"></i>' '<i ng-show="row.entity.editrow" class="fa fa-save fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.saveRow(row.entity,\'Update\')"></i>'
+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i ng-show="row.entity.editrow" class="fa fa-times fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.cancelEdit(row.entity)"></i></p>' +'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i ng-show="row.entity.editrow" id="cancelEdit" class="fa fa-times fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.cancelEdit(row.entity)"></i></p>'
//'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-minus-circle fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.getRowData(row,\'Delete\')"></i></p>'; //'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-minus-circle fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.getRowData(row,\'Delete\')"></i></p>';
var getCellActiveTemplate = '<div ng-show="COL_FIELD==true"><p class="col-lg-12">Y</P></div><div ng-show="COL_FIELD==false"><p class="col-lg-12">N</p></div>'; var getCellActiveTemplate = '<div ng-show="COL_FIELD==true"><p class="col-lg-12">Y</P></div><div ng-show="COL_FIELD==false"><p class="col-lg-12">N</p></div>';
...@@ -620,9 +620,11 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor ...@@ -620,9 +620,11 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
pageSize: 10, pageSize: 10,
enableFiltering:true, enableFiltering:true,
enableCellEdit:false, enableCellEdit:false,
enableRowSelection: true,
rowEditWaitInterval: 0,
columnDefs: [ columnDefs: [
{ name: 'employeeId', displayName: 'Emp ID', enableColumnMenu: true, enableSorting: true, width:80, enableFiltering:true ,enableCellEdit: true }, { name: 'employeeId', displayName: 'Emp ID', enableColumnMenu: true, enableSorting: true, width:80, enableFiltering:true },
{ field: 'employeeName', displayName: 'Emp Name ', enableColumnMenu: false, enableSorting: false,enableFiltering:true,sort: { { field: 'employeeName', displayName: 'Emp Name', enableColumnMenu: false, enableSorting: false,enableFiltering:true,sort: {
direction: uiGridConstants.ASC, direction: uiGridConstants.ASC,
priority: 0, priority: 0,
} }, } },
...@@ -638,7 +640,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor ...@@ -638,7 +640,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
'Lead' ] 'Lead' ]
}, },
{ field: 'designation', resourceRole: 'Designation ', enableColumnMenu: false, enableSorting: false,enableFiltering:false }, { field: 'designation', resourceRole: 'Designation', enableColumnMenu: false, enableSorting: false,enableFiltering:false },
{ {
name: 'billableStatus', displayName: 'Billability ', enableColumnMenu: false, enableSorting: false ,enableFiltering:false, name: 'billableStatus', displayName: 'Billability ', enableColumnMenu: false, enableSorting: false ,enableFiltering:false,
cellTemplate: '<div ng-if="!row.entity.editrow">{{COL_FIELD}}</div><div ng-if="row.entity.editrow" class="grid-Dropdown"><md-select ng-model="MODEL_COL_FIELD" name="empBillableStatus" append-to-body="true">' cellTemplate: '<div ng-if="!row.entity.editrow">{{COL_FIELD}}</div><div ng-if="row.entity.editrow" class="grid-Dropdown"><md-select ng-model="MODEL_COL_FIELD" name="empBillableStatus" append-to-body="true">'
...@@ -650,14 +652,13 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor ...@@ -650,14 +652,13 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
'Reserved' , 'Reserved' ,
'Trainee' ] 'Trainee' ]
}, },
{ field: 'billingStartDate', displayName: 'Start Date ', enableColumnMenu: false, enableSorting: false , cellFilter:'date:"dd-MMM-yyyy"',enableFiltering:false, width:160, { field: 'billingStartDate', displayName: 'Start Date', enableColumnMenu: false, enableSorting: false , cellFilter:'date:"dd-MMM-yyyy"',enableFiltering:false, width:160,
cellTemplate: '<div ng-if="!row.entity.editrow">{{COL_FIELD | date:"dd-MMM-yyyy"}}</div><div ng-if="row.entity.editrow"><md-datepicker ng-model="MODEL_COL_FIELD" md-placeholder="Plase select Date " id="newBillingStartDate " md-min-date="minDate "md-max-date="maxDate " name="newBillingStartDate"></md-datepicker></div>'}, cellTemplate: '<div ng-if="!row.entity.editrow">{{COL_FIELD | date:"dd-MMM-yyyy"}}</div><div ng-if="row.entity.editrow"><md-datepicker ng-model="MODEL_COL_FIELD" md-placeholder="Plase select Date " id="newBillingStartDate " md-min-date="minDate "md-max-date="maxDate " name="newBillingStartDate"></md-datepicker></div>'},
{ field: 'billingEndDate', displayName: 'End Date ', enableColumnMenu: false, enableSorting: false , cellFilter:'date:"dd-MMM-yyyy"',enableFiltering:false, width:160, { field: 'billingEndDate', displayName: 'End Date', enableColumnMenu: false, enableSorting: false , cellFilter:'date:"dd-MMM-yyyy"',enableFiltering:false, width:160,
cellTemplate: '<div ng-if="!row.entity.editrow">{{COL_FIELD | date:"dd-MMM-yyyy"}}</div><div ng-if="row.entity.editrow"><md-datepicker ng-model="MODEL_COL_FIELD" id="endDate " name="endDate">{{MODEL_COL_FIELD}}</md-datepicker></div>'}, cellTemplate: '<div ng-if="!row.entity.editrow">{{COL_FIELD | date:"dd-MMM-yyyy"}}</div><div ng-if="row.entity.editrow"><md-datepicker ng-model="MODEL_COL_FIELD" id="endDate " name="endDate">{{MODEL_COL_FIELD}}</md-datepicker></div>'},
{name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate1, enableColumnMenu: false, enableSorting: false, width:100,enableFiltering: false} {name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate1, enableColumnMenu: false, enableSorting: false, width:100,enableFiltering: false}
] ]
}; };
$scope.isDisabled = true;
if($scope.isSecondTab){ if($scope.isSecondTab){
$scope.gridOptions.columnDefs[5].visible = false; $scope.gridOptions.columnDefs[5].visible = false;
} }
...@@ -711,8 +712,20 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor ...@@ -711,8 +712,20 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
"newBillingStartDate":"", "newBillingStartDate":"",
"empBillableStatuses":[] "empBillableStatuses":[]
}; };
$scope.edit = function (row) {
$scope.edit = function (rowd) {
var row = rowd.entity;
var index = $scope.gridOptions.data.indexOf(row); var index = $scope.gridOptions.data.indexOf(row);
if($scope.previousRow){
$scope.rowCompare(rowd);
}
$scope.previousRow = angular.copy(row);
$scope.previousRowIndex = index;
$scope.gridOptions.enableCellEdit = true;
for(var i =0; i<$scope.gridOptions.data.length; i++){ for(var i =0; i<$scope.gridOptions.data.length; i++){
if(i==index){ if(i==index){
$scope.gridOptions.data[i].editrow = !$scope.gridOptions.data[i].editrow; $scope.gridOptions.data[i].editrow = !$scope.gridOptions.data[i].editrow;
...@@ -724,6 +737,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor ...@@ -724,6 +737,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
row.billingStartDate = new Date(row.billingStartDate); row.billingStartDate = new Date(row.billingStartDate);
row.billingEndDate = new Date(row.billingEndDate); row.billingEndDate = new Date(row.billingEndDate);
$scope.parentData.employeeId = row.employeeId; $scope.parentData.employeeId = row.employeeId;
$scope.parentData.employeeName = row.employeeName; $scope.parentData.employeeName = row.employeeName;
$scope.parentData.emailId = row.emailId; $scope.parentData.emailId = row.emailId;
...@@ -742,13 +756,29 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor ...@@ -742,13 +756,29 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$scope.parentData.newBillingStartDate = row.billingStartDate; $scope.parentData.newBillingStartDate = row.billingStartDate;
$scope.parentData.endDate = row.billingEndDate; $scope.parentData.endDate = row.billingEndDate;
}; };
$scope.rowCompare = function(row) {
var allRows = row.grid.rows;
for(var i=0; i<allRows.length; i++) {
var newIndex = $scope.gridOptions.data.indexOf(allRows[i].entity)
if(newIndex == $scope.previousRowIndex){
allRows[i].entity.resourceRole = $scope.previousRow.resourceRole;
allRows[i].entity.billableStatus = $scope.previousRow.billableStatus;
allRows[i].entity.billingStartDate = $scope.previousRow.billingStartDate;
allRows[i].entity.billingEndDate = $scope.previousRow.billingEndDate
$scope.previousRow = angular.copy(row.entity);
}
}
}
$scope.cancelEdit = function (row) { $scope.cancelEdit = function (row) {
var index = $scope.gridOptions.data.indexOf(row); var index = $scope.gridOptions.data.indexOf(row);
$scope.gridOptions.data[index].editrow = false; $scope.gridOptions.data[index].editrow = false;
$scope.alerts.push({ row.billingStartDate = $scope.parentData.newBillingStartDate;
msg: 'Row editing cancelled', row.billingEndDate = $scope.parentData.endDate;
type: 'info' row.resourceRole = $scope.parentData.role;
}); row.billableStatus = $scope.parentData.billableStatus;
}; };
$scope.saveRow = function (row,action) { $scope.saveRow = function (row,action) {
var index = $scope.gridOptions.data.indexOf(row); var index = $scope.gridOptions.data.indexOf(row);
...@@ -777,6 +807,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor ...@@ -777,6 +807,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
row.resourceRole = $scope.parentData.role; row.resourceRole = $scope.parentData.role;
row.billableStatus = $scope.parentData.billableStatus; row.billableStatus = $scope.parentData.billableStatus;
} }
$scope.previousRow = angular.copy(row);
} }
} }
// $scope.getRowData = function(row, action){ // $scope.getRowData = function(row, action){
...@@ -1317,10 +1348,10 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor ...@@ -1317,10 +1348,10 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$scope.alertMsg = "Please select new Billing StartDate"; $scope.alertMsg = "Please select new Billing StartDate";
angular.element(document.getElementById('newBillingStartDate')).focus(); angular.element(document.getElementById('newBillingStartDate')).focus();
} }
else if(employeeModel != undefined && projectModel != undefined && action == "Add" && getExistingRecordProjectStatus(employeeModel.employeeId, projectModel.projectName)){ /* else if(employeeModel != undefined && projectModel != undefined && action == "Add" && getExistingRecordProjectStatus(employeeModel.employeeId, projectModel.projectName)){
$scope.alertMsg = "Employee is already assigned to the selected project"; $scope.alertMsg = "Employee is already assigned to the selected project";
return false; return false;
} }*/
else if(!(($scope.newBillingStartDate >= new Date(dataToPass.projectStartDate)) && ($scope.newBillingStartDate <= $scope.endDate))){ else if(!(($scope.newBillingStartDate >= new Date(dataToPass.projectStartDate)) && ($scope.newBillingStartDate <= $scope.endDate))){
$scope.alertMsg = $scope.empBillableStatus + " start date should be in between project start date and end date"; $scope.alertMsg = $scope.empBillableStatus + " start date should be in between project start date and end date";
} }
...@@ -1461,10 +1492,12 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor ...@@ -1461,10 +1492,12 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
ok: 'ok', ok: 'ok',
cancel: 'cancel' cancel: 'cancel'
})).then(function () { })).then(function () {
$scope.alertMsg = "";
$mdDialog.hide('Cancelled'); $mdDialog.hide('Cancelled');
}) })
} }
else { else {
$scope.alertMsg = "";
$mdDialog.hide('Cancelled'); $mdDialog.hide('Cancelled');
} }
} }
......
...@@ -180,6 +180,21 @@ i.fa.fa-refresh:hover { ...@@ -180,6 +180,21 @@ i.fa.fa-refresh:hover {
#sidebar-wrapper .sidebar-nav li ul.manageGroup:hover { #sidebar-wrapper .sidebar-nav li ul.manageGroup:hover {
background: transparent; background: transparent;
} }
#sidebar-wrapper .sidebar-nav li ul.reportsGroup {
height: 125px;
overflow: hidden;
padding: 0;
transition: height 0.5s ease-out;
}
#sidebar-wrapper .sidebar-nav li ul.reportsGroup.ng-hide {
height: 0;
}
#sidebar-wrapper .sidebar-nav li ul.reportsGroup li a {
padding-left: 35px;
}
#sidebar-wrapper .sidebar-nav li ul.reportsGroup:hover {
background: transparent;
}
#sidebar-wrapper .sidebar-nav li:last-child { #sidebar-wrapper .sidebar-nav li:last-child {
border: none; border: none;
} }
...@@ -621,3 +636,9 @@ cursor: pointer; ...@@ -621,3 +636,9 @@ cursor: pointer;
.grid-Dropdown md-select { .grid-Dropdown md-select {
margin : 0px; margin : 0px;
} }
.icon-disable {
background-color: green;
}
.iconenable {
background-color: red;
}
\ No newline at end of file
...@@ -19,6 +19,17 @@ ...@@ -19,6 +19,17 @@
aria-hidden="false"> </i> <span>{{manageItem.menu}}</span></a></i> aria-hidden="false"> </i> <span>{{manageItem.menu}}</span></a></i>
</li> </li>
</ul>
</li>
<li> <a href="#" ng-click="toggleReport()" ng-show="reportsGroup.length > 0"> <i class="fa fa-file" aria-hidden="true"></i> <span>Manage Reports</span> <i class="fa fa-angle-down right"></i></a>
<ul ng-hide="customReport" class="reportsGroup">
<li ng-repeat="reportItem in reportsGroup">
<a href="#" class="navbarMenu" ng-click="setTemplateUrl(reportItem.path)"><i
class="{{reportItem.icon}}"
aria-hidden="false"> </i> <span>{{reportItem.menu}}</span></a></i>
</li>
</ul> </ul>
</li> </li>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment