|
Lines 49-74
Link Here
|
| 49 |
<h1>Sent notices for [% INCLUDE 'patron-title.inc' %]</h1> |
49 |
<h1>Sent notices for [% INCLUDE 'patron-title.inc' %]</h1> |
| 50 |
|
50 |
|
| 51 |
[% IF ( QUEUED_MESSAGES ) %] |
51 |
[% IF ( QUEUED_MESSAGES ) %] |
| 52 |
<div class="page-section"> |
52 |
<div class="page-section"> |
|
|
53 |
<span id="checkbox_actions"><a href="#" class="select_all"><i class="fa fa-check"></i> Select all</a> | <a href="#" class="clear_all"><i class="fa fa-remove"></i> Clear all</a></span> |
| 54 |
<form id="print_multiple" action="/cgi-bin/koha/tools/print_notice.pl" method="post" target="_blank"> |
| 55 |
[% INCLUDE 'csrf-token.inc' %] |
| 56 |
|
| 53 |
<table id="noticestable"> |
57 |
<table id="noticestable"> |
| 54 |
<thead> |
58 |
<thead> |
| 55 |
<tr> |
59 |
<tr> |
|
|
60 |
<th class="nosort"> </th> |
| 61 |
<th>Time created</th> |
| 56 |
<th>Notice</th> |
62 |
<th>Notice</th> |
| 57 |
<th>Type</th> |
63 |
<th>Type</th> |
| 58 |
<th>Status</th> |
64 |
<th>Status</th> |
| 59 |
<th>Updated on</th> |
65 |
<th>Updated on</th> |
| 60 |
<th>Time created</th> |
|
|
| 61 |
<th>Delivery note</th> |
66 |
<th>Delivery note</th> |
| 62 |
[% IF CAN_user_tools_view_generated_notices %] |
|
|
| 63 |
<th>Actions</th> |
67 |
<th>Actions</th> |
| 64 |
[% END %] |
|
|
| 65 |
</tr> |
68 |
</tr> |
| 66 |
</thead> |
69 |
</thead> |
| 67 |
<tbody> |
70 |
<tbody> |
| 68 |
[% FOREACH QUEUED_MESSAGE IN QUEUED_MESSAGES %] |
71 |
[% FOREACH QUEUED_MESSAGE IN QUEUED_MESSAGES %] |
| 69 |
<tr> |
72 |
<tr> |
|
|
73 |
<td><input type="checkbox" name="message_ids" value="[% QUEUED_MESSAGE.message_id | html %]" [% IF QUEDUE_MESSAGE.status == 'pending' %]disabled="disabled"[% END %]></td> |
| 74 |
<td data-order="[% QUEUED_MESSAGE.time_queued | html %]">[% QUEUED_MESSAGE.time_queued | $KohaDates with_hours => 1 %]</td> |
| 70 |
<td> |
75 |
<td> |
| 71 |
<a class="notice-title" data-noticeid="[% QUEUED_MESSAGE.message_id | html %]" href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber | uri %]&noticeid=[% QUEUED_MESSAGE.message_id | uri %]">[% QUEUED_MESSAGE.subject | html %]</a> |
76 |
<a class="notice-title" data-noticeid="[% QUEUED_MESSAGE.message_id | html %]" data-status="[% QUEUED_MESSAGE.status | html %]" data-borrowernumber="[% borrowernumber | html %]" href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber | uri %]&noticeid=[% QUEUED_MESSAGE.message_id | uri %]">[% QUEUED_MESSAGE.subject | html %]</a> |
| 72 |
<iframe class="notice" id="notice[% QUEUED_MESSAGE.message_id | html %]" srcdoc="[% QUEUED_MESSAGE.html_content | html %]"></iframe> |
77 |
<iframe class="notice" id="notice[% QUEUED_MESSAGE.message_id | html %]" srcdoc="[% QUEUED_MESSAGE.html_content | html %]"></iframe> |
| 73 |
</td> |
78 |
</td> |
| 74 |
<td> |
79 |
<td> |
|
Lines 84-102
Link Here
|
| 84 |
[% ELSIF ( QUEUED_MESSAGE.status == 'failed' ) %]<span>failed</span> |
89 |
[% ELSIF ( QUEUED_MESSAGE.status == 'failed' ) %]<span>failed</span> |
| 85 |
[% ELSIF ( QUEUED_MESSAGE.status == 'deleted' ) %]<span>deleted</span> |
90 |
[% ELSIF ( QUEUED_MESSAGE.status == 'deleted' ) %]<span>deleted</span> |
| 86 |
[% ELSE %][% QUEUED_MESSAGE.status | html %][% END %] |
91 |
[% ELSE %][% QUEUED_MESSAGE.status | html %][% END %] |
| 87 |
[% IF ( QUEUED_MESSAGE.status != 'pending' ) %] |
|
|
| 88 |
<div class="notice"> |
| 89 |
<form id="resend_notice[% QUEUED_MESSAGE.message_id | html %]" action="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber | html %]" method="POST"> |
| 90 |
[% INCLUDE 'csrf-token.inc' %] |
| 91 |
<input type="hidden" name="op" value="cud-resend_notice" /> |
| 92 |
<input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" /> |
| 93 |
<input type="hidden" name="message_id" value="[% QUEUED_MESSAGE.message_id | html %]" /> |
| 94 |
</form> |
| 95 |
</div> |
| 96 |
[% END %] |
| 97 |
</td> |
92 |
</td> |
| 98 |
<td data-order="[% QUEUED_MESSAGE.updated_on | html %]">[% QUEUED_MESSAGE.updated_on | $KohaDates with_hours => 1 %]</td> |
93 |
<td data-order="[% QUEUED_MESSAGE.updated_on | html %]">[% QUEUED_MESSAGE.updated_on | $KohaDates with_hours => 1 %]</td> |
| 99 |
<td data-order="[% QUEUED_MESSAGE.time_queued | html %]">[% QUEUED_MESSAGE.time_queued | $KohaDates with_hours => 1 %]</td> |
|
|
| 100 |
<td> |
94 |
<td> |
| 101 |
[% IF ( QUEUED_MESSAGE.failure_code ) %] |
95 |
[% IF ( QUEUED_MESSAGE.failure_code ) %] |
| 102 |
[% IF ( QUEUED_MESSAGE.failure_code == "INVALID_BORNUMBER" ) %]<span class="clearfix">Invalid borrowernumber [% borrowernumber | html %]</span> |
96 |
[% IF ( QUEUED_MESSAGE.failure_code == "INVALID_BORNUMBER" ) %]<span class="clearfix">Invalid borrowernumber [% borrowernumber | html %]</span> |
|
Lines 113-119
Link Here
|
| 113 |
<span class="clearfix">Message failed to send with the following error: [% QUEUED_MESSAGE.failure_code | html %]</span> |
107 |
<span class="clearfix">Message failed to send with the following error: [% QUEUED_MESSAGE.failure_code | html %]</span> |
| 114 |
[% END %] |
108 |
[% END %] |
| 115 |
[% END %] |
109 |
[% END %] |
| 116 |
[% IF ( QUEUED_MESSAGE.status == 'sent' ) %] |
110 |
[% IF ( QUEUED_MESSAGE.status != 'pending' ) %] |
| 117 |
[% IF ( QUEUED_MESSAGE.from_address ) %] |
111 |
[% IF ( QUEUED_MESSAGE.from_address ) %] |
| 118 |
<span class="clearfix"><span class="label">From:</span> [% QUEUED_MESSAGE.from_address | html %]</span> |
112 |
<span class="clearfix"><span class="label">From:</span> [% QUEUED_MESSAGE.from_address | html %]</span> |
| 119 |
[% END %] |
113 |
[% END %] |
|
Lines 125-140
Link Here
|
| 125 |
[% END %] |
119 |
[% END %] |
| 126 |
[% END %] |
120 |
[% END %] |
| 127 |
</td> |
121 |
</td> |
| 128 |
[% IF CAN_user_tools_view_generated_notices %]<td class="actions"><a target="_blank" class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/print_notice.pl?message_ids=[% QUEUED_MESSAGE.message_id | uri %]"><i class="fa fa-print"></i> Print</a></td>[% END %] |
122 |
<td class="actions"><a target="_blank" class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/print_notice.pl?message_ids=[% QUEUED_MESSAGE.message_id | uri %]"><i class="fa fa-print"></i> Print</a></td> |
| 129 |
</tr> |
123 |
</tr> |
| 130 |
[% END %] |
124 |
[% END %] |
| 131 |
</tbody> |
125 |
</tbody> |
| 132 |
</table> |
126 |
</table> |
| 133 |
</div> <!-- /.page-section --> |
127 |
<fieldset class="action"> |
|
|
128 |
<input type="submit" class="btn btn-primary" value="Print selected notices" id="print_multiple_button"> |
| 129 |
</fieldset> |
| 130 |
</form> |
| 131 |
</div> <!-- /.page-section --> |
| 134 |
[% ELSE %] |
132 |
[% ELSE %] |
| 135 |
<div class="alert alert-info">There is no record of any messages that have been sent to this patron.</div> |
133 |
<div class="alert alert-info">There is no record of any messages that have been sent to this patron.</div> |
| 136 |
[% END %] |
134 |
[% END %] |
| 137 |
|
|
|
| 138 |
</main> |
135 |
</main> |
| 139 |
</div> <!-- /.col-md-10.order-md-2 --> |
136 |
</div> <!-- /.col-md-10.order-md-2 --> |
| 140 |
|
137 |
|
|
Lines 157-164
Link Here
|
| 157 |
... |
154 |
... |
| 158 |
</div> |
155 |
</div> |
| 159 |
<div class="modal-footer"> |
156 |
<div class="modal-footer"> |
| 160 |
<button type="button" id="resend-notice" class="btn btn-default" style="display:none"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Resend</button> |
157 |
<form id="resend_notice" action="/cgi-bin/koha/members/notices.pl" method="POST" style="display:none"> |
| 161 |
<button type="button" class="btn btn-default deny cancel" data-bs-dismiss="modal"><i class="fa fa-times"></i> Close</button> |
158 |
[% INCLUDE 'csrf-token.inc' %] |
|
|
159 |
<input type="hidden" name="op" value="cud-resend_notice" /> |
| 160 |
<input type="hidden" name="borrowernumber" value="" /> |
| 161 |
<input type="hidden" name="message_id" value="" /> |
| 162 |
<button type="submit" id="resend_notice_button" class="btn btn-default"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Resend</button> |
| 163 |
</form> |
| 164 |
<button type="button" class="btn btn-default deny cancel" data-bs-dismiss="modal"><i class="fa fa-remove"></i> Close</button> |
| 162 |
</div> |
165 |
</div> |
| 163 |
</div> <!-- /.modal-content --> |
166 |
</div> <!-- /.modal-content --> |
| 164 |
</div> <!-- /.modal-dialog --> |
167 |
</div> <!-- /.modal-dialog --> |
|
Lines 178-203
Link Here
|
| 178 |
var title = $(this).text(); |
181 |
var title = $(this).text(); |
| 179 |
var noticeid = $(this).data("noticeid"); |
182 |
var noticeid = $(this).data("noticeid"); |
| 180 |
var body = $("#notice" + noticeid ).attr("srcdoc"); |
183 |
var body = $("#notice" + noticeid ).attr("srcdoc"); |
| 181 |
if( $("#resend_notice" + noticeid ).length ){ |
184 |
if( $(this).data("status") !== 'pending' ){ |
| 182 |
$("#resend-notice").show(); |
185 |
let borrowerNumber = $(this).data("borrowernumber"); |
|
|
186 |
$('#resend_notice input[name="borrowernumber"]').val(borrowerNumber); |
| 187 |
$('#resend_notice input[name="message_id"]').val(noticeid); |
| 188 |
$("#resend_notice").show(); |
| 183 |
} |
189 |
} |
| 184 |
$("#resend-notice").data("noticeid", noticeid ); |
|
|
| 185 |
$("#noticeModalLabel").text( title ); |
190 |
$("#noticeModalLabel").text( title ); |
| 186 |
$("#noticeModal .modal-body").html( body ); |
191 |
$("#noticeModal .modal-body").html( body ); |
| 187 |
$("#noticeModal").modal("show"); |
192 |
$("#noticeModal").modal("show"); |
| 188 |
}); |
193 |
}); |
| 189 |
|
194 |
|
| 190 |
$("#resend-notice").on("click", function(e){ |
|
|
| 191 |
e.preventDefault(); |
| 192 |
var noticeid = $(this).data("noticeid"); |
| 193 |
$("#resend_notice" + noticeid ).submit(); |
| 194 |
}); |
| 195 |
|
| 196 |
$("#noticeModal").on("hide.bs.modal", function(){ |
195 |
$("#noticeModal").on("hide.bs.modal", function(){ |
| 197 |
$("#resend-notice").removeData("noticeid").hide(); |
196 |
$('#resend_notice input[name="borrowernumber"]').val(''); |
|
|
197 |
$('#resend_notice input[name="message_id"]').val(''); |
| 198 |
$("#resend_notice").hide(); |
| 198 |
$("#noticeModalLabel").text(""); |
199 |
$("#noticeModalLabel").text(""); |
| 199 |
$("#noticeModal .modal-body").html(""); |
200 |
$("#noticeModal .modal-body").html(""); |
| 200 |
}); |
201 |
}); |
|
|
202 |
|
| 203 |
$("#print_multiple_button").click(function(e){ |
| 204 |
var selected_notices = $("#print_multiple").find("input[name='message_ids']:checked"); |
| 205 |
if ( selected_notices.length == 0 ) { |
| 206 |
alert(_("Please select at least one sent notice.")); |
| 207 |
e.preventDefault(); |
| 208 |
return false; |
| 209 |
} |
| 210 |
}); |
| 211 |
|
| 212 |
$(".select_all").click(function(e){ |
| 213 |
e.preventDefault(); |
| 214 |
$("input[name='message_ids']").each(function(){ |
| 215 |
$(this).prop("checked", true); |
| 216 |
}); |
| 217 |
}); |
| 218 |
|
| 219 |
$(".clear_all").click(function(e){ |
| 220 |
e.preventDefault(); |
| 221 |
$("input[name='message_ids']").each(function(){ |
| 222 |
$(this).prop("checked", false); |
| 223 |
}); |
| 224 |
}); |
| 201 |
}); |
225 |
}); |
| 202 |
</script> |
226 |
</script> |
| 203 |
[% INCLUDE 'str/members-menu.inc' %] |
227 |
[% INCLUDE 'str/members-menu.inc' %] |