Bug 14667: UI/UX improvements for the Label creator
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / labels / label-edit-batch.tt
index 6666537..ed3f148 100644 (file)
                 return true;    // ok
             };
         }
-           function DeleteConfirm() {
-                var msg = "Are you sure you want to delete batch [% batch_id %]?"
-                var answer = confirm(msg);
-                if (answer) {
-                    window.location = "/cgi-bin/koha/labels/label-manage.pl?op=delete&label_element=batch&element_id=[% batch_id %]";
-                }
-                else {
-                    return; // abort delete
-                }
-            };
             function Remove() {
                 items = new Array;
                 item_num = new Array;
                     item_msg = item_num.join(", ");
                     var msg = "Are you sure you want to remove label number(s): " + item_msg + " from this batch?"
                 }
-//                else if (document.items.action.checked) {
-//                    getstr = "label_id="+document.items.action.value;
-//                    var msg = "Are you sure you want to remove selected item from this batch?"
-//                }
                 else {
                     alert(_("Please select at least label to delete."));
                     return;     // no item selected
                 }
             };
             function Add() {
-                var barcodes = document.getElementById("barcode");
-                if (barcodes.value == '') {
+                var number_list = document.getElementById("number_list");
+                if (number_list.value == '') {
                     window.open("/cgi-bin/koha/labels/label-item-search.pl?batch_id=[% batch_id %]&type=labels",'FindABibIndex','width=875,height=400,toolbar=no,scrollbars=yes');
                 }
                 else {
-                    document.forms["add_by_barcode"].submit();
+                    document.forms["add_by_number"].submit();
                 }
             };
+
+            function add_item(item_number) {
+                $("#itemnum_enter").prop("checked",true);
+                $("#number_list").val($("#number_list").val()+item_number+"\r\n");
+            };
+
             function DeDuplicate() {
                 window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=de_duplicate&batch_id=[% batch_id %]";
             };
                     { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }
                 ],
