<ion-modal-view ng-controller="amazonCardDetailsController">
  <ion-header-bar align-title="center" class="bar-royal">
    <button class="button button-back button-clear" ng-click="cancel()">
      Close
    </button>
    <h1 class="title">Details</h1>
  </ion-header-bar>

  <ion-content>

      <div class="header-modal text-center">
        <img src="img/a_generic.jpg" alt="Amazon.com Gift Card" width="230" ng-click="refreshGiftCard()">

        <div class="m10t">
          Gift Card Amount:
          <span class="text-bold">
            {{card.amount | currency : '$ ' : 2}}
          </span>
        </div>


        <div class="m10t">
          Created
            {{card.date | amTimeAgo}}
        </div>


        <div ng-show="card.claimCode">
          <div ng-show="card.cardStatus !== 'Canceled'">
            Claim code: <span class="text-bold" copy-to-clipboard="card.claimCode">{{card.claimCode}}</span>
          </div>
          <div class="m10t" ng-show="card.cardStatus == 'Fulfilled'">
            <button class="button button-positive"
                    ng-click="openExternalLink('https://www.amazon.com/gc/redeem?claimCode=' + card.claimCode)">
              Redeem Now
            </button>
          </div>
          <div class="m10t" ng-show="card.cardStatus == 'Canceled'">
            <div class="m10t">
              Status:
              <span class="text-bold">
                CANCELED
              </span>
            </div>
          </div>
        </div>
        <div ng-show="!card.claimCode">
          <div class="m10t">
            Status:
            <span class="text-bold" ng-show="card.status == 'PENDING'">
              PENDING
            </span>
            <span class="text-bold" ng-show="card.status=='invalid'">
              STILL PENDING
            </span>

            <span class="text-bold" ng-show="card.status == 'FAILURE' || card.status == 'RESEND'">
              FAILURE
            </span>
            <span class="text-bold" ng-show="card.status == 'expired'">
              EXPIRED
            </span>
          </div>
        </div>
        <div class="m10t text-center">
          <a class="button button-clear button-calm" ng-click="openExternalLink(card.invoiceUrl)">See invoice</a>
        </div>
      </div>

      <div class="box-notification warning" ng-show="card.status == 'FAILURE' || card.status == 'RESEND'">
          There was a failure to the create gift card. Please, contact BitPay support.
      </div>

      <div class="oh m20t size-12 p15h" ng-show="card.claimCode && card.cardStatus == 'Fulfilled'">
        To redeem your gift card, follow these steps:

        <ol class="m10t size-12">
          <li>1. Visit <a ng-click="openExternalLink('https://www.amazon.com/gc')">www.amazon.com/gc</a>
          <li>2. Click Apply to Account and enter the Claim Code when prompted.
          <li>3. Gift card funds will be applied automatically to eligible orders during the checkout process.
          <li>4. You must pay for any remaining balance on your order with another payment method.
        </ol>

        <p class="size-12">
        Your gift card claim code may also be entered when prompted during checkout. To redeem your gift card using
        the Amazon.com 1-Click&reg; service, first add the gift card funds to Your Account.
        </p>

        <p class="size-12">
        If you have questions about redeeming your gift card, please visit
        <a ng-click="openExternalLink('https://www.amazon.com/gc-redeem')">www.amazon.com/gc-redeem</a>.
        If you have questions regarding the BitPay Introductory offer, please contact BitPay.
        </p>

      </div>

      <div class="size-12 p15 m30v">
        * <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a> is not a sponsor of this promotion.
        Except as required by law, <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a>
        Gift Cards ("GCs") cannot be transferred for value or redeemed for cash. GCs may be used only for purchases of
        eligible goods at <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a> or certain of its
        affiliated websites. For complete terms and conditions, see
        <a ng-click="openExternalLink('https://www.amazon.com/gc-legal')">www.amazon.com/gc-legal</a>.
        GCs are issued by ACI Gift Cards, Inc., a Washington corporation. All Amazon &reg;, &trade; &amp; &copy; are IP
        of <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a>, Inc. or its affiliates.
        No expiration date or service fees.
      </div>

      <div class="list text-center">
        <a class="item" ng-show="card.status == 'SUCCESS' && card.cardStatus == 'Fulfilled'" ng-click="cancelGiftCard()">
          <span class="assertive">Cancel</span>
        </a>
        <a class="item" ng-show="card.status == 'FAILURE' || card.cardStatus == 'Canceled'
          || card.cardStatus == 'Expired' || card.status == 'expired'" ng-click="remove()">
          <span class="assertive">Remove</span>
        </a>
      </div>

  </ion-content>
</ion-modal-view>
