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
f820de7e
Commit
f820de7e
authored
Aug 13, 2018
by
Manikanta SKPB Duppanapudi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modified code according to data
parent
4b513597
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
17 deletions
+29
-17
assignAccountsController.js
...in/webapp/WEB-INF/controllers/assignAccountsController.js
+29
-17
No files found.
src/main/webapp/WEB-INF/controllers/assignAccountsController.js
View file @
f820de7e
...
...
@@ -180,6 +180,15 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
$mdSelect
.
hide
();
}
var
getDeliveryManagersFromService
=
function
(){
var
managerIds
=
[];
dataToPass
.
deliveryManagers
.
forEach
(
function
(
manager
){
managerIds
.
push
(
manager
.
employeeId
);
})
return
managerIds
;
}
var
confirmationMsg
=
function
(){
$mdDialog
.
show
(
$mdDialog
.
confirm
({
...
...
@@ -204,14 +213,14 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
}
}
else
{
var
record
=
{
"accountName"
:
$scope
.
accountName
,
"industryType"
:
$scope
.
industryType
,
"clientAddress"
:
$scope
.
clientAddress
,
"deliveryManagers"
:
$scope
.
managersSelectedList
};
var
isFormUpated
=
myFactory
.
updateFormDataCheck
(
$scope
.
myForm
,
recor
d
);
if
(
isFormUpated
==
true
){
confirmationMsg
();
}
else
{
$mdDialog
.
hide
(
'Cancelled'
);
}
var
dataRequired
=
{
"accountName"
:
dataToPass
.
accountName
,
"industryType"
:
dataToPass
.
industryType
,
"clientAddress"
:
dataToPass
.
clientAddress
,
"deliveryManagers"
:
getDeliveryManagersFromService
()
};
var
isFormUpated
=
myFactory
.
updateFormDataCheck
(
$scope
.
myForm
,
dataRequire
d
);
if
(
isFormUpated
==
true
){
confirmationMsg
();
}
else
{
$mdDialog
.
hide
(
'Cancelled'
);
}
}
}
...
...
@@ -265,18 +274,20 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
ev
.
stopPropagation
();
});
$scope
.
accountManagers
=
function
(){
var
employeeIdsArray
=
[];
for
(
i
=
0
;
i
<
$scope
.
managersSelectedList
.
length
;
i
++
){
employeeIdsArray
[
i
]
=
$scope
.
managersSelectedList
[
i
].
employeeId
;
}
return
employeeIdsArray
;
}
$scope
.
validateFields
=
function
(
action
){
var
managersSelectedList
=
$scope
.
managersSelectedList
;
var
accountName
=
$scope
.
accountName
;
var
industryType
=
$scope
.
industryType
;
var
clientAddress
=
$scope
.
clientAddress
;
$scope
.
accountManagers
=
function
(){
var
employeeIdsArray
=
[];
for
(
i
=
0
;
i
<
$scope
.
managersSelectedList
.
length
;
i
++
){
employeeIdsArray
[
i
]
=
$scope
.
managersSelectedList
[
i
].
employeeId
;
}
return
employeeIdsArray
;
}
if
(
action
==
"Add"
){
if
(
accountName
==
undefined
||
accountName
==
""
){
$scope
.
alertMsg
=
"Please enter the account Name"
;
...
...
@@ -302,6 +313,7 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
$timeout
(
function
(){
updateGrid
(
$scope
.
templateTitle
,
record
)},
200
);
}
}
else
if
(
action
==
"Update"
){
console
.
log
(
$scope
.
myForm
);
if
(
accountName
==
undefined
||
accountName
==
""
){
$scope
.
alertMsg
=
"Please enter the account Name"
;
document
.
getElementById
(
'accountName'
).
focus
();
...
...
@@ -321,8 +333,8 @@ 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
()};
var
dataRequired
=
{
"accountName"
:
dataToPass
.
accountName
,
"industryType"
:
dataToPass
.
industryType
,
"clientAddress"
:
dataToPass
.
clientAddress
,
"deliveryManagers"
:
dataToPass
.
deliveryManagers
};
var
dataRequired
=
{
"accountName"
:
dataToPass
.
accountName
,
"industryType"
:
dataToPass
.
industryType
,
"clientAddress"
:
dataToPass
.
clientAddress
,
"deliveryManagers"
:
getDeliveryManagersFromService
()
};
console
.
log
(
$scope
.
myForm
);
var
isFormUpated
=
myFactory
.
updateFormDataCheck
(
$scope
.
myForm
,
dataRequired
);
if
(
isFormUpated
==
true
){
addOrUpdateAccount
(
record
,
$scope
.
templateTitle
,
"U"
);
...
...
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