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