Fix: Incentives was not saving
Fix: Employee edit was not working
This commit is contained in:
parent
cd20982753
commit
eb22eace69
@ -187,11 +187,14 @@ def employee_info(id, dbsession):
|
|||||||
employee = dbsession.query(Employee).filter(Employee.id == id).first()
|
employee = dbsession.query(Employee).filter(Employee.id == id).first()
|
||||||
if employee is None:
|
if employee is None:
|
||||||
raise ValidationError("Invalid Employee")
|
raise ValidationError("Invalid Employee")
|
||||||
employee = {'id': employee.id, 'code': employee.code, 'name': employee.name, 'isActive': employee.is_active,
|
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,
|
'designation': employee.designation, 'salary': employee.salary, 'points': employee.service_points,
|
||||||
'joiningDate': employee.joining_date.strftime('%d-%b-%Y'),
|
'joiningDate': employee.joining_date.strftime('%d-%b-%Y'),
|
||||||
'leavingDate': None if employee.is_active else employee.leaving_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}}
|
'costCentre': {'id': employee.cost_centre_id, 'name': employee.cost_centre.name}
|
||||||
|
}
|
||||||
return employee
|
return employee
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ export class IncentiveComponent implements OnInit {
|
|||||||
getVoucher(): Voucher {
|
getVoucher(): Voucher {
|
||||||
const formModel = this.form.value;
|
const formModel = this.form.value;
|
||||||
this.voucher.date = moment(formModel.date).format('DD-MMM-YYYY');
|
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) => {
|
this.voucher.incentives.forEach((item, index) => {
|
||||||
item.points = array.controls[index].value.points;
|
item.points = array.controls[index].value.points;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user