notes
This commit is contained in:
@@ -10,6 +10,9 @@ import 'package:flux/features/home/latest_store_tickets/ui/latest_store_tickets_
|
||||
import 'package:flux/features/home/ui/quick_actions_widget.dart';
|
||||
import 'package:flux/features/master_data/staff/blocs/staff_cubit.dart';
|
||||
import 'package:flux/features/master_data/staff/models/staff_member_model.dart';
|
||||
import 'package:flux/features/notes/data/notes_repository.dart';
|
||||
import 'package:flux/features/notes/models/note_model.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
class HomeScreen extends StatelessWidget {
|
||||
@@ -62,6 +65,8 @@ class HomeScreen extends StatelessWidget {
|
||||
childAspectRatio: 1.3,
|
||||
),
|
||||
delegate: SliverChildListDelegate([
|
||||
LatestStoreOperationsCard(),
|
||||
LatestStoreTicketsCard(),
|
||||
_buildDashboardWidget(
|
||||
title: context.l10n.homeExpiringContracts,
|
||||
icon: Icons.assignment_late_outlined,
|
||||
@@ -73,6 +78,7 @@ class HomeScreen extends StatelessWidget {
|
||||
icon: Icons.sticky_note_2_outlined,
|
||||
color: Colors.yellow.shade700,
|
||||
context: context,
|
||||
onTap: () => context.pushNamed(Routes.notes),
|
||||
),
|
||||
_buildDashboardWidget(
|
||||
title: context.l10n.homeMyTasks,
|
||||
@@ -80,8 +86,6 @@ class HomeScreen extends StatelessWidget {
|
||||
color: Colors.green,
|
||||
context: context,
|
||||
),
|
||||
LatestStoreOperationsCard(),
|
||||
LatestStoreTicketsCard(),
|
||||
]),
|
||||
),
|
||||
),
|
||||
@@ -211,8 +215,26 @@ class HomeScreen extends StatelessWidget {
|
||||
icon: Icons.note_add,
|
||||
label: context.l10n.commonNote,
|
||||
color: Colors.amber,
|
||||
onTap: () {
|
||||
// TODO: Quando faremo il modale/pagina delle note
|
||||
onTap: () async {
|
||||
final companyId = context.read<SessionCubit>().state.company!.id!;
|
||||
final currentStaffId = context
|
||||
.read<SessionCubit>()
|
||||
.state
|
||||
.currentStaffMember!
|
||||
.id!;
|
||||
final emptyNote = NoteModel.empty(
|
||||
createdBy: currentStaffId,
|
||||
companyId: companyId,
|
||||
);
|
||||
final noteId = await GetIt.I.get<NotesRepository>().saveNote(
|
||||
emptyNote,
|
||||
);
|
||||
if (!context.mounted) return;
|
||||
context.pushNamed(
|
||||
Routes.noteForm,
|
||||
pathParameters: {'id': noteId},
|
||||
extra: emptyNote.copyWith(id: noteId),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
|
||||
Reference in New Issue
Block a user