Skip to content
Permalink
Browse files

Merge pull request #864 from ever-co/feat/#849-manage-employees

Feat/#849 manage employees
  • Loading branch information
evereq committed Mar 25, 2020
2 parents bd5582e + a619fe9 commit 8ada1a9c131474ea77e604f1eb27d2926ad79ceb
@@ -83,6 +83,12 @@ export class Employee extends LocationBase implements IEmployee {
@Column({ nullable: true, default: true })
isActive: boolean;

@ApiPropertyOptional({ type: Date })
@IsDate()
@IsOptional()
@Column({ nullable: true })
startedWorkOn?: Date;

@ApiPropertyOptional({ type: Date })
@IsDate()
@IsOptional()
@@ -159,10 +165,4 @@ export class Employee extends LocationBase implements IEmployee {
@ApiPropertyOptional({ type: Boolean })
@Column({ nullable: true })
anonymousBonus?: boolean;

@ApiPropertyOptional({ type: Date })
@IsDate()
@IsOptional()
@Column({ nullable: true })
startedWorkOn?: Date;
}
@@ -66,7 +66,6 @@ export class EmployeeMutationComponent implements OnInit, AfterViewInit {
lastName: this.form.get('lastName').value,
email: this.form.get('email').value,
imageUrl: this.form.get('imageUrl').value,
startedWorkOn: this.form.get('startedWorkOn').value,
tenant: null,
role: this.role,
tags: this.userBasicInfo.selectedTags
@@ -78,14 +77,14 @@ export class EmployeeMutationComponent implements OnInit, AfterViewInit {

const newEmployee: EmployeeCreateInput = {
user,
startedWorkOn: this.form.get('startedWorkOn').value,
password: this.form.get('password').value,
organization: this.store.selectedOrganization,
offerDate,
acceptDate,
rejectDate
};
this.employees.push(newEmployee);

this.userBasicInfo.loadFormData();
this.form = this.userBasicInfo.form;
this.stepper.reset();
@@ -114,6 +114,7 @@ export class BasicInfoFormComponent implements OnInit, AfterViewInit {
],
role: ['', this.isEmployee ? null : Validators.required],
offerDate: [''],

acceptDate: [''],
rejectDate: ['']
},
@@ -140,8 +141,6 @@ export class BasicInfoFormComponent implements OnInit, AfterViewInit {
}

async registerUser(defaultRoleName: RolesEnum) {
const startedWorkOn = this.form.get('startedWorkOn');

if (this.form.valid) {
const role = await this.roleService
.getRoleByName({
@@ -159,7 +158,6 @@ export class BasicInfoFormComponent implements OnInit, AfterViewInit {
username: this.username.value || null,
imageUrl: this.imageUrl.value,
role,
startedWorkOn: startedWorkOn.value,
tenant: this.tenant,
tags: this.selectedTags
},
@@ -1,44 +1,33 @@
<form class="main-form" [formGroup]="form" *ngIf="form">
<div class="row">
<div class="col">
<div class="col-md-6">
<div class="form-group">
<label class="label">
{{ 'EMPLOYEES_PAGE.EDIT_EMPLOYEE.DEPARTMENT' | translate }}
<label for="startedWork" class="label">
{{ 'FORM.LABELS.START_DATE' | translate }}
</label>
<ng-select
id="departmentInput"
[items]="departments"
formControlName="organizationDepartments"
bindLabel="name"
[searchable]="false"
<input
[nbDatepicker]="datepicker"
nbInput
fullWidth
placeholder="{{
'FORM.PLACEHOLDERS.ALL_DEPARTMENTS' | translate
'FORM.PLACEHOLDERS.START_DATE' | translate
}}"
multiple="true"
>
</ng-select>
formControlName="startedWorkOn"
required
/>
<nb-datepicker #datepicker></nb-datepicker>
</div>
</div>
<div class="col">
<div class="form-group">
<label for="positionInput" class="label">{{
'EMPLOYEES_PAGE.EDIT_EMPLOYEE.POSITION' | translate
}}</label>
<ng-select
id="positionInput"
[items]="positions"
formControlName="organizationPosition"
bindLabel="name"
[searchable]="false"
placeholder="{{
'FORM.PLACEHOLDERS.ALL_POSITIONS' | translate
}}"
>
</ng-select>
<div class="col-md-6" *ngIf="form.invalid && form.touched">
<div class="notes">
<p>
It's required to enter the date when the employee started
work to generate employee payroll, enable the employee to
participate in split expenses, see employee statistics, etc
</p>
</div>
</div>
</div>

<div class="row">
<div class="col-md-6">
<div class="form-group">
@@ -60,7 +49,6 @@
</ng-select>
</div>
</div>

<div class="col-md-6">
<div class="form-group">
<label class="label" for="empLevelInput">
@@ -75,6 +63,47 @@
</ng-select>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group">
<label class="label">
{{ 'EMPLOYEES_PAGE.EDIT_EMPLOYEE.DEPARTMENT' | translate }}
</label>
<ng-select
id="departmentInput"
[items]="departments"
formControlName="organizationDepartments"
bindLabel="name"
[searchable]="false"
placeholder="{{
'FORM.PLACEHOLDERS.ALL_DEPARTMENTS' | translate
}}"
multiple="true"
>
</ng-select>
</div>
</div>
<div class="col">
<div class="form-group">
<label for="positionInput" class="label">{{
'EMPLOYEES_PAGE.EDIT_EMPLOYEE.POSITION' | translate
}}</label>
<ng-select
id="positionInput"
[items]="positions"
formControlName="organizationPosition"
bindLabel="name"
[searchable]="false"
placeholder="{{
'FORM.PLACEHOLDERS.ALL_POSITIONS' | translate
}}"
>
</ng-select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<ngx-tags-color-input
@@ -84,7 +113,6 @@
</div>
</div>
</div>

