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