Fix: Incentives was not saving

Fix: Employee edit was not working
This commit is contained in:
Amritanshu 2018-08-25 11:28:23 +05:30
parent cd20982753
commit eb22eace69
2 changed files with 9 additions and 6 deletions

View File

@ -187,11 +187,14 @@ def employee_info(id, dbsession):
employee = dbsession.query(Employee).filter(Employee.id == id).first()
if employee is None:
raise ValidationError("Invalid Employee")
employee = {'id': employee.id, 'code': employee.code, 'name': employee.name, 'isActive': employee.is_active,
'designation': employee.designation, 'salary': employee.salary, 'points': employee.service_points,
'joiningDate': employee.joining_date.strftime('%d-%b-%Y'),
'leavingDate': None if employee.is_active else employee.leaving_date.strftime('%d-%b-%Y'),
'costCentre': {'id': employee.cost_centre_id, 'name': employee.cost_centre.name}}
employee = {
'id': employee.id, 'code': employee.code, 'name': employee.name,
'isActive': employee.is_active, 'isStarred': employee.is_starred,
'designation': employee.designation, 'salary': employee.salary, 'points': employee.service_points,
'joiningDate': employee.joining_date.strftime('%d-%b-%Y'),
'leavingDate': None if employee.is_active else employee.leaving_date.strftime('%d-%b-%Y'),
'costCentre': {'id': employee.cost_centre_id, 'name': employee.cost_centre.name}
}
return employee

View File

@ -156,7 +156,7 @@ export class IncentiveComponent implements OnInit {
getVoucher(): Voucher {
const formModel = this.form.value;
this.voucher.date = moment(formModel.date).format('DD-MMM-YYYY');
const array = this.form.get('attendances') as FormArray;
const array = this.form.get('incentives') as FormArray;
this.voucher.incentives.forEach((item, index) => {
item.points = array.controls[index].value.points;
});