Skip to main content

max / makenotwork

10.0 KB · 204 lines History Blame Raw
1 {% extends "base.html" %}
2
3 {% block title %}Cart ({{ total_items }}) - Makenotwork{% endblock %}
4 {% block body_attrs %} class="{{ crate::shell::measure(crate::shell::Measure::Wide) }}"{% endblock %}
5
6 {% block content %}
7 {% include "partials/site_header.html" %}
8
9 <div class="container">
10 <h1 class="page-title">Your Cart</h1>
11
12 {% if checkout_status == "partial" %}
13 <div class="callout callout--solid-warning mb-pane">
14 <strong>Some purchases completed.</strong> Part of your checkout succeeded, but one or more creators could not be processed. The items below are still in your cart; you can try checking out again.
15 </div>
16 {% endif %}
17
18 {% if seller_groups.is_empty() %}
19 <div class="content-section cart-empty raised">
20 <p class="muted mb-section">Your cart is empty.</p>
21 <p class="cart-empty-hint">Add items from the Discover page or from your wishlist.</p>
22 <a href="/discover" class="btn-primary">Browse Discover</a>
23 </div>
24 {% else %}
25
26 {% if seller_groups.len() > 1 %}
27 <div class="cart-multi-bar">
28 <div>
29 <strong>{{ total_items }} items from {{ seller_groups.len() }} creators</strong>
30 <span class="cart-multi-bar-note">You'll check out with each creator in sequence.</span>
31 </div>
32 <form action="/stripe/checkout/cart/all" method="post" class="cart-multi-bar-form">
33 {% if let Some(token) = csrf_token %}<input type="hidden" name="_csrf" value="{{ token }}">{% endif %}
34 <label class="cart-share-label">
35 <input type="checkbox" name="share_contact" value="true"> Share email
36 </label>
37 {% if offer_conversion_choice %}
38 <label class="cart-share-label">
39 <input type="checkbox" name="conversion_bank" value="true"
40 {% if !self.conversion_at_checkout() %}checked{% endif %}>
41 Let my bank convert
42 </label>
43 {% endif %}
44 <button type="submit" class="btn-primary" data-loading-text="Redirecting to Stripe...">Checkout All</button>
45 </form>
46 </div>
47 {% endif %}
48
49 {% for group in seller_groups %}
50 <div class="content-section cart-group raised">
51 <h2 class="cart-group-title">
52 <a href="/u/{{ group.seller_username }}">{{ group.seller_username }}</a>
53 </h2>
54 <p class="cart-group-count">{{ group.item_count }} item{% if group.item_count != 1 %}s{% endif %}</p>
55
56 <div class="scroll-x">
57 <table class="data-table minw-400 well">
58 <thead>
59 <tr>
60 <th>Item</th>
61 <th>Type</th>
62 <th class="text-right">Price</th>
63 <th></th>
64 </tr>
65 </thead>
66 <tbody>
67 {% for item in group.items %}
68 <tr id="cart-row-{{ item.item_id }}">
69 <td><a href="/i/{{ item.item_id }}">{{ item.title }}</a></td>
70 <td><span class="badge">{{ item.item_type }}</span></td>
71 <td class="text-right">
72 {% if item.pwyw_enabled %}
73 <div class="cart-pwyw-cell">
74 <span class="cart-pwyw-symbol">{{ group.currency_symbol() }}</span>
75 <input type="number"
76 class="pwyw-cart-input cart-pwyw-input input--xs w-80 input--numeric"
77 data-item-id="{{ item.item_id }}"
78 value="{{ item.effective_price_input_value() }}"
79 min="{{ item.pwyw_min_dollars() }}"
80 step="0.01">
81 </div>
82 {% else if item.is_free() %}Free
83 {% else %}{{ item.effective_price_display() }}
84 {% endif %}
85 </td>
86 <td>
87 {{ crate::quasi::cart_act::html(item.item_id)|safe }}
88 </td>
89 </tr>
90 {% endfor %}
91 </tbody>
92 </table>
93 </div>
94
95 <div class="cart-group-summary">
96 <div>
97 <div class="cart-subtotal">
98 Subtotal: {{ group.subtotal_display() }}
99 </div>
100 <div class="cart-fee-line">
101 Platform fee: {{ group.currency_symbol() }}0.00 &middot; plus Stripe's processing fee
102 </div>
103 {% if group.savings_cents > 0 %}
104 <div class="cart-savings">
105 Buying together saves {{ group.seller_username }} ~{{ group.savings_display() }} in processing fees vs. separate purchases.
106 </div>
107 {% endif %}
108 </div>
109
110 {% if group.stripe_ready %}
111 <form action="/stripe/checkout/cart" method="post">
112 {% if let Some(token) = csrf_token %}<input type="hidden" name="_csrf" value="{{ token }}">{% endif %}
113 <input type="hidden" name="seller_id" value="{{ group.seller_id }}">
114 <div class="cart-promo-row">
115 <input type="text" name="promo_code" placeholder="Promo code (optional)"
116 autocomplete="off"
117 class="cart-promo-input input--sm w-180">
118 </div>
119 <label class="cart-checkout-share">
120 <input type="checkbox" name="share_contact" value="true">
121 Share my email with {{ group.seller_username }}
122 </label>
123 {% if group.offer_conversion_choice %}
124 <fieldset class="cart-conversion">
125 <legend class="cart-conversion-legend">
126 Prices here are in {{ group.currency }}. If your card is in another currency, someone has to convert it.
127 </legend>
128 <label class="cart-conversion-option">
129 <input type="radio" name="conversion" value="checkout"
130 {% if group.conversion_at_checkout() %}checked{% endif %}>
131 <span>
132 <strong>Convert at checkout.</strong>
133 Stripe converts and shows you the exact total in your own currency
134 before you pay. Its rate includes a conversion fee, which Stripe
135 sets between 2% and 4%.
136 </span>
137 </label>
138 <label class="cart-conversion-option">
139 <input type="radio" name="conversion" value="bank"
140 {% if !group.conversion_at_checkout() %}checked{% endif %}>
141 <span>
142 <strong>Let my bank convert.</strong>
143 You pay in {{ group.currency }} and your card issuer converts at
144 its own rate. That rate is set by your bank, so we cannot show it
145 to you here or estimate it.
146 </span>
147 </label>
148 </fieldset>
149 {% endif %}
150 <button type="submit" class="btn-primary" data-loading-text="Redirecting to Stripe...">Checkout ({{ group.item_count }} items)</button>
151 </form>
152 {% else %}
153 <div class="cart-stripe-not-ready">
154 <p>This creator hasn't set up payments yet. You can keep these items in your cart for later, or remove them.</p>
155 <button type="button" class="btn-secondary small"
156 data-seller-name="{{ group.seller_username }}"
157 data-action="onRemoveCartGroup">Remove all from {{ group.seller_username }}</button>
158 </div>
159 {% endif %}
160 </div>
161 </div>
162 {% endfor %}
163
164 {% endif %}
165
166 {% if !wishlist_suggestions.is_empty() %}
167 <div class="content-section cart-wishlist raised">
168 <h2 class="section-header">From your wishlist</h2>
169 <p class="section-lead text-sm dimmed">Add wishlisted items to your cart to buy them together.</p>
170 <div class="scroll-x">
171 <table class="data-table minw-400 well">
172 <thead>
173 <tr>
174 <th>Item</th>
175 <th>Creator</th>
176 <th class="text-right">Price</th>
177 <th></th>
178 </tr>
179 </thead>
180 <tbody>
181 {% for item in wishlist_suggestions %}
182 <tr id="wish-row-{{ item.item_id }}">
183 <td><a href="/i/{{ item.item_id }}">{{ item.title }}</a></td>
184 <td><a href="/u/{{ item.creator }}">{{ item.creator }}</a></td>
185 <td class="text-right">
186 {{ item.price_display() }}
187 </td>
188 <td>
189 <button class="btn-primary small cart-row-btn"
190 hx-post="/api/cart/{{ item.item_id }}"
191 data-after-always="label-added" data-after="fade-row">Add to Cart</button>
192 </td>
193 </tr>
194 {% endfor %}
195 </tbody>
196 </table>
197 </div>
198 </div>
199 {% endif %}
200 </div>
201
202 <script src="/static/page-cart.js?v=0623" defer></script>
203 {% endblock %}
204