<div class="row">
<div class="col">
<div class="form-group">
@@ -94,7 +122,6 @@
</div>
</div>
</div>

<div class="actions">
<button
[disabled]="form.invalid"
@@ -1,3 +1,15 @@
.main-form {
padding: 50px 0px;
}
.notes {
margin-top: 16px;
padding: 10px;
border-radius: 5px;
text-indent: 1em;
}
.notes p {
margin: 0;
color: #eac72d;
font-size: 0.75rem;
font-weight: 700;
}
@@ -131,7 +131,8 @@ export class EditEmployeeEmploymentComponent implements OnInit, OnDestroy {
employeeLevel: [employee.employeeLevel || ''],
anonymousBonus: [employee.anonymousBonus],
organizationDepartments: [employee.organizationDepartments || null],
organizationPosition: [employee.organizationPosition || null]
organizationPosition: [employee.organizationPosition || null],
startedWorkOn: [employee ? new Date(employee.startedWorkOn) : '']
});
}

@@ -97,6 +97,14 @@ export class EditEmployeeProfileComponent extends TranslationBaseComponent
responsive: true,
route: this.getRoute('employment')
},
{
title: this.getTranslation(
'EMPLOYEES_PAGE.EDIT_EMPLOYEE.HIRING'
),
icon: 'map-outline',
responsive: true,
route: this.getRoute('hiring')
},
{
title: this.getTranslation(
'EMPLOYEES_PAGE.EDIT_EMPLOYEE.LOCATION'
@@ -128,14 +136,6 @@ export class EditEmployeeProfileComponent extends TranslationBaseComponent
icon: 'book-open-outline',
responsive: true,
route: this.getRoute('clients')
},
{
title: this.getTranslation(
'EMPLOYEES_PAGE.EDIT_EMPLOYEE.HIRING'
),
icon: 'map-outline',
responsive: true,
route: this.getRoute('hiring')
}
];
}
@@ -9,6 +9,7 @@ import { OrganizationEmploymentType } from './organization-employment-type.model

export interface Employee extends IBaseEntityModel, ILocation {
endWork?: any;
startedWorkOn?: any;
user: User;
userId: string;
organization: Organization;
@@ -59,6 +60,7 @@ export interface EmployeeCreateInput {
acceptDate?: Date;
rejectDate?: Date;
members?: Employee[];
startedWorkOn?: any;
}

export enum PayPeriodEnum {
@@ -17,7 +17,6 @@ export interface User extends IBaseEntityModel {
roleId?: string;
hash?: string;
imageUrl?: string;
startedWorkOn?: string;
tenant: Tenant;
tags: Tag[];
}

0 comments on commit 8ada1a9

Please sign in to comment.
You can’t perform that action at this time.