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

54 lines
1.3 KiB
Dart

import 'package:test_sa/models/lookup.dart';
class PPMCheckList{
3 years ago
int id;
Lookup status;
String title;
String comment;
String measuredValue;
PPMCheckList({
3 years ago
this.id,
this.title,
this.status,
this.comment,
this.measuredValue,
});
3 years ago
Map<String, dynamic> toMap(int visitId) {
return {
3 years ago
'id': id,
"visitId": visitId,
if(status != null) 'taskStatusId': status?.id.toString(),
if(title != null) 'task': title,
if(comment != null) 'taskComment': comment,
if(measuredValue != null) 'measuredValue': measuredValue,
};
}
factory PPMCheckList.fromMap(Map<String, dynamic> map) {
return PPMCheckList(
3 years ago
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,
);
}
3 years ago
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,
);
}
}