Layer type on list

This commit is contained in:
Michał Zieliński
2023-08-22 19:26:08 +02:00
parent f4978009b5
commit dd64b34fa3
7 changed files with 110 additions and 135 deletions

View File

@@ -5,6 +5,13 @@ import { environment } from 'src/environments/environment';
import { map } from 'rxjs';
import { Record } from 'src/app/models/record.model';
export enum LayerType {
Ipmort,
Processed,
Administration,
Dictionary
}
export class Layer extends Base {
// eslint-disable-next-line @typescript-eslint/ban-types
number?: Number;
@@ -12,7 +19,7 @@ export class Layer extends Base {
name?: string;
records: Record[] = [];
created?: string;
type?: 'import' | 'processed';
type?: LayerType = LayerType.Ipmort;
constructor(data: Partial<Layer> = {}) {
super();
@@ -21,6 +28,8 @@ export class Layer extends Base {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
override deserialize(input: any): this {
Object.assign(this, Object.assign(this, super.deserialize(input)));
console.log(input.type);
console.log(this.type);
if (this.records) { this.records = this.records.map(x => new Record().deserialize(x)); }
return this;
}
@@ -33,7 +42,7 @@ export class Layer extends Base {
id: [null],
name: ['', Validators.required],
source: ['', Validators.required],
sheetId: '1G_Hu8DTP-PSPNXTaVYhc_ppnTQi6HWoA4oXSSdUmM9E',
sheetId: '',
createdAt: '',
modifiedAt: '',
createdBy: '',
@@ -51,7 +60,8 @@ export class Layer extends Base {
}
loadForm(form: UntypedFormGroup) {
for (const field of Object.keys(form.controls)) {
this[field as keyof Layer] = form.controls[field].value;
console.log(field);
//this[field as keyof Layer] = form.controls[field].value;
}
this.createdBy = undefined;
this.modifiedBy = undefined;