Initial commit
This commit is contained in:
29
app/components/debt/DebtCheckbox.vue
Normal file
29
app/components/debt/DebtCheckbox.vue
Normal file
@@ -0,0 +1,29 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
page: String, // Due/Overdue
|
||||
paymentScheduleId: Number,
|
||||
});
|
||||
const { $store } = useNuxtApp();
|
||||
$store.commit('selectedPaymentSchedulesForEmailInDue', []);
|
||||
$store.commit('selectedPaymentSchedulesForEmailInOverdue', []);
|
||||
const storeProp = `selectedPaymentSchedulesForEmailIn${props.page}`;
|
||||
</script>
|
||||
<template>
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="$store[storeProp].includes(props.paymentScheduleId)"
|
||||
@change="(e) => {
|
||||
if (e.target.checked) {
|
||||
$store.commit(
|
||||
storeProp,
|
||||
[ ...$store[storeProp], props.paymentScheduleId],
|
||||
)
|
||||
} else {
|
||||
$store.commit(
|
||||
storeProp,
|
||||
$store[storeProp].filter(x => x !== props.paymentScheduleId),
|
||||
)
|
||||
}
|
||||
}"
|
||||
/>
|
||||
</template>
|
||||
Reference in New Issue
Block a user