Bug 11719 - Use new DataTables include in serials templates
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / claims.tt
index b2b5c1a..df18395 100644 (file)
@@ -1,21 +1,29 @@
+[% USE Branches %]
+
 [% INCLUDE 'doc-head-open.inc' %]
     <title>Koha &rsaquo; Serials &rsaquo; Claims</title>
     [% INCLUDE 'doc-head-close.inc' %]
 [% INCLUDE 'calendar.inc' %]
-<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/en/css/datatables.css" />
-<script type="text/javascript" src="[% interface %]/[% theme %]/en/lib/jquery/plugins/jquery.dataTables.min.js"></script>
-[% INCLUDE 'datatables-strings.inc' %]
-<script type="text/javascript" src="[% interface %]/[% theme %]/en/js/datatables.js"></script>
+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+[% INCLUDE 'datatables.inc' %]
 <script type="text/javascript">
 //<![CDATA[
-    [% IF (dateformat == 'metric') %]dt_add_type_uk_date();[% END %]
         $(document).ready(function() {
         [% UNLESS ( preview ) %]
          var sTable = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, {
             "sDom": 't',
-            "aoColumnDefs": [
-                { "aTargets": [ 0,1 ], "bSortable": false, "bSearchable": false }
-            ],
+            [% IF ( letter ) %]
+                "aoColumnDefs": [
+                    { "aTargets": [ 0,1 ], "bSortable": false, "bSearchable": false }
+                ],
+            [% ELSE %]
+                "aoColumnDefs": [
+                    { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }
+                ],
+            [% END %]
+            "aoColumns": [
+                [% IF ( letter ) %]null,[% END %]null,null,{ "sType": "anti-the" },null,null,{ "sType": "title-string" },{ "sType": "title-string" }
+        ],
             "bPaginate": false
         }));
         [% END %]
                // We need to use "input[name=serialid]:checked" instead of "input:checked". Otherwise, the "check all" box will pass the value of "on" as a serialid, which produces a SQL error.
              var selected = $("input[name=serialid]:checked");
 
-               if (selected.length == 0) {
-                       alert(_("Please select at least one item to export."));
-                       return false;
-               }
-               
-               // Building the url from currently checked boxes
-               var url = '/cgi-bin/koha/serials/lateissues-excel.pl?supplierid=&amp;op=claims';
-               for (var i = 0; i < selected.length; i++) {
-                   url += '&amp;serialid=' + selected[i].value;
-               }
+        if (selected.length == 0) {
+            alert(_("Please select at least one item to export."));
+            return false;
+        }
+
+        // Building the url from currently checked boxes
+        var url = '/cgi-bin/koha/serials/lateissues-export.pl?supplierid=&amp;op=claims';
+        for (var i = 0; i < selected.length; i++) {
+            url += '&amp;serialid=' + selected[i].value;
+        }
         url += '&amp;csv_profile=' + $("#csv_profile_for_export option:selected").val();
-               // And redirecting to the CSV page
-               location.href = url;
-               return false;
-           }); 
+        // And redirecting to the CSV page
+        location.href = url;
+        return false;
+        });
 
         $("#titlefilter").keyup( function () {
             sTable.fnFilter( this.value, 3 ); // 3 is position of title column
         }
     }
 
