Bug 26265: (QA follow-up) Remove g option from regex, add few dirs
[koha-equinox.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / maninvoice.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Price %]
5 [% USE Branches %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha &rsaquo; Patrons &rsaquo; Create manual invoice</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 </head>
11
12 <body id="pat_maninvoice" class="pat">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'patron-search.inc' %]
15
16 <div id="breadcrumbs">
17     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
18     <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> &rsaquo;
19     Manual invoice
20 </div>
21
22 <div class="main container-fluid">
23     <div class="row">
24         <div class="col-sm-10 col-sm-push-2">
25             <main>
26
27             [% INCLUDE 'members-toolbar.inc' %]
28
29             <!-- The manual invoice and credit buttons -->
30             <div class="statictabs">
31                 <ul>
32                     <li><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]">Transactions</a></li>
33                     <li><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Make a payment</a></li>
34                     <li class="active"><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual invoice</a></li>
35                     <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual credit</a></li>
36                 </ul>
37                 <div class="tabs-container">
38
39                 [% IF error == 'itemnumber' %]
40                     <div id="error_message" class="dialog alert">
41                         Error: Invalid barcode entered, please try again
42                     </div>
43                 [% ELSIF error %]
44                     <div id="error_message" class="dialog alert">
45                         An error occurred, please try again: [% error | html %]
46                     </div>
47                 [% END %]
48                 <form action="/cgi-bin/koha/members/maninvoice.pl" method="post" id="maninvoice">
49                     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
50                     <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
51                     <fieldset class="rows">
52                         <legend>Manual invoice</legend>
53                         <ol>
54                             <li>
55                                 <label for="type">Type: </label>
56                                 <select name="type" id="type">
57                                     [% FOREACH debit_type IN debit_types %]
58                                     [% IF debit_type.code == type %]
59                                     <option value="[% debit_type.code | html %]" selected="selected">[% debit_type.description | html %]</option>
60                                     [% ELSE %]
61                                     <option value="[% debit_type.code | html %]">[% debit_type.description | html %]</option>
62                                     [% END %]
63                                     [% END %]
64                                 </select>
65                             </li>
66                             <li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" value="[% barcode | html %]" /></li>
67                             <li><label for="desc">Description: </label><input type="text" name="desc" id="desc" size="50" value="[% desc | html %]" /></li>
68                             <li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" value="[% note | html %]" /></li>
69                             <li><label for="amount">Amount: </label><input type="number" name="amount" id="amount" required="required" step="any" min="0" value="[% amount | $Price on_editing => 1 %]" /> Example: 5.00</li>
70                         </ol>
71                     </fieldset>
72                     <fieldset class="action">
73                         <button type="submit" name="add" value="save">Save</button>
74                         <button type="submit" name="add" value="save and pay">Save and pay</button>
75                         <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
76                     </fieldset>
77                 </form>
78
79                 </div>
80             </div>
81
82             </main>
83         </div> <!-- /.col-sm-10.col-sm-push-2 -->
84
85         <div class="col-sm-2 col-sm-pull-10">
86             <aside>
87                 [% INCLUDE 'circ-menu.inc' %]
88             </aside>
89         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
90      </div> <!-- /.row -->
91
92 [% MACRO jsinclude BLOCK %]
93     [% INCLUDE 'str/members-menu.inc' %]
94     [% Asset.js("js/members-menu.js") | $raw %]
95     <script>
96         var type_fees = {};
97         [% FOREACH debit_type IN debit_types %]
98             type_fees['[% debit_type.code | html %]'] = "[% debit_type.default_amount | $Price %]";
99         [% END %]
100         $(document).ready(function(){
101             $('#maninvoice').preventDoubleFormSubmit();
102             $("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit");
103             $("#invoice_type").on("change",function(){
104                 this.form.desc.value = this.options[this.selectedIndex].value;
105                 this.form.amount.value = type_fees[this.options[this.selectedIndex].value];
106             });
107             [% UNLESS amount.defined %]
108             $("#maninvoice #desc").val($("#maninvoice #type option:selected").text());
109             $("#maninvoice #amount").val(type_fees[$("#maninvoice #type option:selected").val()]);
110             [% END %]
111             $("#maninvoice #type").change(function(){
112                 $("#maninvoice #desc").val($(this).find("option:selected").text());
113                 $("#maninvoice #amount").val(type_fees[$(this).val()]);
114             });
115         });
116     </script>
117 [% END %]
118
119 [% INCLUDE 'intranet-bottom.inc' %]