Bug 31203: Add End action to cronjobs and log viewer
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / automatic_item_modification_by_age.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Automatic item modifications by age &rsaquo; Tools &rsaquo; Koha</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 </head>
8
9 <body id="tools_automatic_item_modification_by_age" class="tools">
10 [% INCLUDE 'header.inc' %]
11 [% INCLUDE 'cat-search.inc' %]
12
13     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
14         <ol>
15             <li>
16                 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
17             </li>
18             <li>
19                 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
20             </li>
21
22             [% IF ( op == 'edit_form' ) %]
23                 <li>
24                     <a href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">Automatic item modifications by age</a>
25                 </li>
26                 <li>
27                     <a href="#" aria-current="page">
28                         Rules
29                     </a>
30                 </li>
31             [% ELSE %]
32                 <li>
33                     <a href="#" aria-current="page">
34                         Automatic item modifications by age
35                     </a>
36                 </li>
37             [% END %]
38         </ol>
39     </nav>
40
41 <div class="main container-fluid">
42     <div class="row">
43         <div class="col-sm-10 col-sm-push-2">
44             <main>
45
46         [% IF ( op == 'edit_form' ) %]
47           <form method="post" id="rules_form" action="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">
48             <h1>Rules for automatic item modifications by age</h1>
49             <div id="toolbar" class="btn-toolbar">
50                 <div class="btn-group">
51                     <button class="btn btn-default add_rule"><i class="fa fa-plus"></i> Add rule</button>
52                 </div>
53                 <div class="btn-group">
54                     <button type="submit" id="save_rules" class="btn btn-default"><i class="fa fa-save"></i> Save</button>
55                 </div>
56                 <div class="btn-group">
57                     <a class="btn btn-default" href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl"><i class="fa fa-remove"></i> Cancel</a>
58                 </div>
59             </div>
60         [% ELSE %]
61             <h1>Automatic item modifications by age</h1>
62             [% IF ( rules ) %]
63                 <div id="toolbar" class="btn-toolbar">
64                     <a class="btn btn-default" id="newentry" href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl?op=edit_form"><i class="fa fa-pencil"></i> Edit rules</a>
65                 </div>
66             [% ELSE %]
67                 <div id="toolbar" class="btn-toolbar">
68                     <a class="btn btn-default" id="newentry" href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl?op=edit_form"><i class="fa fa-plus"></i> Add rules</a>
69                 </div>
70             [% END %]
71         [% END %]
72
73         [% FOR message IN messages %]
74           [% IF message.type == "error" %]
75             <div class="dialog alert">
76           [% END %]
77           [% IF message.code == "unable_to_load_configuration" %]
78             An error occurs: Unable to load the configuration.
79           [% END %]
80           </div>
81         [% END %]
82
83         [% IF op == 'edit_form' %]
84             <div id="edit_rules">
85                 <div id="rules">
86                 [% FOR rule IN rules %]
87                   [% SET id = loop.count %]
88                   <fieldset class="rule">
89                     <legend>Rule <span class="rulecount">[% loop.count | html %]</span> <a href="#" class="remove_rule"><i class="fa fa-trash"></i> Remove this rule</a></legend>
90                     <input type="hidden" name="unique_id" value="[% loop.count | html %]" /> <!-- FIXME on update, the unique_id should be filled -->
91                     <div class="age">
92                       <h5>Age in days</h5>
93                       <input class="age" type="text" inputmode="numeric" pattern="[0-9]*"  value="[% rule.age | html %]" name="age_[% id | html %]" />
94                       <h5>Age field</h5>
95                           <div class="blocks">
96                               <select name="agefield_[% id | html %]">
97                                   <option value="">Choose an age field</option>
98                                   [% FOR field IN agefields %]
99                                     [% IF rule.agefield == field %]
100                                      <option value="[% field | html %]" selected="selected">[% field | html %]</option>
101                                     [% ELSE %]
102                                      <option value="[% field | html %]">[% field | html %]</option>
103                                     [% END %]
104                                   [% END %]
105                               </select>
106                               <span class="hint">If not set then items.dateaccessioned will be used</span>
107                           </div>
108                     </div>
109                     <div class="blocks">
110                       <h5>Conditions</h5>
111                       [% FOR condition IN rule.conditions %]
112                         <div class="block">
113                           <select name="condition_field_[% id | html %]">
114                             <option value="">Choose a field name</option>
115                             [% FOR field IN condition_fields %]
116                               [% IF condition.field == field %]
117                                 <option value="[% field | html %]" selected="selected">[% field | html %]</option>
118                               [% ELSE %]
119                                 <option value="[% field | html %]">[% field | html %]</option>
120                               [% END %]
121                             [% END %]
122                           </select>
123                           =
124                           <input type="text" value="[% condition.value | html %]" name="condition_value_[% id | html %]" />
125                           <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a condition</a>
126                           <a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove condition</a>
127                         </div>
128                       [% END %]
129                     </div>
130                     <div class="blocks">
131                       <h5>Substitutions</h5>
132                       [% FOR substitution IN rule.substitutions %]
133                         <div class="block">
134                           <select class="required" required="required" name="substitution_field_[% id | html %]">
135                             <option value="">Choose a field name</option>
136                             [% FOR field IN substitution_fields %]
137                               [% IF substitution.field == field %]
138                                 <option value="[% field | html %]" selected="selected">[% field | html %]</option>
139                               [% ELSE %]
140                                 <option value="[% field | html %]">[% field | html %]</option>
141                               [% END %]
142                             [% END %]
143                           </select>
144                           =
145                           <input type="text" value="[% substitution.value | html %]" name="substitution_value_[% id | html %]" />
146                           <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a substitution</a>
147                           <a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove substitution</a>
148                           <span class="required">A field name is required</span>
149                         </div>
150                       [% END %]
151                     </div>
152                   </fieldset>
153                 [% END %]
154                 </div>
155                 <input type="hidden" name="op" value="update" />
156             </div>
157           </form>
158
159         <div id="norules" class="dialog message">
160           There are no rules defined.
161         </div>
162
163           <fieldset id="new_rule">
164             <legend>Rule <span class="rulecount"></span> <a href="#" class="remove_rule"><i class="fa fa-trash"></i> Remove this rule</a></legend>
165             <input type="hidden" name="unique_id" />
166             <div class="age">
167               <h5>Age in days</h5>
168               <input class="age" type="text" inputmode="numeric" pattern="[0-9]*" value="" name="age" />
169               <h5>Age field</h5>
170               <div class="block">
171                   <select name="agefield">
172                       <option value="">Choose an age field</option>
173                       [% FOR field IN agefields %]
174                            <option value="[% field | html %]">[% field | html %]</option>
175                       [% END %]
176                   </select>
177                   <span class="hint">If not set then items.dateaccessioned will be used</span>
178               </div>
179             </div>
180             <div class="blocks">
181               <h5>Conditions</h5>
182               <div class="block">
183                 <select name="condition_field">
184                   <option value="">Choose a field name</option>
185                   [% FOR field IN condition_fields %]
186                     <option value="[% field | html %]">[% field | html %]</option>
187                   [% END %]
188                 </select>
189                 =
190                 <input type="text" value="" name="condition_value" />
191                 <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a condition</a>
192                 <a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove condition</a>
193               </div>
194             </div>
195             <div class="blocks">
196               <h5>Substitutions</h5>
197               <div class="block">
198                 <select required="required" class="required" name="substitution_field">
199                   <option value="">Choose a field name</option>
200                   [% FOR field IN substitution_fields %]
201                     <option value="[% field | html %]">[% field | html %]</option>
202                   [% END %]
203                 </select>
204                 =
205                 <input type="text" value="" name="substitution_value" />
206                 <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a substitution</a>
207                 <a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove substitution</a>
208                 <span class="required">A field name is required</span>
209               </div>
210             </div>
211           </fieldset>
212         [% ELSIF rules %]
213             <div>
214                 <h4>List of rules</h4>
215                     <table id="rulest">
216                         <thead>
217                           <tr>
218                                <th>Age</th>
219                                 <th>Age field</th>
220                                 <th>Conditions</th>
221                                 <th>Substitutions</th>
222                             </tr>
223                         </thead>
224                         <tbody>
225                             [% FOR rule IN rules %]
226                                 <tr>
227                                     <td>
228                                         [% IF rule.age.defined and rule.age.length > 0 %]
229                                             <span>[% rule.age | html %] days</span>
230                                         [% ELSE %]
231                                             <span>There is no age for this rule.</span>
232                                         [% END %]
233                                     </td>
234                                     <td>
235                                         [% IF rule.agefield %]
236                                             [% rule.agefield | html %]
237                                         [% ELSE %]
238                                             <!-- In case old rules do not contain an agefield value display that items.dateaccessioned will be used -->
239                                             items.dateaccessioned
240                                         [% END %]
241                                     </td>
242                                     <td>
243                                         [% FOR condition IN rule.conditions %]
244                                             [% IF condition.field %]
245                                                 <div class="block">
246                                                 [% condition.field | html %] = [% condition.value | html %]
247                                                 </div>
248                                             [% ELSE %]
249                                                 There is no condition for this rule.
250                                             [% END %]
251                                         [% END %]
252                                     </td>
253                                     <td>
254                                         [% FOR substitution IN rule.substitutions %]
255                                             <div class="block">
256                                                 [% substitution.field | html %] = [% substitution.value | html %]
257                                             </div>
258                                         [% END %]
259                                     </td>
260                                 </tr>
261                             [% END %]
262                         </tbody>
263                     </table>
264             </div>
265         [% ELSE %]
266             <div class="dialog message">
267                 There are no rules defined.
268             </div>
269         [% END %]
270
271             </main>
272         </div> <!-- /.col-sm-10.col-sm-push-2 -->
273
274         <div class="col-sm-2 col-sm-pull-10">
275             <aside>
276                 [% INCLUDE 'tools-menu.inc' %]
277             </aside>
278         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
279      </div> <!-- /.row -->
280
281 [% MACRO jsinclude BLOCK %]
282     [% Asset.js("js/tools-menu.js") | $raw %]
283     [% Asset.js("lib/hc-sticky.js") | $raw %]
284     [% Asset.js("js/automatic_item_modification_by_age.js") | $raw %]
285     [% IF op == 'edit_form' %]
286         <script>
287             var Sticky;
288             $(document).ready(function() {
289                   [% IF ( op == 'edit_form' ) %]
290                 Sticky = $("#toolbar");
291                 Sticky.hcSticky({
292                     stickTo: "main",
293                     stickyClass: "floating"
294                 });
295                   [% END %]
296                   [% IF rules.size > 0 %]
297                       $("#norules").hide();
298                   [% ELSE %]
299                       $("#rules").show();
300                   [% END %]
301             });
302         </script>
303     [% END %]
304 [% END %]
305
306 [% INCLUDE 'intranet-bottom.inc' %]