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