Morsksa K5 data parser
This commit is contained in:
@@ -4,26 +4,25 @@
|
||||
<mat-toolbar color="secondary">
|
||||
Layer details
|
||||
<span class="fill-to-right"></span>
|
||||
<button mat-button (click)="export()">Export to Google</button>
|
||||
</mat-toolbar>
|
||||
<mat-card-content>
|
||||
<mat-grid-list cols="2" rowHeight="90px">
|
||||
<mat-grid-tile>
|
||||
<mat-form-field class="detail-input">
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Name</mat-label>
|
||||
<input matInput formControlName="name">
|
||||
</mat-form-field>
|
||||
</mat-grid-tile>
|
||||
|
||||
<mat-grid-tile>
|
||||
<mat-form-field class="detail-input">
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Source</mat-label>
|
||||
<input matInput formControlName="source">
|
||||
</mat-form-field>
|
||||
</mat-grid-tile>
|
||||
|
||||
<mat-grid-tile *ngIf="document">
|
||||
<mat-form-field class="detail-input">
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Created</mat-label>
|
||||
<input matInput disabled [value]="document.created">
|
||||
</mat-form-field>
|
||||
@@ -50,6 +49,7 @@
|
||||
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||
<mat-row *matRowDef="let item; columns: displayedColumns;"></mat-row>
|
||||
</mat-table>
|
||||
Checksum: {{valueSum}}
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</form>
|
||||
|
||||
@@ -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