Bug 26602: Don't export "actions" column
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / clubs / clubs.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% USE Branches %]
5 [% USE Koha %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha &rsaquo; Tools &rsaquo; Patron clubs</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10
11 </head>
12
13 <body id="clubs_clubs" class="clubs">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'cat-search.inc' %]
16 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; Patron clubs</div>
17
18 <div class="main container-fluid">
19     <div class="row">
20         <div class="col-sm-10 col-sm-push-2">
21             <main>
22
23                 <h1>Patron clubs</h1>
24
25                 [% IF club_template %]
26                     <div class="dialog message">
27                         [% IF stored == 'updated' %]
28                             <p>Club template <em>[% club_template.name | html %]</em> was updated.</p>
29                         [% ELSE %]
30                             <p>Club template <em>[% club_template.name | html %]</em> was saved.</p>
31                         [% END %]
32                     </div>
33                 [% ELSIF club %]
34                     <div class="dialog message">
35                         [% IF stored == 'updated' %]
36                             <p>Club <em>[% club.name | html %]</em> was updated.</p>
37                         [% ELSE %]
38                             <p>Club <em>[% club.name | html %]</em> was saved.</p>
39                         [% END %]
40                     </div>
41                 [% END %]
42
43                 <h3>Club templates</h3>
44
45                 [% IF CAN_user_clubs_edit_templates %]
46                     <div class="btn-toolbar">
47                         <div class="btn-group">
48                             <a class="btn btn-default" href="templates-add-modify.pl"><i class="fa fa-plus"></i> New club template</a>
49                         </div>
50                     </div>
51                 [% END %]
52
53                 [% IF club_templates %]
54                     <table id="club-templates-table">
55                         <thead>
56                             <tr>
57                                 <th>Name</th>
58                                 <th>Description</th>
59                                 <th>Public enrollment</th>
60                                 <th>Email required</th>
61                                 <th>Library</th>
62                                 <th class="noExport">Actions</th>
63                             </tr>
64                         </thead>
65                         <tbody>
66                             [% FOREACH t IN club_templates %]
67                                 <tr>
68                                     <td>[% t.name | html %]</td>
69                                     <td>[% t.description | html %]</td>
70                                     <td>
71                                         [% IF t.is_enrollable_from_opac %]
72                                             Yes
73                                         [% ELSE %]
74                                             No
75                                         [% END %]
76                                     </td>
77                                     <td>
78                                         [% IF t.is_email_required %]
79                                             Yes
80                                         [% ELSE %]
81                                             No
82                                         [% END %]
83                                     </td>
84                                     <td>[% Branches.GetName( t.branchcode ) | html %]</td>
85                                     <td class="actions">
86                                         [% IF CAN_user_clubs_edit_templates %]
87                                             <a class="btn btn-xs btn-default" style="white-space:nowrap"  href="/cgi-bin/koha/clubs/templates-add-modify.pl?id=[% t.id | html %]">
88                                                 <i class="fa fa-pencil"></i> Edit
89                                             </a>
90                                             <a class="btn btn-xs btn-default delete_template" href="#" data-id="[% t.id | html %]" data-name="[% t.name | html %]">
91                                                 <i class="fa fa-trash"></i> Delete
92                                             </a>
93                                         [% END %]
94                                     </td>
95                                 </tr>
96                             [% END %]
97                         </tbody>
98                     </table>
99                 [% ELSE %]
100                     <div class="dialog message">No club templates defined.</div>
101                 [% END %]
102
103                 <h3>Clubs</h3>
104
105                 [% IF CAN_user_clubs_edit_clubs %]
106                     <div class="btn-toolbar">
107                         <div class="btn-group">
108                             [% IF club_templates %]
109                                 <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button>
110                             [% ELSE %]
111                                 <button disabled="disabled" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button>
112                             [% END %]
113                             <ul class="dropdown-menu">
114                                 [% FOREACH t IN club_templates %]
115                                     <li><a href="/cgi-bin/koha/clubs/clubs-add-modify.pl?club_template_id=[% t.id | uri %]">[% t.name | html %]</a></li>
116                                 [% END %]
117                             </ul>
118                         </div>
119                     </div>
120                 [% END %]
121
122                 [% IF clubs %]
123                     [% INCLUDE 'clubs-table.inc' %]
124                 [% ELSE %]
125                     [% IF club_templates %]
126                         <div class="dialog message">No clubs defined.</div>
127                     [% ELSE %]
128                         <div class="dialog message">No clubs defined. A club template must be defined before a club can be defined.</div>
129                     [% END %]
130                 [% END %]
131
132             </main>
133         </div> <!-- /.col-sm-10.col-sm-push-2 -->
134
135         <div class="col-sm-2 col-sm-pull-10">
136             <aside>
137                 [% INCLUDE 'tools-menu.inc' %]
138             </aside>
139         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
140      </div> <!-- /.row -->
141
142 [% MACRO jsinclude BLOCK %]
143     [% INCLUDE 'datatables.inc' %]
144     [% Asset.js("js/tools-menu.js") | $raw %]
145     <script>
146         $(document).ready(function() {
147             tTable = $('#club-templates-table').dataTable($.extend(true, {}, dataTablesDefaults, {
148                 "sPaginationType": "full",
149                 "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
150                 "aoColumnDefs": [
151                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
152                 ]
153             } ));
154
155             cTable = $('#clubs-table').dataTable($.extend(true, {}, dataTablesDefaults, {
156                 "sPaginationType": "full",
157                 "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
158                 "aoColumnDefs": [
159                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
160                 ]
161             } ));
162
163             $(".delete_club").on("click", function(e){
164                 e.preventDefault();
165                 var club_id = $(this).data("id");
166                 var club_name = $(this).data("name");
167                 ConfirmDeleteClub( club_id, club_name );
168             });
169
170             $(".delete_template").on("click", function(e){
171                 e.preventDefault();
172                 var template_id = $(this).data("id");
173                 var template_name = $(this).data("name");
174                 ConfirmDeleteTemplate( template_id, template_name );
175             });
176
177             $(".club_hold_search").on("click", function(e){
178                 e.preventDefault;
179                 var club_id = $(this).data("id");
180                 SearchToHold( club_id );
181             });
182         });
183
184         function ConfirmDeleteTemplate( id, name ) {
185             if ( confirm( _("Are you sure you want to delete the club template %s? This will delete all clubs using this template and cancel patron enrollments" ).format(name) ) ) {
186                 $.ajax({
187                     type: "POST",
188                     url: '/cgi-bin/koha/svc/club/template/delete',
189                     data: { id: id },
190                     success: function( data ) {
191                         if ( data.success ) {
192                             location.reload();
193                         } else {
194                             alert(_("Unable to delete template!"));
195                         }
196                     },
197                     dataType: 'json'
198                 });
199             }
200         }
201
202         function ConfirmDeleteClub( id, name ) {
203             if ( confirm( _("Are you sure you want to delete the club %s? This will cancel all patron enrollments in this club." ).format(name) ) ) {
204                 $.ajax({
205                     type: "POST",
206                     url: '/cgi-bin/koha/svc/club/delete',
207                     data: { id: id },
208                     success: function( data ) {
209                         if ( data.success ) {
210                             location.reload();
211                         } else {
212                             alert(_("Unable to delete club!"));
213                         }
214                     },
215                     dataType: 'json'
216                 });
217             }
218         }
219
220         function SearchToHold(club_id) {
221             var date = new Date();
222             date.setTime(date.getTime() + (10 * 60 * 1000));
223             $.cookie("holdforclub", club_id, { path: "/", expires: date });
224             location.href="/cgi-bin/koha/catalogue/search.pl";
225         }
226     </script>
227 [% END %]
228
229 [% INCLUDE 'intranet-bottom.inc' %]