Sha256: 3b55e2dd185f0c36a1d0dee01a1e33c5ed9f2aad7fd702e04807dd7af9920b6f

Contents?: true

Size: 1.82 KB

Versions: 6

Compression:

Stored size: 1.82 KB

Contents

<%= render 'header' %>

<h1><%= @coupon.stripe_id %></h1>
<h2><%= "#{@coupon.percent_off}\% off #{@coupon.duration}" %></h2>
<hr>

<h3>Coupon details</h3>
<div class="card card-block">
  <dl class="card-text">
    <dt>ID:</dt>
    <dd><%= @coupon.stripe_id %></dd>

    <% if @coupon.percent_off.present? %>
      <dt>Percent off:</dt>
      <dd><%= "#{@coupon.percent_off}\% off" %></dd>
    <% end %>

    <% if @coupon.amount_off.present? %>
      <dt>Amount off:</dt>
      <dd><%= "#{number_to_currency(@coupon.amount_off.to_f / 100.0)} #{@coupon.currency.upcase} off" %></dd>
    <% end %>

    <dt>Duration:</dt>
    <% if @coupon.duration == 'once' %>
      <dd>once</dd>
    <% elsif @coupon.duration == 'repeating' %>
      <dd><%= "#{@coupon.duration_in_months} months" %></dd>
    <% elsif @coupon.duration == 'forever' %>
      <dd>forever</dd>
    <% end %>

    <% if @coupon.max_redemptions.present? %>
      <dt>Max redemptions:</dt>
      <dd><%= @coupon.max_redemptions %> times</dd>
    <% end %>

    <% if @coupon.redeem_by.present? %>
      <dt>Redeem by:</dt>
      <dd><%= @coupon.redeem_by.strftime('%Y/%m/%d %H:%m') %></dd>
    <% end %>

    <dt>Valid:</dt>
    <dd><%= @coupon.coupon_valid? %></dd>
  </dl>
</div>

<h3>Active redemptions</h3>
<div class="card">
  <table class="table table-responsive card-text">
    <tbody>
      <% if @coupon.active_redemptions.any? %>
        <% @coupon.active_redemptions.each do |customer| %>
          <tr><td><%= link_to customer.email, admin_customer_path(customer) %></td></tr>
        <% end %>
      <% else %>
        <tr><td>No active redemptions</td></tr>
      <% end %>
    </tbody>
  </table>
</div>

<hr>
<%= link_to 'Delete Coupon', tang.admin_coupon_path(@coupon), method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger float-md-right' %>

<%= render 'footer' %>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tang-0.2.2 app/views/tang/admin/coupons/show.html.erb
tang-0.2.1 app/views/tang/admin/coupons/show.html.erb
tang-0.2.0 app/views/tang/admin/coupons/show.html.erb
tang-0.1.0 app/views/tang/admin/coupons/show.html.erb
tang-0.0.9 app/views/tang/admin/coupons/show.html.erb
tang-0.0.8 app/views/tang/admin/coupons/show.html.erb