Bug 14100: (follow-up) Language overlay for item types
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reports / acquisitions_stats.tt
index 79d289a..a03b058 100644 (file)
@@ -2,6 +2,39 @@
 <title>Koha &rsaquo; Reports [% IF ( do_it ) %]&rsaquo; Acquisitions statistics &rsaquo; Results[% ELSE %]&rsaquo; Acquisitions statistics[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 [% INCLUDE 'calendar.inc' %]
+<script type="text/javascript">
+//<![CDATA[
+        $(document).ready(function() {
+        // http://jqueryui.com/demos/datepicker/#date-range
+        var dates = $( "#from, #to" ).datepicker({
+            changeMonth: true,
+            numberOfMonths: 1,
+            onSelect: function( selectedDate ) {
+                var option = this.id == "from" ? "minDate" : "maxDate",
+                    instance = $( this ).data( "datepicker" );
+                    date = $.datepicker.parseDate(
+                        instance.settings.dateFormat ||
+                        $.datepicker._defaults.dateFormat,
+                        selectedDate, instance.settings );
+                dates.not( this ).datepicker( "option", option, date );
+            }
+        });
+        var datesRO = $( "#fromRO, #toRO" ).datepicker({
+            changeMonth: true,
+            numberOfMonths: 1,
+            onSelect: function( selectedDate ) {
+                var option = this.id == "fromRO" ? "minDate" : "maxDate",
+                    instance = $( this ).data( "datepicker" );
+                    date = $.datepicker.parseDate(
+                        instance.settings.dateFormat ||
+                        $.datepicker._defaults.dateFormat,
+                        selectedDate, instance.settings );
+                datesRO.not( this ).datepicker( "option", option, date );
+            }
+        });
+        });
+//]]>
+</script>
 </head>
 <body id="rep_acquisitions_stats" class="rep">
 [% INCLUDE 'header.inc' %]
 [% IF ( do_it ) %]
        [% FOREACH mainloo IN mainloop %]
                <h1>Acquisitions statistics </h1>
-               [% IF ( mainloo.loopfilter ) %]
-                       <p><b>Filtered on:</b></p>
-                       [% FOREACH loopfilte IN mainloo.loopfilter %]
-                                       <p>[% loopfilte.crit %]: [% loopfilte.filter %]</p>
+        [% IF ( mainloo.loopfilter.size ) %]
+            <p><b>Filtered on:</b></p>
+            [% FOREACH loopfilte IN mainloo.loopfilter %]
+                <p>
+                    [% SWITCH loopfilte.crit %]
+                        [% CASE '0' %] Placed on (from)
+                        [% CASE '1' %] Placed on (to)
+                        [% CASE '2' %] Received on (from)
+                        [% CASE '3' %] Received on (to)
+                        [% CASE '4' %] Vendor
+                        [% CASE '5' %] Home library
+                        [% CASE '6' %] Collection
+                        [% CASE '7' %] Item type
+                        [% CASE '8' %] Fund
+                        [% CASE '9' %] Sort1
+                        [% CASE '10' %] Sort2
+                        [% CASE %] Unknown filter
+                    [% END %]
+                    : [% loopfilte.filter %]
+                </p>
                        [% END %]
                [% END %]
 
                                <td><input type="radio" name="Line" value="aqbasket.closedate" /></td>
                                <td><input type="radio" checked="checked" name="Column" value="aqbasket.closedate" /> </td>
                                <td> From <input type="text" size="10" id="from" name="Filter" value="" />
-                            <img src="[% themelang %]/lib/calendar/cal.gif" alt="Show calendar" border="0" id="openCalendarFrom" style="cursor: pointer;" />
-                                                                       <script type="text/javascript">
-                                                                       //<![CDATA[
-                                                                       function validate1(date) {
-                                                                               var day = date.getDate();
-                                                                               var month = date.getMonth() + 1;
-                                                                               var year = date.getFullYear();
-                                                                               var weekDay = date.getDay();
-                                                                               var dayMonth = month + '-' + day;
-                                                                               var dateString = year + '-' + month + '-' + day;
-                                                                               var dateTo = document.getElementById('to').value.split("-");
-                                                                               var limitDate = new Date(dateTo[0], (dateTo[1] - 1), dateTo[2]);
-                                                                               if (date > limitDate) {
-                                                                                       return true;
-                                                                               } else {
-                                                                                       return false;
-                                                                               }
-                                                                       }
-
-                                                                       Calendar.setup(
-                                                                               {
-                                                                                       inputField : "from",
-                                                                                       ifFormat : "[% DHTMLcalendar_dateformat %]",
-                                                                                       button : "openCalendarFrom",
-                                                                                       disableFunc : validate1,
-                                                                                       dateStatusFunc : validate1
-                                                                               }
-                                                                       );
-                                                                       //]]>
-                                                               </script>
                                <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
                                        To <input size="10" id="to" name="Filter" type="text" value="" />
-                                               <img src="[% themelang %]/lib/calendar/cal.gif" alt="Show Calendar" id="openCalendarTo" style="cursor: pointer;" border="0" />
-                                                       <script type="text/javascript">
-                                                       //<![CDATA[
-                                                               function validate2(date) {
-                                                                       var day = date.getDate();
-                                                                       var month = date.getMonth() + 1;
-                                                                       var year = date.getFullYear();
-                                                                       var weekDay = date.getDay();
-                                                                       var dayMonth = month + '-' + day;
-                                                                       var dateString = year + '-' + month + '-' + day;
-                                                                       var dateFrom = document.getElementById('from').value.split("-");
-                                                                       var limitDate = new Date(dateFrom[0], (dateFrom[1] - 1), dateFrom[2]);
-                                                                       if (limitDate > date) {
-                                                                               return true;
-                                                                       } else {
-                                                                               return false;
-                                                                       }
-                                                               }
-
-                                                               Calendar.setup(
-                                                                       {
-                                                                               inputField : "to",
-                                                                               ifFormat : "[% DHTMLcalendar_dateformat %]",
-                                                                               button : "openCalendarTo",
-                                                                               disableFunc : validate2,
-                                                                               dateStatusFunc : validate2
-                                                                       }
-                                                               );
-                                                       //]]>
-                                                       </script>
                                <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
                                </td>
                        </tr>
                                <td><input type="radio" name="Line" value="aqorders.datereceived" /></td>
                                <td><input type="radio" name="Column" value="aqorders.datereceived" /></td>
                                <td> From <input type="text" size="10" id="fromRO" name="Filter" value="" />
-                                                       <img src="[% themelang %]/lib/calendar/cal.gif" alt="Show Calendar" border="0" id="openCalendarFromRO" style="cursor: pointer;" />
-                                                                       <script type="text/javascript">
-                                                                       //<![CDATA[
-                                                                       function validate1(date) {
-                                                                               var day = date.getDate();
-                                                                               var month = date.getMonth() + 1;
-                                                                               var year = date.getFullYear();
-                                                                               var weekDay = date.getDay();
-                                                                               var dayMonth = month + '-' + day;
-                                                                               var dateString = year + '-' + month + '-' + day;
-                                                                               var dateTo = document.getElementById('toRO').value.split("-");
-                                                                               var limitDate = new Date(dateTo[0], (dateTo[1] - 1), dateTo[2]);
-                                                                               if (date > limitDate) {
-                                                                                       return true;
-                                                                               } else {
-                                                                                       return false;
-                                                                               }
-                                                                       }
-
-                                                                       Calendar.setup(
-                                                                               {
-                                                                                       inputField : "fromRO",
-                                                                                       ifFormat : "[% DHTMLcalendar_dateformat %]",
-                                                                                       button : "openCalendarFromRO",
-                                                                                       disableFunc : validate1,
-                                                                                       dateStatusFunc : validate1
-                                                                               }
-                                                                       );
-                                                                       //]]>
-                                                                       </script>
                                <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
                                        To <input type="text" size="10" id="toRO" name="Filter" value="" />
-                                               <img src="[% themelang %]/lib/calendar/cal.gif" alt="Show Calendar" id="openCalendarToRO" style="cursor: pointer;" border="0" />
-                                                               <script type="text/javascript">
-                                                               //<![CDATA[
-                                                               function validate2(date) {
-                                                                       var day = date.getDate();
-                                                                       var month = date.getMonth() + 1;
-                                                                       var year = date.getFullYear();
-                                                                       var weekDay = date.getDay();
-                                                                       var dayMonth = month + '-' + day;
-                                                                       var dateString = year + '-' + month + '-' + day;
-                                                                       var dateFrom = document.getElementById('fromRO').value.split("-");
-                                                                       var limitDate = new Date(dateFrom[0], (dateFrom[1] - 1), dateFrom[2]);
-                                                                       if (limitDate > date) {
-                                                                               return true;
-                                                                       } else {
-                                                                               return false;
-                                                                       }
-                                                               }
-
-                                                               Calendar.setup(
-                                                                       {
-                                                                               inputField : "toRO",
-                                                                               ifFormat : "[% DHTMLcalendar_dateformat %]",
-                                                                               button : "openCalendarToRO",
-                                                                               disableFunc : validate2,
-                                                                               dateStatusFunc : validate2
-                                                                       }
-                                                               );
-                                                               //]]>
-                                                               </script>
                                <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
                                </td>
                        </tr>
                                <td>Vendor</td>
                                <td><input type="radio" checked="checked" name="Line" value="aqbooksellers.name" /></td>
                                <td><input type="radio" name="Column" value="aqbooksellers.name" /></td>
-                               <td>[% CGIBookSeller %]</td>
-                       </tr>
+                <td>
+                    <select name="Filter">
+                        <option value="">All vendors</option>
+                        [% FOREACH bookseller IN booksellers %]
+                            <option value="[% bookseller.name %]">[% bookseller.name %]</option>
+                        [% END %]
+                    </select>
+                </td>
+            </tr>
+            <tr>
+                <td>Home library</td>
+                <td><input type="radio" name="Line" value="items.homebranch" /></td>
+                <td><input type="radio" name="Column" value="items.homebranch" /></td>
+                <td>
+                    <select name="Filter">
+                        <option value="" selected="selected">All libraries</option>
+                        [% FOREACH branch IN branches %]
+                            <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
+                        [% END %]
+                    </select>
+                </td>
+            </tr>
+            <tr>
+                <td>
+                    [% IF ccode_label %]
+                        [% ccode_label %]
+                    [% ELSE %]
+                        Collection
+                    [% END %]
+                </td>
+                <td><input type="radio" name="Line" value="items.ccode" /></td>
+                <td><input type="radio" name="Column" value="items.ccode" /></td>
+                <td>
+                    [% IF ccode_avlist.size %]
+                        <select name="Filter">
+                            <option value="" selected="selected">All</option>
+                            [% FOREACH ccode_av IN ccode_avlist %]
+                                <option value="[% ccode_av.value %]">[% ccode_av.lib %]</option>
+                            [% END %]
+                        </select>
+                    [% ELSE %]
+                        <input type="text" name="Filter" />
+                    [% END %]
+                </td>
+            </tr>
                        <tr>
-                               <td>Item Type</td>
+                <td>Item type</td>
                                <td><input type="radio" name="Line" value="biblioitems.itemtype" /></td>
                                <td><input type="radio" name="Column" value="biblioitems.itemtype" /></td>
-                               <td>[% CGIItemType %]</td>
+                <td>
+                    <select name="Filter" size="1" id="itemtypes">
+                        <option value="">All item types</option>
+                        [% FOREACH itemtype IN itemtypes %]
+                        <option value="[% itemtype.itemtype %]">[% itemtype.translated_description %]</option>
+                        [% END %]
+                    </select>
+                </td>
                        </tr>
 
                        <tr>
-                               <td>Budget</td>
+                               <td>Fund</td>
                                <td><input type="radio" name="Line" value="aqbudgets.budget_code" /></td>
                                <td><input type="radio" name="Column" value="aqbudgets.budget_code" /></td>
-                               <td>[% CGIBudget %]</td>
+                <td>
+                    <select name="Filter" size="1" id="budget">
+                        <option value="">All funds</option>
+                        [% FOREACH value IN Budgets.values %]
+                        <option value="[% value %]">[% Budgets.labels.$value %]</option>
+                        [% END %]
+                    </select>
+                </td>
                        </tr>
 
                        [% IF ( hassort1 ) %]
                                        <td>Sort1</td>
                                        <td><input type="radio" name="Line" value="aqorders.sort1" /></td>
                                        <td><input type="radio" name="Column" value="aqorders.sort1" /></td>
-                                       <td>[% CGISort1 %] </td>
+                    <td>
+                        <select name="Filter" size="1" id="sort1">
+                            <option value="">All</option>
+                            [% FOREACH value IN Sort1.values %]
+                            <option value="[% value %]">[% Sort1.labels.$value %]</option>
+                            [% END %]
+                        </select>
+                    </td>
                                </tr>
                        [% END %]
                        [% IF ( hassort2 ) %]
                                        <td>Sort2</td>
                                        <td><input type="radio" name="Line" value="aqorders.sort2" /></td>
                                        <td><input type="radio" name="Column" value="aqorders.sort2" /></td>
-                                       <td>[% CGISort2 %] </td>
+                    <td>
+                        <select name="Filter" size="1" id="sort2">
+                            <option value="">All</option>
+                            [% FOREACH value IN Sort2.values %]
+                            <option value="[% value %]">[% Sort2.labels.$value %]</option>
+                            [% END %]
+                        </select>
+                    </td>
                                </tr>
                        [% END %]
                </tbody>
        </table><br />
        </fieldset>
 
-<fieldset class="rows">                <legend> Cell value </legend>
-                       <ol><li><label for="cellvalue1">Count items</label><input type="radio" name="Cellvalue" id="cellvalue1" value="1" checked="checked" /> </li>
-                       <li><label for="cellvalue2">Amount</label><input type="radio" name="Cellvalue" id="cellvalue2" value="2" /> </li></ol></fieldset>
+<fieldset class="rows">
+    <legend> Cell value </legend>
+    <ol>
+        <li>
+            <label for="cellvalue1">Count items</label><input type="radio" name="Cellvalue" id="cellvalue1" value="1" checked="checked" />
+        </li>
+        <li>
+            <label for="cellvalue2">Count unique biblios</label><input type="radio" name="Cellvalue" id="cellvalue2" value="2" />
+        </li>
+        <li>
+            <label for="cellvalue3">Amount</label><input type="radio" name="Cellvalue" id="cellvalue3" value="3" />
+        </li>
+        <li>
+            <label for="cellvalue4">Ordered amount</label><input type="radio" name="Cellvalue" id="cellvalue4" value="4" />
+        </li>
+        <li>
+            <label for="cellvalue5">Spent amount</label><input type="radio" name="Cellvalue" id="cellvalue5" value="5" />
+        </li>
+    </ol>
+</fieldset>
 
        <fieldset class="rows">
        <legend>Output</legend>
-<ol><li><label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" /> </li>
-<li><label for="outputfile">To a file:</label>                 <input type="radio" name="output" value="file" id="outputfile" /> <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" /> <label class="inline" for="MIME">Into an application
-               </label>[% CGIextChoice %]
-               [% CGIsepChoice %]</li></ol>
+    <ol>
+        <li>
+            <label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
+        </li>
+        <li>
+            <label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" />
+            <label class="inline" for="basename">Named: </label> <input type="text" name="basename" id="basename" value="Export" />
+            <label class="inline" for="MIME">Into an application</label>
+            <select name="MIME" id="MIME" size="1">
+                <option value="CSV">CSV</option>
+            </select>
+            <select name="sep" id="sep" size="1">
+            [% FOREACH value IN CGIsepChoice.values.sort() %]
+              [% IF ( value == CGIsepChoice.default ) %]
+                <option value="[% value %]" selected="selected">[% value %]</option>
+              [% ELSE %]
+                <option value="[% value %]">[% value %]</option>
+              [% END %]
+            [% END %]
+            </select>
+        </li>
+    </ol>
        </fieldset>
 
        <fieldset class="action">