Bug 19641: (follow-up) Move patron templates to the footer
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / patroncards / manage.tt
index 6f77888..3585ea0 100644 (file)
@@ -1,3 +1,4 @@
+[% USE CGI %]
 [% BLOCK translate_card_element %]
 [%-  SWITCH element -%]
 [%-  CASE 'layout'    -%]layout
@@ -26,7 +27,6 @@
     [% INCLUDE 'greybox.inc' %]
     <script type="text/javascript">
         //<![CDATA[
-            var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this?");
             function DeleteConfirm() {
                 var element_ids = selected_layouts("delete");
 
                 }
                 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 400, 800);
             };
-            function selected_layouts(op) {
+
+            function XportPatronlist() {
+                if ( patron_list_id.value.length < 1 ) {
+                    alert(_("Please select a patron list."));
+                    return;     // no patron list selected
+                }
+                getstr = 'patronlist_id='+patron_list_id.value;
+                return GB_showCenter(_("Export patron cards from list"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 700, 800);
+            };
+
+            function selected_layout(op) {
                 if (document.layouts.action.length) {
                     var selected = new Array();
                     for (i=0;i<document.layouts.action.length;i++){
                 Xport();
                 return false;
             });
+            $("#printlist").click(function(){
+                XportPatronlist();
+                return false;
+            });
+            $(".delete").on("click", function(){
+                return confirmDelete( _("Are you sure you want to delete this?") );
+            });
+            $(".export").on("click", function(e){
+                e.preventDefault();
+                var batch_id = $(this).data("batch-id");
+                GB_showCenter( _("Export single batch"),'/cgi-bin/koha/patroncards/print.pl?batch_id='+batch_id, 400, 800);
+            });
          });
 //]]>
 </script>
                                 <tr>
                                 [% FOREACH header_field IN table_loo.header_fields %]
                                     [% SWITCH header_field.field_label -%]
-                                        [% CASE "Select" -%]
-                                             [% IF ( print ) %]<th>Select</th>[% END %]
-                                        [% CASE %]
-                                             <th>[% header_field.field_label %]</th>
-                                        [% END -%]
+                                        [%-  CASE 'Layout ID'     -%]<th>Layout ID</th>
+                                        [%-  CASE 'Layout'        -%]<th>Layout</th>
+                                        [%-  CASE 'Action'        -%]<th>Action</th>
+                                        [%-  CASE 'Actions'       -%]<th>Actions</th>
+                                        [%-  CASE 'Select'        -%][% IF ( print ) %]<th>Select</th>[% END %]
+                                        [%-  CASE 'Template ID'   -%]<th>Template ID</th>
+                                        [%-  CASE 'Template Name' -%]<th>Template name</th>
+                                        [%-  CASE 'Description'   -%]<th>Description</th>
+                                        [%-  CASE 'Profile ID'    -%]<th>Profile ID</th>
+                                        [%-  CASE 'Printer Name'  -%]<th>Printer name</th>
+                                        [%-  CASE 'Paper Bin'     -%]<th>Paper bin</th>
+                                        [%-  CASE 'Batch ID'      -%]<th>Batch ID</th>
+                                        [%-  CASE 'Patron Count'  -%]<th>Patron count</th>
+                                        [%-  CASE                 -%]<th>[% header_field.field_label %]</th>
+                                    [% END -%]
                                 [% END %]
                                 </tr>
                                 [% ELSE %]
                                 [% FOREACH text_field IN table_loo.text_fields %]
                                 [% IF ( text_field.select_field ) %]
                                     <td>
-                                      <a class="btn btn-mini" href="/cgi-bin/koha/patroncards/edit-[% card_element %].pl?op=edit&element_id=[% text_field.field_value %]"><icon class="fa fa-edit"></icon> Edit</a>
-                                      [% IF ( print ) %]<a class="btn btn-mini" href="#" onclick="GB_showCenter('Export single batch','/cgi-bin/koha/patroncards/print.pl?batch_id=[% text_field.field_value |url %]', 400, 800)"><icon class="fa fa-share-square-o"></icon> Export</a>[% END %]
-                                      <a class="btn btn-mini" onclick="return confirm(MSG_CONFIRM_DELETE);" href="/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=[% card_element %]&element_id=[% text_field.field_value %]"><icon class="fa fa-trash"></icon> Delete</a>
+                                      <a class="btn btn-default btn-xs" href="/cgi-bin/koha/patroncards/edit-[% card_element %].pl?op=edit&element_id=[% text_field.field_value %]"><i class="fa fa-edit"></i> Edit</a>
+                                      [% IF ( print ) %]<a class="btn btn-default btn-xs export" data-batch-id="[% text_field.field_value |url %]" href="/cgi-bin/koha/patroncards/print.pl?batch_id=[% text_field.field_value |url %]"><i class="fa fa-share-square-o"></i> Export</a>[% END %]
+                                      <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=[% card_element %]&element_id=[% text_field.field_value %]"><i class="fa fa-trash"></i> Delete</a>
                                     </td>
-                                    [% IF ( print ) %]<td align="center"><input type="checkbox" name="action" value="[% text_field.field_value %]" /></td>[% END %]
+                                    [% IF ( print ) %]<td><input type="checkbox" name="action" value="[% text_field.field_value %]" /></td>[% END %]
                                 [% ELSIF ( text_field.field_value ) %]
                                     <td>[% text_field.field_value %]</td>
                                 [% ELSE %]
                                 [% END %]
                             </table>
                             <fieldset class="action">
-                                [% IF ( print ) %]<input class="btn btn-sm" type="button" id="print" value="Export selected batches" />[% END %]
+                                [% IF ( print ) %]<input type="button" id="print" value="Export selected batches" />[% END %]
+                            </fieldset>
+                            [% IF patron_lists %]
+                            <fieldset class="rows">
+                                <legend>Or use a patron list</legend>
+                                <ol>
+                                    <li>
+                                        <label for="patron_list_id">Patron list: </label>
+                                        <select id="patron_list_id" name="patron_list_id">
+                                            <option value=""></option>
+                                            [% FOREACH pl IN patron_lists %]
+                                                <option value="[% pl.patron_list_id %]">[% pl.name %]</option>
+                                            [% END %]
+                                        </select>
+                                    </li>
+                                </ol>
+                            </fieldset>
+                            <fieldset class="action">
+                                <input type="button" id="printlist" value="Export from patron list" />
                             </fieldset>
+                            [% END %]
                             </form>
+
                             [% ELSE %]
                         <div class="dialog message">
                             <h4>There are no [% PROCESS translate_card_element element=card_element_title %] currently available.</h4>