]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/serial/subscription.tt2
LP1615805 No inputs after submit in patron search (AngularJS)
[working/Evergreen.git] / Open-ILS / src / templates / serial / subscription.tt2
1 [% USE CGI; %]
2 [% WRAPPER "base.tt2" %]
3 <script>
4     [%- IF CGI.param('context') == 'scv' %]
5     xulG = parent.xulG;
6     [%- END %]
7     [%- IF CGI.param('id') != 'new' %]
8     sub_id = [% CGI.param('id') %];
9     [%- ELSE %]
10     sub_id = -1;
11     [%- END %]
12     var cap_editor;
13     var cap_importer;
14 </script>
15 <script src="[% ctx.media_prefix %]/js/ui/default/serial/common.js">
16 </script>
17 <script src="[% ctx.media_prefix %]/js/ui/default/serial/subscription.js">
18 </script>
19 <script src="[% ctx.media_prefix %]/js/ui/default/serial/subscription/distribution.js"></script>
20 <script src="[% ctx.media_prefix %]/js/ui/default/serial/subscription/caption_and_pattern.js">
21 </script>
22 <script src="[% ctx.media_prefix %]/js/ui/default/serial/subscription/issuance.js">
23 </script>
24 [% IF CGI.param('context') == 'scv' -%]
25 <!-- links in the frame have no style at all, let's give them one -->
26 <style type="text/css">
27     a { color: #1155CC; text-decoration: underline }
28     a:hover { text-decoration: none }
29 </style>
30 [%- END %]
31
32 <div dojoType="dijit.layout.ContentPane" layout="top" class="oils-header-panel">
33     <div>[% l('Subscription Details') %]</div>
34     <div>
35         <span dojoType="dijit.form.Button" onClick="clone_dialog.show();">
36             [% l('Clone Subscription') %]
37         </span>
38         <span dojoType="dijit.form.Button" onClick="open_batch_receive();">
39             [% l('Batch Item Receive') %]
40         </span>
41     </div>
42 </div>
43
44 <div dojoType="dijit.layout.TabContainer" jsId="tab_container"
45     class="oils-serial-tab-container">
46
47     <!-- Subscription Summary -->
48     [%- IF CGI.param('context') == 'scv' -%]
49     <div dojoType="dijit.layout.ContentPane" title="[% l('View/Edit') %]" selected="true">
50         <div dojoType="dijit.layout.ContentPane" layout="top"
51             class="oils-header-panel lesser">
52             <div>[% l('Subscriptions') %]</div>
53             <div style="margin-right: 16px;">
54                 <span dojoType="dijit.form.Button"
55                     onClick="open_notes('sub', ssub_grid);">[% l('View/Edit Notes') %]</span>
56             </div>
57         </div>
58
59         <script type="dojo/connect" event="onShow">
60             if(ssub_grid.store && !ssub_grid._fresh) { // onShow fires twice on initial page load; we only want to run the second time (and subsequent times)
61                 ssub_grid.resetStore();
62                 if (sub_id) {
63                     ssub_grid.loadAll(
64                         {"order_by": {"ssub": "start_date DESC"}},
65                         {"id": sub_id}
66                     );
67                 }
68                 ssub_grid._fresh = true;
69             }
70         </script>
71         <table jsId="ssub_grid"
72             dojoType="openils.widget.AutoGrid"
73             query="{id: '*'}"
74             fieldOrder="['id','owning_lib','start_date','end_date']"
75             suppressFields="['record_entry']"
76             fmClass="ssub"
77             showPaginator="true"
78             onPostSubmit="attempt_reload_opac"
79             showSequenceFields="true"
80             editOnEnter="true">
81         </table>
82     </div>
83     [%- ELSE -%]
84     <div dojoType="dijit.layout.ContentPane" title="[% l('Summary') %]" selected="true">
85         <script type="dojo/connect" event="onShow">
86             load_sub_grid(sub_id);
87         </script>
88         <table jsId="sub_grid"
89             dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector="20px">
90             <thead>
91                 <tr>
92                     <th field="id">[% l('ID') %]</th>
93                     <th field="owning_lib" formatter="format_org_unit">
94                         [% l('Owning Library') %]
95                     </th>
96                     <th field="start_date" formatter="format_date">
97                         [% l('Start Date') %]
98                     </th>
99                     <th field="end_date" formatter="format_date">
100                         [% l('End Date') %]
101                     </th>
102                     <th field="record_entry" width="20em"
103                         formatter="format_bib">
104                         [% l('Bibliographic Record') %]
105                     </th>
106                     <th field="expected_date_offset">[% l('Expected Date Offset') %]</th>
107                     <th field="num_dist">[% l('Number of Distributions') %]</th>
108                 </tr>
109             </thead>
110         </table>
111     </div>
112     [%- END -%]
113
114     <!-- Distributions -->
115     <div dojoType="dijit.layout.ContentPane" jsId="distributions_tab"
116         title="[% l('Distributions') %]" layoutAlign="client">
117         <script type="dojo/connect" event="onShow">
118             if (!dist_grid._fresh) {
119                 dist_grid.resetStore();
120                 dist_grid.loadAll(
121                     {"order_by": {"sdist": "holding_lib"}},
122                     {"subscription": sub_id}
123                 );
124                 dist_grid._fresh = true;
125             }
126
127             if (!dist_grid.overrideEditWidgets.subscription) {
128                 dist_grid.overrideEditWidgets.subscription =
129                     new dijit.form.TextBox({
130                         "disabled": true, "value": sub_id
131                     });
132
133                 [%- IF CGI.param('context') == 'scv' %]
134                 // attach the holding_lib selector to the record_entry selector
135                 dist_grid.overrideWidgetArgs.holding_lib = {'dijitArgs' : {'onChange' : function(value) { populate_sre_selector(dist_grid, value); } }};
136
137                 [%- END %]
138                 var _display_grouping_store = new dojo.data.ItemFileReadStore({
139                     "data": {
140                         "identifier": "display_grouping",
141                         "label": "label",
142                         "items": [
143                             {"display_grouping": "chron",
144                                 "label": "[% l('Chronology') %]"},
145                             {"display_grouping": "enum",
146                                 "label": "[% l('Enumeration') %]"}
147                         ]
148                     }
149                 });
150
151                 var settings = fieldmapper.aou.fetchOrgSettingBatch(
152                     openils.User.user.ws_ou(),
153                     ["serial.default_display_grouping"]
154                 );
155                 var default_display_grouping = "chron";
156
157                 if (settings && settings["serial.default_display_grouping"]) {
158                     default_display_grouping =
159                         settings["serial.default_display_grouping"].value;
160                 }
161
162                 dist_grid.overrideEditWidgets.display_grouping =
163                     new dijit.form.FilteringSelect({
164                         "store": _display_grouping_store,
165                         "searchAttr": "label",
166                         "name": "display_grouping"
167                     });
168                     dist_grid.overrideEditWidgets.display_grouping.shove = {
169                         "create": default_display_grouping
170                     };
171
172                 var _summary_method_store = new dojo.data.ItemFileReadStore({
173                     "data": {
174                         "identifier": "summary_method",
175                         "label": "label",
176                         "items": [
177                             {"summary_method": "add_to_sre",
178                                 "label": "[% l('Add to record entry') %]"},
179                             {"summary_method": "merge_with_sre",
180                                 "label": "[% l('Merge with record entry') %]"},
181                             {"summary_method": "use_sre_only",
182                                 "label": "[% l('Use record entry only') %]"},
183                             {"summary_method": "use_sdist_only",
184                                 "label": "[% l('Do not use record entry') %]"}
185                         ]
186                     }
187                 });
188
189                 dist_grid.overrideEditWidgets.summary_method =
190                     new dijit.form.FilteringSelect({
191                         "store": _summary_method_store,
192                         "searchAttr": "label",
193                         "name": "summary_method"
194                     });
195                     // TODO: add setting for default selection?
196                     dist_grid.overrideEditWidgets.summary_method.shove = {
197                         "create": "add_to_sre"
198                     };
199
200             }
201         </script>
202         [% INCLUDE "serial/subscription/distribution.tt2" %]
203     </div>
204
205     <!-- Caption/Pattern -->
206     <div dojoType="dijit.layout.ContentPane"
207         title="[% l('Captions and Patterns') %]" layoutAlign="client">
208         <script type="dojo/connect" event="onShow">
209             if (!cap_editor) {
210                 cap_editor = new SCAPEditor(sub_id);
211                 cap_importer = new SCAPImporter(sub);
212             }
213         </script>
214         [% INCLUDE "serial/subscription/caption_and_pattern.tt2" %]
215     </div>
216
217     <!-- Issuances -->
218     <div dojoType="dijit.layout.ContentPane" jsId="issuances_tab"
219         title="[% l('Issuances') %]" layoutAlign="client">
220         <script type="dojo/connect" event="onShow">
221             if (!iss_grid._fresh) {
222                 iss_grid.resetStore();
223                 iss_grid.loadAll(
224                     {"order_by": {"siss": "date_published"}},
225                     {"subscription": sub_id}
226                 );
227                 iss_grid._fresh = true;
228             }
229
230             if (!iss_grid.overrideEditWidgets.subscription) {
231                 iss_grid.overrideEditWidgets.subscription =
232                     new dijit.form.TextBox({
233                         "disabled": true, "value": sub_id
234                     });
235
236                 iss_grid.overrideEditWidgets.creator =
237                     new dijit.form.TextBox({"disabled": true});
238                 iss_grid.overrideEditWidgets.creator.shove = {
239                     "create": openils.User.user.id()
240                 };
241
242                 iss_grid.overrideEditWidgets.editor =
243                     new dijit.form.TextBox({
244                         "disabled": true, "value": openils.User.user.id()
245                     });
246
247                 iss_grid.overrideEditWidgets.holding_type =
248                     new dijit.form.TextBox({"disabled": true});
249                 iss_grid.overrideEditWidgets.holding_type.shove = {"create":""};
250
251                 iss_grid.overrideEditWidgets.holding_type =
252                     new dijit.form.TextBox;
253             }
254             fresh_scap_selector(iss_grid);
255         </script>
256         [% INCLUDE "serial/subscription/issuance.tt2" %]
257     </div>
258 </div>
259 <div class="hidden">
260     <div dojoType="openils.widget.ProgressDialog" jsId="progress_dialog"></div>
261     <div dojoType="dijit.Dialog" jsId="clone_dialog" title="[% l('Clone Subscription') %]"
262         style="width: 460px;" execute="clone_subscription(arguments[0]);">
263         <div style="margin-bottom: 0.5em;">
264             [% l('This feature will clone a subscription and all of its subscription ' _
265             'notes, distributions, distribution notes, captions and patterns, ' _
266             'streams, and routing list users.') %]</div>
267         <div style="margin-bottom: 0.5em;">
268             [% l('Holdings-related objects, like issuances, items, units, and ' _
269             'summaries will <em>not</em> be cloned.') %]
270         </div>
271         <div style="margin-bottom: 0.5em;">
272             [% l('To what bibliographic record should the new subscription be attached?') %]
273         </div>
274         <table width="100%">
275             <tr>
276                 <td style="padding-right: 0.5em; vertical-align: top;">
277                     <input dojoType="dijit.form.RadioButton"
278                         id="use_ident_no" name="use_ident" value="no"
279                         checked="checked" />
280                 </td>
281                 <td>
282                     <label for="use_ident_no">
283                         [% l('Same record as the existing subscription') %]
284                     </label>
285                 </td>
286             </tr>
287             <tr>
288                 <td style="padding-right: 0.5em; vertical-align: top;">
289                     <input dojoType="dijit.form.RadioButton"
290                         onChange="toggle_clone_ident_field(this);"
291                         id="use_ident_yes" name="use_ident" value="yes" />
292                 </td>
293                 <td>
294                     <label for="use_ident_yes">
295                         [% l('Record specified by this unique identifier:') %]
296                     </label>
297                     <input dojoType="dijit.form.TextBox" name="ident"
298                         jsId="clone_ident" disabled="true"
299                         style="margin-left: 0.5em; width: 10em;" />
300                 </td>
301             </tr>
302             <tr>
303                 <td colspan="2" align="center">
304                     <span dojoType="dijit.form.Button" type="submit">
305                         [% l('Clone!') %]
306                     </span>
307                 </td>
308             </tr>
309         </table>
310     </div>
311 </div>
312 [% END %]