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