|
|
@ -14,7 +14,7 @@ |
|
|
/// limitations under the License.
|
|
|
/// limitations under the License.
|
|
|
///
|
|
|
///
|
|
|
|
|
|
|
|
|
import { ChangeDetectorRef, Component, Inject, Optional } from '@angular/core'; |
|
|
import { ChangeDetectorRef, Component, Inject, OnInit, Optional } from '@angular/core'; |
|
|
import { select, Store } from '@ngrx/store'; |
|
|
import { select, Store } from '@ngrx/store'; |
|
|
import { AppState } from '@core/core.state'; |
|
|
import { AppState } from '@core/core.state'; |
|
|
import { EntityComponent } from '../../components/entity/entity.component'; |
|
|
import { EntityComponent } from '../../components/entity/entity.component'; |
|
|
@ -27,13 +27,14 @@ import { isDefinedAndNotNull } from '@core/utils'; |
|
|
import { EntityTableConfig } from '@home/models/entity/entities-table-config.models'; |
|
|
import { EntityTableConfig } from '@home/models/entity/entities-table-config.models'; |
|
|
import { ActionNotificationShow } from '@app/core/notification/notification.actions'; |
|
|
import { ActionNotificationShow } from '@app/core/notification/notification.actions'; |
|
|
import { TranslateService } from '@ngx-translate/core'; |
|
|
import { TranslateService } from '@ngx-translate/core'; |
|
|
|
|
|
import { UtilsService } from "@core/services/utils.service"; |
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
selector: 'tb-user', |
|
|
selector: 'tb-user', |
|
|
templateUrl: './user.component.html', |
|
|
templateUrl: './user.component.html', |
|
|
styleUrls: ['./user.component.scss'] |
|
|
styleUrls: ['./user.component.scss'] |
|
|
}) |
|
|
}) |
|
|
export class UserComponent extends EntityComponent<User> { |
|
|
export class UserComponent extends EntityComponent<User> implements OnInit{ |
|
|
|
|
|
|
|
|
authority = Authority; |
|
|
authority = Authority; |
|
|
|
|
|
|
|
|
@ -46,11 +47,16 @@ export class UserComponent extends EntityComponent<User> { |
|
|
@Optional() @Inject('entity') protected entityValue: User, |
|
|
@Optional() @Inject('entity') protected entityValue: User, |
|
|
@Optional() @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<User>, |
|
|
@Optional() @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<User>, |
|
|
public fb: UntypedFormBuilder, |
|
|
public fb: UntypedFormBuilder, |
|
|
|
|
|
private utils: UtilsService, |
|
|
protected cd: ChangeDetectorRef, |
|
|
protected cd: ChangeDetectorRef, |
|
|
protected translate: TranslateService) { |
|
|
protected translate: TranslateService) { |
|
|
super(store, fb, entityValue, entitiesTableConfigValue, cd); |
|
|
super(store, fb, entityValue, entitiesTableConfigValue, cd); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
|
this.entityForm.controls.email.addValidators(this.utils.validateEmail); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
hideDelete() { |
|
|
hideDelete() { |
|
|
if (this.entitiesTableConfig) { |
|
|
if (this.entitiesTableConfig) { |
|
|
return !this.entitiesTableConfig.deleteEnabled(this.entity); |
|
|
return !this.entitiesTableConfig.deleteEnabled(this.entity); |
|
|
@ -70,7 +76,7 @@ export class UserComponent extends EntityComponent<User> { |
|
|
buildForm(entity: User): UntypedFormGroup { |
|
|
buildForm(entity: User): UntypedFormGroup { |
|
|
return this.fb.group( |
|
|
return this.fb.group( |
|
|
{ |
|
|
{ |
|
|
email: [entity ? entity.email : '', [Validators.required, Validators.email]], |
|
|
email: [entity ? entity.email : '', [Validators.required]], |
|
|
firstName: [entity ? entity.firstName : ''], |
|
|
firstName: [entity ? entity.firstName : ''], |
|
|
lastName: [entity ? entity.lastName : ''], |
|
|
lastName: [entity ? entity.lastName : ''], |
|
|
phone: [entity ? entity.phone : ''], |
|
|
phone: [entity ? entity.phone : ''], |
|
|
|