diff --git a/docker-compose.yml b/docker-compose.yml
index 98137f2..93b1236 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -40,7 +40,7 @@ services:
container_name: homeschool_frontend
restart: unless-stopped
ports:
- - "8057:80"
+ - "8054:80"
depends_on:
- backend
networks:
diff --git a/frontend/src/views/AdminView.vue b/frontend/src/views/AdminView.vue
index 7e8f0a2..7c31c12 100644
--- a/frontend/src/views/AdminView.vue
+++ b/frontend/src/views/AdminView.vue
@@ -20,15 +20,26 @@
-
-
{{ child.name }}
-
{{ child.is_active ? 'Active' : 'Inactive' }}
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ {{ child.name }}
+ {{ child.is_active ? 'Active' : 'Inactive' }}
+
+
+
+
+
+
No children added yet.
@@ -51,12 +62,24 @@
-
-
{{ subject.icon }}
-
{{ subject.name }}
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+ {{ subject.icon }}
+ {{ subject.name }}
+
+
+
+
+
No subjects added yet.
@@ -78,6 +101,8 @@ const showChildForm = ref(false)
const showSubjectForm = ref(false)
const newChild = ref({ name: '', color: '#4F46E5' })
const newSubject = ref({ name: '', icon: '📚', color: '#10B981' })
+const editingChild = ref(null)
+const editingSubject = ref(null)
async function createChild() {
await childrenStore.createChild(newChild.value)
@@ -85,6 +110,19 @@ async function createChild() {
showChildForm.value = false
}
+function startEditChild(child) {
+ editingChild.value = { ...child }
+ showChildForm.value = false
+}
+
+async function saveChild() {
+ await childrenStore.updateChild(editingChild.value.id, {
+ name: editingChild.value.name,
+ color: editingChild.value.color,
+ })
+ editingChild.value = null
+}
+
async function toggleChild(child) {
await childrenStore.updateChild(child.id, { is_active: !child.is_active })
}
@@ -100,6 +138,22 @@ async function loadSubjects() {
subjects.value = res.data
}
+function startEditSubject(subject) {
+ editingSubject.value = { ...subject }
+ showSubjectForm.value = false
+}
+
+async function saveSubject() {
+ const res = await api.patch(`/api/subjects/${editingSubject.value.id}`, {
+ name: editingSubject.value.name,
+ icon: editingSubject.value.icon,
+ color: editingSubject.value.color,
+ })
+ const idx = subjects.value.findIndex((s) => s.id === editingSubject.value.id)
+ if (idx !== -1) subjects.value[idx] = res.data
+ editingSubject.value = null
+}
+
async function createSubject() {
const res = await api.post('/api/subjects', newSubject.value)
subjects.value.push(res.data)
@@ -171,6 +225,17 @@ h2 { font-size: 1.1rem; color: #94a3b8; text-transform: uppercase; letter-spacin
.empty-small { color: #64748b; font-size: 0.9rem; padding: 1rem 0; }
+.edit-input {
+ padding: 0.35rem 0.6rem;
+ background: #0f172a;
+ border: 1px solid #4f46e5;
+ border-radius: 0.5rem;
+ color: #f1f5f9;
+ font-size: 0.9rem;
+ flex: 1;
+ min-width: 100px;
+}
+
.btn-primary {
padding: 0.5rem 1rem;
background: #4f46e5;