mirror of
https://github.com/valitydev/koffing.git
synced 2024-11-06 09:15:20 +00:00
fix: added report statuses (#224)
This commit is contained in:
parent
6fa83194dd
commit
d13584d7eb
@ -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;
|
||||
}
|
||||
|
@ -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 { }
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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")
|
||||
|
@ -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) => {
|
||||
|
Loading…
Reference in New Issue
Block a user