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