forked from alexrobaina/frontend_petsLove
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
daebf27
commit a5898d7
Showing
38 changed files
with
1,485 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"editExpense": "Edit expense", | ||
"addExpense": "Add expense", | ||
"title": "Title", | ||
"titlePlaceholder": "Enter title", | ||
"totalAmount": "Total amount", | ||
"type": "Type", | ||
"categoryPlaceholder": "Select category", | ||
"addItem": "Add items", | ||
"itemPrice": "Item price", | ||
"itemPricePlaceholder": "Enter item price", | ||
"totalIncome": "Total income", | ||
"totalExpense": "Total expense", | ||
"itemQuantity": "Item quantity", | ||
"inventoryPlaceholder": "Select inventory...", | ||
"expenseNotFound": "Expense not found", | ||
"dontHaveExpense": "You can start adding your incomes and expenses", | ||
"listOfExpenses": "List of expenses and incomes", | ||
"descriptionPlaceholder": "Enter description", | ||
"itemQuantityPlaceholder": "Enter item quantity", | ||
"selectInventory": "Select inventory", | ||
"expensesTitle": "Expense Tracker", | ||
"expensesSubtitle": "Track your expenses and incomes", | ||
"expensesDescription": "Expense Manager helps you track and manage your daily expenses with ease.", | ||
"typePlaceholder": "Select type of expense", | ||
"last": "Last" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"editExpense": "Editar gasto", | ||
"addExpense": "Agregar gasto", | ||
"title": "Titulo", | ||
"titlePlaceholder": "Titulo del gasto", | ||
"totalAmount": "Monto total", | ||
"type": "Tipo", | ||
"typePlaceholder": "Tipo de gasto", | ||
"categoryPlaceholder": "Categoria", | ||
"addItem": "Agregar items", | ||
"itemPrice": "Precio", | ||
"itemPricePlaceholder": "Precio del item", | ||
"itemQuantity": "Cantidad", | ||
"listOfExpenses": "Lista de ingresos y gastos", | ||
"expenseNotFound": "Gastos no encontrado", | ||
"dontHaveExpense": "Puedes comenzar a agregar tus ingresos y gastos", | ||
"inventoryPlaceholder": "Seleccionar inventario", | ||
"descriptionPlaceholder": "Descripcion del gasto", | ||
"itemQuantityPlaceholder": "Cantidad del item", | ||
"selectInventory": "Seleccionar inventario", | ||
"expensesTitle": "Gastos", | ||
"totalIncome": "Ingresos totales", | ||
"totalExpense": "Gastos totales", | ||
"expensesSubtitle": "Aqui puedes ver tus gastos", | ||
"expensesDescription": "Puedes ver tus gastos y agregar nuevos", | ||
"last": "Ultimo" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"editExpense": "Modifier les dépenses", | ||
"addExpense": "Ajouter des dépenses", | ||
"title": "Titre", | ||
"addItem": "Ajouter des articles", | ||
"titlePlaceholder": "Titre de la dépense", | ||
"expenseNotFound": "Dépense introuvable", | ||
"totalAmount": "Montant total", | ||
"type": "Type", | ||
"itemPrice": "Prix de l'article", | ||
"itemPricePlaceholder": "Prix de l'article", | ||
"inventoryPlaceholder": "Select Inventory", | ||
"itemQuantity": "Quantité de l'article", | ||
"dontHaveExpense": "Vous pouvez commencer à ajouter vos revenus et dépenses", | ||
"itemQuantityPlaceholder": "Quantité de l'article", | ||
"descriptionPlaceholder": "Description de la dépense", | ||
"expensesTitle": "Dépenses", | ||
"expensesSubtitle": "Ajoutez vos dépenses ici", | ||
"totalIncome": "Revenu total", | ||
"totalExpense": "Dépense totale", | ||
"analytics": "Analytique", | ||
"expensesDescription": "Ajoutez vos dépenses ici", | ||
"listOfExpenses": "Liste des dépenses", | ||
"selectInventory": "Sélectionner l'inventaire", | ||
"typePlaceholder": "Type de dépense", | ||
"categoryPlaceholder": "Catégorie de dépense", | ||
"last": "Dernier" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import axios from 'axios' | ||
|
||
const API_URL = '/api/v1' | ||
|
||
export const createExpense = async (data: { | ||
id: string | ||
totalAmount: number | ||
type: string | ||
category: string | ||
title: string | ||
description: string | ||
items: { | ||
title: string | ||
quantity: number | ||
price: number | ||
inventoryId: string | ||
}[] | ||
}) => { | ||
try { | ||
const response = await axios.post(`${API_URL}/expense`, data, { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}) | ||
return response.data | ||
} catch (error) { | ||
console.error(error) | ||
throw new Error('Failed to create expense') | ||
} | ||
} | ||
|
||
export const updateExpense = async (data: { | ||
id: string | ||
totalAmount: number | ||
type: string | ||
category: string | ||
title: string | ||
description: string | ||
items: { | ||
title: string | ||
quantity: number | ||
price: number | ||
inventoryId: string | ||
}[] | ||
}) => { | ||
try { | ||
console.log(data) | ||
|
||
const response = await axios.put(`${API_URL}/expense/${data.id}`, data, { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}) | ||
return response.data | ||
} catch (error) { | ||
console.error(error) | ||
throw new Error('Failed to update expense') | ||
} | ||
} | ||
|
||
export const deleteExpense = async (expenseId: string) => { | ||
try { | ||
const response = await axios.delete(`${API_URL}/expense/${expenseId}`) | ||
return response.data | ||
} catch (error) { | ||
console.error(error) | ||
throw new Error('Failed to delete expense') | ||
} | ||
} | ||
|
||
export const getExpense = async (expenseId: string) => { | ||
try { | ||
const response = await axios.get(`${API_URL}/expense/${expenseId}`) | ||
return response.data | ||
} catch (error) { | ||
console.error(error) | ||
throw new Error('Failed to fetch expense') | ||
} | ||
} | ||
|
||
export const listExpenses = async (filters: { | ||
title?: string | ||
type?: string | ||
category?: string | ||
page?: number | ||
startDate?: string | ||
endDate?: string | ||
amount?: string | ||
date?: string | ||
}) => { | ||
try { | ||
const response = await axios.get(`${API_URL}/expenses`, { params: filters }) | ||
return response.data | ||
} catch (error) { | ||
console.error(error) | ||
throw new Error('Failed to fetch expenses') | ||
} | ||
} | ||
|
||
export const getAnalytics = async () => { | ||
try { | ||
const response = await axios.get(`${API_URL}/expenses/analytics`) | ||
return response.data | ||
} catch (error) { | ||
console.error(error) | ||
throw new Error('Failed to fetch analytics') | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.