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 124-129
Link Here
|
124 |
[% INCLUDE 'columns_settings.inc' %] |
110 |
[% INCLUDE 'columns_settings.inc' %] |
125 |
[% INCLUDE 'str/members-menu.inc' %] |
111 |
[% INCLUDE 'str/members-menu.inc' %] |
126 |
[% Asset.js("js/members-menu.js") | $raw %] |
112 |
[% Asset.js("js/members-menu.js") | $raw %] |
|
|
113 |
[% INCLUDE 'js-biblio-format.inc' %] |
127 |
<script> |
114 |
<script> |
128 |
$(document).ready(function() { |
115 |
$(document).ready(function() { |
129 |
var table_settings = [% TablesSettings.GetTableSettings('members', 'holdshistory', 'holdshistory-table', 'json') | $raw %]; |
116 |
var table_settings = [% TablesSettings.GetTableSettings('members', 'holdshistory', 'holdshistory-table', 'json') | $raw %]; |
Lines 131-140
Link Here
|
131 |
//Remove item type column settings |
118 |
//Remove item type column settings |
132 |
table_settings['columns'] = table_settings['columns'].filter(function(c){return c['columnname'] != 'itemtype';}); |
119 |
table_settings['columns'] = table_settings['columns'].filter(function(c){return c['columnname'] != 'itemtype';}); |
133 |
[% END %] |
120 |
[% END %] |
134 |
var table = KohaTable("table_holdshistory", { |
121 |
build_holds_table("#table_holdshistory"); |
135 |
"pagingType": "full", |
122 |
build_holds_table("#table_oldholdshistory", 1); |
136 |
"order": [[4, 'desc']] |
123 |
function build_holds_table(table_id, old){ |
137 |
}, table_settings); |
124 |
let table_url = '/api/v1/patrons/[% patron.borrowernumber | uri %]/holds'; |
|
|
125 |
if (old){table_url += '?old=1'} |
126 |
$(table_id).kohaTable({ |
127 |
ajax: { |
128 |
url: table_url, |
129 |
}, |
130 |
order: [], |
131 |
embed: ['biblio', 'item', 'pickup_library', 'pickup_library.branchname'], |
132 |
columns: [ |
133 |
{ |
134 |
data: "biblio.title:biblio.subtitle:biblio.medium", |
135 |
searchable: true, |
136 |
orderable: true, |
137 |
render: function (data, type, row, meta) { |
138 |
return $biblio_to_html(row.biblio, { link: 1 }); |
139 |
} |
140 |
}, |
141 |
{ |
142 |
data: "biblio.author", |
143 |
searchable: true, |
144 |
orderable: true, |
145 |
render: function (data, type, row, meta) { |
146 |
return row.biblio.author; |
147 |
} |
148 |
}, |
149 |
{ |
150 |
data: "item.external_id", |
151 |
searchable: true, |
152 |
orderable: true, |
153 |
render: function (data, type, row, meta) { |
154 |
return row.item ? row.item.external_id : ""; |
155 |
} |
156 |
}, |
157 |
{ |
158 |
data: "item.callnumber", |
159 |
searchable: true, |
160 |
orderable: true, |
161 |
render: function (data, type, row, meta) { |
162 |
return row.item ? row.item.callnumber: ""; |
163 |
} |
164 |
}, |
165 |
{ |
166 |
data: "pickup_library_id:pickup_library.branchname", |
167 |
searchable: true, |
168 |
orderable: true, |
169 |
render: function (data, type, row, meta) { |
170 |
return row.pickup_library.name; |
171 |
} |
172 |
}, |
173 |
{ |
174 |
data: "hold_date", |
175 |
type: "date", |
176 |
searchable: true, |
177 |
orderable: true, |
178 |
render: function (data, type, row, meta) { |
179 |
return $date(row.hold_date); |
180 |
} |
181 |
}, |
182 |
{ |
183 |
data: "expiration_date", |
184 |
type: "date", |
185 |
searchable: true, |
186 |
orderable: true, |
187 |
render: function (data, type, row, meta) { |
188 |
return $date(row.expiration_date) |
189 |
} |
190 |
}, |
191 |
{ |
192 |
data: "waiting_date", |
193 |
type: "date", |
194 |
searchable: true, |
195 |
orderable: true, |
196 |
render: function (data, type, row, meta) { |
197 |
return $date(row.waiting_date) |
198 |
} |
199 |
}, |
200 |
{ |
201 |
data: "cancellation_date", |
202 |
type: "date", |
203 |
searchable: true, |
204 |
orderable: true, |
205 |
render: function (data, type, row, meta) { |
206 |
return $date(row.cancellation_date) |
207 |
} |
208 |
}, |
209 |
[% IF show_itemtype_column %] |
210 |
{ |
211 |
data: "item_type.item_type", |
212 |
searchable: true, |
213 |
orderable: true, |
214 |
render: function (data, type, row, meta) { |
215 |
if ( row.item_type ) { |
216 |
return row.item_type.item_type; |
217 |
} else { |
218 |
return _("Any item type"); |
219 |
} |
220 |
} |
221 |
}, |
222 |
[% END %] |
223 |
{ |
224 |
data: "found", // FIXME filter with dropdown list |
225 |
searchable: true, |
226 |
orderable: true, |
227 |
render: function (data, type, row, meta) { |
228 |
if ( row.status == 'F' ) { |
229 |
return _("Fulfilled"); |
230 |
} else if (row.cancellation_date) { |
231 |
let r = _("Cancelled"); |
232 |
if (row.cancellation_reason){ |
233 |
r += "(%s)".format("FIXME"); //FIXME Add HOLD_CANCELLATION description |
234 |
} |
235 |
return r; |
236 |
} else if (row.status == 'W') { |
237 |
return _("Waiting"); |
238 |
} else if (row.status == 'P') { |
239 |
return _("Processing"); |
240 |
} else if (row.status == 'T') { |
241 |
return _("In transit"); |
242 |
} |
243 |
|
244 |
return _("Pending"); |
245 |
} |
246 |
}, |
247 |
], |
248 |
}, table_settings); |
249 |
} |
138 |
}); |
250 |
}); |
139 |
</script> |
251 |
</script> |
140 |
[% END %] |
252 |
[% END %] |