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
c68fbe25
Commit
c68fbe25
authored
Jul 19, 2018
by
dgoud-nisum-com
Committed by
tdutta-nisum-com
Jul 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accounts module_MT-77_MT-81 (#29)
* adding and fetcg * adding and fetcg
parent
6acbfdff
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
470 additions
and
35 deletions
+470
-35
AccountController.java
...n/java/com/nisum/mytime/controller/AccountController.java
+31
-13
AccountService.java
src/main/java/com/nisum/mytime/service/AccountService.java
+2
-0
AccountServiceImpl.java
...ain/java/com/nisum/mytime/service/AccountServiceImpl.java
+10
-9
MyTimeUtils.java
src/main/java/com/nisum/mytime/utils/MyTimeUtils.java
+2
-2
LoginController.js
src/main/webapp/WEB-INF/controllers/LoginController.js
+1
-0
assignAccountsController.js
...in/webapp/WEB-INF/controllers/assignAccountsController.js
+286
-0
default-styles.css
src/main/webapp/WEB-INF/css/default-styles.css
+9
-11
accounts.html
src/main/webapp/WEB-INF/templates/accounts.html
+39
-0
index.html
src/main/webapp/WEB-INF/templates/index.html
+1
-0
newAccount.html
src/main/webapp/WEB-INF/templates/newAccount.html
+89
-0
No files found.
src/main/java/com/nisum/mytime/controller/AccountController.java
View file @
c68fbe25
...
...
@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
...
...
@@ -27,29 +28,36 @@ public class AccountController {
@Autowired
private
AccountServiceImpl
accountServiceImpl
;
@RequestMapping
(
value
=
"/addAccount"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
AccountInfo
>
addAccount
(
@RequestBody
AccountInfo
accountInfo
)
throws
MyTimeException
{
@RequestMapping
(
value
=
"/accounts"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
TEXT_PLAIN_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
String
>
addAccount
(
@RequestBody
AccountInfo
accountInfo
)
throws
MyTimeException
{
String
response
=
""
;
if
(
StringUtils
.
isEmpty
(
accountInfo
.
getAccountId
()))
{
accountInfo
.
setAccountId
(
ge
t
AccountId
());
accountInfo
.
setAccountId
(
ge
nerate
AccountId
());
}
accountInfo
.
setStatus
(
MyTimeUtils
.
ACTIVE
);
AccountInfo
currentAccount
=
accountServiceImpl
.
addAccount
(
accountInfo
);
return
new
ResponseEntity
<>(
currentAccount
,
HttpStatus
.
OK
);
if
(
accountInfo
.
getId
()==
null
){
response
=
"saved Succesfully"
;
}
else
{
response
=
"updated Succesfully"
;
}
accountServiceImpl
.
addAccount
(
accountInfo
);
return
new
ResponseEntity
<>(
response
,
HttpStatus
.
OK
);
}
// ge
t
ting the account id.
// account
i
d format is "Acc001"
private
String
ge
t
AccountId
()
throws
MyTimeException
{
return
(
MyTimeUtils
.
ACC
_NAME
+
MyTimeUtils
.
ZERO_
)
+
(
accountServiceImpl
.
getAccounts
().
size
()
+
MyTimeUtils
.
ONE
);
// ge
nera
ting the account id.
// account
I
d format is "Acc001"
private
String
ge
nerate
AccountId
()
throws
MyTimeException
{
return
(
MyTimeUtils
.
ACC
+
MyTimeUtils
.
ZERO_
)
+
(
accountServiceImpl
.
getAccounts
().
size
()
+
MyTimeUtils
.
ONE
);
}
@RequestMapping
(
value
=
"/
getA
ccounts"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/
a
ccounts"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Map
<
Object
,
Object
>>>
getAccounts
()
throws
MyTimeException
{
List
<
Map
<
Object
,
Object
>>
acounts
=
accountServiceImpl
.
getAccountsList
();
return
new
ResponseEntity
<>(
acounts
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/
getA
ccountNames"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/
a
ccountNames"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
String
>>
getAccountNames
()
throws
MyTimeException
{
List
<
AccountInfo
>
acounts
=
accountServiceImpl
.
getAccounts
();
List
<
String
>
accountNames
=
new
ArrayList
<>();
...
...
@@ -59,11 +67,21 @@ public class AccountController {
return
new
ResponseEntity
<>(
accountNames
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/
deleteAccount
"
,
method
=
RequestMethod
.
DELETE
,
produces
=
MediaType
.
TEXT_PLAIN_VALUE
)
@RequestMapping
(
value
=
"/
accounts
"
,
method
=
RequestMethod
.
DELETE
,
produces
=
MediaType
.
TEXT_PLAIN_VALUE
)
public
ResponseEntity
<
String
>
deleteAccount
(
@RequestParam
(
value
=
"accountId"
)
String
accountId
)
throws
MyTimeException
{
accountServiceImpl
.
deleteAccount
(
accountId
);
return
new
ResponseEntity
<>(
"Success"
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
"Deleted Successfully"
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/accounts/{accountName}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
TEXT_PLAIN_VALUE
)
public
ResponseEntity
<
String
>
validateAccounts
(
@PathVariable
(
"accountName"
)
String
accountName
)
throws
MyTimeException
{
String
response
=
""
;
List
<
AccountInfo
>
acounts
=
accountServiceImpl
.
validateAccounts
(
accountName
);
if
(
acounts
.
size
()>
0
){
response
=
"Account already exist"
;
}
return
new
ResponseEntity
<>(
response
,
HttpStatus
.
OK
);
}
}
\ No newline at end of file
src/main/java/com/nisum/mytime/service/AccountService.java
View file @
c68fbe25
...
...
@@ -13,5 +13,7 @@ public interface AccountService {
List
<
AccountInfo
>
getAccounts
()
throws
MyTimeException
;
List
<
Map
<
Object
,
Object
>>
getAccountsList
()
throws
MyTimeException
;
List
<
AccountInfo
>
validateAccounts
(
String
accountName
)
throws
MyTimeException
;
}
src/main/java/com/nisum/mytime/service/AccountServiceImpl.java
View file @
c68fbe25
...
...
@@ -42,7 +42,7 @@ public class AccountServiceImpl implements AccountService {
public
List
<
Map
<
Object
,
Object
>>
getAccountsList
()
throws
MyTimeException
{
List
<
Map
<
Object
,
Object
>>
updatedAccountList
=
new
ArrayList
<>();
List
<
Map
<
String
,
String
>>
updatedEmployeeList
=
null
;
for
(
AccountInfo
account
:
getAccountInfo
())
{
for
(
AccountInfo
account
:
accountRepo
.
findAll
())
{
updatedEmployeeList
=
new
ArrayList
<>();
for
(
EmployeeRoles
employeesRole
:
getEmployeeDetails
(
account
))
{
updatedEmployeeList
.
add
(
getEmployeeDetails
(
employeesRole
));
...
...
@@ -52,6 +52,14 @@ public class AccountServiceImpl implements AccountService {
return
updatedAccountList
;
}
@Override
public
List
<
AccountInfo
>
validateAccounts
(
String
accountName
)
throws
MyTimeException
{
List
<
AccountInfo
>
accountList
=
mongoTemplate
.
find
(
new
Query
(
Criteria
.
where
(
MyTimeUtils
.
ACCOUNT_NAME
).
is
(
accountName
.
trim
())),
AccountInfo
.
class
);
return
accountList
;
}
// fetching the employee details using employeeId.
private
List
<
EmployeeRoles
>
getEmployeeDetails
(
AccountInfo
account
)
{
List
<
EmployeeRoles
>
employeeRoles
=
mongoTemplate
.
find
(
...
...
@@ -60,13 +68,6 @@ public class AccountServiceImpl implements AccountService {
return
employeeRoles
;
}
// fetching the active account details.
private
List
<
AccountInfo
>
getAccountInfo
()
{
List
<
AccountInfo
>
accountList
=
mongoTemplate
.
find
(
new
Query
(
Criteria
.
where
(
MyTimeUtils
.
STATUS
).
is
(
MyTimeUtils
.
ACTIVE
)),
AccountInfo
.
class
);
return
accountList
;
}
private
HashMap
<
String
,
String
>
getEmployeeDetails
(
EmployeeRoles
employeesRole
)
{
HashMap
<
String
,
String
>
employeeDetails
=
new
HashMap
<>();
employeeDetails
.
put
(
MyTimeUtils
.
EMPLOYEE_ID
,
employeesRole
.
getEmployeeId
());
...
...
@@ -76,7 +77,7 @@ public class AccountServiceImpl implements AccountService {
private
Map
<
Object
,
Object
>
getAccuntDetails
(
AccountInfo
account
,
List
<
Map
<
String
,
String
>>
updatedEmployeeList
)
{
Map
<
Object
,
Object
>
accountDetails
=
new
HashMap
<>();
accountDetails
.
put
(
MyTimeUtils
.
ACC_ID
,
account
.
getId
());
accountDetails
.
put
(
MyTimeUtils
.
ID_
,
account
.
getId
());
accountDetails
.
put
(
MyTimeUtils
.
ACCOUNT_ID
,
account
.
getAccountId
());
accountDetails
.
put
(
MyTimeUtils
.
ACCOUNT_NAME
,
account
.
getAccountName
());
accountDetails
.
put
(
MyTimeUtils
.
STATUS
,
account
.
getStatus
());
...
...
src/main/java/com/nisum/mytime/utils/MyTimeUtils.java
View file @
c68fbe25
...
...
@@ -40,10 +40,10 @@ public class MyTimeUtils {
public
final
static
String
ACCOUNT_ID
=
"accountId"
;
public
static
final
int
ONE
=
1
;
public
final
static
String
ACC
_NAME
=
"Acc"
;
public
final
static
String
ACC
=
"Acc"
;
public
static
final
String
ZERO_
=
"00"
;
// Manage account details
public
static
final
String
ACC_ID
=
"id"
;
public
static
final
String
ID_
=
"id"
;
public
static
final
String
ACCOUNT_NAME
=
"accountName"
;
public
static
final
String
STATUS
=
"status"
;
public
static
final
String
CLIENT_ADDRESS
=
"clientAddress"
;
...
...
src/main/webapp/WEB-INF/controllers/LoginController.js
View file @
c68fbe25
...
...
@@ -290,6 +290,7 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
menuItems
.
push
({
"menu"
:
"My Org"
,
"icon"
:
"fa fa-address-card-o fa-2x"
,
"path"
:
"templates/myOrg.html"
});
menuItems
.
push
({
"menu"
:
"My Profile"
,
"icon"
:
"fa fa-address-book-o fa-2x"
,
"path"
:
"templates/profile.html"
});
}
else
if
(
role
==
"Delivery Manager"
||
role
==
"Director"
){
menuItems
.
push
({
"menu"
:
"Manage Accounts"
,
"icon"
:
"fa fa-user-plus fa-2x"
,
"path"
:
"templates/accounts.html"
});
menuItems
.
push
({
"menu"
:
"Manage Employees"
,
"icon"
:
"fa fa-user-plus fa-2x"
,
"path"
:
"templates/roles.html"
});
menuItems
.
push
({
"menu"
:
"Manage Team"
,
"icon"
:
"fa fa-sitemap fa-2x"
,
"path"
:
"templates/projectDetails.html"
});
menuItems
.
push
({
"menu"
:
"Manage Projects"
,
"icon"
:
"fa fa-tasks fa-2x"
,
"path"
:
"templates/projects.html"
});
...
...
src/main/webapp/WEB-INF/controllers/assignAccountsController.js
0 → 100644
View file @
c68fbe25
myApp
.
controller
(
"assignAccountsController"
,
function
(
$scope
,
myFactory
,
$mdDialog
,
$http
,
appConfig
,
$timeout
,
$element
,
$window
){
$scope
.
records
=
[];
$scope
.
parentData
=
{
"accountId"
:
""
,
"accountName"
:
""
,
"industryType"
:
""
,
"status"
:
""
,
"deliveryManagers"
:[],
"action"
:
""
};
var
getCellTemplate
=
'<p class="col-lg-12"><i class="fa fa-pencil-square-o fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" data-placement="center" title="View" onmouseenter="$(this).tooltip(
\'
show
\'
)" ng-click="grid.appScope.getRowData(row,
\'
Update
\'
)"></i>'
+
' <i class="fa fa-minus-circle fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" data-placement="left" title="Delete" onmouseenter="$(this).tooltip(
\'
show
\'
)" ng-click="grid.appScope.getRowData(row,
\'
Delete
\'
)"></i></p>'
;
$scope
.
gridOptions
=
{
paginationPageSizes
:
[
10
,
20
,
30
,
40
,
50
,
100
],
paginationPageSize
:
50
,
pageNumber
:
1
,
pageSize
:
10
,
enableFiltering
:
true
,
columnDefs
:
[
{
field
:
'accountId'
,
displayName
:
'Account ID'
,
enableColumnMenu
:
true
,
enableSorting
:
true
,
enableFiltering
:
true
,
width
:
120
,
cellClass
:
'grid-align'
},
{
field
:
'accountName'
,
displayName
:
'Account Name'
,
enableColumnMenu
:
false
,
enableSorting
:
false
,
enableFiltering
:
true
,
cellClass
:
'grid-align'
},
{
field
:
'industryType'
,
displayName
:
'Industry Type'
,
enableColumnMenu
:
false
,
enableSorting
:
true
,
enableFiltering
:
true
,
cellClass
:
'grid-align'
},
{
field
:
'status'
,
displayName
:
'Status'
,
enableColumnMenu
:
false
,
enableSorting
:
true
,
enableFiltering
:
true
,
cellClass
:
'grid-align'
},
{
field
:
'deliveryManagers'
,
displayName
:
'Account Managers'
,
cellTemplate
:
'<div ng-repeat= "item in row.entity[col.field]">{{item.employeeName}}<span ng-hide="$last">,</span></div>'
,
enableColumnMenu
:
false
,
enableSorting
:
true
,
enableFiltering
:
false
,
cellClass
:
'grid-align'
},
{
name
:
'Actions'
,
displayName
:
'Actions'
,
cellTemplate
:
getCellTemplate
,
enableColumnMenu
:
false
,
enableSorting
:
false
,
enableFiltering
:
false
,
width
:
130
}
]
};
$scope
.
gridOptions
.
data
=
$scope
.
records
;
$scope
.
getRowData
=
function
(
row
,
action
){
$scope
.
parentData
.
accountId
=
row
.
entity
.
accountId
;
$scope
.
parentData
.
accountName
=
row
.
entity
.
accountName
;
$scope
.
parentData
.
industryType
=
row
.
entity
.
industryType
;
$scope
.
parentData
.
deliveryManagers
=
row
.
entity
.
deliveryManagers
;
$scope
.
parentData
.
status
=
row
.
entity
.
status
;
if
(
action
==
"Update"
)
$scope
.
updateAccount
(
action
,
$scope
.
parentData
);
else
if
(
action
==
"Delete"
)
$scope
.
deleteAccount
(
row
,
action
);
}
$scope
.
refreshPage
=
function
(){
$scope
.
getAccountDetails
();
}
$scope
.
getAccountDetails
=
function
(){
$http
({
method
:
"GET"
,
url
:
appConfig
.
appUri
+
"account/accounts"
}).
then
(
function
mySuccess
(
response
)
{
console
.
log
(
response
.
data
);
$scope
.
gridOptions
.
data
=
response
.
data
;
},
function
myError
(
response
)
{
showAlert
(
"Something went wrong while fetching data!!!"
);
$scope
.
gridOptions
.
data
=
[];
});
};
$scope
.
addAccount
=
function
(
action
,
userData
){
$
(
'#home'
).
addClass
(
'md-scroll-mask'
);
userData
.
action
=
action
;
$mdDialog
.
show
({
clickOutsideToClose
:
true
,
scope
:
$scope
,
preserveScope
:
true
,
templateUrl
:
'templates/newAccount.html'
,
controller
:
addController
,
locals
:{
dataToPass
:
userData
,
gridOptionsData
:
$scope
.
gridOptions
.
data
},
}).
then
(
function
(
result
)
{
if
(
result
==
"Add"
)
showAlert
(
'Account assigned successfully'
);
else
if
(
result
==
"Update"
)
showAlert
(
'Account updated successfully'
);
else
if
(
result
==
"Cancelled"
)
console
.
log
(
result
);
else
showAlert
(
'Account assigning/updation failed!!!'
);
});
}
// $scope.updateAccount = function(action, userData){
// $('#home').addClass('md-scroll-mask');
// userData.action = action;
// $mdDialog.show ({
// clickOutsideToClose: true,
// scope: $scope,
// preserveScope: true,
// templateUrl: 'templates/newAccount.html',
// controller: addController,
// locals:{dataToPass: userData,gridOptionsData: $scope.gridOptions.data, employees: $scope.employees},
// }).then(function(result) {
// if(result == "Add") showAlert('Account assigned successfully');
// else if(result == "Update") showAlert('Account updated successfully');
// else if(result == "Cancelled") console.log(result);
// else showAlert('Account assigning/updation failed!!!');
// });
// }
function
showAlert
(
message
)
{
$mdDialog
.
show
(
$mdDialog
.
alert
().
parent
(
angular
.
element
(
document
.
querySelector
(
'#popupContainer'
)))
.
clickOutsideToClose
(
true
).
textContent
(
message
).
ariaLabel
(
'Alert Dialog'
).
ok
(
'Ok'
));
}
$scope
.
deleteAccount
=
function
(
row
,
action
){
$
(
'#home'
).
addClass
(
'md-scroll-mask'
);
var
confirm
=
$mdDialog
.
confirm
()
.
clickOutsideToClose
(
true
)
.
textContent
(
'Are you sure you want to delete this account?'
)
.
ok
(
'Ok'
)
.
cancel
(
'Cancel'
);
$mdDialog
.
show
(
confirm
).
then
(
function
()
{
deleteAccountRole
(
row
.
entity
.
accountId
);
$timeout
(
function
(){
updateGridAfterDelete
()},
500
);
},
function
()
{
console
.
log
(
"Cancelled dialog"
);
});
};
function
deleteAccountRole
(
accountId
){
var
req
=
{
method
:
'DELETE'
,
url
:
appConfig
.
appUri
+
"account/accounts?accountId="
+
accountId
}
$http
(
req
).
then
(
function
mySuccess
(
response
)
{
$scope
.
result
=
"Success"
;
},
function
myError
(
response
){
$scope
.
result
=
"Error"
;
});
}
function
updateGridAfterDelete
(){
if
(
$scope
.
result
==
"Success"
){
$scope
.
refreshPage
();
showAlert
(
'Account deleted successfully'
);
}
else
if
(
$scope
.
result
==
"Error"
){
showAlert
(
'Something went wrong while deleting the account.'
)
}
}
function
addController
(
$scope
,
$mdDialog
,
dataToPass
,
gridOptionsData
,
$mdSelect
)
{
$scope
.
accountName
;
$scope
.
industryType
;
$scope
.
clientAddress
;
$scope
.
searchTerm
;
$scope
.
templateTitle
=
dataToPass
.
action
;
$scope
.
accountValidationMessage
=
''
;
$scope
.
addButtonvisible
=
false
;
$scope
.
managerDetails
=
[];
$scope
.
managersSelectedList
=
[];
$scope
.
employeeInTeam
=
[];
$scope
.
industryTypesList
=
[
'Retail'
,
'Finance'
,
'HealthCare'
,
'Government'
,
'Insurance'
];
$window
.
addEventListener
(
'click'
,
function
(
e
){
if
(
e
.
target
.
type
!==
'search'
){
$mdSelect
.
hide
();
}
})
$scope
.
getDeliveryManagers
=
function
(){
$http
({
method
:
"GET"
,
url
:
appConfig
.
appUri
+
"/projectTeam/getEmployeesToTeam"
}).
then
(
function
mySuccess
(
response
)
{
$scope
.
managerDetails
=
response
.
data
;
},
function
myError
(
response
)
{
showAlert
(
"Something went wrong while fetching data!!!"
);
$scope
.
gridOptions
.
data
=
[];
});
};
$scope
.
duplicateAccNameValidation
=
function
(){
$http
({
method
:
"GET"
,
url
:
appConfig
.
appUri
+
"/account/accounts/"
+
$scope
.
accountName
}).
then
(
function
mySuccess
(
response
)
{
if
(
response
.
data
==
'Account already exist'
){
$scope
.
alertMsg
=
response
.
data
;
$scope
.
addButtonvisible
=
true
;
$
(
'#addButton'
).
addClass
(
'addButtonDisable'
);
}
else
{
//$scope.alertMsg=response.data;
$scope
.
addButtonvisible
=
false
;
$
(
'#addButton'
).
removeClass
(
'addButtonDisable'
);
}
},
function
myError
(
response
)
{
showAlert
(
"Something went wrong while fetching data!!!"
);
});
}
$scope
.
cancel
=
function
(){
$mdDialog
.
hide
(
"Cancelled"
);
}
$scope
.
updateSearch
=
function
(
e
)
{
e
.
stopPropagation
();
}
$scope
.
searchFilter
=
function
(
obj
)
{
var
re
=
new
RegExp
(
$scope
.
searchTerm
,
'i'
);
return
!
$scope
.
searchTerm
||
re
.
test
(
obj
.
employeeName
);
};
$scope
.
removeSelectedLead
=
function
(
item
){
var
index
=
$scope
.
managersSelectedList
.
indexOf
(
item
);
$scope
.
employeeInTeam
.
splice
(
index
,
1
);
$scope
.
managersSelectedList
.
splice
(
index
,
1
);
}
$scope
.
getSelectedLead
=
function
(){
$scope
.
managersSelectedList
.
forEach
(
function
(
manager
){
if
(
!
$scope
.
employeeInTeam
.
includes
(
manager
.
employeeId
))
$scope
.
employeeInTeam
.
push
(
manager
.
employeeId
)
})
console
.
log
(
$scope
.
employeeInTeam
);
}
$scope
.
getIndustryTypeSelected
=
function
(){
if
(
$scope
.
industryType
!==
undefined
)
{
$scope
.
industryType
=
$scope
.
industryType
;
return
$scope
.
industryType
;
}
else
{
return
"Please select a Industry Type"
;
}
};
$scope
.
clearSearchTerm
=
function
()
{
$scope
.
searchTerm
=
''
;
};
$element
.
find
(
'input'
).
on
(
'keydown'
,
function
(
ev
)
{
ev
.
stopPropagation
();
});
$scope
.
validateFields
=
function
(){
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
(
managersSelectedList
==
undefined
){
$scope
.
alertMsg
=
"Please select a accountManager"
;
document
.
getElementById
(
'selectManager'
).
focus
();
}
else
if
(
accountName
==
undefined
){
$scope
.
alertMsg
=
"Please enter the account Name"
;
document
.
getElementById
(
'accountName'
).
focus
();
}
else
if
(
industryType
==
undefined
){
$scope
.
alertMsg
=
"Please enter the industry type"
;
document
.
getElementById
(
'industryType'
).
focus
();
}
else
if
(
clientAddress
==
undefined
){
$scope
.
alertMsg
=
"Please enter the client address"
;
document
.
getElementById
(
'clientAddress'
).
focus
();
}
else
{
$scope
.
alertMsg
=
""
;
var
record
=
{
"accountName"
:
$scope
.
accountName
,
"industryType"
:
$scope
.
industryType
,
"clientAddress"
:
$scope
.
clientAddress
,
"deliveryManagers"
:
$scope
.
accountManagers
()};
console
.
log
(
record
);
addingAccount
(
record
,
$scope
.
templateTitle
);
$timeout
(
function
(){
updateGrid
(
$scope
.
templateTitle
,
record
)},
500
);
}
};
addingAccount
=
function
(
record
,
action
){
var
urlRequest
=
""
;
if
(
action
==
"Add"
){
urlRequest
=
appConfig
.
appUri
+
"/account/accounts"
;
//}else if(action == "Update"){
//urlRequest = appConfig.appUri+ "project/updateProject";
}
var
req
=
{
method
:
'POST'
,
url
:
urlRequest
,
headers
:
{
"Content-type"
:
"application/json"
},
data
:
record
}
$http
(
req
).
then
(
function
mySuccess
(
response
)
{
$scope
.
result
=
"Success"
;
},
function
myError
(
response
){
$scope
.
result
=
"Error"
;
});
}
function
updateGrid
(
action
,
record
){
if
(
$scope
.
alertMsg
==
""
){
if
(
$scope
.
result
==
"Success"
){
if
(
action
==
"Add"
||
action
==
"Delete"
){
$scope
.
refreshPage
();
}
//else if(action == "Update"){
// var existingRecord = getRowEntity($scope.projectId);
// var index = gridOptionsData.indexOf(existingRecord);
// gridOptionsData[index] = record;
// }
$mdDialog
.
hide
(
action
);
}
else
{
$mdDialog
.
hide
(
"Error"
);
}
}
}
}
});
\ No newline at end of file
src/main/webapp/WEB-INF/css/default-styles.css
View file @
c68fbe25
...
...
@@ -114,14 +114,11 @@ md-dialog{
max-height
:
206px
;
}
.selectHeader
{
Please
note
:
All
these
selectors
are
only
applied
to
children
of
elements
with
the
'selectdemoSelectHeader'
class
}
.selectHeader
.searchBoxHeader
{
border
:
none
;
outline
:
none
;
.selectHeader
.searchBoxHeader
{
border
:
none
;
outline
:
none
;
}
.selectHeader
.selectHeaderChild
{
.selectHeader
.selectHeaderChild
{
box-shadow
:
0
1px
0
0
rgba
(
0
,
0
,
0
,
0.1
),
0
0
0
0
rgba
(
0
,
0
,
0
,
0.14
),
0
0
0
0
rgba
(
0
,
0
,
0
,
0.12
);
padding-left
:
10.667px
;
height
:
48px
;
...
...
@@ -147,7 +144,6 @@ md-dialog{
z-index
:
100
!important
;
}
.md-dialog-custom-height
{
max-height
:
95%
!important
;
}
...
...
@@ -156,8 +152,6 @@ md-dialog{
height
:
1100px
!important
;
}
.selectdemoSelectHeader
.demo-header-searchbox
{
border
:
none
;
outline
:
none
;
...
...
@@ -210,4 +204,8 @@ md-dialog{
.header-spacing
{
padding-left
:
0px
!important
;
}
/* Styles added*/
/* Styles added for accounts module*/
.addButtonDisable
{
background-color
:
darkgrey
!important
;
}
src/main/webapp/WEB-INF/templates/accounts.html
0 → 100644
View file @
c68fbe25
<div
class=
"md-padding"
style=
"width: 100%; padding: 3px 0px 0px 0px;"
id=
"Container"
ng-controller=
"assignAccountsController"
ng-init=
"getAccountDetails()"
>
<div
class=
"container-fluid mainDivHeaderClass"
>
<div
class=
"row"
>
<div
class=
"col-lg-12"
>
<p
align=
"center"
class=
"col-xs-11"
style=
"vertical-align: middle; font-weight: bold; font-size: 30px;"
>
Manage Accounts
</p>
<p
align=
"right"
class=
"col-xs-1"
style=
"vertical-align: middle; font-weight: bold; font-size: 1.5em; margin-top: 8px; cursor: pointer;"
>
<i
class=
"fa fa-refresh"
aria-hidden=
"true"
ng-click=
"refreshPage()"
></i>
</p>
</div>
<div
class=
"clearfix"
></div>
</div>
</div>
<div
class=
"row col-lg-12"
>
<div
class=
"col-lg-8"
>
<md-button
class=
"md-raised md-primary"
style=
"width:142px;background: cadetblue; margin: 2% 0% 0% 124%;"
ng-click=
"addAccount('Add', parentData)"
>
<i
class=
"fa fa-plus-circle fa-2x"
style=
"margin-top: 5px; font-size: 1.5em; float: left"
></i>
Add
Account
</md-button>
</div>
</div>
<div
class=
"row col-lg-12"
style=
"height: 15px;"
></div>
<div
class=
"row col-lg-12"
style=
"margin-left: 0px;"
>
<div
id=
"gridTest"
ui-grid=
"gridOptions"
ui-grid-pagination
class=
"myGrid"
style=
"width:99%;height:370px;margin-left:0px;"
>
<div
class=
"watermark"
ng-show=
"!gridOptions.data.length"
>
No
data available
</div>
</div>
</div>
<div
class=
"row col-lg-12"
style=
"height: 15px;"
></div>
</div>
\ No newline at end of file
src/main/webapp/WEB-INF/templates/index.html
View file @
c68fbe25
...
...
@@ -52,6 +52,7 @@
<script
src=
"js/app.js"
></script>
<script
src=
"js/date-text-filter.js"
></script>
<script
src=
"js/ui-grid-edit-datepicker.js"
></script>
<script
src=
"controllers/assignAccountsController.js"
></script>
<script
src=
"controllers/LoginController.js"
></script>
<script
src=
"controllers/HeaderController.js"
></script>
<script
src=
"controllers/LeftMenuController.js"
></script>
...
...
src/main/webapp/WEB-INF/templates/newAccount.html
0 → 100644
View file @
c68fbe25
<md-dialog
aria-label=
"Account Template"
style=
"width:520px;height:500px;"
>
<form
ng-cloak
name=
"myForm"
ng-init=
"getDeliveryManagers()"
>
<md-toolbar>
<div
class=
"md-toolbar-tools"
style=
"background: cadetblue;"
>
<h2>
{{templateTitle}} Account
</h2>
<span
flex
></span>
<md-button
class=
"md-icon-button"
ng-click=
"cancel()"
>
<i
class=
"fa fa-times fa-2x"
style=
"margin-top: 5px; font-size: 1.5em; float: left"
></i>
</md-button>
</div>
</md-toolbar>
<md-dialog-content>
<div
class=
"md-dialog-content"
>
<div
class=
"form-group"
>
<div
class=
"row"
>
<table
width=
"450px"
>
<tr>
<td
colspan=
"4"
>
<b
>
Account ID
</b></td>
<td
colspan=
"8"
><input
type=
"text"
class=
"form-control"
id=
"accountId"
name=
"accountId"
ng-model=
"accountId"
placeholder=
"Account Id Auto Generates"
ng-blur=
""
ng-disabled=
"true"
/>
</td>
<tr>
<td
colspan=
"4"
>
<b
>
Account Name
</b></td>
<td
colspan=
"8"
>
<!-- <md-input-container class="md-block"> -->
<input
type=
"text"
class=
"form-control"
id=
"accountName"
name=
"accountName"
placeholder=
"Account Name"
ng-blur=
"duplicateAccNameValidation()"
ng-model=
"accountName"
/>
<!-- </md-input-container> -->
{{accountValidationMessage}}
</td>
</tr>
<tr>
<td
colspan=
"4"
>
<b
>
Industry Type
</b></td>
<td
colspan=
"8"
>
<md-select
ng-model=
"industryType"
md-selected-text=
"getIndustryTypeSelected()"
id=
"industryType"
>
<md-optgroup
label=
"Industry Type"
>
<md-option
ng-value=
"industryType"
ng-repeat=
"industryType in industryTypesList"
>
{{industryType}}
</md-option>
</md-optgroup>
</md-select>
</td>
</tr>
<tr>
<td
colspan=
"4"
>
<b
>
Client Address
</b></td>
<td
colspan=
"8"
>
<!-- <md-input-container class="md-block"> -->
<textarea
ng-model=
"clientAddress"
id=
"clientAddress"
style=
"width:100%"
md-select-on-focus
></textarea>
<!-- </md-input-container> -->
</td>
</tr>
<tr>
<td
colspan=
"4"
>
<b
>
Account Managers
</b></td>
<td
id=
"lead"
colspan=
"8"
>
<div
class=
"leads-data"
ng-show=
"managersSelectedList.length > 0"
>
<div
ng-repeat=
"item in managersSelectedList"
>
<p>
{{item.employeeName}}
<span
ng-click=
"removeSelectedLead(item)"
class=
"glyphicon glyphicon-remove"
></span>
</p>
</div>
</div>
<md-input-container
style=
"display: block; float: left; width: 100%;"
>
<md-select
class=
"lead-search"
ng-model=
"managersSelectedList"
id=
"selectManager"
data-md-container-class=
"selectdemoSelectHeader"
multiple=
""
md-selected-text=
"getSelectedLead()"
>
<md-select-header
class=
"demo-select-header"
>
<input
ng-model=
"searchTerm"
type=
"search"
id=
"search"
style =
"width:100%"
placeholder=
"Search for a manager"
ng-keydown=
"updateSearch($event)"
ng-model-options=
"{debounce: {'default': 500, 'blur': 0}}"
class=
"demo-header-searchbox md-text"
/>
</md-select-header>
<md-optgroup
label=
"managers"
>
<md-option
ng-value=
"manager"
ng-repeat=
"manager in managerDetails | filter:searchFilter"
>
{{manager.employeeName}}
</md-option>
</md-optgroup>
</md-select>
</md-input-container>
</td>
</tr>
</table>
</div>
<div
role=
"alert"
>
<span
class=
"error"
style=
"color: red;"
>
{{alertMsg}}
</span>
</div>
</div>
</div>
</md-dialog-content>
<md-dialog-actions
layout=
"row"
>
<md-button
class=
"md-raised md-accent"
id =
"addButton"
data-ng-click=
"validateFields(templateTitle)"
ng-disabled=
"addButtonvisible"
style=
"width:120px;background: cadetblue;color:white;"
>
{{templateTitle}}
</md-button>
<md-button
class=
"md-raised"
ng-click=
"cancel()"
style=
"width:120px;background: cadetblue;color:white;"
>
Cancel
</md-button>
</md-dialog-actions>
</form>
</md-dialog>
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