re-work coupons to allow multiple coupon types
[bse.git] / site / templates / admin / coupons / edit.tmpl
CommitLineData
023761bd
TC
1<:wrap admin/base.tmpl title => "Shop: Edit Coupon Code", bodyid => "coupon_edit":>
2<h1>Shop: Edit Coupon <span><:= coupon.code -:></span></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_edit hidden:>
12 <input type="hidden" name="id" value="<:= coupon.id :>">
13 <fieldset>
14 <legend>Coupon Details</legend>
15 <:.call "field", "name":"code", "autofocus":1 :>
16 <:.call "field", "name":"description" :>
17 <:.call "field", "name":"release" :>
18 <:.call "field", "name":"expiry" :>
b55d4af1
TC
19 <:.call "field", "name":"classid" :>
20 <:.set classid = cgi.param("classid") ? [ cgi.param("classid") ][0] : coupon.classid -:>
21 <:.set config = coupon.config_obj -:>
22 <:.for bh in behaviours -:>
23 <:.set fs = bh.behaviour.config_fields -:>
24 <:.set ordered_f = fs.keys.sort(@{a,b: fs[a].order <=> fs[b].order }) -:>
25 <:.set attr = { "data-behaviour": bh.id } -:>
26 <:.set inputattr = { } -:>
27 <:.if classid ne bh.id -:>
28 <:% attr.set("style", "display: none") -:>
29 <:% inputattr.set("disabled", "disabled") -:>
30 <:.end if -:>
31 <:.for f in ordered_f -:>
32 <:.call "field", name:f, fields: fs, options: { htmlattr: attr, inputattr: inputattr }, object: config -:>
33 <:.end for -:>
34 <:.end for -:>
023761bd
TC
35 <:.call "field", "name":"campaign" :>
36 </fieldset>
37 <:.call "fieldset", "name":"tiers" :>
38 <p class="buttons">
39 <input type="submit" name="a_coupon_save" value="Save Coupon">
40 </p>
41</form>
b55d4af1 42<script type="text/javascript" src="/js/admin_coupons.js"></script>