1 dump('entering circ.checkout.js\n');
3 if (typeof patron == 'undefined') patron = {};
4 circ.checkout = function (params) {
6 JSAN.use('util.error'); this.error = new util.error();
7 JSAN.use('main.network'); this.network = new main.network();
9 JSAN.use('OpenILS.data'); this.OpenILS = {};
10 this.OpenILS.data = new OpenILS.data(); this.OpenILS.data.init({'via':'stash'});
13 circ.checkout.prototype = {
15 'init' : function( params ) {
19 obj.session = params['session'];
20 obj.patron_id = params['patron_id'];
22 JSAN.use('main.list'); obj.list = new main.list('checkout_list');
23 //FIXME//getString used to wrap StringBundles, but we need to do the entity/div thing
24 function getString(s) { return obj.OpenILS.data.entities[s]; }
29 'id' : 'acp_id', 'label' : getString('staff.acp_label_id'), 'flex' : 1,
30 'primary' : false, 'hidden' : true, 'render' : 'my.acp.id()'
33 'id' : 'circ_id', 'label' : getString('staff.circ_label_id'), 'flex' : 1,
34 'primary' : false, 'hidden' : true, 'render' : 'my.circ.id()'
37 'id' : 'mvr_doc_id', 'label' : getString('staff.mvr_label_doc_id'), 'flex' : 1,
38 'primary' : false, 'hidden' : true, 'render' : 'my.mvr.doc_id()'
41 'id' : 'barcode', 'label' : getString('staff.acp_label_barcode'), 'flex' : 1,
42 'primary' : false, 'hidden' : false, 'render' : 'my.acp.barcode()'
45 'id' : 'call_number', 'label' : getString('staff.acp_label_call_number'), 'flex' : 1,
46 'primary' : false, 'hidden' : true, 'render' : 'my.acp.call_number()'
49 'id' : 'copy_number', 'label' : getString('staff.acp_label_copy_number'), 'flex' : 1,
50 'primary' : false, 'hidden' : true, 'render' : 'my.acp.copy_number()'
53 'id' : 'location', 'label' : getString('staff.acp_label_location'), 'flex' : 1,
54 'primary' : false, 'hidden' : true, 'render' : 'my.acp.location()'
57 'id' : 'loan_duration', 'label' : getString('staff.acp_label_loan_duration'), 'flex' : 1,
58 'primary' : false, 'hidden' : true, 'render' : 'my.acp.loan_duration()'
61 'id' : 'circ_lib', 'label' : getString('staff.acp_label_circ_lib'), 'flex' : 1,
62 'primary' : false, 'hidden' : true, 'render' : 'my.acp.circ_lib()'
65 'id' : 'fine_level', 'label' : getString('staff.acp_label_fine_level'), 'flex' : 1,
66 'primary' : false, 'hidden' : true, 'render' : 'my.acp.fine_level()'
69 'id' : 'deposit', 'label' : getString('staff.acp_label_deposit'), 'flex' : 1,
70 'primary' : false, 'hidden' : true, 'render' : 'my.acp.deposit()'
73 'id' : 'deposit_amount', 'label' : getString('staff.acp_label_deposit_amount'), 'flex' : 1,
74 'primary' : false, 'hidden' : true, 'render' : 'my.acp.deposit_amount()'
77 'id' : 'price', 'label' : getString('staff.acp_label_price'), 'flex' : 1,
78 'primary' : false, 'hidden' : true, 'render' : 'my.acp.price()'
81 'id' : 'circ_as_type', 'label' : getString('staff.acp_label_circ_as_type'), 'flex' : 1,
82 'primary' : false, 'hidden' : true, 'render' : 'my.acp.circ_as_type()'
85 'id' : 'circ_modifier', 'label' : getString('staff.acp_label_circ_modifier'), 'flex' : 1,
86 'primary' : false, 'hidden' : true, 'render' : 'my.acp.circ_modifier()'
89 'id' : 'xact_start', 'label' : getString('staff.circ_label_xact_start'), 'flex' : 1,
90 'primary' : false, 'hidden' : true, 'render' : 'my.circ.xact_start()'
93 'id' : 'xact_finish', 'label' : getString('staff.circ_label_xact_finish'), 'flex' : 1,
94 'primary' : false, 'hidden' : true, 'render' : 'my.circ.xact_finish()'
97 'id' : 'due_date', 'label' : getString('staff.circ_label_due_date'), 'flex' : 1,
98 'primary' : false, 'hidden' : false, 'render' : 'my.circ.due_date().substr(0,10)'
101 'id' : 'title', 'label' : getString('staff.mvr_label_title'), 'flex' : 2,
102 'primary' : false, 'hidden' : false, 'render' : 'my.mvr.title()'
105 'id' : 'author', 'label' : getString('staff.mvr_label_author'), 'flex' : 1,
106 'primary' : false, 'hidden' : false, 'render' : 'my.mvr.author()'
109 'id' : 'renewal_remaining', 'label' : getString('staff.circ_label_renewal_remaining'), 'flex' : 0,
110 'primary' : false, 'hidden' : false, 'render' : 'my.circ.renewal_remaining()'
113 'id' : 'status', 'label' : getString('staff.acp_label_status'), 'flex' : 1,
114 'primary' : false, 'hidden' : false, 'render' : 'obj.OpenILS.data.hash.ccs[ my.acp.status() ].name()'
117 'map_row_to_column' : function(row,col) {
118 // row contains { 'my' : { 'acp' : {}, 'circ' : {}, 'mvr' : {} } }
119 // col contains one of the objects listed above in columns
121 return eval( col.render );
126 JSAN.use('main.controller'); obj.controller = new main.controller();
130 'checkout_barcode_entry_textbox' : [
137 function() { alert('Not Yet Implemented'); }
139 'cmd_checkout_submit_barcode' : [
143 var barcode = obj.controller.view.checkout_barcode_entry_textbox.value;
144 var permit = obj.network.request(
146 'open-ils.circ.permit_checkout',
147 [ obj.session, barcode, obj.patron_id, 0 ]
150 if (permit.status == 0) {
151 var checkout = obj.network.request(
153 'open-ils.circ.checkout.barcode',
154 [ obj.session, barcode, obj.patron_id ]
160 'circ' : checkout.circ,
161 'mvr' : checkout.record,
162 'acp' : checkout.copy
165 //I could override map_row_to_column here
168 if (typeof obj.on_checkout == 'function') {
176 alert('FIXME: need special alert and error handling\n'
178 if (typeof obj.on_failure == 'function') {
184 'cmd_checkout_print' : [
189 'cmd_checkout_reprint' : [
194 'cmd_checkout_done' : [
205 'on_checkout' : function() {
206 this.controller.view.checkout_barcode_entry_textbox.value = '';
207 this.controller.view.checkout_barcode_entry_textbox.focus();
210 'on_failure' : function() {
211 this.controller.view.checkout_barcode_entry.textbox.select();
212 this.controller.view.checkout_barcode_entry_textbox.focus();
216 dump('exiting circ.checkout.js\n');