fix: improve job step notes and product pricing guardrails

This commit is contained in:
egecankomur
2026-06-12 00:15:18 +03:00
parent b42f68214e
commit d504e505d3
3 changed files with 244 additions and 4 deletions
@@ -540,10 +540,14 @@ class _StepperWidget extends StatelessWidget {
builder: (ctx, snap) {
final history = snap.data ?? [];
final Map<JobStep, int> revisionCounts = {};
final Map<JobStep, List<JobHistoryEntry>> notesByStep = {};
for (final e in history) {
if (e.action == JobHistoryAction.revisionRequested && e.step != null) {
revisionCounts[e.step!] = (revisionCounts[e.step!] ?? 0) + 1;
}
if (e.step != null && e.note != null && e.note!.trim().isNotEmpty) {
notesByStep.putIfAbsent(e.step!, () => []).add(e);
}
}
return Column(
@@ -553,6 +557,7 @@ class _StepperWidget extends StatelessWidget {
final isCompleted = index < currentStepIndex;
final isCurrent = index == currentStepIndex;
final revCount = revisionCounts[step] ?? 0;
final stepNotes = notesByStep[step] ?? const <JobHistoryEntry>[];
Color dotColor;
IconData dotIcon;
@@ -635,6 +640,10 @@ class _StepperWidget extends StatelessWidget {
color: AppColors.textSecondary,
),
),
if (stepNotes.isNotEmpty) ...[
const SizedBox(height: 8),
...stepNotes.map((entry) => _StepNoteCard(entry: entry)),
],
],
),
),
@@ -648,6 +657,58 @@ class _StepperWidget extends StatelessWidget {
}
}
class _StepNoteCard extends StatelessWidget {
const _StepNoteCard({required this.entry});
final JobHistoryEntry entry;
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
margin: const EdgeInsets.only(top: 6),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
decoration: BoxDecoration(
color: AppColors.surfaceVariant,
borderRadius: BorderRadius.circular(10),
border: Border.all(color: AppColors.border),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_label(entry.action),
style: const TextStyle(
fontSize: 11,
fontWeight: FontWeight.w700,
color: AppColors.textSecondary,
),
),
const SizedBox(height: 4),
Text(
entry.note!,
style: const TextStyle(
fontSize: 12,
color: AppColors.textPrimary,
),
),
],
),
);
}
String _label(JobHistoryAction action) {
return switch (action) {
JobHistoryAction.revisionRequested => 'Revizyon Notu',
JobHistoryAction.handedToClinic => 'Laboratuvar Notu',
JobHistoryAction.approved => 'Onay Notu',
JobHistoryAction.delivered => 'Teslim Notu',
JobHistoryAction.accepted => 'Kabul Notu',
JobHistoryAction.cancelled => 'İptal Notu',
};
}
}
class _SectionLabel extends StatelessWidget {
const _SectionLabel({required this.title});
final String title;