|
@@ -31,6 +31,9 @@ import { Customer } from '@app/shared/models/customer.model'; |
|
@@ -31,6 +31,9 @@ import { Customer } from '@app/shared/models/customer.model'; |
31
|
import { CustomerService } from '@app/core/http/customer.service';
|
31
|
import { CustomerService } from '@app/core/http/customer.service';
|
32
|
import { CustomerComponent } from '@modules/home/pages/customer/customer.component';
|
32
|
import { CustomerComponent } from '@modules/home/pages/customer/customer.component';
|
33
|
import { CustomerTabsComponent } from '@home/pages/customer/customer-tabs.component';
|
33
|
import { CustomerTabsComponent } from '@home/pages/customer/customer-tabs.component';
|
|
|
34
|
+import { getCurrentAuthState } from '@core/auth/auth.selectors';
|
|
|
35
|
+import { Store } from '@ngrx/store';
|
|
|
36
|
+import { AppState } from '@core/core.state';
|
34
|
|
37
|
|
35
|
@Injectable()
|
38
|
@Injectable()
|
36
|
export class CustomersTableConfigResolver implements Resolve<EntityTableConfig<Customer>> {
|
39
|
export class CustomersTableConfigResolver implements Resolve<EntityTableConfig<Customer>> {
|
|
@@ -40,13 +43,15 @@ export class CustomersTableConfigResolver implements Resolve<EntityTableConfig<C |
|
@@ -40,13 +43,15 @@ export class CustomersTableConfigResolver implements Resolve<EntityTableConfig<C |
40
|
constructor(private customerService: CustomerService,
|
43
|
constructor(private customerService: CustomerService,
|
41
|
private translate: TranslateService,
|
44
|
private translate: TranslateService,
|
42
|
private datePipe: DatePipe,
|
45
|
private datePipe: DatePipe,
|
43
|
- private router: Router) {
|
46
|
+ private router: Router,
|
|
|
47
|
+ private store: Store<AppState>) {
|
44
|
|
48
|
|
45
|
this.config.entityType = EntityType.CUSTOMER;
|
49
|
this.config.entityType = EntityType.CUSTOMER;
|
46
|
this.config.entityComponent = CustomerComponent;
|
50
|
this.config.entityComponent = CustomerComponent;
|
47
|
this.config.entityTabsComponent = CustomerTabsComponent;
|
51
|
this.config.entityTabsComponent = CustomerTabsComponent;
|
48
|
this.config.entityTranslations = entityTypeTranslations.get(EntityType.CUSTOMER);
|
52
|
this.config.entityTranslations = entityTypeTranslations.get(EntityType.CUSTOMER);
|
49
|
this.config.entityResources = entityTypeResources.get(EntityType.CUSTOMER);
|
53
|
this.config.entityResources = entityTypeResources.get(EntityType.CUSTOMER);
|
|
|
54
|
+ const authState = getCurrentAuthState(this.store);
|
50
|
|
55
|
|
51
|
this.config.columns.push(
|
56
|
this.config.columns.push(
|
52
|
new DateEntityTableColumn<Customer>('createdTime', 'common.created-time', this.datePipe, '150px'),
|
57
|
new DateEntityTableColumn<Customer>('createdTime', 'common.created-time', this.datePipe, '150px'),
|
|
@@ -55,7 +60,6 @@ export class CustomersTableConfigResolver implements Resolve<EntityTableConfig<C |
|
@@ -55,7 +60,6 @@ export class CustomersTableConfigResolver implements Resolve<EntityTableConfig<C |
55
|
new EntityTableColumn<Customer>('country', 'contact.country', '25%'),
|
60
|
new EntityTableColumn<Customer>('country', 'contact.country', '25%'),
|
56
|
new EntityTableColumn<Customer>('city', 'contact.city', '25%')
|
61
|
new EntityTableColumn<Customer>('city', 'contact.city', '25%')
|
57
|
);
|
62
|
);
|
58
|
-
|
|
|
59
|
this.config.cellActionDescriptors.push(
|
63
|
this.config.cellActionDescriptors.push(
|
60
|
{
|
64
|
{
|
61
|
name: this.translate.instant('customer.manage-customer-users'),
|
65
|
name: this.translate.instant('customer.manage-customer-users'),
|
|
@@ -95,19 +99,22 @@ export class CustomersTableConfigResolver implements Resolve<EntityTableConfig<C |
|
@@ -95,19 +99,22 @@ export class CustomersTableConfigResolver implements Resolve<EntityTableConfig<C |
95
|
icon: 'dashboard',
|
99
|
icon: 'dashboard',
|
96
|
isEnabled: (customer) => true,
|
100
|
isEnabled: (customer) => true,
|
97
|
onAction: ($event, entity) => this.manageCustomerDashboards($event, entity)
|
101
|
onAction: ($event, entity) => this.manageCustomerDashboards($event, entity)
|
98
|
- },
|
|
|
99
|
- {
|
|
|
100
|
- name: this.translate.instant('customer.manage-customer-edges'),
|
|
|
101
|
- nameFunction: (customer) => {
|
|
|
102
|
- return customer.additionalInfo && customer.additionalInfo.isPublic
|
|
|
103
|
- ? this.translate.instant('customer.manage-public-edges')
|
|
|
104
|
- : this.translate.instant('customer.manage-customer-edges');
|
|
|
105
|
- },
|
|
|
106
|
- icon: 'router',
|
|
|
107
|
- isEnabled: (customer) => true,
|
|
|
108
|
- onAction: ($event, entity) => this.manageCustomerEdges($event, entity)
|
|
|
109
|
- },
|
|
|
110
|
- );
|
102
|
+ });
|
|
|
103
|
+ if (authState.edgesSupportEnabled) {
|
|
|
104
|
+ this.config.cellActionDescriptors.push(
|
|
|
105
|
+ {
|
|
|
106
|
+ name: this.translate.instant('customer.manage-customer-edges'),
|
|
|
107
|
+ nameFunction: (customer) => {
|
|
|
108
|
+ return customer.additionalInfo && customer.additionalInfo.isPublic
|
|
|
109
|
+ ? this.translate.instant('customer.manage-public-edges')
|
|
|
110
|
+ : this.translate.instant('customer.manage-customer-edges');
|
|
|
111
|
+ },
|
|
|
112
|
+ icon: 'router',
|
|
|
113
|
+ isEnabled: (customer) => true,
|
|
|
114
|
+ onAction: ($event, entity) => this.manageCustomerEdges($event, entity)
|
|
|
115
|
+ }
|
|
|
116
|
+ );
|
|
|
117
|
+ }
|
111
|
|
118
|
|
112
|
this.config.deleteEntityTitle = customer => this.translate.instant('customer.delete-customer-title', { customerTitle: customer.title });
|
119
|
this.config.deleteEntityTitle = customer => this.translate.instant('customer.delete-customer-title', { customerTitle: customer.title });
|
113
|
this.config.deleteEntityContent = () => this.translate.instant('customer.delete-customer-text');
|
120
|
this.config.deleteEntityContent = () => this.translate.instant('customer.delete-customer-text');
|