Bug 19754: Move template JavaScript to the footer: Acquisitions, part 2
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / invoice-files.tt
1 [% USE KohaDates %]
2 [% SET footerjs = 1 %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha &rsaquo; Acquisitions &rsaquo; Invoice &rsaquo; Files</title>
5 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
6 [% INCLUDE 'doc-head-close.inc' %]
7 </head>
8
9 <body id="acq_invoice_files" class="acq">
10 [% INCLUDE 'header.inc' %]
11 [% INCLUDE 'acquisitions-search.inc' %]
12
13 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a> &rsaquo; <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid %]">[% invoicenumber %]</a> &rsaquo; Files</div>
14
15 <div id="doc3" class="yui-t2">
16
17 <div id="bd">
18   <div id="yui-main">
19     <div class="yui-b">
20       <h2>Files for invoice: [% invoicenumber | html %]</h2>
21       <p><b>Vendor: </b><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% suppliername %]</a></p>
22       <br />
23       [% IF errors %]
24         <div class="dialog alert">
25           [% IF errors.empty_upload %]The file you are attempting to upload has no contents.[% END %]
26           [% IF errors.no_file %]You did not select a file to upload.[% END %]
27           [% IF errors.invalid_parameter %]Invalid or missing script parameter.[% END %]
28         </div>
29       [% END %]
30       [% IF files %]
31           <table id="invoice_files_details_table">
32               <thead>
33                   <tr>
34                       <th>Name</th>
35                       <th>Type</th>
36                       <th>Description</th>
37                       <th>Uploaded</th>
38                       <th>Bytes</th>
39                       <th>&nbsp;</th>
40                       <th>&nbsp;</th>
41                   </tr>
42               </thead>
43               <tbody>
44                 [% FOREACH f IN files %]
45                   <tr>
46                       <td><a href="?invoiceid=[% invoiceid %]&amp;op=download&amp;view=1&amp;file_id=[% f.file_id %]">[% f.file_name | html %]</a></td>
47                       <td>[% f.file_type | html %]</td>
48                       <td>[% f.file_description | html %]</td>
49                       <td class="title-string">
50                         <span title="[% f.date_uploaded %]">[% f.date_uploaded | $KohaDates %]</span>
51                       </td>
52                       <td>[% f.file_size %]</td>
53                       <td><a class="delete_file" href="?invoiceid=[% invoiceid %]&amp;op=delete&amp;file_id=[% f.file_id %]">Delete</a></td>
54                       <td><a href="?invoiceid=[% invoiceid %]&amp;op=download&amp;file_id=[% f.file_id %]">Download</a></td>
55                   </tr>
56                 [% END %]
57               </tbody>
58           </table>
59       [% ELSE %]
60           <div class="dialog message">
61               <p>This invoice has no files attached.</p>
62           </div>
63       [% END %]
64       [% IF invoiceid %]
65           <br />
66           <form method="post" action="/cgi-bin/koha/acqui/invoice-files.pl" enctype="multipart/form-data">
67               <fieldset class="rows">
68                   <legend>Upload New File</legend>
69                   <ol>
70                       <li><input type="hidden" name="op" value="upload" />
71                       <input type="hidden" name="invoiceid" value="[% invoiceid %]" />
72                       <label for="description">Description:</label>
73                       <input name="description" id="description" type="text" /></li>
74                       <li><label for="uploadfile">File:</label><input name="uploadfile" type="file" id="uploadfile" /></li>
75                   </ol>
76                   <fieldset class="action"><input name="upload" type="submit" id="upload" value="Upload File" /></fieldset>
77               </fieldset>
78           </form>
79       [% END %]
80     </div>
81   </div>
82   <div class="yui-b">
83     [% INCLUDE 'acquisitions-menu.inc' %]
84   </div>
85 </div>
86
87 [% MACRO jsinclude BLOCK %]
88     <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
89     [% INCLUDE 'datatables.inc' %]
90     <script type="text/javascript">
91         $(document).ready(function() {
92             $("#invoice_files_details_table").dataTable($.extend(true, {}, dataTablesDefaults, {
93                 "aoColumnDefs": [
94                     { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
95                     { "aTargets": [ "title-string" ], "sType": "title-string" }
96                 ],
97                 bInfo: false,
98                 bPaginate: false,
99                 bFilter: false,
100                 sDom: "t"
101             }));
102             $("a.delete_file").click(function(){
103                 return ( confirm( _("Are you sure you want to delete this file ?") ) );
104             });
105         });
106     </script>
107 [% END %]
108
109 [% INCLUDE 'intranet-bottom.inc' %]