Added Type, Category and Signatories on task

This commit is contained in:
2026-02-21 14:33:22 +08:00
parent d32449d096
commit 8d31a629ac
14 changed files with 1178 additions and 48 deletions
+85 -14
View File
@@ -20,6 +20,21 @@ import '../../widgets/tasq_adaptive_list.dart';
import '../../widgets/typing_dots.dart';
import '../../theme/app_surfaces.dart';
// request metadata options used in task creation/editing dialogs
const List<String> _requestTypeOptions = [
'Install',
'Repair',
'Upgrade',
'Replace',
'Other',
];
const List<String> _requestCategoryOptions = [
'Software',
'Hardware',
'Network',
];
class TasksListScreen extends ConsumerStatefulWidget {
const TasksListScreen({super.key});
@@ -402,6 +417,9 @@ class _TasksListScreenState extends ConsumerState<TasksListScreen> {
final titleController = TextEditingController();
final descriptionController = TextEditingController();
String? selectedOfficeId;
String? selectedRequestType;
String? requestTypeOther;
String? selectedRequestCategory;
await showDialog<void>(
context: context,
@@ -438,21 +456,71 @@ class _TasksListScreenState extends ConsumerState<TasksListScreen> {
return const Text('No offices available.');
}
selectedOfficeId ??= offices.first.id;
return DropdownButtonFormField<String>(
initialValue: selectedOfficeId,
decoration: const InputDecoration(
labelText: 'Office',
),
items: offices
.map(
(office) => DropdownMenuItem(
value: office.id,
child: Text(office.name),
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DropdownButtonFormField<String>(
initialValue: selectedOfficeId,
decoration: const InputDecoration(
labelText: 'Office',
),
items: offices
.map(
(office) => DropdownMenuItem(
value: office.id,
child: Text(office.name),
),
)
.toList(),
onChanged: (value) =>
setState(() => selectedOfficeId = value),
),
const SizedBox(height: 12),
// optional request metadata inputs
DropdownButtonFormField<String>(
initialValue: selectedRequestType,
decoration: const InputDecoration(
labelText: 'Request type (optional)',
),
items: _requestTypeOptions
.map(
(t) => DropdownMenuItem(
value: t,
child: Text(t),
),
)
.toList(),
onChanged: (value) =>
setState(() => selectedRequestType = value),
),
if (selectedRequestType == 'Other') ...[
const SizedBox(height: 8),
TextField(
decoration: const InputDecoration(
labelText: 'Please specify',
),
)
.toList(),
onChanged: (value) =>
setState(() => selectedOfficeId = value),
onChanged: (v) => requestTypeOther = v,
),
],
const SizedBox(height: 12),
DropdownButtonFormField<String>(
initialValue: selectedRequestCategory,
decoration: const InputDecoration(
labelText: 'Request category (optional)',
),
items: _requestCategoryOptions
.map(
(t) => DropdownMenuItem(
value: t,
child: Text(t),
),
)
.toList(),
onChanged: (value) => setState(
() => selectedRequestCategory = value,
),
),
],
);
},
loading: () => const Align(
@@ -484,6 +552,9 @@ class _TasksListScreenState extends ConsumerState<TasksListScreen> {
title: title,
description: description,
officeId: officeId,
requestType: selectedRequestType,
requestTypeOther: requestTypeOther,
requestCategory: selectedRequestCategory,
);
if (context.mounted) {
Navigator.of(dialogContext).pop();