MobilePortal23/lib/models/reportListModel.dart

149 lines
3.6 KiB
Dart

class ModelReportList {
String? sId;
String? title;
String? body;
String? poNumber;
String? workNumber;
String? state;
late List<DailyReport> dailyReport;
ModelReportList(
{required this.sId,
required this.title,
required this.body,
required this.poNumber,
required this.workNumber,
required this.state,
required this.dailyReport});
ModelReportList.fromJson(Map<String, dynamic> json) {
sId = json['_id'];
title = json['title'];
body = json['body'];
poNumber = json['poNumber'];
workNumber = json['workNumber'];
state = json['state'];
if (json['dailyReport'] != null) {
dailyReport = <DailyReport>[];
json['dailyReport'].forEach((v) {
dailyReport.add(DailyReport.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['_id'] = sId;
data['title'] = title;
data['body'] = body;
data['poNumber'] = poNumber;
data['workNumber'] = workNumber;
data['state'] = state;
data['dailyReport'] = dailyReport.map((v) => v.toJson()).toList();
return data;
}
}
class DailyReport {
late List<String> employeeList;
String? sId;
String? date;
String? foremanId;
String? workTitle;
DailyReport(
{required this.employeeList,
required this.sId,
required this.date,
required this.foremanId,
required this.workTitle});
DailyReport.fromJson(Map<String, dynamic> json) {
employeeList = json['employeeList'].cast<String>();
sId = json['_id'];
date = json['date'];
foremanId = json['foremanId'];
workTitle = json['workTitle'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['employeeList'] = employeeList;
data['_id'] = sId;
data['date'] = date;
data['foremanId'] = foremanId;
data['workTitle'] = workTitle;
return data;
}
}
class WorkListModel {
String? _sId;
String? _title;
String? _body;
String? _poNumber;
String? _workNumber;
String? _state;
WorkListModel(
{String? sId,
String? title,
String? body,
String? poNumber,
String? workNumber,
String? state}) {
if (sId != null) {
_sId = sId;
}
if (title != null) {
_title = title;
}
if (body != null) {
_body = body;
}
if (poNumber != null) {
_poNumber = poNumber;
}
if (workNumber != null) {
_workNumber = workNumber;
}
if (state != null) {
_state = state;
}
}
String? get sId => _sId;
set sId(String? sId) => _sId = sId;
String? get title => _title;
set title(String? title) => _title = title;
String? get body => _body;
set body(String? body) => _body = body;
String? get poNumber => _poNumber;
set poNumber(String? poNumber) => _poNumber = poNumber;
String? get workNumber => _workNumber;
set workNumber(String? workNumber) => _workNumber = workNumber;
String? get state => _state;
set state(String? state) => _state = state;
WorkListModel.fromJson(Map<String, dynamic> json) {
_sId = json['_id'];
_title = json['title'];
_body = json['body'];
_poNumber = json['poNumber'];
_workNumber = json['workNumber'];
_state = json['state'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['_id'] = _sId;
data['title'] = _title;
data['body'] = _body;
data['poNumber'] = _poNumber;
data['workNumber'] = _workNumber;
data['state'] = _state;
return data;
}
}