add
This commit is contained in:
@@ -21,6 +21,7 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final submissionsAsync = ref.watch(filteredSubmissionsProvider);
|
||||
final statusListAsync = ref.watch(projectStatusListProvider);
|
||||
final filter = ref.watch(submissionsFilterProvider);
|
||||
final selectedStatus = filter.selectedStatus;
|
||||
|
||||
@@ -53,7 +54,7 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Mã dự án hoặc tên dự án',
|
||||
hintText: 'Mã dự án hoặc tên công trình',
|
||||
prefixIcon: const Icon(Icons.search, color: AppColors.grey500),
|
||||
filled: true,
|
||||
fillColor: AppColors.white,
|
||||
@@ -86,16 +87,23 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
onTap: () => ref.read(submissionsFilterProvider.notifier).clearStatusFilter(),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
...SubmissionStatus.values.map((status) => Padding(
|
||||
padding: const EdgeInsets.only(right: 8),
|
||||
child: _buildFilterChip(
|
||||
context,
|
||||
ref,
|
||||
label: status.displayName,
|
||||
isSelected: selectedStatus == status,
|
||||
onTap: () => ref.read(submissionsFilterProvider.notifier).selectStatus(status),
|
||||
// Use projectStatusListProvider to get status options
|
||||
statusListAsync.when(
|
||||
data: (statuses) => Row(
|
||||
children: statuses.map((status) => Padding(
|
||||
padding: const EdgeInsets.only(right: 8),
|
||||
child: _buildFilterChip(
|
||||
context,
|
||||
ref,
|
||||
label: status.label,
|
||||
isSelected: selectedStatus == status.label,
|
||||
onTap: () => ref.read(submissionsFilterProvider.notifier).selectStatus(status.label),
|
||||
),
|
||||
)).toList(),
|
||||
),
|
||||
)),
|
||||
loading: () => const SizedBox.shrink(),
|
||||
error: (_, __) => const SizedBox.shrink(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -268,19 +276,27 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'#${submission.submissionId}',
|
||||
submission.designedArea,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.grey900,
|
||||
),
|
||||
),
|
||||
_buildStatusBadge(submission.status),
|
||||
_buildStatusBadge(submission.status, submission.statusColor),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
// Text(
|
||||
// 'Tên công trình: ${submission.designedArea}',
|
||||
// style: const TextStyle(
|
||||
// fontSize: 14,
|
||||
// color: AppColors.grey900,
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(height: 4),
|
||||
Text(
|
||||
'Tên công trình: ${submission.projectName}',
|
||||
'Ngày nộp: ${DateFormat('dd/MM/yyyy HH:mm').format(submission.requestDate)}',
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColors.grey900,
|
||||
@@ -288,21 +304,13 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Ngày nộp: ${DateFormat('dd/MM/yyyy').format(submission.submittedAt)}',
|
||||
'Diện tích: ${submission.designArea} m²',
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppColors.grey500,
|
||||
color: AppColors.grey900,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Diện tích: ${submission.projectAddress ?? "N/A"}',
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppColors.grey500,
|
||||
),
|
||||
),
|
||||
if (submission.rejectionReason != null) ...[
|
||||
if (submission.reasonForRejection != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
@@ -320,7 +328,7 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
submission.rejectionReason!,
|
||||
submission.reasonForRejection!,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppColors.danger,
|
||||
@@ -338,8 +346,8 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusBadge(SubmissionStatus status) {
|
||||
final color = _getStatusColor(status);
|
||||
Widget _buildStatusBadge(String status, String statusColor) {
|
||||
final color = _getColorFromStatusColor(statusColor);
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
@@ -347,7 +355,7 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
status.displayName,
|
||||
status,
|
||||
style: TextStyle(
|
||||
color: color,
|
||||
fontSize: 12,
|
||||
@@ -357,16 +365,18 @@ class SubmissionsPage extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Color _getStatusColor(SubmissionStatus status) {
|
||||
switch (status) {
|
||||
case SubmissionStatus.pending:
|
||||
Color _getColorFromStatusColor(String statusColor) {
|
||||
switch (statusColor) {
|
||||
case 'Warning':
|
||||
return AppColors.warning;
|
||||
case SubmissionStatus.reviewing:
|
||||
return AppColors.info;
|
||||
case SubmissionStatus.approved:
|
||||
case 'Success':
|
||||
return AppColors.success;
|
||||
case SubmissionStatus.rejected:
|
||||
case 'Danger':
|
||||
return AppColors.danger;
|
||||
case 'Info':
|
||||
return AppColors.info;
|
||||
default:
|
||||
return AppColors.grey500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user