Skip to main content

max / makenotwork

4.4 KB · 101 lines History Blame Raw
1 <div class="tab-docs"><a href="/docs/pricing">Docs: Pricing &rarr;</a></div>
2
3 <div class="data-section">
4 <h2 class="subsection-title">Membership Tiers</h2>
5 <p class="section-lead mb-pane">
6 Create recurring membership tiers for your project. Members get access to all paid content.
7 </p>
8
9 {% if !stripe_connected %}
10 <div class="info-box subs-connect-info">
11 <h3 class="mb-peer">Connect Stripe First</h3>
12 <p class="text-sm">You need to connect your Stripe account before creating subscription tiers. Go to <strong>Account Details</strong> in your dashboard to connect.</p>
13 </div>
14 {% else %}
15
16 <details class="form-section subs-new-tier">
17 <summary><h2 class="subsection-title">New Tier</h2></summary>
18 <form id="new-tier-form"
19 hx-post="/api/projects/{{ project_id }}/tiers"
20 hx-swap="none"
21 data-after="reset refresh" data-arg="/dashboard/project/{{ project_slug }}/tabs/subscriptions" data-arg2="#project-monetization">
22 <div class="form-group">
23 <label for="tier-name">Name</label>
24 <input type="text" id="tier-name" name="name" placeholder="e.g. Supporter, Premium" required maxlength="100">
25 </div>
26 <div class="form-group">
27 <label for="tier-description">Description</label>
28 <textarea id="tier-description" name="description" placeholder="What members get..." maxlength="2000"></textarea>
29 </div>
30 <div class="form-group">
31 <label for="tier-price-dollars">Monthly Price</label>
32 <input type="number" id="tier-price-dollars" step="0.01" min="1.00" placeholder="5.00" required
33 aria-describedby="tier-price-dollars-unit">
34 <span class="form-unit" id="tier-price-dollars-unit">USD</span>
35 <input type="hidden" id="tier-price-cents" name="price_cents">
36 <span class="text-sm dimmed">Minimum $1.00.</span>
37 </div>
38 <script src="/static/tab-project-subscriptions.js?v=0623"></script>
39 <button class="btn-primary" type="submit">Create Tier</button>
40 </form>
41 </details>
42
43 <div id="tiers-list">
44 {% if tiers.is_empty() %}
45 <p class="dimmed">No membership tiers yet. Create one above.</p>
46 {% else %}
47 <table class="data-table well">
48 <thead>
49 <tr>
50 <th>Name</th>
51 <th>Price</th>
52 <th>Status</th>
53 <th>Actions</th>
54 </tr>
55 </thead>
56 <tbody>
57 {% for tier in tiers %}
58 <tr id="tier-row-{{ tier.id }}">
59 <td>
60 <strong>{{ tier.name }}</strong>
61 {% if !tier.description.is_empty() %}
62 <div class="tier-row-desc">{{ tier.description }}</div>
63 {% endif %}
64 </td>
65 <td>{{ tier.price }}</td>
66 <td>
67 {% if tier.is_active %}
68 <span class="badge" data-tone="success">Active</span>
69 {% else %}
70 <span class="badge inactive">Inactive</span>
71 {% endif %}
72 </td>
73 <td>
74 {% if tier.is_active %}
75 <button class="btn-secondary tier-action-btn"
76 hx-delete="/api/tiers/{{ tier.id }}"
77 hx-swap="none"
78 data-after="refresh" data-arg="/dashboard/project/{{ project_slug }}/tabs/subscriptions" data-arg2="#project-monetization"
79 hx-confirm="Deactivate this tier? Existing subscribers will not be affected.">Deactivate</button>
80 {% endif %}
81 </td>
82 </tr>
83 {% endfor %}
84 </tbody>
85 </table>
86 {% endif %}
87 </div>
88
89 <div class="subs-members-bar">
90 <div>
91 <h3>Members</h3>
92 <p class="muted m-0">{{ subscriber_count }} active member{% if subscriber_count != 1 %}s{% endif %}</p>
93 </div>
94 {% if subscriber_count > 0 %}
95 {{ crate::quasi::export_act::html("/api/export/subscriptions", "members.csv")|safe }}
96 {% endif %}
97 </div>
98
99 {% endif %}
100 </div>
101