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