|
Lines 47-120
Link Here
|
| 47 |
<div class="alert alert-warning">Staff members are not allowed to access patron's holds history</div> |
47 |
<div class="alert alert-warning">Staff members are not allowed to access patron's holds history</div> |
| 48 |
[% ELSIF is_anonymous %] |
48 |
[% ELSIF is_anonymous %] |
| 49 |
<div class="alert alert-warning">This is the anonymous patron, so no holds history is displayed.</div> |
49 |
<div class="alert alert-warning">This is the anonymous patron, so no holds history is displayed.</div> |
| 50 |
[% ELSIF ( !holds ) %] |
|
|
| 51 |
<div class="alert alert-info">This patron has no holds history.</div> |
| 52 |
[% ELSE %] |
50 |
[% ELSE %] |
| 53 |
|
51 |
|
| 54 |
[% SET show_itemtype_column = Koha.Preference('AllowHoldItemTypeSelection') %] |
52 |
[% SET show_itemtype_column = Koha.Preference('AllowHoldItemTypeSelection') %] |
| 55 |
|
53 |
|
| 56 |
<div id="holdshistory" class="page-section"> |
54 |
<div id="holdshistory" class="page-section"> |
| 57 |
<table id="table_holdshistory"> |
55 |
<h2>Current holds</h2> |
| 58 |
<thead> |
56 |
[% IF patron.holds.count %] |
| 59 |
<tr> |
57 |
<table id="table_holdshistory"> |
| 60 |
<th class="anti-the">Title</th> |
58 |
<thead> |
| 61 |
<th>Author</th> |
59 |
<tr> |
| 62 |
<th>Barcode</th> |
60 |
<th class="anti-the">Title</th> |
| 63 |
<th>Call number</th> |
61 |
<th>Author</th> |
| 64 |
<th>Library</th> |
62 |
<th>Barcode</th> |
| 65 |
<th>Hold date</th> |
63 |
<th>Call number</th> |
| 66 |
<th>Expiration date</th> |
64 |
<th>Library</th> |
| 67 |
<th>Waiting date</th> |
65 |
<th>Hold date</th> |
| 68 |
<th>Cancellation date</th> |
66 |
<th>Expiration date</th> |
| 69 |
[% IF show_itemtype_column %] |
67 |
<th>Waiting date</th> |
| 70 |
<th>Requested item type</th> |
68 |
<th>Cancellation date</th> |
| 71 |
[% END %] |
69 |
[% IF show_itemtype_column %] |
| 72 |
<th>Status</th> |
70 |
<th>Requested item type</th> |
| 73 |
</tr> |
71 |
[% END %] |
| 74 |
</thead> |
72 |
<th>Status</th> |
| 75 |
<tbody> |
73 |
</tr> |
| 76 |
[% FOREACH hold IN holds %] |
74 |
</thead> |
|
|
75 |
</table> |
| 76 |
[% ELSE %] |
| 77 |
<div class="dialog message">This patron has no current holds.</div> |
| 78 |
[% END %] |
| 79 |
|
| 80 |
<h2>Historical holds</h2> |
| 81 |
[% IF patron.old_holds.count %] |
| 82 |
<table id="table_oldholdshistory"> |
| 83 |
<thead> |
| 77 |
<tr> |
84 |
<tr> |
| 78 |
<td>[% INCLUDE 'biblio-title.inc' biblio=hold.biblio link = 1 %]</td> |
85 |
<th class="anti-the">Title</th> |
| 79 |
<td>[% hold.biblio.author | html %]</td> |
86 |
<th>Author</th> |
| 80 |
<td>[% hold.item.barcode | html %]</td> |
87 |
<th>Barcode</th> |
| 81 |
<td>[% hold.item.itemcallnumber | html %]</td> |
88 |
<th>Call number</th> |
| 82 |
<td>[% Branches.GetName( hold.branchcode ) | html %]</td> |
89 |
<th>Library</th> |
| 83 |
<td data-order="[% hold.reservedate | html %]">[% hold.reservedate | $KohaDates %]</td> |
90 |
<th>Hold date</th> |
| 84 |
<td data-order="[% hold.expirationdate | html %]"> [% hold.expirationdate | $KohaDates %] </td> |
91 |
<th>Expiration date</th> |
| 85 |
<td data-order="[% hold.waitingdate | html %]"> [% hold.waitingdate | $KohaDates %] </td> |
92 |
<th>Waiting date</th> |
| 86 |
<td data-order="[% hold.cancellationdate | html %]"> [% hold.cancellationdate | $KohaDates %] </td> |
93 |
<th>Cancellation date</th> |
| 87 |
[% IF show_itemtype_column %] |
94 |
[% IF show_itemtype_column %] |
| 88 |
<td> |
95 |
<th>Requested item type</th> |
| 89 |
[% IF hold.itemtype %] |
|
|
| 90 |
[% ItemTypes.GetDescription( hold.itemtype ) | html %] |
| 91 |
[% ELSE %] |
| 92 |
<span>Any item type</span> |
| 93 |
[% END %] |
| 94 |
</td> |
| 95 |
[% END %] |
96 |
[% END %] |
| 96 |
<td> |
97 |
<th>Status</th> |
| 97 |
[% IF hold.found == 'F' %] |
|
|
| 98 |
<span>Fulfilled</span> |
| 99 |
[% ELSIF hold.cancellationdate %] |
| 100 |
<span>Cancelled</span> |
| 101 |
[% IF hold.cancellation_reason %] |
| 102 |
([% AuthorisedValues.GetByCode('HOLD_CANCELLATION', hold.cancellation_reason) | html %]) |
| 103 |
[% END %] |
| 104 |
[% ELSIF hold.found == 'W' %] |
| 105 |
<span>Waiting</span> |
| 106 |
[% ELSIF hold.found == 'P' %] |
| 107 |
<span>Processing</span> |
| 108 |
[% ELSIF hold.found == 'T' %] |
| 109 |
<span>In transit</span> |
| 110 |
[% ELSE %] |
| 111 |
<span>Pending</span> |
| 112 |
[% END %] |
| 113 |
</td> |
| 114 |
</tr> |
98 |
</tr> |
| 115 |
[% END %] |
99 |
</thead> |
| 116 |
</tbody> |
100 |
</table> |
| 117 |
</table> |
101 |
[% ELSE %] |
|
|
102 |
<div class="dialog message">This patron has no historical holds.</div> |
| 103 |
[% END %] |
| 118 |
</div> |
104 |
</div> |
| 119 |
[% END %] |
105 |
[% END %] |
| 120 |
[% END %] |
106 |
[% END %] |
|
Lines 123-128
Link Here
|
| 123 |
[% INCLUDE 'datatables.inc' %] |
109 |
[% INCLUDE 'datatables.inc' %] |
| 124 |
[% INCLUDE 'str/members-menu.inc' %] |
110 |
[% INCLUDE 'str/members-menu.inc' %] |
| 125 |
[% Asset.js("js/members-menu.js") | $raw %] |
111 |
[% Asset.js("js/members-menu.js") | $raw %] |
|
|
112 |
[% INCLUDE 'js-biblio-format.inc' %] |
| 126 |
<script> |
113 |
<script> |
| 127 |
$(document).ready(function() { |
114 |
$(document).ready(function() { |
| 128 |
var table_settings = [% TablesSettings.GetTableSettings('members', 'holdshistory', 'holdshistory-table', 'json') | $raw %]; |
115 |
var table_settings = [% TablesSettings.GetTableSettings('members', 'holdshistory', 'holdshistory-table', 'json') | $raw %]; |
|
Lines 130-142
Link Here
|
| 130 |
//Remove item type column settings |
117 |
//Remove item type column settings |
| 131 |
table_settings['columns'] = table_settings['columns'].filter(function(c){return c['columnname'] != 'itemtype';}); |
118 |
table_settings['columns'] = table_settings['columns'].filter(function(c){return c['columnname'] != 'itemtype';}); |
| 132 |
[% END %] |
119 |
[% END %] |
| 133 |
var table = $("#table_holdshistory").kohaTable( |
120 |
build_holds_table("#table_holdshistory"); |
| 134 |
{ |
121 |
build_holds_table("#table_oldholdshistory", 1); |
| 135 |
pagingType: "full", |
122 |
function build_holds_table(table_id, old){ |
| 136 |
order: [[4, "desc"]], |
123 |
let table_url = '/api/v1/patrons/[% patron.borrowernumber | uri %]/holds'; |
| 137 |
}, |
124 |
if (old){table_url += '?old=1'} |
| 138 |
table_settings |
125 |
$(table_id).kohaTable({ |
| 139 |
); |
126 |
ajax: { |
|
|
127 |
url: table_url, |
| 128 |
}, |
| 129 |
order: [], |
| 130 |
embed: ['biblio', 'item', 'pickup_library', 'pickup_library.branchname'], |
| 131 |
columns: [ |
| 132 |
{ |
| 133 |
data: "biblio.title:biblio.subtitle:biblio.medium", |
| 134 |
searchable: true, |
| 135 |
orderable: true, |
| 136 |
render: function (data, type, row, meta) { |
| 137 |
return $biblio_to_html(row.biblio, { link: 1 }); |
| 138 |
} |
| 139 |
}, |
| 140 |
{ |
| 141 |
data: "biblio.author", |
| 142 |
searchable: true, |
| 143 |
orderable: true, |
| 144 |
render: function (data, type, row, meta) { |
| 145 |
return row.biblio.author; |
| 146 |
} |
| 147 |
}, |
| 148 |
{ |
| 149 |
data: "item.external_id", |
| 150 |
searchable: true, |
| 151 |
orderable: true, |
| 152 |
render: function (data, type, row, meta) { |
| 153 |
return row.item ? row.item.external_id : ""; |
| 154 |
} |
| 155 |
}, |
| 156 |
{ |
| 157 |
data: "item.callnumber", |
| 158 |
searchable: true, |
| 159 |
orderable: true, |
| 160 |
render: function (data, type, row, meta) { |
| 161 |
return row.item ? row.item.callnumber: ""; |
| 162 |
} |
| 163 |
}, |
| 164 |
{ |
| 165 |
data: "pickup_library_id:pickup_library.branchname", |
| 166 |
searchable: true, |
| 167 |
orderable: true, |
| 168 |
render: function (data, type, row, meta) { |
| 169 |
return row.pickup_library.name; |
| 170 |
} |
| 171 |
}, |
| 172 |
{ |
| 173 |
data: "hold_date", |
| 174 |
type: "date", |
| 175 |
searchable: true, |
| 176 |
orderable: true, |
| 177 |
render: function (data, type, row, meta) { |
| 178 |
return $date(row.hold_date); |
| 179 |
} |
| 180 |
}, |
| 181 |
{ |
| 182 |
data: "expiration_date", |
| 183 |
type: "date", |
| 184 |
searchable: true, |
| 185 |
orderable: true, |
| 186 |
render: function (data, type, row, meta) { |
| 187 |
return $date(row.expiration_date) |
| 188 |
} |
| 189 |
}, |
| 190 |
{ |
| 191 |
data: "waiting_date", |
| 192 |
type: "date", |
| 193 |
searchable: true, |
| 194 |
orderable: true, |
| 195 |
render: function (data, type, row, meta) { |
| 196 |
return $date(row.waiting_date) |
| 197 |
} |
| 198 |
}, |
| 199 |
{ |
| 200 |
data: "cancellation_date", |
| 201 |
type: "date", |
| 202 |
searchable: true, |
| 203 |
orderable: true, |
| 204 |
render: function (data, type, row, meta) { |
| 205 |
return $date(row.cancellation_date) |
| 206 |
} |
| 207 |
}, |
| 208 |
[% IF show_itemtype_column %] |
| 209 |
{ |
| 210 |
data: "item_type.item_type", |
| 211 |
searchable: true, |
| 212 |
orderable: true, |
| 213 |
render: function (data, type, row, meta) { |
| 214 |
if ( row.item_type ) { |
| 215 |
return row.item_type.item_type; |
| 216 |
} else { |
| 217 |
return _("Any item type"); |
| 218 |
} |
| 219 |
} |
| 220 |
}, |
| 221 |
[% END %] |
| 222 |
{ |
| 223 |
data: "found", // FIXME filter with dropdown list |
| 224 |
searchable: true, |
| 225 |
orderable: true, |
| 226 |
render: function (data, type, row, meta) { |
| 227 |
if ( row.status == 'F' ) { |
| 228 |
return _("Fulfilled"); |
| 229 |
} else if (row.cancellation_date) { |
| 230 |
let r = _("Cancelled"); |
| 231 |
if (row.cancellation_reason){ |
| 232 |
r += "(%s)".format("FIXME"); //FIXME Add HOLD_CANCELLATION description |
| 233 |
} |
| 234 |
return r; |
| 235 |
} else if (row.status == 'W') { |
| 236 |
return _("Waiting"); |
| 237 |
} else if (row.status == 'P') { |
| 238 |
return _("Processing"); |
| 239 |
} else if (row.status == 'T') { |
| 240 |
return _("In transit"); |
| 241 |
} |
| 242 |
|
| 243 |
return _("Pending"); |
| 244 |
} |
| 245 |
}, |
| 246 |
], |
| 247 |
}, table_settings); |
| 248 |
} |
| 140 |
}); |
249 |
}); |
| 141 |
</script> |
250 |
</script> |
| 142 |
[% END %] |
251 |
[% END %] |