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
22d15411
Commit
22d15411
authored
Aug 06, 2018
by
nakavaram-nisum-com
Committed by
tdutta-nisum-com
Aug 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restricting api calls in update (#120)
parent
67879601
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
164 additions
and
136 deletions
+164
-136
DomainController.js
src/main/webapp/WEB-INF/controllers/DomainController.js
+71
-57
assignAccountsController.js
...in/webapp/WEB-INF/controllers/assignAccountsController.js
+93
-79
No files found.
src/main/webapp/WEB-INF/controllers/DomainController.js
View file @
22d15411
...
...
@@ -266,83 +266,89 @@ myApp.controller("domainController",
return
"Please select account"
;
}
};
isDataUpdated
=
function
()
{
if
(
dataToPass
.
action
==
"Update"
)
{
$scope
.
previousData
=
{
domainId
:
dataToPass
.
domainId
,
accountinfo
:
dataToPass
.
AccountName
,
domainname
:
dataToPass
.
domainName
}
$scope
.
currentdata
=
{
domainId
:
$scope
.
domainId
,
accountinfo
:
$scope
.
AccountInfo
.
accountName
,
domainname
:
$scope
.
domainName
}
$scope
.
cancel
=
function
()
{
var
showConfirmDialog
=
false
;
if
(
dataToPass
.
action
==
"Update"
){
console
.
log
(
dataToPass
.
deliveryManagers
+
' response'
)
console
.
log
(
$scope
.
employeeModel
)
$scope
.
previousData
=
{
domainId
:
dataToPass
.
domainId
,
accountinfo
:
dataToPass
.
AccountName
,
domainname
:
dataToPass
.
domainName
}
$scope
.
currentdata
=
{
domainId
:
$scope
.
domainId
,
accountinfo
:
$scope
.
AccountInfo
.
accountName
,
domainname
:
$scope
.
domainName
}
var
predata
=
JSON
.
stringify
(
$scope
.
previousData
);
var
curdata
=
JSON
.
stringify
(
$scope
.
currentdata
);
var
predata
=
JSON
.
stringify
(
$scope
.
previousData
);
var
curdata
=
JSON
.
stringify
(
$scope
.
currentdata
);
var
exsistingMangersList
=
dataToPass
.
deliveryManagers
;
var
currentMangersList
=
$scope
.
employeeModel
;
var
managerCheck
=
false
;
if
(
exsistingMangersList
.
length
===
currentMangersList
.
length
)
{
if
(
exsistingMangersList
.
length
===
currentMangersList
.
length
)
{
var
temp1
=
[];
var
temp2
=
[];
for
(
var
i
in
exsistingMangersList
){
for
(
var
i
in
exsistingMangersList
)
{
temp1
.
push
(
exsistingMangersList
[
i
].
employeeId
);
}
for
(
var
j
in
currentMangersList
){
for
(
var
j
in
currentMangersList
)
{
temp2
.
push
(
currentMangersList
[
j
].
employeeId
);
}
for
(
var
k
=
0
;
k
<
exsistingMangersList
.
length
;
k
++
)
{
if
(
temp2
.
indexOf
(
temp1
[
k
])
>
-
1
)
{
for
(
var
k
=
0
;
k
<
exsistingMangersList
.
length
;
k
++
)
{
if
(
temp2
.
indexOf
(
temp1
[
k
])
>
-
1
)
{
managerCheck
=
true
;
}
else
{
}
else
{
managerCheck
=
false
;
}
}
}
else
{
}
else
{
managerCheck
=
false
;
}
if
(
predata
===
curdata
&&
managerCheck
){
if
(
predata
===
curdata
&&
managerCheck
)
{
//$mdDialog.hide('Cancelled');
return
false
;
}
return
true
;
}
}
$scope
.
cancel
=
function
()
{
var
showConfirmDialog
=
false
;
if
(
dataToPass
.
action
==
"Update"
)
{
if
(
isDataUpdated
()
!=
true
)
{
$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
()
{
cancel
:
'cancel'
})).
then
(
function
()
{
$mdDialog
.
hide
(
'Cancelled'
);
})
}
}
if
(
dataToPass
.
action
==
"Add"
)
{
if
(
dataToPass
.
action
==
"Add"
)
{
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!"
);
if
(
totalFields
[
key
].
$modelValue
!==
''
&&
totalFields
[
key
].
$modelValue
!==
undefined
&&
totalFields
[
key
].
$modelValue
.
length
!==
0
)
{
showConfirmDialog
=
true
;
}
}
if
(
showConfirmDialog
)
{
if
(
showConfirmDialog
)
{
$mdDialog
.
show
(
$mdDialog
.
confirm
({
skipHide
:
true
,
textContent
:
'Are you sure you want to cancel this?'
,
ok
:
'ok'
,
cancel
:
'cancel'
})).
then
(
function
()
{
cancel
:
'cancel'
})).
then
(
function
()
{
$mdDialog
.
hide
(
'Cancelled'
);
})
}
else
{
else
{
$mdDialog
.
hide
(
'Cancelled'
);
}
}
...
...
@@ -477,11 +483,19 @@ myApp.controller("domainController",
"id"
:
$scope
.
id
,
"domainId"
:
dataToPass
.
domainId
};
$scope
.
addOrUpdateDomain
(
record
,
action
);
if
(
isDataUpdated
()
!=
true
)
{
$mdDialog
.
show
(
$mdDialog
.
alert
({
skipHide
:
true
,
title
:
'Attention'
,
textContent
:
'There is no data change to Update'
,
ok
:
'ok'
}))
}
else
{
$scope
.
addOrUpdateDomain
(
record
,
action
);
}
}
}
};
}
...
...
src/main/webapp/WEB-INF/controllers/assignAccountsController.js
View file @
22d15411
...
...
@@ -171,7 +171,6 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
url
:
appConfig
.
appUri
+
"/projectTeam/getEmployeesToTeam"
}).
then
(
function
mySuccess
(
response
)
{
$scope
.
managerDetails
=
response
.
data
;
console
.
log
(
"response"
,
response
)
},
function
myError
(
response
)
{
showAlert
(
"Something went wrong while fetching data!!!"
);
$scope
.
gridOptions
.
data
=
[];
...
...
@@ -181,86 +180,92 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
$scope
.
closeSelectBox
=
function
()
{
$mdSelect
.
hide
();
}
$scope
.
cancel
=
function
(){
var
showConfirmDialog
=
false
;
if
(
dataToPass
.
action
==
"Update"
){
console
.
log
(
dataToPass
);
$scope
.
previousData
=
{
AccountID
:
dataToPass
.
accountId
,
AccountName
:
dataToPass
.
accountName
,
IndustryType
:
dataToPass
.
industryType
,
ClientAddress
:
dataToPass
.
clientAddress
,
}
$scope
.
currentData
=
{
AccountID
:
$scope
.
accountId
,
AccountName
:
$scope
.
accountName
,
IndustryType
:
$scope
.
industryType
,
ClientAddress
:
$scope
.
clientAddress
isDataUpdated
=
function
()
{
if
(
dataToPass
.
action
==
"Update"
)
{
$scope
.
previousData
=
{
AccountID
:
dataToPass
.
accountId
,
AccountName
:
dataToPass
.
accountName
,
IndustryType
:
dataToPass
.
industryType
,
ClientAddress
:
dataToPass
.
clientAddress
,
}
$scope
.
currentData
=
{
AccountID
:
$scope
.
accountId
,
AccountName
:
$scope
.
accountName
,
IndustryType
:
$scope
.
industryType
,
ClientAddress
:
$scope
.
clientAddress
}
var
predata
=
JSON
.
stringify
(
$scope
.
previousData
);
var
curdata
=
JSON
.
stringify
(
$scope
.
currentData
);
var
predata
=
JSON
.
stringify
(
$scope
.
previousData
);
var
curdata
=
JSON
.
stringify
(
$scope
.
currentData
);
var
exsistingMangersList
=
dataToPass
.
deliveryManagers
;
var
currentMangersList
=
$scope
.
managersSelectedList
;
console
.
log
(
$scope
.
managersSelectedList
);
var
managerCheck
=
false
;
if
(
exsistingMangersList
.
length
===
currentMangersList
.
length
)
{
if
(
exsistingMangersList
.
length
===
currentMangersList
.
length
)
{
var
temp1
=
[];
var
temp2
=
[];
for
(
var
i
in
exsistingMangersList
)
{
for
(
var
i
in
exsistingMangersList
)
{
temp1
.
push
(
exsistingMangersList
[
i
].
employeeId
);
}
for
(
var
j
in
currentMangersList
)
{
for
(
var
j
in
currentMangersList
)
{
temp2
.
push
(
currentMangersList
[
j
].
employeeId
);
}
for
(
var
k
=
0
;
k
<
exsistingMangersList
.
length
;
k
++
)
{
if
(
temp2
.
indexOf
(
temp1
[
k
])
>
-
1
)
{
for
(
var
k
=
0
;
k
<
exsistingMangersList
.
length
;
k
++
)
{
if
(
temp2
.
indexOf
(
temp1
[
k
])
>
-
1
)
{
managerCheck
=
true
;
}
else
{
}
else
{
managerCheck
=
false
;
}
}
}
else
{
else
{
managerCheck
=
false
;
}
if
(
predata
===
curdata
&&
managerCheck
){
if
(
predata
===
curdata
&&
managerCheck
)
{
//$mdDialog.hide('Cancelled');
return
false
;
}
return
true
;
}
}
$scope
.
cancel
=
function
()
{
var
showConfirmDialog
=
false
;
if
(
dataToPass
.
action
==
"Update"
)
{
if
(
isDataUpdated
()
!=
true
)
{
$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
()
{
cancel
:
'cancel'
})).
then
(
function
()
{
$mdDialog
.
hide
(
'Cancelled'
);
})
}
}
if
(
dataToPass
.
action
==
"Add"
)
{
if
(
dataToPass
.
action
==
"Add"
)
{
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!"
);
// console.log("Model value of" + key + " ==>" + totalFields[key].$modelValue)
if
(
totalFields
[
key
].
$modelValue
!==
''
&&
totalFields
[
key
].
$modelValue
!==
undefined
&&
totalFields
[
key
].
$modelValue
.
length
!==
0
)
{
showConfirmDialog
=
true
;
}
}
if
(
showConfirmDialog
)
{
if
(
showConfirmDialog
)
{
$mdDialog
.
show
(
$mdDialog
.
confirm
({
skipHide
:
true
,
textContent
:
'Are you sure you want to cancel this?'
,
ok
:
'ok'
,
cancel
:
'cancel'
})).
then
(
function
()
{
cancel
:
'cancel'
})).
then
(
function
()
{
$mdDialog
.
hide
(
'Cancelled'
);
})
}
else
{
else
{
$mdDialog
.
hide
(
'Cancelled'
);
}
}
...
...
@@ -364,10 +369,19 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
else
{
$scope
.
alertMsg
=
""
;
var
record
=
{
"accountId"
:
$scope
.
accountId
,
"accountName"
:
$scope
.
accountName
,
"industryType"
:
$scope
.
industryType
,
"clientAddress"
:
$scope
.
clientAddress
,
"deliveryManagers"
:
$scope
.
accountManagers
()};
record
.
id
=
$scope
.
parentData
.
id
;
addOrUpdateAccount
(
record
,
$scope
.
templateTitle
,
"U"
);
$timeout
(
function
(){
updateGrid
(
$scope
.
templateTitle
,
record
)},
200
);
if
(
isDataUpdated
()
!=
true
)
{
$mdDialog
.
show
(
$mdDialog
.
alert
({
skipHide
:
true
,
title
:
'Attention'
,
textContent
:
'There is no data change to Update'
,
ok
:
'ok'
}))
}
else
{
addOrUpdateAccount
(
record
,
$scope
.
templateTitle
,
"U"
);
$timeout
(
function
()
{
updateGrid
(
$scope
.
templateTitle
,
record
)
},
200
);
}
}
}
};
...
...
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