You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudsolutions-atoms/lib/models/pantry/ppm_check_list.dart

55 lines
1.3 KiB
Dart

import 'package:test_sa/models/lookup.dart';
class PPMCheckList {
int id;
Lookup status;
String title;
String comment;
String measuredValue;
PPMCheckList({
this.id,
this.title,
this.status,
this.comment,
this.measuredValue,
});
Map<String, dynamic> toMap(int visitId) {
return {
'id': id ?? 0,
"visitId": visitId,
if (status != null) 'taskStatusId': status?.id,
if (title != null) 'task': title,
if (comment != null) 'taskComment': comment,
if (measuredValue != null) 'measuredValue': measuredValue,
};
}
factory PPMCheckList.fromMap(Map<String, dynamic> map) {
return PPMCheckList(
id: map['id'] as int,
status: Lookup(id: map["taskStatusId"], name: map["taskStatusName"]),
title: map['task'] as String,
comment: map['taskComment'] as String,
measuredValue: map['measuredValue'] as String,
);
}
PPMCheckList copyWith({
int id,
Lookup status,
String title,
String comment,
String measuredValue,
}) {
return PPMCheckList(
id: id ?? this.id,
status: status ?? this.status,
title: title ?? this.title,
comment: comment ?? this.comment,
measuredValue: measuredValue ?? this.measuredValue,
);
}
}