1<ul class="nav nav-pills m-2">
2  <li class="nav-item">
3    <a class="nav-link active" href="{{ url('/table/search', {'db': db, 'table': table, 'pos': 0}) }}">
4      {{ get_icon('b_search', 'Table search'|trans, false, false, 'TabsMode') }}
5    </a>
6  </li>
7
8  <li class="nav-item">
9    <a class="nav-link" href="{{ url('/table/zoom-search', {'db': db, 'table': table}) }}">
10      {{ get_icon('b_select', 'Zoom search'|trans, false, false, 'TabsMode') }}
11    </a>
12  </li>
13
14  <li class="nav-item">
15    <a class="nav-link" href="{{ url('/table/find-replace', {'db': db, 'table': table}) }}">
16      {{ get_icon('b_find_replace', 'Find and replace'|trans, false, false, 'TabsMode') }}
17    </a>
18  </li>
19</ul>
20
21<form method="post" action="{{ url('/table/search') }}" name="insertForm" id="tbl_search_form" class="ajax lock-page">
22  {{ get_hidden_inputs(db, table) }}
23  <input type="hidden" name="goto" value="{{ goto }}">
24  <input type="hidden" name="back" value="{{ url('/table/search') }}">
25
26  <fieldset id="fieldset_table_search">
27    <fieldset id="fieldset_table_qbe">
28      <legend>
29        {% trans 'Do a "query by example" (wildcard: "%")' %}
30      </legend>
31      <div class="table-responsive-md jsresponsive">
32        <table class="table table-light table-striped table-hover table-sm w-auto">
33          <thead class="thead-light">
34            <tr>
35              {% if geom_column_flag %}
36                <th>{% trans 'Function' %}</th>
37              {% endif %}
38              <th>{% trans 'Column' %}</th>
39              <th>{% trans 'Type' %}</th>
40              <th>{% trans 'Collation' %}</th>
41              <th>{% trans 'Operator' %}</th>
42              <th>{% trans 'Value' %}</th>
43            </tr>
44          </thead>
45          <tbody>
46            {% for column_index in 0..column_names|length - 1 %}
47              <tr class="noclick">
48                {# If 'Function' column is present trying to change comment #}
49                {% if geom_column_flag %}
50                  {# Displays 'Function' column if it is present #}
51                  <td>
52                    {% set geom_types = get_gis_datatypes() %}
53                    {% if column_types[column_index] in geom_types %}
54                      <select class="geom_func" name="geom_func[{{ column_index }}]">
55                        {# get the relevant list of GIS functions #}
56                        {% set funcs = get_gis_functions(column_types[column_index], true, true) %}
57                        {% for func_name, func in funcs %}
58                          {% set name = func['display'] is defined ? func['display'] : func_name %}
59                          <option value="{{ name }}">
60                            {{ name }}
61                          </option>
62                        {% endfor %}
63                      </select>
64                    {% endif %}
65                  </td>
66                {% endif %}
67                {# Displays column's name, type, collation and value #}
68                <th>
69                  {#- Keep this without extra spaces because it is used for a request to build the BETWEEN modal -#}
70                  {{- column_names[column_index] -}}
71                </th>
72                {% set properties = self.getColumnProperties(column_index, column_index) %}
73                <td dir="ltr">
74                  {{ properties['type'] }}
75                </td>
76                <td>
77                  {{ properties['collation'] }}
78                </td>
79                <td>
80                  {{ properties['func']|raw }}
81                </td>
82                {# here, the data-type attribute is needed for a date/time picker #}
83                <td data-type="{{ properties['type'] }}">
84                  {{ properties['value']|raw }}
85                  {# Displays hidden fields #}
86                  <input type="hidden" name="criteriaColumnNames[{{ column_index }}]" value="{{ column_names[column_index] }}">
87                  <input type="hidden" name="criteriaColumnTypes[{{ column_index }}]" value="{{ column_types[column_index] }}">
88                  <input type="hidden" name="criteriaColumnCollations[{{ column_index }}]" value="{{ column_collations[column_index] }}">
89                </td>
90              </tr>
91            {% endfor %}
92          </tbody>
93        </table>
94      </div>
95      <div id="gis_editor"></div>
96      <div id="popup_background"></div>
97    </fieldset>
98
99    <div id="searchoptions"{% if default_sliders_state != 'disabled' -%}
100      {{- default_sliders_state == 'closed' ? ' style="display: none; overflow:auto;"' }} class="pma_auto_slider" title="{% trans 'Options' %}"
101    {%- endif %}>
102
103    {# Displays columns select list for selecting distinct columns in the search #}
104    <fieldset id="fieldset_select_fields">
105      <legend>
106        {% trans 'Select columns (at least one):' %}
107      </legend>
108      <select class="resize-vertical" name="columnsToDisplay[]" size="{{ min(column_names|length, 10) }}" multiple>
109        {% for each_field in column_names %}
110          <option value="{{ each_field }}" selected>
111            {{ each_field }}
112          </option>
113        {% endfor %}
114      </select>
115      <input type="checkbox" name="distinct" value="DISTINCT" id="oDistinct">
116      <label for="oDistinct">DISTINCT</label>
117    </fieldset>
118
119    {# Displays input box for custom 'Where' clause to be used in the search #}
120    <fieldset id="fieldset_search_conditions">
121      <legend>
122        <em>{% trans 'Or' %}</em>
123        {% trans 'Add search conditions (body of the "where" clause):' %}
124      </legend>
125      {{ show_mysql_docu('Functions') }}
126      <input type="text" name="customWhereClause" class="textfield" size="64">
127    </fieldset>
128
129    {# Displays option of changing default number of rows displayed per page #}
130    <fieldset id="fieldset_limit_rows">
131      <legend>{% trans 'Number of rows per page' %}</legend>
132      <input type="number" name="session_max_rows" min="1" value="{{ max_rows }}" class="textfield" required>
133    </fieldset>
134
135    {# Displays option for ordering search results by a column value (Asc or Desc) #}
136    <fieldset id="fieldset_display_order">
137      <legend>{% trans 'Display order:' %}</legend>
138      <select name="orderByColumn"><option value="--nil--"></option>
139        {% for each_field in column_names %}
140          <option value="{{ each_field }}">
141            {{ each_field }}
142          </option>
143        {% endfor %}
144      </select>
145
146      <div class="formelement">
147        <input type="radio" name="order" id="orderByAscRadio" value="ASC" checked>
148        <label for="orderByAscRadio">{% trans 'Ascending' %}</label>
149      </div>
150      <div class="formelement">
151        <input type="radio" name="order" id="orderByDescRadio" value="DESC">
152        <label for="orderByDescRadio">{% trans 'Descending' %}</label>
153      </div>
154
155    </fieldset>
156    <div class="clearfloat"></div>
157    </div>
158  </fieldset>
159
160  <fieldset class="tblFooters">
161    <input class="btn btn-primary" type="submit" name="submit" value="{% trans 'Go' %}">
162  </fieldset>
163</form>
164<div id="sqlqueryresultsouter"></div>
165