-       // Filter by branch
-       function filterByBranch() {
-           selectedBranch = $("#branchfilter").val();
-           if (selectedBranch == "all") {
-               clearFilters();
-           } else {
-               $("table#claimst tbody tr").hide();
-               $("table#claimst tbody tr:contains(" + selectedBranch + ")").show();
-           }
-       }
+    // Filter by branch
+    function filterByBranch() {
+        selectedBranch = $("#branchfilter").val();
+        if (selectedBranch == "all") {
+            clearFilters();
+        } else {
+            $("table#claimst tbody tr").hide();
+            $("table#claimst tbody tr").each( function() {
+                if ( $(this).find("span.branch-" + selectedBranch).size() > 0 ) {
+                    $(this).show();
+                }
+            });
+        }
+    }
+
        // Filter by date
        function filterByDate() {
         var beginDate = Date_from_syspref($("#from").val()).getTime();
             <option value="expected">Expected</option>
             <option value="late">Late</option>
             <option value="missing">Missing</option>
+            <option value="missing_never_received">Missing (never received)</option>
+            <option value="missing_sold_out">Missing (sold out)</option>
+            <option value="missing_damaged">Missing (damaged)</option>
+            <option value="missing_lost">Missing (lost)</option>
             <option value="claimed">Claimed</option>
            </select>
        </li>
     <li>
            <label for="branchfilter">Library: </label>
            <select id="branchfilter" onchange="filterByBranch();">
+            <option value="all" selected="selected">(All)</option>
             [% FOREACH branchloo IN branchloop %]
-                [% IF ( branchloo.selected ) %]
-                <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
-                [% ELSE %]
                 <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
-                [% END %]
             [% END %]
         </select>
        </li>
         <input type="hidden" name="order" value="[% order %]" />
          <table id="claimst">
                 <thead><tr>
-                    [% IF ( letter ) %]
                     <th><input type="checkbox" id="CheckAll"></th>
-                    [% END %]
                     <th>Vendor</th>
                     <th>Library</th>
                     <th>Title</th>
+                    <th>ISSN</th>
                     <th>Issue number</th>
                     <th>Status</th>
                     <th>Since</th>
                 </tr></thead>
                 <tbody>[% FOREACH missingissue IN missingissues %]
                     <tr>
-                        [% IF ( letter ) %]
-                            <td>
-                    <input type="checkbox" name="serialid" value="[% missingissue.serialid %]" />
-                            </td>
-                        [% END %]
+                        <td>
+                            <input type="checkbox" name="serialid" value="[% missingissue.serialid %]" />
+                        </td>
                         <td>
                         [% missingissue.name %]
                         </td>
                         <td>
-                        [% missingissue.branchcode %]
+                            <span class="branch-[% missingissue.branchcode %]">[% Branches.GetName( missingissue.branchcode ) %]</span>
                         </td>
                         <td>
                         <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% missingissue.subscriptionid %]">[% missingissue.title |html %]</a>
                         </td>
+                        <td>
+                          [% missingissue.issn %]
+                        </td>
                         <td>
                         [% missingissue.serialseq %]
                         </td>
                             [% IF ( missingissue.status1 ) %]<span class="status-expected">Expected</span>[% END %]
                             [% IF ( missingissue.status3 ) %]<span class="status-late">Late</span>[% END %]
                             [% IF ( missingissue.status4 ) %]<span class="status-missing">Missing</span>[% END %]
+                            [% IF ( missingissue.status41 ) %]<span class="status-missing_never_received">Missing (never received)</span>[% END %]
+                            [% IF ( missingissue.status42 ) %]<span class="status-missing_sold_out">Missing (sold out)</span>[% END %]
+                            [% IF ( missingissue.status43 ) %]<span class="status-missing_damaged">Missing (damaged)</span>[% END %]
+                            [% IF ( missingissue.status44 ) %]<span class="status-missing_lost">Missing (lost)</span>[% END %]
                             [% IF ( missingissue.status7 ) %]<span class="status-claimed">Claimed</span>[% END %]
                         </td>
                         <td class="planneddate">
-                        [% missingissue.planneddate %]
+                            [% IF ( missingissue.planneddate ) %]
+                                <span title="[% missingissue.planneddateISO %]">[% missingissue.planneddate %]</span>
+                            [% ELSE %]
+                                <span title="0000-00-00"></span>
+                            [% END %]
                         </td>
                         <td>
-                        [% missingissue.claimdate %]
+                            [% IF ( missingissue.claimdate ) %]
+                                <span title="[% missingissue.claimdateISO %]">[% missingissue.claimdate %]</span>
+                            [% ELSE %]
+                                <span title="0000-00-00"></span>
+                            [% END %]
                         </td>
                     </tr>
                 [% END %]</tbody>
             </table>
 
         [% IF csv_profiles %]
-          <p>
-            <span class="exportSelected"><a id="ExportSelected" href="/cgi-bin/koha/serials/claims.pl">Export selected items data</a></span>
-            using the following csv profile:
+          <fieldset class="action">
+            <label for="csv_code">Select CSV profile:</label>
             <select id="csv_profile_for_export">
               [% FOR csv IN csv_profiles %]
                 <option value="[% csv.export_format_id %]">[% csv.profile %]</option>
                [% END %]
             </select>
-          </p>
+            <span class="exportSelected"><a id="ExportSelected" href="/cgi-bin/koha/serials/claims.pl">Download selected claims</a></span>
         [% END %]
 
 [% IF ( letter ) %]