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