Fix icon metadata

This commit is contained in:
Daniel Ponte 2024-11-26 11:00:54 -05:00
parent 8ea82bf7d4
commit ffef985690
2 changed files with 5 additions and 4 deletions

View file

@ -54,7 +54,6 @@ export class TalkgroupRecordComponent {
weight: new FormControl(this.tg.weight), weight: new FormControl(this.tg.weight),
icon: new FormControl(this.tg.icon), icon: new FormControl(this.tg.icon),
}); });
console.log(this.tg.icon);
}); });
} }
@ -83,14 +82,15 @@ export class TalkgroupRecordComponent {
tgu.weight = Number(this.form.controls['weight'].value); tgu.weight = Number(this.form.controls['weight'].value);
} }
if (this.form.controls['icon'].dirty) { if (this.form.controls['icon'].dirty) {
let iv: string = this.form.controls['icon'].value;
if (tgu.metadata == null) { if (tgu.metadata == null) {
tgu.metadata = {}; tgu.metadata = {};
} }
if (this.tg.icon == null || this.tg.icon == '') { if (iv == '') {
tgu.metadata = Object.assign(tgu.metadata, { icon: undefined }); tgu.metadata = Object.assign(tgu.metadata, { icon: undefined });
} else { } else {
tgu.metadata = Object.assign(tgu.metadata!, { tgu.metadata = Object.assign(tgu.metadata!, {
icon: this.form.controls['icon'], icon: iv,
}); });
} }
} }

View file

@ -1,5 +1,4 @@
<div class="w-100 justify-center overflow-x-auto"> <div class="w-100 justify-center overflow-x-auto">
<a href="#" class="btn btn-primary" routerLink="/talkgroups/import">Import</a>
<div class="rounded-lg border border-gray-200 dark:border-gray-700"> <div class="rounded-lg border border-gray-200 dark:border-gray-700">
<div class="overflow-x-auto rounded-t-lg"> <div class="overflow-x-auto rounded-t-lg">
<table <table
@ -177,3 +176,5 @@
</div> </div>
</div> </div>
</div> </div>
<a href="#" class="btn btn-primary" routerLink="/talkgroups/import">Import</a>