+
Transaction list
-
\ No newline at end of file
+
diff --git a/src/main.ts b/src/main.ts
index 5f4e0fc..abb382a 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -23,6 +23,20 @@ app.use(PrimeVue, {
preset: Aura
}
});
+
+app.config.globalProperties.$primevue.config.locale = {
+ firstDayOfWeek: 1, // Устанавливаем понедельник как первый день недели
+ dayNames: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"],
+ dayNamesShort: ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"],
+ dayNamesMin: ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"],
+ monthNames: ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"],
+ monthNamesShort: ["Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек"],
+ today: "Сегодня",
+ clear: "Очистить",
+ dateFormat: "dd.mm.yy",
+ weekHeader: "Нед",
+};
+
// main.js
if ("serviceWorker" in navigator) {
diff --git a/src/router/index.ts b/src/router/index.ts
index c53a3d7..c3dcd9d 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -8,11 +8,12 @@ import SettingsView from "@/components/settings/SettingsView.vue";
import RecurrentList from "@/components/settings/recurrent/RecurrentList.vue";
import TransactionList from "@/components/transactions/TransactionList.vue";
import LoginView from "@/components/auth/LoginView.vue";
+import AnalyticsView from "@/components/analytics/AnalyticsView.vue";
const routes = [
{path: '/login', component: LoginView},
{path: '/', name: 'Budgets main', component: BudgetList, meta: {requiresAuth: true}},
- {path: '/analytics', name: 'Analytics', component: BudgetList, meta: {requiresAuth: true}},
+ {path: '/analytics', name: 'Analytics', component: AnalyticsView, meta: {requiresAuth: true}},
{path: '/budgets', name: 'Budgets', component: BudgetList, meta: {requiresAuth: true}},
{path: '/budgets/:id', name: 'BudgetView', component: BudgetView, meta: {requiresAuth: true}},
{path: '/transactions/:mode*', name: 'Transaction List', component: TransactionList, meta: {requiresAuth: true}},
diff --git a/src/services/transactionService.ts b/src/services/transactionService.ts
index a33690f..da7c97d 100644
--- a/src/services/transactionService.ts
+++ b/src/services/transactionService.ts
@@ -7,7 +7,7 @@ export const getTransaction = async (transactionId: int) => {
return await apiClient.post(`/transactions/${transactionId}`,);
}
-export const getTransactions = async (transaction_type = null, category_type = null, category_id = null, user_id = null) => {
+export const getTransactions = async (transaction_type = null, category_type = null, category_id = null, user_id = null, limit = null, offset = null) => {
const params = {};
// Add the parameters to the params object if they are not null
@@ -25,6 +25,12 @@ export const getTransactions = async (transaction_type = null, category_type = n
if (user_id) {
params.user_id = user_id
}
+ if (limit) {
+ params.limit = limit
+ }
+ if (offset) {
+ params.offset = offset
+ }
// Use axios to make the GET request, passing the params as the second argument
return await apiClient.get('/transactions/', {
@@ -34,7 +40,10 @@ export const getTransactions = async (transaction_type = null, category_type = n
export const createTransactionRequest = async (transaction: Transaction) => {
transaction.date = format(transaction.date, 'yyyy-MM-dd')
- return await apiClient.post('/transactions', transaction);
+ let transactionResponse = await apiClient.post('/transactions', transaction);
+ console.log(transaction.date)
+ transaction.date = new Date(transaction.date);
+ return transactionResponse.data
};
export const updateTransactionRequest = async (transaction: Transaction) => {
@@ -63,4 +72,9 @@ export const deleteTransactionRequest = async (id: number) => {
export const getTransactionTypes = async () => {
return await apiClient.get('/transactions/types');
+}
+
+export const getTransactionCategoriesSums = async () => {
+ let response = await apiClient.get('/transactions/categories/_calc_sums');
+ return response.data;
}
\ No newline at end of file
diff --git a/src/stores/userStore.ts b/src/stores/userStore.ts
index 341eadd..90aa70c 100644
--- a/src/stores/userStore.ts
+++ b/src/stores/userStore.ts
@@ -20,7 +20,6 @@ export const useUserStore = defineStore('user', () => {
user.value = null;
} finally {
loadingUser.value = false; // Сбрасываем флаг `loadingUser` в `false` после завершения
- console.log('Загрузка завершена, loadingUser:', loadingUser.value);
}
}
}
diff --git a/src/utils/utils.ts b/src/utils/utils.ts
index d37b3bc..702c189 100644
--- a/src/utils/utils.ts
+++ b/src/utils/utils.ts
@@ -43,4 +43,17 @@ export const getMonthName = (month: number) => {
case 11:
return 'Декабрь'
}
-}
\ No newline at end of file
+}
+
+export const generateRandomColors = () => {
+
+ const r = Math.floor(Math.random() * 256);
+ const g = Math.floor(Math.random() * 256);
+ const b = Math.floor(Math.random() * 256);
+ const a = 0.5; // Прозрачность от 0.00 до 1.00
+
+ return [r,g,b]
+}
+
+// Пример использования
+