This commit is contained in:
Vladimir Voronin
2025-01-06 16:30:22 +03:00
parent bc7c08cefc
commit e09fe77a5e
29 changed files with 911 additions and 553 deletions

View File

@@ -8,7 +8,6 @@ import DatePicker from "primevue/datepicker";
import {onMounted, ref} from "vue";
import {getMonthName} from "@/utils/utils";
import {Budget} from "@/models/Budget";
import {createBudget} from "@/services/budgetsService";
const props = defineProps({
opened: {
@@ -28,10 +27,10 @@ const budget = ref(new Budget())
const create = async () => {
console.log(budget.value)
try {
await createBudget(budget.value, createRecurrentPayments.value)
emits("budget-created");
emits("budget-created", budget.value, createRecurrentPayments.value);
} catch (e) {
console.error(e)
throw e
}
}
@@ -40,7 +39,7 @@ const cancel = () => {
emits("close-modal");
}
onMounted(() => {
const resetForm = () => {
budget.value.name = ''
budget.value.dateTo = new Date();
budget.value.dateFrom = new Date();
@@ -58,8 +57,10 @@ onMounted(() => {
budget.value.dateTo.setMonth(budget.value.dateTo.getMonth() + 2)
}
budget.value.name = getMonthName(budget.value.dateFrom.getMonth()) + ' ' + budget.value.dateFrom.getFullYear();
}
onMounted(() => {
resetForm()
})
</script>