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