71513: Card tokenization [v3 test tweak]
[freeside.git] / ng_selfservice / quotation.php
1 <STYLE>
2 td.amount {
3     text-align: right;
4 }
5 td.amount:before {
6     content: "$";
7 }
8 tr.total * {
9     background-color: #ddf;
10     font-weight: bold;
11 }
12 table.section {
13     width: 100%;
14     border-collapse: collapse;
15 }
16 table.section td {
17     font-size: small;
18     padding: 1ex 1ex;
19 }
20 table.section th {
21     text-align: left;
22     padding: 1ex;
23 }
24 .row0 td {
25     background-color: #eee;
26 }
27 .row1 td {
28     background-color: #fff;
29 }
30 </STYLE>
31
32 <? $title ='Plan a new service order'; include('elements/header.php'); ?>
33 <? $current_menu = 'services_new.php'; include('elements/menu.php'); ?>
34 <?
35
36 $quotation = $freeside->quotation_info(array(
37   'session_id'  => $_COOKIE['session_id'],
38 ));
39
40 $can_order = 0;
41
42 if ( isset($quotation['sections']) and count($quotation['sections']) > 0 ) {
43   $can_order = 1;
44   # there are other ways this could be formatted, yes.
45   # if you want the HTML-formatted quotation, use quotation_print().
46   print(
47     '<INPUT STYLE="float: right" TYPE="button" onclick="window.location.href=\'quotation_print.php\'" value="Download a quotation" />'.
48     '<H3>Order summary</H3>'.
49     "\n"
50   );
51   foreach ( $quotation['sections'] as $section ) {
52     print(
53       '<TABLE CLASS="section">'.
54       '<TR>'.
55       '<TH COLSPAN=4>'.  htmlspecialchars($section['description']).'</TH>'.
56       '</TR>'.
57       "\n"
58     );
59     $row = 0;
60     foreach ( $section['detail_items'] as $detail ) {
61       if (isset($detail['description'])) {
62         print(
63           '<TR CLASS="row' . $row . '">'.
64           '<TD>'
65         );
66         if ( $detail['pkgnum'] ) {
67           print(
68             '<A HREF="quotation_remove_pkg.php?pkgnum=' .
69             $detail['pkgnum'] . '">'.
70             '<IMG SRC="images/cross.png" /></A>'
71           );
72         }
73         print(
74           '</TD>'.
75           '<TD>'. htmlspecialchars($detail['description']). '</TD>'.
76           '<TD CLASS="amount">'. $detail['amount']. '</TD>'.
77           '</TR>'. "\n"
78         );
79         $row = 1 - $row;
80       } else {
81         # total rows; a 3.x-ism
82         print(
83           '<TR CLASS="total">'.
84           '<TD></TD>'.
85           '<TD>'. htmlspecialchars($detail['total_item']). '</TD>'.
86           '<TD CLASS="amount">'. $detail['total_amount']. '</TD>'.
87           '</TR>'."\n"
88         );
89       }
90     }
91     if (isset($section['subtotal'])) {
92       print(
93         '<TR CLASS="total">'.
94         '<TD></TD>'.
95         '<TD>Total</TD>'.
96         '<TD CLASS="amount">'. $section['subtotal']. '</TD>'.
97         '</TR>'
98       );
99     }
100     print "</TABLE>\n";
101   } # foreach $section
102 }
103
104 $pkgselect = $freeside->mason_comp( array(
105     'session_id' => $_COOKIE['session_id'],
106     'comp'       => '/elements/select-part_pkg.html',
107     'args'       => array( 'onchange'       , 'enable_order_pkg()',
108                            'empty_label'    , 'Select package',
109                            'form_name'      , 'AddPkgForm',
110                          ),
111 ));
112 if ( isset($pkgselect['error']) && $pkgselect['error'] ) {
113   $error = $pkgselect['error'];
114   header('Location:index.php?error='. urlencode($pkgselect));
115   die();
116 }
117
118 ?>
119 <SCRIPT TYPE="text/javascript">
120 function enable_order_pkg () {
121     document.AddPkgForm.submit.disabled =
122         (document.AddPkgForm.pkgpart.value == '');
123 }
124 </SCRIPT>
125
126 <DIV STYLE="border-top: 1px solid; padding: 1ex">
127 <? $error = $_REQUEST['error']; include('elements/error.php'); ?>
128
129 <FORM NAME="AddPkgForm" ACTION="quotation_add_pkg.php" METHOD=POST>
130 <? echo $pkgselect['output']; ?>
131 <INPUT NAME="submit" TYPE="submit" VALUE="Add package" <? if ( ! isset($_REQUEST['pkgpart']) ) { echo 'DISABLED'; } ?>>
132 </FORM>
133
134 <? if ( $can_order ) { ?>
135 <FORM NAME="OrderQuoteForm" ACTION="quotation_order.php" METHOD=POST>
136 <INPUT TYPE="submit" VALUE="Confirm this order" <? if ( !$can_order ) { echo 'DISABLED'; } ?>>
137 <? } ?>
138
139 </DIV>
140
141 <? include('elements/menu_footer.php'); ?>
142 <? include('elements/footer.php'); ?>