]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/patron/items.js
thinko
[Evergreen.git] / Open-ILS / xul / staff_client / server / patron / items.js
1 dump('entering patron.items.js\n');
2
3 if (typeof patron == 'undefined') patron = {};
4 patron.items = function (params) {
5
6         JSAN.use('util.error'); this.error = new util.error();
7         JSAN.use('util.network'); this.network = new util.network();
8         this.OpenILS = {}; JSAN.use('OpenILS.data'); this.OpenILS.data = new OpenILS.data(); this.OpenILS.data.init({'via':'stash'});
9 }
10
11 patron.items.prototype = {
12
13         'init' : function( params ) {
14
15                 var obj = this;
16
17                 obj.session = params['session'];
18                 obj.patron_id = params['patron_id'];
19
20                 JSAN.use('circ.util');
21                 var columns = circ.util.columns( 
22                         { 
23                                 'title' : { 'hidden' : false, 'flex' : '3' },
24                                 'xact_start' : { 'hidden' : false },
25                                 'due_date' : { 'hidden' : false },
26                                 'renewal_remaining' : { 'hidden' : false },
27                         } 
28                 );
29
30                 JSAN.use('util.list'); obj.list = new util.list('item_list');
31                 obj.list.init(
32                         {
33                                 'columns' : columns,
34                                 'map_row_to_column' : circ.util.std_map_row_to_column(),
35                         }
36                 );
37                 
38                 JSAN.use('util.controller'); obj.controller = new util.controller();
39                 obj.controller.init(
40                         {
41                                 'control_map' : {
42                                         'cmd_broken' : [
43                                                 ['command'],
44                                                 function() { alert('Not Yet Implemented'); }
45                                         ],
46                                         'cmd_item_print' : [
47                                                 ['command'],
48                                                 function() {
49                                                 }
50                                         ],
51                                         'cmd_item_reprint' : [
52                                                 ['command'],
53                                                 function() {
54                                                 }
55                                         ],
56                                 }
57                         }
58                 );
59
60         },
61
62         'retrieve' : function() {
63                 if (window.xulG && window.xulG.checkouts) {
64                         this.checkouts = window.xulG.checkouts;
65                 } else {
66                         this.checkouts = this.network.request(
67                                 api.blob_checkouts_retrieve.app,
68                                 api.blob_checkouts_retrieve.method,
69                                 [ this.session, this.patron_id ]
70                         );
71                                 
72                 }
73                 for (var i in this.checkouts) {
74                         this.list.append(
75                                 {
76                                         'row' : {
77                                                 'my' : {
78                                                         'circ' : this.checkouts[i].circ,
79                                                         'mvr' : this.checkouts[i].record,
80                                                         'acp' : this.checkouts[i].copy
81                                                 }
82                                         }
83                                 }
84                         );
85                 }
86         },
87 }
88
89 dump('exiting patron.items.js\n');