Merge branch 'refs/heads/design_3.0_sdk_upgrade' into design_3.0_waseem_dev
# Conflicts: # lib/service_request_latest/views/components/request_detail_view.dartdesign_3.0_demo_module
commit
acbf33e2a2
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
@ -1,751 +0,0 @@
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
|
||||
class WorkOrderDetail {
|
||||
WorkOrder? data;
|
||||
String? message;
|
||||
String? title;
|
||||
String? innerMessage;
|
||||
int? responseCode;
|
||||
bool? isSuccess;
|
||||
|
||||
WorkOrderDetail({this.data, this.message, this.title, this.innerMessage, this.responseCode, this.isSuccess});
|
||||
|
||||
factory WorkOrderDetail.fromJson(Map<String, dynamic> json) {
|
||||
return WorkOrderDetail(
|
||||
data: json['data'] == null ? null : WorkOrder.fromJson(json['data']),
|
||||
message: json['message'],
|
||||
title: json['title'],
|
||||
innerMessage: json['innerMessage'],
|
||||
responseCode: json['responseCode'],
|
||||
isSuccess: json['isSuccess'],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'data': data?.toJson(),
|
||||
'message': message,
|
||||
'title': title,
|
||||
'innerMessage': innerMessage,
|
||||
'responseCode': responseCode,
|
||||
'isSuccess': isSuccess,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class WorkOrder {
|
||||
String? workOrderNo;
|
||||
WorkOrderCreatedBy? workOrderCreatedBy;
|
||||
DateTime? requestedDate;
|
||||
Asset? asset;
|
||||
Lookup? assetGroup;
|
||||
Lookup? manufacturer;
|
||||
Lookup? model;
|
||||
Lookup? assetNDModel;
|
||||
Site? site;
|
||||
Lookup? building;
|
||||
Lookup? floor;
|
||||
Lookup? department;
|
||||
dynamic room;
|
||||
Lookup? assetType;
|
||||
AssignedEmployee? assignedEmployee;
|
||||
dynamic lastActivityStatus;
|
||||
Lookup? status;
|
||||
Lookup? nextStep;
|
||||
dynamic assetVerificationType;
|
||||
List<WorkOrderContactPerson>? workOrderContactPerson;
|
||||
EquipmentStatus? equipmentStatus;
|
||||
Priority? priority;
|
||||
RequestedThrough? requestedThrough;
|
||||
TypeOfRequest? typeofRequest;
|
||||
dynamic loanAvailablity;
|
||||
dynamic assetLoan;
|
||||
dynamic safety;
|
||||
ProblemDescription? problemDescription;
|
||||
String? comments;
|
||||
String? voiceNote;
|
||||
List<dynamic>? workOrderAttachments;
|
||||
dynamic returnToService;
|
||||
dynamic serviceType;
|
||||
dynamic failureReasone;
|
||||
dynamic solution;
|
||||
dynamic totalWorkingHours;
|
||||
List<WorkOrderHistory>? workOrderHistory;
|
||||
List<dynamic>? activityMaintenances;
|
||||
List<dynamic>? activitySpareParts;
|
||||
List<dynamic>? activityAssetToBeRetireds;
|
||||
|
||||
WorkOrder({
|
||||
this.workOrderNo,
|
||||
this.workOrderCreatedBy,
|
||||
this.requestedDate,
|
||||
this.asset,
|
||||
this.assetGroup,
|
||||
this.manufacturer,
|
||||
this.model,
|
||||
this.assetNDModel,
|
||||
this.site,
|
||||
this.building,
|
||||
this.floor,
|
||||
this.department,
|
||||
this.room,
|
||||
this.assetType,
|
||||
this.assignedEmployee,
|
||||
this.lastActivityStatus,
|
||||
this.status,
|
||||
this.nextStep,
|
||||
this.assetVerificationType,
|
||||
this.workOrderContactPerson,
|
||||
this.equipmentStatus,
|
||||
this.priority,
|
||||
this.requestedThrough,
|
||||
this.typeofRequest,
|
||||
this.loanAvailablity,
|
||||
this.assetLoan,
|
||||
this.safety,
|
||||
this.problemDescription,
|
||||
this.comments,
|
||||
this.voiceNote,
|
||||
this.workOrderAttachments,
|
||||
this.returnToService,
|
||||
this.serviceType,
|
||||
this.failureReasone,
|
||||
this.solution,
|
||||
this.totalWorkingHours,
|
||||
this.workOrderHistory,
|
||||
this.activityMaintenances,
|
||||
this.activitySpareParts,
|
||||
this.activityAssetToBeRetireds,
|
||||
});
|
||||
|
||||
factory WorkOrder.fromJson(Map<String, dynamic> json) {
|
||||
return WorkOrder(
|
||||
workOrderNo: json['workOrderNo'],
|
||||
workOrderCreatedBy: WorkOrderCreatedBy.fromJson(json['workOrderCreatedBy']),
|
||||
requestedDate: DateTime.parse(json['requestedDate']),
|
||||
asset: Asset.fromJson(json['asset']),
|
||||
assetGroup: json['assetGroup'] ?? Lookup.fromJson(json['assetGroup']),
|
||||
manufacturer: json['manufacturer'] ?? Lookup.fromJson(json['manufacturer']),
|
||||
model: json['model'] ?? Lookup.fromJson(json['model']),
|
||||
assetNDModel: json['assetNDModel'] ?? Lookup.fromJson(json['assetNDModel']),
|
||||
site: Site.fromJson(json['site']),
|
||||
building: json['building'] ?? Lookup.fromJson(json['building']),
|
||||
floor: json['floor'] ?? Lookup.fromJson(json['floor']),
|
||||
department: json['department'] ?? Lookup.fromJson(json['department']),
|
||||
room: json['room'],
|
||||
assetType: json['assetType'] ?? Lookup.fromJson(json['assetType']),
|
||||
assignedEmployee: AssignedEmployee.fromJson(json['assignedEmployee']),
|
||||
lastActivityStatus: json['lastActivityStatus'],
|
||||
status: json['status'] ?? Lookup.fromJson(json['status']),
|
||||
nextStep: json['nextStep'] ?? Lookup.fromJson(json['nextStep']),
|
||||
assetVerificationType: json['assetVerificationType'],
|
||||
workOrderContactPerson: (json['workOrderContactPerson'] as List).map((i) => WorkOrderContactPerson.fromJson(i)).toList(),
|
||||
equipmentStatus: EquipmentStatus.fromJson(json['equipmentStatus']),
|
||||
priority: Priority.fromJson(json['priority']),
|
||||
requestedThrough: RequestedThrough.fromJson(json['requestedThrough']),
|
||||
typeofRequest: TypeOfRequest.fromJson(json['typeofRequest']),
|
||||
loanAvailablity: json['loanAvailablity'],
|
||||
assetLoan: json['assetLoan'],
|
||||
safety: json['safety'],
|
||||
problemDescription: ProblemDescription.fromJson(json['problemDescription']),
|
||||
comments: json['comments'],
|
||||
voiceNote: json['voiceNote'],
|
||||
workOrderAttachments: json['workOrderAttachments'] as List,
|
||||
returnToService: json['returnToService'],
|
||||
serviceType: json['serviceType'],
|
||||
failureReasone: json['failureReasone'],
|
||||
solution: json['solution'],
|
||||
totalWorkingHours: json['totalWorkingHours'],
|
||||
workOrderHistory: (json['workOrderHistory'] as List).map((i) => WorkOrderHistory.fromJson(i)).toList(),
|
||||
activityMaintenances: json['activityMaintenances'] as List,
|
||||
activitySpareParts: json['activitySpareParts'] as List,
|
||||
activityAssetToBeRetireds: json['activityAssetToBeRetireds'] as List,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'workOrderNo': workOrderNo,
|
||||
'workOrderCreatedBy': workOrderCreatedBy?.toJson(),
|
||||
'requestedDate': requestedDate?.toIso8601String(),
|
||||
'asset': asset?.toJson(),
|
||||
'assetGroup': assetGroup?.toJson(),
|
||||
'manufacturer': manufacturer?.toJson(),
|
||||
'model': model?.toJson(),
|
||||
'assetNDModel': assetNDModel?.toJson(),
|
||||
'site': site?.toJson(),
|
||||
'building': building?.toJson(),
|
||||
'floor': floor?.toJson(),
|
||||
'department': department?.toJson(),
|
||||
'room': room,
|
||||
'assetType': assetType?.toJson(),
|
||||
'assignedEmployee': assignedEmployee?.toJson(),
|
||||
'lastActivityStatus': lastActivityStatus,
|
||||
'status': status?.toJson(),
|
||||
'nextStep': nextStep?.toJson(),
|
||||
'assetVerificationType': assetVerificationType,
|
||||
'workOrderContactPerson': workOrderContactPerson?.map((i) => i.toJson()).toList(),
|
||||
'equipmentStatus': equipmentStatus?.toJson(),
|
||||
'priority': priority?.toJson(),
|
||||
'requestedThrough': requestedThrough?.toJson(),
|
||||
'typeofRequest': typeofRequest?.toJson(),
|
||||
'loanAvailablity': loanAvailablity,
|
||||
'assetLoan': assetLoan,
|
||||
'safety': safety,
|
||||
'problemDescription': problemDescription?.toJson(),
|
||||
'comments': comments,
|
||||
'voiceNote': voiceNote,
|
||||
'workOrderAttachments': workOrderAttachments,
|
||||
'returnToService': returnToService,
|
||||
'serviceType': serviceType,
|
||||
'failureReasone': failureReasone,
|
||||
'solution': solution,
|
||||
'totalWorkingHours': totalWorkingHours,
|
||||
'workOrderHistory': workOrderHistory?.map((i) => i.toJson()).toList(),
|
||||
'activityMaintenances': activityMaintenances,
|
||||
'activitySpareParts': activitySpareParts,
|
||||
'activityAssetToBeRetireds': activityAssetToBeRetireds,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class WorkOrderCreatedBy {
|
||||
String? id;
|
||||
String? userName;
|
||||
|
||||
WorkOrderCreatedBy({this.id, this.userName});
|
||||
|
||||
factory WorkOrderCreatedBy.fromJson(Map<String, dynamic> json) {
|
||||
return WorkOrderCreatedBy(id: json['id'], userName: json['userName']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {'id': id, 'userName': userName};
|
||||
}
|
||||
}
|
||||
|
||||
class Asset {
|
||||
int? id;
|
||||
String? assetNumber;
|
||||
|
||||
Asset({this.id, this.assetNumber});
|
||||
|
||||
factory Asset.fromJson(Map<String, dynamic> json) {
|
||||
return Asset(id: json['id'], assetNumber: json['assetNumber']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {'id': id, 'assetNumber': assetNumber};
|
||||
}
|
||||
}
|
||||
|
||||
class WorkOrderContactPerson {
|
||||
int? id;
|
||||
String? name;
|
||||
String? employeeId;
|
||||
String? position;
|
||||
String? extension;
|
||||
String? email;
|
||||
String? mobilePhone;
|
||||
ContactUser? contactUser;
|
||||
|
||||
WorkOrderContactPerson({this.id, this.name, this.employeeId, this.position, this.extension, this.email, this.mobilePhone, this.contactUser});
|
||||
|
||||
factory WorkOrderContactPerson.fromJson(Map<String, dynamic> json) {
|
||||
return WorkOrderContactPerson(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
employeeId: json['employeeId'],
|
||||
position: json['position'],
|
||||
extension: json['extension'],
|
||||
email: json['email'],
|
||||
mobilePhone: json['mobilePhone'],
|
||||
contactUser: json['contactUser'] == null ? null : ContactUser.fromJson(json['contactUser']),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'employeeId': employeeId,
|
||||
'position': position,
|
||||
'extension': extension,
|
||||
'email': email,
|
||||
'mobilePhone': mobilePhone,
|
||||
'contactUser': contactUser?.toJson(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class ContactUser {
|
||||
String? id;
|
||||
String? userName;
|
||||
|
||||
ContactUser({this.id, this.userName});
|
||||
|
||||
factory ContactUser.fromJson(Map<String, dynamic> json) {
|
||||
return ContactUser(id: json['id'], userName: json['userName']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {'id': id, 'userName': userName};
|
||||
}
|
||||
}
|
||||
|
||||
class AssignedEmployee {
|
||||
String? id;
|
||||
String? userName;
|
||||
|
||||
AssignedEmployee({this.id, this.userName});
|
||||
|
||||
factory AssignedEmployee.fromJson(Map<String, dynamic> json) {
|
||||
return AssignedEmployee(id: json['id'], userName: json['userName']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {'id': id, 'userName': userName};
|
||||
}
|
||||
}
|
||||
|
||||
class Site {
|
||||
int? id;
|
||||
String? siteName;
|
||||
|
||||
Site({this.id, this.siteName});
|
||||
|
||||
factory Site.fromJson(Map<String, dynamic> json) {
|
||||
return Site(id: json['id'], siteName: json['siteName']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {'id': id, 'siteName': siteName};
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
// class AssetGroup {
|
||||
// int id;
|
||||
// String name;
|
||||
//
|
||||
// AssetGroup({this.id, this.name});
|
||||
//
|
||||
// factory AssetGroup.fromJson(Map<String, dynamic> json) {
|
||||
// return AssetGroup(
|
||||
// id: json['id'],
|
||||
// name: json['name'],
|
||||
// );
|
||||
// }
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {
|
||||
// 'id': id,
|
||||
// 'name': name,
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// class Manufacturer {
|
||||
// int id;
|
||||
// String name;
|
||||
//
|
||||
// Manufacturer({this.id, this.name});
|
||||
//
|
||||
// factory Manufacturer.fromJson(Map<String, dynamic> json) {
|
||||
// return Manufacturer(
|
||||
// id: json['id'],
|
||||
// name: json['name'],
|
||||
// );
|
||||
// }
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {
|
||||
// 'id': id,
|
||||
// 'name': name,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class Model {
|
||||
// int id;
|
||||
// String name;
|
||||
//
|
||||
// Model({this.id, this.name});
|
||||
//
|
||||
// factory Model.fromJson(Map<String, dynamic> json) {
|
||||
// return Model(
|
||||
// id: json['id'],
|
||||
// name: json['name'],
|
||||
// );
|
||||
// }
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {
|
||||
// 'id': id,
|
||||
// 'name': name,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class AssetNDModel {
|
||||
// int id;
|
||||
// String name;
|
||||
//
|
||||
// AssetNDModel({this.id, this.name});
|
||||
//
|
||||
// factory AssetNDModel.fromJson(Map<String, dynamic> json) {
|
||||
// return AssetNDModel(
|
||||
// id: json['id'],
|
||||
// name: json['name'],
|
||||
// );
|
||||
// }
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {
|
||||
// 'id': id,
|
||||
// 'name': name,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class Building {
|
||||
// int id;
|
||||
// String name;
|
||||
// int value;
|
||||
//
|
||||
// Building({this.id, this.name, this.value});
|
||||
//
|
||||
// factory Building.fromJson(Map<String, dynamic> json) {
|
||||
// return Building(
|
||||
// id: json['id'],
|
||||
// name: json['name'],
|
||||
// value: json['value'],
|
||||
// );
|
||||
// }
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {
|
||||
// 'id': id,
|
||||
// 'name': name,
|
||||
// 'value': value,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class Floor {
|
||||
// int id;
|
||||
// String name;
|
||||
// int value;
|
||||
//
|
||||
// Floor({this.id, this.name, this.value});
|
||||
//
|
||||
// factory Floor.fromJson(Map<String, dynamic> json) {
|
||||
// return Floor(
|
||||
// id: json['id'],
|
||||
// name: json['name'],
|
||||
// value: json['value'],
|
||||
// );
|
||||
// }
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {
|
||||
// 'id': id,
|
||||
// 'name': name,
|
||||
// 'value': value,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class Department {
|
||||
// int id;
|
||||
// String name;
|
||||
//
|
||||
// Department({this.id, this.name});
|
||||
//
|
||||
// factory Department.fromJson(Map<String, dynamic> json) {
|
||||
// return Department(
|
||||
// id: json['id'],
|
||||
// name: json['name'],
|
||||
// );
|
||||
// }
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {
|
||||
// 'id': id,
|
||||
// 'name': name,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class AssetType {
|
||||
// int id;
|
||||
// String name;
|
||||
// int value;
|
||||
//
|
||||
// AssetType({this.id, this.name, this.value});
|
||||
//
|
||||
// factory AssetType.fromJson(Map<String, dynamic> json) {
|
||||
// return AssetType(
|
||||
// id: json['id'],
|
||||
// name: json['name'],
|
||||
// value: json['value'],
|
||||
// );
|
||||
// }
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {
|
||||
// 'id': id,
|
||||
// 'name': name,
|
||||
// 'value': value,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class Status {
|
||||
// int id;
|
||||
// String name;
|
||||
// int value;
|
||||
//
|
||||
// Status({this.id, this.name, this.value});
|
||||
//
|
||||
// factory Status.fromJson(Map<String, dynamic> json) {
|
||||
// return Status(
|
||||
// id: json['id'],
|
||||
// name: json['name'],
|
||||
// value: json['value'],
|
||||
// );
|
||||
// }
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {
|
||||
// 'id': id,
|
||||
// 'name': name,
|
||||
// 'value': value,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class NextStep {
|
||||
// int id;
|
||||
// String name;
|
||||
// int value;
|
||||
//
|
||||
// NextStep({this.id, this.name, this.value});
|
||||
//
|
||||
// factory NextStep.fromJson(Map<String, dynamic> json) {
|
||||
// return NextStep(
|
||||
// id: json['id'],
|
||||
// name: json['name'],
|
||||
// value: json['value'],
|
||||
// );
|
||||
// }
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {
|
||||
// 'id': id,
|
||||
// 'name': name,
|
||||
// 'value': value,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
|
||||
class EquipmentStatus {
|
||||
int? id;
|
||||
String? name;
|
||||
int? value;
|
||||
|
||||
EquipmentStatus({this.id, this.name, this.value});
|
||||
|
||||
factory EquipmentStatus.fromJson(Map<String, dynamic> json) {
|
||||
return EquipmentStatus(id: json['id'], name: json['name'], value: json['value']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {'id': id, 'name': name, 'value': value};
|
||||
}
|
||||
}
|
||||
|
||||
class Priority {
|
||||
int? id;
|
||||
String? name;
|
||||
int? value;
|
||||
|
||||
Priority({this.id, this.name, this.value});
|
||||
|
||||
factory Priority.fromJson(Map<String, dynamic> json) {
|
||||
return Priority(id: json['id'], name: json['name'], value: json['value']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {'id': id, 'name': name, 'value': value};
|
||||
}
|
||||
}
|
||||
|
||||
class RequestedThrough {
|
||||
int? id;
|
||||
String? name;
|
||||
|
||||
RequestedThrough({this.id, this.name});
|
||||
|
||||
factory RequestedThrough.fromJson(Map<String, dynamic> json) {
|
||||
return RequestedThrough(id: json['id'], name: json['name']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {'id': id, 'name': name};
|
||||
}
|
||||
}
|
||||
|
||||
class TypeOfRequest {
|
||||
int? id;
|
||||
String? name;
|
||||
|
||||
TypeOfRequest({this.id, this.name});
|
||||
|
||||
factory TypeOfRequest.fromJson(Map<String, dynamic> json) {
|
||||
return TypeOfRequest(id: json['id'], name: json['name']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {'id': id, 'name': name};
|
||||
}
|
||||
}
|
||||
|
||||
class ProblemDescription {
|
||||
int? id;
|
||||
String? name;
|
||||
|
||||
ProblemDescription({this.id, this.name});
|
||||
|
||||
factory ProblemDescription.fromJson(Map<String, dynamic> json) {
|
||||
return ProblemDescription(id: json['id'], name: json['name']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {'id': id, 'name': name};
|
||||
}
|
||||
}
|
||||
|
||||
class WorkOrderHistory {
|
||||
int? id;
|
||||
Lookup? workOrderStatus;
|
||||
dynamic activityStatus; // Since activityStatus is null, it's dynamic
|
||||
String? date;
|
||||
HistoryUser? user;
|
||||
Lookup? step;
|
||||
dynamic fixRemotelyStartTime; // Since it's null, it's dynamic
|
||||
dynamic fixRemotelyEndTime; // Since it's null, it's dynamic
|
||||
dynamic fixRemotelyWorkingHours; // Since it's null, it's dynamic
|
||||
String? comments;
|
||||
dynamic needAVisitDateTime; // Since it's null, it's dynamic
|
||||
|
||||
WorkOrderHistory(
|
||||
{this.id,
|
||||
this.workOrderStatus,
|
||||
this.activityStatus,
|
||||
this.date,
|
||||
this.user,
|
||||
this.step,
|
||||
this.fixRemotelyStartTime,
|
||||
this.fixRemotelyEndTime,
|
||||
this.fixRemotelyWorkingHours,
|
||||
this.comments,
|
||||
this.needAVisitDateTime});
|
||||
|
||||
factory WorkOrderHistory.fromJson(Map<String, dynamic> json) {
|
||||
return WorkOrderHistory(
|
||||
id: json['id'],
|
||||
//json['assetType'] != null ? Lookup.fromJson(json['assetType']) : null;
|
||||
workOrderStatus: json['workorderStatus'] ?? Lookup.fromJson(json['workorderStatus']),
|
||||
activityStatus: json['activityStatus'],
|
||||
date: json['date'],
|
||||
user: HistoryUser.fromJson(json['user']),
|
||||
step: json['step'] ?? Lookup.fromJson(json['step']),
|
||||
fixRemotelyStartTime: json['fixRemotlyStartTime'],
|
||||
fixRemotelyEndTime: json['fixRemotlyEndTime'],
|
||||
fixRemotelyWorkingHours: json['fixRemotlyWorkingHours'],
|
||||
comments: json['comments'] ?? "",
|
||||
needAVisitDateTime: json['needAVisitDateTime'],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
// Lookup.fromJson(json['workorderStatus'])
|
||||
'workorderStatus': workOrderStatus?.toJson(),
|
||||
'activityStatus': activityStatus,
|
||||
'date': date,
|
||||
'user': user?.toJson(),
|
||||
'step': step?.toJson(),
|
||||
'fixRemotelyStartTime': fixRemotelyStartTime,
|
||||
'fixRemotelyEndTime': fixRemotelyEndTime,
|
||||
'fixRemotelyWorkingHours': fixRemotelyWorkingHours,
|
||||
'comments': comments,
|
||||
'needAVisitDateTime': needAVisitDateTime,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// class WorkOrderStatus {
|
||||
// int id;
|
||||
// String name;
|
||||
// int value;
|
||||
//
|
||||
// WorkOrderStatus({
|
||||
// this.id,
|
||||
// this.name,
|
||||
// this.value,
|
||||
// });
|
||||
//
|
||||
// factory WorkOrderStatus.fromJson(Map<String, dynamic> json) {
|
||||
// return WorkOrderStatus(
|
||||
// id: json['id'],
|
||||
// name: json['name'],
|
||||
// value: json['value'],
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {
|
||||
// 'id': id,
|
||||
// 'name': name,
|
||||
// 'value': value,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
|
||||
class HistoryUser {
|
||||
String? id;
|
||||
String? userName;
|
||||
|
||||
HistoryUser({this.id, this.userName});
|
||||
|
||||
factory HistoryUser.fromJson(Map<String, dynamic> json) {
|
||||
return HistoryUser(id: json['id'], userName: json['userName']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {'id': id, 'userName': userName};
|
||||
}
|
||||
}
|
||||
|
||||
// class Step {
|
||||
// int id;
|
||||
// String name;
|
||||
// int value;
|
||||
//
|
||||
// Step({
|
||||
// this.id,
|
||||
// this.name,
|
||||
// this.value,
|
||||
// });
|
||||
//
|
||||
// factory Step.fromJson(Map<String, dynamic> json) {
|
||||
// return Step(
|
||||
// id: json['id'],
|
||||
// name: json['name'],
|
||||
// value: json['value'],
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {
|
||||
// 'id': id,
|
||||
// 'name': name,
|
||||
// 'value': value,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
@ -0,0 +1,751 @@
|
||||
// import 'package:test_sa/models/lookup.dart';
|
||||
//
|
||||
// class WorkOrderDetail {
|
||||
// WorkOrder? data;
|
||||
// String? message;
|
||||
// String? title;
|
||||
// String? innerMessage;
|
||||
// int? responseCode;
|
||||
// bool? isSuccess;
|
||||
//
|
||||
// WorkOrderDetail({this.data, this.message, this.title, this.innerMessage, this.responseCode, this.isSuccess});
|
||||
//
|
||||
// factory WorkOrderDetail.fromJson(Map<String, dynamic> json) {
|
||||
// return WorkOrderDetail(
|
||||
// data: json['data'] == null ? null : WorkOrder.fromJson(json['data']),
|
||||
// message: json['message'],
|
||||
// title: json['title'],
|
||||
// innerMessage: json['innerMessage'],
|
||||
// responseCode: json['responseCode'],
|
||||
// isSuccess: json['isSuccess'],
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {
|
||||
// 'data': data?.toJson(),
|
||||
// 'message': message,
|
||||
// 'title': title,
|
||||
// 'innerMessage': innerMessage,
|
||||
// 'responseCode': responseCode,
|
||||
// 'isSuccess': isSuccess,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class WorkOrder {
|
||||
// String? workOrderNo;
|
||||
// WorkOrderCreatedBy? workOrderCreatedBy;
|
||||
// DateTime? requestedDate;
|
||||
// Asset? asset;
|
||||
// Lookup? assetGroup;
|
||||
// Lookup? manufacturer;
|
||||
// Lookup? model;
|
||||
// Lookup? assetNDModel;
|
||||
// Site? site;
|
||||
// Lookup? building;
|
||||
// Lookup? floor;
|
||||
// Lookup? department;
|
||||
// dynamic room;
|
||||
// Lookup? assetType;
|
||||
// AssignedEmployee? assignedEmployee;
|
||||
// dynamic lastActivityStatus;
|
||||
// Lookup? status;
|
||||
// Lookup? nextStep;
|
||||
// dynamic assetVerificationType;
|
||||
// List<WorkOrderContactPerson>? workOrderContactPerson;
|
||||
// EquipmentStatus? equipmentStatus;
|
||||
// Priority? priority;
|
||||
// RequestedThrough? requestedThrough;
|
||||
// TypeOfRequest? typeofRequest;
|
||||
// dynamic loanAvailablity;
|
||||
// dynamic assetLoan;
|
||||
// dynamic safety;
|
||||
// ProblemDescription? problemDescription;
|
||||
// String? comments;
|
||||
// String? voiceNote;
|
||||
// List<dynamic>? workOrderAttachments;
|
||||
// dynamic returnToService;
|
||||
// dynamic serviceType;
|
||||
// dynamic failureReasone;
|
||||
// dynamic solution;
|
||||
// dynamic totalWorkingHours;
|
||||
// List<WorkOrderHistory>? workOrderHistory;
|
||||
// List<dynamic>? activityMaintenances;
|
||||
// List<dynamic>? activitySpareParts;
|
||||
// List<dynamic>? activityAssetToBeRetireds;
|
||||
//
|
||||
// WorkOrder({
|
||||
// this.workOrderNo,
|
||||
// this.workOrderCreatedBy,
|
||||
// this.requestedDate,
|
||||
// this.asset,
|
||||
// this.assetGroup,
|
||||
// this.manufacturer,
|
||||
// this.model,
|
||||
// this.assetNDModel,
|
||||
// this.site,
|
||||
// this.building,
|
||||
// this.floor,
|
||||
// this.department,
|
||||
// this.room,
|
||||
// this.assetType,
|
||||
// this.assignedEmployee,
|
||||
// this.lastActivityStatus,
|
||||
// this.status,
|
||||
// this.nextStep,
|
||||
// this.assetVerificationType,
|
||||
// this.workOrderContactPerson,
|
||||
// this.equipmentStatus,
|
||||
// this.priority,
|
||||
// this.requestedThrough,
|
||||
// this.typeofRequest,
|
||||
// this.loanAvailablity,
|
||||
// this.assetLoan,
|
||||
// this.safety,
|
||||
// this.problemDescription,
|
||||
// this.comments,
|
||||
// this.voiceNote,
|
||||
// this.workOrderAttachments,
|
||||
// this.returnToService,
|
||||
// this.serviceType,
|
||||
// this.failureReasone,
|
||||
// this.solution,
|
||||
// this.totalWorkingHours,
|
||||
// this.workOrderHistory,
|
||||
// this.activityMaintenances,
|
||||
// this.activitySpareParts,
|
||||
// this.activityAssetToBeRetireds,
|
||||
// });
|
||||
//
|
||||
// factory WorkOrder.fromJson(Map<String, dynamic> json) {
|
||||
// return WorkOrder(
|
||||
// workOrderNo: json['workOrderNo'],
|
||||
// workOrderCreatedBy: WorkOrderCreatedBy.fromJson(json['workOrderCreatedBy']),
|
||||
// requestedDate: DateTime.parse(json['requestedDate']),
|
||||
// asset: Asset.fromJson(json['asset']),
|
||||
// assetGroup: json['assetGroup'] ?? Lookup.fromJson(json['assetGroup']),
|
||||
// manufacturer: json['manufacturer'] ?? Lookup.fromJson(json['manufacturer']),
|
||||
// model: json['model'] ?? Lookup.fromJson(json['model']),
|
||||
// assetNDModel: json['assetNDModel'] ?? Lookup.fromJson(json['assetNDModel']),
|
||||
// site: Site.fromJson(json['site']),
|
||||
// building: json['building'] ?? Lookup.fromJson(json['building']),
|
||||
// floor: json['floor'] ?? Lookup.fromJson(json['floor']),
|
||||
// department: json['department'] ?? Lookup.fromJson(json['department']),
|
||||
// room: json['room'],
|
||||
// assetType: json['assetType'] ?? Lookup.fromJson(json['assetType']),
|
||||
// assignedEmployee: AssignedEmployee.fromJson(json['assignedEmployee']),
|
||||
// lastActivityStatus: json['lastActivityStatus'],
|
||||
// status: json['status'] ?? Lookup.fromJson(json['status']),
|
||||
// nextStep: json['nextStep'] ?? Lookup.fromJson(json['nextStep']),
|
||||
// assetVerificationType: json['assetVerificationType'],
|
||||
// workOrderContactPerson: (json['workOrderContactPerson'] as List).map((i) => WorkOrderContactPerson.fromJson(i)).toList(),
|
||||
// equipmentStatus: EquipmentStatus.fromJson(json['equipmentStatus']),
|
||||
// priority: Priority.fromJson(json['priority']),
|
||||
// requestedThrough: RequestedThrough.fromJson(json['requestedThrough']),
|
||||
// typeofRequest: TypeOfRequest.fromJson(json['typeofRequest']),
|
||||
// loanAvailablity: json['loanAvailablity'],
|
||||
// assetLoan: json['assetLoan'],
|
||||
// safety: json['safety'],
|
||||
// problemDescription: ProblemDescription.fromJson(json['problemDescription']),
|
||||
// comments: json['comments'],
|
||||
// voiceNote: json['voiceNote'],
|
||||
// workOrderAttachments: json['workOrderAttachments'] as List,
|
||||
// returnToService: json['returnToService'],
|
||||
// serviceType: json['serviceType'],
|
||||
// failureReasone: json['failureReasone'],
|
||||
// solution: json['solution'],
|
||||
// totalWorkingHours: json['totalWorkingHours'],
|
||||
// workOrderHistory: (json['workOrderHistory'] as List).map((i) => WorkOrderHistory.fromJson(i)).toList(),
|
||||
// activityMaintenances: json['activityMaintenances'] as List,
|
||||
// activitySpareParts: json['activitySpareParts'] as List,
|
||||
// activityAssetToBeRetireds: json['activityAssetToBeRetireds'] as List,
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {
|
||||
// 'workOrderNo': workOrderNo,
|
||||
// 'workOrderCreatedBy': workOrderCreatedBy?.toJson(),
|
||||
// 'requestedDate': requestedDate?.toIso8601String(),
|
||||
// 'asset': asset?.toJson(),
|
||||
// 'assetGroup': assetGroup?.toJson(),
|
||||
// 'manufacturer': manufacturer?.toJson(),
|
||||
// 'model': model?.toJson(),
|
||||
// 'assetNDModel': assetNDModel?.toJson(),
|
||||
// 'site': site?.toJson(),
|
||||
// 'building': building?.toJson(),
|
||||
// 'floor': floor?.toJson(),
|
||||
// 'department': department?.toJson(),
|
||||
// 'room': room,
|
||||
// 'assetType': assetType?.toJson(),
|
||||
// 'assignedEmployee': assignedEmployee?.toJson(),
|
||||
// 'lastActivityStatus': lastActivityStatus,
|
||||
// 'status': status?.toJson(),
|
||||
// 'nextStep': nextStep?.toJson(),
|
||||
// 'assetVerificationType': assetVerificationType,
|
||||
// 'workOrderContactPerson': workOrderContactPerson?.map((i) => i.toJson()).toList(),
|
||||
// 'equipmentStatus': equipmentStatus?.toJson(),
|
||||
// 'priority': priority?.toJson(),
|
||||
// 'requestedThrough': requestedThrough?.toJson(),
|
||||
// 'typeofRequest': typeofRequest?.toJson(),
|
||||
// 'loanAvailablity': loanAvailablity,
|
||||
// 'assetLoan': assetLoan,
|
||||
// 'safety': safety,
|
||||
// 'problemDescription': problemDescription?.toJson(),
|
||||
// 'comments': comments,
|
||||
// 'voiceNote': voiceNote,
|
||||
// 'workOrderAttachments': workOrderAttachments,
|
||||
// 'returnToService': returnToService,
|
||||
// 'serviceType': serviceType,
|
||||
// 'failureReasone': failureReasone,
|
||||
// 'solution': solution,
|
||||
// 'totalWorkingHours': totalWorkingHours,
|
||||
// 'workOrderHistory': workOrderHistory?.map((i) => i.toJson()).toList(),
|
||||
// 'activityMaintenances': activityMaintenances,
|
||||
// 'activitySpareParts': activitySpareParts,
|
||||
// 'activityAssetToBeRetireds': activityAssetToBeRetireds,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class WorkOrderCreatedBy {
|
||||
// String? id;
|
||||
// String? userName;
|
||||
//
|
||||
// WorkOrderCreatedBy({this.id, this.userName});
|
||||
//
|
||||
// factory WorkOrderCreatedBy.fromJson(Map<String, dynamic> json) {
|
||||
// return WorkOrderCreatedBy(id: json['id'], userName: json['userName']);
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {'id': id, 'userName': userName};
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class Asset {
|
||||
// int? id;
|
||||
// String? assetNumber;
|
||||
//
|
||||
// Asset({this.id, this.assetNumber});
|
||||
//
|
||||
// factory Asset.fromJson(Map<String, dynamic> json) {
|
||||
// return Asset(id: json['id'], assetNumber: json['assetNumber']);
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {'id': id, 'assetNumber': assetNumber};
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class WorkOrderContactPerson {
|
||||
// int? id;
|
||||
// String? name;
|
||||
// String? employeeId;
|
||||
// String? position;
|
||||
// String? extension;
|
||||
// String? email;
|
||||
// String? mobilePhone;
|
||||
// ContactUser? contactUser;
|
||||
//
|
||||
// WorkOrderContactPerson({this.id, this.name, this.employeeId, this.position, this.extension, this.email, this.mobilePhone, this.contactUser});
|
||||
//
|
||||
// factory WorkOrderContactPerson.fromJson(Map<String, dynamic> json) {
|
||||
// return WorkOrderContactPerson(
|
||||
// id: json['id'],
|
||||
// name: json['name'],
|
||||
// employeeId: json['employeeId'],
|
||||
// position: json['position'],
|
||||
// extension: json['extension'],
|
||||
// email: json['email'],
|
||||
// mobilePhone: json['mobilePhone'],
|
||||
// contactUser: json['contactUser'] == null ? null : ContactUser.fromJson(json['contactUser']),
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {
|
||||
// 'id': id,
|
||||
// 'name': name,
|
||||
// 'employeeId': employeeId,
|
||||
// 'position': position,
|
||||
// 'extension': extension,
|
||||
// 'email': email,
|
||||
// 'mobilePhone': mobilePhone,
|
||||
// 'contactUser': contactUser?.toJson(),
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class ContactUser {
|
||||
// String? id;
|
||||
// String? userName;
|
||||
//
|
||||
// ContactUser({this.id, this.userName});
|
||||
//
|
||||
// factory ContactUser.fromJson(Map<String, dynamic> json) {
|
||||
// return ContactUser(id: json['id'], userName: json['userName']);
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {'id': id, 'userName': userName};
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class AssignedEmployee {
|
||||
// String? id;
|
||||
// String? userName;
|
||||
//
|
||||
// AssignedEmployee({this.id, this.userName});
|
||||
//
|
||||
// factory AssignedEmployee.fromJson(Map<String, dynamic> json) {
|
||||
// return AssignedEmployee(id: json['id'], userName: json['userName']);
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {'id': id, 'userName': userName};
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class Site {
|
||||
// int? id;
|
||||
// String? siteName;
|
||||
//
|
||||
// Site({this.id, this.siteName});
|
||||
//
|
||||
// factory Site.fromJson(Map<String, dynamic> json) {
|
||||
// return Site(id: json['id'], siteName: json['siteName']);
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {'id': id, 'siteName': siteName};
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// ///
|
||||
//
|
||||
// // class AssetGroup {
|
||||
// // int id;
|
||||
// // String name;
|
||||
// //
|
||||
// // AssetGroup({this.id, this.name});
|
||||
// //
|
||||
// // factory AssetGroup.fromJson(Map<String, dynamic> json) {
|
||||
// // return AssetGroup(
|
||||
// // id: json['id'],
|
||||
// // name: json['name'],
|
||||
// // );
|
||||
// // }
|
||||
// // Map<String, dynamic> toJson() {
|
||||
// // return {
|
||||
// // 'id': id,
|
||||
// // 'name': name,
|
||||
// // };
|
||||
// // }
|
||||
// //
|
||||
// // }
|
||||
// //
|
||||
// // class Manufacturer {
|
||||
// // int id;
|
||||
// // String name;
|
||||
// //
|
||||
// // Manufacturer({this.id, this.name});
|
||||
// //
|
||||
// // factory Manufacturer.fromJson(Map<String, dynamic> json) {
|
||||
// // return Manufacturer(
|
||||
// // id: json['id'],
|
||||
// // name: json['name'],
|
||||
// // );
|
||||
// // }
|
||||
// // Map<String, dynamic> toJson() {
|
||||
// // return {
|
||||
// // 'id': id,
|
||||
// // 'name': name,
|
||||
// // };
|
||||
// // }
|
||||
// // }
|
||||
// //
|
||||
// // class Model {
|
||||
// // int id;
|
||||
// // String name;
|
||||
// //
|
||||
// // Model({this.id, this.name});
|
||||
// //
|
||||
// // factory Model.fromJson(Map<String, dynamic> json) {
|
||||
// // return Model(
|
||||
// // id: json['id'],
|
||||
// // name: json['name'],
|
||||
// // );
|
||||
// // }
|
||||
// // Map<String, dynamic> toJson() {
|
||||
// // return {
|
||||
// // 'id': id,
|
||||
// // 'name': name,
|
||||
// // };
|
||||
// // }
|
||||
// // }
|
||||
// //
|
||||
// // class AssetNDModel {
|
||||
// // int id;
|
||||
// // String name;
|
||||
// //
|
||||
// // AssetNDModel({this.id, this.name});
|
||||
// //
|
||||
// // factory AssetNDModel.fromJson(Map<String, dynamic> json) {
|
||||
// // return AssetNDModel(
|
||||
// // id: json['id'],
|
||||
// // name: json['name'],
|
||||
// // );
|
||||
// // }
|
||||
// // Map<String, dynamic> toJson() {
|
||||
// // return {
|
||||
// // 'id': id,
|
||||
// // 'name': name,
|
||||
// // };
|
||||
// // }
|
||||
// // }
|
||||
// //
|
||||
// // class Building {
|
||||
// // int id;
|
||||
// // String name;
|
||||
// // int value;
|
||||
// //
|
||||
// // Building({this.id, this.name, this.value});
|
||||
// //
|
||||
// // factory Building.fromJson(Map<String, dynamic> json) {
|
||||
// // return Building(
|
||||
// // id: json['id'],
|
||||
// // name: json['name'],
|
||||
// // value: json['value'],
|
||||
// // );
|
||||
// // }
|
||||
// // Map<String, dynamic> toJson() {
|
||||
// // return {
|
||||
// // 'id': id,
|
||||
// // 'name': name,
|
||||
// // 'value': value,
|
||||
// // };
|
||||
// // }
|
||||
// // }
|
||||
// //
|
||||
// // class Floor {
|
||||
// // int id;
|
||||
// // String name;
|
||||
// // int value;
|
||||
// //
|
||||
// // Floor({this.id, this.name, this.value});
|
||||
// //
|
||||
// // factory Floor.fromJson(Map<String, dynamic> json) {
|
||||
// // return Floor(
|
||||
// // id: json['id'],
|
||||
// // name: json['name'],
|
||||
// // value: json['value'],
|
||||
// // );
|
||||
// // }
|
||||
// // Map<String, dynamic> toJson() {
|
||||
// // return {
|
||||
// // 'id': id,
|
||||
// // 'name': name,
|
||||
// // 'value': value,
|
||||
// // };
|
||||
// // }
|
||||
// // }
|
||||
// //
|
||||
// // class Department {
|
||||
// // int id;
|
||||
// // String name;
|
||||
// //
|
||||
// // Department({this.id, this.name});
|
||||
// //
|
||||
// // factory Department.fromJson(Map<String, dynamic> json) {
|
||||
// // return Department(
|
||||
// // id: json['id'],
|
||||
// // name: json['name'],
|
||||
// // );
|
||||
// // }
|
||||
// // Map<String, dynamic> toJson() {
|
||||
// // return {
|
||||
// // 'id': id,
|
||||
// // 'name': name,
|
||||
// // };
|
||||
// // }
|
||||
// // }
|
||||
// //
|
||||
// // class AssetType {
|
||||
// // int id;
|
||||
// // String name;
|
||||
// // int value;
|
||||
// //
|
||||
// // AssetType({this.id, this.name, this.value});
|
||||
// //
|
||||
// // factory AssetType.fromJson(Map<String, dynamic> json) {
|
||||
// // return AssetType(
|
||||
// // id: json['id'],
|
||||
// // name: json['name'],
|
||||
// // value: json['value'],
|
||||
// // );
|
||||
// // }
|
||||
// // Map<String, dynamic> toJson() {
|
||||
// // return {
|
||||
// // 'id': id,
|
||||
// // 'name': name,
|
||||
// // 'value': value,
|
||||
// // };
|
||||
// // }
|
||||
// // }
|
||||
// //
|
||||
// // class Status {
|
||||
// // int id;
|
||||
// // String name;
|
||||
// // int value;
|
||||
// //
|
||||
// // Status({this.id, this.name, this.value});
|
||||
// //
|
||||
// // factory Status.fromJson(Map<String, dynamic> json) {
|
||||
// // return Status(
|
||||
// // id: json['id'],
|
||||
// // name: json['name'],
|
||||
// // value: json['value'],
|
||||
// // );
|
||||
// // }
|
||||
// // Map<String, dynamic> toJson() {
|
||||
// // return {
|
||||
// // 'id': id,
|
||||
// // 'name': name,
|
||||
// // 'value': value,
|
||||
// // };
|
||||
// // }
|
||||
// // }
|
||||
// //
|
||||
// // class NextStep {
|
||||
// // int id;
|
||||
// // String name;
|
||||
// // int value;
|
||||
// //
|
||||
// // NextStep({this.id, this.name, this.value});
|
||||
// //
|
||||
// // factory NextStep.fromJson(Map<String, dynamic> json) {
|
||||
// // return NextStep(
|
||||
// // id: json['id'],
|
||||
// // name: json['name'],
|
||||
// // value: json['value'],
|
||||
// // );
|
||||
// // }
|
||||
// // Map<String, dynamic> toJson() {
|
||||
// // return {
|
||||
// // 'id': id,
|
||||
// // 'name': name,
|
||||
// // 'value': value,
|
||||
// // };
|
||||
// // }
|
||||
// // }
|
||||
//
|
||||
// class EquipmentStatus {
|
||||
// int? id;
|
||||
// String? name;
|
||||
// int? value;
|
||||
//
|
||||
// EquipmentStatus({this.id, this.name, this.value});
|
||||
//
|
||||
// factory EquipmentStatus.fromJson(Map<String, dynamic> json) {
|
||||
// return EquipmentStatus(id: json['id'], name: json['name'], value: json['value']);
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {'id': id, 'name': name, 'value': value};
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class Priority {
|
||||
// int? id;
|
||||
// String? name;
|
||||
// int? value;
|
||||
//
|
||||
// Priority({this.id, this.name, this.value});
|
||||
//
|
||||
// factory Priority.fromJson(Map<String, dynamic> json) {
|
||||
// return Priority(id: json['id'], name: json['name'], value: json['value']);
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {'id': id, 'name': name, 'value': value};
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class RequestedThrough {
|
||||
// int? id;
|
||||
// String? name;
|
||||
//
|
||||
// RequestedThrough({this.id, this.name});
|
||||
//
|
||||
// factory RequestedThrough.fromJson(Map<String, dynamic> json) {
|
||||
// return RequestedThrough(id: json['id'], name: json['name']);
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {'id': id, 'name': name};
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class TypeOfRequest {
|
||||
// int? id;
|
||||
// String? name;
|
||||
//
|
||||
// TypeOfRequest({this.id, this.name});
|
||||
//
|
||||
// factory TypeOfRequest.fromJson(Map<String, dynamic> json) {
|
||||
// return TypeOfRequest(id: json['id'], name: json['name']);
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {'id': id, 'name': name};
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class ProblemDescription {
|
||||
// int? id;
|
||||
// String? name;
|
||||
//
|
||||
// ProblemDescription({this.id, this.name});
|
||||
//
|
||||
// factory ProblemDescription.fromJson(Map<String, dynamic> json) {
|
||||
// return ProblemDescription(id: json['id'], name: json['name']);
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {'id': id, 'name': name};
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class WorkOrderHistory {
|
||||
// int? id;
|
||||
// Lookup? workOrderStatus;
|
||||
// dynamic activityStatus; // Since activityStatus is null, it's dynamic
|
||||
// String? date;
|
||||
// HistoryUser? user;
|
||||
// Lookup? step;
|
||||
// dynamic fixRemotelyStartTime; // Since it's null, it's dynamic
|
||||
// dynamic fixRemotelyEndTime; // Since it's null, it's dynamic
|
||||
// dynamic fixRemotelyWorkingHours; // Since it's null, it's dynamic
|
||||
// String? comments;
|
||||
// dynamic needAVisitDateTime; // Since it's null, it's dynamic
|
||||
//
|
||||
// WorkOrderHistory(
|
||||
// {this.id,
|
||||
// this.workOrderStatus,
|
||||
// this.activityStatus,
|
||||
// this.date,
|
||||
// this.user,
|
||||
// this.step,
|
||||
// this.fixRemotelyStartTime,
|
||||
// this.fixRemotelyEndTime,
|
||||
// this.fixRemotelyWorkingHours,
|
||||
// this.comments,
|
||||
// this.needAVisitDateTime});
|
||||
//
|
||||
// factory WorkOrderHistory.fromJson(Map<String, dynamic> json) {
|
||||
// return WorkOrderHistory(
|
||||
// id: json['id'],
|
||||
// //json['assetType'] != null ? Lookup.fromJson(json['assetType']) : null;
|
||||
// workOrderStatus: json['workorderStatus'] ?? Lookup.fromJson(json['workorderStatus']),
|
||||
// activityStatus: json['activityStatus'],
|
||||
// date: json['date'],
|
||||
// user: HistoryUser.fromJson(json['user']),
|
||||
// step: json['step'] ?? Lookup.fromJson(json['step']),
|
||||
// fixRemotelyStartTime: json['fixRemotlyStartTime'],
|
||||
// fixRemotelyEndTime: json['fixRemotlyEndTime'],
|
||||
// fixRemotelyWorkingHours: json['fixRemotlyWorkingHours'],
|
||||
// comments: json['comments'] ?? "",
|
||||
// needAVisitDateTime: json['needAVisitDateTime'],
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {
|
||||
// 'id': id,
|
||||
// // Lookup.fromJson(json['workorderStatus'])
|
||||
// 'workorderStatus': workOrderStatus?.toJson(),
|
||||
// 'activityStatus': activityStatus,
|
||||
// 'date': date,
|
||||
// 'user': user?.toJson(),
|
||||
// 'step': step?.toJson(),
|
||||
// 'fixRemotelyStartTime': fixRemotelyStartTime,
|
||||
// 'fixRemotelyEndTime': fixRemotelyEndTime,
|
||||
// 'fixRemotelyWorkingHours': fixRemotelyWorkingHours,
|
||||
// 'comments': comments,
|
||||
// 'needAVisitDateTime': needAVisitDateTime,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // class WorkOrderStatus {
|
||||
// // int id;
|
||||
// // String name;
|
||||
// // int value;
|
||||
// //
|
||||
// // WorkOrderStatus({
|
||||
// // this.id,
|
||||
// // this.name,
|
||||
// // this.value,
|
||||
// // });
|
||||
// //
|
||||
// // factory WorkOrderStatus.fromJson(Map<String, dynamic> json) {
|
||||
// // return WorkOrderStatus(
|
||||
// // id: json['id'],
|
||||
// // name: json['name'],
|
||||
// // value: json['value'],
|
||||
// // );
|
||||
// // }
|
||||
// //
|
||||
// // Map<String, dynamic> toJson() {
|
||||
// // return {
|
||||
// // 'id': id,
|
||||
// // 'name': name,
|
||||
// // 'value': value,
|
||||
// // };
|
||||
// // }
|
||||
// // }
|
||||
//
|
||||
// class HistoryUser {
|
||||
// String? id;
|
||||
// String? userName;
|
||||
//
|
||||
// HistoryUser({this.id, this.userName});
|
||||
//
|
||||
// factory HistoryUser.fromJson(Map<String, dynamic> json) {
|
||||
// return HistoryUser(id: json['id'], userName: json['userName']);
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {'id': id, 'userName': userName};
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // class Step {
|
||||
// // int id;
|
||||
// // String name;
|
||||
// // int value;
|
||||
// //
|
||||
// // Step({
|
||||
// // this.id,
|
||||
// // this.name,
|
||||
// // this.value,
|
||||
// // });
|
||||
// //
|
||||
// // factory Step.fromJson(Map<String, dynamic> json) {
|
||||
// // return Step(
|
||||
// // id: json['id'],
|
||||
// // name: json['name'],
|
||||
// // value: json['value'],
|
||||
// // );
|
||||
// // }
|
||||
// //
|
||||
// // Map<String, dynamic> toJson() {
|
||||
// // return {
|
||||
// // 'id': id,
|
||||
// // 'name': name,
|
||||
// // 'value': value,
|
||||
// // };
|
||||
// // }
|
||||
// // }
|
||||
@ -0,0 +1,417 @@
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
|
||||
class WorkOrderDetail {
|
||||
WorkOrderDetail({
|
||||
required this.data,
|
||||
required this.message,
|
||||
required this.title,
|
||||
required this.innerMessage,
|
||||
required this.responseCode,
|
||||
required this.isSuccess,
|
||||
});
|
||||
|
||||
final WorkOrderData? data;
|
||||
final String? message;
|
||||
final dynamic title;
|
||||
final dynamic innerMessage;
|
||||
final int? responseCode;
|
||||
final bool? isSuccess;
|
||||
|
||||
factory WorkOrderDetail.fromJson(Map<String, dynamic> json) {
|
||||
return WorkOrderDetail(
|
||||
data: json["data"] == null ? null : WorkOrderData.fromJson(json["data"]),
|
||||
message: json["message"],
|
||||
title: json["title"],
|
||||
innerMessage: json["innerMessage"],
|
||||
responseCode: json["responseCode"],
|
||||
isSuccess: json["isSuccess"],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() =>
|
||||
{
|
||||
"data": data?.toJson(),
|
||||
"message": message,
|
||||
"title": title,
|
||||
"innerMessage": innerMessage,
|
||||
"responseCode": responseCode,
|
||||
"isSuccess": isSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
class WorkOrderData {
|
||||
WorkOrderData({
|
||||
required this.workOrderNo,
|
||||
required this.workOrderCreatedBy,
|
||||
required this.requestedDate,
|
||||
required this.asset,
|
||||
required this.assetGroup,
|
||||
required this.manufacturer,
|
||||
required this.model,
|
||||
required this.assetNdModel,
|
||||
required this.site,
|
||||
required this.building,
|
||||
required this.floor,
|
||||
required this.department,
|
||||
required this.room,
|
||||
required this.assetType,
|
||||
required this.assignedEmployee,
|
||||
required this.lastActivityStatus,
|
||||
required this.status,
|
||||
required this.nextStep,
|
||||
required this.assetVerificationType,
|
||||
required this.workOrderContactPerson,
|
||||
required this.equipmentStatus,
|
||||
required this.priority,
|
||||
required this.requestedThrough,
|
||||
required this.typeofRequest,
|
||||
required this.loanAvailablity,
|
||||
required this.assetLoan,
|
||||
required this.safety,
|
||||
required this.problemDescription,
|
||||
required this.comments,
|
||||
required this.voiceNote,
|
||||
required this.workOrderAttachments,
|
||||
required this.returnToService,
|
||||
required this.serviceType,
|
||||
required this.failureReasone,
|
||||
required this.solution,
|
||||
required this.totalWorkingHours,
|
||||
required this.workOrderHistory,
|
||||
required this.activities,
|
||||
required this.activityAssetToBeRetireds,
|
||||
});
|
||||
|
||||
final String? workOrderNo;
|
||||
final AssignedEmployee? workOrderCreatedBy;
|
||||
final DateTime? requestedDate;
|
||||
final Asset? asset;
|
||||
final Lookup? assetGroup;
|
||||
final Lookup? manufacturer;
|
||||
final Lookup? model;
|
||||
final Lookup? assetNdModel;
|
||||
final Site? site;
|
||||
final Lookup? building;
|
||||
final Lookup? floor;
|
||||
final AssetGroup? department;
|
||||
final int? room;
|
||||
final Lookup? assetType;
|
||||
final AssignedEmployee? assignedEmployee;
|
||||
final String? lastActivityStatus;
|
||||
final Lookup? status;
|
||||
final Lookup? nextStep;
|
||||
final int? assetVerificationType;
|
||||
final List<WorkOrderContactPerson> workOrderContactPerson;
|
||||
final Lookup? equipmentStatus;
|
||||
final Lookup? priority;
|
||||
final Lookup? requestedThrough;
|
||||
final Lookup? typeofRequest;
|
||||
final Lookup? loanAvailablity;
|
||||
final Lookup? assetLoan;
|
||||
final Lookup? safety;
|
||||
final Lookup? problemDescription;
|
||||
final String? comments;
|
||||
final String? voiceNote;
|
||||
final List<String> workOrderAttachments;
|
||||
final String? returnToService;
|
||||
final Lookup? serviceType;
|
||||
final Lookup? failureReasone;
|
||||
final Lookup? solution;
|
||||
final String? totalWorkingHours;
|
||||
final List<WorkOrderHistory> workOrderHistory;
|
||||
final List<dynamic> activities;
|
||||
final List<dynamic> activityAssetToBeRetireds;
|
||||
|
||||
factory WorkOrderData.fromJson(Map<String, dynamic> json) {
|
||||
return WorkOrderData(
|
||||
workOrderNo: json["workOrderNo"],
|
||||
workOrderCreatedBy: json["workOrderCreatedBy"] == null ? null : AssignedEmployee.fromJson(json["workOrderCreatedBy"]),
|
||||
requestedDate: DateTime.tryParse(json["requestedDate"] ?? ""),
|
||||
asset: json["asset"] == null ? null : Asset.fromJson(json["asset"]),
|
||||
assetGroup: json["assetGroup"] == null ? null : Lookup.fromJson(json["assetGroup"]),
|
||||
manufacturer: json["manufacturer"] == null ? null : Lookup.fromJson(json["manufacturer"]),
|
||||
model: json["model"] == null ? null : Lookup.fromJson(json["model"]),
|
||||
assetNdModel: json["assetNDModel"] == null ? null : Lookup.fromJson(json["assetNDModel"]),
|
||||
site: json["site"] == null ? null : Site.fromJson(json["site"]),
|
||||
building: json["building"] == null ? null : Lookup.fromJson(json["building"]),
|
||||
floor: json["floor"] == null ? null : Lookup.fromJson(json["floor"]),
|
||||
department: json["department"] == null ? null : AssetGroup.fromJson(json["department"]),
|
||||
room: json["room"],
|
||||
assetType: json["assetType"] == null ? null : Lookup.fromJson(json["assetType"]),
|
||||
assignedEmployee: json["assignedEmployee"] == null ? null : AssignedEmployee.fromJson(json["assignedEmployee"]),
|
||||
lastActivityStatus: json["lastActivityStatus"],
|
||||
status: json["status"] == null ? null : Lookup.fromJson(json["status"]),
|
||||
nextStep: json["nextStep"] == null ? null : Lookup.fromJson(json["nextStep"]),
|
||||
assetVerificationType: json["assetVerificationType"],
|
||||
workOrderContactPerson: json["workOrderContactPerson"] == null ? [] : List<WorkOrderContactPerson>.from(json["workOrderContactPerson"]!.map((x) => WorkOrderContactPerson.fromJson(x))),
|
||||
equipmentStatus: json["equipmentStatus"] == null ? null : Lookup.fromJson(json["equipmentStatus"]),
|
||||
priority: json["priority"] == null ? null : Lookup.fromJson(json["priority"]),
|
||||
requestedThrough: json["requestedThrough"] == null ? null : Lookup.fromJson(json["requestedThrough"]),
|
||||
typeofRequest: json["typeofRequest"] == null ? null : Lookup.fromJson(json["typeofRequest"]),
|
||||
loanAvailablity: json["loanAvailablity"] == null ? null : Lookup.fromJson(json["loanAvailablity"]),
|
||||
assetLoan: json["assetLoan"] == null ? null : Lookup.fromJson(json["assetLoan"]),
|
||||
safety: json["safety"] == null ? null : Lookup.fromJson(json["safety"]),
|
||||
problemDescription: json["problemDescription"] == null ? null : Lookup.fromJson(json["problemDescription"]),
|
||||
comments: json["comments"],
|
||||
voiceNote: json["voiceNote"],
|
||||
workOrderAttachments: json["workOrderAttachments"] == null ? [] : List<String>.from(json["workOrderAttachments"]!.map((x) => x)),
|
||||
returnToService: json["returnToService"],
|
||||
serviceType: json["serviceType"] == null ? null : Lookup.fromJson(json["serviceType"]),
|
||||
failureReasone: json["failureReasone"] == null ? null : Lookup.fromJson(json["failureReasone"]),
|
||||
solution: json["solution"] == null ? null : Lookup.fromJson(json["solution"]),
|
||||
totalWorkingHours: json["totalWorkingHours"],
|
||||
workOrderHistory: json["workOrderHistory"] == null ? [] : List<WorkOrderHistory>.from(json["workOrderHistory"]!.map((x) => WorkOrderHistory.fromJson(x))),
|
||||
activities: json["activities"] == null ? [] : List<dynamic>.from(json["activities"]!.map((x) => x)),
|
||||
activityAssetToBeRetireds: json["activityAssetToBeRetireds"] == null ? [] : List<dynamic>.from(json["activityAssetToBeRetireds"]!.map((x) => x)),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() =>
|
||||
{
|
||||
"workOrderNo": workOrderNo,
|
||||
"workOrderCreatedBy": workOrderCreatedBy?.toJson(),
|
||||
"requestedDate": requestedDate?.toIso8601String(),
|
||||
"asset": asset?.toJson(),
|
||||
"assetGroup": assetGroup?.toJson(),
|
||||
"manufacturer": manufacturer?.toJson(),
|
||||
"model": model?.toJson(),
|
||||
"assetNDModel": assetNdModel?.toJson(),
|
||||
"site": site?.toJson(),
|
||||
"building": building?.toJson(),
|
||||
"floor": floor?.toJson(),
|
||||
"department": department?.toJson(),
|
||||
"room": room,
|
||||
"assetType": assetType?.toJson(),
|
||||
"assignedEmployee": assignedEmployee?.toJson(),
|
||||
"lastActivityStatus": lastActivityStatus,
|
||||
"status": status?.toJson(),
|
||||
"nextStep": nextStep?.toJson(),
|
||||
"assetVerificationType": assetVerificationType,
|
||||
"workOrderContactPerson": workOrderContactPerson.map((x) => x?.toJson()).toList(),
|
||||
"equipmentStatus": equipmentStatus?.toJson(),
|
||||
"priority": priority?.toJson(),
|
||||
"requestedThrough": requestedThrough?.toJson(),
|
||||
"typeofRequest": typeofRequest?.toJson(),
|
||||
"loanAvailablity": loanAvailablity?.toJson(),
|
||||
"assetLoan": assetLoan?.toJson(),
|
||||
"safety": safety?.toJson(),
|
||||
"problemDescription": problemDescription?.toJson(),
|
||||
"comments": comments,
|
||||
"voiceNote": voiceNote,
|
||||
"workOrderAttachments": workOrderAttachments.map((x) => x).toList(),
|
||||
"returnToService": returnToService,
|
||||
"serviceType": serviceType?.toJson(),
|
||||
"failureReasone": failureReasone?.toJson(),
|
||||
"solution": solution?.toJson(),
|
||||
"totalWorkingHours": totalWorkingHours,
|
||||
"workOrderHistory": workOrderHistory.map((x) => x?.toJson()).toList(),
|
||||
"activities": activities.map((x) => x).toList(),
|
||||
"activityAssetToBeRetireds": activityAssetToBeRetireds.map((x) => x).toList(),
|
||||
};
|
||||
}
|
||||
|
||||
class Asset {
|
||||
Asset({
|
||||
required this.id,
|
||||
required this.assetNumber,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final String? assetNumber;
|
||||
|
||||
factory Asset.fromJson(Map<String, dynamic> json) {
|
||||
return Asset(
|
||||
id: json["id"],
|
||||
assetNumber: json["assetNumber"],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() =>
|
||||
{
|
||||
"id": id,
|
||||
"assetNumber": assetNumber,
|
||||
};
|
||||
}
|
||||
|
||||
class AssetGroup {
|
||||
AssetGroup({
|
||||
required this.id,
|
||||
required this.name,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final String? name;
|
||||
|
||||
factory AssetGroup.fromJson(Map<String, dynamic> json) {
|
||||
return AssetGroup(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() =>
|
||||
{
|
||||
"id": id,
|
||||
"name": name,
|
||||
};
|
||||
}
|
||||
|
||||
class AssignedEmployee {
|
||||
AssignedEmployee({
|
||||
required this.userId,
|
||||
required this.userName,
|
||||
required this.email,
|
||||
required this.languageId,
|
||||
});
|
||||
|
||||
final dynamic userId;
|
||||
final String? userName;
|
||||
final String? email;
|
||||
final int? languageId;
|
||||
|
||||
factory AssignedEmployee.fromJson(Map<String, dynamic> json) {
|
||||
return AssignedEmployee(
|
||||
userId: json["userId"],
|
||||
userName: json["userName"],
|
||||
email: json["email"],
|
||||
languageId: json["languageId"],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() =>
|
||||
{
|
||||
"userId": userId,
|
||||
"userName": userName,
|
||||
"email": email,
|
||||
"languageId": languageId,
|
||||
};
|
||||
}
|
||||
|
||||
class Site {
|
||||
Site({
|
||||
required this.id,
|
||||
required this.siteName,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final String? siteName;
|
||||
|
||||
factory Site.fromJson(Map<String, dynamic> json) {
|
||||
return Site(
|
||||
id: json["id"],
|
||||
siteName: json["siteName"],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() =>
|
||||
{
|
||||
"id": id,
|
||||
"siteName": siteName,
|
||||
};
|
||||
}
|
||||
|
||||
class WorkOrderContactPerson {
|
||||
WorkOrderContactPerson({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.employeeId,
|
||||
required this.position,
|
||||
required this.extension,
|
||||
required this.email,
|
||||
required this.mobilePhone,
|
||||
required this.contactUser,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final String? name;
|
||||
final String? employeeId;
|
||||
final String? position;
|
||||
final dynamic extension;
|
||||
final String? email;
|
||||
final dynamic mobilePhone;
|
||||
final AssignedEmployee? contactUser;
|
||||
|
||||
factory WorkOrderContactPerson.fromJson(Map<String, dynamic> json) {
|
||||
return WorkOrderContactPerson(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
employeeId: json["employeeId"],
|
||||
position: json["position"],
|
||||
extension: json["extension"],
|
||||
email: json["email"],
|
||||
mobilePhone: json["mobilePhone"],
|
||||
contactUser: json["contactUser"] == null ? null : AssignedEmployee.fromJson(json["contactUser"]),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() =>
|
||||
{
|
||||
"id": id,
|
||||
"name": name,
|
||||
"employeeId": employeeId,
|
||||
"position": position,
|
||||
"extension": extension,
|
||||
"email": email,
|
||||
"mobilePhone": mobilePhone,
|
||||
"contactUser": contactUser?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class WorkOrderHistory {
|
||||
WorkOrderHistory({
|
||||
required this.id,
|
||||
required this.workorderStatus,
|
||||
required this.activityStatus,
|
||||
required this.date,
|
||||
required this.user,
|
||||
required this.step,
|
||||
required this.fixRemotlyStartTime,
|
||||
required this.fixRemotlyEndTime,
|
||||
required this.fixRemotlyWorkingHours,
|
||||
required this.comments,
|
||||
required this.needAVisitDateTime,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final Lookup? workorderStatus;
|
||||
final dynamic activityStatus;
|
||||
final DateTime? date;
|
||||
final AssignedEmployee? user;
|
||||
final Lookup? step;
|
||||
final DateTime? fixRemotlyStartTime;
|
||||
final DateTime? fixRemotlyEndTime;
|
||||
final num? fixRemotlyWorkingHours;
|
||||
final String? comments;
|
||||
final DateTime? needAVisitDateTime;
|
||||
|
||||
factory WorkOrderHistory.fromJson(Map<String, dynamic> json) {
|
||||
return WorkOrderHistory(
|
||||
id: json["id"],
|
||||
workorderStatus: json["workorderStatus"] == null ? null : Lookup.fromJson(json["workorderStatus"]),
|
||||
activityStatus: json["activityStatus"],
|
||||
date: DateTime.tryParse(json["date"] ?? ""),
|
||||
user: json["user"] == null ? null : AssignedEmployee.fromJson(json["user"]),
|
||||
step: json["step"] == null ? null : Lookup.fromJson(json["step"]),
|
||||
fixRemotlyStartTime: DateTime.tryParse(json["fixRemotlyStartTime"] ?? ""),
|
||||
fixRemotlyEndTime: DateTime.tryParse(json["fixRemotlyEndTime"] ?? ""),
|
||||
fixRemotlyWorkingHours: json["fixRemotlyWorkingHours"],
|
||||
comments: json["comments"],
|
||||
needAVisitDateTime: DateTime.tryParse(json["needAVisitDateTime"] ?? ""),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() =>
|
||||
{
|
||||
"id": id,
|
||||
"workorderStatus": workorderStatus?.toJson(),
|
||||
"activityStatus": activityStatus,
|
||||
"date": date?.toIso8601String(),
|
||||
"user": user?.toJson(),
|
||||
"step": step?.toJson(),
|
||||
"fixRemotlyStartTime": fixRemotlyStartTime?.toIso8601String(),
|
||||
"fixRemotlyEndTime": fixRemotlyEndTime?.toIso8601String(),
|
||||
"fixRemotlyWorkingHours": fixRemotlyWorkingHours,
|
||||
"comments": comments,
|
||||
"needAVisitDateTime": needAVisitDateTime?.toIso8601String(),
|
||||
};
|
||||
}
|
||||
@ -1,87 +1,87 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/extensions/int_extensions.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||
import 'package:test_sa/new_views/pages/land_page/calender_fragments/daily_fragment.dart';
|
||||
import 'package:test_sa/new_views/pages/land_page/calender_fragments/weekly_fragment.dart';
|
||||
|
||||
import 'calender_fragments/monthly_fragment.dart';
|
||||
|
||||
class CalendarPage extends StatefulWidget {
|
||||
const CalendarPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<CalendarPage> createState() => _CalendarPageState();
|
||||
}
|
||||
|
||||
class _CalendarPageState extends State<CalendarPage> with SingleTickerProviderStateMixin {
|
||||
late TabController _tabController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_tabController = TabController(length: 3, vsync: this)
|
||||
..addListener(() {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// todo @sikander, hiding My shift view, later when they add data, then will us it.
|
||||
// SizedBox(
|
||||
// width: double.infinity,
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// context.translation.myShift.heading5(context),
|
||||
// 8.height,
|
||||
// context.translation.sunToThurs.bodyText(context),
|
||||
// "09:00 to 18:00".bodyText(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
||||
// ],
|
||||
// ).toShadowContainer(context),
|
||||
// ).paddingOnly(start: 16, end: 16),
|
||||
16.height,
|
||||
Container(
|
||||
margin: const EdgeInsets.only(left: 16, right: 16),
|
||||
decoration: BoxDecoration(color: context.isDark ? AppColor.neutral50 : AppColor.neutral30, borderRadius: BorderRadius.circular(16)),
|
||||
child: TabBar(
|
||||
controller: _tabController,
|
||||
padding: EdgeInsets.zero,
|
||||
labelColor: context.isDark ? AppColor.neutral30 : AppColor.neutral60,
|
||||
unselectedLabelColor: context.isDark ? AppColor.neutral10 : AppColor.neutral20,
|
||||
unselectedLabelStyle: AppTextStyles.bodyText,
|
||||
labelStyle: AppTextStyles.bodyText,
|
||||
indicatorPadding: const EdgeInsets.all(4),
|
||||
indicator: BoxDecoration(color: context.isDark ? AppColor.neutral60 : Theme.of(context).cardColor, borderRadius: BorderRadius.circular(13)),
|
||||
tabs: [
|
||||
Tab(text: context.translation.monthly, height: 57.toScreenHeight),
|
||||
Tab(text: context.translation.weekly, height: 57.toScreenHeight),
|
||||
Tab(text: context.translation.daily, height: 57.toScreenHeight),
|
||||
],
|
||||
),
|
||||
),
|
||||
8.height,
|
||||
TabBarView(
|
||||
//physics: const NeverScrollableScrollPhysics(),
|
||||
controller: _tabController,
|
||||
children: const [
|
||||
MonthlyFragment(),
|
||||
WeeklyFragment(),
|
||||
DailyFragment(),
|
||||
],
|
||||
).expanded,
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:test_sa/extensions/context_extension.dart';
|
||||
// import 'package:test_sa/extensions/int_extensions.dart';
|
||||
// import 'package:test_sa/extensions/text_extensions.dart';
|
||||
// import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
// import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||
// import 'package:test_sa/new_views/pages/land_page/calender_fragments/daily_fragment.dart';
|
||||
// import 'package:test_sa/new_views/pages/land_page/calender_fragments/weekly_fragment.dart';
|
||||
//
|
||||
// import 'calender_fragments/monthly_fragment.dart';
|
||||
// todo delete
|
||||
// class CalendarPage extends StatefulWidget {
|
||||
// const CalendarPage({Key? key}) : super(key: key);
|
||||
//
|
||||
// @override
|
||||
// State<CalendarPage> createState() => _CalendarPageState();
|
||||
// }
|
||||
//
|
||||
// class _CalendarPageState extends State<CalendarPage> with SingleTickerProviderStateMixin {
|
||||
// late TabController _tabController;
|
||||
//
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
// _tabController = TabController(length: 3, vsync: this)
|
||||
// ..addListener(() {
|
||||
// setState(() {});
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// body: SafeArea(
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// // todo @sikander, hiding My shift view, later when they add data, then will us it.
|
||||
// // SizedBox(
|
||||
// // width: double.infinity,
|
||||
// // child: Column(
|
||||
// // crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// // children: [
|
||||
// // context.translation.myShift.heading5(context),
|
||||
// // 8.height,
|
||||
// // context.translation.sunToThurs.bodyText(context),
|
||||
// // "09:00 to 18:00".bodyText(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
||||
// // ],
|
||||
// // ).toShadowContainer(context),
|
||||
// // ).paddingOnly(start: 16, end: 16),
|
||||
// 16.height,
|
||||
// Container(
|
||||
// margin: const EdgeInsets.only(left: 16, right: 16),
|
||||
// decoration: BoxDecoration(color: context.isDark ? AppColor.neutral50 : AppColor.neutral30, borderRadius: BorderRadius.circular(16)),
|
||||
// child: TabBar(
|
||||
// controller: _tabController,
|
||||
// padding: EdgeInsets.zero,
|
||||
// labelColor: context.isDark ? AppColor.neutral30 : AppColor.neutral60,
|
||||
// unselectedLabelColor: context.isDark ? AppColor.neutral10 : AppColor.neutral20,
|
||||
// unselectedLabelStyle: AppTextStyles.bodyText,
|
||||
// labelStyle: AppTextStyles.bodyText,
|
||||
// indicatorPadding: const EdgeInsets.all(4),
|
||||
// indicator: BoxDecoration(color: context.isDark ? AppColor.neutral60 : Theme.of(context).cardColor, borderRadius: BorderRadius.circular(13)),
|
||||
// tabs: [
|
||||
// Tab(text: context.translation.monthly, height: 57.toScreenHeight),
|
||||
// Tab(text: context.translation.weekly, height: 57.toScreenHeight),
|
||||
// Tab(text: context.translation.daily, height: 57.toScreenHeight),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// 8.height,
|
||||
// TabBarView(
|
||||
// //physics: const NeverScrollableScrollPhysics(),
|
||||
// controller: _tabController,
|
||||
// children: const [
|
||||
// MonthlyFragment(),
|
||||
// WeeklyFragment(),
|
||||
// DailyFragment(),
|
||||
// ],
|
||||
// ).expanded,
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
@ -1,82 +1,82 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/extensions/int_extensions.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
|
||||
import '../../../../controllers/providers/api/all_requests_provider.dart';
|
||||
import '../../../app_style/app_color.dart';
|
||||
import '../requests/asset_item_view.dart';
|
||||
import '../requests/gas_refill_item_view.dart';
|
||||
import '../requests/ppm_item_view.dart';
|
||||
import '../requests/service_request_item_view.dart';
|
||||
|
||||
class DailyFragment extends StatefulWidget {
|
||||
const DailyFragment({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_DailyFragmentState createState() {
|
||||
return _DailyFragmentState();
|
||||
}
|
||||
}
|
||||
|
||||
class _DailyFragmentState extends State<DailyFragment> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Provider.of<AllRequestsProvider>(context, listen: false).getCalendarRequests(from: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||
child: Consumer<AllRequestsProvider>(builder: (context, snapshot, _) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
DateFormat("EEEE, d MMMM, yyyy", context.isAr ? "ar" : "en").format(DateTime.now()).heading5(context),
|
||||
const Divider().defaultStyle(context),
|
||||
if (snapshot.calendarRequests?.requestsDetails?.isEmpty ?? true)
|
||||
Center(
|
||||
child: context.translation.noDataFound.heading5(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
||||
).paddingOnly(top: 16, bottom: 16),
|
||||
ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (cxt, index) {
|
||||
final list = snapshot.calendarRequests!.requestsDetails!;
|
||||
if (snapshot.isCalendarLoading) return const SizedBox().toRequestShimmer(cxt, snapshot.isCalendarLoading);
|
||||
bool isServiceRequest = list[index].nameOfType == "ServiceRequest";
|
||||
bool isGasRefill = list[index].nameOfType == "GasRefill";
|
||||
bool isAssetTransfer = list[index].nameOfType == "AssetTransfer";
|
||||
bool isPPMs = list[index].nameOfType == "PPMs";
|
||||
|
||||
return isServiceRequest
|
||||
? ServiceRequestItemView(list[index])
|
||||
: isGasRefill
|
||||
? GasRefillItemView(list[index])
|
||||
: isPPMs
|
||||
? PpmItemView(list[index])
|
||||
: isAssetTransfer
|
||||
? AssetItemView(list[index])
|
||||
: Container(
|
||||
height: 100,
|
||||
width: double.infinity,
|
||||
color: Colors.grey,
|
||||
);
|
||||
},
|
||||
separatorBuilder: (cxt, index) => 8.height,
|
||||
itemCount: snapshot.isCalendarLoading ? 6 : snapshot.calendarRequests!.requestsDetails!.length,
|
||||
),
|
||||
],
|
||||
).toShadowContainer(context);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
BoxDecoration cellDecoration({Color? color}) => BoxDecoration(color: color ?? Colors.transparent, shape: BoxShape.circle);
|
||||
}
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:intl/intl.dart';
|
||||
// import 'package:provider/provider.dart';
|
||||
// import 'package:test_sa/extensions/context_extension.dart';
|
||||
// import 'package:test_sa/extensions/int_extensions.dart';
|
||||
// import 'package:test_sa/extensions/text_extensions.dart';
|
||||
// import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
//
|
||||
// import '../../../../controllers/providers/api/all_requests_provider.dart';
|
||||
// import '../../../app_style/app_color.dart';
|
||||
// import '../requests/asset_item_view.dart';
|
||||
// import '../requests/gas_refill_item_view.dart';
|
||||
// import '../requests/ppm_item_view.dart';
|
||||
// import '../requests/service_request_item_view.dart';
|
||||
// todo delete
|
||||
// class DailyFragment extends StatefulWidget {
|
||||
// const DailyFragment({Key? key}) : super(key: key);
|
||||
//
|
||||
// @override
|
||||
// _DailyFragmentState createState() {
|
||||
// return _DailyFragmentState();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class _DailyFragmentState extends State<DailyFragment> {
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
// Provider.of<AllRequestsProvider>(context, listen: false).getCalendarRequests(from: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day));
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return SingleChildScrollView(
|
||||
// padding: const EdgeInsets.only(left: 16, right: 16),
|
||||
// child: Consumer<AllRequestsProvider>(builder: (context, snapshot, _) {
|
||||
// return Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
// children: [
|
||||
// DateFormat("EEEE, d MMMM, yyyy", context.isAr ? "ar" : "en").format(DateTime.now()).heading5(context),
|
||||
// const Divider().defaultStyle(context),
|
||||
// if (snapshot.calendarRequests?.requestsDetails?.isEmpty ?? true)
|
||||
// Center(
|
||||
// child: context.translation.noDataFound.heading5(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
||||
// ).paddingOnly(top: 16, bottom: 16),
|
||||
// ListView.separated(
|
||||
// shrinkWrap: true,
|
||||
// physics: const NeverScrollableScrollPhysics(),
|
||||
// itemBuilder: (cxt, index) {
|
||||
// final list = snapshot.calendarRequests!.requestsDetails!;
|
||||
// if (snapshot.isCalendarLoading) return const SizedBox().toRequestShimmer(cxt, snapshot.isCalendarLoading);
|
||||
// bool isServiceRequest = list[index].nameOfType == "ServiceRequest";
|
||||
// bool isGasRefill = list[index].nameOfType == "GasRefill";
|
||||
// bool isAssetTransfer = list[index].nameOfType == "AssetTransfer";
|
||||
// bool isPPMs = list[index].nameOfType == "PPMs";
|
||||
//
|
||||
// return isServiceRequest
|
||||
// ? ServiceRequestItemView(list[index])
|
||||
// : isGasRefill
|
||||
// ? GasRefillItemView(list[index])
|
||||
// : isPPMs
|
||||
// ? PpmItemView(list[index])
|
||||
// : isAssetTransfer
|
||||
// ? AssetItemView(list[index])
|
||||
// : Container(
|
||||
// height: 100,
|
||||
// width: double.infinity,
|
||||
// color: Colors.grey,
|
||||
// );
|
||||
// },
|
||||
// separatorBuilder: (cxt, index) => 8.height,
|
||||
// itemCount: snapshot.isCalendarLoading ? 6 : snapshot.calendarRequests!.requestsDetails!.length,
|
||||
// ),
|
||||
// ],
|
||||
// ).toShadowContainer(context);
|
||||
// }),
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// BoxDecoration cellDecoration({Color? color}) => BoxDecoration(color: color ?? Colors.transparent, shape: BoxShape.circle);
|
||||
// }
|
||||
|
||||
@ -1,143 +1,143 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:table_calendar/table_calendar.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/extensions/int_extensions.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||
|
||||
import '../../../../controllers/providers/api/all_requests_provider.dart';
|
||||
import '../requests/asset_item_view.dart';
|
||||
import '../requests/gas_refill_item_view.dart';
|
||||
import '../requests/ppm_item_view.dart';
|
||||
import '../requests/service_request_item_view.dart';
|
||||
import 'calender_days_card.dart';
|
||||
|
||||
class WeeklyFragment extends StatefulWidget {
|
||||
const WeeklyFragment({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_WeeklyFragmentState createState() {
|
||||
return _WeeklyFragmentState();
|
||||
}
|
||||
}
|
||||
|
||||
class _WeeklyFragmentState extends State<WeeklyFragment> {
|
||||
late DateTime _initialDate, _firstDate, _lastDate;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_initialDate = DateTime.now();
|
||||
_firstDate = DateTime.utc(2010, 10, 16);
|
||||
_lastDate = DateTime.utc(2030, 3, 14);
|
||||
Provider.of<AllRequestsProvider>(context, listen: false)
|
||||
.getCalendarRequests(from: DateTime.now().subtract(Duration(days: DateTime.now().weekday)), to: DateTime.now().add(Duration(days: DateTime.daysPerWeek - DateTime.now().weekday - 1)));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||
child: Consumer<AllRequestsProvider>(builder: (context, snapshot, _) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TableCalendar(
|
||||
firstDay: _firstDate,
|
||||
lastDay: _lastDate,
|
||||
focusedDay: _initialDate,
|
||||
calendarFormat: CalendarFormat.week,
|
||||
weekendDays: const [],
|
||||
onCalendarCreated: (controller) {},
|
||||
onPageChanged: (date) {
|
||||
if (!snapshot.isCalendarLoading) {
|
||||
_initialDate = date;
|
||||
|
||||
Provider.of<AllRequestsProvider>(context, listen: false)
|
||||
.getCalendarRequests(from: date.subtract(Duration(days: date.weekday)), to: date.add(Duration(days: DateTime.daysPerWeek - date.weekday - 1)));
|
||||
}
|
||||
},
|
||||
calendarBuilders: CalendarBuilders(
|
||||
headerTitleBuilder: (context, dateTime) => Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
DateFormat("EEEE, d MMMM, yyyy", context.isAr ? "ar" : "en").format(dateTime).heading5(context),
|
||||
8.height,
|
||||
const Divider().defaultStyle(context),
|
||||
],
|
||||
),
|
||||
dowBuilder: (context, dateTime) {
|
||||
final day = DateFormat("EE", context.isAr ? "ar" : "en").format(dateTime).toUpperCase();
|
||||
return Align(alignment: Alignment.center, child: day.bodyText(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50));
|
||||
},
|
||||
defaultBuilder: (context, dateTime, _) {
|
||||
final day = DateFormat("d").format(dateTime);
|
||||
return CalendarDaysCard(
|
||||
day: day,
|
||||
fill: snapshot.calendarRequests!.requestsDetails?.firstWhere(
|
||||
(element) => (element.date != null) && (DateTime.tryParse(element.date!)?.day == (dateTime).day),
|
||||
orElse: null,
|
||||
) !=
|
||||
null,
|
||||
).toShimmer(isShow: snapshot.isCalendarLoading);
|
||||
},
|
||||
outsideBuilder: (context, dateTime, _) {
|
||||
final day = DateFormat("d").format(dateTime);
|
||||
return CalendarDaysCard(
|
||||
day: day,
|
||||
fill: snapshot.calendarRequests!.requestsDetails?.firstWhere(
|
||||
(element) => (element.date != null) && (DateTime.tryParse(element.date!)?.day == (dateTime).day),
|
||||
orElse: null,
|
||||
) !=
|
||||
null,
|
||||
).toShimmer(isShow: snapshot.isCalendarLoading);
|
||||
},
|
||||
),
|
||||
daysOfWeekHeight: 35.toScreenHeight,
|
||||
headerStyle: const HeaderStyle(leftChevronVisible: false, rightChevronVisible: false, formatButtonVisible: false),
|
||||
calendarStyle: CalendarStyle(
|
||||
isTodayHighlighted: false,
|
||||
defaultTextStyle: AppTextStyles.bodyText,
|
||||
defaultDecoration: const BoxDecoration(shape: BoxShape.circle, color: AppColor.neutral30),
|
||||
),
|
||||
),
|
||||
if (snapshot.calendarRequests?.requestsDetails?.isNotEmpty ?? false) const Divider().defaultStyle(context),
|
||||
ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (cxt, index) {
|
||||
final list = snapshot.calendarRequests!.requestsDetails!;
|
||||
if (snapshot.isCalendarLoading) return const SizedBox().toRequestShimmer(cxt, snapshot.isCalendarLoading);
|
||||
bool isServiceRequest = list[index].nameOfType == "ServiceRequest";
|
||||
bool isGasRefill = list[index].nameOfType == "GasRefill";
|
||||
bool isAssetTransfer = list[index].nameOfType == "AssetTransfer";
|
||||
bool isPPMs = list[index].nameOfType == "PPMs";
|
||||
|
||||
return isServiceRequest
|
||||
? ServiceRequestItemView(list[index], showShadow: false)
|
||||
: isGasRefill
|
||||
? GasRefillItemView(list[index], showShadow: false)
|
||||
: isPPMs
|
||||
? PpmItemView(list[index], showShadow: false)
|
||||
: isAssetTransfer
|
||||
? AssetItemView(list[index], showShadow: false)
|
||||
: Container(
|
||||
height: 100,
|
||||
width: double.infinity,
|
||||
color: Colors.grey,
|
||||
);
|
||||
},
|
||||
separatorBuilder: (cxt, index) => const Divider().defaultStyle(context),
|
||||
itemCount: snapshot.isCalendarLoading ? 6 : snapshot.calendarRequests!.requestsDetails!.length,
|
||||
),
|
||||
],
|
||||
).toShadowContainer(context);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
BoxDecoration cellDecoration({Color? color}) => BoxDecoration(color: color ?? Colors.transparent, shape: BoxShape.circle);
|
||||
}
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:intl/intl.dart';
|
||||
// import 'package:provider/provider.dart';
|
||||
// import 'package:table_calendar/table_calendar.dart';
|
||||
// import 'package:test_sa/extensions/context_extension.dart';
|
||||
// import 'package:test_sa/extensions/int_extensions.dart';
|
||||
// import 'package:test_sa/extensions/text_extensions.dart';
|
||||
// import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
// import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||
// todo delete
|
||||
// import '../../../../controllers/providers/api/all_requests_provider.dart';
|
||||
// import '../requests/asset_item_view.dart';
|
||||
// import '../requests/gas_refill_item_view.dart';
|
||||
// import '../requests/ppm_item_view.dart';
|
||||
// import '../requests/service_request_item_view.dart';
|
||||
// import 'calender_days_card.dart';
|
||||
//
|
||||
// class WeeklyFragment extends StatefulWidget {
|
||||
// const WeeklyFragment({Key? key}) : super(key: key);
|
||||
//
|
||||
// @override
|
||||
// _WeeklyFragmentState createState() {
|
||||
// return _WeeklyFragmentState();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class _WeeklyFragmentState extends State<WeeklyFragment> {
|
||||
// late DateTime _initialDate, _firstDate, _lastDate;
|
||||
//
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
// _initialDate = DateTime.now();
|
||||
// _firstDate = DateTime.utc(2010, 10, 16);
|
||||
// _lastDate = DateTime.utc(2030, 3, 14);
|
||||
// Provider.of<AllRequestsProvider>(context, listen: false)
|
||||
// .getCalendarRequests(from: DateTime.now().subtract(Duration(days: DateTime.now().weekday)), to: DateTime.now().add(Duration(days: DateTime.daysPerWeek - DateTime.now().weekday - 1)));
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return SingleChildScrollView(
|
||||
// padding: const EdgeInsets.only(left: 16, right: 16),
|
||||
// child: Consumer<AllRequestsProvider>(builder: (context, snapshot, _) {
|
||||
// return Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// children: [
|
||||
// TableCalendar(
|
||||
// firstDay: _firstDate,
|
||||
// lastDay: _lastDate,
|
||||
// focusedDay: _initialDate,
|
||||
// calendarFormat: CalendarFormat.week,
|
||||
// weekendDays: const [],
|
||||
// onCalendarCreated: (controller) {},
|
||||
// onPageChanged: (date) {
|
||||
// if (!snapshot.isCalendarLoading) {
|
||||
// _initialDate = date;
|
||||
//
|
||||
// Provider.of<AllRequestsProvider>(context, listen: false)
|
||||
// .getCalendarRequests(from: date.subtract(Duration(days: date.weekday)), to: date.add(Duration(days: DateTime.daysPerWeek - date.weekday - 1)));
|
||||
// }
|
||||
// },
|
||||
// calendarBuilders: CalendarBuilders(
|
||||
// headerTitleBuilder: (context, dateTime) => Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
// children: [
|
||||
// DateFormat("EEEE, d MMMM, yyyy", context.isAr ? "ar" : "en").format(dateTime).heading5(context),
|
||||
// 8.height,
|
||||
// const Divider().defaultStyle(context),
|
||||
// ],
|
||||
// ),
|
||||
// dowBuilder: (context, dateTime) {
|
||||
// final day = DateFormat("EE", context.isAr ? "ar" : "en").format(dateTime).toUpperCase();
|
||||
// return Align(alignment: Alignment.center, child: day.bodyText(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50));
|
||||
// },
|
||||
// defaultBuilder: (context, dateTime, _) {
|
||||
// final day = DateFormat("d").format(dateTime);
|
||||
// return CalendarDaysCard(
|
||||
// day: day,
|
||||
// fill: snapshot.calendarRequests!.requestsDetails?.firstWhere(
|
||||
// (element) => (element.date != null) && (DateTime.tryParse(element.date!)?.day == (dateTime).day),
|
||||
// orElse: null,
|
||||
// ) !=
|
||||
// null,
|
||||
// ).toShimmer(isShow: snapshot.isCalendarLoading);
|
||||
// },
|
||||
// outsideBuilder: (context, dateTime, _) {
|
||||
// final day = DateFormat("d").format(dateTime);
|
||||
// return CalendarDaysCard(
|
||||
// day: day,
|
||||
// fill: snapshot.calendarRequests!.requestsDetails?.firstWhere(
|
||||
// (element) => (element.date != null) && (DateTime.tryParse(element.date!)?.day == (dateTime).day),
|
||||
// orElse: null,
|
||||
// ) !=
|
||||
// null,
|
||||
// ).toShimmer(isShow: snapshot.isCalendarLoading);
|
||||
// },
|
||||
// ),
|
||||
// daysOfWeekHeight: 35.toScreenHeight,
|
||||
// headerStyle: const HeaderStyle(leftChevronVisible: false, rightChevronVisible: false, formatButtonVisible: false),
|
||||
// calendarStyle: CalendarStyle(
|
||||
// isTodayHighlighted: false,
|
||||
// defaultTextStyle: AppTextStyles.bodyText,
|
||||
// defaultDecoration: const BoxDecoration(shape: BoxShape.circle, color: AppColor.neutral30),
|
||||
// ),
|
||||
// ),
|
||||
// if (snapshot.calendarRequests?.requestsDetails?.isNotEmpty ?? false) const Divider().defaultStyle(context),
|
||||
// ListView.separated(
|
||||
// shrinkWrap: true,
|
||||
// physics: const NeverScrollableScrollPhysics(),
|
||||
// itemBuilder: (cxt, index) {
|
||||
// final list = snapshot.calendarRequests!.requestsDetails!;
|
||||
// if (snapshot.isCalendarLoading) return const SizedBox().toRequestShimmer(cxt, snapshot.isCalendarLoading);
|
||||
// bool isServiceRequest = list[index].nameOfType == "ServiceRequest";
|
||||
// bool isGasRefill = list[index].nameOfType == "GasRefill";
|
||||
// bool isAssetTransfer = list[index].nameOfType == "AssetTransfer";
|
||||
// bool isPPMs = list[index].nameOfType == "PPMs";
|
||||
//
|
||||
// return isServiceRequest
|
||||
// ? ServiceRequestItemView(list[index], showShadow: false)
|
||||
// : isGasRefill
|
||||
// ? GasRefillItemView(list[index], showShadow: false)
|
||||
// : isPPMs
|
||||
// ? PpmItemView(list[index], showShadow: false)
|
||||
// : isAssetTransfer
|
||||
// ? AssetItemView(list[index], showShadow: false)
|
||||
// : Container(
|
||||
// height: 100,
|
||||
// width: double.infinity,
|
||||
// color: Colors.grey,
|
||||
// );
|
||||
// },
|
||||
// separatorBuilder: (cxt, index) => const Divider().defaultStyle(context),
|
||||
// itemCount: snapshot.isCalendarLoading ? 6 : snapshot.calendarRequests!.requestsDetails!.length,
|
||||
// ),
|
||||
// ],
|
||||
// ).toShadowContainer(context);
|
||||
// }),
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// BoxDecoration cellDecoration({Color? color}) => BoxDecoration(color: color ?? Colors.transparent, shape: BoxShape.circle);
|
||||
// }
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test_sa/models/enums/user_types.dart';
|
||||
|
||||
class RequestUtils{
|
||||
static List<Map<String, dynamic>> getTabs({required UsersTypes userType,required BuildContext context}) {
|
||||
List<Map<String, dynamic>> tabs = [];
|
||||
if(userType==UsersTypes.engineer){
|
||||
tabs.add({'label':'In Progress','status':2});
|
||||
tabs.add({'label':'Completed','status':4});
|
||||
return tabs;
|
||||
}
|
||||
tabs.add({'label':'New Request','status':1});
|
||||
tabs.add({'label':'In Progress','status':2});
|
||||
tabs.add({'label':'Completed','status':4});
|
||||
return tabs;
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/extensions/int_extensions.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||
|
||||
class NoDataFound extends StatelessWidget {
|
||||
final String? message;
|
||||
|
||||
const NoDataFound({Key? key, this.message}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset("assets/images/no_data_found.png", height: 64, width: 64),
|
||||
16.height,
|
||||
Text(message ?? "no Data found", style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20)),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||
|
||||
class NoItemFound extends StatelessWidget {
|
||||
final String? message;
|
||||
const NoItemFound({Key? key, this.message}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Center(
|
||||
child: Text(message ?? "no item found", style: AppTextStyles.heading5.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50)),
|
||||
),
|
||||
ListView(),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue