RSS Git Download  Clone
Raw Blame History
	[% META title="Record Search" %]
<!-- BEGIN search/default.tt -->

    <script type="text/javascript" src="/js/jquery.dateentry.min.js"></script>
	<script type="text/javascript" src="/js/jquery.mousewheel.js"></script>
	<script type="text/javascript" src="/js/changeField.js"></script>

    <h2 class="header">Search for record(s):</h2>

    <form method="get" action="[% app_url %]/search/do_search" name="search" id="search"
		[% # INCLUDE site/snippets/disable_form_resubmission.tt name = 'searchButton'
			value = 'Searching' %]>

    [% INCLUDE search/main_form.tt %]

    [% IF c.user_can('simple_sql') %]
		[% INCLUDE site/simple_sql.tt %]
    [% END %]

	<p><i>Date constraints:</i>
		[% div_name = 'date_constraints'; INCLUDE site/snippets/toggleview.tt %]
    </p>
	[% class = 
		c.query.param('previous_days') OR c.query.param('specific_year')
		OR c.query.param('date_from') OR c.query.param('date_to')
		? 'itemshow' : 'itemhidden' %]
    <div id="[% div_name %]" class="[% class %]">
		<ul>
			<li>previous 
			  <input type="text" name="previous_days" id="previous_days" size="4" />
			  days
			</li>
			[% USE date(format = '%Y'); # just need year
				this_year  = date.format; # this year
				start_year = start_date.strftime('%Y') || this_year; # for test suite
				IF start_year <= this_year; # don't load unless needed
			%] 
			<li>specific year:                    
				<select name="specific_year" id="specific_year">
				  <option value=""></option>
				  [% years = [ start_year .. this_year ];
					FOREACH yr IN years.sort.reverse %]
					<option value="[% yr %]">[% yr %]</option>
				  [% END %]
				</select>
			</li>
			<li>date range: 
				<input type="text" name="date_from" id="date_from" size="8" /> to
				<input type="text" name="date_to" id="date_to" size="8" />
            </li>
		[% END %]
		</ul>
	</div>

    [% # IF c.user_can('free_sql') # maybe replace with dedicated package %]
		[% # INCLUDE site/free_sql.tt %]
    [% # END %]

    <h4>Search Options:</h4>

    <table class="indent">
        <tr>
            <td class="bold">Hits/page:
                <input type="text" name="entries_per_page" [% site.html.on_focus %]
					size="3" value="[% c.cfg('settings').entries_per_page %]" />
            </td>
            <td class="bold">Sort by:
                <select name="sort_by" [% site.html.on_focus %]>
                    <option value="requests.id">Date</option>
                    <option value="patients.dob">D.o.B</option>
                    <option value="patients.first_name">First Name</option>
                    <option value="patients.last_name">Last Name</option>
                    <option value="patient_case.unit_number">Patient No.</option>
                    <option value="patient.nhs_number">NHS No.</option>
                    <option value="referral_sources.display_name">Source</option>
                </select>
            </td>
            <td class="bold">Sort order:
                <select name="sort_order" [% site.html.on_focus %]>
                    <option value="desc">Descending</option>
                    <option value="">Ascending</option>
                </select>
            </td>
        </tr>
    </table>

    <p class="center">
        <input type="submit" value="Search" class="button" id="searchButton" />
        <input type="reset" name=".reset" class="button" />
    </p>
    </form>

    [% PROCESS site/field_focus.tt form_name = 'search', field_name = 'lab_number' %]
<!-- END search/default.tt -->