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