- 신규 추가 폼: 자주 쓰는 내역 선택해 폼 채우기(불러오기) 셀렉트 - '자주 쓰는 내역으로 저장' 버튼은 수정(editId) 시에만 노출 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -690,6 +690,25 @@ async function removeQuick(q) {
|
||||
flash(e.response?.data?.message || '삭제에 실패했습니다.')
|
||||
}
|
||||
}
|
||||
// 신규 추가 시: 자주 쓰는 내역을 폼에 불러오기(채움, 저장은 사용자가)
|
||||
function applyQuick(q) {
|
||||
if (!q) return
|
||||
form.type = q.type
|
||||
form.category = q.category || ''
|
||||
form.amount = q.amount
|
||||
form.memo = q.memo || ''
|
||||
if (q.walletId) {
|
||||
form.walletId = q.walletId
|
||||
form.walletKind = walletKindOf(q.walletId) || form.walletKind
|
||||
}
|
||||
syncCategoryMajor()
|
||||
}
|
||||
function onQuickPick(e) {
|
||||
const id = Number(e.target.value)
|
||||
e.target.value = '' // 다시 선택 가능하게 초기화
|
||||
const q = quickEntries.value.find((x) => x.id === id)
|
||||
if (q) applyQuick(q)
|
||||
}
|
||||
// 현재 폼 값을 자주 쓰는 내역으로 저장
|
||||
async function saveAsQuick() {
|
||||
if (form.type !== 'INCOME' && form.type !== 'EXPENSE') return
|
||||
@@ -960,6 +979,16 @@ onMounted(async () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 신규 추가 시: 자주 쓰는 내역 불러오기(폼 채움) -->
|
||||
<label v-if="!editId && quickEntries.length" class="quick-load">⭐ 자주 쓰는 내역 불러오기
|
||||
<select :disabled="submitting" @change="onQuickPick">
|
||||
<option value="">선택해서 불러오기</option>
|
||||
<option v-for="q in quickEntries" :key="q.id" :value="q.id">
|
||||
{{ quickLabel(q) }} · {{ q.type === 'INCOME' ? '+' : '-' }}{{ won(q.amount) }}
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label>거래일<input v-model="form.entryDate" type="date" :disabled="submitting" /></label>
|
||||
<label>구분
|
||||
<select v-model="form.type" :disabled="submitting" @change="onTypeChange">
|
||||
@@ -1081,7 +1110,7 @@ onMounted(async () => {
|
||||
>🔁 이 내역을 고정지출로 등록</button>
|
||||
|
||||
<button
|
||||
v-if="form.type === 'INCOME' || form.type === 'EXPENSE'"
|
||||
v-if="editId && (form.type === 'INCOME' || form.type === 'EXPENSE')"
|
||||
type="button"
|
||||
class="to-recurring to-quick"
|
||||
:disabled="submitting"
|
||||
|
||||
Reference in New Issue
Block a user