-                "aaSorting": [[ 1, "asc" ]],
+                "aaSorting": [[ 0, "asc" ]],
                 "sPaginationType": "four_button"
             }));
             $("#additems").click(function(){
         <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
         <a href="/cgi-bin/koha/labels/label-home.pl">Labels home</a> &rsaquo;
         <a href="/cgi-bin/koha/labels/label-manage.pl?label_element=batch">Manage label batches</a> &rsaquo;
-        Manage batch number [% batch_id %]
+        [% IF batch_id %]
+            Manage batch number [% batch_id %]
+        [% ELSE %]
+            Create new batch
+        [% END %]
     </div>
     <div id="doc3" class="yui-t2">
         <div id="bd">
             <div id="yui-main">
                 <div class="yui-b">
-                    <div id="toolbar" class="btn-toolbar">
-                            <a class="btn btn-small" id="additems" href="#">Add item(s)</a>[% IF ( table_loop ) %]
-                            <a class="btn btn-small" id="removeitems" href="#">Remove item(s)</a>
-                            <a class="btn btn-small" id="deletebatch" href="#">Delete batch</a>
-                            <a class="btn btn-small" id="deduplicate" href="#">Remove duplicates</a>
-                            <a class="btn btn-small" id="exportitems" href="#">Export item(s)</a>
-                            <a class="btn btn-small" id="exportbatch" href="#">Export batch</a>[% END %]
-                    </div>
-
+                        [% INCLUDE 'labels-toolbar.inc' %]
                         [% IF ( err ) %]
                             <div class="dialog alert">
                                 <strong>WARNING:</strong> An error was encountered and [% errstr %] Please have your system administrator check the error log for details.
 
                         <div id="manage-label-batches">
                             <div class="hint">Current library: [% LoginBranchname %]</div>
-                            <form name="add_by_barcode" action="/cgi-bin/koha/labels/label-edit-batch.pl" method="post">
+                            <form name="add_by_number" action="/cgi-bin/koha/labels/label-edit-batch.pl" method="post">
                                 <div>
                                     <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
                                     <ol><li>
-                                    <input type="hidden" name="op" value="add" />
-                                    <input type="hidden" name="batch_id" value="[% batch_id %]" />
-                                    <label for="barcode">Add by barcode(s):
-                                        <br /> <span class="hint">One barcode per line.</span>
-                                        <br /> <span class="hint">Leave empty to add via item search.</span>
-                                    </label>
-                                    <textarea rows="5" id="barcode" name="barcode" tabindex="1" class="focus"></textarea>
+                                        <input type="hidden" name="op" value="add" />
+                                        <input type="hidden" name="batch_id" value="[% batch_id %]" />
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="number_type" id="barcode_enter" value="barcode" checked />
+                                        <label for="barcode_enter">Enter by barcode</label><br/>
+                                        <input type="radio" name="number_type" id="itemnum_enter" value="itemnumber" />
+                                        <label for="itemnum_enter">Enter by itemnumber</label>
+                                    </li>
+                                    <li>
+                                        <label for="number_list">Add by barcode(s) or itemnumbers(s):
+                                            <br /> <span class="hint">One number per line.</span>
+                                            <br /> <span class="hint">Leave empty to add via item search (itemnunber).</span>
+                                        </label>
+                                        <textarea rows="5" id="number_list" name="number_list" tabindex="1" class="focus"></textarea>
                                     </li></ol>
                                     </fieldset>
                                 </div>
                             </form>
-                                [% IF ( table_loop ) %]
+                            <div id="batch-manage" class="btn-toolbar">
+                                <a class="btn btn-small" id="additems" href="#"><icon class="icon-plus"></icon> Add item(s)</a>[% IF ( table_loop ) %]
+                                <a class="btn btn-small" id="removeitems" href="#"><icon class="icon-trash"></icon> Remove selected items</a>
+                                <a class="btn btn-small" id="deduplicate" href="#"><icon class="icon-minus"></icon> Remove duplicates</a>
+                                <a class="btn btn-small" id="exportitems" href="#"><icon class="icon-share"></icon> Export selected items</a>
+                                <a class="btn btn-small" id="exportbatch" href="#"><icon class="icon-share"></icon> Export full batch</a>[% END %]
+                            </div>
+                            [% IF ( table_loop ) %]
                                 <form name="items" class="checkboxed">
                                     <h2>Items in batch number [% batch_id %]</h2>
                                     <table id="batcht">
                                                     <tr>
                                                         [% FOREACH text_field IN table_loo.text_fields %]
                                                             [% IF ( text_field.select_field ) %]
-                                                                <td><input type="checkbox" name="action" value="[% text_field.field_value %]"></td>
+                                                                <td><a class="btn btn-mini" onclick="return confirm('Are you sure you want to delete this?');" href="/cgi-bin/koha/labels/label-edit-batch.pl?op=remove&amp;batch_id=[% batch_id |url %]&amp;label_id=[% text_field.field_value |url %]"><icon class="icon-trash"></icon> Delete</a> <a class="btn btn-mini" href="#" onclick="GB_showCenter('Export labels','/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id %]&amp;label_id=[% text_field.field_value |url %]')"><icon class="icon-share"></icon> Export</a></td>
+                                                                <td><center><input type="checkbox" name="action" value="[% text_field.field_value %]"></center></td>
                                                             [% ELSE %]
                                                                 <td>
                                                                     [% IF ( text_field.field_name == '_item_type_tbl' ) %]
                                 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
                                 <ol><li>
                                     <div class="dialog message">
-                                        <h4>There are no items in Batch [% batch_id %] yet</h4>
-                                        <p>Add items by barcode using the text area above or leave empty to add via item search.</p>
+                                        <h4>There are no items in this batch yet</h4>
+                                        <p>Add items by using the text area above or leave empty to add via item search.</p>
                                     </div>
                                 </li></ol>
                                 </fieldset>