Bug 34531: Fix template logic to not hide patron restrictions
[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 [% PROCESS 'i18n.inc' %]
7 [% SET footerjs = 1 %]
8 [% PROCESS 'accounts.inc' %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>[% FILTER collapse %]
11     [% t("Create manual invoice") | html %] &rsaquo;
12     [% t("Patrons") | html %] &rsaquo;
13     [% t("Koha") | html %]
14 [% END %]</title>
15 [% INCLUDE 'doc-head-close.inc' %]
16 </head>
17
18 <body id="pat_maninvoice" class="pat">
19 [% WRAPPER 'header.inc' %]
20     [% INCLUDE 'patron-search-header.inc' %]
21 [% END %]
22
23 [% WRAPPER 'sub-header.inc' %]
24     [% WRAPPER breadcrumbs %]
25         [% WRAPPER breadcrumb_item %]
26             <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
27         [% END %]
28         [% WRAPPER breadcrumb_item %]
29             <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% INCLUDE 'patron-title.inc' %]</a>
30         [% END %]
31         [% WRAPPER breadcrumb_item bc_active= 1 %]
32             <span>Manual invoice</span>
33         [% END %]
34     [% END #/ WRAPPER breadcrumbs %]
35 [% END #/ WRAPPER sub-header.inc %]
36
37 <div class="main container-fluid">
38     <div class="row">
39         <div class="col-sm-10 col-sm-push-2">
40             <main>
41
42
43             [% INCLUDE 'members-toolbar.inc' %]
44
45             <h1>Manual invoice</h1>
46
47             <!-- The manual invoice and credit buttons -->
48             <div class="toptabs">
49                 <ul class="nav nav-tabs" role="tablist">
50                     <li role="presentation" class="transactions">
51                         <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Transactions</a>
52                     </li>
53                     <li role="presentation" class="makepayment">
54                         <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Make a payment</a>
55                     </li>
56                     <li role="presentation" class="manualinvoice active">
57                         <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual invoice</a>
58                     </li>
59                     [% IF CAN_user_updatecharges_manual_credit %]
60                         <li role="presentation" class="manualcredit">
61                             <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual credit</a>
62                         </li>
63                     [% END %]
64                 </ul> <!-- /.nav.nav-tabs -->
65                 <div class="tab-content">
66                     <div role="tabpanel" class="tab-pane active">
67                 [% IF error == 'itemnumber' %]
68                     <div id="error_message" class="dialog alert">
69                         Error: Invalid barcode entered, please try again
70                     </div>
71                 [% ELSIF error %]
72                     <div id="error_message" class="dialog alert">
73                         An error occurred, please try again: [% error | html %]
74                     </div>
75                 [% END %]
76                 <form action="/cgi-bin/koha/members/maninvoice.pl" method="post" id="maninvoice">
77                     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
78                     <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
79                     <fieldset class="rows">
80                         <legend>Manual invoice</legend>
81                         <ol>
82                             <li>
83                                 <label for="type">Type: </label>
84                                 <select name="type" id="type">
85                                     [% FOREACH debit_type IN debit_types %]
86                                     [% IF debit_type.code == type %]
87                                     <option value="[% debit_type.code | html %]" selected="selected">[%- PROCESS debit_type_description debit_type=debit_type -%]</option>
88                                     [% ELSE %]
89                                     <option value="[% debit_type.code | html %]">[%- PROCESS debit_type_description debit_type=debit_type -%]</option>
90                                     [% END %]
91                                     [% END %]
92                                 </select>
93                             </li>
94                             <li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" value="[% barcode | html %]" /></li>
95                             <li><label for="desc">Description: </label><input type="text" name="desc" id="desc" size="50" value="[% desc | html %]" /></li>
96                             <li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" value="[% note | html %]" /></li>
97                             <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>
98                         </ol>
99                     </fieldset>
100
101                     [% IF available_additional_fields %]
102                         [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
103                     [% END %]
104
105                     <fieldset class="action">
106                         <button type="submit" name="add" class="btn btn-primary" value="save">Save</button>
107                         <button type="submit" name="add" class="btn btn-primary" value="save and pay">Save and pay</button>
108                         <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
109                     </fieldset>
110                 </form>
111
112                     </div> <!-- /.tab-pane -->
113                 </div> <!-- /.tab-content -->
114             </div> <!-- /.toptabs -->
115
116             </main>
117         </div> <!-- /.col-sm-10.col-sm-push-2 -->
118
119         <div class="col-sm-2 col-sm-pull-10">
120             <aside>
121                 [% INCLUDE 'circ-menu.inc' %]
122             </aside>
123         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
124      </div> <!-- /.row -->
125
126 [% MACRO jsinclude BLOCK %]
127     [% INCLUDE 'str/members-menu.inc' %]
128     [% Asset.js("js/members-menu.js") | $raw %]
129     <script>
130         var type_fees = {};
131         [% FOREACH debit_type IN debit_types %]
132             type_fees['[% debit_type.code | html %]'] = "[% IF debit_type.default_amount %][% debit_type.default_amount | $Price on_editing => 1 %][% END %]";
133         [% END %]
134         $(document).ready(function(){
135             $('#maninvoice').preventDoubleFormSubmit();
136             $("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit");
137             $("#invoice_type").on("change",function(){
138                 this.form.desc.value = this.options[this.selectedIndex].value;
139                 this.form.amount.value = type_fees[this.options[this.selectedIndex].value];
140             });
141             [% UNLESS amount.defined %]
142             $("#maninvoice #desc").val($("#maninvoice #type option:selected").text());
143             $("#maninvoice #amount").val(type_fees[$("#maninvoice #type option:selected").val()]);
144             [% END %]
145             $("#maninvoice #type").change(function(){
146                 $("#maninvoice #desc").val($(this).find("option:selected").text());
147                 $("#maninvoice #amount").val(type_fees[$(this).val()]);
148             });
149         });
150     </script>
151 [% END %]
152
153 [% INCLUDE 'intranet-bottom.inc' %]