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){
$scope.role = myFactory.getEmpRole();
$scope.menuItems = myFactory.getMenuItems();
$scope.manageGroup = [];
$scope.reportsGroup = [];
$scope.nonManageGroup = [];
$scope.setTemplateUrl = function(path){
var element = document.getElementById('main');
......@@ -24,20 +25,34 @@ myApp.controller("leftmenuController",function($scope, myFactory, $compile){
if($scope.menuItems[i].menu.indexOf('Manage') !== -1) {
$scope.manageGroup.push($scope.menuItems[i]);
}
else if($scope.menuItems[i].menu.indexOf('Report') !== -1) {
$scope.reportsGroup.push($scope.menuItems[i]);
}
else{
$scope.nonManageGroup.push($scope.menuItems[i]);
}
}
$scope.custom = true;
$scope.customReport = true;
$scope.toggleManage = function(){
$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(){
if(!$scope.custom){
$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
//$scope.isSecondTab = ($scope.projectId == 'Nisum0000');
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>'
+'&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>';
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
pageSize: 10,
enableFiltering:true,
enableCellEdit:false,
enableRowSelection: true,
rowEditWaitInterval: 0,
columnDefs: [
{ name: 'employeeId', displayName: 'Emp ID', enableColumnMenu: true, enableSorting: true, width:80, enableFiltering:true ,enableCellEdit: true },
{ field: 'employeeName', displayName: 'Emp Name ', enableColumnMenu: false, enableSorting: false,enableFiltering:true,sort: {
{ 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: {
direction: uiGridConstants.ASC,
priority: 0,
} },
......@@ -638,7 +640,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
'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,
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
'Reserved' ,
'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>'},
{ 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>'},
{name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate1, enableColumnMenu: false, enableSorting: false, width:100,enableFiltering: false}
]
};
$scope.isDisabled = true;
if($scope.isSecondTab){
$scope.gridOptions.columnDefs[5].visible = false;
}
......@@ -711,8 +712,20 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
"newBillingStartDate":"",
"empBillableStatuses":[]
};
$scope.edit = function (row) {
$scope.edit = function (rowd) {
var row = rowd.entity;
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++){
if(i==index){
$scope.gridOptions.data[i].editrow = !$scope.gridOptions.data[i].editrow;
......@@ -724,6 +737,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
row.billingStartDate = new Date(row.billingStartDate);
row.billingEndDate = new Date(row.billingEndDate);
$scope.parentData.employeeId = row.employeeId;
$scope.parentData.employeeName = row.employeeName;
$scope.parentData.emailId = row.emailId;
......@@ -742,13 +756,29 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$scope.parentData.newBillingStartDate = row.billingStartDate;
$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) {
var index = $scope.gridOptions.data.indexOf(row);
$scope.gridOptions.data[index].editrow = false;
$scope.alerts.push({
msg: 'Row editing cancelled',
type: 'info'
});
row.billingStartDate = $scope.parentData.newBillingStartDate;
row.billingEndDate = $scope.parentData.endDate;
row.resourceRole = $scope.parentData.role;
row.billableStatus = $scope.parentData.billableStatus;
};
$scope.saveRow = function (row,action) {
var index = $scope.gridOptions.data.indexOf(row);
......@@ -777,6 +807,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
row.resourceRole = $scope.parentData.role;
row.billableStatus = $scope.parentData.billableStatus;
}
$scope.previousRow = angular.copy(row);
}
}
// $scope.getRowData = function(row, action){
......@@ -1317,10 +1348,10 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$scope.alertMsg = "Please select new Billing StartDate";
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";
return false;
}
}*/
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";
}
......@@ -1461,10 +1492,12 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
ok: 'ok',
cancel: 'cancel'
})).then(function () {
$scope.alertMsg = "";
$mdDialog.hide('Cancelled');
})
}
else {
$scope.alertMsg = "";
$mdDialog.hide('Cancelled');
}
}
......
......@@ -180,6 +180,21 @@ i.fa.fa-refresh:hover {
#sidebar-wrapper .sidebar-nav li ul.manageGroup:hover {
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 {
border: none;
}
......@@ -621,3 +636,9 @@ cursor: pointer;
.grid-Dropdown md-select {
margin : 0px;
}
.icon-disable {
background-color: green;
}
.iconenable {
background-color: red;
}
\ No newline at end of file
......@@ -19,6 +19,17 @@
aria-hidden="false"> </i> <span>{{manageItem.menu}}</span></a></i>
</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>
</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