-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserviceman.component.ts
More file actions
72 lines (68 loc) · 2.39 KB
/
serviceman.component.ts
File metadata and controls
72 lines (68 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { Component, AfterViewInit, ChangeDetectorRef } from '@angular/core';
import { BaseTableComponent } from 'app/shared/components';
import { StringFilterComponent } from 'app/shared/components/filters/string-filter/string-filter.component';
import { ColumnType } from 'app/shared/types/enumerations';
import { SERVICEMAN, SERVICEMAN_NEW } from 'app/shared/constants';
import { HoaRepository, ServicemanRepository } from 'app/repositories';
import { SelectFilterComponent } from 'app/shared/components/filters/select-filter/select-filter.component';
@Component({
selector: 'ngx-serviceman',
templateUrl: '../../shared/components/base-table/base-table.component.html',
styleUrls: ['../../shared/components/base-table/base-table.component.scss'],
})
export class ServicemanComponent extends BaseTableComponent implements AfterViewInit {
constructor(
private hoaRepo: HoaRepository,
public servicemanRepository: ServicemanRepository,
protected cdk: ChangeDetectorRef,
) {
super(servicemanRepository);
this.columns['connectedHoas'] = {
title: this.translate.instant('table_title.hoa'),
type: ColumnType.STRING,
getter: (val: Array<any>) => {
return val?.length ? val?.map(hoa => hoa.hoaName).join(', ') : ' - ';
},
filter: {
component: SelectFilterComponent,
dropdownItemName: 'hoaName',
dynamicData: this.hoaRepo.find({
order: [['hoaName', 'ASC']],
}),
name: '$hoas->HoaServicemanModel.hoa_id$',
},
disableSort: true,
};
this.columns['type'] = {
title: this.translate.instant('table_title.serviceman_type'),
type: ColumnType.STRING,
filter: {
name: 'type',
component: StringFilterComponent,
},
};
this.columns['servicemanName'] = {
title: this.translate.instant('table_title.serviceman_name'),
type: ColumnType.STRING,
filter: {
name: 'servicemanName',
component: StringFilterComponent,
},
};
this.columns['phone'] = {
title: this.translate.instant('table_title.serviceman_phone'),
type: ColumnType.STRING,
filter: {
name: 'phone',
component: StringFilterComponent,
},
};
this.editUrl = SERVICEMAN;
this.pageSize = 0;
}
override ngAfterViewInit() {
this.FAB.newItemUrl = SERVICEMAN_NEW;
super.ngAfterViewInit();
this.cdk.detectChanges();
}
}