fix: added report statuses (#224)

This commit is contained in:
Alexandra Usacheva 2018-10-04 13:54:33 +03:00 committed by GitHub
parent 6fa83194dd
commit d13584d7eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 3 deletions

View File

@ -5,6 +5,11 @@ export enum ReportType {
paymentRegistry = 'paymentRegistry'
}
export enum ReportStatus {
pending = 'pending',
created = 'created'
}
export class Report {
public id: number;
public createdAt: string;
@ -12,4 +17,5 @@ export class Report {
public toTime: string;
public type: ReportType;
public files: FileMeta[];
public status: ReportStatus;
}

View File

@ -9,6 +9,7 @@ import { SearchReportsResultComponent } from './reports/search-result/search-rep
import { ReportFilesComponent } from './reports/search-result/report-files/report-files.component';
import { ReportsComponent } from './reports/reports.component';
import { ReportsService } from 'koffing/backend/reports.service';
import { ReportStatusPipe } from './reports/search-result/report-status.pipe';
@NgModule({
providers: [ReportsService],
@ -22,7 +23,8 @@ import { ReportsService } from 'koffing/backend/reports.service';
DocumentsComponent,
SearchReportsResultComponent,
ReportFilesComponent,
ReportsComponent
ReportsComponent,
ReportStatusPipe
]
})
export class DocumentsModule { }

View File

@ -0,0 +1,17 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'kofReportStatus'
})
export class ReportStatusPipe implements PipeTransform {
private STATUSES = {
pending: 'В процессе формирования',
created: 'Сформирован'
};
public transform(input: string): string {
const status = this.STATUSES[input];
return status ? status : input;
}
}

View File

@ -4,14 +4,16 @@ table.table.table-striped
th Идентификатор
th.hidden-xs Временной интервал
th Время создания
th Статус
th
tbody(*ngFor="let item of filtered(reportItems)")
tr
td {{item.report.id}}
td.hidden-xs {{item.report.fromTime | date: "dd.MM.yyyy"}} - {{item.report.toTime | date: "dd.MM.yyyy"}}
td {{item.report.createdAt | date: "dd.MM.yyyy HH:mm:ss"}}
td {{item.report.status | kofReportStatus}}
td
.pull-right
.pull-right(*ngIf="item.report.status === reportStatuses.created")
button.btn.btn-xs.btn-default((click)="toggleFilesPanel(item)")
| {{item.isVisible ? 'Скрыть' : 'Показать'}} файлы
tr(*ngIf="item.isVisible")

View File

@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { get } from 'lodash';
import { Report } from 'koffing/backend';
import { Report, ReportStatus } from 'koffing/backend';
import { ReportTableItem } from './report-item';
import { ReportsFilter } from '../reports-filter';
@ -19,6 +19,7 @@ export class SearchReportsResultComponent implements OnInit {
public filter: ReportsFilter;
public reportItems: ReportTableItem[];
public reportStatuses = ReportStatus;
public ngOnInit() {
this.reports$.subscribe((reports) => {