import 'package:flutter/material.dart'; import 'package:ftc_mobile_app/models/profileData/user_data.dart'; import 'package:ftc_mobile_app/models/profile_screen_model.dart'; import 'package:ftc_mobile_app/utilities/date_formatter.dart'; import 'ShiftLocationData.dart'; class WeekArrayData { WeekArrayData({ this.weekNo, this.daysArray, this.id, }); WeekArrayData.fromJson(dynamic json) { weekNo = json['weekNo']; if (json['daysArray'] != null) { daysArray = []; json['daysArray'].forEach((v) { daysArray?.add(DaysArrayData.fromJson(v)); }); } id = json['_id']; } int? weekNo; List? daysArray; String? id; Map toJson() { final map = {}; map['weekNo'] = weekNo; if (daysArray != null) { map['daysArray'] = daysArray?.map((v) => v.toJson()).toList(); } map['_id'] = id; return map; } } class DaysArrayData { DaysArrayData({ this.dayName, this.staffAssigned, this.serviceUserAssigned, this.staffUserId, this.shiftDate, this.shiftStartTime, this.shiftEndTime, this.workHrs, this.note, this.serviceUserId, this.isSleepOver, this.isOverNightStay, this.lastModifiedBy, this.active, this.isDelete, this.locationId, this.rosterId, this.isRequested, this.id, }); DaysArrayData.fromJson(dynamic json) { dayName = json['dayName']; staffAssigned = json['staffAssigned']; serviceUserAssigned = json['serviceUserAssigned']; staffUserId = json['staffUserId'] != null ? StaffMembers.fromJson(json['staffUserId']) : null; shiftDate = json['shiftDate']; shiftStartTime = json['shiftStartTime']; shiftEndTime = json['shiftEndTime']; workHrs = json['workHrs']; note = json['note']; serviceUserId = json['serviceUserId'] != null ? UserData.fromJson(json['serviceUserId']) : null; locationId = json['locationId'] is Map ? ShiftLocationData.fromJson(json['locationId']) : null; isSleepOver = json['isSleepOver']; isOverNightStay = json['isOverNightStay']; lastModifiedBy = json['lastModifiedBy']; active = json['active']; isDelete = json['isDelete']; rosterId = json['rosterId']; isRequested = json['isRequested']; id = json['_id']; if (shiftDate != null) { shiftDateTime = DateTime.fromMillisecondsSinceEpoch(shiftDate!).toLocal(); } final f = DateFormatter(); startTime = f.time24to12format(time: shiftStartTime ?? ""); endTime = f.time24to12format(time: shiftEndTime ?? ""); } String? dayName; bool? staffAssigned; bool? serviceUserAssigned; StaffMembers? staffUserId; int? shiftDate; String? shiftStartTime; String? shiftEndTime; int? workHrs; String? note; UserData? serviceUserId; bool? isSleepOver; bool? isOverNightStay; String? lastModifiedBy; bool? active; bool? isDelete; String? rosterId; bool? isRequested; String? id; ShiftLocationData? locationId; // local usage vars DateTime? shiftDateTime; ///stores 12hour format of [shiftStartTime] and [shiftEndTime] TimeOfDay? startTime, endTime; Map toJson() { final map = {}; map['dayName'] = dayName; map['staffAssigned'] = staffAssigned; map['serviceUserAssigned'] = serviceUserAssigned; if (staffUserId != null) { map['staffUserId'] = staffUserId?.toJson(); } map['shiftDate'] = shiftDate; map['shiftStartTime'] = shiftStartTime; map['shiftEndTime'] = shiftEndTime; map['workHrs'] = workHrs; map['note'] = note; if (serviceUserId != null) { map['serviceUserId'] = serviceUserId?.toJson(); } if (locationId != null) { map['locationId'] = locationId?.toJson(); } map['isSleepOver'] = isSleepOver; map['isOverNightStay'] = isOverNightStay; map['lastModifiedBy'] = lastModifiedBy; map['active'] = active; map['isDelete'] = isDelete; map['rosterId'] = rosterId; map['isRequested'] = isRequested; map['_id'] = id; return map; } } // class ServiceUserId { // ServiceUserId({ // this.fcmTokens, // this.location, // this.profileVideoUrl, // this.id, // this.userModelName, // this.name, // this.version, // this.email, // this.phoneNumber, // this.active, // this.role, // this.profilePictureUrl, // this.deviceId, // this.verificationCode, // this.isVerified, // this.approved, // this.blocked, // this.createdAt, // this.updatedAt, // this.v, // this.password, // this.userSettings, // this.modelId,}); // // ServiceUserId.fromJson(dynamic json) { // fcmTokens = json['fcm_tokens'] != null ? FcmTokens.fromJson(json['fcm_tokens']) : null; // location = json['location'] != null ? Location.fromJson(json['location']) : null; // profileVideoUrl = json['profile_video_url']; // id = json['_id']; // userModelName = json['userModelName']; // name = json['name']; // version = json['version']; // email = json['email']; // phoneNumber = json['phoneNumber']; // active = json['active']; // role = json['role']; // profilePictureUrl = json['profile_picture_url']; // deviceId = json['deviceId']; // verificationCode = json['verification_code']; // isVerified = json['is_verified']; // approved = json['approved']; // blocked = json['blocked']; // createdAt = json['createdAt']; // updatedAt = json['updatedAt']; // v = json['__v']; // password = json['password']; // userSettings = json['userSettings']; // modelId = json['modelId'] != null ? ModelId.fromJson(json['modelId']) : null; // } // FcmTokens? fcmTokens; // Location? location; // String? profileVideoUrl; // String? id; // String? userModelName; // String? name; // String? version; // String? email; // String? phoneNumber; // bool? active; // String? role; // String? profilePictureUrl; // String? deviceId; // String? verificationCode; // bool? isVerified; // bool? approved; // bool? blocked; // String? createdAt; // String? updatedAt; // int? v; // String? password; // String? userSettings; // ModelId? modelId; // // Map toJson() { // final map = {}; // if (fcmTokens != null) { // map['fcm_tokens'] = fcmTokens?.toJson(); // } // if (location != null) { // map['location'] = location?.toJson(); // } // map['profile_video_url'] = profileVideoUrl; // map['_id'] = id; // map['userModelName'] = userModelName; // map['name'] = name; // map['version'] = version; // map['email'] = email; // map['phoneNumber'] = phoneNumber; // map['active'] = active; // map['role'] = role; // map['profile_picture_url'] = profilePictureUrl; // map['deviceId'] = deviceId; // map['verification_code'] = verificationCode; // map['is_verified'] = isVerified; // map['approved'] = approved; // map['blocked'] = blocked; // map['createdAt'] = createdAt; // map['updatedAt'] = updatedAt; // map['__v'] = v; // map['password'] = password; // map['userSettings'] = userSettings; // if (modelId != null) { // map['modelId'] = modelId?.toJson(); // } // return map; // } // // } // // class ModelId { // ModelId({ // this.aboutPatient, // this.id, // this.suLastName, // this.suFirstMiddleName, // this.suPreferredName, // this.name, // this.suSsn, // this.providerName, // this.suSex, // this.suTitle, // this.suDOB, // this.suAge, // this.suReferredBY, // this.suFamilyHead, // this.suAddress1, // this.suAddress2, // this.suCity, // this.suState, // this.suZip, // this.suFirstVisitDate, // this.suLastVisitDate, // this.suProvider, // this.currSU, // this.suHomePhone, // this.suWorkPhone, // this.suMobileHomeNo, // this.suMobileWorkNo, // this.suEmailHome, // this.suEmailWork, // this.suPrefHomeNo, // this.suPrefWorkNo, // this.suEmergencyContact, // this.seMedicalAlert, // this.suNote, // this.diagnosises, // this.user, // this.shifts, // this.serviceUserMedications, // this.homeVisitSignOut, // this.srUsShiftsRequired, // this.suEnquiries, // this.active, // this.createdAt, // this.updatedAt, // this.v,}); // // ModelId.fromJson(dynamic json) { // aboutPatient = json['aboutPatient'] != null ? AboutPatient.fromJson(json['aboutPatient']) : null; // id = json['_id']; // suLastName = json['suLastName']; // suFirstMiddleName = json['suFirstMiddleName']; // suPreferredName = json['suPreferredName']; // name = json['name']; // suSsn = json['suSsn']; // providerName = json['providerName']; // suSex = json['suSex']; // suTitle = json['suTitle']; // suDOB = json['suDOB']; // suAge = json['suAge']; // suReferredBY = json['suReferredBY']; // suFamilyHead = json['suFamilyHead']; // suAddress1 = json['suAddress1']; // suAddress2 = json['suAddress2']; // suCity = json['suCity']; // suState = json['suState']; // suZip = json['suZip']; // suFirstVisitDate = json['suFirstVisitDate']; // suLastVisitDate = json['suLastVisitDate']; // if (json['suProvider'] != null) { // suProvider = []; // json['suProvider'].forEach((v) { // suProvider?.add(Dynamic.fromJson(v)); // }); // } // currSU = json['currSU']; // suHomePhone = json['suHomePhone']; // suWorkPhone = json['suWorkPhone']; // suMobileHomeNo = json['suMobileHomeNo']; // suMobileWorkNo = json['suMobileWorkNo']; // suEmailHome = json['suEmailHome']; // suEmailWork = json['suEmailWork']; // suPrefHomeNo = json['suPrefHomeNo']; // suPrefWorkNo = json['suPrefWorkNo']; // suEmergencyContact = json['suEmergencyContact']; // seMedicalAlert = json['seMedicalAlert']; // suNote = json['suNote']; // if (json['diagnosises'] != null) { // diagnosises = []; // json['diagnosises'].forEach((v) { // diagnosises?.add(Diagnosises.fromJson(v)); // }); // } // user = json['user']; // if (json['shifts'] != null) { // shifts = []; // json['shifts'].forEach((v) { // shifts?.add(Dynamic.fromJson(v)); // }); // } // if (json['serviceUserMedications'] != null) { // serviceUserMedications = []; // json['serviceUserMedications'].forEach((v) { // serviceUserMedications?.add(Dynamic.fromJson(v)); // }); // } // if (json['homeVisitSignOut'] != null) { // homeVisitSignOut = []; // json['homeVisitSignOut'].forEach((v) { // homeVisitSignOut?.add(Dynamic.fromJson(v)); // }); // } // if (json['srUsShiftsRequired'] != null) { // srUsShiftsRequired = []; // json['srUsShiftsRequired'].forEach((v) { // srUsShiftsRequired?.add(Dynamic.fromJson(v)); // }); // } // if (json['suEnquiries'] != null) { // suEnquiries = []; // json['suEnquiries'].forEach((v) { // suEnquiries?.add(Dynamic.fromJson(v)); // }); // } // active = json['active']; // createdAt = json['createdAt']; // updatedAt = json['updatedAt']; // v = json['__v']; // } // AboutPatient? aboutPatient; // String? id; // String? suLastName; // String? suFirstMiddleName; // String? suPreferredName; // String? name; // String? suSsn; // String? providerName; // String? suSex; // String? suTitle; // String? suDOB; // String? suAge; // String? suReferredBY; // String? suFamilyHead; // String? suAddress1; // String? suAddress2; // String? suCity; // String? suState; // String? suZip; // String? suFirstVisitDate; // String? suLastVisitDate; // List? suProvider; // bool? currSU; // String? suHomePhone; // String? suWorkPhone; // String? suMobileHomeNo; // String? suMobileWorkNo; // String? suEmailHome; // String? suEmailWork; // String? suPrefHomeNo; // String? suPrefWorkNo; // String? suEmergencyContact; // String? seMedicalAlert; // String? suNote; // List? diagnosises; // String? user; // List? shifts; // List? serviceUserMedications; // List? homeVisitSignOut; // List? srUsShiftsRequired; // List? suEnquiries; // bool? active; // String? createdAt; // String? updatedAt; // int? v; // // Map toJson() { // final map = {}; // if (aboutPatient != null) { // map['aboutPatient'] = aboutPatient?.toJson(); // } // map['_id'] = id; // map['suLastName'] = suLastName; // map['suFirstMiddleName'] = suFirstMiddleName; // map['suPreferredName'] = suPreferredName; // map['name'] = name; // map['suSsn'] = suSsn; // map['providerName'] = providerName; // map['suSex'] = suSex; // map['suTitle'] = suTitle; // map['suDOB'] = suDOB; // map['suAge'] = suAge; // map['suReferredBY'] = suReferredBY; // map['suFamilyHead'] = suFamilyHead; // map['suAddress1'] = suAddress1; // map['suAddress2'] = suAddress2; // map['suCity'] = suCity; // map['suState'] = suState; // map['suZip'] = suZip; // map['suFirstVisitDate'] = suFirstVisitDate; // map['suLastVisitDate'] = suLastVisitDate; // if (suProvider != null) { // map['suProvider'] = suProvider?.map((v) => v.toJson()).toList(); // } // map['currSU'] = currSU; // map['suHomePhone'] = suHomePhone; // map['suWorkPhone'] = suWorkPhone; // map['suMobileHomeNo'] = suMobileHomeNo; // map['suMobileWorkNo'] = suMobileWorkNo; // map['suEmailHome'] = suEmailHome; // map['suEmailWork'] = suEmailWork; // map['suPrefHomeNo'] = suPrefHomeNo; // map['suPrefWorkNo'] = suPrefWorkNo; // map['suEmergencyContact'] = suEmergencyContact; // map['seMedicalAlert'] = seMedicalAlert; // map['suNote'] = suNote; // if (diagnosises != null) { // map['diagnosises'] = diagnosises?.map((v) => v.toJson()).toList(); // } // map['user'] = user; // if (shifts != null) { // map['shifts'] = shifts?.map((v) => v.toJson()).toList(); // } // if (serviceUserMedications != null) { // map['serviceUserMedications'] = serviceUserMedications?.map((v) => v.toJson()).toList(); // } // if (homeVisitSignOut != null) { // map['homeVisitSignOut'] = homeVisitSignOut?.map((v) => v.toJson()).toList(); // } // if (srUsShiftsRequired != null) { // map['srUsShiftsRequired'] = srUsShiftsRequired?.map((v) => v.toJson()).toList(); // } // if (suEnquiries != null) { // map['suEnquiries'] = suEnquiries?.map((v) => v.toJson()).toList(); // } // map['active'] = active; // map['createdAt'] = createdAt; // map['updatedAt'] = updatedAt; // map['__v'] = v; // return map; // } // // } // // class Diagnosises { // Diagnosises({ // this.diagnosisText, // this.diagnosisDate, // this.diagnosisBy, // this.isCurrentDiagnosis, // this.id,}); // // Diagnosises.fromJson(dynamic json) { // diagnosisText = json['diagnosisText']; // diagnosisDate = json['diagnosisDate']; // diagnosisBy = json['diagnosisBy']; // isCurrentDiagnosis = json['isCurrentDiagnosis']; // id = json['_id']; // } // String? diagnosisText; // String? diagnosisDate; // String? diagnosisBy; // bool? isCurrentDiagnosis; // String? id; // // Map toJson() { // final map = {}; // map['diagnosisText'] = diagnosisText; // map['diagnosisDate'] = diagnosisDate; // map['diagnosisBy'] = diagnosisBy; // map['isCurrentDiagnosis'] = isCurrentDiagnosis; // map['_id'] = id; // return map; // } // // } // // class AboutPatient { // AboutPatient({ // this.aboutText, // this.aboutDate, // this.aboutBy,}); // // AboutPatient.fromJson(dynamic json) { // aboutText = json['aboutText']; // aboutDate = json['aboutDate']; // aboutBy = json['aboutBy']; // } // String? aboutText; // String? aboutDate; // String? aboutBy; // // Map toJson() { // final map = {}; // map['aboutText'] = aboutText; // map['aboutDate'] = aboutDate; // map['aboutBy'] = aboutBy; // return map; // } // // } // // class Location { // Location({ // this.type, // this.coordinates,}); // // Location.fromJson(dynamic json) { // type = json['type']; // coordinates = json['coordinates'] != null ? json['coordinates'].cast() : []; // } // String? type; // List? coordinates; // // Map toJson() { // final map = {}; // map['type'] = type; // map['coordinates'] = coordinates; // return map; // } // // } // // class FcmTokens { // FcmTokens({ // this.token, // this.deviceType,}); // // FcmTokens.fromJson(dynamic json) { // token = json['token']; // deviceType = json['deviceType']; // } // String? token; // String? deviceType; // // Map toJson() { // final map = {}; // map['token'] = token; // map['deviceType'] = deviceType; // return map; // } // // } // class StaffUserId { // StaffUserId({ // this.contractedHours, // this.id, // this.staffMemberName, // this.staffDesignation, // this.staffOnLeave, // this.supervisorId, // this.holidays, // this.complianceDocuments, // this.niNumber, // this.kin, // this.user, // this.clients, // this.staffWorkLoads, // this.staffHolidayRequests, // this.staffTrainings, // this.supervision, // this.underSupervisions, // this.staffWorkingDays, // this.stafDob, // this.active, // this.covidCheck, // this.createdAt, // this.updatedAt, // this.v, // this.staffDisciplinaries, // this.staffReferences,}); // // StaffUserId.fromJson(dynamic json) { // contractedHours = json['contractedHours'] != null ? ContractedHours.fromJson(json['contractedHours']) : null; // id = json['_id']; // staffMemberName = json['staffMemberName']; // staffDesignation = json['staffDesignation']; // staffOnLeave = json['staffOnLeave']; // supervisorId = json['supervisorId']; // if (json['holidays'] != null) { // holidays = []; // json['holidays'].forEach((v) { // holidays?.add(Dynamic.fromJson(v)); // }); // } // if (json['complianceDocuments'] != null) { // complianceDocuments = []; // json['complianceDocuments'].forEach((v) { // complianceDocuments?.add(Dynamic.fromJson(v)); // }); // } // niNumber = json['niNumber']; // kin = json['kin']; // user = json['user']; // if (json['clients'] != null) { // clients = []; // json['clients'].forEach((v) { // clients?.add(Dynamic.fromJson(v)); // }); // } // staffWorkLoads = json['staffWorkLoads'] != null ? json['staffWorkLoads'].cast() : []; // if (json['staffHolidayRequests'] != null) { // staffHolidayRequests = []; // json['staffHolidayRequests'].forEach((v) { // staffHolidayRequests?.add(Dynamic.fromJson(v)); // }); // } // if (json['staffTrainings'] != null) { // staffTrainings = []; // json['staffTrainings'].forEach((v) { // staffTrainings?.add(Dynamic.fromJson(v)); // }); // } // supervision = json['supervision'] != null ? Supervision.fromJson(json['supervision']) : null; // if (json['underSupervisions'] != null) { // underSupervisions = []; // json['underSupervisions'].forEach((v) { // underSupervisions?.add(Dynamic.fromJson(v)); // }); // } // if (json['staffWorkingDays'] != null) { // staffWorkingDays = []; // json['staffWorkingDays'].forEach((v) { // staffWorkingDays?.add(Dynamic.fromJson(v)); // }); // } // stafDob = json['stafDob']; // active = json['active']; // covidCheck = json['covidCheck']; // createdAt = json['createdAt']; // updatedAt = json['updatedAt']; // v = json['__v']; // staffDisciplinaries = json['staffDisciplinaries']; // staffReferences = json['staffReferences']; // } // ContractedHours? contractedHours; // String? id; // String? staffMemberName; // String? staffDesignation; // bool? staffOnLeave; // String? supervisorId; // List? holidays; // List? complianceDocuments; // String? niNumber; // String? kin; // String? user; // List? clients; // List? staffWorkLoads; // List? staffHolidayRequests; // List? staffTrainings; // Supervision? supervision; // List? underSupervisions; // List? staffWorkingDays; // String? stafDob; // bool? active; // bool? covidCheck; // String? createdAt; // String? updatedAt; // int? v; // String? staffDisciplinaries; // String? staffReferences; // // Map toJson() { // final map = {}; // if (contractedHours != null) { // map['contractedHours'] = contractedHours?.toJson(); // } // map['_id'] = id; // map['staffMemberName'] = staffMemberName; // map['staffDesignation'] = staffDesignation; // map['staffOnLeave'] = staffOnLeave; // map['supervisorId'] = supervisorId; // if (holidays != null) { // map['holidays'] = holidays?.map((v) => v.toJson()).toList(); // } // if (complianceDocuments != null) { // map['complianceDocuments'] = complianceDocuments?.map((v) => v.toJson()).toList(); // } // map['niNumber'] = niNumber; // map['kin'] = kin; // map['user'] = user; // if (clients != null) { // map['clients'] = clients?.map((v) => v.toJson()).toList(); // } // map['staffWorkLoads'] = staffWorkLoads; // if (staffHolidayRequests != null) { // map['staffHolidayRequests'] = staffHolidayRequests?.map((v) => v.toJson()).toList(); // } // if (staffTrainings != null) { // map['staffTrainings'] = staffTrainings?.map((v) => v.toJson()).toList(); // } // if (supervision != null) { // map['supervision'] = supervision?.toJson(); // } // if (underSupervisions != null) { // map['underSupervisions'] = underSupervisions?.map((v) => v.toJson()).toList(); // } // if (staffWorkingDays != null) { // map['staffWorkingDays'] = staffWorkingDays?.map((v) => v.toJson()).toList(); // } // map['stafDob'] = stafDob; // map['active'] = active; // map['covidCheck'] = covidCheck; // map['createdAt'] = createdAt; // map['updatedAt'] = updatedAt; // map['__v'] = v; // map['staffDisciplinaries'] = staffDisciplinaries; // map['staffReferences'] = staffReferences; // return map; // } // // } // // class Supervision { // Supervision({ // this.supervisionName, // this.sprDueDate, // this.sprStatus, // this.sprResult, // this.templateTitleId,}); // // Supervision.fromJson(dynamic json) { // supervisionName = json['supervisionName']; // sprDueDate = json['sprDueDate']; // sprStatus = json['sprStatus']; // sprResult = json['sprResult']; // templateTitleId = json['templateTitleId']; // } // String? supervisionName; // String? sprDueDate; // String? sprStatus; // String? sprResult; // String? templateTitleId; // // Map toJson() { // final map = {}; // map['supervisionName'] = supervisionName; // map['sprDueDate'] = sprDueDate; // map['sprStatus'] = sprStatus; // map['sprResult'] = sprResult; // map['templateTitleId'] = templateTitleId; // return map; // } // // } // // class ContractedHours { // ContractedHours({ // this.contractedHours, // this.totalShiftHoursWeek, // this.noOfShifts,}); // // ContractedHours.fromJson(dynamic json) { // contractedHours = json['contractedHours']; // totalShiftHoursWeek = json['totalShiftHoursWeek']; // noOfShifts = json['noOfShifts']; // } // int? contractedHours; // int? totalShiftHoursWeek; // int? noOfShifts; // // Map toJson() { // final map = {}; // map['contractedHours'] = contractedHours; // map['totalShiftHoursWeek'] = totalShiftHoursWeek; // map['noOfShifts'] = noOfShifts; // return map; // } // // }