From b8051a40fe75774b40c5150b7e0e35551f14a1ec Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 13 Jul 2023 09:50:09 +0300 Subject: [PATCH] signature fixes --- lib/controllers/api_routes/urls.dart | 5 ++++- .../providers/api/device_transfer_provider.dart | 10 +++++----- .../pages/device_transfer/update_device_transfer.dart | 4 +++- lib/views/pages/user/requests/request_details.dart | 4 ++-- .../device_trancfer/device_transfer_info_section.dart | 1 + 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/controllers/api_routes/urls.dart b/lib/controllers/api_routes/urls.dart index 86794228..b4cb7226 100644 --- a/lib/controllers/api_routes/urls.dart +++ b/lib/controllers/api_routes/urls.dart @@ -12,7 +12,7 @@ class URLs { set host(String value) => _host = value; - static String getFileUrl(String file) => file == null || file.isEmpty ? null : "$_host/attachment/$file"; + static String getFileUrl(String file) => (file == null || file.isEmpty) ? null : (file.contains("/") ? file : "$_host/attachment/$file"); // API Routes static get login => "$_baseUrl/MobileAuth/LoginIntegration"; // post @@ -36,8 +36,11 @@ class URLs { static get getRepairLocation => "$_baseUrl/Lookups/GetLookup?lookupEnum=504"; static get equipmentStatus => "$_baseUrl/Lookups/GetLookup?lookupEnum=601"; + static get getDateOperators => "$_baseUrl/Lookups/GetLookup?lookupEnum=200"; + static get getMaintenanceSituation => "$_baseUrl/Lookups/GetLookup?lookupEnum=502"; + static get getAllUsers => "http://109.123.243.118:5000/api/Account/GetAllUsers"; static get getPreventiveMaintenanceVisits => "$_baseUrl/return/user/calibrations"; // get diff --git a/lib/controllers/providers/api/device_transfer_provider.dart b/lib/controllers/providers/api/device_transfer_provider.dart index 43c5eced..ca5234ce 100644 --- a/lib/controllers/providers/api/device_transfer_provider.dart +++ b/lib/controllers/providers/api/device_transfer_provider.dart @@ -181,7 +181,7 @@ class DeviceTransferProvider extends ChangeNotifier { "senderStartDate": newModel.timer?.startAt?.toIso8601String(), "senderEndDate": newModel.timer?.endAt?.toIso8601String(), "senderTravelingHours": newModel.travelingHours, - "senderAttachmentName": "${newModel.signature}.png", + "senderAttachmentName": newModel?.signature ?? "", "destSiteId": oldModel.receiver.client.id, "destDepartmentId": oldModel.receiver.department.id, "receiverAssignedEmployeeId": oldModel.receiver.userId, @@ -191,7 +191,7 @@ class DeviceTransferProvider extends ChangeNotifier { "receiverStartDate": oldModel.receiver.timer?.startAt?.toIso8601String(), "receiverEndDate": oldModel.receiver.timer?.endAt?.toIso8601String(), "receiverTravelingHours": oldModel.receiver.travelingHours, - "receiverAttachmentName": "${oldModel.receiver.signature}.png", + "receiverAttachmentName": oldModel.receiver?.signature ?? "", }); } else { body.addAll({ @@ -204,7 +204,7 @@ class DeviceTransferProvider extends ChangeNotifier { "senderStartDate": oldModel.sender.timer?.startAt?.toIso8601String(), "senderEndDate": oldModel.sender.timer?.endAt?.toIso8601String(), "senderTravelingHours": oldModel.sender.travelingHours, - "senderAttachmentName": "${oldModel.sender.signature}.png", + "senderAttachmentName": oldModel.sender?.signature ?? "", "destSiteId": newModel.client.id, "destDepartmentId": newModel.department.id, "receiverAssignedEmployeeId": newModel.userId, @@ -214,11 +214,11 @@ class DeviceTransferProvider extends ChangeNotifier { "receiverStartDate": newModel.timer?.startAt?.toIso8601String(), "receiverEndDate": newModel.timer?.endAt?.toIso8601String(), "receiverTravelingHours": newModel.travelingHours, - "receiverAttachmentName": "${newModel.signature}.png", + "receiverAttachmentName": newModel?.signature ?? "", }); } - body.addAll(newModel.toJson(isSender)); + //body.addAll(newModel.toJson(isSender)); print(body); Response response; try { diff --git a/lib/views/pages/device_transfer/update_device_transfer.dart b/lib/views/pages/device_transfer/update_device_transfer.dart index 061b5d21..a2787979 100644 --- a/lib/views/pages/device_transfer/update_device_transfer.dart +++ b/lib/views/pages/device_transfer/update_device_transfer.dart @@ -202,7 +202,9 @@ class _UpdateDeviceTransferState extends State { onSaved: (signature) { _signature = signature; if (signature == null || signature.isEmpty) return; - _formModel.signature = base64Encode(signature); + _formModel.signature = + "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}"; + // base64Encode(signature); }, ), Padding( diff --git a/lib/views/pages/user/requests/request_details.dart b/lib/views/pages/user/requests/request_details.dart index 61e835b2..23bd5792 100644 --- a/lib/views/pages/user/requests/request_details.dart +++ b/lib/views/pages/user/requests/request_details.dart @@ -194,8 +194,8 @@ class RequestDetailsPage extends StatelessWidget { info: serviceRequest.deviceNumber, ), RequestInfoRow( - title: _subtitle.deviceSN, - info: serviceRequest.deviceSerialNumber, + title: _subtitle.assetName, + info: serviceRequest.deviceEnName, ), RequestInfoRow( title: _subtitle.deviceModel, diff --git a/lib/views/widgets/device_trancfer/device_transfer_info_section.dart b/lib/views/widgets/device_trancfer/device_transfer_info_section.dart index 556cfec8..ea699121 100644 --- a/lib/views/widgets/device_trancfer/device_transfer_info_section.dart +++ b/lib/views/widgets/device_trancfer/device_transfer_info_section.dart @@ -18,6 +18,7 @@ class DeviceTransferInfoSection extends StatelessWidget { Widget build(BuildContext context) { info.userName = Provider.of(context).user.username; final subtitle = AppLocalization.of(context).subtitle; + print("url:${info.signature}"); return Column( children: [ RequestInfoRow(