summaryrefslogtreecommitdiff
path: root/httemplate/elements/tr-select-agent-sales.html
blob: e1920bea4558db1a9d2ac4d2b136c9e0e696170d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<%doc>

Example:

  <& /elements/tr-select-agent-sales.html,
       'agent_empty_label'   => '(any)', #defaults to "all"
       'sales_disable_empty' => 1,       #defaults with empty enabled
  &>

</%doc>
% if ( $curuser->report_salesnum ) {

    <INPUT TYPE="hidden" NAME="agentnum" VALUE="<% $curuser->report_sales->agentnum %>">
    <INPUT TYPE="hidden" NAME="salesnum" VALUE="<% $curuser->report_salesnum %>">

% } else {

    <& /elements/tr-select-agent.html,
         'onchange'      => 'agent_changed(this)',
         'empty_label'   => $opt{agent_empty_label},
    &>

    <SCRIPT TYPE="text/javascript">

      function agent_changed(what) {
        salesnum_agentnum_changed(what);
      }

      <&| /elements/onload.js &>
      agent_changed(document.getElementById('agentnum'))
      </&>

    </SCRIPT>

    <& /elements/tr-select-sales.html,
        'empty_label'   => 'all',
        'disable_empty' => $opt{sales_disable_empty},
    &>

% }
<%init>

my %opt = @_;

my $curuser = $FS::CurrentUser::CurrentUser;

</%init>