수입·이체·상환은 카드/대출에서 나가지 않으므로 카드 제외(대출은 이미 제외). 구분 변경 시 허용 안 되는 계좌 종류면 초기화. AccountView·RecurringView 동일 적용. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -347,7 +347,15 @@ const WALLET_KINDS = [
|
|||||||
{ value: 'INVEST', label: '증권' },
|
{ value: 'INVEST', label: '증권' },
|
||||||
]
|
]
|
||||||
// 출금/결제 계좌 종류 뱃지에서는 대출 제외 — 대출은 지출·이체의 '출처'가 아니라 상환 대상
|
// 출금/결제 계좌 종류 뱃지에서는 대출 제외 — 대출은 지출·이체의 '출처'가 아니라 상환 대상
|
||||||
const FROM_WALLET_KINDS = WALLET_KINDS.filter((k) => k.value !== 'LOAN')
|
// 출금/결제 계좌 종류: 대출은 항상 제외(상환 대상), 카드는 '지출'(카드결제)일 때만 노출.
|
||||||
|
// 수입·이체·상환은 카드/대출에서 나가지 않음.
|
||||||
|
const fromWalletKinds = computed(() =>
|
||||||
|
WALLET_KINDS.filter((k) => {
|
||||||
|
if (k.value === 'LOAN') return false
|
||||||
|
if (k.value === 'CARD') return form.type === 'EXPENSE'
|
||||||
|
return true
|
||||||
|
}),
|
||||||
|
)
|
||||||
const TYPES = [
|
const TYPES = [
|
||||||
{ value: 'EXPENSE', label: '지출', cls: 'chip-expense' },
|
{ value: 'EXPENSE', label: '지출', cls: 'chip-expense' },
|
||||||
{ value: 'INCOME', label: '수입', cls: 'chip-income' },
|
{ value: 'INCOME', label: '수입', cls: 'chip-income' },
|
||||||
@@ -402,9 +410,13 @@ async function loadCategories() {
|
|||||||
// 필터용 전체 분류명 (중복 제거)
|
// 필터용 전체 분류명 (중복 제거)
|
||||||
const allCategoryNames = computed(() => [...new Set(categories.value.map((c) => c.name))])
|
const allCategoryNames = computed(() => [...new Set(categories.value.map((c) => c.name))])
|
||||||
|
|
||||||
// 구분(수입/지출/이체) 변경 시 분류 초기화
|
// 구분(수입/지출/이체) 변경 시 분류 초기화 + 새 구분에서 허용 안 되는 계좌 종류면 초기화
|
||||||
function onTypeChange() {
|
function onTypeChange() {
|
||||||
form.category = ''
|
form.category = ''
|
||||||
|
if (!fromWalletKinds.value.some((k) => k.value === form.walletKind)) {
|
||||||
|
form.walletKind = ''
|
||||||
|
form.walletId = ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 태그 (태그 관리에 등록된 태그 선택)
|
// 태그 (태그 관리에 등록된 태그 선택)
|
||||||
@@ -1148,7 +1160,7 @@ onMounted(async () => {
|
|||||||
<div class="field">
|
<div class="field">
|
||||||
<span class="field-label">계좌 종류</span>
|
<span class="field-label">계좌 종류</span>
|
||||||
<div class="wallet-chips">
|
<div class="wallet-chips">
|
||||||
<button v-for="k in FROM_WALLET_KINDS" :key="k.value" type="button"
|
<button v-for="k in fromWalletKinds" :key="k.value" type="button"
|
||||||
class="chip" :class="{ active: form.walletKind === k.value }"
|
class="chip" :class="{ active: form.walletKind === k.value }"
|
||||||
:disabled="submitting" @click="form.walletKind = k.value; onWalletKindChange()">
|
:disabled="submitting" @click="form.walletKind = k.value; onWalletKindChange()">
|
||||||
{{ k.label }}
|
{{ k.label }}
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ const WALLET_KINDS = [
|
|||||||
]
|
]
|
||||||
const walletsOfKind = computed(() => wallets.value.filter((w) => w.type === form.walletKind))
|
const walletsOfKind = computed(() => wallets.value.filter((w) => w.type === form.walletKind))
|
||||||
const toWalletsOfKind = computed(() => wallets.value.filter((w) => w.type === form.toWalletKind))
|
const toWalletsOfKind = computed(() => wallets.value.filter((w) => w.type === form.toWalletKind))
|
||||||
|
// 출금 계좌 종류: 카드는 '지출'(카드결제)일 때만. 수입·이체는 카드에서 나가지 않음
|
||||||
|
const fromWalletKinds = computed(() =>
|
||||||
|
WALLET_KINDS.filter((k) => k.value !== 'CARD' || form.type === 'EXPENSE'),
|
||||||
|
)
|
||||||
// 계좌 선택 칩 옵션
|
// 계좌 선택 칩 옵션
|
||||||
function walletOpts(list) {
|
function walletOpts(list) {
|
||||||
return list.map((w) => ({ value: w.id, label: `${w.name}${w.issuer ? ` (${w.issuer})` : ''}` }))
|
return list.map((w) => ({ value: w.id, label: `${w.name}${w.issuer ? ` (${w.issuer})` : ''}` }))
|
||||||
@@ -73,7 +77,13 @@ function walletKindOf(id) {
|
|||||||
}
|
}
|
||||||
function onWalletKindChange() { form.walletId = '' }
|
function onWalletKindChange() { form.walletId = '' }
|
||||||
function onToWalletKindChange() { form.toWalletId = '' }
|
function onToWalletKindChange() { form.toWalletId = '' }
|
||||||
function onTypeChange() { form.category = '' }
|
function onTypeChange() {
|
||||||
|
form.category = ''
|
||||||
|
if (!fromWalletKinds.value.some((k) => k.value === form.walletKind)) {
|
||||||
|
form.walletKind = ''
|
||||||
|
form.walletId = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function won(n) { return (n ?? 0).toLocaleString('ko-KR') }
|
function won(n) { return (n ?? 0).toLocaleString('ko-KR') }
|
||||||
function typeLabel(t) {
|
function typeLabel(t) {
|
||||||
@@ -295,7 +305,7 @@ onMounted(load)
|
|||||||
<span class="field-label">{{ form.type === 'TRANSFER' ? '출금 계좌' : '계좌/카드' }}</span>
|
<span class="field-label">{{ form.type === 'TRANSFER' ? '출금 계좌' : '계좌/카드' }}</span>
|
||||||
<div class="wallet-chips">
|
<div class="wallet-chips">
|
||||||
<button
|
<button
|
||||||
v-for="k in WALLET_KINDS" :key="k.value"
|
v-for="k in fromWalletKinds" :key="k.value"
|
||||||
type="button" class="chip" :class="{ active: form.walletKind === k.value }"
|
type="button" class="chip" :class="{ active: form.walletKind === k.value }"
|
||||||
:disabled="submitting"
|
:disabled="submitting"
|
||||||
@click="form.walletKind = k.value; onWalletKindChange()"
|
@click="form.walletKind = k.value; onWalletKindChange()"
|
||||||
|
|||||||
Reference in New Issue
Block a user