Browse Source

refactor(ui): apply review feedback for form control disabled logic and isNil

Signed-off-by: Sigmabrogz <sigmabrogz@gmail.com>
pull/6495/head
Sigmabrogz 3 weeks ago
parent
commit
268d3c7b19
  1. 5
      libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.component.ts
  2. 6
      libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.html

5
libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.component.ts

@ -24,6 +24,7 @@ import { MatInputModule } from '@angular/material/input';
import { IonIcon } from '@ionic/angular/standalone'; import { IonIcon } from '@ionic/angular/standalone';
import { addIcons } from 'ionicons'; import { addIcons } from 'ionicons';
import { calendarClearOutline, refreshOutline } from 'ionicons/icons'; import { calendarClearOutline, refreshOutline } from 'ionicons/icons';
import { isNil } from 'lodash';
import { HistoricalMarketDataEditorDialogParams } from './interfaces/interfaces'; import { HistoricalMarketDataEditorDialogParams } from './interfaces/interfaces';
@ -95,7 +96,7 @@ export class GfHistoricalMarketDataEditorDialogComponent implements OnInit {
public onUpdate() { public onUpdate() {
const marketPrice = this.form.controls.marketPrice.value; const marketPrice = this.form.controls.marketPrice.value;
if (marketPrice === undefined || marketPrice === null) { if (isNil(marketPrice)) {
return; return;
} }
@ -106,7 +107,7 @@ export class GfHistoricalMarketDataEditorDialogComponent implements OnInit {
marketData: [ marketData: [
{ {
date: this.data.dateString, date: this.data.dateString,
marketPrice: marketPrice marketPrice
} }
] ]
}, },

6
libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.html

@ -6,10 +6,10 @@
<mat-label i18n>Date</mat-label> <mat-label i18n>Date</mat-label>
<input <input
disabled disabled
formControlName="dateString"
matInput matInput
name="date" name="date"
[matDatepicker]="date" [matDatepicker]="date"
formControlName="dateString"
/> />
<mat-datepicker-toggle class="mr-2" matSuffix [for]="date"> <mat-datepicker-toggle class="mr-2" matSuffix [for]="date">
<ion-icon <ion-icon
@ -25,10 +25,10 @@
<mat-form-field appearance="outline" class="w-100"> <mat-form-field appearance="outline" class="w-100">
<mat-label i18n>Market Price</mat-label> <mat-label i18n>Market Price</mat-label>
<input <input
formControlName="marketPrice"
matInput matInput
name="marketPrice" name="marketPrice"
type="number" type="number"
formControlName="marketPrice"
/> />
<span class="ml-2" matTextSuffix>{{ data.currency }}</span> <span class="ml-2" matTextSuffix>{{ data.currency }}</span>
</mat-form-field> </mat-form-field>
@ -47,7 +47,7 @@
<button <button
color="primary" color="primary"
mat-flat-button mat-flat-button
[disabled]="!form.dirty" [disabled]="!(form.dirty && form.valid)"
(click)="onUpdate()" (click)="onUpdate()"
> >
<ng-container i18n>Save</ng-container> <ng-container i18n>Save</ng-container>

Loading…
Cancel
Save