Skip to content

Commit

Permalink
add more transaction edit dialog basis code
Browse files Browse the repository at this point in the history
  • Loading branch information
mayswind committed Aug 14, 2023
1 parent 0ad72e8 commit ed0100a
Show file tree
Hide file tree
Showing 5 changed files with 245 additions and 42 deletions.
11 changes: 6 additions & 5 deletions src/components/desktop/AmountInput.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<template>
<v-text-field type="number" :class="extraClass"
:density="density" :disabled="disabled"
:label="label"
:placeholder="placeholder"
:persistent-placeholder="persistentPlaceholder"
<v-text-field :type="hide ? 'password' : 'number'" :class="extraClass"
:density="density" :readonly="!!readonly" :disabled="!!disabled"
:label="label" :placeholder="placeholder"
:persistent-placeholder="!!persistentPlaceholder"
:rules="enableRules ? rules : []" v-model="value"
@keydown="onKeyUpDown" @keyup="onKeyUpDown">
<template #prepend-inner v-if="currency && prependText">
Expand All @@ -30,6 +29,8 @@ export default {
'placeholder',
'persistentPlaceholder',
'disabled',
'readonly',
'hide',
'enableRules',
'modelValue'
],
Expand Down
12 changes: 8 additions & 4 deletions src/lib/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
getFirstAvailableCategoryId
} from './category.js';

export function setTransactionModelByTransaction(transaction, transaction2, allCategories, allCategoriesMap, allVisibleAccounts, allAccountsMap, defaultAccountId, options, isNew) {
export function setTransactionModelByTransaction(transaction, transaction2, allCategories, allCategoriesMap, allVisibleAccounts, allAccountsMap, defaultAccountId, options, setContextData) {
if ((!options.type || options.type === '0') && options.categoryId && options.categoryId !== '0' && allCategoriesMap[options.categoryId]) {
const category = allCategoriesMap[options.categoryId];
const type = categoryTypeToTransactionType(category.type);
Expand Down Expand Up @@ -85,7 +85,7 @@ export function setTransactionModelByTransaction(transaction, transaction2, allC
}

if (transaction2) {
if (!isNew) {
if (setContextData) {
transaction.id = transaction2.id;
}

Expand All @@ -99,7 +99,7 @@ export function setTransactionModelByTransaction(transaction, transaction2, allC
transaction.transferCategory = transaction2.categoryId;
}

if (!isNew) {
if (setContextData) {
transaction.utcOffset = transaction2.utcOffset;
transaction.timeZone = transaction2.timeZone;
transaction.time = getDummyUnixTimeForLocalUsage(transaction2.time, transaction.utcOffset, getBrowserTimezoneOffsetMinutes());
Expand All @@ -109,19 +109,23 @@ export function setTransactionModelByTransaction(transaction, transaction2, allC

if (transaction2.destinationAccountId) {
transaction.destinationAccountId = transaction2.destinationAccountId;
} else {
transaction.destinationAccountId = '';
}

transaction.sourceAmount = transaction2.sourceAmount;

if (transaction2.destinationAmount) {
transaction.destinationAmount = transaction2.destinationAmount;
} else {
transaction.destinationAccountId = 0;
}

transaction.hideAmount = transaction2.hideAmount;
transaction.tagIds = transaction2.tagIds || [];
transaction.comment = transaction2.comment;

if (!isNew) {
if (setContextData) {
transaction.geoLocation = transaction2.geoLocation;
}
}
Expand Down
8 changes: 0 additions & 8 deletions src/views/desktop/transactions/ListPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -998,14 +998,6 @@ export default {
height: 40px !important;
}
.transaction-table tr.transaction-table-row-data .hover-display {
display: none;
}
.transaction-table tr.transaction-table-row-data:hover .hover-display {
display: grid;
}
.transaction-table .transaction-table-column-time {
width: 110px;
white-space: nowrap;
Expand Down
Loading

0 comments on commit ed0100a

Please sign in to comment.