add transaction template

This commit is contained in:
MaysWind
2024-07-29 00:53:19 +08:00
parent 4c69243bef
commit de086aa29e
25 changed files with 2109 additions and 44 deletions
+8
View File
@@ -37,6 +37,10 @@ export function categoryTypeToTransactionType(categoryType) {
}
export function getTransactionPrimaryCategoryName(categoryId, allCategories) {
if (!allCategories) {
return '';
}
for (let i = 0; i < allCategories.length; i++) {
for (let j = 0; j < allCategories[i].subCategories.length; j++) {
const subCategory = allCategories[i].subCategories[j];
@@ -50,6 +54,10 @@ export function getTransactionPrimaryCategoryName(categoryId, allCategories) {
}
export function getTransactionSecondaryCategoryName(categoryId, allCategories) {
if (!allCategories) {
return '';
}
for (let i = 0; i < allCategories.length; i++) {
for (let j = 0; j < allCategories[i].subCategories.length; j++) {
const subCategory = allCategories[i].subCategories[j];
+48
View File
@@ -517,6 +517,54 @@ export default {
id
});
},
getAllTransactionTemplates: ({ templateType }) => {
return axios.get('v1/transaction/templates/list.json?templateType=' + templateType);
},
getTransactionTemplate: ({ id }) => {
return axios.get('v1/transaction/templates/get.json?id=' + id);
},
addTransactionTemplate: ({ templateType, name, clientSessionId }) => {
return axios.post('v1/transaction/templates/add.json', {
templateType,
name,
clientSessionId
});
},
modifyTransactionNameTemplate: ({ id, name }) => {
return axios.post('v1/transaction/templates/modify_name.json', {
id,
name
});
},
modifyTransactionTemplate: ({ id, type, categoryId, sourceAccountId, destinationAccountId, sourceAmount, destinationAmount, tagIds, comment }) => {
return axios.post('v1/transaction/templates/modify.json', {
id,
type,
categoryId,
sourceAccountId,
destinationAccountId,
sourceAmount,
destinationAmount,
tagIds,
comment
});
},
hideTransactionTemplate: ({ id, hidden }) => {
return axios.post('v1/transaction/templates/hide.json', {
id,
hidden
});
},
moveTransactionTemplate: ({ newDisplayOrders }) => {
return axios.post('v1/transaction/templates/move.json', {
newDisplayOrders,
});
},
deleteTransactionTemplate: ({ id }) => {
return axios.post('v1/transaction/templates/delete.json', {
id
});
},
getLatestExchangeRates: ({ ignoreError }) => {
return axios.get('v1/exchange_rates/latest.json', {
ignoreError: !!ignoreError