Skip to content

Commit 88c6dde

Browse files
backend: fix delete support goal and check endpoints, client: pdf, learning support WIP
1 parent b7e7afe commit 88c6dde

10 files changed

Lines changed: 415 additions & 341 deletions

File tree

school_data_hub_flutter/lib/features/learning_support/domain/learning_support_manager.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ class LearningSupportManager {
9999

100100
_learningSupportPlans.value = plansToUpdate;
101101

102+
await _pupilManager.updatePupilData(pupilId);
103+
102104
_notificationService.showSnackBar(
103105
NotificationType.success,
104106
'Förderplan erstellt',

school_data_hub_flutter/lib/features/learning_support/presentation/widgets/dialogs/support_goal_check_dialog.dart

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
22
import 'package:gap/gap.dart';
33
import 'package:school_data_hub_client/school_data_hub_client.dart';
44
import 'package:school_data_hub_flutter/common/theme/app_colors.dart';
5+
import 'package:school_data_hub_flutter/common/theme/styles.dart';
56

67
final GlobalKey<FormState> _goalCheckFormKey = GlobalKey<FormState>();
78

@@ -136,41 +137,24 @@ Future<SupportGoalCheck?> supportGoalCheckDialog({
136137
actions: [
137138
// Cancel button
138139
Padding(
139-
padding: const EdgeInsets.only(
140-
left: 15,
141-
right: 15,
142-
bottom: 10,
143-
),
140+
padding: const EdgeInsets.only(left: 15, right: 15, bottom: 10),
144141
child: ElevatedButton(
145-
style: ElevatedButton.styleFrom(
146-
backgroundColor: AppColors.dangerButtonColor,
147-
minimumSize: const Size.fromHeight(50),
148-
),
142+
style: AppStyles.cancelButtonStyle,
149143
onPressed: () {
150144
Navigator.of(dialogContext).pop(null);
151145
},
152146
child: const Text(
153147
'ABBRECHEN',
154-
style: TextStyle(
155-
fontWeight: FontWeight.bold,
156-
fontSize: 17,
157-
),
148+
style: AppStyles.buttonTextStyle,
158149
),
159150
),
160151
),
161152

162153
// Confirm button
163154
Padding(
164-
padding: const EdgeInsets.only(
165-
left: 15,
166-
right: 15,
167-
bottom: 10,
168-
),
155+
padding: const EdgeInsets.only(left: 15, right: 15, bottom: 10),
169156
child: ElevatedButton(
170-
style: ElevatedButton.styleFrom(
171-
backgroundColor: AppColors.successButtonColor,
172-
minimumSize: const Size.fromHeight(50),
173-
),
157+
style: AppStyles.successButtonStyle,
174158
onPressed: () {
175159
if (_goalCheckFormKey.currentState!.validate()) {
176160
final check = SupportGoalCheck(
@@ -186,11 +170,7 @@ Future<SupportGoalCheck?> supportGoalCheckDialog({
186170
},
187171
child: const Text(
188172
'SPEICHERN',
189-
style: TextStyle(
190-
fontWeight: FontWeight.bold,
191-
fontSize: 17,
192-
color: Colors.white,
193-
),
173+
style: AppStyles.buttonTextStyle,
194174
),
195175
),
196176
),

school_data_hub_flutter/lib/features/learning_support/presentation/widgets/support_catagory_status/support_category_statuses_list.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import 'package:school_data_hub_flutter/features/learning_support/presentation/w
88
import 'package:school_data_hub_flutter/features/learning_support/presentation/widgets/support_goal/support_category_badge.dart';
99
import 'package:school_data_hub_flutter/features/pupil/domain/models/pupil_proxy.dart';
1010

11-
class SupportCategoryStatusesList extends StatelessWidget {
11+
class SupportCategoryStatusesList extends WatchingWidget {
1212
final PupilProxy pupil;
1313

1414
const SupportCategoryStatusesList({required this.pupil, super.key});
1515

1616
@override
1717
Widget build(BuildContext context) {
18+
watch(pupil);
1819
final statuses = pupil.supportCategoryStatuses;
1920
if (statuses == null || statuses.isEmpty) {
2021
return const SizedBox.shrink();

school_data_hub_flutter/lib/features/learning_support/presentation/widgets/support_catagory_status/widgets/support_category_status_card.dart

Lines changed: 75 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ import 'package:flutter/material.dart';
22
import 'package:gap/gap.dart';
33
import 'package:school_data_hub_client/school_data_hub_client.dart';
44
import 'package:school_data_hub_flutter/common/theme/styles.dart';
5+
import 'package:school_data_hub_flutter/common/widgets/custom_expansion_tile/custom_expansion_tile.dart';
6+
import 'package:school_data_hub_flutter/common/widgets/custom_expansion_tile/custom_expansion_tile_content.dart';
7+
import 'package:school_data_hub_flutter/common/widgets/custom_expansion_tile/custom_expansion_tile_switch.dart';
58
import 'package:school_data_hub_flutter/features/learning_support/presentation/new_support_category_status_page/controller/new_support_category_status_controller.dart';
69
import 'package:school_data_hub_flutter/features/learning_support/presentation/widgets/support_catagory_status/widgets/support_category_status_entry/support_category_status_entry.dart';
710
import 'package:school_data_hub_flutter/features/learning_support/presentation/widgets/support_category_parents_names.dart';
811
import 'package:school_data_hub_flutter/features/learning_support/presentation/widgets/support_goal/support_goal_card.dart';
912
import 'package:school_data_hub_flutter/features/pupil/domain/models/pupil_proxy.dart';
13+
import 'package:watch_it/watch_it.dart';
1014

11-
class SupportCategoryStatusCard extends StatelessWidget {
15+
class SupportCategoryStatusCard extends WatchingWidget {
1216
final PupilProxy pupil;
1317
final List<SupportCategoryStatus> statusesWithSameGoalCategory;
1418

@@ -20,6 +24,10 @@ class SupportCategoryStatusCard extends StatelessWidget {
2024

2125
@override
2226
Widget build(BuildContext context) {
27+
final expansionController = createOnce(
28+
() => CustomExpansionTileController(),
29+
);
30+
2331
final int supportCategoryId =
2432
statusesWithSameGoalCategory[0].supportCategoryId;
2533

@@ -66,51 +74,80 @@ class SupportCategoryStatusCard extends StatelessWidget {
6674
for (final status in statusesWithSameGoalCategory)
6775
SupportCategoryStatusEntry(pupil: pupil, status: status),
6876
const Gap(5),
69-
if (goalIndices.isEmpty)
70-
const Row(
71-
mainAxisAlignment: MainAxisAlignment.center,
72-
children: [
73-
Icon(Icons.warning, color: Colors.red),
74-
Gap(5),
75-
Text(
76-
'Noch keine Förderziele formuliert!',
77-
style: TextStyle(
78-
color: Colors.red,
77+
Row(
78+
mainAxisAlignment: MainAxisAlignment.end,
79+
children: [
80+
CustomExpansionTileSwitch(
81+
customExpansionTileController: expansionController,
82+
switchColor: Colors.black,
83+
expansionSwitchWidget: Text(
84+
goalIndices.isEmpty
85+
? 'Förderziele'
86+
: 'Förderziele (${goalIndices.length})',
87+
style: const TextStyle(
7988
fontSize: 14,
8089
fontWeight: FontWeight.bold,
8190
),
8291
),
83-
Gap(10),
84-
],
85-
)
86-
else
87-
for (final goalIndex in goalIndices)
88-
SupportGoalCard(pupil: pupil, goalIndex: goalIndex),
89-
Padding(
90-
padding: const EdgeInsets.all(10.0),
91-
child: ElevatedButton(
92-
style: AppStyles.actionButtonStyle,
93-
onPressed: () async {
94-
await Navigator.of(context).push(
95-
MaterialPageRoute(
96-
builder: (ctx) => NewSupportCategoryStatus(
97-
appBarTitle: 'Neues Förderziel',
98-
pupilId: pupil.pupilId,
99-
goalCategoryId: supportCategoryId,
100-
elementType: 'goal',
92+
includeSwitch: true,
93+
),
94+
const Gap(10),
95+
],
96+
),
97+
CustomExpansionTileContent(
98+
tileController: expansionController,
99+
widgetList: [
100+
if (goalIndices.isEmpty)
101+
const Row(
102+
mainAxisAlignment: MainAxisAlignment.center,
103+
children: [
104+
Icon(Icons.warning, color: Colors.red),
105+
Gap(5),
106+
Text(
107+
'Noch keine Förderziele formuliert!',
108+
style: TextStyle(
109+
color: Colors.red,
110+
fontSize: 14,
111+
fontWeight: FontWeight.bold,
112+
),
113+
),
114+
Gap(10),
115+
],
116+
)
117+
else
118+
for (final goalIndex in goalIndices)
119+
SupportGoalCard(
120+
pupil: pupil,
121+
goalIndex: goalIndex,
122+
showCategoryBadge: false,
123+
),
124+
Padding(
125+
padding: const EdgeInsets.all(10.0),
126+
child: ElevatedButton(
127+
style: AppStyles.actionButtonStyle,
128+
onPressed: () async {
129+
await Navigator.of(context).push(
130+
MaterialPageRoute(
131+
builder: (ctx) => NewSupportCategoryStatus(
132+
appBarTitle: 'Neues Förderziel',
133+
pupilId: pupil.pupilId,
134+
goalCategoryId: supportCategoryId,
135+
elementType: 'goal',
136+
),
137+
),
138+
);
139+
},
140+
child: const Text(
141+
"NEUES FÖRDERZIEL",
142+
style: TextStyle(
143+
fontSize: 17.0,
144+
color: Colors.white,
145+
fontWeight: FontWeight.bold,
101146
),
102147
),
103-
);
104-
},
105-
child: const Text(
106-
"NEUES FÖRDERZIEL",
107-
style: TextStyle(
108-
fontSize: 17.0,
109-
color: Colors.white,
110-
fontWeight: FontWeight.bold,
111148
),
112149
),
113-
),
150+
],
114151
),
115152
],
116153
),

school_data_hub_flutter/lib/features/learning_support/presentation/widgets/support_goal/support_goal_card.dart

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,21 @@ import 'package:school_data_hub_flutter/core/models/datetime_extensions.dart';
1818
import 'package:school_data_hub_flutter/core/session/hub_session_manager.dart';
1919
import 'package:school_data_hub_flutter/features/learning_support/domain/learning_support_manager.dart';
2020
import 'package:school_data_hub_flutter/features/learning_support/domain/support_category_manager.dart';
21+
import 'package:school_data_hub_flutter/features/learning_support/presentation/new_support_category_status_page/controller/new_support_category_status_controller.dart';
2122
import 'package:school_data_hub_flutter/features/learning_support/presentation/widgets/dialogs/support_goal_check_dialog.dart';
2223
import 'package:school_data_hub_flutter/features/learning_support/presentation/widgets/support_catagory_status/widgets/support_category_status_entry/support_category_status_entry.dart';
2324
import 'package:school_data_hub_flutter/features/learning_support/presentation/widgets/support_catagory_status/widgets/support_category_status_entry/support_category_status_symbol.dart';
24-
import 'package:school_data_hub_flutter/features/learning_support/presentation/new_support_category_status_page/controller/new_support_category_status_controller.dart';
2525
import 'package:school_data_hub_flutter/features/learning_support/presentation/widgets/support_goal/support_category_badge.dart';
2626
import 'package:school_data_hub_flutter/features/pupil/domain/models/pupil_proxy.dart';
2727

2828
class SupportGoalCard extends WatchingWidget {
2929
final PupilProxy pupil;
3030
final int goalIndex;
31+
final bool showCategoryBadge;
3132
const SupportGoalCard({
3233
required this.pupil,
3334
required this.goalIndex,
35+
this.showCategoryBadge = true,
3436
super.key,
3537
});
3638

@@ -74,19 +76,21 @@ class SupportGoalCard extends WatchingWidget {
7476
Row(
7577
children: [
7678
const Gap(10),
77-
Padding(
78-
padding: const EdgeInsets.only(
79-
top: 8.0,
80-
bottom: 8,
81-
left: 10,
82-
right: 10,
83-
),
84-
child: SupportCategoryBadge(
85-
categoryId:
86-
pupil.supportGoals![goalIndex].supportCategoryId,
79+
if (showCategoryBadge) ...[
80+
Padding(
81+
padding: const EdgeInsets.only(
82+
top: 8.0,
83+
bottom: 8,
84+
left: 10,
85+
right: 10,
86+
),
87+
child: SupportCategoryBadge(
88+
categoryId:
89+
pupil.supportGoals![goalIndex].supportCategoryId,
90+
),
8791
),
88-
),
89-
const Gap(10),
92+
const Gap(10),
93+
],
9094
Flexible(
9195
child: InkWell(
9296
onTap: () {

0 commit comments

Comments
 (0)