Select Git revision
TestSensorLineChartTile.py
-
Robert Goldmann authoredRobert Goldmann authored
transactions.js 16.67 KiB
$(document).ready(function()
{
let pickerEndDate;
// open filter modal if corresponding anchor is in url (originating from hotkeys.js)
if(window.location.href.endsWith('#modalFilter'))
{
$('#modalFilter').modal('open');
}
if($("#transaction-name").length)
{
let elements = document.querySelectorAll('#transaction-name');
let autoCompleteInstances = M.Autocomplete.init(elements, {
data: transactionNameSuggestions,
});
// prevent tab traversal for dropdown (otherwise "tab" needs to be hit twice to jump from name input to amount input)
autoCompleteInstances[0].dropdown.dropdownEl.tabIndex = -1;
document.getElementById('transaction-name').focus();
}
if($("#transaction-description").length)
{
$("#transaction-description").characterCounter();
}
if($(".datepicker-simple".length) && $("#transaction-repeating-end-date-input").length)
{
let pickerEndDate = document.getElementById('transaction-repeating-end-date-input');
// select corresponding radio button
let endDate = document.getElementById("repeating-end-date");
pickerEndDate.addEventListener('input', function()
{
endDate.checked = true;
});
pickerEndDate.addEventListener('focus', function()
{
endDate.checked = true;
});
}
if($(".datepicker").length)
{
let pickerStartDate = M.Datepicker.init(document.getElementById('transaction-datepicker'), {
yearRange: 25,
firstDay: 1,
showClearBtn: false,
defaultDate: startDate,
autoClose: true,
i18n: {
// Strings and translations
months: monthNames,
monthsShort: monthNamesShort,
weekdays: weekDays,
weekdaysShort: weekDaysShort,
weekdaysAbbrev: weekDaysLetters,
// Buttons
cancel: buttonCancel,
done: buttonClose,
// Accessibility labels
labelMonthNext: '>',
labelMonthPrev: '<'