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
aa1fb2a5
Commit
aa1fb2a5
authored
Jul 10, 2018
by
BH04921
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MT-72_On_billability_status_change and capture the new status start date
parent
385ab5c4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
103 additions
and
35 deletions
+103
-35
ProjectTeamController.java
...va/com/nisum/mytime/controller/ProjectTeamController.java
+11
-0
ProjectTeamMate.java
src/main/java/com/nisum/mytime/model/ProjectTeamMate.java
+24
-22
ProjectService.java
src/main/java/com/nisum/mytime/service/ProjectService.java
+3
-0
ProjectServiceImpl.java
...ain/java/com/nisum/mytime/service/ProjectServiceImpl.java
+18
-5
ProjectTeamController.js
src/main/webapp/WEB-INF/controllers/ProjectTeamController.js
+47
-8
No files found.
src/main/java/com/nisum/mytime/controller/ProjectTeamController.java
View file @
aa1fb2a5
...
...
@@ -80,6 +80,17 @@ public class ProjectTeamController {
EmployeeRoles
employeesRole
=
userService
.
getEmployeesRoleData
(
empId
);
return
new
ResponseEntity
<>(
employeesRole
,
HttpStatus
.
OK
);
}
//MT-72
@RequestMapping
(
value
=
"/getEmployeeProjectInfo"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
ProjectTeamMate
>>
getEmployeeProjectInfo
(
@RequestParam
(
"empId"
)
String
empId
)
throws
MyTimeException
{
List
<
ProjectTeamMate
>
projectInfo
=
projectService
.
getProjectInfo
(
empId
);
return
new
ResponseEntity
<>(
projectInfo
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getEmployeesToTeam"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
...
...
src/main/java/com/nisum/mytime/model/ProjectTeamMate.java
View file @
aa1fb2a5
...
...
@@ -23,28 +23,30 @@ import lombok.ToString;
@Document
(
collection
=
"TeamDetails"
)
public
class
ProjectTeamMate
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
@Id
private
ObjectId
id
;
private
String
employeeId
;
private
String
employeeName
;
private
String
emailId
;
private
String
role
;
private
String
shift
;
private
String
projectId
;
private
String
projectName
;
private
String
account
;
private
String
managerId
;
private
String
managerName
;
private
String
experience
;
private
String
designation
;
private
String
billableStatus
;
private
String
mobileNumber
;
@DateTimeFormat
(
iso
=
ISO
.
DATE
)
private
Date
startDate
;
@DateTimeFormat
(
iso
=
ISO
.
DATE
)
private
Date
endDate
;
private
boolean
active
;
@Id
private
ObjectId
id
;
private
String
employeeId
;
private
String
employeeName
;
private
String
emailId
;
private
String
role
;
private
String
shift
;
private
String
projectId
;
private
String
projectName
;
private
String
account
;
private
String
managerId
;
private
String
managerName
;
private
String
experience
;
private
String
designation
;
private
String
billableStatus
;
private
String
mobileNumber
;
@DateTimeFormat
(
iso
=
ISO
.
DATE
)
private
Date
startDate
;
@DateTimeFormat
(
iso
=
ISO
.
DATE
)
private
Date
endDate
;
@DateTimeFormat
(
iso
=
ISO
.
DATE
)
private
Date
newBillingStartDate
;
private
boolean
active
;
}
src/main/java/com/nisum/mytime/service/ProjectService.java
View file @
aa1fb2a5
...
...
@@ -33,6 +33,9 @@ public interface ProjectService {
EmployeeRoles
getEmployeesRoleData
(
String
empId
);
List
<
ProjectTeamMate
>
getTeamDetails
(
String
empId
);
//MT-72
List
<
ProjectTeamMate
>
getProjectInfo
(
String
empId
);
public
ProjectTeamMate
addProjectTeamMate
(
ProjectTeamMate
projectTeamMate
)
throws
MyTimeException
;
...
...
src/main/java/com/nisum/mytime/service/ProjectServiceImpl.java
View file @
aa1fb2a5
...
...
@@ -13,6 +13,7 @@ import org.apache.commons.lang.time.DateUtils;
import
org.bson.types.ObjectId
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.mongodb.core.FindAndModifyOptions
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.Criteria
;
...
...
@@ -137,6 +138,17 @@ public class ProjectServiceImpl implements ProjectService {
return
projectTeamMatesRepo
.
findByManagerId
(
empId
);
}
//MT-72
@Override
public
List
<
ProjectTeamMate
>
getProjectInfo
(
String
empId
)
{
Query
query
=
new
Query
(
Criteria
.
where
(
"employeeId"
).
is
(
empId
));
query
.
limit
(
1
);
query
.
with
(
new
Sort
(
Sort
.
Direction
.
DESC
,
"startDate"
));
List
<
ProjectTeamMate
>
projectTeamMate
=
mongoTemplate
.
find
(
query
,
ProjectTeamMate
.
class
);
return
projectTeamMate
;
}
@Override
public
ProjectTeamMate
addProjectTeamMate
(
ProjectTeamMate
projectTeamMate
)
...
...
@@ -146,8 +158,7 @@ public class ProjectServiceImpl implements ProjectService {
pT
.
getEmployeeId
());
for
(
BillingDetails
b
:
listBD
)
{
Date
d
=
pT
.
getStartDate
()
!=
null
?
pT
.
getStartDate
()
:
new
Date
();
d
.
setDate
(
d
.
getDate
()
-
1
);
b
.
setBillingEndDate
(
DateUtils
.
truncate
(
d
,
Calendar
.
DATE
));
b
.
setBillingEndDate
(
DateUtils
.
truncate
(
DateUtils
.
addDays
(
d
,
-
1
),
Calendar
.
DATE
));
b
.
setActive
(
false
);
updateEmployeeBilling
(
b
);
}
...
...
@@ -161,7 +172,7 @@ public class ProjectServiceImpl implements ProjectService {
billings
.
setActive
(
true
);
billings
.
setBillingStartDate
(
pT
.
getStartDate
()
==
null
?
DateUtils
.
truncate
(
new
Date
(),
Calendar
.
DATE
)
:
DateUtils
.
truncate
(
pT
.
getStartDate
(),
Calendar
.
DATE
));
:
DateUtils
.
truncate
(
pT
.
get
NewBilling
StartDate
(),
Calendar
.
DATE
));
if
(
pT
.
getEndDate
()
!=
null
)
{
billings
.
setBillingEndDate
(
DateUtils
.
truncate
(
pT
.
getEndDate
(),
Calendar
.
DATE
));
...
...
@@ -208,7 +219,9 @@ public class ProjectServiceImpl implements ProjectService {
projectTeamMate
.
getProjectId
());
if
(
listBD
!=
null
&&
!
listBD
.
isEmpty
())
{
BillingDetails
billingDetails
=
listBD
.
get
(
0
);
Date
d
=
new
Date
();
/* Date d = new Date();
d.setDate(d.getDate() - 1);*/
Date
d
=
projectTeamMate
.
getNewBillingStartDate
();
d
.
setDate
(
d
.
getDate
()
-
1
);
billingDetails
.
setBillingEndDate
(
DateUtils
.
truncate
(
d
,
Calendar
.
DATE
));
...
...
@@ -224,7 +237,7 @@ public class ProjectServiceImpl implements ProjectService {
billings
.
setBillableStatus
(
projectTeamMate
.
getBillableStatus
());
billings
.
setActive
(
true
);
billings
.
setBillingStartDate
(
DateUtils
.
truncate
(
new
Date
(),
Calendar
.
DATE
));
DateUtils
.
truncate
(
projectTeamMate
.
getNewBillingStart
Date
(),
Calendar
.
DATE
));
billings
.
setBillingEndDate
(
DateUtils
.
truncate
(
projectTeamMate
.
getEndDate
(),
Calendar
.
DATE
));
billings
.
setCreateDate
(
new
Date
());
...
...
src/main/webapp/WEB-INF/controllers/ProjectTeamController.js
View file @
aa1fb2a5
...
...
@@ -19,6 +19,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
"mobileNumber"
:
""
,
"startDate"
:
""
,
"endDate"
:
""
,
"newBillingStartDate"
:
""
,
"action"
:
""
};
$scope
.
employees
=
[];
...
...
@@ -92,6 +93,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
$scope
.
parentData
.
mobileNumber
=
row
.
entity
.
mobileNumber
;
$scope
.
parentData
.
startDate
=
row
.
entity
.
startDate
;
$scope
.
parentData
.
endDate
=
row
.
entity
.
endDate
;
$scope
.
parentData
.
newBillingStartDate
=
row
.
entity
.
newBillingStartDate
;
if
(
action
==
"Update"
){
$scope
.
updateEmployee
(
action
,
$scope
.
parentData
);
...
...
@@ -252,6 +254,9 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
};
function
deleteUserRole
(
empId
,
projectId
,
id
){
var
record
=
{
"id"
:
id
,
"employeeId"
:
empId
,
"projectId"
:
projectId
};
var
req
=
{
method
:
'POST'
,
...
...
@@ -292,15 +297,22 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
}
function
AddProjectTeamController
(
$scope
,
$mdDialog
,
dataToPass
,
gridOptionsData
,
employees
)
{
console
.
log
(
"data"
,
dataToPass
,
gridOptionsData
,
employees
);
$scope
.
templateTitle
=
dataToPass
.
action
;
$scope
.
alertMsg
=
""
;
$scope
.
isDisabled
=
false
;
$scope
.
result
=
""
;
$scope
.
employeeList
=
employees
;
$scope
.
projectList
=
[];
//MT-72
$scope
.
projectInfoList
=
[];
$scope
.
newBillingStartDate
;
$scope
.
employeeModel
;
$scope
.
projectModel
;
$scope
.
objectId
=
""
;
$scope
.
getProjects
=
function
(){
$http
({
method
:
"GET"
,
...
...
@@ -311,6 +323,13 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
$scope
.
projectList
=
[];
});
};
$scope
.
currentBillabilityDateChange
=
function
(){
$scope
.
startDate
=
$scope
.
newBillingStartDate
;
}
if
(
dataToPass
.
action
==
"Add"
){
$scope
.
empId
=
""
;
$scope
.
empName
=
""
;
...
...
@@ -320,6 +339,8 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
$scope
.
startDate
;
$scope
.
endDate
;
$scope
.
empEmail
=
""
;
$scope
.
newBillingStartDate
;
$scope
.
projectStartDate
;
$scope
.
isDisabled
=
false
;
}
else
if
(
dataToPass
.
action
==
"Update"
){
$scope
.
id
=
dataToPass
.
id
;
...
...
@@ -339,6 +360,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
$scope
.
designation
=
dataToPass
.
designation
;
$scope
.
startDate
=
new
Date
(
dataToPass
.
startDate
);
$scope
.
endDate
=
new
Date
(
dataToPass
.
endDate
);
$scope
.
newBillingStartDate
=
new
Date
(
dataToPass
.
newBillingStartDate
);
$scope
.
isDisabled
=
true
;
$scope
.
projectModel
=
{
'projectName'
:
dataToPass
.
projectName
,
...
...
@@ -408,7 +430,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
};
$scope
.
addBilling
=
function
()
{
var
record
=
{
"employeeId"
:
$scope
.
employeeId
,
"employeeName"
:
$scope
.
employeeName
,
"projectId"
:
$scope
.
projectId
,
"projectName"
:
$scope
.
projectName
,
"billingStartDate"
:
$scope
.
fromDate
,
"billingEndDate"
:
$scope
.
toDate
,
"active"
:
true
};
"projectName"
:
$scope
.
projectName
,
"billingStartDate"
:
$scope
.
fromDate
,
"billingEndDate"
:
$scope
.
toDate
,
"active"
:
true
,
"newBillingStartDate"
:
$scope
.
newBillingStartDate
};
addOrUpdateBilling
(
record
,
"Add"
)
};
...
...
@@ -583,6 +605,16 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
};
$scope
.
getEmployeeSelected
=
function
(){
if
(
$scope
.
employeeModel
!==
undefined
)
{
//MT-72
$http
({
method
:
"GET"
,
url
:
appConfig
.
appUri
+
"/projectTeam/getEmployeeProjectInfo?empId="
+
$scope
.
employeeModel
.
employeeId
}).
then
(
function
mySuccess
(
response
)
{
$scope
.
projectInfoList
=
response
.
data
;
},
function
myError
(
response
)
{
$scope
.
projectInfoList
=
[];
});
$scope
.
employee
=
$scope
.
employeeModel
;
return
$scope
.
employeeModel
.
employeeName
;
}
else
{
...
...
@@ -628,16 +660,21 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
$scope
.
alertMsg
=
"Please select a billable status"
;
document
.
getElementById
(
'empBillableStatus'
).
focus
();
}
else
if
(
$scope
.
startDate
==
undefined
)
{
$scope
.
alertMsg
=
"Please select Start Date"
;
$scope
.
alertMsg
=
"Please select
Assignment
Start Date"
;
document
.
getElementById
(
'startDate'
).
focus
();
}
else
if
(
$scope
.
endDate
==
undefined
)
{
$scope
.
alertMsg
=
"Please select End Date"
;
}
else
if
(
$scope
.
newBillingStartDate
==
undefined
)
{
$scope
.
alertMsg
=
"Please select Current Billability Start Date"
;
document
.
getElementById
(
'newBillingStartDate'
).
focus
();
}
else
if
(
$scope
.
endDate
==
undefined
)
{
$scope
.
alertMsg
=
"Please select Assignment End Date"
;
document
.
getElementById
(
'endDate'
).
focus
();
}
}
else
if
(
$scope
.
newBillingStartDate
>
$scope
.
endDate
){
$scope
.
alertMsg
=
"Assignment End Date should be less than Current Billability Start Date "
;
}
else
{
$scope
.
alertMsg
=
""
;
var
record
=
{
"employeeId"
:
employeeModel
.
employeeId
,
"employeeName"
:
employeeModel
.
employeeName
,
"emailId"
:
employeeModel
.
emailId
,
"role"
:
employeeModel
.
role
,
"designation"
:
employeeModel
.
designation
,
"shift"
:
employeeModel
.
shift
,
"projectId"
:
projectModel
.
projectId
,
"projectName"
:
projectModel
.
projectName
,
"account"
:
$scope
.
projectModel
.
account
,
"managerId"
:
myFactory
.
getEmpId
(),
"managerName"
:
myFactory
.
getEmpName
(),
"mobileNumber"
:
employeeModel
.
mobileNumber
,
"active"
:
true
,
"billableStatus"
:
$scope
.
empBillableStatus
,
"startDate"
:
$scope
.
startDate
,
"endDate"
:
$scope
.
endDate
};
var
record
=
{
"employeeId"
:
employeeModel
.
employeeId
,
"employeeName"
:
employeeModel
.
employeeName
,
"emailId"
:
employeeModel
.
emailId
,
"role"
:
employeeModel
.
role
,
"designation"
:
employeeModel
.
designation
,
"shift"
:
employeeModel
.
shift
,
"projectId"
:
projectModel
.
projectId
,
"projectName"
:
projectModel
.
projectName
,
"account"
:
$scope
.
projectModel
.
account
,
"managerId"
:
myFactory
.
getEmpId
(),
"managerName"
:
myFactory
.
getEmpName
(),
"mobileNumber"
:
employeeModel
.
mobileNumber
,
"active"
:
true
,
"billableStatus"
:
$scope
.
empBillableStatus
,
"startDate"
:
$scope
.
startDate
,
"endDate"
:
$scope
.
endDate
,
"newBillingStartDate"
:
$scope
.
newBillingStartDate
};
addOrUpdateRole
(
record
,
$scope
.
templateTitle
);
$timeout
(
function
(){
updateGrid
(
$scope
.
templateTitle
,
record
)},
500
);
}
...
...
@@ -657,11 +694,11 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
$scope
.
alertMsg
=
"Please select Start Date"
;
document
.
getElementById
(
'startDate'
).
focus
();
}
else
if
(
$scope
.
endDate
==
undefined
)
{
$scope
.
alertMsg
=
"Please select
End Date
"
;
$scope
.
alertMsg
=
"Please select
new Billing Date
"
;
document
.
getElementById
(
'endDate'
).
focus
();
}
else
{
$scope
.
alertMsg
=
""
;
var
record
=
{
"id"
:
$scope
.
id
,
"employeeId"
:
$scope
.
employeeId
,
"employeeName"
:
$scope
.
employeeName
,
"emailId"
:
$scope
.
emailId
,
"role"
:
$scope
.
role
,
"shift"
:
$scope
.
shift
,
"projectId"
:
$scope
.
projectModel
.
projectId
,
"projectName"
:
$scope
.
projectModel
.
projectName
,
"account"
:
$scope
.
projectModel
.
account
,
"managerId"
:
myFactory
.
getEmpId
(),
"managerName"
:
myFactory
.
getEmpName
(),
"designation"
:
$scope
.
empDesignation
,
"billableStatus"
:
$scope
.
empBillableStatus
,
"experience"
:
$scope
.
experience
,
"mobileNumber"
:
$scope
.
mobileNumber
,
"startDate"
:
$scope
.
startDate
,
"endDate"
:
$scope
.
endDate
};
var
record
=
{
"id"
:
$scope
.
id
,
"employeeId"
:
$scope
.
employeeId
,
"employeeName"
:
$scope
.
employeeName
,
"emailId"
:
$scope
.
emailId
,
"role"
:
$scope
.
role
,
"shift"
:
$scope
.
shift
,
"projectId"
:
$scope
.
projectModel
.
projectId
,
"projectName"
:
$scope
.
projectModel
.
projectName
,
"account"
:
$scope
.
projectModel
.
account
,
"managerId"
:
myFactory
.
getEmpId
(),
"managerName"
:
myFactory
.
getEmpName
(),
"designation"
:
$scope
.
empDesignation
,
"billableStatus"
:
$scope
.
empBillableStatus
,
"experience"
:
$scope
.
experience
,
"mobileNumber"
:
$scope
.
mobileNumber
,
"startDate"
:
$scope
.
startDate
,
"endDate"
:
$scope
.
endDate
,
"newBillingStartDate"
:
$scope
.
newBillingStartDate
};
addOrUpdateRole
(
record
,
$scope
.
templateTitle
);
$timeout
(
function
(){
updateGrid
(
$scope
.
templateTitle
,
record
)},
500
);
}
...
...
@@ -694,6 +731,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
}
function
addOrUpdateRole
(
record
,
action
){
console
.
log
(
"record"
,
record
);
var
urlRequest
=
""
;
if
(
action
==
"Add"
){
urlRequest
=
appConfig
.
appUri
+
"projectTeam/addEmployeeToTeam"
;
...
...
@@ -713,6 +751,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
$scope
.
objectId
=
response
.
data
.
id
;
},
function
myError
(
response
){
$scope
.
result
=
"Error"
;
console
.
log
(
"error in 748"
)
});
}
...
...
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