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