feat: setup completo architettura ticket, UI e cubit
This commit is contained in:
@@ -29,6 +29,8 @@ import 'package:flux/features/operations/models/operation_model.dart';
|
||||
import 'package:flux/features/operations/ui/operation_form_screen.dart';
|
||||
import 'package:flux/features/operations/ui/operation_mobile_upload_screen.dart';
|
||||
import 'package:flux/features/operations/ui/operations_screen.dart';
|
||||
import 'package:flux/features/tickets/blocs/ticket_list_cubit.dart';
|
||||
import 'package:flux/features/tickets/ui/ticket_list_screen.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
@@ -146,6 +148,13 @@ class AppRouter {
|
||||
builder: (context, state) =>
|
||||
const CustomersContent(), // O come si chiama il tuo widget della lista!
|
||||
),
|
||||
GoRoute(
|
||||
path: '/tickets',
|
||||
builder: (context, state) => BlocProvider(
|
||||
create: (context) => TicketListCubit(),
|
||||
child: const TicketListScreen(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ class _LatestOperationsCardContent extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
side: BorderSide(color: theme.dividerColor.withValues(alpha: 0.5)),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () => context.push('/operations'),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
@@ -69,8 +71,6 @@ class _LatestOperationsCardContent extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: TextButton(
|
||||
onPressed: () => context.push('/operations'),
|
||||
child: Text(
|
||||
context.l10n.homeLatestOperations,
|
||||
style: TextStyle(
|
||||
@@ -82,7 +82,6 @@ class _LatestOperationsCardContent extends StatelessWidget {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
@@ -95,12 +94,17 @@ class _LatestOperationsCardContent extends StatelessWidget {
|
||||
LatestStoreOperationsState
|
||||
>(
|
||||
builder: (context, state) {
|
||||
if (state.status == LatestStoreOperationsStatus.loading ||
|
||||
state.status == LatestStoreOperationsStatus.initial) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
if (state.status ==
|
||||
LatestStoreOperationsStatus.loading ||
|
||||
state.status ==
|
||||
LatestStoreOperationsStatus.initial) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
|
||||
if (state.status == LatestStoreOperationsStatus.failure) {
|
||||
if (state.status ==
|
||||
LatestStoreOperationsStatus.failure) {
|
||||
return Center(
|
||||
child: Text(
|
||||
"Errore di caricamento",
|
||||
@@ -184,6 +188,7 @@ class _LatestOperationsCardContent extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,12 +77,13 @@ class HomeScreen extends StatelessWidget {
|
||||
context: context,
|
||||
),
|
||||
LatestStoreOperationsCard(),
|
||||
|
||||
_buildDashboardWidget(
|
||||
title: context.l10n.homeLatestOperationTickets,
|
||||
icon: Icons.support_agent_outlined,
|
||||
color: Colors.purple,
|
||||
context: context,
|
||||
onTap: () =>
|
||||
context.push('/tickets'), // <-- Aggiunto!
|
||||
),
|
||||
]),
|
||||
),
|
||||
@@ -194,8 +195,8 @@ class HomeScreen extends StatelessWidget {
|
||||
label: context.l10n.homeNewOperationTicket,
|
||||
color: Colors.redAccent,
|
||||
onTap: () {
|
||||
// TODO: Quando avrai la rotta per la nuova assistenza
|
||||
// context.push('/assistance-form');
|
||||
// Andiamo alla lista! (Da lì poi aggiungeremo il tasto "+" per il form)
|
||||
context.push('/tickets');
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
@@ -226,15 +227,19 @@ class HomeScreen extends StatelessWidget {
|
||||
required String title,
|
||||
required IconData icon,
|
||||
required Color color,
|
||||
VoidCallback? onTap,
|
||||
}) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return Card(
|
||||
elevation: 0,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
side: BorderSide(color: theme.dividerColor.withValues(alpha: 0.5)),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
@@ -290,6 +295,7 @@ class HomeScreen extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class TicketRepository {
|
||||
.select('''
|
||||
*,
|
||||
customer (*),
|
||||
staff (*),
|
||||
staff_member (*),
|
||||
target_model:model!ticket_model_id_1_fkey (*),
|
||||
source_model:model!ticket_model_id_2_fkey (*)
|
||||
''')
|
||||
@@ -83,7 +83,7 @@ class TicketRepository {
|
||||
.select('''
|
||||
*,
|
||||
customer (*),
|
||||
staff (*),
|
||||
staff_member (*),
|
||||
target_model:model!ticket_model_id_1_fkey (*),
|
||||
source_model:model!ticket_model_id_2_fkey (*)
|
||||
''')
|
||||
|
||||
Reference in New Issue
Block a user