RT# 75817 - updated UI to be more intuitive
[freeside.git] / httemplate / misc / qual.html
1 <% include('/elements/header-popup.html', 'Service Qualification' ) %>
2
3 <% include('/elements/error.html') %>
4
5 <FORM NAME     = "QualForm"
6       ACTION   = "<% $p %>edit/process/qual.cgi"
7       METHOD   = "POST"
8       onSubmit = "document.QualForm.submitButton.disabled=true;"
9 >
10
11 <INPUT TYPE="hidden" NAME="<%$cust_or_prospect%>num" VALUE="<% $custnum_or_prospectnum %>">
12
13 <% ntable("#cccccc", 2) %>
14
15 <% include('/elements/tr-td-label.html',
16              'cgi'        => $cgi,
17              'label'      => 'Qualify using',
18              #'cell_style' => 'font-weight: bold',
19              'id'         => 'exportnum',
20           )
21 %>
22 <TD>
23 <% include('/elements/select.html',
24              'cgi'        => $cgi,
25              'field'      => 'exportnum',
26              'options'    => \@export_options,
27              'labels'     => $export_labels,
28              'curr_value' => $exportnum,
29           )
30 %>
31 </TD>
32 </TR>
33
34 <% include('/elements/tr-input-text.html',
35              'cgi'     => $cgi,
36              'label'   => 'Service phone number',
37              'field'   => 'phonenum',
38              'size'    => '12',
39              'value'   => scalar($cgi->param('phonenum')),
40
41              'valign'  => 'middle',
42              'colspan' => 6,
43              'prefix'  => '<TABLE><TR><TD>',
44              'postfix' => '</TD><TD><FONT SIZE="-2">'. join('<BR>',
45                  'Line-share (non dry loops) - always fill in',
46                  'Dry loops - always leave empty',
47                ). '</FONT></TD></TR></TABLE>',
48           )
49 %>
50
51 <% include('/elements/tr-select-cust_location.html',
52              'cgi'           => $cgi,
53              $table          => $cust_main_or_prospect_main,
54              'alt_format'    => $conf->exists('qual-alt_address_format'),
55              'disable_empty' => $conf->exists('qual-alt_address_format'),
56              'no_bold'       => 1,
57              #required for ikano.. config? 'is_optional' => 1,
58           )
59 %>
60 </TABLE>
61
62 <BR>
63 <INPUT TYPE  = "submit"
64        NAME  = "submitButton"
65        ID    = "submitButton" 
66        VALUE = "Qualify"
67 >
68
69 </FORM>
70 </BODY>
71 </HTML>
72 <%init>
73
74 my $curuser = $FS::CurrentUser::CurrentUser;
75
76 die "access denied"
77   unless $curuser->access_right('Qualify service'); 
78
79 my $conf = new FS::Conf;
80 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
81
82 $cgi->param('custnum') =~ /^(\d+)$/;
83 my $custnum = $1;
84 $cgi->param('prospectnum') =~ /^(\d+)$/;
85 my $prospectnum = $1;
86 my $cust_or_prospect = $custnum ? "cust" : "prospect";
87 my $table = $cust_or_prospect . "_main";
88 my $custnum_or_prospectnum = $custnum ? $custnum : $prospectnum;
89 my $cust_main_or_prospect_main = qsearchs({
90   'table'     => $table,
91   'hashref'   => { $cust_or_prospect."num" => $custnum_or_prospectnum },
92   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
93 });
94 die "neither prospect nor customer specified or found" 
95     unless $cust_main_or_prospect_main;
96
97 my @exports = grep { $_->can('qual') } qsearch( 'part_export', {} );
98 my @export_options = ( 0 );
99 my $export_labels = { '0' => '(manual)' };
100 foreach my $export ( @exports ) {
101     push @export_options, $export->exportnum;
102     $export_labels->{$export->exportnum} = $export->exportname;
103 }
104 my $exportnum = $cgi->param('error')
105                   ? scalar($cgi->param('exportnum'))
106                   : scalar(@exports) == 1
107                     ? $exports[0]->exportnum
108                     : '';
109
110 </%init>