Added the transaction sorting in the accounting application.

This commit is contained in:
2020-08-06 23:51:20 +08:00
parent 9d49815462
commit f970974e71
8 changed files with 385 additions and 27 deletions

View File

@ -0,0 +1,43 @@
/* The Mia Website
* sort.css: The style sheet to reorder the transaction
*/
/* Copyright (c) 2019-2020 imacat.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Author: imacat@mail.imacat.idv.tw (imacat)
* First written: 2019/10/12
*/
ul.txn-content-expense {
margin: 0;
padding: 0 0 0 0;
}
ul.txn-content-expense li {
list-style-type: none;
}
.txn-content-income {
margin: 0 0 0 1em;
}
ul.txn-content-income {
margin: 0 0 0 1em;
padding: 0 0 0 0;
}
ul.txn-content-income li {
list-style-type: none;
}
.amount {
text-align: right;
}

View File

@ -0,0 +1,47 @@
/* The Mia Website
* sort.js: The JavaScript to reorder the transactions
*/
/* Copyright (c) 2019-2020 imacat.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Author: imacat@mail.imacat.idv.tw (imacat)
* First written: 2019/10/13
*/
// Initializes the page JavaScript.
$(function () {
$("#transactions").sortable({
classes: {
"ui-sortable-helper": "table-active",
},
cursor: "move",
stop: function () {
resetTransactionOrders();
},
});
});
/**
* Resets the order of the transactions according to their appearance.
*
* @private
*/
function resetTransactionOrders() {
const sorted = $("#transactions").sortable("toArray");
for (let i = 0; i < sorted.length; i++) {
$("#" + sorted[i] + "-ord")[0].value = i + 1;
}
}