diff --git a/lib/controllers/api_routes/urls.dart b/lib/controllers/api_routes/urls.dart index 900aafd6..7f0995d8 100644 --- a/lib/controllers/api_routes/urls.dart +++ b/lib/controllers/api_routes/urls.dart @@ -169,12 +169,12 @@ class URLs { static get getGasCylinderSize => "$_baseUrl/Lookups/GetLookup?lookupEnum=608"; // get static get getGasCylinderType => "$_baseUrl/Lookups/GetLookup?lookupEnum=607"; // get static get getGasStatus => "$_baseUrl/Lookups/GetLookup?lookupEnum=609"; // get - static get requestGasRefill => "$_baseUrl/GazRefill/AddGazRefill"; // get - static get updateGasRefill => "$_baseUrl/GazRefill/UpdateGazRefill"; // get - static get getGasRefill => "$_baseUrl/GazRefill/GetGazRefills"; // get - static get getGasRefillById => "$_baseUrl/GazRefill/GetGazRefillById"; // get - static get getGazRefillComments => "$_baseUrl/GazRefill/GetHistoryComments"; // get - static get addGazRefillComment => "$_baseUrl/GazRefill/AddHistoryComment"; // add + static get requestGasRefill => "$_baseUrl/GasRefill/AddGasRefill"; // get + static get updateGasRefill => "$_baseUrl/GasRefill/UpdateGasRefill"; // get + static get getGasRefill => "$_baseUrl/GasRefill/GetGasRefills"; // get + static get getGasRefillById => "$_baseUrl/GasRefill/GetGasRefillById"; // get + static get getGasRefillComments => "$_baseUrl/GasRefill/GetHistoryComments"; // get + static get addGasRefillComment => "$_baseUrl/GasRefill/AddHistoryComment"; // add //device transfer static get requestDeviceTransfer => "$_baseUrl/AssetTransfer/AddAssetTransfer"; // get diff --git a/lib/controllers/providers/api/gas_refill_comments.dart b/lib/controllers/providers/api/gas_refill_comments.dart index 71e85f01..281ba4b3 100644 --- a/lib/controllers/providers/api/gas_refill_comments.dart +++ b/lib/controllers/providers/api/gas_refill_comments.dart @@ -47,7 +47,7 @@ class GasRefillCommentsProvider extends ChangeNotifier { notifyListeners(); late Response response; try { - response = await ApiManager.instance.get(URLs.getGazRefillComments + "?gasRefillId=$callId"); + response = await ApiManager.instance.get(URLs.getGasRefillComments + "?gasRefillId=$callId"); stateCode = response.statusCode; if (response.statusCode >= 200 && response.statusCode < 300) { @@ -87,7 +87,7 @@ class GasRefillCommentsProvider extends ChangeNotifier { late Response response; try { showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading()); - response = await ApiManager.instance.post(URLs.addGazRefillComment, body: {"id": 0, "gasRefillId": id, "comment": comment}); + response = await ApiManager.instance.post(URLs.addGasRefillComment, body: {"id": 0, "gasRefillId": id, "comment": comment}); stateCode = response.statusCode; if (response.statusCode >= 200 && response.statusCode < 300) { diff --git a/lib/controllers/providers/api/gas_refill_provider.dart b/lib/controllers/providers/api/gas_refill_provider.dart index a5d59016..c2892a0d 100644 --- a/lib/controllers/providers/api/gas_refill_provider.dart +++ b/lib/controllers/providers/api/gas_refill_provider.dart @@ -46,7 +46,7 @@ class GasRefillProvider extends ChangeNotifier { Future getGasRefillObjectById(num id) async { try { - Response response = await ApiManager.instance.get(URLs.getGasRefillById + "?gazRefillId=$id"); + Response response = await ApiManager.instance.get(URLs.getGasRefillById + "?gasRefillId=$id"); if (response.statusCode >= 200 && response.statusCode < 300) { return GasRefillModel.fromJson(json.decode(response.body)["data"]); diff --git a/lib/models/helper_data_models/maintenance_request/activity_maintenance_model.dart b/lib/models/helper_data_models/maintenance_request/activity_maintenance_model.dart index 046cf913..9580c1a9 100644 --- a/lib/models/helper_data_models/maintenance_request/activity_maintenance_model.dart +++ b/lib/models/helper_data_models/maintenance_request/activity_maintenance_model.dart @@ -12,7 +12,6 @@ class ActivityMaintenanceHelperModel { //remove this int? lastSituationId; Lookup? lastSituation; - Lookup? activityStatus; DateTime? startTime; DateTime? endTime; diff --git a/lib/models/new_models/gas_refill_model.dart b/lib/models/new_models/gas_refill_model.dart index 938d94e4..61f566c4 100644 --- a/lib/models/new_models/gas_refill_model.dart +++ b/lib/models/new_models/gas_refill_model.dart @@ -42,7 +42,7 @@ class GasRefillModel { GasRefillModel.fromJson(dynamic json) { id = json['id']; - gazRefillNo = json['gazRefillNo']; + gazRefillNo = json['gasRefillNo']; expectedDate = json['expectedDate']; expectedTime = json['expectedTime']; startDate = json['startDate']; @@ -80,9 +80,9 @@ class GasRefillModel { department = json['department'] != null ? Department.fromJson(json['department']) : null; assignedEmployee = json['assignedEmployee'] != null ? AssignedEmployee.fromJson(json['assignedEmployee']) : null; status = json['status'] != null ? Lookup.fromJson(json['status']) : null; - if (json['gazRefillDetails'] != null) { + if (json['gasRefillDetails'] != null) { gazRefillDetails = []; - json['gazRefillDetails'].forEach((v) { + json['gasRefillDetails'].forEach((v) { gazRefillDetails!.add(GasRefillDetails.fromJson(v)); // Use '!' since gazRefillDetails is initialized here }); } @@ -167,7 +167,7 @@ class GasRefillModel { Map toJson() { final map = {}; map['id'] = id ?? 0; - map['gazRefillNo'] = "GR-${DateTime.now().toString().split(" ").first}"; + map['gasRefillNo'] = "GR-${DateTime.now().toString().split(" ").first}"; map['expectedDate'] = expectedDate; map['expectedTime'] = expectedTime; map['startDate'] = startDate; @@ -201,7 +201,7 @@ class GasRefillModel { map['status'] = status?.toJson(); // Use '?.' for null safety } if (gazRefillDetails != null) { - map['gazRefillDetails'] = gazRefillDetails!.map((v) => v.toJson()).toList(); // Use '!' since gazRefillDetails could be null + map['gasRefillDetails'] = gazRefillDetails!.map((v) => v.toJson()).toList(); // Use '!' since gazRefillDetails could be null } return map; } diff --git a/lib/new_views/pages/land_page/requests/gas_refill_item_view.dart b/lib/new_views/pages/land_page/requests/gas_refill_item_view.dart index a817e22f..00f848f6 100644 --- a/lib/new_views/pages/land_page/requests/gas_refill_item_view.dart +++ b/lib/new_views/pages/land_page/requests/gas_refill_item_view.dart @@ -21,7 +21,9 @@ class GasRefillItemView extends StatelessWidget { @override Widget build(BuildContext context) { + if (requestData != null) { + return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/views/pages/user/gas_refill/gas_refill_details.dart b/lib/views/pages/user/gas_refill/gas_refill_details.dart index b341c310..424410b1 100644 --- a/lib/views/pages/user/gas_refill/gas_refill_details.dart +++ b/lib/views/pages/user/gas_refill/gas_refill_details.dart @@ -109,9 +109,9 @@ class _GasRefillDetailsPageState extends State { context.translation.gasRefillRequest.heading5(context), 8.height, - '${context.translation.gasRequest}: ${gasRefillModel.gazRefillDetails![0].gasType?.name}'.bodyText(context), - '${context.translation.cylinderType}: ${gasRefillModel.gazRefillDetails![0].cylinderType?.name}'.bodyText(context), - '${context.translation.cylinderSize}: ${gasRefillModel.gazRefillDetails![0].cylinderSize?.name}'.bodyText(context), + '${context.translation.gasRequest}: ${gasRefillModel.gazRefillDetails?[0].gasType?.name}'.bodyText(context), + '${context.translation.cylinderType}: ${gasRefillModel.gazRefillDetails?[0].cylinderType?.name}'.bodyText(context), + '${context.translation.cylinderSize}: ${gasRefillModel.gazRefillDetails?[0].cylinderSize?.name}'.bodyText(context), '${context.translation.site}: ${gasRefillModel.site?.name?.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context), '${context.translation.department}: ${gasRefillModel.department?.name?.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context), '${context.translation.requestNo}: ${gasRefillModel.gazRefillNo}'.bodyText(context), @@ -122,8 +122,8 @@ class _GasRefillDetailsPageState extends State { infoText(label:context.translation.createdDate ,value:gasRefillModel.createdDate?.toInitialVisitCardFormat), const Divider().defaultStyle(context), - '${context.translation.requestedQuantity}: ${gasRefillModel.gazRefillDetails![0].requestedQty ?? 0}'.bodyText(context), - '${context.translation.deliveredQuantity}: ${gasRefillModel.gazRefillDetails![0].deliverdQty ?? 0}'.bodyText(context), + '${context.translation.requestedQuantity}: ${gasRefillModel.gazRefillDetails?[0].requestedQty ?? 0}'.bodyText(context), + '${context.translation.deliveredQuantity}: ${gasRefillModel.gazRefillDetails?[0].deliverdQty ?? 0}'.bodyText(context), 8.height, if (gasRefillModel.comment?.isNotEmpty ?? false) ...[ const Divider().defaultStyle(context),