Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mytime
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Narendar Vakiti
mytime
Commits
d2823a8d
Commit
d2823a8d
authored
Aug 09, 2018
by
nakavaram-nisum-com
Committed by
rbonthala-nisum-com
Aug 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MT-143 defect update in manage projects (#138)
parent
00d149ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
250 additions
and
154 deletions
+250
-154
ProjectController.js
src/main/webapp/WEB-INF/controllers/ProjectController.js
+249
-153
newProject.html
src/main/webapp/WEB-INF/templates/newProject.html
+1
-1
No files found.
src/main/webapp/WEB-INF/controllers/ProjectController.js
View file @
d2823a8d
...
...
@@ -1028,22 +1028,73 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
$scope
.
currentBillabilityDateChange
=
function
(){
$scope
.
startDate
=
$scope
.
newBillingStartDate
;
}
isDataUpdated
=
function
()
{
console
.
log
(
dataToPass
);
if
(
dataToPass
.
action
==
"Update"
)
{
$scope
.
previousData
=
{
ProjectID
:
dataToPass
.
projectId
,
ProjectName
:
dataToPass
.
projectName
,
Account
:
dataToPass
.
account
,
Domain
:
dataToPass
.
domain
,
ProjectStatus
:
dataToPass
.
status
,
StartDate
:
new
Date
(
dataToPass
.
projectStartDate
),
EndDate
:
new
Date
(
dataToPass
.
projectEndDate
)
}
console
.
log
(
$scope
.
projectStartDate
);
$scope
.
currentData
=
{
ProjectID
:
$scope
.
projectId
,
ProjectName
:
$scope
.
projectName
,
Account
:
$scope
.
account
.
accountName
,
Domain
:
$scope
.
domain
.
domainName
,
ProjectStatus
:
$scope
.
projectStatus
,
StartDate
:
$scope
.
projectStartDate
,
EndDate
:
$scope
.
projectEndDate
}
var
predata
=
JSON
.
stringify
(
$scope
.
previousData
);
var
curdata
=
JSON
.
stringify
(
$scope
.
currentData
);
var
exsistingMangersList
=
dataToPass
.
deliveryLeadIds
;
var
temp
=
[];
temp
.
push
(
$scope
.
deliveryLeadsSelectedList
);
var
currentMangersList
=
temp
;
var
managerCheck
=
false
;
if
(
exsistingMangersList
.
length
===
currentMangersList
.
length
)
{
var
temp1
=
[];
var
temp2
=
[];
for
(
var
i
in
exsistingMangersList
)
{
temp1
.
push
(
exsistingMangersList
[
i
].
employeeId
);
}
for
(
var
j
in
currentMangersList
)
{
temp2
.
push
(
currentMangersList
[
j
].
employeeId
);
}
for
(
var
k
=
0
;
k
<
exsistingMangersList
.
length
;
k
++
)
{
if
(
temp2
.
indexOf
(
temp1
[
k
])
>
-
1
)
{
managerCheck
=
true
;
}
else
{
managerCheck
=
false
;
}
}
}
else
{
managerCheck
=
false
;
}
if
(
predata
===
curdata
&&
managerCheck
)
{
//$mdDialog.hide('Cancelled');
return
false
;
}
return
true
}
}
$scope
.
validateFields
=
function
(
action
)
{
var
project
=
$scope
.
projectId
;
var
projectName
=
$scope
.
projectName
;
var
managerModel
=
$scope
.
managerModel
;
var
account
=
$scope
.
account
;
var
managerId
=
$scope
.
managerId
;
var
managerName
=
$scope
.
managerName
;
var
employeeModel
=
$scope
.
employeeModel
;
var
projectModel
=
$scope
.
projectModel
;
var
domain
=
$scope
.
domain
;
var
newBillingStartDate
=
$scope
.
newBillingStartDate
var
deliveryLeadsSelectedList
=
$scope
.
deliveryLeadsSelectedList
;
var
projectStartDate
=
$scope
.
projectStartDate
;
var
projectEndDate
=
$scope
.
projectEndDate
;
var
projectStatus
=
$scope
.
projectStatus
;
if
(
action
===
"Add"
||
action
==
"Update"
){
if
(
employeeModel
==
undefined
||
employeeModel
.
employeeName
==
undefined
){
$scope
.
alertMsg
=
"Please select a employee"
;
...
...
@@ -1086,178 +1137,223 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
$scope
.
alertMsg
=
""
;
var
record
=
{
"id"
:
$scope
.
id
,
"employeeId"
:
employeeModel
.
employeeId
,
"employeeName"
:
employeeModel
.
employeeName
,
"emailId"
:
employeeModel
.
emailId
,
"designation"
:
employeeModel
.
designation
,
"projectId"
:
project
,
"projectName"
:
projectName
,
"managerId"
:
managerId
,
"managerName"
:
managerName
,
"mobileNumber"
:
employeeModel
.
mobileNumber
,
"active"
:
true
,
"billableStatus"
:
$scope
.
empBillableStatus
,
"startDate"
:
$scope
.
startDate
,
"endDate"
:
$scope
.
endDate
,
"account"
:
account
,
"role"
:
$scope
.
employeeRole
,
"newBillingStartDate"
:
newBillingStartDate
,
"accountId"
:
$scope
.
accountId
,
"domainId"
:
$scope
.
domainId
,
"shift"
:
$scope
.
employeeShift
,
"projectStartDate"
:
$scope
.
startDate
,
"projectEndDate"
:
$scope
.
endDate
};
if
(
action
==
"Add"
){
addRecord
(
record
,
action
);
}
else
if
(
action
==
"Update"
){
updateTeamRecord
(
record
,
action
);
$timeout
(
function
(){
getProjectDetails
(
project
,
$scope
.
status
);
removeTab
(
'Add'
);
$mdDialog
.
show
(
$mdDialog
.
alert
({
addRecord
(
record
,
action
);
$scope
.
myForm
.
$setPristine
();
}
else
if
(
action
==
"Update"
)
{
if
(
$scope
.
DataUpdate
()
!=
true
)
{
$mdDialog
.
show
(
$mdDialog
.
alert
({
skipHide
:
true
,
textContent
:
'Employee Updated'
,
ok
:
'ok'
}));
},
500
);
}
title
:
'Attention'
,
textContent
:
'There is no data change to Update'
,
ok
:
'ok'
}))
}
else
{
updateTeamRecord
(
record
,
action
);
$timeout
(
function
()
{
getProjectDetails
(
project
,
$scope
.
status
);
removeTab
(
'Add'
);
$mdDialog
.
show
(
$mdDialog
.
alert
({
skipHide
:
true
,
textContent
:
'Employee Updated'
,
ok
:
'ok'
})).
then
(
function
()
{
$scope
.
myForm
.
$setPristine
();
})
;
},
500
);
}
}
}
}
else
{
if
(
projectName
==
""
)
{
$scope
.
alertMsg
=
"Project Name is mandatory"
;
document
.
getElementById
(
'projectName'
).
focus
();
}
else
if
(
account
==
undefined
||
account
==
""
)
{
$scope
.
alertMsg
=
"Account is mandatory"
;
document
.
getElementById
(
'account'
).
focus
();
}
else
if
(
domain
==
undefined
||
domain
==
""
)
{
$scope
.
alertMsg
=
"Domain is mandatory"
;
document
.
getElementById
(
'domain'
).
focus
();
}
else
if
(
deliveryLeadsSelectedList
.
employeeName
==
undefined
||
deliveryLeadsSelectedList
.
employeeName
==
""
){
$scope
.
alertMsg
=
"Please select a Delivery Lead"
;
document
.
getElementById
(
'deliveryLead'
).
focus
();
}
else
if
(
projectStatus
==
undefined
){
$scope
.
alertMsg
=
"Please select a Project Status"
;
document
.
getElementById
(
'projectStatus'
).
focus
();
}
else
if
(
projectStartDate
==
undefined
){
$scope
.
alertMsg
=
"Please select project start date"
;
document
.
getElementById
(
'projectStartDate'
).
focus
();
}
else
if
(
projectEndDate
==
undefined
){
$scope
.
alertMsg
=
"Please select project end date"
;
document
.
getElementById
(
'projectEndDate'
).
focus
();
}
else
if
(
projectStartDate
>=
projectEndDate
){
$scope
.
alertMsg
=
"Start date should be grater than end date"
;
};
$scope
.
validateProjectFields
=
function
(
action
){
var
domain
=
$scope
.
domain
;
var
account
=
$scope
.
account
;
var
projectName
=
$scope
.
projectName
;
var
deliveryLeadsSelectedList
=
$scope
.
deliveryLeadsSelectedList
;
var
projectStartDate
=
$scope
.
projectStartDate
;
var
projectEndDate
=
$scope
.
projectEndDate
;
var
projectStatus
=
$scope
.
projectStatus
;
if
(
action
==
"Assign"
||
action
==
"Update"
)
if
(
projectName
==
""
)
{
$scope
.
alertMsg
=
"Project Name is mandatory"
;
document
.
getElementById
(
'projectName'
).
focus
();
}
else
if
(
account
==
undefined
||
account
==
""
)
{
$scope
.
alertMsg
=
"Account is mandatory"
;
document
.
getElementById
(
'account'
).
focus
();
}
else
if
(
domain
==
undefined
||
domain
==
""
)
{
$scope
.
alertMsg
=
"Domain is mandatory"
;
document
.
getElementById
(
'domain'
).
focus
();
}
else
if
(
deliveryLeadsSelectedList
.
employeeName
==
undefined
||
deliveryLeadsSelectedList
.
employeeName
==
""
){
$scope
.
alertMsg
=
"Please select a Delivery Lead"
;
document
.
getElementById
(
'deliveryLead'
).
focus
();
}
else
if
(
projectStatus
==
undefined
){
$scope
.
alertMsg
=
"Please select a Project Status"
;
document
.
getElementById
(
'projectStatus'
).
focus
();
}
else
{
$scope
.
alertMsg
=
""
;
console
.
log
(
$scope
.
projectStatus
,
$scope
.
domain
.
domainId
);
var
record
=
{
"projectId"
:
$scope
.
projectId
,
"projectName"
:
$scope
.
projectName
,
"account"
:
$scope
.
account
.
accountName
,
"domain"
:
$scope
.
domain
.
domainName
,
"accountId"
:
$scope
.
account
.
accountId
,
"domainId"
:
$scope
.
domain
.
domainId
,
"managerIds"
:
[],
"deliveryLeadIds"
:
getSelectedDeliveryLeadIds
(),
"status"
:
$scope
.
projectStatus
,
"projectStartDate"
:
$scope
.
projectStartDate
,
"projectEndDate"
:
$scope
.
projectEndDate
};
console
.
log
(
record
);
else
if
(
projectStartDate
==
undefined
){
$scope
.
alertMsg
=
"Please select project start date"
;
document
.
getElementById
(
'projectStartDate'
).
focus
();
}
else
if
(
projectEndDate
==
undefined
){
$scope
.
alertMsg
=
"Please select project end date"
;
document
.
getElementById
(
'projectEndDate'
).
focus
();
}
else
if
(
projectStartDate
>=
projectEndDate
){
$scope
.
alertMsg
=
"Start date should not be greater than end date"
;
}
else
{
$scope
.
alertMsg
=
""
;
console
.
log
(
$scope
.
projectStatus
,
$scope
.
domain
.
domainId
);
var
record
=
{
"projectId"
:
$scope
.
projectId
,
"projectName"
:
$scope
.
projectName
,
"account"
:
$scope
.
account
.
accountName
,
"domain"
:
$scope
.
domain
.
domainName
,
"accountId"
:
$scope
.
account
.
accountId
,
"domainId"
:
$scope
.
domain
.
domainId
,
"managerIds"
:
[],
"deliveryLeadIds"
:
getSelectedDeliveryLeadIds
(),
"status"
:
$scope
.
projectStatus
,
"projectStartDate"
:
$scope
.
projectStartDate
,
"projectEndDate"
:
$scope
.
projectEndDate
};
console
.
log
(
record
);
if
(
action
==
"Update"
){
if
(
isDataUpdated
()
!=
true
)
{
$mdDialog
.
show
(
$mdDialog
.
alert
({
skipHide
:
true
,
title
:
'Attention'
,
textContent
:
'There is no data change to Update'
,
ok
:
'ok'
}))
}
else
{
addOrUpdateProject
(
record
,
$scope
.
templateTitle
);
$timeout
(
function
()
{
updateGrid
(
$scope
.
templateTitle
,
record
)
},
500
);
}
}
else
{
addOrUpdateProject
(
record
,
$scope
.
templateTitle
);
$timeout
(
function
()
{
updateGrid
(
$scope
.
templateTitle
,
record
)
},
500
);
}
}
};
}
}}
$scope
.
cancel
=
function
()
{
var
showConfirmDialog
=
false
;
if
(
dataToPass
.
action
==
"Update"
){
if
(
$scope
.
domain
!=
undefined
){
$scope
.
previousData
=
{
ProjectID
:
dataToPass
.
projectId
,
ProjectName
:
dataToPass
.
projectName
,
Account
:
dataToPass
.
account
,
Domain
:
dataToPass
.
domain
,
ProjectStatus
:
dataToPass
.
status
}
$scope
.
currentData
=
{
ProjectID
:
$scope
.
projectId
,
ProjectName
:
$scope
.
projectName
,
Account
:
$scope
.
account
.
accountName
,
Domain
:
$scope
.
domain
.
domainName
,
ProjectStatus
:
$scope
.
projectStatus
,
}
var
predata
=
JSON
.
stringify
(
$scope
.
previousData
);
var
curdata
=
JSON
.
stringify
(
$scope
.
currentData
);
var
exsistingMangersList
=
dataToPass
.
deliveryLeadIds
;
var
temp
=
[];
temp
.
push
(
$scope
.
deliveryLeadsSelectedList
);
var
currentMangersList
=
temp
;
var
managerCheck
=
false
;
if
(
exsistingMangersList
.
length
===
currentMangersList
.
length
){
var
temp1
=
[];
var
temp2
=
[];
for
(
var
i
in
exsistingMangersList
){
temp1
.
push
(
exsistingMangersList
[
i
].
employeeId
);
}
for
(
var
j
in
currentMangersList
){
temp2
.
push
(
currentMangersList
[
j
].
employeeId
);
}
for
(
var
k
=
0
;
k
<
exsistingMangersList
.
length
;
k
++
){
if
(
temp2
.
indexOf
(
temp1
[
k
])
>
-
1
){
managerCheck
=
true
;
}
else
{
managerCheck
=
false
;
}
}
}
else
{
managerCheck
=
false
;
}
if
(
predata
===
curdata
&&
managerCheck
){
$mdDialog
.
hide
(
'Cancelled'
);
}
else
{
$mdDialog
.
show
(
$mdDialog
.
confirm
({
skipHide
:
true
,
textContent
:
'Are you sure you want to cancel this?'
,
ok
:
'ok'
,
cancel
:
'cancel'
})).
then
(
function
(){
$mdDialog
.
hide
(
'Cancelled'
);
})
}
if
(
dataToPass
.
action
==
"Update"
)
{
if
(
$scope
.
domain
!=
undefined
)
{
if
(
isDataUpdated
()
!=
true
)
{
$mdDialog
.
hide
(
'Cancelled'
);
}
else
{
$mdDialog
.
show
(
$mdDialog
.
confirm
({
skipHide
:
true
,
textContent
:
'Are you sure you want to cancel this?'
,
ok
:
'ok'
,
cancel
:
'cancel'
})).
then
(
function
()
{
$mdDialog
.
hide
(
'Cancelled'
);
})
}
}
else
{
else
{
$mdDialog
.
show
(
$mdDialog
.
confirm
({
skipHide
:
true
,
textContent
:
'Are you sure you want to cancel this?'
,
ok
:
'ok'
,
cancel
:
'cancel'
})).
then
(
function
()
{
$mdDialog
.
hide
(
'Cancelled'
);
})
cancel
:
'cancel'
})).
then
(
function
()
{
$mdDialog
.
hide
(
'Cancelled'
);
})
}
}
if
(
dataToPass
.
action
==
"Assign"
)
{
var
totalFields
=
$scope
.
myForm
.
$$controls
;
for
(
key
in
totalFields
)
{
console
.
log
(
"Model value of"
+
key
+
" ==>"
+
totalFields
[
key
].
$modelValue
)
if
(
totalFields
[
key
].
$modelValue
!==
''
&&
totalFields
[
key
].
$modelValue
!==
undefined
&&
totalFields
[
key
].
$modelValue
.
length
!==
0
)
{
console
.
log
(
"Came here!"
);
showConfirmDialog
=
true
;
}
if
(
dataToPass
.
action
==
"Assign"
){
var
totalFields
=
$scope
.
myForm
.
$$controls
;
for
(
key
in
totalFields
)
{
console
.
log
(
"Model value of"
+
key
+
" ==>"
+
totalFields
[
key
].
$modelValue
)
if
(
totalFields
[
key
].
$modelValue
!==
''
&&
totalFields
[
key
].
$modelValue
!==
undefined
&&
totalFields
[
key
].
$modelValue
.
length
!==
0
)
{
console
.
log
(
"Came here!"
);
showConfirmDialog
=
true
;
}
}
if
(
showConfirmDialog
){
$mdDialog
.
show
(
$mdDialog
.
confirm
({
skipHide
:
true
,
textContent
:
'Are you sure you want to cancel this?'
,
ok
:
'ok'
,
cancel
:
'cancel'
})).
then
(
function
(){
$mdDialog
.
hide
(
'Cancelled'
);
})
}
else
{
$mdDialog
.
hide
(
'Cancelled'
);
}
}
};
$scope
.
cancelDialog
=
function
()
{
$mdDialog
.
hide
(
'Cancelled'
);
};
$scope
.
cancelTab
=
function
()
{
if
(
dataToPass
.
action
==
"View"
)
{
if
(
$scope
.
myForm
.
$dirty
)
{
if
(
showConfirmDialog
)
{
$mdDialog
.
show
(
$mdDialog
.
confirm
({
skipHide
:
true
,
textContent
:
'Are you sure you want to cancel this?'
,
ok
:
'ok'
,
cancel
:
'cancel'
})).
then
(
function
()
{
removeTab
(
"cancel"
);
$scope
.
myForm
.
$setPristine
();
$mdDialog
.
hide
(
'Cancelled'
);
})
}
else
{
removeTab
(
"cancel"
)
$mdDialog
.
hide
(
'Cancelled'
);
}
}
};
$scope
.
cancelDialog
=
function
()
{
$mdDialog
.
hide
(
'Cancelled'
);
};
$scope
.
DataUpdate
=
function
()
{
var
data
=
$scope
.
parentData
;
if
(
data
.
role
==
"Individual Contributor"
)
{
var
roleselected
=
"Employee"
;
}
else
{
roleselected
=
data
.
role
;
}
$scope
.
previousData
=
{
Role
:
roleselected
,
Shift
:
data
.
shift
,
Billabilitystatus
:
data
.
billableStatus
,
newBilligStartDate
:
new
Date
(
data
.
newBillingStartDate
),
Startdate
:
data
.
startDate
,
Enddate
:
data
.
endDate
},
$scope
.
currentData
=
{
Role
:
$scope
.
employeeRole
,
Shift
:
$scope
.
employeeShift
,
Billabilitystatus
:
$scope
.
empBillableStatus
,
newBilligStartDate
:
$scope
.
newBillingStartDate
,
Startdate
:
$scope
.
startDate
,
Enddate
:
$scope
.
endDate
}
var
predata
=
JSON
.
stringify
(
$scope
.
previousData
);
var
curdata
=
JSON
.
stringify
(
$scope
.
currentData
);
if
(
predata
==
curdata
)
{
return
false
;
}
return
true
;
}
$scope
.
cancelTab
=
function
()
{
if
(
dataToPass
.
action
==
"View"
)
{
if
(
$scope
.
templateTitle
==
"Update"
)
{
if
(
$scope
.
DataUpdate
()
==
false
)
{
removeTab
(
"cancel"
);
}
else
{
$mdDialog
.
show
(
$mdDialog
.
confirm
({
skipHide
:
true
,
textContent
:
'Are you sure you want to cancel this?'
,
ok
:
'ok'
,
cancel
:
'cancel'
})).
then
(
function
()
{
removeTab
(
"cancel"
);
$scope
.
myForm
.
$setPristine
();
})
}
}
if
(
$scope
.
templateTitle
==
"Add"
)
{
console
.
log
(
$scope
.
myForm
);
if
(
$scope
.
myForm
.
$dirty
)
{
$mdDialog
.
show
(
$mdDialog
.
confirm
({
skipHide
:
true
,
textContent
:
'Are you sure you want to cancel this?'
,
ok
:
'ok'
,
cancel
:
'cancel'
})).
then
(
function
()
{
removeTab
(
"cancel"
);
$scope
.
myForm
.
$setPristine
();
})
}
else
{
removeTab
(
"cancel"
)
}
}
}
};
...
...
src/main/webapp/WEB-INF/templates/newProject.html
View file @
d2823a8d
...
...
@@ -115,7 +115,7 @@
</md-dialog-content>
<md-dialog-actions
layout=
"row"
>
<md-button
class=
"md-raised"
data-ng-click=
"validate
Fields('{{templateTitle}}'
)"
style=
"width:120px;background: cadetblue;color:white;"
>
<md-button
class=
"md-raised"
data-ng-click=
"validate
ProjectFields(templateTitle
)"
style=
"width:120px;background: cadetblue;color:white;"
>
<span
ng-show=
"templateTitle == 'Assign' "
>
Add
</span>
<span
ng-show=
"templateTitle != 'Assign' "
>
{{templateTitle}}
</span>
</md-button>
<md-button
class=
"md-raised"
ng-click=
"cancel()"
style=
"width:120px;background: cadetblue;color:white;"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment