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