Bug 7736: Support Ordering via Edifact EDI messages
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / subscription-numberpatterns.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Serials &rsaquo; Numbering patterns</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 [% INCLUDE 'calendar.inc' %]
5 <script type="text/javascript">
6 //<![CDATA[
7
8 function confirmDelete() {
9   return confirm(_("Are you sure you want to delete this numbering pattern?"));
10 }
11
12 [% IF (new or modify) %]
13   function testPattern() {
14       var frequencyid = $("#frequency").val();
15       var firstacquidate = $("#firstacquidate").val();
16       var error = 0;
17       var error_msg = "";
18       if(frequencyid == undefined || frequencyid == "") {
19           error_msg += _("- Frequency is not defined") + "\n";
20           error ++;
21       }
22       if(firstacquidate == undefined || firstacquidate == "") {
23           error_msg += _("- First publication date is not defined") + "\n";
24           error ++;
25       }
26
27       if(error){
28           alert(_("Cannot test prediction pattern for the following reason(s):") + "\n\n"
29               + error_msg);
30           return false;
31       }
32
33       var ajaxData = {
34           'custompattern': true,
35       };
36       var ajaxParams = [
37           'firstacquidate', 'subtype', 'sublength', 'frequency', 'numberingmethod',
38           'lastvalue1', 'lastvalue2', 'lastvalue3', 'add1', 'add2', 'add3',
39           'every1', 'every2', 'every3', 'innerloop1', 'innerloop2', 'innerloop3',
40           'setto1', 'setto2', 'setto3', 'numbering1', 'numbering2', 'numbering3',
41           'whenmorethan1', 'whenmorethan2', 'whenmorethan3', 'locale'
42       ];
43       for(i in ajaxParams) {
44           var param = ajaxParams[i];
45           var value = $("#"+param).val();
46           if(value.length > 0)
47               ajaxData[param] = value;
48       }
49
50       $.ajax({
51           url: "/cgi-bin/koha/serials/showpredictionpattern.pl",
52           data: ajaxData,
53           async: false,
54           dataType: "text",
55           success: function(data) {
56               $("#predictionpattern").html(data);
57           }
58       });
59   }
60 [% END %]
61
62 function show_blocking_subs() {
63     $("#blocking_subs").show();
64 }
65 $(document).ready(function(){
66     $(".delete_pattern").on("click",function(){
67         return confirmDelete();
68     });
69 });
70 //]]>
71 </script>
72 </head>
73
74 <body id="ser_subscription_numberpatterns" class="ser">
75 [% INCLUDE 'header.inc' %]
76 [% INCLUDE 'serials-search.inc' %]
77
78 <div id="breadcrumbs">
79     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
80     <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo;
81     <a href="/cgi-bin/koha/serials/subscription-numberpatterns.pl">Numbering patterns</a>
82 </div>
83
84 <div id="doc3" class="yui-t2">
85
86 <div id="bd">
87   <div id="yui-main">
88     <div class="yui-b">
89       [% IF (new or modify) %]
90         <div class="yui-g">
91           [% IF (new) %]
92             <h1>New numbering pattern</h1>
93             [% IF (error_existing_numberpattern) %]
94               <div class="dialog alert">
95                 <p>A pattern with this name already exists.</p>
96               </div>
97             [% END %]
98           [% ELSE %]
99             <h1>Modify pattern: [% label %]</h1>
100             [% IF (error_existing_numberpattern) %]
101               <div class="dialog alert">
102                 <p>Another pattern with this name already exists.</p>
103               </div>
104             [% END %]
105           [% END %]
106         </div>
107         <div class="yui-g">
108           <form action="/cgi-bin/koha/serials/subscription-numberpatterns.pl" method="post">
109             [% IF (new) %]
110               <input type="hidden" name="op" value="savenew" />
111             [% ELSE %]
112               <input type="hidden" name="op" value="savemod" />
113               <input type="hidden" name="id" value="[% id %]" />
114             [% END %]
115             <fieldset class="rows">
116               <ol>
117                 <li>
118                   <label for="label">Name:</label>
119                   <input type="text" id="label" name="label" value="[% label %]" />
120                 </li>
121                 <li>
122                   <label for="description">Description:</label>
123                   <input type="text" id="description" name="description" value="[% description %]" />
124                 </li>
125                 <li>
126                   <label for="numberingmethod">Numbering formula:</label>
127                   <input type="text" id="numberingmethod" name="numberingmethod" value="[% numberingmethod %]" />
128                 </li>
129                 <li>
130                   <label for="displayorder">Display order:</label>
131                   <input type="text" id="displayorder" name="displayorder" value="[% displayorder %]" />
132                 </li>
133               </ol>
134               <table>
135                 <thead>
136                   <tr>
137                     <th>&nbsp;</th>
138                     <th>X</th>
139                     <th>Y</th>
140                     <th>Z</th>
141                   </tr>
142                 </thead>
143                 <tbody>
144                   <tr>
145                     <td>Label</td>
146                     <td><input type="text" id="label1" name="label1" value="[% label1 %]" /></td>
147                     <td><input type="text" id="label2" name="label2" value="[% label2 %]" /></td>
148                     <td><input type="text" id="label3" name="label3" value="[% label3 %]" /></td>
149                   </tr>
150                   <tr>
151                     <td>Add</td>
152                     <td><input type="text" id="add1" name="add1" value="[% add1 %]" /></td>
153                     <td><input type="text" id="add2" name="add2" value="[% add2 %]" /></td>
154                     <td><input type="text" id="add3" name="add3" value="[% add3 %]" /></td>
155                   </tr>
156                   <tr>
157                     <td>Every</td>
158                     <td><input type="text" id="every1" name="every1" value="[% every1 %]" /></td>
159                     <td><input type="text" id="every2" name="every2" value="[% every2 %]" /></td>
160                     <td><input type="text" id="every3" name="every3" value="[% every3 %]" /></td>
161                   </tr>
162                   <tr>
163                     <td>Set back to</td>
164                     <td><input type="text" id="setto1" name="setto1" value="[% setto1 %]" /></td>
165                     <td><input type="text" id="setto2" name="setto2" value="[% setto2 %]" /></td>
166                     <td><input type="text" id="setto3" name="setto3" value="[% setto3 %]" /></td>
167                   </tr>
168                   <tr>
169                     <td>When more than</td>
170                     <td><input type="text" id="whenmorethan1" name="whenmorethan1" value="[% whenmorethan1 %]" /></td>
171                     <td><input type="text" id="whenmorethan2" name="whenmorethan2" value="[% whenmorethan2 %]" /></td>
172                     <td><input type="text" id="whenmorethan3" name="whenmorethan3" value="[% whenmorethan3 %]" /></td>
173                   </tr>
174                   <tr>
175                     [% BLOCK numbering_select %]
176                       <select id="[% name %]" name="[% name %]">
177                         <option value=""></option>
178                         [% IF (value == "dayname") %]
179                             <option selected="selected" value="dayname">Name of day</option>
180                         [% ELSE %]
181                             <option value="dayname">Name of day</option>
182                         [% END %]
183                         [% IF (value == "monthname") %]
184                             <option selected="selected" value="monthname">Name of month</option>
185                         [% ELSE %]
186                             <option value="monthname">Name of month</option>
187                         [% END %]
188                         [% IF (value == "season") %]
189                             <option selected="selected" value="season">Name of season</option>
190                         [% ELSE %]
191                             <option value="season">Name of season</option>
192                         [% END %]
193                       </select>
194                     [% END %]
195                     <td>Formatting</td>
196                     <td>[% PROCESS numbering_select name="numbering1" value=numbering1 %]</td>
197                     <td>[% PROCESS numbering_select name="numbering2" value=numbering2 %]</td>
198                     <td>[% PROCESS numbering_select name="numbering3" value=numbering3 %]</td>
199                   </tr>
200                 </tbody>
201               </table>
202             </fieldset>
203             <fieldset class="action">
204               <input type="submit" value="Save" />
205               <input type="reset" value="Reset" />
206               <a class="cancel" href="/cgi-bin/koha/serials/subscription-numberpatterns.pl">Cancel</a>
207             </fieldset>
208           </form>
209         </div>
210         <div class="yui-g">
211           <form>
212             <fieldset class="rows">
213               <legend>Test prediction pattern</legend>
214               <ol>
215                 <li>
216                   <label for="frequency">Frequency: </label>
217                   <select id="frequency">
218                     [% FOREACH frequency IN frequencies_loop %]
219                       <option value="[% frequency.id %]">[% frequency.description %]</option>
220                     [% END %]
221                   </select>
222                 </li>
223                 <li>
224                   <label for="firstacquidate">First issue publication date: </label>
225                   <input type="text" id="firstacquidate" class="datepicker" size="10" />
226                 </li>
227                 <li>
228                   <label for="sublength">Subscription length:</label>
229                   <select id="subtype">
230                     [% FOREACH subtype IN subtypes_loop %]
231                       <option value="[% subtype.value %]">[% subtype.value %]</option>
232                     [% END %]
233                   </select>
234                   <input type="text" id="sublength" size="3" />
235                 </li>
236                 <li>
237                   <label for="locale">Locale: </label>
238                   <select id="locale" name="locale">
239                       <option value=""></option>
240                       [% FOREACH locale IN locales %]
241                         <option value="[% locale.language %]">[% locale.description %]</option>
242                       [% END %]
243                     </select>
244                   <span class="hint">If empty, English is used</span>
245                 </li>
246               </ol>
247               <table>
248                 <thead>
249                   <tr>
250                     <th>&nbsp;</th>
251                     <th>X</th>
252                     <th>Y</th>
253                     <th>Z</th>
254                   </tr>
255                 </thead>
256                 <tbody>
257                   <tr>
258                     <td>Begins with</td>
259                     <td><input type="text" id="lastvalue1" name="lastvalue1" value="[% lastvalue1 %]" /></td>
260                     <td><input type="text" id="lastvalue2" name="lastvalue2" value="[% lastvalue2 %]" /></td>
261                     <td><input type="text" id="lastvalue3" name="lastvalue3" value="[% lastvalue3 %]" /></td>
262                   </tr>
263                   <tr>
264                     <td>Inner counter</td>
265                     <td><input type="text" id="innerloop1" name="innerloop1" value="[% innerloop1 %]" /></td>
266                     <td><input type="text" id="innerloop2" name="innerloop2" value="[% innerloop2 %]" /></td>
267                     <td><input type="text" id="innerloop3" name="innerloop3" value="[% innerloop3 %]" /></td>
268                   </tr>
269                 </tbody>
270               </table>
271               <fieldset class="action">
272               <input type="button" value="Test pattern" onclick="testPattern();" />
273               </fieldset>
274               <div id="predictionpattern"></div>
275             </fieldset>
276           </form>
277         </div>
278       [% ELSE %]
279         <h1>Numbering patterns</h1>
280         [% IF still_used %]
281             <div class="dialog alert">
282                 <p>
283                     This pattern is still used by [% subscriptions.size %]
284                     subscription(s). Do you still want to delete it?
285                 </p>
286                 <p><a href="#" onclick="show_blocking_subs(); return false;">Show subscriptions</a></p>
287                 <ul id="blocking_subs" style="display:none">
288                     [% FOREACH sub IN subscriptions %]
289                         <li style="list-style-type:none">
290                             <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% sub.subscriptionid %]">[% sub.title %]</a>
291                         </li>
292                     [% END %]
293                 </ul>
294
295                 <form action="/cgi-bin/koha/serials/subscription-numberpatterns.pl" method="get">
296                     <input type="hidden" name="op" value="del" />
297                     <input type="hidden" name="confirm" value="1" />
298                     <input type="hidden" name="id" value="[% id %]" />
299                     <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
300                 </form>
301                 <form action="/cgi-bin/koha/serials/subscription-numberpatterns.pl" method="get">
302                     <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
303                 </form>
304             </div>
305         [% END %]
306
307         <div id="toolbar" class="btn-toolbar">
308             <a class="btn btn-small" id="newnumberpattern" href="/cgi-bin/koha/serials/subscription-numberpatterns.pl?op=new"><i class="fa fa-plus"></i> New numbering pattern</a>
309         </div>
310
311         [% IF (numberpatterns_loop.size) %]
312           <table id="numberpatternst">
313             <thead>
314               <tr>
315                 <th>Name</th>
316                 <th>Description</th>
317                 <th>Numbering formula</th>
318                 <th>Display order</th>
319                 <th>Actions</th>
320               </tr>
321             </thead>
322             <tbody>
323               [% FOREACH numberpattern IN numberpatterns_loop %]
324                 <tr>
325                   <td>[% numberpattern.label %]</td>
326                   <td>[% numberpattern.description %]</td>
327                   <td>[% numberpattern.numberingmethod %]</td>
328                   <td>[% numberpattern.displayorder %]</td>
329                   <td class="actions">
330                     <a class="btn btn-mini" href="/cgi-bin/koha/serials/subscription-numberpatterns.pl?op=modify&id=[% numberpattern.id %]"><i class="fa fa-pencil"></i> Edit</a>
331                     <a class="delete_pattern btn btn-mini" href="/cgi-bin/koha/serials/subscription-numberpatterns.pl?op=del&id=[% numberpattern.id %]"><i class="fa fa-trash"></i> Delete</a>
332                   </td>
333                 </tr>
334               [% END %]
335             </tbody>
336           </table>
337         [% ELSE %]
338           <p>There are no existing numbering patterns.</p>
339         [% END %]
340       [% END %]
341     </div>
342   </div>
343   <div class="yui-b">
344     [% INCLUDE 'serials-menu.inc' %]
345   </div>
346 </div>
347 [% INCLUDE 'intranet-bottom.inc' %]