fix several UI nits in FCC 477 report configuration, #24047
authorMark Wells <mark@freeside.biz>
Sat, 22 Nov 2014 00:32:37 +0000 (16:32 -0800)
committerMark Wells <mark@freeside.biz>
Sat, 22 Nov 2014 00:33:40 +0000 (16:33 -0800)
FS/FS/Report/FCC_477.pm
httemplate/browse/part_pkg-fcc.html
httemplate/edit/part_pkg.cgi
httemplate/edit/process/bulk-part_pkg-fcc.html
httemplate/elements/input-fcc_options.html
httemplate/elements/tr-input-fcc_options.html
httemplate/misc/part_pkg_fcc_options.html
httemplate/search/477.html

index ff29d19..f5d6a06 100644 (file)
@@ -4,14 +4,13 @@ use base qw( FS::Report );
 use strict;
 use vars qw( @upload @download @technology @part2aoption @part2boption
              %states
-             $DEBUG
            );
 use FS::Record qw( dbh );
 
 use Tie::IxHash;
 use Storable;
 
-$DEBUG = 0;
+our $DEBUG = 0;
 
 =head1 NAME
 
@@ -305,6 +304,7 @@ sub report {
     unless $class->can($method);
   my $statement = $class->$method(%opt);
 
+  warn $statement if $DEBUG;
   my $sth = dbh->prepare($statement);
   $sth->execute or die $sth->errstr;
   $sth->fetchall_arrayref;
index e3fd97c..bdfb99a 100755 (executable)
@@ -180,9 +180,11 @@ if ( $cgi->param('redirect') ) {
 my $html_init = 
   include('/elements/init_overlib.html') .
   include('/elements/input-fcc_options.html', js_only => 1) .
-  include('.style');
+  include('.style') .
+  include('.script');
 
-my $html_form = qq!<FORM ACTION="${p}edit/process/bulk-part_pkg-fcc.html" METHOD="POST">
+my $html_form = qq!<FORM ACTION="${p}edit/process/bulk-part_pkg-fcc.html" METHOD="POST" NAME="bulk-part_pkg-fcc">
+  <INPUT TYPE="hidden" NAME="jump">
   ( show class: !.
   include('/elements/select-pkg_class.html',
             #'curr_value'    => $classnum,
@@ -193,20 +195,13 @@ my $html_form = qq!<FORM ACTION="${p}edit/process/bulk-part_pkg-fcc.html" METHOD
             'disable_empty' => 1,
          ).
   ' )
-  <BR><BR>' .
-  qq!<SCRIPT TYPE="text/javascript">
-  function filter_change() {
-    window.location = '! . $cgi->self_url . qq!?classnum='
-      + document.getElementById('classnum').value;
-  }
-  </SCRIPT>!;
+  <BR><BR>';
+
 
 # restore this only after creating $html_form
 $cgi->param('classnum', $classnum) if length($classnum);
 
-my $html_foot = qq!
-  <INPUT TYPE="submit" VALUE="Save changes">
-  </FORM>!;
+my $html_foot = '</FORM>';
 
 my @menubar =
   ( 'Package definitions' => $p.'browse/part_pkg.cgi' );
@@ -224,3 +219,17 @@ my @menubar =
   }
 </style>
 </%def>
+<%def .script>
+<script type="text/javascript">
+  function finish_edit_fcc(id) {
+    cClick();
+    document.forms['bulk-part_pkg-fcc']['jump'].value = id;
+    document.forms['bulk-part_pkg-fcc'].submit(); //immediately save/refresh
+  }
+
+  function filter_change() {
+    window.location = '! . $cgi->self_url . qq!?classnum='
+      + document.getElementById('classnum').value;
+  }
+</script>
+</%def>
index 5e42687..dca5b39 100755 (executable)
@@ -805,6 +805,11 @@ my $javascript = <<'END';
       }
     }
 
+    function finish_edit_fcc(id) {
+      cClick();
+      show_fcc_options(id); // refresh the display
+    }
+
 END
 
 my $warning =
index 4a0fb2a..8ef3308 100644 (file)
@@ -17,7 +17,7 @@
 %   }
 <% $cgi->redirect($fsurl.'browse/part_pkg-fcc.html?redirect='.$session) %>
 % } else {
-<% $cgi->redirect($fsurl.'browse/part_pkg-fcc.html?classnum='.$classnum) %>
+<% $cgi->redirect($fsurl.'browse/part_pkg-fcc.html?classnum='.$classnum.$jump) %>
 % }
 <%init>
 my $curuser = $FS::CurrentUser::CurrentUser;
