Merge branch 'zaid_development_new' into sikander-development

main_design2.0
Sikander Saleem 2 years ago
commit dc983f0db4

@ -202,8 +202,11 @@ class DeviceTransferProvider extends ChangeNotifier {
"senderEndDate": newModel.timer?.endAt?.toIso8601String(),
"senderTravelingHours": newModel.travelingHours,
"senderAttachmentName": newModel?.signature ?? "",
"destSiteId": oldModel.receiver.client.id,
"destDepartmentId": oldModel.receiver.department.id,
"destSiteId": oldModel.receiver.client?.id,
"destDepartmentId": oldModel.receiver.department?.id,
"destBuildingId": oldModel.receiver.building?.id,
"destFloorId": oldModel.receiver.floor?.id,
"destRoom": oldModel.receiver?.room,
"receiverAssignedEmployeeId": oldModel.receiver.userId,
"receiverMachineStatusId": oldModel.receiver.status.id ?? "",
"receiverComment": oldModel.receiver.comment,
@ -225,8 +228,11 @@ class DeviceTransferProvider extends ChangeNotifier {
"senderEndDate": oldModel.sender.timer?.endAt?.toIso8601String(),
"senderTravelingHours": oldModel.sender.travelingHours,
"senderAttachmentName": oldModel.sender?.signature ?? "",
"destSiteId": newModel.client.id,
"destDepartmentId": newModel.department.id,
"destSiteId": newModel.client?.id,
"destDepartmentId": newModel.department?.id,
"destBuildingId": newModel.building?.id,
"destFloorId": newModel.floor?.id,
"destRoom": newModel.room,
"receiverAssignedEmployeeId": newModel.userId,
"receiverMachineStatusId": newModel.status?.id ?? "",
"receiverComment": newModel.comment,
@ -237,7 +243,7 @@ class DeviceTransferProvider extends ChangeNotifier {
"receiverAttachmentName": newModel?.signature ?? "",
});
}
if (true) {}
//body.addAll(newModel.toJson(isSender));
print(body);
Response response;

@ -80,7 +80,6 @@ class RegularVisitsProvider extends ChangeNotifier {
List<Visit> visits = requestsListJson.map((request) => Visit.fromJson(request)).toList();
this.visits ??= [];
this.visits.addAll(visits);
sortMostRecent(this.visits);
notifyListeners();
if (visits.length == pageItemNumber) {
nextPage = true;
@ -100,12 +99,6 @@ class RegularVisitsProvider extends ChangeNotifier {
return response.statusCode;
}
void sortMostRecent(List<Visit> visits) {
visits.sort((prev, next) => (visitsSearch.mostRecent ?? false)
? DateTime.tryParse(next.createdOn).compareTo(DateTime.tryParse(prev.createdOn))
: DateTime.tryParse(prev.createdOn).compareTo(DateTime.tryParse(next.createdOn)));
}
/// return -2 if request in progress
/// return -1 if error happen when sending request
/// return state code if request complete may be 200, 404 or 403

@ -9,6 +9,9 @@ class DeviceTransferInfo {
String comment;
Hospital client;
Department department;
Buildings building;
Floors floor;
String room;
String workingHours;
// DateTime startDate;
@ -34,6 +37,9 @@ class DeviceTransferInfo {
this.status,
this.assignedEmployeeName,
this.timer,
this.building,
this.room,
this.floor,
});
Map<String, String> toJson(bool isSender) {
@ -63,6 +69,19 @@ class DeviceTransferInfo {
userName = old.userName;
client = Hospital.fromHospital(old.client);
department = Department.fromDepartment(old.department);
building = Buildings(
id: old.building?.id,
name: old.building?.name,
value: old.building?.value,
floors: old.building?.floors,
);
floor = Floors(
id: old.floor?.id,
name: old.floor?.name,
value: old.floor?.value,
departments: old.floor?.departments,
);
room = old.room;
workingHours = old.workingHours;
// startDate = old.startDate;
// endDate = old.endDate;
@ -94,6 +113,15 @@ class DeviceTransferInfo {
id: parsedJson["${key}DepartmentId"],
name: parsedJson["${key}DepartmentName"],
),
building: Buildings(
id: parsedJson["${key}BuildingId"],
name: parsedJson["${key}BuildingName"],
),
floor: Floors(
id: parsedJson["${key}FloorId"],
name: parsedJson["${key}FloorName"],
),
room: parsedJson["${key}Room"],
status: Lookup(
id: parsedJson["${key}status"],
name: parsedJson["${key}status"],

@ -156,43 +156,13 @@ class _RequestDeviceTransferState extends State<RequestDeviceTransfer> {
},
),
if (_formModel.device != null) 8.height,
if (_formModel.device != null) const ASubTitle("Asset Site"),
if (_formModel.device != null)
Container(
width: double.infinity,
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 16),
decoration: BoxDecoration(
color: AColors.inputFieldBackgroundColor,
border: Border.all(
color: const Color(0xffefefef),
),
borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
// boxShadow: const [
// AppStyle.boxShadow
// ]
),
child: ASubTitle(_formModel.device?.hospital?.name),
),
if (_formModel.device != null) AdditionalAssetInfo(title: "Asset Site", value: _formModel.device.hospital?.name),
if (_formModel.device != null) 4.height,
if (_formModel.device != null && _formModel.device.destDepartmentName != null) const ASubTitle("Asset Department"),
if (_formModel.device != null && _formModel.device.destDepartmentName != null)
Container(
width: double.infinity,
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 16),
decoration: BoxDecoration(
color: AColors.inputFieldBackgroundColor,
border: Border.all(
color: const Color(0xffefefef),
),
borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
// boxShadow: const [
// AppStyle.boxShadow
// ]
),
child: ASubTitle(_formModel.device.destDepartmentName.toString()),
),
if (_formModel.device != null) AdditionalAssetInfo(title: "Asset Department", value: _formModel.device.destDepartmentName),
if (_formModel.device != null) 4.height,
if (_formModel.device != null) AdditionalAssetInfo(title: "Asset Floor", value: _formModel.device.destFloor),
if (_formModel.device != null) 4.height,
if (_formModel.device != null) AdditionalAssetInfo(title: "Asset Room", value: _formModel.device.destRoom),
if (_formModel.device != null) 8.height,
// const SizedBox(height: 8,),
// const ASubTitle("Sender Department"),
@ -323,3 +293,31 @@ class _RequestDeviceTransferState extends State<RequestDeviceTransfer> {
);
}
}
class AdditionalAssetInfo extends StatelessWidget {
final String title, value;
const AdditionalAssetInfo({@required this.title, @required this.value, Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ASubTitle(title ?? ""),
Container(
width: double.infinity,
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 16),
decoration: BoxDecoration(
color: AColors.inputFieldBackgroundColor,
border: Border.all(
color: const Color(0xffefefef),
),
borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
),
child: ASubTitle(value ?? ""),
),
],
);
}
}

