This commit is contained in:
Vladimir Voronin
2024-10-24 23:18:56 +03:00
parent f2e94764a3
commit 95debfbd71
5 changed files with 55 additions and 54 deletions

View File

@@ -15,9 +15,6 @@
<script setup lang="ts"> <script setup lang="ts">
import MenuBar from "./components/MenuBar.vue"; import MenuBar from "./components/MenuBar.vue";
import OverlayView from "@/components/OverlayView.vue"; import OverlayView from "@/components/OverlayView.vue";
import axios from "@/plugins/axios";
console.log(axios)
// @Options({ // @Options({
// components: { // components: {

View File

@@ -85,11 +85,11 @@ onMounted(() => {
/> />
<SpeedDial :model="items" :radius="120" type="quarter" direction="up" <SpeedDial :model="items" :radius="120" type="quarter" direction="up"
class=" mb-10 h-fit" :style="{ position: 'fixed', right: 0, bottom: 0 }" class=" mb-10 h-fit !items-end me-10" :style="{ position: 'fixed', right: 0, bottom: 0 }"
pt:menuitem="m-2"> pt:menuitem="m-2">
<template #item="{ item, toggleCallback }" > <template #item="{ item, toggleCallback }" >
<div <div
class="flex flex-row items-center justify-between p-2 border w-56 bg-white rounded border-surface-200 dark:border-surface-700 cursor-pointer" class="flex flex-row items-start gap-2 justify-between right-10 p-2 border bg-white rounded border-surface-200 dark:border-surface-700 cursor-pointer"
@click="toggleCallback"> <!-- Установлена минимальная ширина --> @click="toggleCallback"> <!-- Установлена минимальная ширина -->
<span>{{ item.label }}</span> <span>{{ item.label }}</span>

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="p-4"> <div class="p-4">
<!-- Заголовок --> <!-- Заголовок -->
<h2 class="text-4xl mb-6 mt-14 font-bold">Monthly Budgets</h2> <h2 class="text-4xl mb-6 font-bold">Monthly Budgets</h2>
<!-- Плитка с бюджетами --> <!-- Плитка с бюджетами -->
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4"> <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">

View File

@@ -9,6 +9,7 @@ import {ref, onMounted, computed} from 'vue';
import {Transaction, TransactionType} from "@/models/Transaction"; import {Transaction, TransactionType} from "@/models/Transaction";
import {CategoryType} from "@/models/Category"; import {CategoryType} from "@/models/Category";
import SelectButton from "primevue/selectbutton"; import SelectButton from "primevue/selectbutton";
import Select from "primevue/select";
import { import {
createTransactionRequest, createTransactionRequest,
getTransactionTypes, getTransactionTypes,
@@ -166,8 +167,7 @@ const dateErrorMessage = computed(() => {
} else if (editedTransaction.value.transactionType.code == 'PLANNED' && editedTransaction.value.date < new Date()) { } else if (editedTransaction.value.transactionType.code == 'PLANNED' && editedTransaction.value.date < new Date()) {
console.log('tu3') console.log('tu3')
return 'При плановых тратах дата должна быть больше текущей!' return 'При плановых тратах дата должна быть больше текущей!'
} } else {
else {
console.log('tu4') console.log('tu4')
return '' return ''
} }
@@ -187,7 +187,7 @@ onMounted(async () => {
<template> <template>
<div class="card flex justify-center"> <div class="card flex justify-center h-dvh">
<Drawer :visible="visible" :header="isEditing ? 'Edit Transaction' : 'Create Transaction'" :showCloseIcon="false" <Drawer :visible="visible" :header="isEditing ? 'Edit Transaction' : 'Create Transaction'" :showCloseIcon="false"
position="right" @hide="closeDrawer" position="right" @hide="closeDrawer"
@@ -195,13 +195,13 @@ onMounted(async () => {
<div v-if="loading"> <div v-if="loading">
Loading... Loading...
</div> </div>
<div v-else class="p-fluid grid formgrid p-4 w-full gap-5"> <div v-else class=" grid gap-4 w-full ">
<div class="relative w-full justify-center justify-items-center "> <div class="relative w-full justify-center justify-items-center ">
<div class="flex flex-col justify-items-center gap-2"> <div class="flex flex-col justify-items-center gap-2">
<div class="flex flex-row gap-2">
<!-- {{editedTransaction.value.transactionType}}--> <!-- {{editedTransaction.value.transactionType}}-->
<SelectButton v-if="!isEditing" v-model="editedTransaction.transactionType" :allow-empty="false" <Select v-if="!isEditing" v-model="editedTransaction.transactionType" :allow-empty="false"
:options="transactionTypes" :options="transactionTypes"
optionLabel="name" optionLabel="name"
aria-labelledby="basic" aria-labelledby="basic"
@@ -210,6 +210,7 @@ onMounted(async () => {
optionLabel="name" optionLabel="name"
aria-labelledby="basic" aria-labelledby="basic"
@change="categoryTypeChanged" class="justify-center"/> @change="categoryTypeChanged" class="justify-center"/>
</div>
<button class="border border-gray-300 rounded-lg w-full z-50" <button class="border border-gray-300 rounded-lg w-full z-50"
@click="isCategorySelectorOpened = !isCategorySelectorOpened"> @click="isCategorySelectorOpened = !isCategorySelectorOpened">
<div class="flex flex-row items-center pe-4 py-2 "> <div class="flex flex-row items-center pe-4 py-2 ">
@@ -252,9 +253,26 @@ onMounted(async () => {
</div> </div>
</div> </div>
</div> </div>
<div class="grid grid-cols-4">
<div class=" ">
<FloatLabel variant="on" class="w-10">
<InputNumber class="!w-10"
:invalid="!editedTransaction.amount"
:minFractionDigits="0"
id="amount"
v-model="editedTransaction.amount"
mode="currency"
currency="RUB"
locale="ru-RU"
/>
<label for="amount" class="!w-10">Amount</label>
</FloatLabel>
</div>
<!-- Comment Input --> <!-- Comment Input -->
<div class="field col-12 w-full"> <div class="field col-12 col-span-3">
<FloatLabel variant="on" class="w-full"> <FloatLabel variant="on" class="l">
<label for="comment">Comment</label> <label for="comment">Comment</label>
<InputText class="w-full" <InputText class="w-full"
:invalid="!editedTransaction.comment" :invalid="!editedTransaction.comment"
@@ -264,6 +282,7 @@ onMounted(async () => {
/> />
</FloatLabel> </FloatLabel>
</div> </div>
</div>
<!-- Date Picker --> <!-- Date Picker -->
<div class="field col-12 gap-0"> <div class="field col-12 gap-0">
@@ -277,6 +296,7 @@ onMounted(async () => {
v-model="editedTransaction.date" v-model="editedTransaction.date"
dateFormat="yy-mm-dd" dateFormat="yy-mm-dd"
showIcon showIcon
/> />
<p :class="dateErrorMessage != '' ? 'visible' : 'invisible'" <p :class="dateErrorMessage != '' ? 'visible' : 'invisible'"
class="text-red-400">{{ dateErrorMessage }}</p> class="text-red-400">{{ dateErrorMessage }}</p>
@@ -286,21 +306,7 @@ onMounted(async () => {
</div> </div>
<!-- Amount Input --> <!-- Amount Input -->
<div class="field col-12">
<FloatLabel variant="on">
<InputNumber class="w-full"
:invalid="!editedTransaction.amount"
:minFractionDigits="0"
id="amount"
v-model="editedTransaction.amount"
mode="currency"
currency="RUB"
locale="ru-RU"
/>
<label for="amount">Amount</label>
</FloatLabel>
</div>
<!-- Buttons --> <!-- Buttons -->
<div class="field col-12 flex justify-content-end gap-4"> <div class="field col-12 flex justify-content-end gap-4">
@@ -318,7 +324,5 @@ onMounted(async () => {
</template> </template>
<style scoped> <style scoped>
.formgrid .field {
margin-bottom: 1rem;
}
</style> </style>

View File

@@ -3,7 +3,7 @@ import axios from 'axios';
// Создание экземпляра axios с базовым URL // Создание экземпляра axios с базовым URL
const apiClient = axios.create({ const apiClient = axios.create({
baseURL: 'https://luminic.space/api/v1', baseURL: 'http://localhost:8000/api/v1',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',