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