mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 00:12:11 +08:00
add transaction template
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user