<html>
<head>
<title>Credit Card Offers for Publisher {{ publisher }}</title>
<style>
  h2 {
    margin: 3ex 0 1ex;
  }
  td.cardName {
    padding-bottom: 2ex;
  }
  td {
    vertical-align: top;
    overflow: auto;
  }
  tr.details td {
    padding: 0 3ex;
  }
  td pre {
    margin: 3ex 3em;
    width: 500px;
  }
</style>
<script>
  function toggleDisplay(id) {
    el = document.getElementById(id);
    if (el.style.display == "none") {
      el.style.display = "block"
    } else {
      el.style.display = "none"
    }
  }
</script>
</head>
<body>
<h1>Credit Card Offers for Publisher {{ publisher }}</h1>
<table>
{% for item in items %}
<tr>
<td colspan=3 class="cardName">
  <h2>{{ item.cardName }}</h2>
  {{ item.network }} from {{ item.issuer }} - <a href="{{ item.trackingUrl }}">Click to apply</a>
  - <a href="javascript:toggleDisplay('pre{{forloop.counter}}');">debug</a>
<tr class="details">
<td>
  {% if item.imageUrl %}
  <img src="{{ item.imageUrl }}" title="Image from GAN" />
  {% endif %}
  {% if item.logoUrl %}
  <img src="{{ item.logoUrl }}" title="Image from AdConnect" />
  {% endif %}
  {% if item.disclaimer %}
  <div>{{ item.disclaimer }}</div>
  {% endif %}
<td>
  <div>APR: {{ item.aprDisplay }}</div>
  <div>Annual Fee: {{ item.annualFeeDisplay }}</div>
  <div>Grace Period: {{ item.gracePeriodDisplay }}</div>
  <div>Late Payment Fee: {{ item.latePaymentFee }}</div>
  <div>Credit Rating: {{ item.creditRatingDisplay }}</div>
<td>
  {% if item.introAprDisplay %}
  <div>Intro APR: {{ item.introAprDisplay }}</div>
  {% endif %}
  {% if item.balanceTransferAprDisplay %}
  <div>Balance Transfer APR: {{ item.balanceTransferAprDisplay }}</div>
  {% endif %}
  {% if item.balanceTransferFeeDisplay %}
  <div>Balance Transfer Fee: {{ item.balanceTransferFeeDisplay }}</div>
  {% endif %}
  {% if item.cashAdvanceAprDisplay %}
  <div>Cash Advance APR: {{ item.cashAdvanceAprDisplay }}</div>
  {% endif %}
  {% if item.cashAdvanceFeeDisplay %}
  <div>Cash Advance Fee: {{ item.cashAdvanceFeeDisplay }}</div>
  {% endif %}
<!--
<td>
  Card benefits: <ul>
    {% for benefit in item.cardBenefits %}
    <li> {{ benefit }} </li>
    {% endfor %}
  </ul>
<td>
  Additional benefits: <ul>
    {% for benefit in item.additionalCardBenefits %}
    <li> {{ benefit }} </li>
    {% endfor %}
  </ul>
-->
</tr>
<tr><td colspan=3><pre id="pre{{forloop.counter}}" style="display:none">
{{ item|pprint|linebreaks }}</pre>
{% empty %}
<tr><td>
<h2>Whoops, {{ publisher }} has no associated credit card offers.</h2>
{% endfor %}
</table>
</body>
</html>
