Skip to main content

max / makenotwork

4.3 KB · 100 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-5">
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-2">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-hx-reset data-hx-get="/dashboard/project/{{ project_slug }}/tabs/subscriptions" data-hx-target="#tab-content">
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 <input type="hidden" id="tier-price-cents" name="price_cents">
34 <span class="text-sm dimmed">Minimum $1.00.</span>
35 </div>
36 <script src="/static/tab-project-subscriptions.js?v=0623"></script>
37 <button class="btn-primary" type="submit">Create Tier</button>
38 </form>
39 </details>
40
41 <div id="tiers-list">
42 {% if tiers.is_empty() %}
43 <p class="dimmed">No membership tiers yet. Create one above.</p>
44 {% else %}
45 <table class="data-table">
46 <thead>
47 <tr>
48 <th>Name</th>
49 <th>Price</th>
50 <th>Status</th>
51 <th>Actions</th>
52 </tr>
53 </thead>
54 <tbody>
55 {% for tier in tiers %}
56 <tr id="tier-row-{{ tier.id }}">
57 <td>
58 <strong>{{ tier.name }}</strong>
59 {% if !tier.description.is_empty() %}
60 <div class="tier-row-desc">{{ tier.description }}</div>
61 {% endif %}
62 </td>
63 <td>{{ tier.price }}</td>
64 <td>
65 {% if tier.is_active %}
66 <span class="badge active">Active</span>
67 {% else %}
68 <span class="badge inactive">Inactive</span>
69 {% endif %}
70 </td>
71 <td>
72 {% if tier.is_active %}
73 <button class="btn-secondary tier-action-btn"
74 hx-delete="/api/tiers/{{ tier.id }}"
75 hx-swap="none"
76 data-hx-get="/dashboard/project/{{ project_slug }}/tabs/subscriptions" data-hx-target="#tab-content"
77 hx-confirm="Deactivate this tier? Existing subscribers will not be affected.">Deactivate</button>
78 {% endif %}
79 </td>
80 </tr>
81 {% endfor %}
82 </tbody>
83 </table>
84 {% endif %}
85 </div>
86
87 <div class="subs-members-bar">
88 <div>
89 <h3>Members</h3>
90 <p class="muted m-0">{{ subscriber_count }} active member{% if subscriber_count != 1 %}s{% endif %}</p>
91 </div>
92 {% if subscriber_count > 0 %}
93 <button class="btn-secondary text-sm"
94 data-action="exportCsvButton" data-arg="/api/export/subscriptions" data-arg2="members.csv">Export CSV</button>
95 {% endif %}
96 </div>
97
98 {% endif %}
99 </div>
100