Skip to content

Commit

Permalink
fix(PWA): sync sanctioned amt with claimed amt only when claimed amou…
Browse files Browse the repository at this point in the history
…nt is edited

(cherry picked from commit 2ea2a13)
  • Loading branch information
ruchamahabal authored and mergify[bot] committed Dec 1, 2023
1 parent 1e17a74 commit b807cf2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion frontend/src/components/ExpensesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,14 @@ const expenseItem = ref({})
const editingIdx = ref(null)
const isModalOpen = ref(false)
const isFirstRender = ref(false)
const openModal = async (item, idx) => {
if (item) {
expenseItem.value = { ...item }
editingIdx.value = idx
}
isFirstRender.value = true
isModalOpen.value = true
}
Expand All @@ -184,6 +186,7 @@ const updateExpenseItem = () => {
}
function resetSelectedItem() {
isFirstRender.value = false
isModalOpen.value = false
expenseItem.value = {}
editingIdx.value = null
Expand Down Expand Up @@ -237,8 +240,10 @@ watch(
watch(
() => expenseItem.value.amount,
(value) => {
if (!expenseItem.value.sanctioned_amount) {
if (!isFirstRender.value) {
expenseItem.value.sanctioned_amount = parseFloat(value)
} else {
isFirstRender.value = false
}
}
)
Expand Down

0 comments on commit b807cf2

Please sign in to comment.