This commit is contained in:
2026-05-26 19:31:25 +02:00
parent 45455a16c4
commit 9d796d6e41
12 changed files with 785 additions and 62 deletions

View File

@@ -16,9 +16,9 @@ class DashboardTaskListCubit extends Cubit<DashboardTaskListState> {
DashboardTaskListCubit() : super(DashboardTaskListState());
void startListening({required String staffId}) {
void startListening({required String staffId}) async {
emit(state.copyWith(status: DashboardTaskListStatus.loading));
_loadTasks(staffId: staffId);
await _loadTasks(staffId: staffId);
_taskChannel?.unsubscribe();
_taskChannel = _supabase
.channel('public:tasks_staff_$staffId')

View File

@@ -100,7 +100,7 @@ class _DashboardTasksCardContent extends StatelessWidget {
if (state.status == DashboardTaskListStatus.failure) {
return Center(
child: Text(
"Errore di caricamento",
"Errore di caricamento ${state.errorMessage}",
style: TextStyle(color: theme.colorScheme.error),
),
);

View File

@@ -236,23 +236,10 @@ class HomeScreen extends StatelessWidget {
label: context.l10n.commonTask,
color: Colors.teal,
onTap: () {
final companyId = context.read<SessionCubit>().state.company!.id!;
final currentStaffId = context
.read<SessionCubit>()
.state
.currentStaffMember!
.id!;
final emptyTask = TaskModel.empty(
companyId: companyId,
createdById: currentStaffId,
);
final savedTask = GetIt.I.get<TaskRepository>().createTask(
emptyTask,
);
context.pushNamed(
Routes.taskForm,
pathParameters: {'id': 'new'},
extra: savedTask,
extra: (task: null),
);
},
),