fix that transaction list on to revert does not have multiple items
This commit is contained in:
parent
56b09abeaa
commit
ebffecd364
|
@ -10,8 +10,10 @@
|
|||
<div v-if="showSelector" class="col-6">
|
||||
<UserSelector v-model="user" />
|
||||
</div>
|
||||
<div class="col-1 justify-end">
|
||||
<q-btn round flat icon="mdi-format-list-checks" @click="openHistory" />
|
||||
<div class="col-1">
|
||||
<div class="row fit justify-end content-end items-end">
|
||||
<q-btn round flat icon="mdi-format-list-checks" @click="openHistory" />
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</template>
|
||||
|
|
24
src/store.ts
24
src/store.ts
|
@ -131,14 +131,14 @@ export const useBalanceStore = defineStore({
|
|||
user: FG.User,
|
||||
filter:
|
||||
| {
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
from?: Date;
|
||||
to?: Date;
|
||||
showReversals?: boolean;
|
||||
showCancelled?: boolean;
|
||||
descending?: boolean;
|
||||
}
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
from?: Date;
|
||||
to?: Date;
|
||||
showReversals?: boolean;
|
||||
showCancelled?: boolean;
|
||||
descending?: boolean;
|
||||
}
|
||||
| undefined = undefined
|
||||
) {
|
||||
if (!filter) filter = { limit: 10 };
|
||||
|
@ -146,7 +146,13 @@ export const useBalanceStore = defineStore({
|
|||
params: filter,
|
||||
});
|
||||
data.transactions.forEach((t) => fixTransaction(t));
|
||||
if (data.transactions) this.transactions.push(...data.transactions);
|
||||
if (data.transactions) {
|
||||
data.transactions.forEach((t) => {
|
||||
const idx = this.transactions.findIndex((x) => x.id === t.id);
|
||||
if (idx == -1) this.transactions.push(t);
|
||||
else this.transactions[idx] = t;
|
||||
});
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue