af6ef22752c778b2d74c0a35fce5f00d1506b9a8
[kivitendo-erp.git] / templates / webpages / bank_transactions / list.html
1 [%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]
2
3 <h1>[% title %]</h1>
4
5 [%- INCLUDE 'common/flash.html' %]
6
7 <p>[% HTML.escape(bank_account.name) %] [% HTML.escape(bank_account.iban) %], [% 'Bank code' | $T8 %] [% HTML.escape(bank_account.bank_code) %], [% 'Bank' | $T8 %] [% HTML.escape(bank_account.bank) %]</p>
8 <p>
9 [% IF FORM.filter.fromdate %] [% 'From' | $T8 %] [% FORM.filter.fromdate %] [% END %]
10 [% IF FORM.filter.todate %]   [% 'to (date)' | $T8 %] [% FORM.filter.todate %][% END %]
11 </p>
12
13 <form method="post" id="list_form">
14 [% L.hidden_tag('filter.bank_account', FORM.filter.bank_account) %]
15 [% L.hidden_tag('filter.fromdate', FORM.filter.fromdate) %]
16 [% L.hidden_tag('filter.todate',   FORM.filter.todate) %]
17
18 <div class="tabwidget">
19   <ul>
20     <li><a href="#all" onclick="show_invoice_button();">[% 'All transactions' | $T8 %]</a></li>
21     <li><a href="#automatic" onclick="show_proposal_button();">[% 'Proposals' | $T8 %]</a></li>
22   </ul>
23
24   <div id="all">[% PROCESS "bank_transactions/tabs/all.html" %]</div>
25   <div id="automatic">[% PROCESS "bank_transactions/tabs/automatic.html" %]</div>
26 </div>
27
28 [% L.hidden_tag('action', 'BankTransaction/dispatch') %]
29 [% L.submit_tag('action_save_invoices', LxERP.t8('Save invoices')) %]
30 [% L.submit_tag('action_save_proposals', LxERP.t8('Save proposals'), style='display: none') %]
31
32 </form>
33
34 <script type="text/javascript">
35 <!--
36
37 $(function() {
38   $('#check_all').checkall('INPUT[name^="proposal_ids"]');
39 });
40
41 $(function() {
42   $('.sort_link').each(function() {
43     var _href = $(this).attr("href");
44     $(this).attr("href", _href + "&filter.fromdate=" + "[% FORM.filter.fromdate %]" + "&filter.todate=" + "[% FORM.filter.todate %]");
45   });
46 });
47
48 function show_invoice_button () {
49   $("#action_save_proposals").hide();
50   $("#action_save_invoices").show();
51 }
52
53 function show_proposal_button () {
54   $("#action_save_invoices").hide();
55   $("#action_save_proposals").show();
56 }
57
58 function assign_invoice(bt_id) {
59   kivi.popup_dialog({
60     url:    'controller.pl?action=BankTransaction/assign_invoice',
61     data:   '&bt_id=' + bt_id,
62     type:   'POST',
63     id:     'assign_invoice_window',
64     dialog: { title: kivi.t8('Assign invoice') }
65   });
66   return true;
67 }
68
69 function add_invoices(bt_id, prop_id, prop_invnumber) {
70   // prop_id is a proposed invoice_id
71   // remove the added invoice from all the other suggestions
72   var number_of_elements = document.getElementsByName(prop_id).length;
73   for( var i = 0; i < number_of_elements; i++ ) {
74     var node = document.getElementsByName(prop_id)[0];
75     node.parentNode.removeChild(node);
76   }
77   var invoices = document.getElementById('assigned_invoices_' + bt_id);
78
79   $.ajax({
80     url: 'controller.pl?action=BankTransaction/ajax_payment_suggestion&bt_id=' + bt_id  + '&prop_id=' + prop_id,
81     success: function(data) {
82       invoices.innerHTML += data.html;
83     }
84   });
85 }
86
87 function delete_invoice(bt_id, prop_id) {
88   $( "#" + bt_id + "\\." + prop_id ).remove();
89 }
90
91 function create_invoice(bt_id) {
92   kivi.popup_dialog({
93     url:    'controller.pl?action=BankTransaction/create_invoice',
94     data:   '&bt_id=' + bt_id + "&filter.bank_account=[% FORM.filter.bank_account %]&filter.todate=[% FORM.filter.todate %]&filter.fromdate=[% FORM.filter.fromdate %]",
95     type:   'POST',
96     id:     'create_invoice_window',
97     dialog: { title: kivi.t8('Create invoice') }
98   });
99   return true;
100 }
101
102 //-->
103 </script>