Morsksa K5 data parser
This commit is contained in:
@@ -5,7 +5,6 @@ import { UntypedFormGroup, UntypedFormBuilder, FormsModule, ReactiveFormsModule
|
||||
import { MatSort, MatSortable, MatSortModule } from '@angular/material/sort';
|
||||
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { AuthService } from 'src/app/auth/auth.service';
|
||||
import { Layer } from 'src/app/models/layer.model';
|
||||
import { Record } from 'src/app/models/record.model';
|
||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
@@ -32,6 +31,8 @@ export class LayerDetailComponent implements OnInit {
|
||||
public form!: UntypedFormGroup;
|
||||
public document!: Layer;
|
||||
|
||||
valueSum = 0;
|
||||
|
||||
displayedColumns = environment.views.layers.recordColumns.split("|");
|
||||
dataSource!: MatTableDataSource<Record>;
|
||||
|
||||
@@ -54,6 +55,7 @@ export class LayerDetailComponent implements OnInit {
|
||||
this.form.disable();
|
||||
this.document.created = `${this.datePipe.transform(this.document.createdAt?.toDate(), 'short')}, ${this.document.createdBy?.userName}`;
|
||||
this.dataSource.sort.sort({ id: 'code', start: 'desc' } as MatSortable);
|
||||
this.valueSum = this.document.records.map(t => t.value || 0).reduce((acc, value) => acc + value, 0);
|
||||
}
|
||||
private async load(): Promise<Layer> {
|
||||
return await Layer.getById(this.route$.snapshot.paramMap.get('id') || "", this.http$);
|
||||
|
||||
Reference in New Issue
Block a user