From 8062619ebe66dacd9458b549bd852a812979dada Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1s=20Gr=C3=BCner?=
<47506558+MegaRedHand@users.noreply.github.com>
Date: Wed, 22 May 2024 21:45:51 -0300
Subject: [PATCH 1/4] feat: allow editing groups
---
my-app/src/lib/svgs.ts | 3 +++
.../categories/details/[[id=integer]]/+page.server.ts | 4 ++--
my-app/src/routes/groups/+page.svelte | 6 +++++-
.../src/routes/groups/budgets/[[id=integer]]/+page.svelte | 4 +---
4 files changed, 11 insertions(+), 6 deletions(-)
create mode 100644 my-app/src/lib/svgs.ts
diff --git a/my-app/src/lib/svgs.ts b/my-app/src/lib/svgs.ts
new file mode 100644
index 0000000..73d5578
--- /dev/null
+++ b/my-app/src/lib/svgs.ts
@@ -0,0 +1,3 @@
+// Useful SVGs
+export const PENCIL_SVG =
+ '';
diff --git a/my-app/src/routes/categories/details/[[id=integer]]/+page.server.ts b/my-app/src/routes/categories/details/[[id=integer]]/+page.server.ts
index 0ece8b4..6dd10de 100644
--- a/my-app/src/routes/categories/details/[[id=integer]]/+page.server.ts
+++ b/my-app/src/routes/categories/details/[[id=integer]]/+page.server.ts
@@ -1,4 +1,4 @@
-import { error } from '@sveltejs/kit';
+import { error, redirect } from '@sveltejs/kit';
import type { Actions } from './$types';
import { categoryService, groupService } from '$lib/server/api';
import type { PageServerLoad } from './$types';
@@ -35,6 +35,6 @@ export const actions: Actions = {
const category: Category = { id, group_id, name, description, strategy };
await categoryService.save(category, cookies);
- return { success: true };
+ redirect(302, `/groups/movements/${group_id}`);
}
};
diff --git a/my-app/src/routes/groups/+page.svelte b/my-app/src/routes/groups/+page.svelte
index 3cab6a6..808d0e6 100644
--- a/my-app/src/routes/groups/+page.svelte
+++ b/my-app/src/routes/groups/+page.svelte
@@ -1,5 +1,6 @@
From 9b30ac4cf5a5d82ca63d98676ee03d016c0bc8c9 Mon Sep 17 00:00:00 2001
From: Borja Garibotti
Date: Wed, 22 May 2024 22:10:00 -0300
Subject: [PATCH 2/4] Add breadcrumb (nav)
---
.../routes/budgets/details/[[id=integer]]/+page.svelte | 7 +++++++
.../categories/details/[[id=integer]]/+page.server.ts | 5 +++--
.../categories/details/[[id=integer]]/+page.svelte | 7 +++++++
.../routes/groups/budgets/[[id=integer]]/+page.svelte | 10 +++++++++-
.../routes/groups/details/[[id=integer]]/+page.svelte | 7 +++++++
.../routes/groups/movements/[id=integer]/+page.svelte | 9 ++++++++-
.../spendings/details/[[id=integer]]/+page.svelte | 7 +++++++
7 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/my-app/src/routes/budgets/details/[[id=integer]]/+page.svelte b/my-app/src/routes/budgets/details/[[id=integer]]/+page.svelte
index f55bf5d..2854855 100644
--- a/my-app/src/routes/budgets/details/[[id=integer]]/+page.svelte
+++ b/my-app/src/routes/budgets/details/[[id=integer]]/+page.svelte
@@ -61,6 +61,13 @@
{title} - Nuevo Presupuesto
+
+
{#if edit}Editando{:else}Creando{/if} Presupuesto
diff --git a/my-app/src/routes/categories/details/[[id=integer]]/+page.server.ts b/my-app/src/routes/categories/details/[[id=integer]]/+page.server.ts
index 0ece8b4..afc7d08 100644
--- a/my-app/src/routes/categories/details/[[id=integer]]/+page.server.ts
+++ b/my-app/src/routes/categories/details/[[id=integer]]/+page.server.ts
@@ -1,4 +1,4 @@
-import { error } from '@sveltejs/kit';
+import { error, redirect } from '@sveltejs/kit';
import type { Actions } from './$types';
import { categoryService, groupService } from '$lib/server/api';
import type { PageServerLoad } from './$types';
@@ -35,6 +35,7 @@ export const actions: Actions = {
const category: Category = { id, group_id, name, description, strategy };
await categoryService.save(category, cookies);
- return { success: true };
+
+ redirect(302, `/groups/movements/${group_id}`);
}
};
diff --git a/my-app/src/routes/categories/details/[[id=integer]]/+page.svelte b/my-app/src/routes/categories/details/[[id=integer]]/+page.svelte
index a218125..5460276 100644
--- a/my-app/src/routes/categories/details/[[id=integer]]/+page.svelte
+++ b/my-app/src/routes/categories/details/[[id=integer]]/+page.svelte
@@ -9,6 +9,13 @@
{title} - Nueva Categoría
+
+
Nueva Categoría