| 1 |
<div class="tab-docs"><a href="/docs/pricing">Docs: Pricing →</a></div> |
| 2 |
|
| 3 |
<div class="content-section"> |
| 4 |
<div class="section-header"> |
| 5 |
<h2 class="subsection-title">Promo Codes</h2> |
| 6 |
</div> |
| 7 |
|
| 8 |
<p class="form-hint mb-5">Create codes that give buyers discounts, free access, or free trials on items in this project.</p> |
| 9 |
|
| 10 |
<details class="form-section"> |
| 11 |
<summary><h2 class="subsection-title">New Promo Code</h2></summary> |
| 12 |
<form hx-post="/api/promo-codes" |
| 13 |
hx-target="#promo-codes-list" |
| 14 |
hx-swap="outerHTML" |
| 15 |
class="proj-promo-form"> |
| 16 |
<input type="hidden" name="project_id" value="{{ project_id }}"> |
| 17 |
|
| 18 |
<div class="proj-promo-grid"> |
| 19 |
<div class="form-group"> |
| 20 |
<label for="pc-purpose">Type</label> |
| 21 |
<select id="pc-purpose" name="code_purpose" |
| 22 |
data-change="onPromoTypeChange"> |
| 23 |
<option value="discount">Discount</option> |
| 24 |
<option value="free_access">Free Access</option> |
| 25 |
<option value="free_trial">Free Trial</option> |
| 26 |
</select> |
| 27 |
</div> |
| 28 |
<div class="form-group"> |
| 29 |
<label for="pc-code">Code</label> |
| 30 |
<input type="text" id="pc-code" name="code" placeholder="e.g. LAUNCH50" |
| 31 |
class="proj-promo-code-input input--upper"> |
| 32 |
</div> |
| 33 |
</div> |
| 34 |
|
| 35 |
<div id="discount-fields" class="proj-promo-grid proj-promo-grid--spaced"> |
| 36 |
<div class="form-group"> |
| 37 |
<label for="pc-type">Discount type</label> |
| 38 |
<select id="pc-type" name="discount_type"> |
| 39 |
<option value="percentage">Percentage</option> |
| 40 |
<option value="fixed">Fixed ($)</option> |
| 41 |
</select> |
| 42 |
</div> |
| 43 |
<div class="form-group"> |
| 44 |
<label for="pc-value-input">Amount</label> |
| 45 |
<input type="number" id="pc-value-input" min="1" step="1" placeholder="e.g. 50"> |
| 46 |
<input type="hidden" id="pc-value-hidden" name="discount_value"> |
| 47 |
</div> |
| 48 |
</div> |
| 49 |
|
| 50 |
<div id="trial-fields" class="proj-promo-trial-fields"> |
| 51 |
<div class="form-group proj-promo-trial-group"> |
| 52 |
<label for="pc-trial-preset">Trial length</label> |
| 53 |
<select id="pc-trial-preset" data-change="onTrialPresetChange"> |
| 54 |
<option value="7">7 days</option> |
| 55 |
<option value="14" selected>14 days</option> |
| 56 |
<option value="30">30 days</option> |
| 57 |
<option value="60">60 days</option> |
| 58 |
<option value="90">90 days</option> |
| 59 |
<option value="custom">Custom...</option> |
| 60 |
</select> |
| 61 |
<input type="number" id="pc-trial-days" name="trial_days" min="1" value="14" hidden> |
| 62 |
<input type="number" id="pc-trial-days-custom" min="1" placeholder="e.g. 21" hidden |
| 63 |
data-input="syncTrialDays"> |
| 64 |
</div> |
| 65 |
</div> |
| 66 |
|
| 67 |
<div class="proj-promo-grid proj-promo-grid--bordered"> |
| 68 |
<div class="form-group"> |
| 69 |
<label for="pc-max">Max uses</label> |
| 70 |
<input type="number" id="pc-max" name="max_uses" min="1" placeholder="Unlimited"> |
| 71 |
</div> |
| 72 |
<div class="form-group"> |
| 73 |
<label for="pc-starts">Starts</label> |
| 74 |
<input type="date" id="pc-starts" name="starts_at"> |
| 75 |
</div> |
| 76 |
<div class="form-group"> |
| 77 |
<label for="pc-expires">Expires</label> |
| 78 |
<input type="date" id="pc-expires" name="expires_at"> |
| 79 |
</div> |
| 80 |
{% if !items.is_empty() %} |
| 81 |
<div class="form-group proj-promo-scope"> |
| 82 |
<label for="pc-item">Scope</label> |
| 83 |
<select id="pc-item" name="item_id"> |
| 84 |
<option value="">All items in project</option> |
| 85 |
{% for item in items %} |
| 86 |
<option value="{{ item.id }}">{{ item.title }}</option> |
| 87 |
{% endfor %} |
| 88 |
</select> |
| 89 |
</div> |
| 90 |
{% endif %} |
| 91 |
</div> |
| 92 |
|
| 93 |
<div class="proj-promo-actions"> |
| 94 |
<button class="btn-secondary" type="submit">Create Code</button> |
| 95 |
</div> |
| 96 |
<p class="form-hint proj-promo-hint">Percentage: 1-100. Fixed: dollar amount (e.g. 5 = $5.00 off). Free access codes auto-generate if code left blank.</p> |
| 97 |
<script src="/static/tab-project-promotions.js?v=0623"></script> |
| 98 |
</form> |
| 99 |
</details> |
| 100 |
|
| 101 |
{% include "partials/promo_codes_list.html" %} |
| 102 |
</div> |
| 103 |
|
| 104 |
<script src="/static/tab-project-promotions-2.js?v=0623"></script> |
| 105 |
|