import { Component, Injector, ViewEncapsulation, ViewChild } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { ReportServiceProxy, ReportList, UserServiceProxy, UserListDto, ReportScheduleServiceProxy } from '@shared/service-proxies/service-proxies'; import { NotifyService } from '@abp/notify/notify.service'; import { AppComponentBase } from '@shared/common/app-component-base'; import { TokenAuthServiceProxy } from '@shared/service-proxies/service-proxies'; //import { ViewRouteTypeModalComponent } from './view-routeType-modal.component'; import { appModuleAnimation } from '@shared/animations/routerTransition'; import { Table } from 'primeng/components/table/table'; import { Paginator } from 'primeng/components/paginator/paginator'; import { LazyLoadEvent } from 'primeng/components/common/lazyloadevent'; import { FileDownloadService } from '@shared/utils/file-download.service'; import { EntityTypeHistoryModalComponent } from '@app/shared/common/entityHistory/entity-type-history-modal.component'; import * as _ from 'lodash'; import * as moment from 'moment'; import { Router } from '@angular/router'; import { Location } from '@angular/common'; import { CreateReportScheduleModalComponent } from './create-report-schedule-modal.component'; import { EditReportScheduleModalComponent } from './edit-report-schedule-modal.component'; import { ViewReportScheduleModalComponent } from './view-report-schedule-modal.component'; @Component({ templateUrl: './report-schedule.component.html', encapsulation: ViewEncapsulation.None, animations: [appModuleAnimation()], providers: [ReportScheduleServiceProxy] }) export class ReportScheduleComponent extends AppComponentBase { @ViewChild('dataTable', { static: true }) dataTable: Table; @ViewChild('paginator', { static: true }) paginator: Paginator; @ViewChild('createReportScheduleModalComponent', { static: true }) createReportSchedule : CreateReportScheduleModalComponent; @ViewChild('editReportScheduleModalComponent', { static: true }) editReportSchedule : EditReportScheduleModalComponent; @ViewChild('viewReportScheduleModalComponent', { static: true }) viewReportSchedule : ViewReportScheduleModalComponent; advancedFiltersAreShown = false; filterText = ''; filterName = ''; filterDescription = ''; modifiedByFilter: any; createdByFilter: any; createdFrom: any; createdTo: any; modifiedFrom: any; modifiedTo: any; update: Array = []; users: Array<{ id: number, name: string, surname: string }> = new Array(); creatorId: any; id : any reportName : string = "" public modifiedDateRange: moment.Moment[] = null; public createdDateRange: moment.Moment[] = null; constructor( injector: Injector, private _reportServiceProxy: ReportServiceProxy, private _reportScheduleServiceProxy: ReportScheduleServiceProxy, private _notifyService: NotifyService, private _tokenAuth: TokenAuthServiceProxy, private _activatedRoute: ActivatedRoute, private _router: Router, private route: ActivatedRoute, private _location: Location ) { super(injector); } ngOnInit(): void { //this.entityHistoryEnabled = this.setIsEntityHistoryEnabled(); $('.kt-select2').select2(); this.route.paramMap.subscribe(params => { this.id = params.get("id") }) // this.showAllUsers(); this. getReportName(); } getReportName(){ this._reportScheduleServiceProxy.getReportName(this.id) .subscribe(result => { this.reportName = result }) } getReportSchedules(event?: LazyLoadEvent) { // this.createdByFilter = Number((document.getElementById('createdByFilter')).value) != 0 ? Number((document.getElementById('createdByFilter')).value) : undefined; // this.modifiedByFilter = Number((document.getElementById('modifiedByFilter')).value) != 0 ? Number((document.getElementById('modifiedByFilter')).value) : undefined; this.spinnerService.show(); this._reportScheduleServiceProxy.getReportSchedules( this.id, this.filterText, this.filterName, this.filterDescription, this.primengTableHelper.getSorting(this.dataTable), this.primengTableHelper.getSkipCount(this.paginator, event), this.primengTableHelper.getMaxResultCount(this.paginator, event) ).subscribe(result => { this.primengTableHelper.totalRecordsCount = result.totalCount; this.primengTableHelper.records = result.items; // console.log(result); //this.primengTableHelper.hideLoadingIndicator(); this.spinnerService.hide(); }); } reloadPage(): void { //this.paginator.changePage(this.paginator.getPage()); this.getReportSchedules(); } delete(id): void { this.message.confirm( '', '', (isConfirmed) => { this.spinnerService.show() if (isConfirmed) { this._reportScheduleServiceProxy.deleteReportSchedules(id) .subscribe(() => { this.reloadPage(); this.notify.success(this.l('SuccessfullyDeleted')); this.spinnerService.hide() }); } } ); } goBack() { this._location.back() } // showAllUsers() : void { // this._reportServiceProxy.getUsersForDropDownReport().subscribe((result) => { // result.forEach(element => { // this.users.push(element); // }); // }); // } }