@@ -, +, @@
---
.../intranet-tmpl/prog/js/cashup_modal.js | 88 ++++++++++---------
1 file changed, 45 insertions(+), 43 deletions(-)
--- a/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js
+++ a/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js
@@ -1,52 +1,54 @@
-$('#cashupSummaryModal').on('show.bs.modal', function(e) {
- var button = $(e.relatedTarget);
- var cashup = button.data('cashup');
- var description = button.data('register');
- var summary_modal = $(this);
- summary_modal.find('#register_description').text(description);
- $.ajax({
- url: '/api/v1/cashups/' + cashup,
- headers: {
- 'x-koha-embed': 'summary'
- },
- async: false,
- success: function(data) {
- summary_modal.find('#from_date').text(data.summary.from_date);
- summary_modal.find('#to_date').text(data.summary.to_date);
- var tbody = summary_modal.find('tbody')
- tbody.empty();
- for (out of data.summary.payout_grouped) {
- tbody.append('
' + out.credit_type.description + ' | - ' + out.total + ' |
');
- }
+$(document).ready(function(){
+ $('#cashupSummaryModal').on('show.bs.modal', function(e) {
+ var button = $(e.relatedTarget);
+ var cashup = button.data('cashup');
+ var description = button.data('register');
+ var summary_modal = $(this);
+ summary_modal.find('#register_description').text(description);
+ $.ajax({
+ url: '/api/v1/cashups/' + cashup,
+ headers: {
+ 'x-koha-embed': 'summary'
+ },
+ async: false,
+ success: function(data) {
+ summary_modal.find('#from_date').text(data.summary.from_date);
+ summary_modal.find('#to_date').text(data.summary.to_date);
+ var tbody = summary_modal.find('tbody')
+ tbody.empty();
+ for (out of data.summary.payout_grouped) {
+ tbody.append('' + out.credit_type.description + ' | - ' + out.total + ' |
');
+ }
- for (income of data.summary.income_grouped) {
- tbody.append('' + income.debit_type.description + ' | ' + income.total + ' |
');
- }
+ for (income of data.summary.income_grouped) {
+ tbody.append('' + income.debit_type.description + ' | ' + income.total + ' |
');
+ }
- var tfoot = summary_modal.find('tfoot');
- tfoot.empty();
- tfoot.append('Total | ' + data.summary.total + ' |
');
- for (type of data.summary.total_grouped) {
- if (type.total !== 0) {
- tfoot.append('' + type.payment_type + ' | ' + type.total + ' |
');
+ var tfoot = summary_modal.find('tfoot');
+ tfoot.empty();
+ tfoot.append('Total | ' + data.summary.total + ' |
');
+ for (type of data.summary.total_grouped) {
+ if (type.total !== 0) {
+ tfoot.append('' + type.payment_type + ' | ' + type.total + ' |
');
+ }
}
}
- }
+ });
});
-});
-$('.modal.printable').on('shown.bs.modal', function() {
- $('.modal-dialog', this).addClass('focused');
- $('body').addClass('modalprinter');
+ $('.modal.printable').on('shown.bs.modal', function() {
+ $('.modal-dialog', this).addClass('focused');
+ $('body').addClass('modalprinter');
- if ($(this).hasClass('autoprint')) {
- window.print();
- }
-}).on('hidden.bs.modal', function() {
- $('.modal-dialog', this).removeClass('focused');
- $('body').removeClass('modalprinter');
-});
+ if ($(this).hasClass('autoprint')) {
+ window.print();
+ }
+ }).on('hidden.bs.modal', function() {
+ $('.modal-dialog', this).removeClass('focused');
+ $('body').removeClass('modalprinter');
+ });
-$('.printModal').click(function() {
- window.print();
+ $('.printModal').click(function() {
+ window.print();
+ });
});
--