Skip to main content

max / makenotwork

6.7 KB · 145 lines History Blame Raw
1 <div class="pricing-strategies">
2 <div class="pricing-strategies-title">Pricing strategies</div>
3 <div class="pricing-strategies-grid">
4 <div><strong>Fixed price</strong>: set in the Details tab. Good for finished products.</div>
5 <div><strong>Pay What You Want</strong>: fans choose their price. Set a minimum below.</div>
6 <div><strong>Free + promo codes</strong>: set price to $0, then generate codes for specific access.</div>
7 <div><strong>License keys</strong>: per-seat licensing for software. Works with any pricing model.</div>
8 </div>
9 </div>
10
11 <!-- Pay What You Want -->
12 <div class="content-section">
13 <div class="section-header">
14 <h2 class="subsection-title">Pay What You Want</h2>
15 </div>
16
17 <form hx-put="/api/items/{{ item.id }}"
18 hx-target="#pwyw-save-status"
19 hx-swap="innerHTML"
20 hx-indicator="#pwyw-spinner">
21 <div class="form-group">
22 <label class="checkbox-label">
23 <input type="hidden" name="pwyw_enabled" value="off">
24 <input type="checkbox" name="pwyw_enabled" value="on"
25 {% if item.pwyw_enabled %}checked{% endif %}
26 data-change="togglePwywSettings">
27 Enable pay-what-you-want pricing
28 </label>
29 <p class="form-hint">The item price becomes the suggested amount. Buyers can choose any amount at or above the minimum.</p>
30 </div>
31
32 <div id="pwyw-settings"{% if !item.pwyw_enabled %} class="hidden"{% endif %}>
33 <div class="form-group">
34 <label for="pwyw-min-dollars">Minimum price ($)</label>
35 <input type="number" id="pwyw-min-dollars" step="0.01" min="0" placeholder="0.00">
36 <input type="hidden" id="pwyw-min-cents" name="pwyw_min_cents"
37 value="{% if let Some(min) = item.pwyw_min_cents %}{{ min }}{% endif %}">
38 <p class="form-hint">The lowest amount a buyer can pay. $0 = any amount.</p>
39 </div>
40 </div>
41 <script src="/static/tab-item-pricing.js?v=0623"></script>
42
43 <button class="btn-primary" type="submit">
44 Save PWYW Settings
45 <span id="pwyw-spinner" class="htmx-indicator"> ...</span>
46 </button>
47 <span id="pwyw-save-status"></span>
48 </form>
49 </div>
50
51 <!-- License Terms -->
52 <div class="content-section">
53 <div class="section-header">
54 <h2 class="subsection-title">License Terms</h2>
55 </div>
56
57 <form hx-put="/api/items/{{ item.id }}/license-settings"
58 hx-target="#license-save-status"
59 hx-swap="innerHTML"
60 hx-indicator="#license-spinner">
61 <div class="form-group">
62 <label for="dash-license-preset">License</label>
63 <select id="dash-license-preset" name="license_preset"
64 data-change="toggleCustomLicense">
65 <option value="">None (no license)</option>
66 {% for opt in license_preset_options %}
67 <option value="{{ opt.0 }}"{% if item.license_preset.as_deref() == Some(opt.0) %} selected{% endif %}>{{ opt.1 }}</option>
68 {% endfor %}
69 </select>
70 <p class="form-hint">Displayed on the item page and included with downloads as LICENSE.txt.</p>
71 </div>
72
73 <div id="dash-custom-license"{% if item.license_preset.as_deref() != Some("custom") %} class="hidden"{% endif %}>
74 <div class="form-group">
75 <label for="dash-custom-text">Custom License Text</label>
76 <textarea id="dash-custom-text" name="custom_license_text" rows="6"
77 placeholder="Enter your custom license terms...">{{ item.custom_license_text.as_deref().unwrap_or("") }}</textarea>
78 </div>
79 </div>
80
81 <div class="form-group">
82 <label class="checkbox-label">
83 <input type="checkbox" name="enable_license_keys" value="on"
84 {% if item.enable_license_keys %}checked{% endif %}
85 data-change="toggleLicenseKeys">
86 Enable license keys for this item
87 </label>
88 <p class="form-hint">Buyers receive a unique license key with their purchase. Each key can be activated on a limited number of devices (you choose). Useful for software with per-seat licensing. Works with any pricing model including Pay What You Want.</p>
89 </div>
90
91 <div class="form-group">
92 <label for="default-max-activations">Default max activations per key</label>
93 <input type="number" id="default-max-activations" name="default_max_activations"
94 value="{% if let Some(max) = item.default_max_activations %}{{ max }}{% endif %}"
95 min="1" placeholder="Leave blank for unlimited">
96 <p class="form-hint">How many machines can activate each key. Blank = unlimited.</p>
97 </div>
98
99 <button class="btn-primary" type="submit">
100 Save License Settings
101 <span id="license-spinner" class="htmx-indicator"> ...</span>
102 </button>
103 <span id="license-save-status"></span>
104 </form>
105
106 <div id="license-keys-section" class="license-keys-section{% if !item.enable_license_keys %} hidden{% endif %}">
107 <div class="section-header">
108 <h3>Generated Keys</h3>
109 <form hx-post="/api/items/{{ item.id }}/keys"
110 hx-target="#license-keys-list"
111 hx-swap="outerHTML">
112 <button class="btn-secondary" type="submit">Generate Key</button>
113 </form>
114 </div>
115
116 {% include "partials/item_license_keys.html" %}
117 </div>
118 </div>
119
120 <!-- Promo Codes -->
121 <div class="content-section">
122 <div class="section-header">
123 <h2 class="subsection-title">Promo Codes</h2>
124 </div>
125 <p class="form-hint promo-codes-hint">Generate codes that grant free access to this item. Share them with reviewers, collaborators, or for promotions.</p>
126
127 <form hx-post="/api/promo-codes"
128 hx-target="#promo-codes-list"
129 hx-swap="outerHTML"
130 class="promo-codes-form">
131 <input type="hidden" name="item_id" value="{{ item.id }}">
132 <input type="hidden" name="code_purpose" value="free_access">
133 <div class="promo-codes-row">
134 <input type="number" name="max_uses" min="1" placeholder="Max uses (blank = unlimited)"
135 class="promo-max-uses">
136 <input type="date" name="expires_at" placeholder="Expires (optional)"
137 title="Expiry date (optional)"
138 class="promo-expires">
139 <button class="btn-secondary" type="submit">Generate Code</button>
140 </div>
141 </form>
142
143 {% include "partials/promo_codes_list.html" %}
144 </div>
145