113 lines
3.4 KiB
Dart
113 lines
3.4 KiB
Dart
import 'package:ftc_mobile_app/models/profile_screen_model.dart';
|
|
import '../profileData/user_data.dart';
|
|
import 'LiveRoster.dart';
|
|
import 'Days.dart';
|
|
import 'StaffHolidays.dart';
|
|
|
|
class ShiftArray {
|
|
ShiftArray({
|
|
this.liveRoster,
|
|
this.staffHolidays,
|
|
this.staffUserId,
|
|
this.primaryWeek1EndDate,
|
|
this.primaryWeek2EndDate,
|
|
this.primaryWeek3EndDate,
|
|
this.rosterEndDate,
|
|
this.shiftStartTime,
|
|
this.shiftEndTime,
|
|
this.workHrs,
|
|
this.patientId,
|
|
this.secondaryWeeks,
|
|
this.primaryWeekNo,
|
|
this.noOfShifts,
|
|
this.addedby,
|
|
this.active,
|
|
this.isDelete,
|
|
this.days,
|
|
this.id,
|
|
this.templateId,});
|
|
|
|
ShiftArray.fromJson(dynamic json) {
|
|
liveRoster = json['liveRoster'] != null ? LiveRoster.fromJson(json['liveRoster']) : null;
|
|
staffHolidays = json['staffHolidays'] != null ? StaffHolidays.fromJson(json['staffHolidays']) : null;
|
|
staffUserId = json['staffUserId'] != null ? StaffMembers.fromJson(json['staffUserId']) : null;
|
|
primaryWeek1EndDate = json['primaryWeek1EndDate'];
|
|
primaryWeek2EndDate = json['primaryWeek2EndDate'];
|
|
primaryWeek3EndDate = json['primaryWeek3EndDate'];
|
|
rosterEndDate = json['rosterEndDate'];
|
|
shiftStartTime = json['shiftStartTime'];
|
|
shiftEndTime = json['shiftEndTime'];
|
|
workHrs = json['workHrs'];
|
|
patientId = json['patientId'] != null ? UserData.fromJson(json['patientId']) : null;
|
|
secondaryWeeks = json['secondaryWeeks'] != null ? json['secondaryWeeks'].cast<String>() : [];
|
|
primaryWeekNo = json['primaryWeekNo'];
|
|
noOfShifts = json['noOfShifts'];
|
|
addedby = json['addedby'];
|
|
active = json['active'];
|
|
isDelete = json['isDelete'];
|
|
if (json['days'] != null) {
|
|
days = [];
|
|
json['days'].forEach((v) {
|
|
days?.add(Days.fromJson(v));
|
|
});
|
|
}
|
|
id = json['_id'];
|
|
templateId = json['templateId'];
|
|
}
|
|
LiveRoster? liveRoster;
|
|
StaffHolidays? staffHolidays;
|
|
StaffMembers? staffUserId;
|
|
int? primaryWeek1EndDate;
|
|
int? primaryWeek2EndDate;
|
|
int? primaryWeek3EndDate;
|
|
int? rosterEndDate;
|
|
int? shiftStartTime;
|
|
int? shiftEndTime;
|
|
int? workHrs;
|
|
UserData? patientId;
|
|
List<String>? secondaryWeeks;
|
|
int? primaryWeekNo;
|
|
int? noOfShifts;
|
|
String? addedby;
|
|
bool? active;
|
|
bool? isDelete;
|
|
List<Days>? days;
|
|
String? id;
|
|
String? templateId;
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final map = <String, dynamic>{};
|
|
if (liveRoster != null) {
|
|
map['liveRoster'] = liveRoster?.toJson();
|
|
}
|
|
if (staffHolidays != null) {
|
|
map['staffHolidays'] = staffHolidays?.toJson();
|
|
}
|
|
if (staffUserId != null) {
|
|
map['staffUserId'] = staffUserId?.toJson();
|
|
}
|
|
map['primaryWeek1EndDate'] = primaryWeek1EndDate;
|
|
map['primaryWeek2EndDate'] = primaryWeek2EndDate;
|
|
map['primaryWeek3EndDate'] = primaryWeek3EndDate;
|
|
map['rosterEndDate'] = rosterEndDate;
|
|
map['shiftStartTime'] = shiftStartTime;
|
|
map['shiftEndTime'] = shiftEndTime;
|
|
map['workHrs'] = workHrs;
|
|
if (patientId != null) {
|
|
map['patientId'] = patientId?.toJson();
|
|
}
|
|
map['secondaryWeeks'] = secondaryWeeks;
|
|
map['primaryWeekNo'] = primaryWeekNo;
|
|
map['noOfShifts'] = noOfShifts;
|
|
map['addedby'] = addedby;
|
|
map['active'] = active;
|
|
map['isDelete'] = isDelete;
|
|
if (days != null) {
|
|
map['days'] = days?.map((v) => v.toJson()).toList();
|
|
}
|
|
map['_id'] = id;
|
|
map['templateId'] = templateId;
|
|
return map;
|
|
}
|
|
|
|
} |