
{{~#*inline "format-money"~}}
{{money-amount money}} {{money.currency}}
{{~/inline~}}

{{~#*inline "format-date"~}}
{{date date format="MMM d, YYYY"}}
{{~/inline~}}

<html>
  <body>
    {{#with transaction}}
    <h1>Please respond to a request by {{customer.display-name}}</h1>

    <p>Good news! {{customer.display-name}} just requested to book {{listing.title}} from {{> format-date date=booking.start}} to {{> format-date date=booking.end}}. Here's the breakdown.</p>

    <table>
      <thead>
        <tr>
          <th style="text-align: left;">Payment</th>
        </tr>
      </thead>
      <tbody>
      {{#each line-items}}
        {{#contains include-for "provider"}}
          <tr>
            {{#eq "day" code}}
            <td>{{> format-money money=unit-price}} &times; {{number quantity}} {{inflect quantity "day" "days"}}</td>
            <td style="text-align: right; padding-left: 20px">{{> format-money money=line-total}}</td>
            {{/eq}}

            {{#eq "night" code}}
            <td>{{> format-money money=unit-price}} &times; {{number quantity}} {{inflect quantity "night" "nights"}}</td>
            <td style="text-align: right; padding-left: 20px">{{> format-money money=line-total}}</td>
            {{/eq}}

            {{#eq "provider-commission" code}}
            <td>{{marketplace.name}} fee:</td>
            <td style="text-align: right; padding-left: 20px;">{{> format-money money=line-total}}</td>
            {{/eq}}
          </tr>
        {{/contains}}
      {{/each}}
      </tbody>
      <tfoot>
        <tr>
          <th style="text-align: left;">You earn</th>
          <th style="text-align: left; padding-left: 20px;">{{> format-money money=payout-total}}</th>
        </tr>
      </tfoot>
    </table>

    <p>You need to accept the request by {{> format-date date=delayed-transition.run-at}}. Otherwise the request will be expired and you won't get paid. If the booked dates won't work for you, you can also choose to decline the request.</p>

    <p><a href="{{marketplace.url}}/sale/{{url-encode id}}/details">Accept or decline the booking</a></p>

    {{/with}}
  </body>
</html>