Compare commits
2 Commits
9f764150a2
...
7716460363
| Author | SHA1 | Date | |
|---|---|---|---|
| 7716460363 | |||
| ab5d385325 |
@@ -0,0 +1,16 @@
|
|||||||
|
import '../../models/it_service_request.model.dart';
|
||||||
|
import '../../theme/app_status_colors.dart';
|
||||||
|
|
||||||
|
/// Maps an IT service request status to a semantic [StatusKind] so its color
|
||||||
|
/// carries meaning consistently across the list and detail screens
|
||||||
|
/// (amber=pending approval, grey=scheduled, blue=in progress, green=completed,
|
||||||
|
/// grey=cancelled).
|
||||||
|
StatusKind isrStatusKind(String status) => switch (status) {
|
||||||
|
ItServiceRequestStatus.pendingApproval => StatusKind.warning,
|
||||||
|
ItServiceRequestStatus.scheduled => StatusKind.neutral,
|
||||||
|
ItServiceRequestStatus.inProgress => StatusKind.info,
|
||||||
|
ItServiceRequestStatus.inProgressDryRun => StatusKind.info,
|
||||||
|
ItServiceRequestStatus.completed => StatusKind.success,
|
||||||
|
ItServiceRequestStatus.cancelled => StatusKind.neutral,
|
||||||
|
_ => StatusKind.neutral,
|
||||||
|
};
|
||||||
@@ -31,6 +31,7 @@ import '../../widgets/mono_text.dart';
|
|||||||
import '../../widgets/responsive_body.dart';
|
import '../../widgets/responsive_body.dart';
|
||||||
import '../../theme/app_status_colors.dart';
|
import '../../theme/app_status_colors.dart';
|
||||||
import '../../widgets/status_pill.dart';
|
import '../../widgets/status_pill.dart';
|
||||||
|
import 'isr_status_kind.dart';
|
||||||
import 'it_service_request_pdf.dart';
|
import 'it_service_request_pdf.dart';
|
||||||
|
|
||||||
class ItServiceRequestDetailScreen extends ConsumerStatefulWidget {
|
class ItServiceRequestDetailScreen extends ConsumerStatefulWidget {
|
||||||
@@ -557,7 +558,7 @@ class _ItServiceRequestDetailScreenState
|
|||||||
MonoText(request.requestNumber!),
|
MonoText(request.requestNumber!),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
StatusPill.kind(
|
StatusPill.kind(
|
||||||
_isrStatusKind(request.status),
|
isrStatusKind(request.status),
|
||||||
label: ItServiceRequestStatus.label(request.status),
|
label: ItServiceRequestStatus.label(request.status),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
@@ -2246,15 +2247,3 @@ class _EvidenceSectionState extends ConsumerState<_EvidenceSection> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Maps an IT service request status to a semantic [StatusKind]
|
|
||||||
/// (amber=pending approval, blue=scheduled/in-progress, green=completed,
|
|
||||||
/// grey=cancelled).
|
|
||||||
StatusKind _isrStatusKind(String status) => switch (status) {
|
|
||||||
ItServiceRequestStatus.pendingApproval => StatusKind.warning,
|
|
||||||
ItServiceRequestStatus.scheduled => StatusKind.info,
|
|
||||||
ItServiceRequestStatus.inProgress => StatusKind.info,
|
|
||||||
ItServiceRequestStatus.inProgressDryRun => StatusKind.info,
|
|
||||||
ItServiceRequestStatus.completed => StatusKind.success,
|
|
||||||
ItServiceRequestStatus.cancelled => StatusKind.neutral,
|
|
||||||
_ => StatusKind.neutral,
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import '../../utils/app_time.dart';
|
|||||||
import '../../utils/snackbar.dart';
|
import '../../utils/snackbar.dart';
|
||||||
import '../../theme/app_status_colors.dart';
|
import '../../theme/app_status_colors.dart';
|
||||||
import '../../widgets/app_status_summary.dart';
|
import '../../widgets/app_status_summary.dart';
|
||||||
|
import 'isr_status_kind.dart';
|
||||||
import '../../widgets/m3_card.dart';
|
import '../../widgets/m3_card.dart';
|
||||||
import '../../widgets/mono_text.dart';
|
import '../../widgets/mono_text.dart';
|
||||||
import '../../widgets/reconnect_overlay.dart';
|
import '../../widgets/reconnect_overlay.dart';
|
||||||
@@ -669,7 +670,10 @@ class _RequestTile extends StatelessWidget {
|
|||||||
if (request.requestNumber != null)
|
if (request.requestNumber != null)
|
||||||
MonoText(request.requestNumber!),
|
MonoText(request.requestNumber!),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
StatusPill(label: ItServiceRequestStatus.label(request.status)),
|
StatusPill.kind(
|
||||||
|
isrStatusKind(request.status),
|
||||||
|
label: ItServiceRequestStatus.label(request.status),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:skeletonizer/skeletonizer.dart';
|
import 'package:skeletonizer/skeletonizer.dart';
|
||||||
|
|
||||||
|
import '../../../theme/app_surfaces.dart';
|
||||||
|
|
||||||
/// Wraps each report chart widget in a themed Card with a title, loading
|
/// Wraps each report chart widget in a themed Card with a title, loading
|
||||||
/// skeleton and error state handling. Exposes a [GlobalKey] on the inner
|
/// skeleton and error state handling. Exposes a [GlobalKey] on the inner
|
||||||
/// [RepaintBoundary] so the PDF exporter can capture the rendered chart
|
/// [RepaintBoundary] so the PDF exporter can capture the rendered chart
|
||||||
@@ -74,15 +76,25 @@ class ReportCardWrapper extends StatelessWidget {
|
|||||||
body = child;
|
body = child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final radius = AppSurfaces.of(context).cardRadius;
|
||||||
|
final isDark = colors.brightness == Brightness.dark;
|
||||||
|
|
||||||
final cardContent = Column(
|
final cardContent = Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(16, 14, 16, 4),
|
padding: const EdgeInsets.fromLTRB(16, 12, 16, 10),
|
||||||
child: Text(title, style: text.titleSmall),
|
child: Text(
|
||||||
|
title.toUpperCase(),
|
||||||
|
style: text.labelMedium?.copyWith(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
letterSpacing: 0.6,
|
||||||
|
color: colors.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const Divider(height: 1),
|
Divider(height: 1, color: colors.outlineVariant),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: height != null ? SizedBox(height: height, child: body) : body,
|
child: height != null ? SizedBox(height: height, child: body) : body,
|
||||||
@@ -93,8 +105,12 @@ class ReportCardWrapper extends StatelessWidget {
|
|||||||
final card = Card(
|
final card = Card(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
shadowColor: Colors.transparent,
|
shadowColor: Colors.transparent,
|
||||||
color: colors.surfaceContainerLow,
|
surfaceTintColor: Colors.transparent,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
color: isDark ? colors.surfaceContainer : colors.surfaceContainerLowest,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(radius),
|
||||||
|
side: BorderSide(color: colors.outlineVariant),
|
||||||
|
),
|
||||||
child: cardContent,
|
child: cardContent,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -77,10 +77,11 @@ class _RequestTypeChartState extends ConsumerState<RequestTypeChart> {
|
|||||||
return ReportCardWrapper(
|
return ReportCardWrapper(
|
||||||
title: 'Request Type Distribution',
|
title: 'Request Type Distribution',
|
||||||
repaintBoundaryKey: widget.repaintKey,
|
repaintBoundaryKey: widget.repaintKey,
|
||||||
height: 220,
|
height: 180,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
SizedBox(
|
||||||
|
width: 150,
|
||||||
child: PieChart(
|
child: PieChart(
|
||||||
PieChartData(
|
PieChartData(
|
||||||
pieTouchData: PieTouchData(
|
pieTouchData: PieTouchData(
|
||||||
@@ -116,22 +117,24 @@ class _RequestTypeChartState extends ConsumerState<RequestTypeChart> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 16),
|
||||||
Column(
|
Expanded(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: data.asMap().entries.map((entry) {
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
final i = entry.key;
|
children: data.asMap().entries.map((entry) {
|
||||||
final e = entry.value;
|
final i = entry.key;
|
||||||
final isTouched = i == _touchedIndex;
|
final e = entry.value;
|
||||||
return _HoverLegendItem(
|
final isTouched = i == _touchedIndex;
|
||||||
color: colorFor(i, e.name),
|
return _HoverLegendItem(
|
||||||
label: e.name,
|
color: colorFor(i, e.name),
|
||||||
value:
|
label: e.name,
|
||||||
'${e.count} (${(e.count / total * 100).toStringAsFixed(0)}%)',
|
value:
|
||||||
isTouched: isTouched,
|
'${e.count} (${(e.count / total * 100).toStringAsFixed(0)}%)',
|
||||||
);
|
isTouched: isTouched,
|
||||||
}).toList(),
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -208,10 +211,11 @@ class _RequestCategoryChartState extends ConsumerState<RequestCategoryChart> {
|
|||||||
return ReportCardWrapper(
|
return ReportCardWrapper(
|
||||||
title: 'Request Category Distribution',
|
title: 'Request Category Distribution',
|
||||||
repaintBoundaryKey: widget.repaintKey,
|
repaintBoundaryKey: widget.repaintKey,
|
||||||
height: 220,
|
height: 180,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
SizedBox(
|
||||||
|
width: 150,
|
||||||
child: PieChart(
|
child: PieChart(
|
||||||
PieChartData(
|
PieChartData(
|
||||||
pieTouchData: PieTouchData(
|
pieTouchData: PieTouchData(
|
||||||
@@ -247,22 +251,24 @@ class _RequestCategoryChartState extends ConsumerState<RequestCategoryChart> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 16),
|
||||||
Column(
|
Expanded(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: data.asMap().entries.map((entry) {
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
final i = entry.key;
|
children: data.asMap().entries.map((entry) {
|
||||||
final e = entry.value;
|
final i = entry.key;
|
||||||
final isTouched = i == _touchedIndex;
|
final e = entry.value;
|
||||||
return _HoverLegendItem(
|
final isTouched = i == _touchedIndex;
|
||||||
color: colorFor(i, e.name),
|
return _HoverLegendItem(
|
||||||
label: e.name,
|
color: colorFor(i, e.name),
|
||||||
value:
|
label: e.name,
|
||||||
'${e.count} (${(e.count / total * 100).toStringAsFixed(0)}%)',
|
value:
|
||||||
isTouched: isTouched,
|
'${e.count} (${(e.count / total * 100).toStringAsFixed(0)}%)',
|
||||||
);
|
isTouched: isTouched,
|
||||||
}).toList(),
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -52,10 +52,11 @@ class _TicketsByStatusChartState extends ConsumerState<TicketsByStatusChart> {
|
|||||||
return ReportCardWrapper(
|
return ReportCardWrapper(
|
||||||
title: 'Tickets by Status',
|
title: 'Tickets by Status',
|
||||||
repaintBoundaryKey: widget.repaintKey,
|
repaintBoundaryKey: widget.repaintKey,
|
||||||
height: 220,
|
height: 180,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
SizedBox(
|
||||||
|
width: 150,
|
||||||
child: PieChart(
|
child: PieChart(
|
||||||
PieChartData(
|
PieChartData(
|
||||||
pieTouchData: PieTouchData(
|
pieTouchData: PieTouchData(
|
||||||
@@ -92,22 +93,24 @@ class _TicketsByStatusChartState extends ConsumerState<TicketsByStatusChart> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 16),
|
||||||
Column(
|
Expanded(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: data.asMap().entries.map((entry) {
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
final i = entry.key;
|
children: data.asMap().entries.map((entry) {
|
||||||
final e = entry.value;
|
final i = entry.key;
|
||||||
final isTouched = i == _touchedIndex;
|
final e = entry.value;
|
||||||
return _LegendItem(
|
final isTouched = i == _touchedIndex;
|
||||||
color: _ticketStatusColor(context, e.status),
|
return _LegendItem(
|
||||||
label: _capitalize(e.status),
|
color: _ticketStatusColor(context, e.status),
|
||||||
value:
|
label: _capitalize(e.status),
|
||||||
'${e.count} (${(e.count / total * 100).toStringAsFixed(0)}%)',
|
value:
|
||||||
isTouched: isTouched,
|
'${e.count} (${(e.count / total * 100).toStringAsFixed(0)}%)',
|
||||||
);
|
isTouched: isTouched,
|
||||||
}).toList(),
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -178,10 +181,11 @@ class _TasksByStatusChartState extends ConsumerState<TasksByStatusChart> {
|
|||||||
return ReportCardWrapper(
|
return ReportCardWrapper(
|
||||||
title: 'Tasks by Status',
|
title: 'Tasks by Status',
|
||||||
repaintBoundaryKey: widget.repaintKey,
|
repaintBoundaryKey: widget.repaintKey,
|
||||||
height: 220,
|
height: 180,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
SizedBox(
|
||||||
|
width: 150,
|
||||||
child: PieChart(
|
child: PieChart(
|
||||||
PieChartData(
|
PieChartData(
|
||||||
pieTouchData: PieTouchData(
|
pieTouchData: PieTouchData(
|
||||||
@@ -218,22 +222,24 @@ class _TasksByStatusChartState extends ConsumerState<TasksByStatusChart> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 16),
|
||||||
Column(
|
Expanded(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: data.asMap().entries.map((entry) {
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
final i = entry.key;
|
children: data.asMap().entries.map((entry) {
|
||||||
final e = entry.value;
|
final i = entry.key;
|
||||||
final isTouched = i == _touchedIndex;
|
final e = entry.value;
|
||||||
return _LegendItem(
|
final isTouched = i == _touchedIndex;
|
||||||
color: _taskStatusColor(context, e.status),
|
return _LegendItem(
|
||||||
label: _formatTaskStatus(e.status),
|
color: _taskStatusColor(context, e.status),
|
||||||
value:
|
label: _formatTaskStatus(e.status),
|
||||||
'${e.count} (${(e.count / total * 100).toStringAsFixed(0)}%)',
|
value:
|
||||||
isTouched: isTouched,
|
'${e.count} (${(e.count / total * 100).toStringAsFixed(0)}%)',
|
||||||
);
|
isTouched: isTouched,
|
||||||
}).toList(),
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user