chet novoe
This commit is contained in:
@@ -16,15 +16,20 @@ const props = defineProps(
|
||||
transaction: {
|
||||
type: Object as PropType<Transaction>,
|
||||
required: true,
|
||||
},
|
||||
isList: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
}
|
||||
}
|
||||
)
|
||||
const emits = defineEmits(['open-drawer'])
|
||||
const emits = defineEmits(['open-drawer', 'transaction-checked', 'transaction-updated'])
|
||||
|
||||
|
||||
const setIsDoneTrue = async () => {
|
||||
setTimeout(async () => {
|
||||
await updateTransactionRequest(props.transaction)
|
||||
emits('transaction-checked')
|
||||
}, 10);
|
||||
// showedTransaction.value.isDone = !showedTransaction.value.isDone;
|
||||
|
||||
@@ -40,6 +45,11 @@ const toggleDrawer = () => {
|
||||
emits('open-drawer', props.transaction)
|
||||
}
|
||||
|
||||
const transactionUpdate = () => {
|
||||
console.log('my tut 1')
|
||||
emits('transaction-updated')
|
||||
}
|
||||
|
||||
const isPlanned = computed(() => {
|
||||
return props.transaction?.transactionType.code === "PLANNED"
|
||||
})
|
||||
@@ -86,25 +96,25 @@ onMounted(async () => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div :class="transaction.category.type.code == 'INCOME' ? 'from-green-100 to-green-50' : ' from-red-100 to-red-50' &&
|
||||
transaction.transactionType.code == 'INSTANT' ? ' bg-gradient-to-r shadow-lg border-2 gap-5 p-2 rounded-xl ' : 'border-b pb-2'
|
||||
<div :class="
|
||||
props.isList ? ' bg-gradient-to-r shadow-lg border-2 gap-5 p-2 rounded-xl me-5' : 'border-b pb-2'
|
||||
"
|
||||
class="flex bg-white min-w-fit max-h-fit flex-row items-center gap-4 w-full ">
|
||||
<div>
|
||||
<p v-if="transaction.transactionType.code=='INSTANT'"
|
||||
<p v-if="transaction.transactionType.code=='INSTANT' || props.isList"
|
||||
class="text-6xl font-bold text-gray-700 dark:text-gray-400">
|
||||
{{ transaction.category.icon }}</p>
|
||||
<Checkbox v-model="transaction.isDone" v-else-if="transaction.transactionType.code=='PLANNED'"
|
||||
<Checkbox v-model="transaction.isDone" v-else-if="transaction.transactionType.code=='PLANNED' && !props.isList"
|
||||
:binary="true"
|
||||
@click="setIsDoneTrue"/>
|
||||
</div>
|
||||
<button class="flex flex-row items-center p-x-4 justify-between w-full " @click="toggleDrawer">
|
||||
|
||||
<div class="flex flex-col items-start justify-items-start">
|
||||
<p :class="transaction.isDone && isPlanned ? 'line-through' : ''" class="font-bold">{{
|
||||
<p :class="transaction.isDone && isPlanned && !props.isList ? 'line-through' : ''" class="font-bold">{{
|
||||
transaction.comment
|
||||
}}</p>
|
||||
<p :class="transaction.isDone && isPlanned ? 'line-through' : ''" class="font-light">{{
|
||||
<p :class="transaction.isDone && isPlanned && !props.isList ? 'line-through' : ''" class="font-light">{{
|
||||
transaction.category.name
|
||||
}} |
|
||||
{{ formatDate(transaction.date) }}</p>
|
||||
@@ -122,7 +132,7 @@ onMounted(async () => {
|
||||
<TransactionEditDrawer v-if="drawerOpened" :visible="drawerOpened" :expenseCategories="expenseCategories"
|
||||
:incomeCategories="incomeCategories" :transaction="transaction"
|
||||
:category-types="categoryTypes"
|
||||
|
||||
@transaction-updated="transactionUpdate"
|
||||
@close-drawer="closeDrawer()"
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user