]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/web/js/ui/default/booking/return.js
LP#1706124: Make include inactive patrons checkbox sticky
[working/Evergreen.git] / Open-ILS / web / js / ui / default / booking / return.js
1 dojo.requireLocalization("openils.booking", "pickup_and_return");
2 var localeStrings = dojo.i18n.getLocalization(
3     "openils.booking", "pickup_and_return"
4 );
5 var p;
6
7 function react_to_pass_in(opts) {
8     if (opts && opts.patron_barcode) {
9         p.populate({"patron": opts.patron_barcode});
10
11         hide_dom_element(
12             document.getElementById("contains_barcode_control")
13         );
14
15         document.getElementById("barcode").value = opts.patron_barcode;
16         var barcode_type = document.getElementById("barcode_type");
17         for (var i in barcode_type.options) {
18             if (barcode_type.options[i].value == "patron") {
19                 barcode_type.selectedIndex = i;
20                 break;
21             }
22         }
23
24         p._extra_resetting = function() {
25             reveal_dom_element(
26                 document.getElementById("contains_barcode_control")
27             );
28         };
29     }
30 }
31
32 function my_init() {
33     p = new Populator({
34         "out": out_bresv,
35         "in": in_bresv,
36         "patron": document.getElementById("patron_info")
37     }, document.getElementById("barcode"));
38     init_auto_l10n(document.getElementById("auto_l10n_start_here"));
39
40     setTimeout(
41         function() {
42             var opts;
43             if (typeof xulG != 'undefined' && typeof xulG.bresv_interface_opts != 'undefined') {
44                 opts = xulG.bresv_interface_opts;
45             } else {
46                 opts = {};
47             }
48             var uri = location.href;
49             var query = uri.substring(uri.indexOf("?") + 1, uri.length);
50             var queryObject = dojo.queryToObject(query);
51             if (typeof queryObject['patron_barcode'] != 'undefined') {
52                 opts.patron_barcode = queryObject['patron_barcode'];
53             }
54             react_to_pass_in(opts);
55         }, 0
56     );
57 }