|
Line 0
Link Here
|
|
|
1 |
[% USE raw %] |
| 2 |
[% USE Asset %] |
| 3 |
[% USE KohaDates %] |
| 4 |
[% USE Branches %] |
| 5 |
[% USE Categories %] |
| 6 |
[% USE TablesSettings %] |
| 7 |
[% SET footerjs = 1 %] |
| 8 |
[% INCLUDE 'doc-head-open.inc' %] |
| 9 |
<title>Notices management › Tools › Koha</title> |
| 10 |
[% PROCESS "patron-search.inc" %] |
| 11 |
[% SET libraries = Branches.all %] |
| 12 |
[% SET categories = Categories.all.unblessed %] |
| 13 |
[% SET columns = ['name', 'cardnumber', 'dateofbirth', 'category', 'branch', 'address', 'phone'] %] |
| 14 |
[% INCLUDE 'doc-head-close.inc' %] |
| 15 |
<style> |
| 16 |
.notice { display: none; } |
| 17 |
</style> |
| 18 |
</head> |
| 19 |
|
| 20 |
<body id="tools_notices_mgmt" class="tools"> |
| 21 |
[% WRAPPER 'header.inc' %] |
| 22 |
[% INCLUDE 'circ-search.inc' %] |
| 23 |
[% END %] |
| 24 |
|
| 25 |
[% WRAPPER 'sub-header.inc' %] |
| 26 |
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb"> |
| 27 |
<ol> |
| 28 |
<li> |
| 29 |
<a href="/cgi-bin/koha/mainpage.pl">Home</a> |
| 30 |
</li> |
| 31 |
<li> |
| 32 |
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> |
| 33 |
</li> |
| 34 |
<li> |
| 35 |
<a href="#" aria-current="page"> |
| 36 |
Notices management |
| 37 |
</a> |
| 38 |
</li> |
| 39 |
</ol> |
| 40 |
</nav> |
| 41 |
[% END %] |
| 42 |
|
| 43 |
<div class="main container-fluid"> |
| 44 |
<div class="row"> |
| 45 |
<div class="col-sm-10 col-sm-push-2"> |
| 46 |
<main> |
| 47 |
|
| 48 |
<h1>Notices management</h1> |
| 49 |
|
| 50 |
[% IF notices && notices.count > 0 %] |
| 51 |
|
| 52 |
<div class="dialog message">Printing a notice will mark it as sent.</div> |
| 53 |
|
| 54 |
<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> |
| 55 |
|
| 56 |
<form id="print_multiple" action="/cgi-bin/koha/tools/print_notice.pl" method="post" target="_blank"> |
| 57 |
|
| 58 |
<table id="notices"> |
| 59 |
<thead> |
| 60 |
<tr> |
| 61 |
<th class="nosort"> </th> |
| 62 |
<th>Time created</th> |
| 63 |
<th>Patron</th> |
| 64 |
<th>Notice</th> |
| 65 |
<th>Type</th> |
| 66 |
<th>Status</th> |
| 67 |
<th>Updated on</th> |
| 68 |
<th class="nosort">Actions</th> |
| 69 |
</tr> |
| 70 |
</thead> |
| 71 |
<tbody> |
| 72 |
[% FOREACH notice IN notices %] |
| 73 |
<tr> |
| 74 |
<td><input type="checkbox" name="message_ids" value="[% notice.message_id | html %]"></td> |
| 75 |
<td>[% notice.time_queued | $KohaDates with_hours = 1 %]</td> |
| 76 |
<td>[% INCLUDE 'patron-title.inc' patron=notice.patron hide_patron_infos_if_needed=1 %]</td> |
| 77 |
<td> |
| 78 |
<a class="notice-title" data-noticeid="[% notice.message_id | html %]" href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% notice.borrowernumber | uri %]&noticeid=[% notice.message_id | uri %]">[% notice.subject | html %]</a> |
| 79 |
<iframe class="notice" id="notice[% notice.message_id | html %]" srcdoc="[% notice.html_content | html %]"></iframe> |
| 80 |
</td> |
| 81 |
<td>[% notice.message_transport_type | html %]</td> |
| 82 |
<td>[% notice.status | html %]</td> |
| 83 |
<td>[% notice.updated_on | $KohaDates with_hours = 1 %]</td> |
| 84 |
<td class="actions"><a target="_blank" class="btn btn-default btn-xs print" href="/cgi-bin/koha/tools/print_notice.pl?message_ids=[% notice.message_id | uri %]"><i class="fa fa-print"></i> Print</a></td> |
| 85 |
</tr> |
| 86 |
[% END %] |
| 87 |
</tbody> |
| 88 |
</table> |
| 89 |
|
| 90 |
<input type="submit" class="btn btn-primary" value="Print selected notices" id="print_multiple_button"> |
| 91 |
|
| 92 |
</form> |
| 93 |
|
| 94 |
[% ELSE %] |
| 95 |
|
| 96 |
<div> |
| 97 |
Use the search form on the left to find sent notices. |
| 98 |
</div> |
| 99 |
|
| 100 |
[% IF notices && notices.count == 0 %] |
| 101 |
|
| 102 |
<div class="dialog message"> |
| 103 |
No sent notices were found with those search parameters. |
| 104 |
</div> |
| 105 |
|
| 106 |
[% END %] |
| 107 |
|
| 108 |
[% END %] |
| 109 |
|
| 110 |
</main> |
| 111 |
</div> <!-- /.col-sm-10.col-sm-push-2 --> |
| 112 |
|
| 113 |
<div class="col-sm-2 col-sm-pull-10"> |
| 114 |
<aside> |
| 115 |
<fieldset class="sidebar brief"> |
| 116 |
<h3>Go to a patron's notices</h3> |
| 117 |
<ol> |
| 118 |
<li> |
| 119 |
<div id="notices_patronsearch_pane" role="tabpanel" class="tab-pane active"> |
| 120 |
[% PROCESS patron_search_filters_simple %] |
| 121 |
[% PROCESS patron_search_table table_id => 'table_borrowers', open_on_row_click => 1 %] |
| 122 |
</div> |
| 123 |
</li> |
| 124 |
</ol> |
| 125 |
</fieldset> |
| 126 |
<fieldset class="sidebar brief"> |
| 127 |
<form id="notices-search" action="/cgi-bin/koha/tools/notices.pl" method="post"> |
| 128 |
<input type="hidden" name="op" value="search"> |
| 129 |
<h3>Search filters</h3> |
| 130 |
<ol> |
| 131 |
<li> |
| 132 |
<label for="branchcode">Library:</label> |
| 133 |
<select id="branchcode" name="branchcode"> |
| 134 |
<option value="">All libraries</option> |
| 135 |
[% FOREACH branch IN Branches.all( selected => branchcode ) %] |
| 136 |
[% IF ( branch.selected ) %] |
| 137 |
<option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option> |
| 138 |
[% ELSE %] |
| 139 |
<option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option> |
| 140 |
[% END %] |
| 141 |
[% END %] |
| 142 |
</select> |
| 143 |
</li> |
| 144 |
<li> |
| 145 |
<label for="letter_code">Notice:</label> |
| 146 |
<select id="letter_code" name="letter_code"> |
| 147 |
<option value="">All notices</option> |
| 148 |
[% FOREACH letter IN letters %] |
| 149 |
[% IF ( letter.code == letter_code ) %] |
| 150 |
<option selected="selected" value="[% letter.code | html %]">[% letter.name | html %] ([% letter.code | html %])</option> |
| 151 |
[% ELSE %] |
| 152 |
<option value="[% letter.code | html %]">[% letter.name | html %] ([% letter.code | html %])</option> |
| 153 |
[% END %] |
| 154 |
[% END %] |
| 155 |
</select> |
| 156 |
</li> |
| 157 |
<li> |
| 158 |
<label for="status">Notice status:</label> |
| 159 |
<select id="status" name="status"> |
| 160 |
<option value="">All statuses</option> |
| 161 |
[% IF status == 'sent' %] |
| 162 |
<option selected="selected" value="sent">Sent</option> |
| 163 |
[% ELSE %] |
| 164 |
<option value="sent">Sent</option> |
| 165 |
[% END %] |
| 166 |
[% IF status == 'sent' %] |
| 167 |
<option selected="selected" value="pending">Pending</option> |
| 168 |
[% ELSE %] |
| 169 |
<option value="pending">Pending</option> |
| 170 |
[% END %] |
| 171 |
[% IF status == 'sent' %] |
| 172 |
<option selected="selected" value="failed">Failed</option> |
| 173 |
[% ELSE %] |
| 174 |
<option value="failed">Failed</option> |
| 175 |
[% END %] |
| 176 |
[% IF status == 'sent' %] |
| 177 |
<option selected="selected" value="deleted">Deleted</option> |
| 178 |
[% ELSE %] |
| 179 |
<option value="deleted">Deleted</option> |
| 180 |
[% END %] |
| 181 |
</select> |
| 182 |
</li> |
| 183 |
<li> |
| 184 |
<fieldset class="brief"> |
| 185 |
<legend>Date queued</legend> |
| 186 |
<ol> |
| 187 |
<li> |
| 188 |
<label for="from">From:</label> |
| 189 |
<input type="text" id="from" name="from" size="10" value="[% from | html %]" class="flatpickr" data-date_to="to" /> |
| 190 |
<div class="hint">[% INCLUDE 'date-format.inc' %]</div> |
| 191 |
</li> |
| 192 |
<li> |
| 193 |
<label for="to">To:</label> |
| 194 |
<input type="text" id="to" name="to" size="10" value="[% to | html %]" class="flatpickr" /> |
| 195 |
<div class="hint">[% INCLUDE 'date-format.inc' %]</div> |
| 196 |
</li> |
| 197 |
</ol> |
| 198 |
</fieldset> |
| 199 |
</li> |
| 200 |
<li> |
| 201 |
<label for="categorycode">Patron category:</label> |
| 202 |
<select id="categorycode" name="categorycode"> |
| 203 |
<option value="">All patron categories</option> |
| 204 |
[% FOREACH category IN Categories.all %] |
| 205 |
[% IF ( category.categorycode == categorycode ) %] |
| 206 |
<option selected="selected" value="[% category.categorycode | html %]">[% category.description | html %]</option> |
| 207 |
[% ELSE %] |
| 208 |
<option value="[% category.categorycode | html %]">[% category.description | html %]</option> |
| 209 |
[% END %] |
| 210 |
[% END %] |
| 211 |
</select> |
| 212 |
</li> |
| 213 |
</ol> |
| 214 |
<fieldset class="action"> |
| 215 |
<input type="submit" class="btn btn-default" value="Search"> |
| 216 |
</fieldset> |
| 217 |
</form> |
| 218 |
</fieldset> |
| 219 |
[% INCLUDE 'tools-menu.inc' %] |
| 220 |
</aside> |
| 221 |
</div> <!-- /.col-sm-2.col-sm-pull-10 --> |
| 222 |
</div> <!-- /.row --> |
| 223 |
|
| 224 |
<!-- Modal --> |
| 225 |
<div class="modal" id="noticeModal" tabindex="-1" aria-labelledby="noticeModalLabel" aria-hidden="true"> |
| 226 |
<div class="modal-dialog"> |
| 227 |
<div class="modal-content"> |
| 228 |
<div class="modal-header"> |
| 229 |
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"> |
| 230 |
<span aria-hidden="true">×</span> |
| 231 |
</button> |
| 232 |
<h5 class="modal-title" id="noticeModalLabel">Notice</h5> |
| 233 |
</div> |
| 234 |
<div class="modal-body"> |
| 235 |
... |
| 236 |
</div> |
| 237 |
<div class="modal-footer"> |
| 238 |
<button type="button" class="btn btn-default deny cancel" data-dismiss="modal"><i class="fa fa-remove"></i> Close</button> |
| 239 |
</div> |
| 240 |
</div> <!-- /.modal-content --> |
| 241 |
</div> <!-- /.modal-dialog --> |
| 242 |
</div> <!-- /.modal --> |
| 243 |
|
| 244 |
[% MACRO jsinclude BLOCK %] |
| 245 |
[% Asset.js("js/tools-menu.js") | $raw %] |
| 246 |
[% INCLUDE 'calendar.inc' %] |
| 247 |
[% INCLUDE 'datatables.inc' %] |
| 248 |
[% PROCESS patron_search_js table_id => 'table_borrowers', categories => categories, libraries => libraries, extended_attribute_types => attribute_type_codes, columns => columns, open_on_row_click => 1, on_click_url => '/cgi-bin/koha/tools/notices.pl?', redirect_if_one_result => 1, redirect_url => '/cgi-bin/koha/tools/notices.pl?', redirect_if_attribute_equal => 'cardnumber' %] |
| 249 |
|
| 250 |
<script> |
| 251 |
table_settings = [% TablesSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %]; |
| 252 |
$(document).ready(function() { |
| 253 |
$("#notices").dataTable($.extend(true, {}, dataTablesDefaults, { |
| 254 |
"aoColumnDefs": [ |
| 255 |
{ 'bSortable': false, 'aTargets': [ 'nosort' ] } |
| 256 |
], |
| 257 |
"aaSorting": [[1, "desc" ]], |
| 258 |
"sPaginationType": "full" |
| 259 |
})); |
| 260 |
|
| 261 |
$("#notices").on("click", ".notice-title", function(e){ |
| 262 |
e.preventDefault(); |
| 263 |
var title = $(this).text(); |
| 264 |
var noticeid = $(this).data("noticeid"); |
| 265 |
var body = $("#notice" + noticeid ).attr("srcdoc"); |
| 266 |
$("#noticeModalLabel").text( title ); |
| 267 |
$("#noticeModal .modal-body").html( body ); |
| 268 |
$("#noticeModal").modal("show"); |
| 269 |
}); |
| 270 |
|
| 271 |
$("#noticeModal").on("hide.bs.modal", function(){ |
| 272 |
$("#noticeModalLabel").text(""); |
| 273 |
$("#noticeModal .modal-body").html(""); |
| 274 |
}); |
| 275 |
|
| 276 |
$("#notices_patronsearch").on("submit", filter); |
| 277 |
[% UNLESS notices %] |
| 278 |
[% IF ( Koha.Preference('PatronAutoComplete') ) %] |
| 279 |
patron_autocomplete($("#search_patron_filter"), { 'link-to': 'notices', 'url-params': '[% url_biblio_params | url %]' }); |
| 280 |
[% END %] |
| 281 |
[% END %] |
| 282 |
|
| 283 |
$("#print_multiple_button").click(function(e){ |
| 284 |
var selected_notices = $("#print_multiple").find("input[name='message_ids']:checked"); |
| 285 |
if ( selected_notices.length == 0 ) { |
| 286 |
alert(_("Please select at least one sent notice.")); |
| 287 |
e.preventDefault(); |
| 288 |
return false; |
| 289 |
} |
| 290 |
}); |
| 291 |
|
| 292 |
$(".select_all").click(function(e){ |
| 293 |
e.preventDefault(); |
| 294 |
$("input[name='message_ids']").each(function(){ |
| 295 |
$(this).prop("checked", true); |
| 296 |
}); |
| 297 |
}); |
| 298 |
|
| 299 |
$(".clear_all").click(function(e){ |
| 300 |
e.preventDefault(); |
| 301 |
$("input[name='message_ids']").each(function(){ |
| 302 |
$(this).prop("checked", false); |
| 303 |
}); |
| 304 |
}); |
| 305 |
}); |
| 306 |
</script> |
| 307 |
|
| 308 |
[% END %] |
| 309 |
|
| 310 |
[% INCLUDE 'intranet-bottom.inc' %] |