<div fxLayout="column" fxLayout.gt-sm="row" fxLayoutAlign="space-between stretch">
  <div fxFlex="35" class="modal-qr-code-container padding-gap-large" [fxLayoutAlign]="offer?.bolt12 && offer?.bolt12 !== '' ? 'center start' : 'center center'" [ngClass]="{'display-none': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM}">
    <qr-code *ngIf="offer?.bolt12 && offer?.bolt12 !== ''" [value]="offer?.bolt12" [size]="qrWidth" [errorCorrectionLevel]="'L'"></qr-code>
    <span *ngIf="!offer?.bolt12 || offer?.bolt12 === ''" class="font-size-300">N/A</span>
  </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 class="page-title-img mr-1" [icon]="faReceipt"></fa-icon>
        <span class="page-title">{{screenSize === screenSizeEnum.XS ?  (newlyAdded ? 'Created' : 'Offer') : (newlyAdded ? 'Offer Created' : 'Offer Information')}}</span>
      </div>
      <button tabindex="3" fxFlex="5" fxLayoutAlign="center center" class="btn-close-x p-0" mat-button (click)="onClose()">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" class="modal-qr-code-container padding-gap" [fxLayoutAlign]="offer?.bolt12 && offer?.bolt12 !== '' ? 'center start' : 'center center'" [ngClass]="{'display-none': screenSize !== screenSizeEnum.XS && screenSize !== screenSizeEnum.SM}">
          <qr-code *ngIf="offer?.bolt12 && offer?.bolt12 !== ''" [value]="offer?.bolt12" [size]="qrWidth" [errorCorrectionLevel]="'L'"></qr-code>
          <span *ngIf="!offer?.bolt12 || offer?.bolt12 === ''" class="font-size-120">QR Code Not Applicable</span>
        </div>
        <mat-divider *ngIf="screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM" class="my-1" [inset]="true"></mat-divider>
         <div fxLayout="row">
          <div fxFlex="50">
            <h4 fxLayoutAlign="start" class="font-bold-500">Amount Requested (Sats)</h4>
            <span class="foreground-secondary-text">
              {{ !offerDecoded?.amount_msat || offerDecoded?.amount === 0 ? 'Open Offer' : ((offerDecoded?.amount / 1000) | number) }}
            </span>
          </div>
          <div fxFlex="50">
            <h4 fxLayoutAlign="start" class="font-bold-500">Active</h4>
            <span class="foreground-secondary-text">
              {{!offer?.active ? 'N/K' : offer?.active ? 'Active' : 'Inactive'}}
            </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">
              {{offerDecoded?.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">Offer Request</h4>
            <span class="foreground-secondary-text">{{offer?.bolt12}}</span>
          </div>
        </div>
        <div *ngIf="showAdvanced">
          <mat-divider *ngIf="offer?.used || offer?.single_use" class="w-100 my-1"></mat-divider>
          <div *ngIf="offer?.used || offer?.single_use" fxLayout="row">
            <div fxFlex="50">
              <h4 fxLayoutAlign="start" class="font-bold-500">Used</h4>
              <span class="foreground-secondary-text">
                {{ !offer?.used ? 'N/K' : offer?.used ? 'Yes' : 'No' }}
              </span>
            </div>
            <div fxFlex="50">
              <h4 fxLayoutAlign="start" class="font-bold-500">Single Use</h4>
              <span class="foreground-secondary-text">
                {{ !offer?.single_use ? 'N/K' : offer?.single_use ? 'Yes' : 'No' }}
              </span>
            </div>
          </div>
          <mat-divider  *ngIf="offerDecoded?.vendor || offerDecoded?.issuer" class="w-100 my-1"></mat-divider>   
          <div *ngIf="offerDecoded?.vendor || offerDecoded?.issuer" fxLayout="row">
            <div fxFlex="100">
              <h4 fxLayoutAlign="start" class="font-bold-500">Vendor</h4>
              <span class="overflow-wrap foreground-secondary-text">{{offerDecoded?.vendor || offerDecoded?.issuer}}</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">Offer ID</h4>
              <span class="foreground-secondary-text">{{ offerDecoded.offer_id }}</span>
            </div>
          </div>
          <mat-divider class="w-100 my-1"></mat-divider>   
        </div>
        <div fxLayout="row" fxLayoutAlign="end center" [ngClass]="{'mt-2': !showAdvanced, 'mt-1': showAdvanced}">
          <button class="mr-1" mat-button color="primary" type="reset" tabindex="1" (click)="onShowAdvanced()">
            <p *ngIf="!showAdvanced; else hideAdvancedText">Show Advanced</p>
            <ng-template #hideAdvancedText><p>Hide Advanced</p></ng-template>
          </button>
          <button *ngIf="offer?.bolt12 && offer?.bolt12 !== ''" autoFocus mat-button color="primary" tabindex="2" type="submit" rtlClipboard [payload]="offer?.bolt12" (copied)="onCopyOffer($event)">Copy Offer</button>
          <button *ngIf="!offer?.bolt12 || offer?.bolt12 === ''" autoFocus mat-button color="primary" tabindex="2" type="button" (click)="onClose()">OK</button>
        </div>
      </div>
      </mat-card-content>
  </div>
</div>
