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