|
Line 0
Link Here
|
|
|
1 |
[% USE raw %] |
| 2 |
[% USE Asset %] |
| 3 |
[% SET footerjs = 1 %] |
| 4 |
[% USE TablesSettings %] |
| 5 |
[% INCLUDE 'doc-head-open.inc' %] |
| 6 |
<title> |
| 7 |
Concerns › Cataloging › Koha |
| 8 |
</title> |
| 9 |
[% INCLUDE 'doc-head-close.inc' %] |
| 10 |
</head> |
| 11 |
|
| 12 |
<body id="cat_concerns" class="cat"> |
| 13 |
[% INCLUDE 'header.inc' %] |
| 14 |
[% INCLUDE 'cataloging-search.inc' %] |
| 15 |
|
| 16 |
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb"> |
| 17 |
<ol> |
| 18 |
<li> |
| 19 |
<a href="/cgi-bin/koha/mainpage.pl">Home</a> |
| 20 |
</li> |
| 21 |
<li> |
| 22 |
<a href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloging</a> |
| 23 |
</li> |
| 24 |
<li> |
| 25 |
<a href="#" aria-current="page"> |
| 26 |
Concerns |
| 27 |
</a> |
| 28 |
</li> |
| 29 |
</ol> |
| 30 |
</nav> |
| 31 |
|
| 32 |
<div class="main container-fluid"> |
| 33 |
<div class="row"> |
| 34 |
<div class="col-sm-10 col-sm-push-2"> |
| 35 |
<main> |
| 36 |
<div id="toolbar" class="btn-toolbar"> |
| 37 |
<a class="btn btn-default" id="newconcern" role="button" href="#" data-toggle="modal" data-target="#addConcernModal"><i class="fa fa-plus"></i> New concern</a> |
| 38 |
</div> |
| 39 |
|
| 40 |
<h1>Concerns</h1> |
| 41 |
|
| 42 |
<div class="table_concerns_table_controls"></div> |
| 43 |
<table id="table_concerns"> |
| 44 |
<thead> |
| 45 |
<tr> |
| 46 |
<th>Reported</th> |
| 47 |
<th>Concern</th> |
| 48 |
<th>Title</th> |
| 49 |
<th>Status</th> |
| 50 |
<th data-class-name="actions noExport">Actions</th> |
| 51 |
</tr> |
| 52 |
</thead> |
| 53 |
</table> |
| 54 |
</main> |
| 55 |
</div> <!-- /.col-sm-10.col-sm-push-2 --> |
| 56 |
|
| 57 |
<div class="col-sm-2 col-sm-pull-10"> |
| 58 |
<aside> |
| 59 |
[% INCLUDE 'cat-menu.inc' %] |
| 60 |
</aside> |
| 61 |
</div> <!-- /.col-sm-2.col-sm-pull-10 --> |
| 62 |
</div> <!-- /.row --> |
| 63 |
|
| 64 |
<!-- Add concern modal --> |
| 65 |
<div class="modal" id="addConcernModal" tabindex="-1" role="dialog" aria-labelledby="addConcernLabel"> |
| 66 |
<div class="modal-dialog" role="document"> |
| 67 |
<div class="modal-content"> |
| 68 |
<div class="modal-header"> |
| 69 |
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
| 70 |
<h4 class="modal-title" id="addConcernLabel">Add concern</h4> |
| 71 |
</div> |
| 72 |
<div class="modal-body"> |
| 73 |
<fieldset class="rows"> |
| 74 |
<ol> |
| 75 |
<li> |
| 76 |
<label class="required" for="biblio_id">Biblio: </label> |
| 77 |
<input type="text" name="biblio_id" id="biblio_add"> |
| 78 |
<span class="required">Required</span> |
| 79 |
</li> |
| 80 |
<li> |
| 81 |
<label class="required" for="message">Please describe your concern: </label> |
| 82 |
<textarea id="message_add" name="message" required="required"></textarea> |
| 83 |
<span class="required">Required</span> |
| 84 |
<p id="helpBlock" class="help-block">A short summary of what the library policy is for dealing with such concerns and what constitutes a valid concern</p> |
| 85 |
</li> |
| 86 |
</ol> |
| 87 |
</fieldset> |
| 88 |
</div> <!-- /.modal-body --> |
| 89 |
<div class="modal-footer"> |
| 90 |
<button type="submit" class="btn btn-default" id="addConfirm">Confirm</button> |
| 91 |
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> |
| 92 |
</div> <!-- /.modal-footer --> |
| 93 |
</div> <!-- /.modal-content --> |
| 94 |
</div> <!-- /.modal-dialog --> |
| 95 |
</div> <!-- /#addConcernModal --> |
| 96 |
|
| 97 |
[% MACRO jsinclude BLOCK %] |
| 98 |
[% INCLUDE 'datatables.inc' %] |
| 99 |
[% INCLUDE 'columns_settings.inc' %] |
| 100 |
[% INCLUDE 'js-date-format.inc' %] |
| 101 |
[% INCLUDE 'js-patron-format.inc' %] |
| 102 |
[% INCLUDE 'js-biblio-format.inc' %] |
| 103 |
<script> |
| 104 |
$(document).ready(function() { |
| 105 |
|
| 106 |
var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]"; |
| 107 |
|
| 108 |
var concerns_url = '/api/v1/catalog/concerns'; |
| 109 |
var concerns = $("#table_concerns").kohaTable({ |
| 110 |
"ajax": { |
| 111 |
"url": concerns_url |
| 112 |
}, |
| 113 |
"embed": [ |
| 114 |
"reporter", |
| 115 |
"resolver", |
| 116 |
"biblio" |
| 117 |
], |
| 118 |
'emptyTable': '<div class="dialog message">'+_("Congradulations, there are no catalog concerns.")+'</div>', |
| 119 |
"columnDefs": [ { |
| 120 |
"targets": [0,1,2,3], |
| 121 |
"render": function (data, type, row, meta) { |
| 122 |
if ( type == 'display' ) { |
| 123 |
if ( data != null ) { |
| 124 |
return data.escapeHtml(); |
| 125 |
} |
| 126 |
else { |
| 127 |
return ""; |
| 128 |
} |
| 129 |
} |
| 130 |
return data; |
| 131 |
} |
| 132 |
} ], |
| 133 |
"columns": [ |
| 134 |
{ |
| 135 |
"data": "reported_date:reporter.firstname", |
| 136 |
"render": function(data, type, row, meta) { |
| 137 |
let reported = '<span class="date clearfix">'+$datetime(row.reported_date)+'</span>'; |
| 138 |
reported += '<span class="reporter clearfix">'+$patron_to_html( row.reporter, { display_cardnumber: false, url: true } )+'</span>'; |
| 139 |
return reported; |
| 140 |
}, |
| 141 |
"searchable": true, |
| 142 |
"orderable": true |
| 143 |
}, |
| 144 |
{ |
| 145 |
"data": "message", |
| 146 |
"searchable": true, |
| 147 |
"orderable": true |
| 148 |
}, |
| 149 |
{ |
| 150 |
"data": "biblio.title", |
| 151 |
"render": function(data, type, row, meta) { |
| 152 |
return $biblio_to_html(row.biblio, { link: 1 }); |
| 153 |
}, |
| 154 |
"searchable": true, |
| 155 |
"orderable": true |
| 156 |
}, |
| 157 |
{ |
| 158 |
"data": "resolved_date:resolver.firstname", |
| 159 |
"render": function(data, type, row, meta) { |
| 160 |
let result = ''; |
| 161 |
if ( row.resolved_date ) { |
| 162 |
result += _("Resolved by:")+' <span>'+$patron_to_html( row.resolver, { display_cardnumber: false, url: true } )+'</span>'; |
| 163 |
result += '<span class="clearfix">'+$datetime(row.resolved_date)+'</span>'; |
| 164 |
} else { |
| 165 |
result += _("Open"); |
| 166 |
} |
| 167 |
return result; |
| 168 |
}, |
| 169 |
"searchable": true, |
| 170 |
"orderable": true |
| 171 |
}, |
| 172 |
{ |
| 173 |
"data": function( row, type, val, meta ) { |
| 174 |
var result = '<a class="btn btn-default btn-xs" role="button" class="resolve_concern" data-concern-id="'+ encodeURIComponent(row.concern_id) +'"><i class="fa fa-check" aria-hidden="true"></i> '+_("Resolve")+'</a>'; |
| 175 |
return result; |
| 176 |
}, |
| 177 |
"searchable": false, |
| 178 |
"orderable": false |
| 179 |
}, |
| 180 |
] |
| 181 |
}); |
| 182 |
|
| 183 |
$('#table_concerns').on( "click", '.resolve_concern', function () { |
| 184 |
var concern_id = decodeURIComponent($(this).data('concern-id')); |
| 185 |
|
| 186 |
$("#delete_confirm_modal_button").unbind("click").on( "click", function () { |
| 187 |
$.ajax({ |
| 188 |
method: "PUT", |
| 189 |
url: "/api/v1/catalog/concerns/"+concern_id |
| 190 |
}).success(function() { |
| 191 |
$("#delete_confirm_modal").modal('hide'); |
| 192 |
concerns.api().ajax.reload(function (data) { |
| 193 |
$("#concern_action_result_dialog").hide(); |
| 194 |
$("#concern_delete_success").html(_("Concern #%s deleted successfully.").format(concern_id)).show(); |
| 195 |
}); |
| 196 |
}).error(function () { |
| 197 |
$("#concern_delete_error").html(_("Error deleting concern #%s. Check the logs.").format(concern_id)).show(); |
| 198 |
}); |
| 199 |
}); |
| 200 |
}); |
| 201 |
|
| 202 |
$('#addConcernModal').on('click', '#addConfirm', function(e) { |
| 203 |
let biblio_id = $('#biblio_add').val(); |
| 204 |
let message = $('#message_add').val(); |
| 205 |
|
| 206 |
params = { |
| 207 |
message: message, |
| 208 |
biblio_id: biblio_id, |
| 209 |
reporter_id: logged_in_user_borrowernumber, |
| 210 |
}; |
| 211 |
|
| 212 |
$.ajax({ |
| 213 |
url: '/api/v1/catalog/concerns', |
| 214 |
type: 'POST', |
| 215 |
data: JSON.stringify(params), |
| 216 |
success: function(data) { |
| 217 |
$('#AddConcernModal').modal('hide'); |
| 218 |
|
| 219 |
if ( $.fn.dataTable.isDataTable("#table_concerns") ) { |
| 220 |
$("#table_concerns").DataTable().ajax.reload(); |
| 221 |
} |
| 222 |
}, |
| 223 |
contentType: "json" |
| 224 |
}); |
| 225 |
}); |
| 226 |
}); |
| 227 |
</script> |
| 228 |
[% END %] |
| 229 |
[% INCLUDE 'intranet-bottom.inc' %] |