|
1 | 1 | {%- default voucher: nil %} |
2 | 2 |
|
3 | 3 | <div class="sc-container sc-container-spacious"> |
4 | | - {%- render "shared/page_header", heading: "t.vouchers.show.heading", sub_heading: current_request.params["code"] %} |
5 | | - |
6 | 4 | {%- if voucher == blank %} |
7 | 5 | {% if current_request.params.code != blank %} |
8 | 6 | <div class="sc-mt-large sc-mb-large"> |
9 | 7 | {{ "vouchers.show.not_found" | t }} |
10 | 8 | </div> |
11 | 9 | {%- endif %} |
12 | 10 | {%- else %} |
13 | | - <table class="sc-compact sc-mb-large"> |
14 | | - <tr> |
15 | | - <th>{{ "vouchers.show.balance" | t }}</th> |
16 | | - <th>{{ "vouchers.show.expires" | t }}</th> |
17 | | - </tr> |
18 | | - <tr> |
19 | | - <td data-th="{{ "vouchers.show.balance" | t }}">{{ voucher.current_balance | money }}</td> |
20 | | - <td data-th="{{ "vouchers.show.expires" | t }}"> |
21 | | - {%- if voucher.expires_at == blank %} |
22 | | - {{ "vouchers.show.no_expiry" | t }} |
23 | | - {%- else %} |
24 | | - {% render "shared/date", timestamp: voucher.expires_at %} |
25 | | - {%- endif %} |
26 | | - </td> |
27 | | - </tr> |
28 | | - </table> |
29 | | - {%- if voucher.orders.size > 0 %} |
30 | | - <h2>{{ "vouchers.show.orders.heading" | t }}</h2> |
31 | | - <table class="sc-compact sc-mb-spacious"> |
| 11 | + {%- if voucher.requires_activation? %} |
| 12 | + {%- render "shared/page_header", heading: "t.vouchers.show.activation_form.heading", sub_heading: current_request.params["code"] %} |
| 13 | + {%- else %} |
| 14 | + {%- render "shared/page_header", heading: "t.vouchers.show.heading", sub_heading: current_request.params["code"] %} |
| 15 | + {%- endif %} |
| 16 | + |
| 17 | + {%- if voucher.requires_activation? %} |
| 18 | + <div class="sc-mt-large"> |
| 19 | + {% form "activate-voucher", voucher: voucher %} |
| 20 | + <span> |
| 21 | + <input |
| 22 | + type="text" |
| 23 | + name="activation_code" |
| 24 | + placeholder="{{ 'vouchers.show.activation_form.activation_code' | t }}" |
| 25 | + class="SC-Field_input" |
| 26 | + > |
| 27 | + </span> |
| 28 | + <span class="sc-pl-medium"> |
| 29 | + <input |
| 30 | + type="submit" |
| 31 | + name="commit" |
| 32 | + value="{{ 'vouchers.show.activation_form.submit' | t }}" |
| 33 | + class="SC-Button SC-Button-small SC-Button-primary sc-font-small" |
| 34 | + data-disable-with="{{ 'vouchers.show.activation_form.submit'| t }}" |
| 35 | + > |
| 36 | + </span> |
| 37 | + {% endform %} |
| 38 | + </div> |
| 39 | + {%- else %} |
| 40 | + <table class="sc-compact sc-mb-large sc-mt-large"> |
| 41 | + <tr> |
| 42 | + <th>{{ "vouchers.show.balance" | t }}</th> |
| 43 | + <th>{{ "vouchers.show.expires" | t }}</th> |
| 44 | + </tr> |
32 | 45 | <tr> |
33 | | - <th>{{ "vouchers.show.orders.reference" | t }}</th> |
34 | | - <th>{{ "vouchers.show.orders.date" | t }}</th> |
35 | | - <th>{{ "vouchers.show.orders.total" | t }}</th> |
| 46 | + <td data-th="{{ "vouchers.show.balance" | t }}"><p class="sc-mt-small">{{ voucher.current_balance | money }}</p></td> |
| 47 | + <td data-th="{{ "vouchers.show.expires" | t }}"> |
| 48 | + <p class="sc-mt-small"> |
| 49 | + {%- if voucher.expires_at == blank %} |
| 50 | + {{ "vouchers.show.no_expiry" | t }} |
| 51 | + {%- else %} |
| 52 | + {% render "shared/date", timestamp: voucher.expires_at %} |
| 53 | + {%- endif %} |
| 54 | + </p> |
| 55 | + </td> |
36 | 56 | </tr> |
37 | | - {% for order in voucher.orders %} |
| 57 | + </table> |
| 58 | + {%- if voucher.orders.size > 0 %} |
| 59 | + <h2>{{ "vouchers.show.orders.heading" | t }}</h2> |
| 60 | + <table class="sc-compact sc-mb-spacious"> |
38 | 61 | <tr> |
39 | | - <td data-th="{{ "vouchers.show.orders.reference" | t }}"><a href="{{ order.path }}">{{ order.reference }}</a></td> |
40 | | - <td data-th="{{ "vouchers.show.orders.date" | t }}">{% render "shared/date", timestamp: order.ordered_at %}</td> |
41 | | - <td data-th="{{ "vouchers.show.orders.total" | t }}"> |
42 | | - {% if order.quotable? %}-{% else %}{{ order.total | money }}{% endif %} |
43 | | - </td> |
| 62 | + <th>{{ "vouchers.show.orders.reference" | t }}</th> |
| 63 | + <th>{{ "vouchers.show.orders.date" | t }}</th> |
| 64 | + <th>{{ "vouchers.show.orders.total" | t }}</th> |
44 | 65 | </tr> |
45 | | - {%- endfor %} |
46 | | - </table> |
| 66 | + {% for order in voucher.orders %} |
| 67 | + <tr> |
| 68 | + <td data-th="{{ "vouchers.show.orders.reference" | t }}"><a href="{{ order.path }}">{{ order.reference }}</a></td> |
| 69 | + <td data-th="{{ "vouchers.show.orders.date" | t }}">{% render "shared/date", timestamp: order.ordered_at %}</td> |
| 70 | + <td data-th="{{ "vouchers.show.orders.total" | t }}"> |
| 71 | + {% if order.quotable? %}-{% else %}{{ order.total | money }}{% endif %} |
| 72 | + </td> |
| 73 | + </tr> |
| 74 | + {%- endfor %} |
| 75 | + </table> |
| 76 | + {%- endif %} |
47 | 77 | {%- endif %} |
48 | 78 | {%- endif %} |
49 | 79 |
|
50 | 80 | {%- if current_request.params["code"] != blank %} |
51 | 81 | <hr> |
52 | 82 | <h3 class="sc-mt-large">{{ "vouchers.show.form.heading" | t }}</h3> |
| 83 | + {%- else %} |
| 84 | + <h1 class="sc-mt-large">{{ "vouchers.show.check_voucher_heading" | t }}</h1> |
53 | 85 | {%- endif %} |
| 86 | + |
54 | 87 | <form> |
55 | 88 | <div class="SC-Field SC-Field-expand"> |
56 | 89 | <input type="text" name="code" value="{{ current_request.params["code"] }}" placeholder="{{ "vouchers.show.form.code" | t }}" class="SC-Field_input sc-expand"> |
|
0 commit comments