re-work coupons to allow multiple coupon types
[bse.git] / site / templates / admin / coupons / add.tmpl
CommitLineData
023761bd
TC
1<:wrap admin/base.tmpl title => "Shop: Add Coupon Code", bodyid => "coupon_add":>
2<h1>Shop: Add Coupon Code</h1>
3<p>| <a href="<:= cfg.admin_url("menu") :>">Admin Menu</a> |
4<:.if request.user_can("bse_shop_coupon_list") -:>
5<a href="<:= cfg.admin_url2("shopadmin", "coupon_list") :>">Return to coupon list</a> |
6<:.end if-:>
7</p>
8<:.call "messages"-:>
9<:.set object = coupon -:>
b55d4af1 10<form action="<:= cfg.admin_url("shopadmin") :>" method="post" id="coupon_form">
023761bd
TC
11 <:csrfp admin_bse_coupon_add hidden:>
12 <fieldset>
13 <legend>Coupon Details</legend>
14 <:.call "field", "name":"code", "autofocus":1 :>
15 <:.call "field", "name":"description" :>
16 <:.call "field", "name":"release" :>
17 <:.call "field", "name":"expiry" :>
b55d4af1
TC
18 <:.call "field", "name":"classid" :>
19 <:.set classid = cgi.param("classid") ? [ cgi.param("classid") ][0] : behaviours[0].id -:>
20 <:.for bh in behaviours -:>
21 <:.set fs = bh.behaviour.config_fields -:>
22 <:.set ordered_f = fs.keys.sort(@{a,b: fs[a].order <=> fs[b].order }) -:>
23 <:.set attr = { "data-behaviour": bh.id } -:>
24 <:.set inputattr = { } -:>
25 <:.if classid ne bh.id -:>
26 <:% attr.set("style", "display: none") -:>
27 <:% inputattr.set("disabled", "disabled") -:>
28 <:.end if -:>
29 <:.for f in ordered_f -:>
30 <:.call "field", name:f, fields: fs, options: { htmlattr: attr, inputattr: inputattr } -:>
31 <:.end for -:>
32 <:.end for -:>
023761bd
TC
33 <:.call "field", "name":"campaign" :>
34 </fieldset>
35 <:.call "fieldset", "name":"tiers" :>
36 <p class="buttons">
37 <input type="submit" name="a_coupon_add" value="Add Coupon">
38 </p>
39</form>
b55d4af1
TC
40<script type="text/javascript" src="/js/admin_coupons.js"></script>
41