[% META title="Initial Screen" %]
<!-- BEGIN [% template.name %] -->
[% # PROCESS dumper.tt dump = screen_categories %]
[% IF dfv_errors %]
<p class="error">[% c.config('msg').dfv_errors %]</p>
[% END %]
<script language="javascript" type="text/javascript">
<!--
function showhide_screens(f,v) {
var t = f.screen_id;
var tx_type_ids = [ [% opts.tx_type_ids.join(',') %] ];
// does value of 'v' match any of tx_type_ids array:
match = jQuery.grep(tx_type_ids, function (a) { return a == v; }); // alert(match);
/* alternative:
var match = 0;
for (i=0; i<tx_type_ids.length; i++) {
if (tx_type_ids[i] == v) {
match = 1;
break;
}
}
if (match) { .. }
*/
if (match.length) { // ie contains the value of tx_type_id
t.style.visibility='visible';
}
else {
t.style.visibility='hidden';
}
}
// use addLoadEvent function in common.js for onload:
[% visibility = opts.tx_details.size ? 'visible' : 'hidden' %]
addLoadEvent(
function() {
document.initialScreen.screen_id.style.visibility='[% visibility %]';
}
);
// screen_category onChange event for screen_id select menu
$(document).ready(function () {
$('#screen_category').change( function() {
$('#screen_name').load('[% app_url %]/screen/screen_terms', {
category_id: $('#screen_category').val()
})
})
});
-->
</script>
<h2>Screen record:</h2>
<div class="indent">
[% PROCESS request/summary_display.tt # expects 'data' object %]
</div>
[% initial_screen_dfv_js %]
[% INCLUDE site/previous_cases.tt # 'PROCESS' clobbers 'data' %]
<span class="spacer"> </span>
<form method="post" action="[% app_url %]/screen/do_initial_screen/[% data.id %]"
[% initial_screen_onsubmit %] name="initialScreen" id="initialScreen">
<table class="indent">
<tr>
<td class="label">Screen category:</td>
<td class="content">
<select name="screen_category" id="screen_category"
onchange="showhide_screens(this.form,this.value)">
<option value=""> </option>
[% FOREACH entry IN screen_categories;
NEXT UNLESS entry.is_active.match('yes') %]
<option value="[% entry.id %]">
[% entry.name %]
</option>
[% END %]
</select>
[% error_screen_category %]
<!-- // replaced by ajax output after selection of screen_category: -->
<select name="screen_id" id="screen_name">
[% IF opts.tx_details.size %]
<option value=""></option>
[% FOREACH opt IN opts.tx_details %]
<option value="[% opt.key %]">[% opt.value %]</option>
[% END; END %]
</select>
</td>
</tr>
<tr>
<td class="label">Reason for request:</td>
<td class="content">
<select name="option_id">
<option value=""> </option>
[% FOREACH group IN audit_categories %]
<optgroup label="[% group.description | upper %]">
[% FOREACH item IN request_audit %]
[% NEXT UNLESS
item.category.description.match(group.description) %]
<option value="[% item.id %]">
[% item.description %]
</option>
[% END %]
</optgroup>
[% END %]
</select>
[% error_option_id %]
</td>
</tr>
<tr>
<td colspan="2" align="center" class="borderless">
[% site.html.submit %] [% site.html.reset %]
</td>
</tr>
</table>
</form>
<!-- END [% template.name %] -->