Added Action Taken on Task

This commit is contained in:
2026-02-21 15:44:12 +08:00
parent d2f1bcf9b3
commit 1478667bbf
5 changed files with 224 additions and 2 deletions
+15
View File
@@ -1,3 +1,5 @@
import 'dart:convert';
import '../utils/app_time.dart';
class Task {
@@ -21,6 +23,7 @@ class Task {
this.requestType,
this.requestTypeOther,
this.requestCategory,
this.actionTaken,
});
final String id;
@@ -45,6 +48,8 @@ class Task {
final String? requestType;
final String? requestTypeOther;
final String? requestCategory;
// JSON serialized rich text for action taken (Quill Delta JSON encoded)
final String? actionTaken;
factory Task.fromMap(Map<String, dynamic> map) {
return Task(
@@ -70,6 +75,16 @@ class Task {
requestedBy: map['requested_by'] as String?,
notedBy: map['noted_by'] as String?,
receivedBy: map['received_by'] as String?,
actionTaken: (() {
final at = map['action_taken'];
if (at == null) return null;
if (at is String) return at;
try {
return jsonEncode(at);
} catch (_) {
return at.toString();
}
})(),
);
}
}