bfe0f08729f96dae5ab7900800554c4ebd5d204a
[working/Evergreen.git] / Open-ILS / src / templates / serial / subscription.tt2
1 [% WRAPPER "base.tt2" %]
2 <script>
3     var cap_editor;
4     var cap_importer;
5 </script>
6 <script src="[% ctx.media_prefix %]/js/ui/default/serial/common.js">
7 </script>
8 <script src="[% ctx.media_prefix %]/js/ui/default/serial/subscription.js">
9 </script>
10 <script src="[% ctx.media_prefix %]/js/ui/default/serial/subscription/caption_and_pattern.js">
11 </script>
12 <script src="[% ctx.media_prefix %]/js/ui/default/serial/subscription/issuance.js">
13 </script>
14
15 <div dojoType="dijit.layout.ContentPane" layout="top" class="oils-header-panel">
16     <div>[% l('Subscription Details') %]</div>
17     <div>
18         <span dojoType="dijit.form.Button" onClick="clone_dialog.show();">
19             [% l('Clone Subscription') %]
20         </span>
21         <span dojoType="dijit.form.Button" onClick="open_batch_receive();">
22             [% l('Batch Item Receive') %]
23         </span>
24     </div>
25 </div>
26
27 <div dojoType="dijit.layout.TabContainer" jsId="tab_container"
28     class="oils-serial-tab-container">
29
30     <!-- Subscription Summary -->
31     <div dojoType="dijit.layout.ContentPane" title="[% l('Summary') %]" selected="true">
32         <script type="dojo/connect" event="onShow">
33             load_sub_grid(sub_id);
34         </script>
35         <table jsId="sub_grid"
36             dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector="20px">
37             <thead>
38                 <tr>
39                     <th field="id">[% l('ID') %]</th>
40                     <th field="owning_lib" formatter="format_org_unit">
41                         [% l('Owning Library') %]
42                     </th>
43                     <th field="start_date" formatter="format_date">
44                         [% l('Start Date') %]
45                     </th>
46                     <th field="end_date" formatter="format_date">
47                         [% l('End Date') %]
48                     </th>
49                     <th field="record_entry" width="20em"
50                         formatter="format_bib">
51                         [% l('Bibliographic Record') %]
52                     </th>
53                     <th field="expected_date_offset">[% l('Expected Date Offset') %]</th>
54                     <th field="num_dist">[% l('Number of Distributions') %]</th>
55                 </tr>
56             </thead>
57         </table>
58     </div>
59
60     <!-- Distributions -->
61     <div dojoType="dijit.layout.ContentPane" jsId="distributions_tab"
62         title="[% l('Distributions') %]" layoutAlign="client">
63         <script type="dojo/connect" event="onShow">
64             if (!dist_grid._fresh) {
65                 dist_grid.resetStore();
66                 dist_grid.loadAll(
67                     {"order_by": {"sdist": "holding_lib"}},
68                     {"subscription": sub_id}
69                 );
70                 dist_grid._fresh = true;
71             }
72
73             if (!dist_grid.overrideEditWidgets.subscription) {
74                 dist_grid.overrideEditWidgets.subscription =
75                     new dijit.form.TextBox({
76                         "disabled": true, "value": sub_id
77                     });
78
79                 var _display_grouping_store = new dojo.data.ItemFileReadStore({
80                     "data": {
81                         "identifier": "display_grouping",
82                         "label": "label",
83                         "items": [
84                             {"display_grouping": "chron",
85                                 "label": "[% l('Chronology') %]"},
86                             {"display_grouping": "enum",
87                                 "label": "[% l('Enumeration') %]"}
88                         ]
89                     }
90                 });
91
92                 var settings = fieldmapper.aou.fetchOrgSettingBatch(
93                     openils.User.user.ws_ou(),
94                     ["serial.default_display_grouping"]
95                 );
96                 var default_display_grouping = "chron";
97
98                 if (settings && settings["serial.default_display_grouping"]) {
99                     default_display_grouping =
100                         settings["serial.default_display_grouping"].value;
101                 }
102
103                 dist_grid.overrideEditWidgets.display_grouping =
104                     new dijit.form.FilteringSelect({
105                         "store": _display_grouping_store,
106                         "searchAttr": "label",
107                         "name": "display_grouping"
108                     });
109                     dist_grid.overrideEditWidgets.display_grouping.shove = {
110                         "create": default_display_grouping
111                     };
112             }
113         </script>
114         [% INCLUDE "serial/subscription/distribution.tt2" %]
115     </div>
116
117     <!-- Caption/Pattern -->
118     <div dojoType="dijit.layout.ContentPane"
119         title="[% l('Captions and Patterns') %]" layoutAlign="client">
120         <script type="dojo/connect" event="onShow">
121             if (!cap_editor) {
122                 cap_editor = new SCAPEditor(sub_id);
123                 cap_importer = new SCAPImporter(sub);
124             }
125         </script>
126         [% INCLUDE "serial/subscription/caption_and_pattern.tt2" %]
127     </div>
128
129     <!-- Issuances -->
130     <div dojoType="dijit.layout.ContentPane" jsId="issuances_tab"
131         title="[% l('Issuances') %]" layoutAlign="client">
132         <script type="dojo/connect" event="onShow">
133             if (!iss_grid._fresh) {
134                 iss_grid.resetStore();
135                 iss_grid.loadAll(
136                     {"order_by": {"siss": "date_published"}},
137                     {"subscription": sub_id}
138                 );
139                 iss_grid._fresh = true;
140             }
141
142             if (!iss_grid.overrideEditWidgets.subscription) {
143                 iss_grid.overrideEditWidgets.subscription =
144                     new dijit.form.TextBox({
145                         "disabled": true, "value": sub_id
146                     });
147
148                 iss_grid.overrideEditWidgets.creator =
149                     new dijit.form.TextBox({"disabled": true});
150                 iss_grid.overrideEditWidgets.creator.shove = {
151                     "create": openils.User.user.id()
152                 };
153
154                 iss_grid.overrideEditWidgets.editor =
155                     new dijit.form.TextBox({
156                         "disabled": true, "value": openils.User.user.id()
157                     });
158
159                 iss_grid.overrideEditWidgets.holding_type =
160                     new dijit.form.TextBox({"disabled": true});
161                 iss_grid.overrideEditWidgets.holding_type.shove = {"create":""};
162
163                 iss_grid.overrideEditWidgets.holding_type =
164                     new dijit.form.TextBox;
165             }
166             fresh_scap_selector(iss_grid);
167         </script>
168         [% INCLUDE "serial/subscription/issuance.tt2" %]
169     </div>
170 </div>
171 <div class="hidden">
172     <div dojoType="openils.widget.ProgressDialog" jsId="progress_dialog"></div>
173     <div dojoType="dijit.Dialog" jsId="clone_dialog" title="[% l('Clone Subscription') %]"
174         style="width: 460px;" execute="clone_subscription(arguments[0]);">
175         <div style="margin-bottom: 0.5em;">
176             [% |l %]This feature will clone a subscription and all of its subscription
177             notes, distributions, distribution notes, captions and patterns,
178             streams, and routing list users.[% END %]</div>
179         <div style="margin-bottom: 0.5em;">
180             [% |l %]Holdings-related objects, like issuances, items, units, and
181             summaries will <em>not</em> be cloned.[% END %]
182         </div>
183         <div style="margin-bottom: 0.5em;">
184             [% |l %]To what bibliographic record should the new subscription be
185             attached?[% END %]
186         </div>
187         <table width="100%">
188             <tr>
189                 <td style="padding-right: 0.5em; vertical-align: top;">
190                     <input dojoType="dijit.form.RadioButton"
191                         id="use_ident_no" name="use_ident" value="no"
192                         checked="checked" />
193                 </td>
194                 <td>
195                     <label for="use_ident_no">
196                         [% l('Same record as the existing subscription') %]
197                     </label>
198                 </td>
199             </tr>
200             <tr>
201                 <td style="padding-right: 0.5em; vertical-align: top;">
202                     <input dojoType="dijit.form.RadioButton"
203                         onChange="toggle_clone_ident_field(this);"
204                         id="use_ident_yes" name="use_ident" value="yes" />
205                 </td>
206                 <td>
207                     <label for="use_ident_yes">
208                         [% l('Record specified by this unique identifier:') %]
209                     </label>
210                     <input dojoType="dijit.form.TextBox" name="ident"
211                         jsId="clone_ident" disabled="true"
212                         style="margin-left: 0.5em; width: 10em;" />
213                 </td>
214             </tr>
215             <tr>
216                 <td colspan="2" align="center">
217                     <span dojoType="dijit.form.Button" type="submit">
218                         [% l('Clone!') %]
219                     </span>
220                 </td>
221             </tr>
222         </table>
223     </div>
224 </div>
225 [% END %]