Bug 34531: Fix template logic to not hide patron restrictions
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / alert-subscriptions.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE AuthorisedValues  %]
4 [% USE Branches %]
5 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Alert subscriptions for [% INCLUDE 'patron-title.inc' no_html = 1 %] &rsaquo; Patrons &rsaquo; Koha</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 </head>
10
11 <body id="pat_alert_subscriptions" class="pat">
12 [% WRAPPER 'header.inc' %]
13     [% INCLUDE 'patron-search-header.inc' %]
14 [% END %]
15
16 [% WRAPPER 'sub-header.inc' %]
17     [% WRAPPER breadcrumbs %]
18         [% WRAPPER breadcrumb_item %]
19             <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
20         [% END %]
21         [% WRAPPER breadcrumb_item %]
22             <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% INCLUDE 'patron-title.inc' %]</a>
23         [% END %]
24         [% WRAPPER breadcrumb_item bc_active= 1 %]
25             <span>Alert subscriptions</span>
26         [% END %]
27     [% END #/ WRAPPER breadcrumbs %]
28 [% END #/ WRAPPER sub-header.inc %]
29
30 <div class="main container-fluid">
31     <div class="row">
32         <div class="col-sm-10 col-sm-push-2">
33             <main>
34
35                 [% INCLUDE 'members-toolbar.inc' %]
36                 <h1>Alert subscriptions</h1>
37
38                 [% IF patron.alert_subscriptions.count %]
39                     <div class="page-section">
40                         <table id="subscriptions">
41                             <thead>
42                                 <tr>
43                                 <th>ISSN</th>
44                                 <th>Title</th>
45                                 <th>Library</th>
46                                 <th>Location</th>
47                                 <th>Call number</th>
48                                 <th>Actions</th>
49                                 </tr>
50                             </thead>
51
52                             <tbody>
53                                 [% FOREACH sub IN patron.alert_subscriptions %]
54                                     <tr>
55                                         <td>
56                                             [% IF sub.biblio.biblioitem.issn %][% sub.biblio.biblioitem.issn | html %][% END %]
57                                         </td>
58                                         <td>
59                                             <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% sub.subscriptionid | uri %]" class="button" title="subscription detail">[% sub.biblio.title | html %] [% sub.biblio.subtitle | html %]</a>
60                                         </td>
61                                         <td>
62                                             [% IF ( sub.branchcode ) %][% Branches.GetName( sub.branchcode ) | html %][% END %]
63                                         </td>
64                                         <td>
65                                             [% IF ( sub.location ) %][% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => sub.location ) | html %][% END %]
66                                         </td>
67                                         <td>
68                                             [% IF ( sub.callnumber ) %][% sub.callnumber | html %][% END %]
69                                         </td>
70                                         <td class="actions">
71                                             <form action="/cgi-bin/koha/members/alert-subscriptions.pl" method="post" class="unsubscribe" data-title="[% sub.biblio.title | html %] [% sub.biblio.subtitle | html %]"data-patron="[% INCLUDE 'patron-title.inc' no_html = 1 %]">
72                                                 <input type="hidden" name="subscription_id" value="[% sub.subscriptionid | html %]">
73                                                 <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]">
74                                                 <button type="submit" class="btn btn-default btn-sm"><i class="fa fa-times"></i> Unsubscribe from email alerts</button>
75                                             </form>
76                                         </td>
77                                     </tr>
78                                 [% END %]
79                             </tbody>
80                         </table>
81                 </div> <!-- /.page-section -->
82                 [% ELSE %]
83                     <div class="dialog message">
84                         <p>This patron has not subscribed to email alerts for any subscriptions.</p>
85                     </div>
86                 [% END %]
87
88             </main>
89         </div> <!-- /.col-sm-10.col-sm-push-2 -->
90
91         <div class="col-sm-2 col-sm-pull-10">
92             <aside>
93                 [% INCLUDE 'circ-menu.inc' %]
94             </aside>
95         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
96      </div> <!-- /.row -->
97
98 [% MACRO jsinclude BLOCK %]
99     [% INCLUDE 'str/members-menu.inc' %]
100     [% Asset.js("js/members-menu.js") | $raw %]
101     [% INCLUDE 'datatables.inc' %]
102     <script>
103         $(document).ready(function() {
104             $("#subscriptions").dataTable($.extend(true, {}, dataTablesDefaults, {
105             }));
106             $(".unsubscribe").submit(function(){
107                 var patron = $(this).data('patron');
108                 var title = $(this).data('title');
109                 return confirmDelete(__("Are you sure you want to unsubscribe %s from email alerts for %s?").format(patron, title));
110             });
111         });
112     </script>
113 [% END %]
114
115 [% INCLUDE 'intranet-bottom.inc' %]