Bug 10716: fix JavaScript error on basket groups page
[koha-ffzg.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / basketgroup.tt
index d8be02a..0dfd1c0 100644 (file)
@@ -1,9 +1,15 @@
+[% USE KohaBranchName %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Basket grouping for [% booksellername |html %]</title>
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
 [% INCLUDE 'doc-head-close.inc' %]
 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
+[% INCLUDE 'datatables-strings.inc' %]
 <script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
+<script type="text/javascript" src="[% yuipath %]/utilities/utilities.js"></script>
+<script type="text/javascript" src="[% yuipath %]/button/button-min.js"></script>
+<script type="text/javascript" src="[% yuipath %]/container/container_core-min.js"></script>
+<script type="text/javascript" src="[% yuipath %]/menu/menu-min.js"></script>
 <script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
 [% IF ( grouping ) %]
 <script type="text/javascript" src="[% yuipath %]/yahoo-dom-event/yahoo-dom-event.js"></script>
@@ -20,7 +26,9 @@ body {
        margin:0;
        padding:0;
 }
-
+#basketgroupcolumns {
+    width: 58em;
+}
 #ungrouped {
        overflow: auto;
        height: 400px;
@@ -88,6 +96,12 @@ fieldset.various li {
 //<![CDATA[
        YAHOO.util.Event.onDOMReady(DDApp.init, DDApp, true);
 
+var MSG_CONFIRM_CLOSE_BASKETGROUP = _("Are you sure you want to close this basketgroup?");
+var MSG_CLOSE_EMPTY_BASKET = _("Why close an empty basket?");
+var MSG_SAVE_BEFORE_PRINTING = _("You need to save the page before printing");
+var MSG_REOPEN_BASKETGROUP = _("reopen basketgroup");
+var MSG_FILE_DOWNLOAD_ERROR = _("Error downloading the file");
+
 function submitForm(form) {
     if (form.close.checked == true) {
        var input = document.createElement("input");
@@ -97,53 +111,21 @@ function submitForm(form) {
        form.appendChild(input);
     }
 }
-// prepare DOM for YUI Toolbar
 
  $(document).ready(function() {
-  //  $("#toolbar").empty();
-    yuiToolbar();
     $("#basket_groups").tabs();
 
     $("table").dataTable($.extend(true, {}, dataTablesDefaults, {
         "aoColumnDefs": [
             { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
         ],
-        "bAutoWidth": false,
-        "bPaginate": false,
-        "bInfo": false,
-        "bFilter": false,
+        sDom: 't',
+        "bAutoWidth": false
     } ));
 
  });
 
-// YUI Toolbar Functions
-
-function yuiToolbar() {
-       var booksellermenu = [
-               { text: _("Vendor"), url: "/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]" },
-               { text: _("Edit vendor"), url: "/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]&op=enter"},
-       ]
-       var ordersbutton = [
-                { text: _("Manage orders"), url: "/cgi-bin/koha/acqui/booksellers.pl?booksellerid=[% booksellerid %]" },
-                { text: _("Edit uncertain prices"), url: "/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=[% booksellerid %]&owner=1" },
-       ]
-       new YAHOO.widget.Button("newbasketgroup");
-    new YAHOO.widget.Button({
-        type: "menu",
-        label: _("Vendor"),
-        name: "booksellerbutton",
-        menu: booksellermenu,
-        container: "toolbar"
-    });
 
-    new YAHOO.widget.Button({
-        type: "menu",
-        label: _("Orders"),
-        name: "ordersbutton",
-        menu: ordersbutton,
-        container: "toolbar"
-    });
-}
 //]]>
 </script>
 </head>
@@ -151,19 +133,21 @@ function yuiToolbar() {
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'acquisitions-search.inc' %]
 
-<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/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a> &rsaquo; Basket grouping</div>
+<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;
+[% IF ( grouping ) %]
+    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid %]">Basket grouping</a> &rsaquo; Add basket group for [% booksellername |html %]</div>
+[% ELSE %]
+    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a> &rsaquo; Basket grouping</div>
+[% END %]
+
+<div id="doc3" class="yui-t2">
+    <div id="bd">
+    <div id="yui-main">
+    <div class="yui-b">
 
-<div id="doc" class="yui-t7">
-            
-        <div class="yui-b"> 
-               <div id="toolbar">
-                <a href="?op=add&amp;booksellerid=[% booksellerid %]" name="newbasketgroup" id="newbasketgroup">New basket group</a>
-                       </div>
-            <h1>Basket grouping for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1>
-               </div>
 [% IF ( grouping ) %]
-       <div id="bd"> 
-           <div class="yui-g"> 
+    <h1>Add basket group for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1>
+        <div id="basketgroupcolumns" class="yui-g">
                    <div class="yui-u">
 
                                <form action="[% scriptname %]" method="post" name="basketgroups" id="basketgroups">
@@ -249,14 +233,18 @@ function yuiToolbar() {
                                        <input type="hidden" name="basketgroupid" value="[% basketgroupid %]" />
                                [% END %]
                                <input type="hidden" name="op" value="attachbasket" />
-                               <input type="submit" value="Save" />
+                        <input type="submit" value="Save" /> <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid %]" class="cancel">Cancel</a>
                        </fieldset>
                                </form>
                        </div> 
                </div>   
-    </div> 
 [% ELSE %]
-       <div class="yui-g">
+
+    <div id="toolbar" class="btn-toolbar">
+        <div class="btn-group"><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="newbasketgroup"><i class="icon-plus"></i> New basket group</a></div>
+    </div>
+    <h1>Basket grouping for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1>
+
        <div id="basket_groups" class="toptabs">
        <ul class="ui-tabs-nav">
         [% UNLESS ( closed ) %]<li class="ui-tabs-selected"><a href="#opened">Open</a></li>
@@ -268,25 +256,32 @@ function yuiToolbar() {
         <table id="basket_group_opened">
                        <thead>
                                <tr>
-                    <th>Basket group</th><th>Action</th>
+                                        <th>Name</th>
+                                        <th>Number</th>
+                                        <th>Billing place</th>
+                                        <th>Delivery place</th>
+                                        <th>Number of baskets</th>
+                                        <th>Action</th>
                                </tr>
                        </thead>
                        <tbody>
                        [% FOREACH basketgroup IN basketgroups %]
                                [% UNLESS ( basketgroup.closed ) %]
                                        <tr>
-                                               <td><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% basketgroup.booksellerid %]&amp;basketgroupid=[% basketgroup.id %]">[% IF ( basketgroup.name ) %]
+                                               <td>[% IF ( basketgroup.name ) %]
                                                                                                        [% basketgroup.name %]
                                                                                                [% ELSE %]
                                                                                                        Basket group no. [% basketgroup.id %]
-                                                                                               [% END %]</a>
+                                                                                               [% END %]
                                                </td>
+                                    <td>[% basketgroup.id %]</td>
+                                    <td>[% basketgroup.billingplace | $KohaBranchName %]</td>
+                                    <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% basketgroup.deliveryplace | $KohaBranchName %][% END %]</td>
+                                    <td>[% basketgroup.basketsqty %]</td>
                                                        <td>
-                              <span>
                                                                <input type="button" onclick="closeandprint([% basketgroup.id %])" value="Close and print" />
                                                                <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="add" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Edit" /></form>
                                                                <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="delete" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Delete" /></form>
-                              </span>
                                                        </td>
                                        </tr>
                                [% END %]
@@ -298,7 +293,12 @@ function yuiToolbar() {
         <table id="basket_group_closed">
                        <thead>
                                <tr>
-                    <th>Basket group</th><th>Action</th>
+                                        <th>Name</th>
+                                        <th>Number</th>
+                                        <th>Billing place</th>
+                                        <th>Delivery place</th>
+                                        <th>Number of baskets</th>
+                                        <th>Action</th>
                                </tr>
                        </thead>
                        <tbody>
@@ -306,12 +306,16 @@ function yuiToolbar() {
                                [% IF ( basketgroup.closed ) %]
                                <tr>
                                <td>
-                    <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=reopen&amp;booksellerid=[% basketgroup.booksellerid %]&amp;basketgroupid=[% basketgroup.id %]">[% IF ( basketgroup.name ) %]
+                                     [% IF ( basketgroup.name ) %]
                                                                                        [% basketgroup.name %]
                                                                                [% ELSE %]
                                                                                        Basket group no. [% basketgroup.id %]
-                                                                               [% END %]</a>
+                                                                               [% END %]
                                        </td>
+                                    <td>[% basketgroup.id %]</td>
+                                    <td>[% basketgroup.billingplace | $KohaBranchName %]</td>
+                                    <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% basketgroup.deliveryplace | $KohaBranchName %][% END %]</td>
+                                    <td>[% basketgroup.basketsqty %]</td>
                                        <td>
                                                        <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="reopen" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Reopen" /></form>
                                                        <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="print" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Print" /></form>
@@ -323,8 +327,15 @@ function yuiToolbar() {
                                </tbody>
                        </table>
                        </div>
-                   </div>
-                   </div>
+        </div>
 [% END %]
-
+</div>
+</div>
+<div class="yui-b">
+[% IF ( booksellerid ) %]
+[% INCLUDE 'vendor-menu.inc' %]
+[% END %]
+[% INCLUDE 'acquisitions-menu.inc' %]
+</div>
+</div>
 [% INCLUDE 'intranet-bottom.inc' %]