summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-04-05 12:52:17 -0700
committerMark Wells <mark@freeside.biz>2016-04-05 13:06:37 -0700
commit0c8fb96e40e3d9dc4ebb1f421e58efd0ac8ba5a4 (patch)
treecc0d00cde8c429e66d2b4dd1a4ea8e1843c83b00 /httemplate
parent06809c379e25e6753d39ca79a39c977e5194c696 (diff)
sticky setting for expanded payment history, #41397
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/view/cust_main/payment_history.html39
1 files changed, 32 insertions, 7 deletions
diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html
index a28fa071d..3603d3767 100644
--- a/httemplate/view/cust_main/payment_history.html
+++ b/httemplate/view/cust_main/payment_history.html
@@ -340,29 +340,43 @@
% if ( $item->{'balance_forward'} ) {
<& .balance_forward_row, $item->{'balance'}, $item->{'date'} &>
-% }
+% }
%} # foreach $item
+% if ( $old_history ) {
+<& .hide_history_row, $old_history++ &>
+% }
+
</TABLE>
</TD>
</TR>
</TABLE>
+<SCRIPT SRC="<% $fsurl %>elements/page_pref.js"></SCRIPT>
<SCRIPT TYPE="text/javascript">
-function show_history () {
- //alert('showing history!');
-
+function show_history(show) { // but don't update pref
var balance_forward_row = document.getElementById('balance_forward_row');
- balance_forward_row.style.display = 'none';
+ balance_forward_row.style.display = show ? 'none' : '';
for ( var i = 0; i < <% $old_history %>; i++ ) {
var oldRow = document.getElementById('old_history'+i);
- oldRow.style.display = '';
+ oldRow.style.display = show ? '' : 'none';
}
+}
+function update_show_history (show) {
+
+ show = show ? 1 : 0;
+ show_history(show);
+ // update user pref (blind post, don't care about the output here)
+ set_page_pref('expand_old_history', '<% $custnum %>', show);
}
+$().ready(function() {
+ show_history(<% get_page_pref('expand_old_history', $custnum) %>);
+});
+
</SCRIPT>
<%def .balance_forward_row>
% my( $b, $date ) = @_;
@@ -375,7 +389,7 @@ function show_history () {
<TD CLASS="grid" BGCOLOR="#dddddd">
<I><% mt("Starting balance on [_1]", time2str($date_format, $date) ) |h %></I>
- (<A HREF="javascript:void(0);" onClick="show_history();"><% mt('show prior history') |h %></A>)
+ (<A HREF="javascript:void(0);" onClick="update_show_history(true);"><% mt('show prior history') |h %></A>)
</TD>
<TD CLASS="grid" BGCOLOR="#dddddd"></TD>
@@ -386,6 +400,17 @@ function show_history () {
</TR>
</%def>
+<%def .hide_history_row>
+% my $num = shift;
+ <TR ID="old_history<% $num %>" STYLE="display: none">
+ <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
+ <TD CLASS="grid" BGCOLOR="#dddddd">
+ <I>(<A HREF="#" onclick="update_show_history(false)"><% mt('hide prior history') |h %></A>)</I>
+ </TD>
+ <TD CLASS="grid" BGCOLOR="#dddddd" COLSPAN=5></TD>
+ </TR>
+</%def>
+
<%shared>
my $conf = new FS::Conf;
my $date_format = $conf->config('date_format') || '%m/%d/%Y';