@ -34,7 +34,7 @@ class GasRefillDetails extends StatefulWidget {
}
class _GasRefillDetailsState extends State<GasRefillDetails> {
final GasRefillModel _model = GasRefillModel();
GasRefillModel _model = GasRefillModel();
bool _enableEdit = false;
bool _validate = false;
UserProvider _userProvider;
@ -75,7 +75,7 @@ class _GasRefillDetailsState extends State<GasRefillDetails> {
@override
void initState() {
_model.fromGasRefillModel(widget.model);
_model?.fromGasRefillModel(widget.model);
super.initState();
}
@ -124,7 +124,7 @@ class _GasRefillDetailsState extends State<GasRefillDetails> {
onPressed: () async {
// _enableEdit = !_enableEdit;
print(widget.model.startDate);
_model.fromGasRefillModel(widget.model);
_model?.fromGasRefillModel(widget.model);
print(widget.model.startDate);
// setState(() {});
Navigator.push(
@ -135,7 +135,9 @@ class _GasRefillDetailsState extends State<GasRefillDetails> {
),
),
).then((value) {
_model.status = value;
if (value != null) {
_model = value;
}
});
setState(() {});
},
@ -168,6 +170,10 @@ class _GasRefillDetailsState extends State<GasRefillDetails> {
title: "Floor",
info: _model.floor?.name,
),
RequestInfoRow(
title: "Department",
info: _model.department?.departmentName,
),
RequestInfoRow(
title: _subtitle.startDate,
info: _model.startDate == null ? null : "${DateFormat.yMd().format(_model.startDate)} ${DateFormat.Hms().format(_model.startDate)}",

@ -104,7 +104,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
Fluttertoast.showToast(
msg: _subtitle.requestCompleteSuccessfully,
);
Navigator.of(context).pop(_formModel.status);
Navigator.of(context).pop(_formModel);
setState(() {});
} else {
String errorMessage = HttpStatusManger.getStatusMessage(status: status, subtitle: _subtitle);
@ -294,6 +294,8 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
onChange: (timer) async {
_gasRefillProvider.timer = timer;
_formModel.workingHours = num.tryParse((((timer?.durationInSecond ?? 0) / 60) / 60)?.toStringAsFixed(2) ?? "0");
_formModel.startDate = timer.startAt;
_formModel.endDate = timer.endAt;
return true;
},
),
@ -533,12 +535,12 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
if (widget.gasRefillModel != null)
ESignature(
oldSignature: _formModel.signatureEngineer,
newSignature: _formModel.localNurseSignature,
newSignature: _formModel.localEngineerSignature,
onChange: (signature) {
if (signature == null || signature.isEmpty) {
return;
}
_formModel.localNurseSignature = signature;
_formModel.localEngineerSignature = signature;
_formModel.signatureEngineer = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
},
),

Loading…
Cancel
Save