Bug 21965: Update two-column templates with Bootstrap grid: Patrons part 3
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / notices.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE AuthorisedValues %]
5 [% USE Branches %]
6 [% USE KohaDates %]
7 [% SET footerjs = 1 %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Sent notices for [% INCLUDE 'patron-title.inc' no_html = 1 %]</title>
10 [% INCLUDE 'doc-head-close.inc' %]
11 [% Asset.css("css/datatables.css") | $raw %]
12 <style>
13     .notice { display: none; }
14     .notice-title { font-weight: bold; display: block; }
15 </style>
16 </head>
17
18 <body id="pat_notices" class="pat">
19 [% INCLUDE 'header.inc' %]
20 [% INCLUDE 'patron-search.inc' %]
21
22 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Sent notices for [% INCLUDE 'patron-title.inc' %]</div>
23
24 <div class="main container-fluid">
25     <div class="row">
26         <div class="col-sm-10 col-sm-push-2">
27             <main>
28
29 [% INCLUDE 'members-toolbar.inc' %]
30 <h1>Sent notices for [% INCLUDE 'patron-title.inc' %]</h1>
31
32 [% IF ( QUEUED_MESSAGES ) %]
33     <table id="noticestable">
34         <thead>
35             <tr>
36                 <th>Notice</th>
37                 <th>Type</th>
38                 <th>Status</th>
39                 <th>Time</th>
40             </tr>
41         </thead>
42         <tbody>
43             [% FOREACH QUEUED_MESSAGE IN QUEUED_MESSAGES %]
44             <tr>
45                 <td>
46             <a class="notice-title" data-noticeid="[% QUEUED_MESSAGE.message_id | html %]" href="#">[% QUEUED_MESSAGE.subject | html %]</a>
47             <div id="notice[% QUEUED_MESSAGE.message_id | html %]" class="notice">
48                 <iframe srcdoc="[% QUEUED_MESSAGE.content | html | html_line_break %]"></iframe>
49             </div>
50         </td>
51                 <td>
52             [% IF ( QUEUED_MESSAGE.message_transport_type == 'email' ) %]email
53             [% ELSIF ( QUEUED_MESSAGE.message_transport_type == 'print' ) %]print
54             [% ELSIF ( QUEUED_MESSAGE.message_transport_type == 'feed' ) %]feed
55             [% ELSIF ( QUEUED_MESSAGE.message_transport_type == 'sms' ) %]sms
56             [% ELSE %][% QUEUED_MESSAGE.message_transport_type | html %][% END %]
57         </td>
58                 <td>
59             [% IF ( QUEUED_MESSAGE.status == 'sent' ) %]sent
60             [% ELSIF ( QUEUED_MESSAGE.status == 'pending' ) %]pending
61             [% ELSIF ( QUEUED_MESSAGE.status == 'failed' ) %]failed
62             [% ELSIF ( QUEUED_MESSAGE.status == 'deleted' ) %]deleted
63             [% ELSE %][% QUEUED_MESSAGE.status | html %][% END %]
64             [% IF ( QUEUED_MESSAGE.status != 'pending' ) %]
65             <div id="resend_notice[% QUEUED_MESSAGE.message_id | html %]"  class="notice">
66                 <form action="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber | html %]" method="POST">
67                     <input type="hidden" name="op" value="resend_notice" />
68                     <input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" />
69                     <input type="hidden" name="message_id" value="[% QUEUED_MESSAGE.message_id | html %]" />
70                     <fieldset class="action">
71                         <button class="btn btn-default btn-xs" type="submit">Resend</button>
72                     </fieldset>
73                 </form>
74             </div>
75             [% END %]
76         </td>
77         <td><span title="[% QUEUED_MESSAGE.time_queued | html %]">[% QUEUED_MESSAGE.time_queued | $KohaDates  with_hours => 1 %]</span></td>
78             </tr>
79             [% END %]
80         </tbody>
81     </table>
82 [% ELSE %]
83     <div class="dialog message">There is no record of any messages that have been sent to this patron.</div>
84 [% END %]
85
86             </main>
87         </div> <!-- /.col-sm-10.col-sm-push-2 -->
88
89         <div class="col-sm-2 col-sm-pull-10">
90             <aside>
91                 [% INCLUDE 'circ-menu.inc' %]
92             </aside>
93         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
94      </div> <!-- /.row -->
95
96 [% MACRO jsinclude BLOCK %]
97     [% INCLUDE 'datatables.inc' %]
98     <script>
99         $(document).ready(function() {
100             $("#noticestable").dataTable($.extend(true, {}, dataTablesDefaults, {
101                 "aaSorting": [[ 3, "desc" ]],
102                 "aoColumns": [ null,null,null,{ "sType": "title-string" } ],
103                 "sPaginationType": "four_button"
104             }));
105
106             $("#noticestable").on("click", ".notice-title", function(e){
107                 e.preventDefault();
108                 var rowid = $(this).data("noticeid");
109                 $("#notice"+rowid).toggle();
110                 $("#resend_notice"+rowid).toggle();
111                 var iframe = $("#notice"+rowid).children('iframe');
112                 // Adding some padding to the height and width to remove scrollbars
113                 var height = iframe.get(0).contentWindow.document.body.scrollHeight + 25;
114                 var width = iframe.get(0).contentWindow.document.body.scrollWidth + 25;
115                 iframe.css({
116                     'width':  width + 'px',
117                     'height': height + 'px'
118                 });
119             });
120         });
121     </script>
122     [% INCLUDE 'str/members-menu.inc' %]
123     [% Asset.js("js/members-menu.js") | $raw %]
124 [% END %]
125
126 [% INCLUDE 'intranet-bottom.inc' %]