+ <FONT CLASS="fsinnerbox-title"><% emt('Customer search options') %></FONT>
+ <TABLE CLASS="fsinnerbox">
+
+ <& /elements/tr-select-agent.html,
+ 'curr_value' => scalar( $cgi->param('agentnum') ),
+ 'disable_empty' => 0,
+ 'onchange' => 'agent_changed(this)',
+ &>
+
+ <& /elements/tr-select-cust_main-status.html,
+ 'label' => 'Customer status',
+ 'field' => 'cust_status',
+ &>
+
+ <SCRIPT TYPE="text/javascript">
+
+ function agent_changed(what) {
+% # update sales dropdowns
+ salesnum_agentnum_changed(what);
+ cust_main_salesnum_agentnum_changed(what);
+ }
+
+ <&| /elements/onload.js &>
+ agent_changed(document.getElementById('agentnum'))
+ </&>
+
+ </SCRIPT>
+
+ <& /elements/tr-select-sales.html,
+ 'label' => 'Customer sales person',
+ 'element_name' => 'cust_main_salesnum',
+ 'id' => 'cust_main_salesnum',
+ 'curr_value' => scalar($cgi->param('cust_main_salesnum')),
+ 'pre_options' => [ '' => 'all',
+ 0 => '(none)', ],
+ 'disable_empty' => 1,
+ &>
+
+ </TABLE>
+ <BR>
+
+% }
+
+<FONT CLASS="fsinnerbox-title"><% emt('Package search options') %></FONT>
+<TABLE CLASS="fsinnerbox">
+
+ <& /elements/tr-select-sales.html,
+ 'label' => 'Package sales person',
+ 'curr_value' => scalar($cgi->param('salesnum')),
+ 'pre_options' => [ '' => 'all',
+ 0 => '(none)', ],
+ 'disable_empty' => 1,
+ &>
+
+ <& /elements/tr-select-cust_pkg-status.html,
+ 'label' => 'Package status',
+ 'onchange' => 'status_changed(this);',
+ &>
+
+ <SCRIPT TYPE="text/javascript">
+
+ function status_changed(what) {
+
+% foreach my $status ( '', FS::cust_pkg->statuses() ) {
+
+ if ( what.options[what.selectedIndex].value == '<% $status %>' ) {
+
+% foreach my $field (@date_fields) {
+% if ( $disable{$status}->{$field} ) {
+
+ what.form.<% $field %>_beginning_text.disabled = true;
+ what.form.<% $field %>_ending_text.disabled = true;
+ what.form.<% $field %>_null.disabled = true;
+ what.form.<% $field %>_beginning_text.style.backgroundColor = '#dddddd';
+ what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
+
+ what.form.<% $field %>_beginning_button.style.display = 'none';
+ what.form.<% $field %>_ending_button.style.display = 'none';
+ what.form.<% $field %>_beginning_disabled.style.display = '';
+ what.form.<% $field %>_ending_disabled.style.display = '';
+
+% } else {
+
+ what.form.<% $field %>_null.disabled = false;
+
+ if ( ! what.form.<% $field %>_null.checked ) {
+
+ what.form.<% $field %>_beginning_text.disabled = false;
+ what.form.<% $field %>_ending_text.disabled = false;
+ what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
+ what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
+
+ what.form.<% $field %>_beginning_button.style.display = '';
+ what.form.<% $field %>_ending_button.style.display = '';
+ what.form.<% $field %>_beginning_disabled.style.display = 'none';
+ what.form.<% $field %>_ending_disabled.style.display = 'none';
+
+ }
+
+% }
+% }
+
+ }
+
+% }
+
+ }
+
+% foreach my $field (@date_fields) {
+
+ function <% $field %>_null_changed(what) {
+
+ if ( what.checked ) {
+ what.form.<% $field %>_beginning_text.disabled = true;
+ what.form.<% $field %>_ending_text.disabled = true;
+ what.form.<% $field %>_beginning_text.style.backgroundColor = '#dddddd';
+ what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
+ what.form.<% $field %>_beginning_button.style.display = 'none';
+ what.form.<% $field %>_ending_button.style.display = 'none';
+ what.form.<% $field %>_beginning_disabled.style.display = '';
+ what.form.<% $field %>_ending_disabled.style.display = '';
+
+ } else {
+ what.form.<% $field %>_beginning_text.disabled = false;
+ what.form.<% $field %>_ending_text.disabled = false;
+ what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
+ what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
+
+ what.form.<% $field %>_beginning_button.style.display = '';
+ what.form.<% $field %>_ending_button.style.display = '';
+ what.form.<% $field %>_beginning_disabled.style.display = 'none';
+ what.form.<% $field %>_ending_disabled.style.display = 'none';
+
+ }
+
+ }
+
+% }
+
+ </SCRIPT>
+
+ <& /elements/tr-select-pkg_class.html,