<div fxLayout="row">
  <div fxFlex="100">
    <mat-card-header fxLayout="row" fxLayoutAlign="space-between center" class="modal-info-header">
      <div fxFlex="95" fxLayoutAlign="start start">
        <span class="page-title">Create Invoice</span>
      </div>
      <button tabindex="8" fxFlex="5" fxLayoutAlign="center center" class="btn-close-x p-0" default mat-button [mat-dialog-close]="false">X</button>
    </mat-card-header>
    <mat-card-content class="padding-gap-x-large">
      <form #addInvoiceForm="ngForm" fxLayout="row wrap" fxLayoutAlign="start space-between" fxFlex="100">
        <mat-form-field fxLayout="column" fxFlex="100" fxLayoutAlign="start end">
          <mat-label>Description</mat-label>
          <input matInput autoFocus tabindex="2" name="description" required [(ngModel)]="description">
          <mat-error *ngIf="!description">Description is required.</mat-error>
        </mat-form-field>
        <div fxLayout="row" fxLayoutAlign="space-between start" fxFlex="100">
          <mat-form-field fxLayout="column" fxFlex="40">
            <mat-label>Amount</mat-label>
            <input matInput type="number" tabindex="3" name="invValue" [step]="100" [min]="1" [(ngModel)]="invoiceValue" (keyup)="onInvoiceValueChange()">
            <span matSuffix>  Sats </span>
            <mat-hint>{{invoiceValueHint}}</mat-hint>
          </mat-form-field>
          <mat-form-field fxLayout="column" fxFlex="30">
            <mat-label>Expiry</mat-label>
            <input matInput type="number" name="exp" tabindex="4" [step]="selTimeUnit === timeUnitEnum.SECS ? 300 : selTimeUnit === timeUnitEnum.MINS ? 10 : selTimeUnit === timeUnitEnum.HOURS ? 2 : 1" [min]="1" [(ngModel)]="expiry">
            <span matSuffix>{{selTimeUnit | titlecase}} </span>
          </mat-form-field>
          <mat-form-field fxLayout="column" fxFlex="26">
            <mat-select tabindex="5" name="timeUnit" [value]="selTimeUnit" (selectionChange)="onTimeUnitChange($event)">
              <mat-option *ngFor="let timeUnit of timeUnits" [value]="timeUnit">{{timeUnit | titlecase}}</mat-option>
            </mat-select>
          </mat-form-field>
        </div>
        <div *ngIf="invoiceError !== ''" fxFlex="100" class="alert alert-danger mt-1">
          <fa-icon class="mr-1 alert-icon" [icon]="faExclamationTriangle"></fa-icon>
          <span *ngIf="invoiceError !== ''">{{invoiceError}}</span>
        </div>
        <div fxLayout="row" fxFlex="100" class="mt-2" fxLayoutAlign="end center">
          <button class="mr-1" mat-button color="primary" tabindex="7" type="reset" (click)="resetData()">Clear Field</button>
          <button mat-button color="primary" tabindex="8" (click)="onAddInvoice(addInvoiceForm)">Create Invoice</button>
        </div>
      </form>
    </mat-card-content>
  </div>      
</div>
