4f4ff73aedad9de8b8af95c3249e2afc1ba2cb7e
[Evergreen.git] / Open-ILS / src / templates-bootstrap / opac / parts / advanced / search.tt2
1 [%
2     PROCESS "opac/parts/misc_util.tt2";
3     PROCESS get_library;
4 %]
5 <form action="[% ctx.opac_root %]/results" method="get">
6 <div id='adv_global_search' class='data_grid data_grid_center'>
7     <div id='adv_search_rows' class="container">
8         <h1 class="text-center">Advanced Search</h1>
9         <h2 class="text-center">Refine your search by filling out one or more fields to search by below.</h2>
10         <div class='adv_global_input_container row'>
11             <table role="presentation" id="adv_global_input_table" class="mx-auto col-12">
12                 <tbody id="adv_global_tbody">
13                     [% INCLUDE "opac/parts/advanced/global_row.tt2" %]
14                     <!-- add a new row -->
15                     <tr id='adv_global_addrow' >
16                         <td class="td-search-left" colspan="2">
17                             <a class="btn btn-opac btn-sm" href="javascript:;" id="myopac_new_global_row" onclick='addSearchRow();'><i class="fas fa-plus-circle" aria-hidden="true"></i> [% l('Add Search Row') %]</a>
18                         </td>
19                     </tr>
20                 </tbody>
21             </table>
22         </div>
23     </div>
24 <div id='adv_search_submit' class="my-3">
25         <input type="hidden" name="_adv" value="1" />
26         <input id="detail" type="hidden" name="detail_record_view"
27                value="[% show_detail_view %]"/>
28         <span>
29             <button id='search-submit-go' type="submit" class="btn btn-confirm"
30                 onclick='setTimeout(function(){$("search-submit-spinner").className=""; $("search-submit-go").className="hidden"}, 2000)'><i class="fas fa-search"></i> [% l("Submit") %]</button>
31             <img id='search-submit-spinner' src='/opac/images/progressbar_green.gif[% ctx.cache_key %]'
32                 class='hidden' alt="[% l('Search in progress icon') %]"/>
33         </span>
34
35         <a href="[% mkurl(ctx.opac_root _ '/advanced', {$loc_name => loc_value}, 1) %]"
36             class="btn btn-deny"><i class="fas fa-ban"></i> [% l('Clear Form') %]</a>
37     </div>
38     <div class="my-5">
39         <h3>Search Filters</h3>
40         <div>
41             [% FOR adv_chunk IN search.adv_config; NEXT IF adv_chunk.adv_hide || (adv_chunk.adv_special && adv_chunk.adv_special != 'copy_location'); %]
42             <div class="pt-3">
43                 <div [% IF adv_chunk.js_only %] id='adv_chunk_[% adv_chunk.adv_special %]' class='hidden  accordion' [%ELSE%] class='accordion' [% END %]>
44                     <div class="card">
45                         <div class="card-header p-0" id="[% adv_chunk.id %]_card">
46                         <h4 class="mb-0">
47                             <button type="button" class="btn filter-header w-100 text-left" data-toggle="collapse" data-target="#[% IF adv_chunk.id == 'adv_copy_location_selector'; 'adv_copy_location_selector_new';  ELSE; adv_chunk.id; END; %]" aria-expanded="true" aria-controls="#[% IF adv_chunk.id == 'adv_copy_location_selector'; 'adv_copy_location_selector_new';  ELSE; adv_chunk.id; END; %]">
48                             [% adv_chunk.adv_label %]
49                             </button>
50                         </h4>
51                     </div>
52
53                     <div id="[% IF adv_chunk.id == 'adv_copy_location_selector'; 'adv_copy_location_selector_new';  ELSE; adv_chunk.id; END; %]" class="collapse" aria-labelledby="[% adv_chunk.id %]_card" data-parent="#[% IF adv_chunk.id == 'adv_copy_location_selector'; 'adv_copy_location_selector_new';  ELSE; adv_chunk.id; END; %]">
54                     [% IF adv_chunk.id != 'adv_copy_location_selector';%]
55                         <div class="card-body">
56                         <fieldset>
57                         <legend class="sr-only"> [% adv_chunk.adv_label %]</legend>
58                        [% END %]
59                             [% IF adv_chunk.adv_attr;
60                                         INCLUDE "opac/parts/check_value_selector.tt2"
61                                             id=adv_chunk.id
62                                             attr=adv_chunk.adv_attr multiple="multiple"
63                                             size=adv_chunk.adv_size || search.default_adv_select_height || "4";
64                             ELSIF adv_chunk.adv_filter;
65                                         INCLUDE "opac/parts/filter_group_selector.tt2"
66                                             id=adv_chunk.id
67                                             filter_group=adv_chunk.adv_filter multiple="multiple"
68                                             size=adv_chunk.adv_size || search.default_adv_select_height || "4";
69                             END; %]
70                             [% IF adv_chunk.id != 'adv_copy_location_selector';%]
71                         </fieldset>
72                          [% END %]
73                         </div>
74                     </div>
75                 </div></div>
76             </div>
77             [%END;%]
78         </div>
79     </div>
80
81     <!--Bottom Content (Library/Pub Year/Sort and Limit/Format Checkboxes -->
82     <div class="row adv_options">
83         [% FOR adv_chunk IN search.adv_config; NEXT IF adv_chunk.adv_hide || adv_chunk.adv_special == 'copy_location';%]
84         [%      IF adv_chunk.adv_special;%]
85         <div class='col-12 my-2'>
86             <div [% IF adv_chunk.js_only %] id='adv_chunk_[% adv_chunk.adv_special %]' class='hidden' [% END %]>
87                 <strong><label for="[% adv_chunk.id %]"> [% adv_chunk.adv_label %] </label></strong>
88                     [% IF adv_chunk.adv_special == "lib_selector"; PROCESS "opac/parts/org_selector.tt2"; INCLUDE build_org_selector show_loc_groups=1 id=adv_chunk.id %]
89                     [% ELSIF adv_chunk.adv_special == "pub_year"; %]
90                     <div id='adv_special_block' class="text-center form-inline">
91                             <select name='pubdate' class='form-control' id="[% adv_chunk.id %]" onchange='if(this.selectedIndex == 3) $("#adv_global_pub_date_2_span").removeClass("hide_me"); else $("#adv_global_pub_date_2_span").addClass("hide_me");'>
92                             [%  FOR opt IN [
93                                     {"code" => "is", "label" => l("Is")},
94                                     {"code" => "before", "label" => l("Before")},
95                                     {"code" => "after", "label" => l("After")},
96                                     {"code" => "between", "label" => l("Between")} ] %]
97                                 <option value="[% opt.code %]"[% CGI.param('pubdate') == opt.code ? ' selected="selected"' : '' %]>[% opt.label | html %]</option>
98                             [%  END %]
99                             </select>
100
101                             <br/>
102                             <div id='adv_special_block' class="text-center">
103                                 <input title="[% l('Search date') %]" class='form-control' placeholder='Year'
104                                   name='date1' type='text' size='4' maxlength='4' value="[% CGI.param('date1') | html %]" />
105                                 <span id='adv_global_pub_date_2_span' class='[% CGI.param("pubdate") == "between" ? "" : "hide_me" %]'>
106                                    [% l("AND") %] <input name='date2' class='form-control' placeholder='Year'
107                                     title="[% l('Secondary search date') %]" type='text' size='4' maxlength='4' value="[% CGI.param('date2') | html %]" />
108                                 </span>
109                                 </div>
110                             </div>
111
112                           
113                             
114                     [% ELSIF adv_chunk.adv_special == "sort_selector"; default_sort=ctx.default_sort;
115                     IF CGI.param('sort'); default_sort=CGI.param('sort'); END;
116                     INCLUDE "opac/parts/filtersort.tt2"
117                         id=adv_chunk.id
118                         value=default_sort class='results_header_sel form-control'; %]
119                          
120                             <div class="pt-5">
121                             [% IF ctx.exclude_electronic_checkbox %]
122                             <div class="adv_search_available">
123                                 <input type='checkbox' name="fi:-search_format" value="electronic"
124                                 [%- CGI.param('fi:-search_format').grep('electronic').size ?
125                                     ' checked="checked"' : '' %]
126                                 id='opac.result.excludeelec' />
127                                 <label for='opac.result.excludeelec'>
128                                     [% l("Exclude Electronic Resources") %]
129                                 </label>
130                             </div>
131                             [% END %]
132                                 [% IF NOT metarecords.disabled %]
133                                 <div>
134                                     <input type='checkbox' name="modifier" value="metabib"
135                                     [%- CGI.param('modifier').grep('metabib').size || search.metarecord_default ?
136                                             ' checked="checked"' : '' %]
137                                         id='opac.result.ismetabib' />
138                                     <label for='opac.result.ismetabib'>
139                                         [% l("Group Formats and Editions") %]</label>
140                                 </div>
141                                 [% END %]
142                                 <div>
143                                     <input type='checkbox' name="modifier"
144                                         value="available"[% CGI.param('modifier').grep('available').size ? ' checked="checked"' : '' %]
145                                         id='opac.result.limit2avail' />
146                                     <label for='opac.result.limit2avail'>
147                                         [% l("Limit to Available") %]</label>
148                                 </div>
149                             </div>
150                     [% END %]
151                 </div>
152             </div>
153         [% END %]
154     [% END %]
155     </div>
156     <div id='adv_search_submit' class="my-3">
157         <input type="hidden" name="_adv" value="1" />
158         <input id="detail" type="hidden" name="detail_record_view"
159                value="[% show_detail_view %]"/>
160         <span>
161             <button id='search-submit-go' type="submit" class="btn btn-confirm"
162                 onclick='setTimeout(function(){$("search-submit-spinner").className=""; $("search-submit-go").className="hidden"}, 2000)'><i class="fas fa-search"></i> [% l("Submit") %]</button>
163             <img id='search-submit-spinner' src='/opac/images/progressbar_green.gif[% ctx.cache_key %]'
164                 class='hidden' alt="[% l('Search in progress icon') %]"/>
165         </span>
166
167         <a href="[% mkurl(ctx.opac_root _ '/advanced', {$loc_name => loc_value}, 1) %]"
168             class="btn btn-deny"><i class="fas fa-ban"></i> [% l('Clear Form') %]</a>
169     </div>
170 </form>