firefly-iii/public/js/ff/reports/default/all.js

54 lines
1.3 KiB
JavaScript
Raw Normal View History

2016-04-01 09:06:55 -05:00
/* globals startDate, endDate, reportType, accountIds */
/*
* all.js
2016-04-01 09:46:11 -05:00
* Copyright (C) 2016 thegrumpydictator@gmail.com
2016-04-01 09:06:55 -05:00
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
/**
* Created by sander on 01/04/16.
*/
$(function () {
"use strict";
// find the little info buttons and respond to them.
$('.firefly-info-button').click(clickInfoButton);
});
function clickInfoButton(e) {
"use strict";
// find all data tags, regardless of what they are:
var element = $(e.target);
var attributes = element.data();
2016-04-03 04:07:51 -05:00
// set wait cursor
$('body').addClass('waiting');
2016-04-01 09:06:55 -05:00
// add some more elements:
attributes.startDate = startDate;
attributes.endDate = endDate;
attributes.reportType = reportType;
attributes.accounts = accountIds;
$.getJSON('popup/report', {attributes: attributes}).done(respondInfoButton).fail(errorInfoButton);
2016-04-01 09:06:55 -05:00
}
function errorInfoButton(data) {
"use strict";
2016-04-03 04:07:51 -05:00
// remove wait cursor
$('body').removeClass('waiting');
alert('Apologies. The requested data is not (yet) available.');
2016-04-01 09:06:55 -05:00
}
function respondInfoButton(data) {
"use strict";
2016-04-03 04:07:51 -05:00
// remove wait cursor
$('body').removeClass('waiting');
2016-04-01 09:06:55 -05:00
$('#defaultModal').empty().html(data.html);
$('#defaultModal').modal('show');
}