90 lines
2.5 KiB
JavaScript
90 lines
2.5 KiB
JavaScript
$(function() {
|
|
|
|
|
|
|
|
//$('select').material_select(); //new transfer form doesn't work whithout it
|
|
|
|
$('').attr('id', 'value');
|
|
$( "#draggable" ).draggable();
|
|
// Initialize collapse button
|
|
//$(".button-collapse").sideNav({
|
|
// menuWidth: 300, // Default is 240
|
|
// edge: 'left', // Choose the horizontal origin
|
|
// closeOnClick: true // Closes side-nav on <a> clicks, useful for Angular/Meteor
|
|
// });
|
|
|
|
// Initialize collapsible (uncomment the line below if you use the dropdown variation)
|
|
// $('.collapsible').collapsible();
|
|
|
|
/*
|
|
$(".dropdown-button").dropdown();
|
|
|
|
$('#id_tr_date').pickadate({
|
|
format: 'dd.mm.yyyy',
|
|
selectMonths: true,
|
|
selectYears: true,
|
|
closeOnSelect: false,
|
|
closeOnClear: true
|
|
});
|
|
*/
|
|
|
|
//categories with negative balance are red
|
|
var rows = $("td.balance");
|
|
var cats = $("tr.category");
|
|
for (i=0; i<rows.length; i++) {
|
|
if (rows[i].innerHTML < 0) {
|
|
cats[i].style.color = "red";
|
|
}
|
|
}
|
|
})
|
|
|
|
function ModalForm(id) {
|
|
if (id == '0') {
|
|
$("input[name='tr_date']").attr('value', Date());
|
|
$.ajax({
|
|
data: {id: id},
|
|
success: function(form){console.log("new"); $("#form").html(form +
|
|
'<button type="submit" name="action" value="create" class="waves-effect waves-light btn-large blue">Save</button>')}
|
|
})
|
|
} else {
|
|
$("input[name='id']").attr('value', id);
|
|
$.ajax({
|
|
data: {id: id},
|
|
success: function(form){console.log("edit"); $("#form").html(form +
|
|
'<button type="submit" name="action" value="edit" class="waves-effect waves-light btn-large blue">Save</button>' +
|
|
'<button type="submit" name="action" value="delete" class="waves-effect waves-light btn-large blue">Delete</button>')}
|
|
})
|
|
}
|
|
}
|
|
/*
|
|
function TrModalForm(id) {
|
|
$("input[name='id']").attr('value', id);
|
|
var type = $('#id_tr_type').value;
|
|
console.log(type);
|
|
console.log("test");
|
|
$.ajax({
|
|
data: {id: id, type: $('#id_tr_type').value},
|
|
success: function(form){console.log(form); $("#form").html(form)}
|
|
})
|
|
}
|
|
*/
|
|
|
|
function showMenu() {
|
|
if ($("#dropdown-content").css("display") == "none") {
|
|
$("#dropdown-content").css("display","block");
|
|
} else {
|
|
$("#dropdown-content").css("display","none");
|
|
}
|
|
}
|
|
|
|
function showSideMenu() {
|
|
if ($("#sideMenu").css("display") == "none") {
|
|
$("#sideMenu").css("display","block");
|
|
$("#underlayer").css("display","block");
|
|
} else {
|
|
$("#sideMenu").css("display","none");
|
|
$("#underlayer").css("display","none");
|
|
}
|
|
}
|
|
|