summaryrefslogtreecommitdiff
path: root/httemplate/elements/tr-select-payment_options.html
blob: 5197c37064270480d6b9bc8772f0176c29ee5f34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

  <TR STYLE="display:block">
    <TH ALIGN="right"><% mt('Payment options') |h %></TH>
    <TD COLSPAN=7>
     <SELECT
  	  ID       = "<% $opt{prefix} %>payment_option"
  	  NAME     = "<% $opt{prefix} %>payment_option"
  	  onChange = "<% $opt{prefix} %>payment_option_changed(this)"
  	  <% $opt{disabled} %>
	>
  		<OPTION VALUE="select">Select payment option</OPTION>
  		<OPTION VALUE="<% $opt{amount} %>">Pay full balance</OPTION>
  		<OPTION VALUE="invoice">Pay specific invoice</OPTION>
  		<OPTION VALUE="">Pay specific amount</OPTION>
	</SELECT>	
    </TD>
  </TR>

  <& /elements/tr-select-invoice.html,
       %opt
  &>

  <& /elements/tr-amount_fee.html,
       %opt
  &>

  <SCRIPT TYPE="text/javascript">

      function <% $opt{prefix} %>payment_option_changed(what) {

        if ( what.value == 'select' ) {
        	document.getElementById('payment_amount_row').style.display = 'none';
        	document.getElementById('invoice_row').style.display = 'none';
        	document.getElementById('amount').value = '';
        }
        else if ( what.value == 'invoice' ) {
        	document.getElementById('payment_amount_row').style.display = 'none';
        	document.getElementById('invoice_row').style.display = 'block';
        	document.getElementById('amount').value = '';
        }
        else {
        	document.getElementById('payment_amount_row').style.display = 'block';
        	document.getElementById('invoice_row').style.display = 'none';
        	document.getElementById('amount').value = what.value;
        }

      }

      function <% $opt{prefix} %>invoice_select_changed(what) {

        if ( what.value == 'select' ) {
        	document.getElementById('payment_amount_row').style.display = 'none';
        	document.getElementById('amount').value = '';
        }
        else {
        	document.getElementById('payment_amount_row').style.display = 'block';
        	document.getElementById('amount').value = what.value;
        }

      }

</SCRIPT>

<%init>

my %opt = @_;

</%init>