use SL::Iconv;
use SL::TODO;
use SL::Printer;
-use CGI::Ajax;
use CGI;
require "bin/mozilla/common.pl";
$ca->{link_edit_account} = $link_edit_account . '&id=' . E($ca->{id});
}
- # Ajax
- my $pjx = new CGI::Ajax('list_account_details' => build_std_url('action=list_account_details'));
-
- # Eneable AJAX debuging
- #$pjx->DEBUG(1);
- #$pjx->JSDEBUG(1);
-
- push(@ { $form->{AJAX} }, $pjx);
-
$form->use_stylesheet("list_accounts.css");
$form->{title} = $locale->text('Chart of Accounts');
}
$form->{title} = $locale->text('Chart of Accounts');
- $form->header();
- print $form->parse_html_template('am/list_account_details');
+ print $form->ajax_response_header, $form->parse_html_template('am/list_account_details');
$main::lxdebug->leave_sub();
[%- USE T8 %]
-[% USE HTML %]<body>
-
- <br/><div id='pjxdebugrequest'></div><br/>
-
- <div class="coa_listtop">[% title %]</div>
-
- <br />
+[%- USE HTML %]
+<body>
+ <h1>[% title %]</h1>
<table width="100%">
<col width="10%">
</colgroup>
- <tr class="coa_listheading">
- <td class="coa_listheading_element">[% 'Account' | $T8 %]</td>
- <td colspan="3" class="coa_listheading_element">[% 'Description (Click on Description for details)' | $T8 %]</td>
- <td class="coa_listheading_element">[% 'Debit' | $T8 %]</td>
- <td class="coa_listheading_element">[% 'Credit' | $T8 %]</td>
+ <tr class="listheading">
+ <th>[% 'Account' | $T8 %]</td>
+ <th colspan="3">[% 'Description (Click on Description for details)' | $T8 %]</td>
+ <th>[% 'Debit' | $T8 %]</td>
+ <th>[% 'Credit' | $T8 %]</td>
</tr>
- [% SET row_odd = '1' %][% FOREACH row = CA %]
-
- [% IF row.heading %]
- <tr>
- <td class="accountlistheading"><a href="[% row.link_edit_account %]">[% HTML.escape(row.accno) %]</a></td>
- <td colspan="5" class="accountlistheading">[% HTML.escape(row.description) %]</td>
+[%- FOREACH row = CA %]
+ [%- IF row.heading %]
+ <tr class="listheading">
+ <td><a href="[% row.link_edit_account %]">[% row.accno | html %]</a></td>
+ <td colspan="5">[% row.description | html %]</td>
</tr>
-
- [% ELSE %]
-
- <tr class="coa_listrow[% IF row_odd %]1[% SET row_odd = '0' %][% ELSE %]0[% SET row_odd = '1' %][% END %]">
-
- <td class="coa_account_header">
- <b><a href="[% row.link_edit_account %]" >[% HTML.escape(row.accno) %]</a></b>
- </td>
-
- <input type="hidden" name="chart_id" value="[% HTML.escape(row.id) %]" id="chart_id_[% HTML.escape(row.id) %]" >
- <td colspan="3" id="accountcontent[% HTML.escape(row.id) %]-title" class="coa_account_header_sc"
- onclick="list_account_details( ['chart_id_[% HTML.escape(row.id) %]'], ['ajaxcontent[% HTML.escape(row.id) %]'] )">
- [% HTML.escape(row.description) %]
- </td>
-
- <td class="coa_account_header"><div class="coa_amount">[% HTML.escape(row.debit) %]</div></td>
- <td class="coa_account_header"><div class="coa_amount">[% HTML.escape(row.credit) %]</div>
- </td>
+ [% ELSE %]
+ <tr class="listrow[% loop.count % 2 %]">
+ <td><b><a href="[% row.link_edit_account %]">[% row.accno | html %]</a></b></td>
+ <td colspan="3" onclick="account_details([% row.id %])">[% row.description | html %]</td>
+ <td class='numeric'>[% row.debit | html %]</td>
+ <td class='numeric'>[% row.credit | html %]</td>
</tr>
- <tr class="coa_detail">
- <td colspan="6" width="100%"><div id="ajaxcontent[% HTML.escape(row.id) %]"></div></td>
+ <tr id="ajaxrow[% row.id %]" style="display:none", onclick="$(this).toggle()">
+ <td colspan="6" width="100%"><div id="ajaxcontent[% row.id %]"></div></td>
</tr>
-
- [% END %]
-
- [% END %]
+ [% END %]
+[% END %]
</table>
</body>
+<script type='text/javascript'>
+ function account_details(id) {
+ $.ajax({
+ url: 'am.pl?action=list_account_details',
+ data: { args: id },
+ dataType: 'html',
+ success: function (data) { $('#ajaxcontent' + id).html(data) },
+ });
+ $('#ajaxrow' + id).toggle();
+ }
+</script>
+
+
</html>