Resolve "implement updating a category"
This commit is contained in:
parent
0ddfe3e606
commit
d7bb318c24
6 changed files with 25 additions and 14 deletions
|
|
@ -14,7 +14,7 @@ export default function Page() {
|
|||
const {data, isLoading, reFetch} = useFetch({sql: "SELECT e.guid AS expense_guid, e.name AS expense_name, c.name AS category_name, e.datetime AS expense_datetime, e.amount AS expense_amount, c.color AS category_color FROM expense e JOIN category c ON e.category_guid = c.guid WHERE c.guid = ? ORDER BY expense_datetime desc;", args: [category_guid]});
|
||||
|
||||
const handleEditCategory = () => {
|
||||
router.push({pathname: "./(tabs)/budget/editCategory", params: {category_guid: category_guid, category_color: category_color, category_amount: category_amount, category_name: category_name, category_type: category_type}});
|
||||
router.push({pathname: "/(tabs)/budget/editCategory", params: {category_guid: category_guid, category_color: category_color, category_amount: category_amount, category_name: category_name, category_type: category_type}});
|
||||
}
|
||||
|
||||
const handleBackButton = () => {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { router, useLocalSearchParams } from "expo-router";
|
|||
import { useState } from "react";
|
||||
import { SafeAreaView, StyleSheet, Text, TextInput, View } from "react-native";
|
||||
import { AutoDecimalInput, CustomColorPicker, NavigationButton, TypeSelectorSwitch } from "../../../components";
|
||||
import { updateCategory } from "../../../services/database";
|
||||
import { useTheme } from "../../contexts/ThemeContext";
|
||||
|
||||
const addCategory = () => {
|
||||
|
|
@ -48,7 +49,7 @@ const addCategory = () => {
|
|||
router.back();
|
||||
}}/>
|
||||
<NavigationButton text="Save" onPress={() => {
|
||||
console.log("Implement Saving here!");
|
||||
updateCategory(category_guid.toString(), categoryName, categoryColor, selectedType, amount);
|
||||
router.back();
|
||||
}}/>
|
||||
</View>
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ export default function Page() {
|
|||
};
|
||||
|
||||
const handleCategoryPress = (item: {[column: string]: any;}) => {
|
||||
router.push({pathname: "./(tabs)/budget/category", params: {category_guid: item.category_guid, category_name: item.category_name}})
|
||||
router.push({pathname: "/(tabs)/budget/category", params: {category_guid: item.category_guid, category_name: item.category_name}})
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
|||
Reference in a new issue