@@ -40,4 +40,8 @@ foreach my $param ($cgi->param) {
 
 my $classnum = $cgi->param('classnum');
 
+my $jump = '';
+if ( $cgi->param('jump') =~ /^pkgpart(\d+)$/ ) {
+  $jump = '#'.$1;
+}
 </%init>
index fb2500f..064c647 100644 (file)
@@ -80,7 +80,8 @@ function show_fcc_options(id) {
     }
   } // is_phone
   if ( curr_values['is_voip'] ) {
-    out += '<li><strong>VoIP</strong> telephone service</li>';
+    out += '<li><strong>VoIP</strong> telephone service over <strong>' 
+            + media + '</strong></li>';
     out += '<li><strong>' + curr_values['voip_sessions'] + 
            '</strong> sessions allowed</li>';
     if ( curr_values['voip_lastmile'] ) {
index 87117ef..1f63588 100644 (file)
@@ -7,96 +7,9 @@
 </STYLE>
 <TR>
   <TH COLSPAN=2>
-    <& hidden.html, 'id' => $id, @_ &>
-%#    <& input-text.html, 'id' => $id, @_ &> # XXX debugging
-    <UL ID="<%$id%>_display_fcc_options" CLASS="fcc_options">
-    </UL>
-    <BUTTON TYPE="button" onclick="edit_fcc_options()">
-      Edit
-    </BUTTON>
-% # show some kind of useful summary of the FCC options here
+    <& input-fcc_options.html, 'id' => $id, @_ &>
   </TH>
 </TR>
-<SCRIPT TYPE="text/javascript">
-function edit_fcc_options() {
-  <& popup_link_onclick.html,
-  'action'      => $fsurl.'misc/part_pkg_fcc_options.html?id=' . $id,
-  'actionlabel' => 'FCC Form 477 options',
-  'width'       => 760,
-  'height'      => 600,
-  &>
-}
-var technology_labels = <% encode_json(FS::part_pkg_fcc_option->technology_labels) %>;
-function show_fcc_options() {
-  var curr_values = JSON.parse(document.getElementById('<% $id %>').value);
-  // hardcoded for the same reasons as misc/part_pkg_fcc_options
-  var out = '';
-  var tech = curr_values['technology'];
-  if ( tech ) {
-    if (technology_labels[tech]) {
-      tech = technology_labels[tech];
-    } else {
-      tech = 'Technology '+tech; // unknown?
-    }
-  }
-  var media = curr_values['media'] || 'unknown media';
-  media = media.toLowerCase();
-  if ( curr_values['is_consumer'] ) {
-    out += '<li><strong>Consumer-grade</strong></li>>';
-  } else {
-    out += '<li><strong>Business-grade</strong></li>';
-  }
-  if ( curr_values['is_broadband'] ) {
-    out += '<li>Broadband via <strong>' + tech + '</strong>'
-        +  '<li><strong>' + curr_values['broadband_downstream']
-        +  'Mbps </strong> down / '
-        +  '<strong>' + curr_values['broadband_upstream']
-        +  'Mbps </strong> up</li>';
-  }
-  if ( curr_values['is_phone'] ) {
-    if ( curr_values['phone_wholesale'] ) {
-      out += '<li>Wholesale telephone</li>';
-      if ( curr_values['phone_vges'] ) {
-        out += '<li><strong>' + curr_values['phone_vges'] + '</strong>'
-            +  ' switched voice-grade lines</li>';
-      }
-      if ( curr_values['phone_circuits'] ) {
-        out += '<li><strong>' + curr_values['phone_circuits'] + '</strong>'
-            +  ' unswitched circuits</li>';
-      }
-    } else {
-      // enduser service
-      out += '<li>Local telephone over <strong>' + media + '</strong></li>'
-          +  '<li><strong>' + curr_values['phone_lines']
-          +  '</strong> voice-grade lines</li>';
-      if ( curr_values['phone_localloop'] == 'resale' ) {
-        out += '<li><strong>Resold</strong> from another carrier</li>>';
-      } else if ( curr_values['phone_localloop'] == 'leased' ) {
-        out += '<li>Using <strong>leased circuits</strong> from another carrier</li>';
-      } else if ( curr_values['phone_localloop'] == 'owned' ) {
-        out += '<li>Using <strong>our own circuits</strong></li>';
-      }
-      if ( curr_values['phone_longdistance'] ) {
-        out += '<li>Includes <strong>long-distance service</strong></li>';
-      }
-    }
-  } // is_phone
-  if ( curr_values['is_voip'] ) {
-    out += '<li><strong>VoIP</strong> telephone service</li>';
-    if ( curr_values['voip_ott'] ) {
-      out += '<li>Using a <strong>separate</strong> last-mile connection</li>';
-    } else {
-      out += '<li><strong>Including</strong> last-mile connection</li>';
-    }
-  } // is_voip
-
-  var out_ul = document.getElementById('<% $id %>_display_fcc_options');
-  out_ul.innerHTML = out;
-}
-<&| onload.js &>
-  show_fcc_options();
-</&>
-</SCRIPT>
 <%init>
 my %opt = @_;
 my $id = $opt{id} || $opt{field};
index 27b45e0..0db4e25 100644 (file)
@@ -156,8 +156,7 @@ function save_changes() {
   }
   parent_input.value = JSON.stringify(data);
   // update the display
-  parent.show_fcc_options(parent_input.id);
-  parent.cClick(); //overlib
+  parent.finish_edit_fcc(parent_input.id);
 }
 
 function enable_fieldset(fieldset_id) {
index 244bfa1..ff2ac86 100644 (file)
@@ -212,7 +212,7 @@ my $part_titles = FS::Report::FCC_477->parts;
 </%def>
 <%def .header_voip>
   <TR CLASS="head">
-    <TD ROWSPAN=2>State</TD>
+    <TD ROWSPAN=3>State</TD>
     <TD COLSPAN=2>VoIP OTT</TD>
     <TD COLSPAN=8>VoIP Non-OTT</TD>
   </TR>