base_uri as a misnomer. changed to base_path. added support for overrideing the...
[working/Evergreen.git] / Open-ILS / web / templates / default / acq / common / jubgrid.tt2
1 [%#-
2 This template creates a split screen Dojo layout. The top frame
3 of the screen holds a list of of JUBs, or titles. Clicking on a
4 title in the top frame will load the purchase details for all the
5 copies on order for that title into the bottom frame.
6
7 To create a display for a set of JUBs, create a Dojo store and
8 model for the set of JUBs, then place the following lines in your
9 HTML where you want the display to appear:
10
11     <%namespace file='/oils/default/common/jubgrid.html' name='jubgrid'/>
12     ${jubgrid.jubgrid('dom_prefix', 'grid_jsid')}
13
14 where 'dom_prefix' is a string that will be used as the prefix
15 for the DOM notes that are created by this template, and
16 'grid_jsid' is a valid JavaScript identifier that will name the
17 DOM node to which the list of JUBs will be attached.  For example
18
19     ${jubgrid.jubgrid('oils-acq-picklist', 'pickListGrid', hideDetails)}
20
21 will create a Dojo grid with the DOM id of
22
23     'oils-acq-picklist-JUB-grid'
24
25 and a jsid of
26
27     pickListGrid
28
29 To fill the grid with data, call the javascript function
30
31     JUBGrid.populate(grid_jsid, model)
32
33 'grid_jsid' is the same javascript id that was used to
34 instantiate the template, and model is a javascript variable
35 pointing to the JUB model (and store) that you have created.
36 -#%]
37
38 [% UNLESS hide_details %]
39 <div dojoType='dijit.layout.ContentPane' style='height:100%;'>
40 [% END %]
41
42     <style type='text/css'>
43         .grid_container {width: 100%; height: 100%;}
44     </style>
45
46     <script src='[% ctx.media_prefix %]/js/ui/default/acq/common/jubgrid.js'> </script>
47     <script src='[% ctx.media_prefix %]/js/dojo/openils/CopyLocation.js'> </script>
48     <script type="text/javascript">
49     JUBGrid.getPO = function(rowIndex) {
50         var data = JUBGrid.jubGrid.model.getRow(rowIndex);
51         if (!(data && data.purchase_order)) return '';
52         return "<a href='[% ctx.base_path %]/acq/po/view/" + data.purchase_order+"'>"+data.purchase_order+"</a>";
53     }
54     JUBGrid.jubGridLayout = [{
55         //noscroll: true,
56         cells: [[
57             {name: 'ID', field: 'id', width:'auto'},
58             {name: 'Title', width: "180px", get:JUBGrid.getJUBTitle},
59             {name: 'Author', get:JUBGrid.getJUBAuthor, width:'auto'},
60             {name: 'ISBN', get:JUBGrid.getJUBIsbn, width:'auto'},
61             {name: 'Pubdate', get:JUBGrid.getJUBPubdate, width:'auto'},
62             {name: 'Actual Price', 
63                 field:'actual_price',
64                 get:JUBGrid.getJUBActualPrice,
65                 editor:dojox.grid.editors.Dijit, width:'auto', 
66                 editorClass: "dijit.form.CurrencyTextBox" 
67             },
68             {name: 'Estimated Price', 
69                 field:'estimated_price',
70                 get:JUBGrid.getJUBEstimatedPrice, width:'auto',
71                 editor:dojox.grid.editors.Dijit, 
72                 editorClass: "dijit.form.CurrencyTextBox" 
73             },
74             {name: 'Vendor', width:'auto',
75              field: 'provider', get:JUBGrid.getProvider,
76              editor:openils.editors.ProviderSelectEditor,
77             },
78             {name: 'No. Copies', field: 'item_count', width:'auto'},
79             {name: 'State', field: 'state', width:'auto'},
80             {name: 'PO', get:JUBGrid.getPO, width:'auto'}
81         ]]
82     }];
83
84     JUBGrid.jubDetailGridLayout = [{
85         cells: [[
86             {name:"ID", field:"id"},
87             {name:"Fund", field:"fund",
88                 get:JUBGrid.getLIDFundCode,
89                 editor: openils.editors.FundSelectEditor,
90             },
91             {name:"Branch", field:"owning_lib",
92                     get:JUBGrid.getLIDLibName,
93                     editor: openils.editors.OrgUnitSelectEditor
94                 },
95             {name:"Barcode", field:"barcode", width:'auto',
96                 editor:dojox.grid.editors.Dijit, 
97                 editorClass: "dijit.form.TextBox" 
98                 },
99             {name:"Call Number", field:"cn_label", width:'auto',
100                 editor:dojox.grid.editors.Dijit, 
101                 editorClass: "dijit.form.TextBox" 
102                 },
103             {name:"Shelving Location", field:"location", width:'auto',
104                 editor:openils.editors.CopyLocationSelectEditor,
105                 get:JUBGrid.getCopyLocation
106                 },
107             {name:"Receive Time", width:'auto',
108                 get:JUBGrid.getRecvTime
109                 },
110         ]]
111     }];
112
113     JUBGrid.jubDetailGridLayoutReadOnly = [{
114         cells: [[
115             {name:'ID', field:"id"},
116             {name:'Fund', field:"fund",
117              get:JUBGrid.getLIDFundCode,
118             },
119             {name:'Branch', field:"owning_lib",
120                     get:JUBGrid.getLIDLibName,
121                 },
122             {name:'Barcode', field:"barcode", width:'auto'},
123             {name:'Call Number', field:"cn_label", width:'auto'},
124             {name:'Shelving Location', field:"location", 
125                 width:'auto', get:JUBGrid.getCopyLocation},
126         ]]
127     }];
128     </script>
129
130 [% UNLESS hide_details %]
131     <!-- button bar for lineitems -->
132     <script>JUBGrid.showDetails = true;</script>
133     <div id="[% domprefix %]-container" class='container'
134         dojoType="dijit.layout.ContentPane" sizeMin="" sizeShare="">
135         <div dojoType="dijit.layout.ContentPane"
136              id='[% domprefix %]-jub-buttonbar'>
137             <button dojoType="dijit.form.Button" onclick="JUBGrid.approveJUB">
138                 Approve Selected Titles
139             </button>
140             <button dojoType="dijit.form.Button" onclick="JUBGrid.removeSelectedJUBs">
141                 Remove Selected Titles
142             </button>
143         </div>
144     </div>
145     <div style='height:40%;'>
146 [% ELSE %]
147     <div style='height:100%;'>
148 [% END %]
149         <div structure='JUBGrid.jubGridLayout' jsid='[% grid_jsid %]' class='grid_container'
150             dojoType='dojox.Grid' id="[% domprefix %]-JUB-grid">
151         </div>
152     </div>
153 [% UNLESS hide_details %]
154     <!-- button bar for lineitem details -->
155     <div dojoType="dijit.layout.ContentPane" sizeMin="" sizeShare="" class='container'>
156         <div dojoType="dijit.layout.ContentPane" id='[% domprefix %]-details-buttonbar'>
157             <div dojoType="dijit.form.DropDownButton">
158                 <span>New Copy</span>
159                 <div dojoType="dijit.TooltipDialog" execute="JUBGrid.createLID(arguments[0]);">
160                     <script type='dojo/connect' event='onOpen'>
161                         new openils.User().buildPermOrgSelector('MANAGE_FUND', copyOwnerSelect);
162                         openils.acq.Fund.buildPermFundSelector('MANAGE_FUND', acqlidFund);
163                     </script>
164                     <table class="dijitTooltipTable">
165                         <tr>
166                             <td><label for="fund">Fund: </label></td>
167                             <td>
168                                 <input dojoType="openils.widget.FundSelector"
169                                 jsId="acqlidFund" searchAttr="name" autocomplete="true" name="fund"></input>
170                             </td>
171                         </tr>
172                         <tr>
173                             <td><label for="owning_lib">Location: </label></td>
174                             <td><input dojoType="openils.widget.OrgUnitFilteringSelect"
175                                 jsId="copyOwnerSelect"
176                                 searchAttr="shortname"
177                                 name="owning_lib" autocomplete="true"
178                                 labelAttr="shortname"></input>
179                             </td>
180                         </tr>
181                         <tr>
182                             <td colspan="2" align="center">
183                                 <button dojotype="dijit.form.Button" type="submit">
184                                 Create
185                                 </button>
186                             </td>
187                         </tr>
188                     </table>
189                 </div>
190             </div>
191             <button dojoType='dijit.form.Button' onclick='JUBGrid.deleteLID'>
192                 Delete Selected Copy
193             </button>
194             <button dojoType='dijit.form.Button' onclick='JUBGrid.receiveLID'>
195                 Mark Selected Copies Received
196             </button>
197         </div>
198     </div>
199     <!-- end button bar -->
200
201     <div style='height:40%;'>
202             <div class='grid_container'>
203             <div structure='JUBGrid.jubDetailGridLayout' jsid="JUBGrid.jubDetailGrid" dojoType="dojox.Grid"
204                 id='[% domprefix %]-details-grid'>
205             </div>
206         </div>
207     </div>
208 </div>
209 [% END %]