import { Component, OnInit, Inject, ViewChild } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { MessageService as MessageServiceP, Message, ConfirmationService } from 'primeng/api'; import { AuthService } from 'ekangularbase/src/auth/auth.service'; import { routerTransition } from 'ekangularbase/src/common/router.animations'; import { SelectItem } from 'primeng/api'; import { WebNotificationService } from 'ekangularbase/src/auth/webNotification.service'; // import { GenericUiClass, GenericUiFunc } from '../../../interface/generic-ui'; import { GenericUiService } from '../../../service/object/GenericUi.service'; import { BaseComponentV2 } from 'ekangularbase/src/baseclass/BaseComponentV2'; import { AuditTrailService } from 'ekangularbase/src/service/object/audit-trail.service'; import { Location } from '@angular/common'; import { EtableComponent } from 'ekangularbase/src/ek-components/etable/etable.component'; import { EntityStatus } from 'ekangularbase/src/interface/entity-status'; import { AppConfig } from 'ekangularbase/src/AppConfig/AppConfig'; @Component({ templateUrl: './generic-ui-list.component.html', styleUrls: ['./generic-ui-list.component.scss'], animations: [routerTransition()] }) export class GenericUiComponent extends BaseComponentV2 { strTableName = 'EK.IPMS.Base.Entity.GenericUi'; logColumnList: string[] = []; pageTittle = ''; contentType: any; @ViewChild('dt', { static: false }) dt: EtableComponent; constructor( public messageService: MessageServiceP, public confirmationService: ConfirmationService, public authService: AuthService, public router: Router, public route: ActivatedRoute, public locationNav: Location, public auditTrailService: AuditTrailService, public webNotificationService: WebNotificationService, public genericUiService: GenericUiService, ) { super(confirmationService, webNotificationService , messageService, genericUiService, 'GenericUi', authService, router , locationNav, route, auditTrailService); this.authService.pageName = 'List'; } listService() { const d = new Date(); console.log(d); this.genericUiService.GetByType(this.contentType).subscribe(res => { console.log(res); if (res.setup) { this.pageTittle = res.setup.pageTittle; } this.setTableDetails(res); this.listServiceDone(res.objectlist); this.dataFinishLoaded(); }, error => { console.error(error); this.dataFinishLoaded(); } ); } startGetHasAuditLog() { this.getHasAuditLog(this.objectlist, this.dt); } onStatusChange() { this.list(); } ngOnInitLocal() { this.route.queryParams.subscribe(params => { if (this.contentType !== null && this.contentType !== params['contentType']) { // this.dt.reset(); this.contentType = params['contentType']; this.list(); } this.contentType = params['contentType']; console.log(this.contentType); }); } setTableDetails(res) { this.cols = res.cols; this.func = res.func; } detectChanges(event = null) { try { this.dt.detectChanges(event); } catch (error) { console.log(error); } } }