added guardian login with views for their assigned childs
This commit is contained in:
@@ -8,9 +8,9 @@ import '../../../../api/marianumcloud/talk/chat/rich_object_string_processor.dar
|
||||
import '../../../../api/marianumcloud/talk/room/get_room_response.dart';
|
||||
import '../../../../api/marianumcloud/talk/set_read_marker/set_read_marker.dart';
|
||||
import '../../../../extensions/date_time.dart';
|
||||
import '../../../../model/account_data.dart';
|
||||
import '../../../../notification/notification_tasks.dart';
|
||||
import '../../../../routing/app_routes.dart';
|
||||
import '../../../../session/session_manager.dart';
|
||||
import '../../../../state/app/modules/chat/bloc/chat_bloc.dart';
|
||||
import '../../../../state/app/modules/chat_list/bloc/chat_list_bloc.dart';
|
||||
import '../../../../utils/haptics.dart';
|
||||
@@ -51,13 +51,9 @@ class _ChatTileState extends State<ChatTile> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
AccountData().waitForPopulation().then((_) {
|
||||
SessionManager().waitForLoad().then((session) {
|
||||
if (!mounted) return;
|
||||
setState(
|
||||
() => selfUsername = AccountData().isPopulated()
|
||||
? AccountData().getUsername()
|
||||
: null,
|
||||
);
|
||||
setState(() => selfUsername = session?.nextcloud?.username);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import '../../../../api/marianumcloud/talk/get_poll/get_poll_state_response.dart
|
||||
import '../../../../api/marianumcloud/talk/room/get_room_response.dart';
|
||||
import '../../../../api/marianumcloud/talk/vote_poll/vote_poll.dart';
|
||||
import '../../../../api/marianumcloud/talk/vote_poll/vote_poll_params.dart';
|
||||
import '../../../../model/account_data.dart';
|
||||
import '../../../../session/session_manager.dart';
|
||||
import '../../../../widget/async_action_button.dart';
|
||||
import '../../../../widget/confirm_dialog.dart';
|
||||
import '../../../../widget/demo_restricted.dart';
|
||||
@@ -186,7 +186,7 @@ class _PollOptionsListState extends State<PollOptionsList> {
|
||||
|
||||
Widget _actionBar(GetPollStateResponseObject poll, ThemeData theme) {
|
||||
final canClose = poll.canClose(
|
||||
selfId: AccountData().getUsername(),
|
||||
selfId: SessionManager().requireNextcloud().username,
|
||||
participantType: widget.room.participantType,
|
||||
);
|
||||
if (!_isInteractive && !canClose) return const SizedBox.shrink();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../access/user_role.dart';
|
||||
import '../../../../api/marianumconnect/queries/user_search/user_search_response.dart';
|
||||
import '../../../../widget/user_avatar.dart';
|
||||
|
||||
@@ -18,14 +19,14 @@ class UserSearchTile extends StatelessWidget {
|
||||
leading: UserAvatar(id: user.username, isGroup: false),
|
||||
title: Text('${user.firstName} ${user.lastName}'),
|
||||
subtitle: Text(_subtitle),
|
||||
trailing: RoleBadge(userType: user.userType),
|
||||
trailing: RoleBadge(role: UserRole.parse(user.userType)),
|
||||
onTap: onTap,
|
||||
);
|
||||
}
|
||||
|
||||
String get _subtitle {
|
||||
final className = user.className;
|
||||
if (user.userType == 'STUDENT' &&
|
||||
if (UserRole.parse(user.userType) == UserRole.student &&
|
||||
className != null &&
|
||||
className.isNotEmpty) {
|
||||
return '${user.username} · $className';
|
||||
@@ -36,16 +37,17 @@ class UserSearchTile extends StatelessWidget {
|
||||
|
||||
/// Compact colour-coded badge distinguishing teachers, students and staff.
|
||||
class RoleBadge extends StatelessWidget {
|
||||
final String userType;
|
||||
final UserRole role;
|
||||
|
||||
const RoleBadge({super.key, required this.userType});
|
||||
const RoleBadge({super.key, required this.role});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final (label, color) = switch (userType) {
|
||||
'TEACHER' => ('Lehrkraft', Colors.blue),
|
||||
'STUDENT' => ('Schüler:in', Colors.green),
|
||||
_ => ('Personal', Colors.orange),
|
||||
final (label, color) = switch (role) {
|
||||
UserRole.teacher => ('Lehrkraft', Colors.blue),
|
||||
UserRole.student => ('Schüler:in', Colors.green),
|
||||
UserRole.parent => ('Elternteil', Colors.purple),
|
||||
UserRole.staff || UserRole.unknown => ('Personal', Colors.orange),
|
||||
};
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
|
||||
Reference in New Issue
Block a user