477 report rewrite, #28020
[freeside.git] / httemplate / elements / tr-input-fcc_options.html
1 <STYLE>
2   ul.fcc_options {
3     font-weight: normal;
4     text-align: left;
5     padding: 0em 1em 0em 2em;
6   }
7 </STYLE>
8 <TR>
9   <TH COLSPAN=2>
10     <& hidden.html, 'id' => $id, @_ &>
11 %#    <& input-text.html, 'id' => $id, @_ &> # XXX debugging
12     <UL ID="<%$id%>_display_fcc_options" CLASS="fcc_options">
13     </UL>
14     <BUTTON TYPE="button" onclick="edit_fcc_options()">
15       Edit
16     </BUTTON>
17 % # show some kind of useful summary of the FCC options here
18   </TH>
19 </TR>
20 <SCRIPT TYPE="text/javascript">
21 function edit_fcc_options() {
22   <& popup_link_onclick.html,
23   'action'      => $fsurl.'misc/part_pkg_fcc_options.html?id=' . $id,
24   'actionlabel' => 'FCC Form 477 options',
25   'width'       => 760,
26   'height'      => 600,
27   &>
28 }
29 var technology_labels = <% encode_json(FS::part_pkg_fcc_option->technology_labels) %>;
30 function show_fcc_options() {
31   var curr_values = JSON.parse(document.getElementById('<% $id %>').value);
32   // hardcoded for the same reasons as misc/part_pkg_fcc_options
33   var out = '';
34   var tech = curr_values['technology'];
35   if ( tech ) {
36     if (technology_labels[tech]) {
37       tech = technology_labels[tech];
38     } else {
39       tech = 'Technology '+tech; // unknown?
40     }
41   }
42   var media = String.toLowerCase(curr_values['media'] || 'unknown media');
43   if ( curr_values['is_consumer'] ) {
44     out += '<li><strong>Consumer-grade</strong> service</li>>';
45   } else {
46     out += '<li><strong>Business-grade</strong> service</li>';
47   }
48   if ( curr_values['is_broadband'] ) {
49     out += '<li>Broadband via <strong>' + tech + '</strong>'
50         +  '<li><strong>' + curr_values['broadband_downstream']
51         +  'Mbps </strong> down / '
52         +  '<strong>' + curr_values['broadband_upstream']
53         +  'Mbps </strong> up</li>';
54   }
55   if ( curr_values['is_phone'] ) {
56     if ( curr_values['phone_wholesale'] ) {
57       out += '<li>Wholesale telephone</li>';
58       if ( curr_values['phone_vges'] ) {
59         out += '<li><strong>' + curr_values['phone_vges'] + '</strong>'
60             +  ' switched voice-grade lines</li>';
61       }
62       if ( curr_values['phone_circuits'] ) {
63         out += '<li><strong>' + curr_values['phone_circuits'] + '</strong>'
64             +  ' unswitched circuits</li>';
65       }
66     } else {
67       // enduser service
68       out += '<li>Local telephone over <strong>' + media + '</strong></li>'
69           +  '<li><strong>' + curr_values['phone_lines']
70           +  '</strong> voice-grade lines</li>';
71       if ( curr_values['phone_localloop'] == 'resale' ) {
72         out += '<li><strong>Resold</strong> from another carrier</li>>';
73       } else if ( curr_values['phone_localloop'] == 'leased' ) {
74         out += '<li>Using <strong>leased circuits</strong> from another carrier</li>';
75       } else if ( curr_values['phone_localloop'] == 'owned' ) {
76         out += '<li>Using <strong>our own circuits</strong></li>';
77       }
78       if ( curr_values['phone_longdistance'] ) {
79         out += '<li>Includes <strong>long-distance service</strong></li>';
80       }
81     }
82   } // is_phone
83   if ( curr_values['is_voip'] ) {
84     out += '<li><strong>VoIP</strong> telephone service</li>';
85     if ( curr_values['voip_ott'] ) {
86       out += '<li>Using a <strong>separate</strong> last-mile connection</li>';
87     } else {
88       out += '<li><strong>Including</strong> last-mile connection</li>';
89     }
90   } // is_voip
91
92   var out_ul = document.getElementById('<% $id %>_display_fcc_options');
93   out_ul.innerHTML = out;
94 }
95 <&| onload.js &>
96   show_fcc_options();
97 </&>
98 </SCRIPT>
99 <%init>
100 my %opt = @_;
101 my $id = $opt{id} || $opt{field};
102 </%init>