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