<div fxLayout="column" fxLayout.gt-sm="row" fxLayoutAlign="space-between stretch">
  <div fxFlex="35" fxLayoutAlign="center start" class="modal-qr-code-container padding-gap-large" [ngClass]="{'display-none': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM}">
    <qrcode [qrdata]="invoice.serialized" [margin]="2" [width]="qrWidth" [errorCorrectionLevel]="'L'" [allowEmptyString]="true"></qrcode>
  </div>
  <div fxFlex="65">
    <mat-card-header fxLayout="row" fxLayoutAlign="space-between center" class="modal-info-header">
      <div fxFlex="95" fxLayoutAlign="start start">
        <fa-icon [icon]="faReceipt" class="page-title-img mr-1"></fa-icon>
        <span class="page-title">{{screenSize === screenSizeEnum.XS ?  (newlyAdded ? 'Created' : 'Invoice') : (newlyAdded ? 'Invoice Created' : 'Invoice Information')}}</span>
      </div>
      <button tabindex="3" fxFlex="5" fxLayoutAlign="center" class="btn-close-x p-0" (click)="onClose()" mat-button>X</button>
    </mat-card-header>
    <mat-card-content class="padding-gap-x-large" [ngClass]="{'xs-scroll-y': screenSize === screenSizeEnum.XS}">
      <div fxLayout="column">
        <div fxFlex="30" fxLayoutAlign="center start" class="modal-qr-code-container padding-gap" [ngClass]="{'display-none': screenSize !== screenSizeEnum.XS && screenSize !== screenSizeEnum.SM}">
          <qrcode [qrdata]="invoice.serialized" [margin]="2" [width]="qrWidth" [errorCorrectionLevel]="'L'" [allowEmptyString]="true"></qrcode>
        </div>
        <div fxLayout="row">
          <div fxFlex="50">
            <h4 fxLayoutAlign="start" class="font-bold-500">Amount Requested</h4>
            <span class="foreground-secondary-text">{{(invoice.amount || 0) | number}} Sats<ng-container *ngIf="!invoice.amount"> (zero amount) </ng-container></span>
          </div>
          <div fxFlex="50">
            <h4 fxLayoutAlign="start" class="font-bold-500">Amount Settled</h4>
            <span class="foreground-secondary-text">
              <ng-container *ngIf="invoice.amountSettled">{{invoice.amountSettled | number}} Sats</ng-container>
              <ng-container *ngIf="!invoice.amountSettled">-</ng-container>
            </span>
          </div>
        </div>
        <mat-divider class="w-100 my-1"></mat-divider>   
        <div fxLayout="row">
          <div fxFlex="50">
            <h4 fxLayoutAlign="start" class="font-bold-500">Date Created</h4>
            <span class="overflow-wrap foreground-secondary-text">{{invoice.timestampStr}}</span>
          </div>
          <div fxFlex="50">
            <h4 fxLayoutAlign="start" class="font-bold-500">Status</h4>
            <span class="overflow-wrap foreground-secondary-text">{{invoice.status | titlecase}}</span>
          </div>
        </div>
        <mat-divider class="w-100 my-1"></mat-divider>   
        <div fxLayout="row">
          <div fxFlex="100">
            <h4 fxLayoutAlign="start" class="font-bold-500">Description</h4>
            <span class="foreground-secondary-text">{{invoice.description || '-'}}</span>
          </div>
        </div>
        <mat-divider class="w-100 my-1"></mat-divider>        
        <div fxLayout="row">
          <div fxFlex="100">
            <h4 fxLayoutAlign="start" class="font-bold-500">Invoice</h4>
            <span class="overflow-wrap foreground-secondary-text">{{invoice.serialized}}</span>
          </div>
        </div>
        <div *ngIf="showAdvanced">
          <mat-divider class="w-100 my-1"></mat-divider>        
          <div fxLayout="row">
            <div fxFlex="40">
              <h4 fxLayoutAlign="start" class="font-bold-500">Date Expiry</h4>
              <span class="foreground-secondary-text">{{invoice.expiresAtStr}}</span>
            </div>
            <div fxFlex="60">
              <h4 fxLayoutAlign="start" class="font-bold-500">Date Settled</h4>
              <span class="overflow-wrap foreground-secondary-text">{{invoice.receivedAtStr}}</span>
            </div>
          </div>
          <mat-divider class="w-100 my-1"></mat-divider>        
          <div fxLayout="row">
            <div fxFlex="100">
              <h4 fxLayoutAlign="start" class="font-bold-500">Payment Hash</h4>
              <span class="overflow-wrap foreground-secondary-text">{{invoice.paymentHash}}</span>
            </div>
          </div>
          <mat-divider class="w-100 my-1"></mat-divider>        
          <div fxLayout="row">
            <div fxFlex="100">
              <h4 fxLayoutAlign="start" class="font-bold-500">Node Id</h4>
              <span class="overflow-wrap foreground-secondary-text">{{invoice.nodeId}}</span>
            </div>
          </div>
          <mat-divider class="w-100 my-1"></mat-divider>        
        </div>
        <div [ngClass]="{'mt-2': !showAdvanced, 'mt-1': showAdvanced}" fxLayout="row" fxLayoutAlign="end center">
          <button class="mr-1" mat-stroked-button color="primary" type="reset" (click)="onShowAdvanced()" tabindex="1">
            <p *ngIf="!showAdvanced; else hideAdvancedText">Show Advanced</p>
            <ng-template #hideAdvancedText><p>Hide Advanced</p></ng-template>
          </button>
          <button autoFocus mat-flat-button color="primary" tabindex="2" type="submit" rtlClipboard [payload]="invoice.serialized" (copied)="onCopyPayment($event)">Copy Invoice</button>
        </div>
      </div>
      </mat-card-content>
  </div>
</div>
