fix timer issue on update transfer asset & update gas refill

main_design2.0
zaid_daoud 2 years ago
parent 58e6118cff
commit 67a224f60a

@ -154,10 +154,10 @@ class AssetTransferProvider extends ChangeNotifier {
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
assetTransfer.receiverStartDate = assetTransfer.receiverTimer?.startAt?.toIso8601String();
assetTransfer.receiverEndDate = assetTransfer.receiverTimer?.endAt?.toIso8601String();
assetTransfer.receiverWorkingHours = (((assetTransfer.receiverTimer?.durationInSecond ?? 0) * 60) * 60).toStringAsFixed(2);
assetTransfer.receiverWorkingHours = (((assetTransfer.receiverTimer?.durationInSecond ?? 0) / 60) / 60).toStringAsFixed(2);
assetTransfer.senderStartDate = assetTransfer.senderTimer?.startAt?.toIso8601String();
assetTransfer.senderEndDate = assetTransfer.senderTimer?.endAt?.toIso8601String();
assetTransfer.senderWorkingHours = (((assetTransfer.senderTimer?.durationInSecond ?? 0) * 60) * 60).toStringAsFixed(2);
assetTransfer.senderWorkingHours = (((assetTransfer.senderTimer?.durationInSecond ?? 0) / 60) / 60).toStringAsFixed(2);
response = await ApiManager.instance.put(URLs.updateDeviceTransfer, body: assetTransfer.toJson());
print(response.body);

@ -153,7 +153,7 @@ class GasRefillProvider extends ChangeNotifier {
if (newModel.timer?.endAt != null) "endDate": newModel.timer.endAt.toIso8601String(),
if (newModel.timer?.endAt != null) "endTime": newModel.timer.endAt.toIso8601String(),
// "workingHours": ((endDate?.difference(startDate)?.inMinutes ?? 0) / 60),
'workingHours': newModel.timer.durationInSecond != null ? newModel.timer.durationInSecond * 60 * 60 : newModel.workingHours,
'workingHours': newModel.timer.durationInSecond != null ? newModel.timer.durationInSecond / 60 / 60 : newModel.workingHours,
"assignedEmployee": oldModel?.assignedEmployee?.id == null ? null : oldModel?.assignedEmployee?.toJson(),
"site": hospital?.toMap(),
"building": building?.toJson(includeFloors: false),

@ -108,8 +108,8 @@ class AssetTransfer {
receiverTravelingHours = json['receiverTravelingHours'];
receiverEngSignature = json['receiverEngSignature'];
try {
receiverTimer = TimerModel(startAt: DateTime.tryParse(receiverStartDate ?? ""), endAt: DateTime.tryParse(receiverEndDate));
senderTimer = TimerModel(startAt: DateTime.tryParse(senderStartDate ?? ""), endAt: DateTime.tryParse(senderEndDate));
receiverTimer = TimerModel(startAt: DateTime.tryParse(receiverStartDate ?? ""), endAt: DateTime.tryParse(receiverEndDate ?? ""));
senderTimer = TimerModel(startAt: DateTime.tryParse(senderStartDate ?? ""), endAt: DateTime.tryParse(senderEndDate ?? ""));
if (receiverTimer.endAt != null && receiverTimer.startAt != null) {
receiverTimer.durationInSecond = (receiverTimer.endAt.difference(receiverTimer.startAt))?.inSeconds;
receiverWorkingHours = (((receiverTimer.durationInSecond ?? 0) / 60) / 60)?.toStringAsFixed(2);

@ -56,6 +56,14 @@ class _AllRequestsSearchPageState extends State<AllRequestsSearchPage> {
}
return Scaffold(
/// todo @zaid : FM asked if this button is doable
// floatingActionButton: FloatingActionButton(
// child: "qr".toSvgAsset(height: 32, fit: BoxFit.fitHeight, color: Theme.of(context).scaffoldBackgroundColor),
// onPressed: () async {
// String result = await Navigator.of(context).push(MaterialPageRoute(builder: (_) => const ScanQr())) as String;
// // _getDevice(result, isQr: true);
// },
// ).paddingOnly(bottom: 75),
appBar: DefaultAppBar(
title: context.translation.search,
actions: [

Loading…
Cancel
Save