Bug 28949: Use Flatpickr on reports pages
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reports / dictionary.tt
1 [% SET footerjs = 1 %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Dictionary &rsaquo; Guided reports &rsaquo; Reports &rsaquo; Koha</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 <style>fieldset.rows table { clear: none; margin: 0;}</style>
6 </head>
7
8 <body id="rep_dictionary" class="rep">
9 [% INCLUDE 'header.inc' %]
10 [% INCLUDE 'circ-search.inc' %]
11
12 [%- BLOCK area_name -%]
13     [%- SWITCH area -%]
14         [%- CASE 'CIRC' -%]Circulation
15         [%- CASE 'CAT'  -%]Catalog
16         [%- CASE 'PAT'  -%]Patrons
17         [%- CASE 'ACQ'  -%]Acquisitions
18         [%- CASE 'ACC'  -%]Accounts
19         [%- CASE 'SER'  -%]Serials
20     [%- END -%]
21 [%- END -%]
22
23 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
24     <ol>
25         <li>
26             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
27         </li>
28         <li>
29             <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
30         </li>
31         <li>
32             <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
33         </li>
34
35         [% IF ( new_dictionary ) %]
36             <li>
37                 <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a>
38             </li>
39             <li>
40                 <a href="#" aria-current="page">
41                     Name the new definition
42                 </a>
43             </li>
44
45         [% ELSIF ( step_2 ) %]
46             <li>
47                 <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a>
48             </li>
49             <li>
50                 <a href="#" aria-current="page">
51                     Step 2: Choose the area
52                 </a>
53             </li>
54
55         [% ELSIF ( step_3 ) %]
56             <li>
57                 <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a>
58             </li>
59             <li>
60                 <a href="#" aria-current="page">
61                     Step 3: Choose a column
62                 </a>
63             </li>
64
65         [% ELSIF ( step_4 ) %]
66             <li>
67                 <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a>
68             </li>
69             <li>
70                 <a href="#" aria-current="page">
71                     Step 4: Specify a value
72                 </a>
73             </li>
74
75         [% ELSIF ( step_5 ) %]
76             <li>
77                 <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a>
78             </li>
79             <li>
80                 <a href="#" aria-current="page">
81                     Step 5: Confirm definition
82                 </a>
83             </li>
84
85         [% ELSE %]
86             <li>
87                 <a href="#" aria-current="page">
88                     Dictionary
89                 </a>
90             </li>
91         [% END %]
92     </ol>
93 </nav>
94
95 <div class="main container-fluid">
96     <div class="row">
97         <div class="col-sm-10 col-sm-push-2">
98             <main>
99
100 [% IF ( start_dictionary ) %]
101     <div id="toolbar">
102         <a id="newdictionary" class="btn btn-default" href="/cgi-bin/koha/reports/dictionary.pl?phase=Add%20New%20Definition"><i class="fa fa-plus"></i> New definition</a>
103     </div>
104 [% END %]
105 <h1>Dictionary</h1>
106 [% IF ( start_dictionary ) %]
107         <p>Use the dictionary to define custom criteria for reporting.</p>
108
109                 [% IF ( definitions ) %]
110         <h2>Current terms</h2>
111                 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
112         <input type="hidden" name="phase" value="View Dictionary" />
113   [% IF ( areas ) %]
114         Filter by area
115         <select name="area">
116           <option value="">All</option>
117         [% FOREACH area IN areas %]
118           [%- IF ( area.selected ) -%]
119           <option value="[% area.id | html %]" selected="selected">[%- PROCESS area_name area=area.id -%]</option>
120           [%- ELSE -%]
121           <option value="[% area.id | html %]">[%- PROCESS area_name area=area.id -%]</option>
122           [%- END -%]
123         [% END %]
124         </select>
125       <input name="submit" value="Go" type="submit" />
126   [% END %]
127       </form>
128       <br />
129         <table>
130             <tr>
131                 <th>Name</th>
132                 <th>Description</th>
133                 <th>Area</th>
134                 <th>Definition</th>
135                 <th>Action</th>
136             </tr>
137             [% FOREACH definition IN definitions %]
138             <tr>
139                 <td>[% definition.name | html %]</td>
140                 <td>[% definition.description | html %]</td>
141                 <td>[% definition.areaname | html %]</td>
142                 <td>[% definition.saved_sql | html %]</td>
143                 <td class="actions"><form method="post" action="/cgi-bin/koha/reports/dictionary.pl">
144                     <input type="hidden" name="id" value="[% definition.id | html %]" />
145                     <input type="hidden" name="phase" value="Delete Definition" />
146                     <button type="submit" name="submit" class="btn btn-default btn-xs" id="delete"><i class="fa fa-trash"></i> Delete</button>
147                 </form></td>
148             </tr>
149             [% END %]
150         </table>
151                 [% ELSE %]
152                 <div class="dialog message">There are no saved definitions. <a id="newdictionary" href="/cgi-bin/koha/reports/dictionary.pl?phase=Add%20New%20Definition">Add a definition to the dictionary.</a></div>
153                 [% END %]
154 [% END %]
155
156 [% IF ( new_dictionary ) %]
157 <h3>Add new definition</h3>
158 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
159 <fieldset class="rows"><legend>Step 1 of 5: Name the new definition</legend><ol>
160 <li>
161 <label for="definition_name">Definition name:</label>
162 <input type="text" id="definition_name" name="definition_name" />
163 </li>
164 <li>
165 <label for="definition_description">Definition description:</label>
166 <textarea name="definition_description" id="definition_description" rows="3" cols="20"></textarea>
167 </li>
168 </ol></fieldset>
169
170 <fieldset class="action"><input type="hidden" name="phase" value="New Term step 2" />
171 <input name="submit" value="Next" type="submit" /></fieldset>
172 </form>
173 [% END %]
174
175 [%- IF ( step_2 ) -%]
176 <h3>Add new definition</h3>
177 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
178   <fieldset class="rows">
179     <legend>Step 2 of 5: Choose the area</legend>
180     <ol>
181       <li>
182         <input type="hidden" name="phase" value="New Term step 3" />
183         <input type="hidden" name="definition_name" value="[% definition_name | html %]" />
184         <input type="hidden" name="definition_description" value="[% definition_description | html %]" />
185         <label for="area">Select table:</label><select name="area" id="area">
186       [%- FOREACH area IN areas -%]
187         <option value="[%- area.id | html -%]">[%- PROCESS area_name area=area.id -%]</option>
188       [%- END -%]
189         </select>
190       </li>
191     </ol>
192   </fieldset>
193   <fieldset class="action"><input name="submit" value="Next" type="submit" /></fieldset>
194 </form>
195 [%- END -%]
196
197 [% IF ( step_3 ) %]
198 <h3>Add new definition</h3>
199 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">      
200 <fieldset class="rows">
201 <legend>Step 3 of 5: Choose a column</legend>
202 <input type="hidden" name="area" value="[% area | html %]" />
203 <input type="hidden" name="definition_name" value="[% definition_name | html %]" />
204 <input type="hidden" name="definition_description" value="[% definition_description | html %]" />
205
206 <select id="availableColumns" name="columns" size="25" style="width:200px;height:300px;margin:1em;">
207 [% FOREACH column IN columns %]
208 [% IF ( column.table ) %]
209 [% IF ( loop.first ) %]                              
210 [% ELSE %]               
211 </optgroup>        
212 [% END %]                                                         
213
214 <optgroup label="[% column.table | html %]">              
215 [% ELSE %]               
216 <option value="[% column.name | html %]">
217 [% IF ( column.description ) %][% column.description | html %]    
218 [% ELSE %]               
219 [% column.name | html %]                          
220 [% END %]              
221 </option>      
222 [% END %]              
223 [% END %]                
224 </optgroup>
225 </select>
226
227 <input type="hidden" name="phase" value="New Term step 4" />
228 </fieldset>
229 <fieldset class="action"><input type="submit" name="submit" value="Next" /></fieldset>
230 </form>
231 [% END %]
232
233 [% IF ( step_4 ) %]
234 <h3>Add new definition</h3>
235 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
236 <fieldset class="rows">
237 <legend>Step 4 of 5: Specify a value</legend>
238 <input type="hidden" name="area" value="[% area | html %]" />
239 <input type="hidden" name="definition_name" value="[% definition_name | html %]" />
240 <input type="hidden" name="definition_description" value="[% definition_description | html %]" />
241 <input type="hidden" name="columnstring" value="[% columnstring | html %]" />
242
243 [% FOREACH column IN columns %]
244 <input type="hidden" name="criteria_column" value="[% column.name | html %]" />
245 <ol><li><span class="label">Column: </span> [% column.name | html %]</li>
246 [% IF ( column.distinct ) %]
247     <li><label for="[% column.name | html %]_value">Choose: </label> <select id="[% column.name | html %]_value" name="[% column.name | html %]_value">
248         [% FOREACH value IN column.values %]
249             <option value="[% value.availablevalues | html %]">[% value.availablevalues | html %]</option>
250         [% END %]
251     </select></li>
252 [% END %]
253 [% IF ( column.date ) %]
254     <li class="radio">
255         <label for="all_dates">All dates</label>
256         <input type="radio" id="all_dates" name="[% column.name | html %]_date_type_value" value="all" checked="checked" />
257         <label for="date_range">Date range</label>
258         <input type="radio" id="date_range" name="[% column.name | html %]_date_type_value" value="range" />
259     </li>
260     <li class="radio">
261         Start of date range
262         <input type="text" size="10" id="from" name="[% column.name | html %]_start_value" value="" class="flatpickrfrom" />
263         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
264         End of date range
265         <input type="text" size="10" id="to" name="[% column.name | html %]_end_value" value="" class="flatpickrto" />
266         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
267     </li>
268 [% END %]
269 [% IF ( column.text ) %]
270         <li><label for="[% column.name | html %]_value">Search string matches: </label> <input type="text" size="13" name="[% column.name | html %]_value" /></li>
271 [% END %]
272
273 [% END %]
274 </ol>
275 <input type="hidden" name="phase" value="New Term step 5" />
276 </fieldset>
277 <fieldset class="action">
278 <input type="submit" name="submit" value="Next" />
279 </fieldset>
280 </form>
281 [% END %]
282
283 [% IF ( step_5 ) %]
284 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
285 <input type="hidden" name="area" value="[% area | html %]" />
286 <input type="hidden" name="definition_name" value="[% definition_name | html %]" />
287 <input type="hidden" name="definition_description" value="[% definition_description | html %]" />
288 <input type="hidden" name="columnstring" value="[% columnstring | html %]" />
289
290 <h3>Add new definition</h3>
291
292 <fieldset class="rows">
293   <legend>Step 5 of 5: Confirm details</legend>
294   <ol>
295     <li>
296       <span class="label">Name:</span>[%- definition_name | html -%]
297     </li>
298     <li>
299       <span class="label">Description:</span>[%- definition_description | html -%]
300     </li>
301     <li>
302       <span class="label">Area:</span>[%- PROCESS area_name area=area -%]
303     </li>
304     <li>
305       <span class="label">Data:</span>
306       <table>
307         <tr>
308           <th>Columns</th>
309           <th>Values</th>
310         </tr>
311       [%- FOREACH criteria_loo IN criteria_loop -%]
312         <tr>
313           <td>[%- criteria_loo.name | html -%]</td>
314           <td>[%- criteria_loo.value | html -%]</td>
315         </tr>
316       [%- END -%]
317       </table>
318     </li>
319   </ol>
320 </fieldset>
321
322 <fieldset class="action"><input type="hidden" name="sql" value="[% query | html %]" />
323 <input type="hidden" name="phase" value="New Term step 6" />
324 <input type="submit" name="submit" value="Save" />         </fieldset>
325
326 </form>
327 [% END %]
328
329             </main>
330         </div> <!-- /.col-sm-10.col-sm-push-2 -->
331
332         <div class="col-sm-2 col-sm-pull-10">
333             <aside>
334                 [% INCLUDE 'guided-reports-view.inc' %]
335             </aside>
336         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
337      </div> <!-- /.row -->
338
339 [% MACRO jsinclude BLOCK %]
340     [% INCLUDE 'calendar.inc' %]
341     <script>
342         var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this dictionary definition? This cannot be undone.");
343
344         $(document).ready(function() {
345             $("#delete").on("click",function(){
346                 return confirmDelete(MSG_CONFIRM_DELETE);
347             });
348
349             $("#date_range").change(function(){
350                 $("input#from").parents('li').show();
351             });
352             $("#all_dates").change(function(){
353                 $("input#from").parents('li').hide();
354             });
355             $("#all_dates").click().change();
356         });
357     </script>
358 [% END %]
359
360 [% INCLUDE 'intranet-bottom.inc' %]