diff options
Diffstat (limited to 'httemplate/elements')
-rw-r--r-- | httemplate/elements/header.html | 94 | ||||
-rw-r--r-- | httemplate/elements/menu.html | 52 | ||||
-rw-r--r-- | httemplate/elements/search-cust_main.html | 163 | ||||
-rw-r--r-- | httemplate/elements/select-agent.html | 8 | ||||
-rw-r--r-- | httemplate/elements/select-part_referral.html | 17 | ||||
-rw-r--r-- | httemplate/elements/table-grid.html | 6 | ||||
-rw-r--r-- | httemplate/elements/tr-select-agent.html | 10 | ||||
-rw-r--r-- | httemplate/elements/tr-select-part_referral.html | 30 |
8 files changed, 332 insertions, 48 deletions
diff --git a/httemplate/elements/header.html b/httemplate/elements/header.html index 3aa81be3b..ea8c418c3 100644 --- a/httemplate/elements/header.html +++ b/httemplate/elements/header.html @@ -3,6 +3,7 @@ my $etc = @_ ? shift : ''; #$etc is for things like onLoad= etc. my $head = @_ ? shift : ''; #$head is for things that go in the <HEAD> section my $conf = new FS::Conf; + %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML> @@ -18,17 +19,22 @@ <SCRIPT TYPE="text/javascript"> function clearhint_search_cust (what) { - if ( what.value = '(cust #, name or company)' ) + if ( what.value == '(cust #, name, company or phone)' ) + what.value = ''; + } + + function clearhint_search_invoice (what) { + if ( what.value == '(inv #)' ) what.value = ''; } function clearhint_search_svc (what) { - if ( what.value = '(user, user@domain or domain)' ) + if ( what.value == '(user, user@domain or domain)' ) what.value = ''; } function clearhint_search_ticket (what) { - if ( what.value = '(ticket # or subject string)' ) + if ( what.value == '(ticket # or subject string)' ) what.value = ''; } </SCRIPT> @@ -39,13 +45,11 @@ <BODY BACKGROUND="<%=$fsurl%>images/background-cheat.png" <%= $etc %> STYLE="margin-top:0; margin-bottom:0; margin-left:0; margin-right:0"> <table width="100%" CELLPADDING=0 CELLSPACING=0 STYLE="padding-left:0; padding-right:4"> <tr> - <td rowspan=2 BGCOLOR="#ffffff"> - <IMG BORDER=0 ALT="freeside" SRC="<%=$fsurl%>images/small-logo.png"> - </td> + <td rowspan=2 BGCOLOR="#ffffff"><IMG BORDER=0 ALT="freeside" SRC="<%=$fsurl%>images/small-logo.png"></td> <td align=left rowspan=2 BGCOLOR="#ffffff"> <!-- valign="top" --> <font size=6><%= $conf->config('company_name') || 'ExampleCo' %></font> </td> - <td align=right valign=top BGCOLOR="#ffffff">Logged in as <b><%= getotaker %> </b><br><FONT SIZE="-2"><a href="<%=$fsurl%>pref/XXXwritethis">Preferences</a> <BR><BR></FONT> + <td align=right valign=top BGCOLOR="#ffffff"><FONT SIZE="-1">Logged in as <b><%= getotaker %> </b><br></FONT><FONT SIZE="-2"><a href="<%=$fsurl%>pref/XXXwritethis">Preferences</a> <BR></FONT> </td> </tr> <tr> @@ -77,34 +81,88 @@ </tr> </table> - <TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=4> +<style type="text/css"> +input.fsblackbutton { + background-color:#333333; + color: #ffffff; + border:1px solid; + border-top-color:#cccccc; + border-left-color:#cccccc; + border-right-color:#aaaaaa; + border-bottom-color:#aaaaaa; + font-weight:bold; + padding-left:12px; + padding-right:12px; + overflow:visible; + filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#ff333333',EndColorStr='#ff666666') +} + +input.fsblackbuttonselected { + background-color:#7e0079; + color: #ffffff; + border:1px solid; + border-top-color:#cccccc; + border-left-color:#cccccc; + border-right-color:#aaaaaa; + border-bottom-color:#aaaaaa; + font-weight:bold; + padding-left:12px; + padding-right:12px; + overflow:visible; + filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#ff330033',EndColorStr='#ff7e0079') +} +</style> + + <TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=0> <TR> - <TD COLSPAN=4 WIDTH="100%" STYLE="padding:0"><IMG BORDER=0 ALT="" SRC="<%=$fsurl%>images/black-gradient.png" HEIGHT="13" WIDTH="100%"></TD> + <TD COLSPAN=5 WIDTH="100%" STYLE="padding:0"><IMG BORDER=0 ALT="" SRC="<%=$fsurl%>images/black-gradient.png" HEIGHT="13" WIDTH="100%"></TD> </TR> + <TR> - <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right" WIDTH="15%"> + + <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right"> <FORM ACTION="<%=$fsurl%>edit/cust_main.cgi" METHOD="GET" STYLE="margin:0"> - <INPUT TYPE="submit" VALUE="New customer"> + <INPUT TYPE="submit" VALUE="New customer" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="vertical-align:bottom"> </FORM> </TD> + <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right"> <FORM ACTION="<%=$fsurl%>search/cust_main.cgi" METHOD="GET" STYLE="margin:0"> - <INPUT NAME="search_cust" TYPE="text" VALUE="(cust #, name or company)" SIZE="22" onFocus="clearhint_search_cust(this);" onClick="clearhint_search_cust(this);" STYLE="text-align:right"> - <INPUT TYPE="submit" VALUE="Search customers"> + <INPUT NAME="search_cust" TYPE="text" VALUE="(cust #, name, company or phone)" SIZE="28" onFocus="clearhint_search_cust(this);" onClick="clearhint_search_cust(this);" STYLE="vertical-align:bottom;text-align:right"><BR> + <A HREF="<%=$fsurl%>search/cust_main.html" STYLE="color: #000000; font-size: 70%">Advanced</A> + <INPUT TYPE="submit" VALUE="Search customers" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:70%"> </FORM> </TD> + + <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right"> + <% if ( $FS::CurrentUser::CurrentUser->access_right('View invoices') ) { %> + <FORM ACTION="<%=$fsurl%>search/cust_bill.html" METHOD="GET" STYLE="margin:0;display:inline"> + <INPUT NAME="invnum" TYPE="text" VALUE="(inv #)" SIZE="4" onFocus="clearhint_search_invoice(this);" onClick="clearhint_search_invoice(this);" STYLE="vertical-align:bottom;text-align:right;margin-bottom:1px"> + <% if ( $FS::CurrentUser::CurrentUser->access_right('List invoices') ) { %> + <A HREF="<%=$fsurl%>search/report_cust_bill.html" STYLE="color: #ffffff; font-size: 70%">Advanced</A> + <% } %> + <BR> + <INPUT TYPE="submit" VALUE="Search invoices" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:70%"> + </FORM> + <% } %> + </TD> + <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right"> <FORM ACTION="<%=$fsurl%>search/svc_Smart.html" METHOD="GET" STYLE="margin:0"> - <INPUT NAME="search_svc" TYPE="text" VALUE="(user, user@domain or domain)" SIZE="26" onFocus="clearhint_search_svc(this);" onClick="clearhint_search_svc(this);" STYLE="text-align:right"> - <INPUT TYPE="submit" VALUE="Search services"> + <INPUT NAME="search_svc" TYPE="text" VALUE="(user, user@domain or domain)" SIZE="26" onFocus="clearhint_search_svc(this);" onClick="clearhint_search_svc(this);" STYLE="vertical-align:bottom;text-align:right"><BR> + <A HREF="<%=$fsurl%>search/svc_Smarter.html" STYLE="color: #000000; font-size: 70%">Advanced</A> + <INPUT TYPE="submit" VALUE="Search services"CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:70%"> </FORM> </TD> - <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right"> + + <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right" STYLE="padding-right:4px"> <FORM ACTION="<%=$fsurl%>rt/index.html" METHOD="GET" STYLE="margin:0"> - <INPUT NAME="q" TYPE="text" VALUE="(ticket # or subject string)" onFocus="clearhint_search_ticket(this);" onClick="clearhint_search_ticket(this);" STYLE="text-align:right"> - <INPUT TYPE="submit" VALUE="Search tickets"> + <INPUT NAME="q" TYPE="text" VALUE="(ticket # or subject string)" onFocus="clearhint_search_ticket(this);" onClick="clearhint_search_ticket(this);" STYLE="vertical-align:bottom;text-align:right"><BR> + <A HREF="<%=$fsurl%>rt/Search/Build.html" STYLE="color: #ffffff; font-size: 70%">Advanced</A> + <INPUT TYPE="submit" VALUE="Search tickets" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:70%;padding-left:2px;padding-right:2px"> </FORM> </TD> + </TR> </TABLE> <TABLE WIDTH="100%" HEIGHT="100%" CELLSPACING=0 CELLPADDING=4> diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index 8c62d9778..a5b41aefd 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -189,26 +189,36 @@ 'View/Edit address blocks' => [ $fsurl.'browse/addr_block.cgi', 'Manage address blocks and block assignments to broadband routers' ], ; - tie my %config_misc, 'Tie::IxHash', - 'View/Edit advertising sources' => [ $fsurl.'browse/part_referral.cgi', 'Where a customer heard about your service. Tracked for informational purposes' ], - 'View/Edit virtual fields' => [ $fsurl.'browse/part_virtual_field.cgi', 'Locally defined fields', ], - 'View/Edit message catalog' => [ $fsurl.'browse/msgcat.cgi', 'Change error messages and other customizable labels' ], - 'View/Edit inventory classes and inventory' => [ $fsurl.'browse/inventory_class.html', 'Setup inventory classes and stock inventory' ], - ; + tie my %config_misc, 'Tie::IxHash'; + $config_misc{'View/Edit advertising sources'} = [ $fsurl.'browse/part_referral.html', 'Where a customer heard about your service. Tracked for informational purposes' ] + if $curuser->access_right('Configuration') + || $curuser->access_right('Edit advertising sources') + || $curuser->access_right('Edit global advertising sources'); + if ( $curuser->access_right('Configuration') ) { + $config_misc{'View/Edit virtual fields'} = [ $fsurl.'browse/part_virtual_field.cgi', 'Locally defined fields', ]; + $config_misc{'View/Edit message catalog'} = [ $fsurl.'browse/msgcat.cgi', 'Change error messages and other customizable labels' ]; + $config_misc{'View/Edit inventory classes and inventory'} = [ $fsurl.'browse/inventory_class.html', 'Setup inventory classes and stock inventory' ]; + } - tie my %config_menu, 'Tie::IxHash', - 'Settings' => [ $fsurl.'config/config-view.cgi', '' ], - 'separator' => '', #its a separator! - 'Employees' => [ \%config_employees, '' ], - 'Provisioning, services and packages' - => [ \%config_export_svc_pkg, '' ], - 'Resellers' => [ \%config_agent, '' ], - 'Billing' => [ \%config_billing, '' ], - 'Dialup' => [ \%config_dialup, '' ], - 'Fixed (username-less) broadband' - => [ \%config_broadband, '' ], - 'Miscellaneous' => [ \%config_misc, '' ], - ; + tie my %config_menu, 'Tie::IxHash'; + if ( $curuser->access_right('Configuration' ) ) { + %config_menu = ( + 'Settings' => [ $fsurl.'config/config-view.cgi', '' ], + 'separator' => '', #its a separator! + 'Employees' => [ \%config_employees, '' ], + 'Provisioning, services and packages' + => [ \%config_export_svc_pkg, '' ], + 'Resellers' => [ \%config_agent, '' ], + 'Billing' => [ \%config_billing, '' ], + 'Dialup' => [ \%config_dialup, '' ], + 'Fixed (username-less) broadband' + => [ \%config_broadband, '' ], + ); + } + $config_menu{'Miscellaneous'} = [ \%config_misc, '' ] + if $curuser->access_right('Configuration') + || $curuser->access_right('Edit advertising sources') + || $curuser->access_right('Edit global advertising sources'); tie my %menu, 'Tie::IxHash', 'Billing Main' => [ $fsurl, 'Billing start page', ], @@ -225,7 +235,9 @@ $menu{'Tools'} = [ \%tools_menu, 'Tools' ] if keys %tools_menu; $menu{'Configuration'} = [ \%config_menu, 'Configuraiton and setup' ] - if $curuser->access_right('Configuration'); + if $curuser->access_right('Configuration') + || $curuser->access_right('Edit advertising sources') + || $curuser->access_right('Edit global advertising sources'); use vars qw($gmenunum); $gmenunum = 0; diff --git a/httemplate/elements/search-cust_main.html b/httemplate/elements/search-cust_main.html new file mode 100644 index 000000000..ca91b4027 --- /dev/null +++ b/httemplate/elements/search-cust_main.html @@ -0,0 +1,163 @@ +<% + my( %opt ) = @_; + $opt{'field_name'} ||= 'custnum'; + + my $cust_main = ''; + if ( $opt{'value'} ) { + $cust_main = qsearchs( + 'table' => 'cust_main', + 'hashref' => { 'custnum' => $opt{'value'} }, + 'extra_sql' => " AND ". $FS::CurrentUser::CurrentUser->agentnums_sql, + ); + } +%> + +<INPUT TYPE="hidden" NAME="<%= $opt{'field_name'} %>" VALUE="<%= $opt{'value'} %>"> + +<!-- some false laziness w/ misc/batch-cust_pay.html, though not as bad as i'd thought at first... --> + +<INPUT TYPE="text" NAME="<%= $opt{'field_name'} %>_search" ID="<%= $opt{'field_name'} %>_search" SIZE="32" VALUE="<%= $cust_main ? $cust_main->name : '(cust #, name or company)' %>" onFocus="clearhint_<%= $opt{'field_name'} %>_search(this);" onClick="clearhint_<%= $opt{'field_name'} %>_search(this);" onChange="smart_<%= $opt{'field_name'} %>_search(this);"> + +<SELECT NAME="<%= $opt{'field_name'} %>_select" ID="<%= $opt{'field_name'} %>_select" STYLE="color:#ff0000; display:none" onChange="select_<%= $opt{'field_name'} %>(this);"> +</SELECT> + +<%= include('/elements/xmlhttp.html', + 'url' => $p. 'misc/xmlhttp-cust_main-search.cgi', + 'subs' => [ 'smart_search' ], + ) +%> + +<SCRIPT TYPE="text/javascript"> + + function clearhint_<%= $opt{'field_name'} %>_search (what) { + + what.style.color = '#000000'; + + if ( what.value == '(cust #, name or company)' ) + what.value = ''; + + if ( what.value.indexOf('Customer not found: ') == 0 ) + what.value = what.value.substr(20); + + } + + function smart_<%= $opt{'field_name'} %>_search(what) { + + var customer = what.value; + + if ( customer == 'searching...' || customer == '' + || customer.indexOf('Customer not found: ') == 0 ) + return; + + if ( what.getAttribute('magic') == 'nosearch' ) { + what.setAttribute('magic', ''); + return; + } + + //what.value = 'searching...' + what.disabled = true; + what.style.color= '#000000'; + what.style.backgroundColor = '#dddddd'; + + var customer_select = document.getElementById('<%= $opt{'field_name'} %>_select'); + + //alert("search for customer " + customer); + + function <%= $opt{'field_name'} %>_search_update(customers) { + + //alert('customers returned: ' + customers); + + var customerArray = eval('(' + customers + ')'); + + what.disabled = false; + what.style.backgroundColor = '#ffffff'; + + if ( customerArray.length == 0 ) { + + what.form.<%= $opt{'field_name'} %>.value = ''; + + what.value = 'Customer not found: ' + what.value; + what.style.color = '#ff0000'; + + what.style.display = ''; + customer_select.style.display = 'none'; + + } else if ( customerArray.length == 1 ) { + + //alert('one customer found: ' + customerArray[0]); + + what.form.<%= $opt{'field_name'} %>.value = customerArray[0][0]; + what.value = customerArray[0][1]; + + what.style.display = ''; + customer_select.style.display = 'none'; + + } else { + + //alert('multiple customers found, have to create select dropdown'); + + //blank the current list + for ( var i = customer_select.length; i >= 0; i-- ) + customer_select.options[i] = null; + + opt(customer_select, '', 'Multiple customers match "' + customer + '" - select one', '#ff0000'); + + //add the multiple customers + for ( var s = 0; s < customerArray.length; s++ ) + opt(customer_select, customerArray[s][0], customerArray[s][1], '#000000'); + + opt(customer_select, 'cancel', '(Edit search string)', '#000000'); + + what.style.display = 'none'; + customer_select.style.display = ''; + + } + + } + + smart_search( customer, <%= $opt{'field_name'} %>_search_update ); + + + } + + function select_<%= $opt{'field_name'} %> (what) { + + var custnum = what.options[what.selectedIndex].value; + var customer = what.options[what.selectedIndex].text; + + var customer_obj = document.getElementById('<%= $opt{'field_name'} %>_search'); + + if ( custnum == '' ) { + //what.style.color = '#ff0000'; + + } else if ( custnum == 'cancel' ) { + + customer_obj.style.color = '#000000'; + + what.style.display = 'none'; + customer_obj.style.display = ''; + customer_obj.focus(); + + } else { + + what.form.<%= $opt{'field_name'} %>.value = custnum; + + customer_obj.value = customer; + customer_obj.style.color = '#000000'; + + what.style.display = 'none'; + customer_obj.style.display = ''; + + } + + } + + function opt(what,value,text,color) { + var optionName = new Option(text, value, false, false); + optionName.style.color = color; + var length = what.length; + what.options[length] = optionName; + } + +</SCRIPT> + diff --git a/httemplate/elements/select-agent.html b/httemplate/elements/select-agent.html index 78ec25f82..009cc6e06 100644 --- a/httemplate/elements/select-agent.html +++ b/httemplate/elements/select-agent.html @@ -1,8 +1,7 @@ <% my( $agentnum, %opt ) = @_; - my %select_opt = (); - $select_opt{'records'} = $opt{'agents'} + $opt{'records'} = delete $opt{'agents'} if $opt{'agents'}; %><%= include( '/elements/select-table.html', @@ -12,7 +11,8 @@ 'empty_label' => 'all', 'hashref' => { 'disabled' => '' }, 'extra_sql' => ' AND '. - $FS::CurrentUser::CurrentUser->agentnums_sql, - %select_opt, + $FS::CurrentUser::CurrentUser->agentnums_sql. + ' ORDER BY agent', + %opt, ) %> diff --git a/httemplate/elements/select-part_referral.html b/httemplate/elements/select-part_referral.html new file mode 100644 index 000000000..deb87bd3b --- /dev/null +++ b/httemplate/elements/select-part_referral.html @@ -0,0 +1,17 @@ +<% + my( $refnum, %opt ) = @_; + + $opt{'records'} = delete $opt{'part_referrals'} + if $opt{'part_referrals'}; + +%><%= include( '/elements/select-table.html', + 'table' => 'part_referral', + 'name_col' => 'referral', + 'value' => $refnum, + 'empty_label' => 'Select advertising source', + 'hashref' => { 'disabled' => '' }, + 'extra_sql' => ' AND '. + FS::part_referral->all_part_referral(1), + %opt, + ) +%> diff --git a/httemplate/elements/table-grid.html b/httemplate/elements/table-grid.html index 17eafdf1a..fd1cb9113 100644 --- a/httemplate/elements/table-grid.html +++ b/httemplate/elements/table-grid.html @@ -5,9 +5,15 @@ %> <STYLE TYPE="text/css"> + .grid table { border: solid; empty-cells: show } .grid TH { padding-left: 3px; padding-right: 3px; border: 1px solid #dddddd; border-bottom: dashed 1px black; border-right: none } .grid TD { padding-left: 3px; padding-right: 3px; empty-cells: show; border: 1px solid #cccccc; border-bottom: none; border-right: none } + +.inv table { border: none } +.inv TH { border: none } +.inv TD { border: none } + </STYLE> <TABLE CLASS="grid" CELLSPACING=<%= $opt{cellspacing} %> CELLPADDING=<%= $opt{cellpadding} %> BORDER=1 BORDERCOLOR="#000000" STYLE="border: solid 1px black; empty-cells: show"> diff --git a/httemplate/elements/tr-select-agent.html b/httemplate/elements/tr-select-agent.html index 83c8d1758..6158f6f47 100644 --- a/httemplate/elements/tr-select-agent.html +++ b/httemplate/elements/tr-select-agent.html @@ -7,12 +7,9 @@ #here is the agent virtualization my $agentnums_href = $FS::CurrentUser::CurrentUser->agentnums_href; @agents = grep $agentnums_href->{$_->agentnum}, @{ $opt{'agents'} }; + delete $opt{'agents'}; } else { - @agents = qsearch( { - 'table' => 'agent', - 'hashref' => { disabled=>'' }, - 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, - }); + @agents = $FS::CurrentUser::CurrentUser->agents; } %> @@ -24,10 +21,11 @@ <% } else { %> <TR> - <TD ALIGN="right"><%= $opt{'label'} || 'Agent: ' %></TD> + <TD ALIGN="right"><%= $opt{'label'} || 'Agent' %></TD> <TD> <%= include( '/elements/select-agent.html', $agentnum, 'agents' => \@agents, + %opt, ) %> </TD> diff --git a/httemplate/elements/tr-select-part_referral.html b/httemplate/elements/tr-select-part_referral.html new file mode 100644 index 000000000..0108388bc --- /dev/null +++ b/httemplate/elements/tr-select-part_referral.html @@ -0,0 +1,30 @@ +<% + my( $refnum, %opt ) = @_; + + $opt{'part_referrals'} ||= + [ FS::part_referral->all_part_referral( 1 ) ]; #1: include global + + my $r = qq!<font color="#ff0000">*</font> !; + +%> + +<% if ( scalar( @{$opt{'part_referrals'}} ) == 0 ) { + eidiot "You have not created any advertising sources. You must create at least one advertising source before adding a customer. Go to ". popurl(2). "browse/part_referral.html and create one or more advertising sources."; + } elsif ( scalar( @{$opt{'part_referrals'}} ) == 1 ) { +%> + + <INPUT TYPE="hidden" NAME="refnum" VALUE="<%= $opt{'part_referrals'}->[0]->refnum %>"> + +<% } else { %> + + <TR> + <TH ALIGN="right"><%=$r%>Advertising source</TH> + <TD> + <%= include( '/elements/select-part_referral.html', $refnum, + 'part_referrals' => $opt{'part_referrals'}, + ) + %> + </TD> + </TR> + +<% } %> |