From 02ccdd1f6a1617d59a923d9b242c15b7a8ed9aea Mon Sep 17 00:00:00 2001 From: WaseemAbbasi22 Date: Tue, 6 May 2025 08:09:23 +0300 Subject: [PATCH] ATOMS-856 fixed --- lib/main.dart | 9 +- lib/models/device/asset.dart | 17 + lib/models/new_models/department.dart | 2 +- lib/models/new_models/gas_refill_model.dart | 24 +- lib/models/new_models/mapped_sites.dart | 322 ++++++++++++++++++ .../task_request/task_request_model.dart | 15 +- .../app_floating_action_button.dart | 2 +- ...page.dart => gas_refill_request_form.dart} | 135 ++++---- .../create_request-type_bottomsheet.dart | 4 +- .../gas_request_providers/site_provider.dart | 27 +- .../create__device_transfer_request.dart | 8 +- .../user/gas_refill/gas_refill_details.dart | 19 +- ...rm.dart => update_gas_refill_request.dart} | 96 +----- lib/views/pages/user/land_page.dart | 2 +- .../user/tasks_request/create_task_view.dart | 11 +- .../task_request_detail_view.dart | 4 +- .../tasks_request/task_request_item_view.dart | 2 +- ...iew.dart => update_task_request_view.dart} | 8 +- 18 files changed, 500 insertions(+), 207 deletions(-) create mode 100644 lib/models/new_models/mapped_sites.dart rename lib/new_views/pages/{new_gas_refill_request_page.dart => gas_refill_request_form.dart} (75%) rename lib/views/pages/user/gas_refill/{gas_refill_form.dart => update_gas_refill_request.dart} (68%) rename lib/views/pages/user/tasks_request/{task_request_form_view.dart => update_task_request_view.dart} (99%) diff --git a/lib/main.dart b/lib/main.dart index 979b1e2d..4eac10a1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -73,7 +73,7 @@ import 'package:test_sa/views/pages/device_transfer/device_search_screen.dart'; import 'package:test_sa/views/pages/device_transfer/create__device_transfer_request.dart'; import 'package:test_sa/views/pages/device_transfer/track_device_transfer.dart'; import 'package:test_sa/views/pages/sub_workorder/create_sub_workorder_page.dart'; -import 'package:test_sa/views/pages/user/gas_refill/gas_refill_form.dart'; +import 'package:test_sa/views/pages/user/gas_refill/update_gas_refill_request.dart'; import 'package:test_sa/views/pages/user/gas_refill/request_gas_refill.dart'; import 'package:test_sa/views/pages/user/gas_refill/track_gas_refill.dart'; import 'package:test_sa/views/pages/user/notifications/notifications_page.dart'; @@ -92,7 +92,7 @@ import 'controllers/providers/api/gas_refill_comments.dart'; import 'controllers/providers/api/user_provider.dart'; import 'controllers/providers/settings/setting_provider.dart'; import 'dashboard_latest/dashboard_provider.dart'; -import 'new_views/pages/new_gas_refill_request_page.dart'; +import 'new_views/pages/gas_refill_request_form.dart'; import 'providers/service_request_providers/loan_availability_provider.dart'; import 'providers/service_request_providers/reject_reason_provider.dart'; import 'package:flutter_timezone/flutter_timezone.dart'; @@ -165,6 +165,7 @@ class MyApp extends StatelessWidget { ChangeNotifierProvider(create: (_) => CylinderSizeProvider()), ChangeNotifierProvider(create: (_) => DepartmentProvider()), ChangeNotifierProvider(create: (_) => SiteProvider()), + ChangeNotifierProvider(create: (_) => MappedSiteProvider()), ChangeNotifierProvider(create: (_) => NurseProvider()), ChangeNotifierProvider(create: (_) => HospitalsProvider()), ChangeNotifierProvider(create: (_) => AssetProvider()), @@ -304,12 +305,12 @@ class MyApp extends StatelessWidget { ///todo deleted //old.LandPage.id: (_) => const old.LandPage(), LandPage.routeName: (_) => const LandPage(), - NewGasRefillRequestPage.routeName: (_) => const NewGasRefillRequestPage(), + GasRefillRequestForm.routeName: (_) => const GasRefillRequestForm(), ServiceRequestsPage.id: (_) => const ServiceRequestsPage(), CreateTaskView.id: (_) => const CreateTaskView(), //ReportIssuesPage.id: (_) => ReportIssuesPage(), RequestGasRefill.id: (_) => const RequestGasRefill(), - GasRefillForm.id: (_) => const GasRefillForm(), + UpdateGasRefillRequest.id: (_) => const UpdateGasRefillRequest(), CreateServiceRequestPage.id: (_) => const CreateServiceRequestPage(), CreateNewRequest.id: (_) => const CreateNewRequest(), // SingleHospitalPicker.id: (_) => SingleHospitalPicker(), diff --git a/lib/models/device/asset.dart b/lib/models/device/asset.dart index b4b7b952..9473cfcc 100644 --- a/lib/models/device/asset.dart +++ b/lib/models/device/asset.dart @@ -1,6 +1,7 @@ import 'package:test_sa/models/device/supplier.dart'; import 'package:test_sa/models/device/technical_guidance_book.dart'; import 'package:test_sa/models/lookup.dart'; +import 'package:test_sa/models/new_models/mapped_sites.dart'; import 'package:test_sa/models/new_models/room_model.dart'; import '../new_models/building.dart'; @@ -30,6 +31,10 @@ class Asset { this.floor, this.department, this.room, + this.mappedSite, + this.mappedBuilding, + this.mappedDepartment, + this.mappedFloor, this.testsDay, this.purchasingPrice, this.nbv, @@ -137,6 +142,10 @@ class Asset { Building? building; // Now nullable Floor? floor; // Now nullable Department? department; // Now nullable + MappedSite? mappedSite; // Now nullable + MappedBuilding? mappedBuilding; // Now nullable + MappedFloor? mappedFloor; // Now nullable + MappedDepartment? mappedDepartment; // No Rooms? room; // Now nullable num? testsDay; // Now nullable num? purchasingPrice; // Now nullable @@ -189,6 +198,10 @@ class Asset { Floor? floor, Department? department, Rooms? room, + MappedSite? mappedSite, + MappedBuilding? mappedBuilding, + MappedDepartment? mappedDepartment, + MappedFloor? mappedFloor, num? testsDay, num? purchasingPrice, String? nbv, @@ -236,6 +249,10 @@ class Asset { parentAsset: parentAsset ?? this.parentAsset, assetType: assetType ?? this.assetType, site: site ?? this.site, + mappedSite: mappedSite ?? this.mappedSite, + mappedDepartment: mappedDepartment ?? this.mappedDepartment, + mappedFloor: mappedFloor ?? this.mappedFloor, + mappedBuilding: mappedBuilding ?? this.mappedBuilding, building: building ?? this.building, floor: floor ?? this.floor, department: department ?? this.department, diff --git a/lib/models/new_models/department.dart b/lib/models/new_models/department.dart index aff8fd39..fb93cc40 100644 --- a/lib/models/new_models/department.dart +++ b/lib/models/new_models/department.dart @@ -31,7 +31,7 @@ class Department extends Base { num? id; // Now nullable String? departmentName; // Now nullable String? departmentCode; // Now nullable - String? departmentId; // Now nullable + dynamic departmentId; // Now nullable String? ntCode; // Now nullable List? rooms; // Now nullable diff --git a/lib/models/new_models/gas_refill_model.dart b/lib/models/new_models/gas_refill_model.dart index 177af0c9..6d1ac30e 100644 --- a/lib/models/new_models/gas_refill_model.dart +++ b/lib/models/new_models/gas_refill_model.dart @@ -8,6 +8,7 @@ import 'package:test_sa/models/new_models/assigned_employee.dart'; import 'package:test_sa/models/new_models/building.dart'; import 'package:test_sa/models/new_models/department.dart'; import 'package:test_sa/models/new_models/floor.dart'; +import 'package:test_sa/models/new_models/mapped_sites.dart'; import 'package:test_sa/models/new_models/site.dart'; import 'package:test_sa/models/timer_model.dart'; @@ -65,6 +66,10 @@ class GasRefillModel { Building? building; // Now nullable Floor? floor; // Now nullable Department? department; // Now nullable + MappedSite? mapSite; // Now nullable + MappedBuilding? mappedBuilding; // Now nullable + MappedFloor? mappedFloor; // Now nullable + MappedDepartment? mappedDepartment; // AssignedEmployee? assignedEmployee; // Now nullable Lookup? status; // Now nullable String? comment; // Now nullable @@ -102,7 +107,6 @@ class GasRefillModel { gasRefillTimers?.add(GasRefillTimer.fromJson(v)); }); workingHours = json['gasRefillTimers'].fold(0.0, (sum, item) => (sum ?? 0) + DateTime.parse(item['endDate']).difference(DateTime.parse(item['startDate'])).inSeconds) ?? 0; - } if (json['gasRefillAttachments'] != null) { gasRefillAttachments = []; @@ -151,17 +155,17 @@ class GasRefillModel { map['cylinderTypeId'] = gasRefillDetails?[0].cylinderType?.id; map['cylinderSizeId'] = gasRefillDetails?[0].cylinderSize?.id; map['requestedQty'] = gasRefillDetails?[0].requestedQty; - if (site != null) { - map['siteId'] = site?.id; // Use '?.' for null safety + if (mapSite != null) { + map['siteId'] = mapSite?.id; // Use '?.' for null safety } - if (building != null) { - map['buildingId'] = building?.id; // Use '?.' for null safety + if (mappedBuilding != null) { + map['buildingId'] = mappedBuilding?.clientBuildingId; // Use '?.' for null safety } - if (floor != null) { - map['floorId'] = floor?.id; // Use '?.' for null safety + if (mappedFloor != null) { + map['floorId'] = mappedFloor?.clientFloorId; // Use '?.' for null safety } - if (department != null) { - map['departmentId'] = department?.id; // Use '?.' for null safety + if (mappedDepartment != null) { + map['departmentId'] = mappedDepartment?.departmentId; // Use '?.' for null safety } map['comment'] = comment; @@ -270,7 +274,7 @@ class GasRefillModel { gasRefillAttachments = model.gasRefillAttachments; createdDate = model.createdDate; workingHours = model.workingHours; - gasRefillTimers=model.gasRefillTimers; + gasRefillTimers = model.gasRefillTimers; } GasRefillModel copyWith({ diff --git a/lib/models/new_models/mapped_sites.dart b/lib/models/new_models/mapped_sites.dart new file mode 100644 index 00000000..9034aa77 --- /dev/null +++ b/lib/models/new_models/mapped_sites.dart @@ -0,0 +1,322 @@ +import 'package:test_sa/models/base.dart'; +import 'package:test_sa/models/new_models/room_model.dart'; + +class MappedSite extends Base { + int? id; + String? custName; + int? languageId; + List? translations; + int? customerCode; + dynamic costOfCustomerId; + dynamic costOfCustomerName; + dynamic taxId; + dynamic taxName; + dynamic custCategoryId; + dynamic custCategoryName; + dynamic custTypeId; + dynamic custTypeName; + dynamic custGroupId; + dynamic custGroupName; + dynamic invCollectionRep; + dynamic salesRep; + int? cityId; + String? cityName; + dynamic collectionPeriod1Id; + dynamic collectionPeriod1Name; + dynamic collectionPeriod2Id; + dynamic collectionPeriod2Name; + dynamic creditLimit; + dynamic salesSubRepId; + dynamic salesSubRepName; + dynamic initialLetterText; + dynamic assignedEmployeeId; + dynamic assignedEmployeeUserName; + dynamic groupLeaderId; + dynamic groupLeaderUserName; + int? organizationId; + String? orgCode; + String? orgName; + String? orgPostalCode; + List? attachments; + List? buildings; + dynamic operatingUnitNumber; + dynamic operatingUnitName; + List? custEndPoints; + dynamic createdBy; + dynamic createdDate; + dynamic modifiedBy; + dynamic modifiedDate; + + MappedSite({ + this.id, + this.custName, + this.languageId, + this.translations, + this.customerCode, + this.costOfCustomerId, + this.costOfCustomerName, + this.taxId, + this.taxName, + this.custCategoryId, + this.custCategoryName, + this.custTypeId, + this.custTypeName, + this.custGroupId, + this.custGroupName, + this.invCollectionRep, + this.salesRep, + this.cityId, + this.cityName, + this.collectionPeriod1Id, + this.collectionPeriod1Name, + this.collectionPeriod2Id, + this.collectionPeriod2Name, + this.creditLimit, + this.salesSubRepId, + this.salesSubRepName, + this.initialLetterText, + this.assignedEmployeeId, + this.assignedEmployeeUserName, + this.groupLeaderId, + this.groupLeaderUserName, + this.organizationId, + this.orgCode, + this.orgName, + this.orgPostalCode, + this.attachments, + this.buildings, + this.operatingUnitNumber, + this.operatingUnitName, + this.custEndPoints, + this.createdBy, + this.createdDate, + this.modifiedBy, + this.modifiedDate, + }) : super(identifier: id?.toString() ?? '', name: custName); + + MappedSite.fromJson(Map json) { + id = json['id']; + identifier = id?.toString() ?? ''; // Handle potential null id + custName = json['custName']; + name = custName; + languageId = json['languageId']; + translations = (json['translations'] as List?)?.map((e) => MappedTranslation.fromJson(e)).toList(); + customerCode = json['customerCode']; + costOfCustomerId = json['costOfCustomerId']; + costOfCustomerName = json['costOfCustomerName']; + taxId = json['taxId']; + taxName = json['taxName']; + custCategoryId = json['custCategoryId']; + custCategoryName = json['custCategoryName']; + custTypeId = json['custTypeId']; + custTypeName = json['custTypeName']; + custGroupId = json['custGroupId']; + custGroupName = json['custGroupName']; + invCollectionRep = json['invCollectionRep']; + salesRep = json['salesRep']; + cityId = json['cityId']; + cityName = json['cityName']; + collectionPeriod1Id = json['collectionPeriod_1Id']; + collectionPeriod1Name = json['collectionPeriod_1Name']; + collectionPeriod2Id = json['collectionPeriod_2Id']; + collectionPeriod2Name = json['collectionPeriod_2Name']; + creditLimit = json['creditLimit']; + salesSubRepId = json['salesSubRepId']; + salesSubRepName = json['salesSubRepName']; + initialLetterText = json['initialLetterText']; + assignedEmployeeId = json['assignedEmployeeId']; + assignedEmployeeUserName = json['assignedEmployeeUserName']; + groupLeaderId = json['groupLeaderId']; + groupLeaderUserName = json['groupLeaderUserName']; + organizationId = json['organizationId']; + orgCode = json['orgCode']; + orgName = json['orgName']; + orgPostalCode = json['orgPostalCode']; + attachments = json['attachments']; + buildings = (json['buildings'] as List?)?.map((e) => MappedBuilding.fromJson(e)).toList(); + operatingUnitNumber = json['operatingUnitNumber']; + operatingUnitName = json['operatingUnitName']; + custEndPoints = json['custEndPoints']; + createdBy = json['createdBy']; + createdDate = json['createdDate']; + modifiedBy = json['modifiedBy']; + modifiedDate = json['modifiedDate']; + } + + Map toJson() => { + 'id': id, + 'custName': custName, + 'languageId': languageId, + 'translations': translations?.map((e) => e.toJson()).toList(), + 'customerCode': customerCode, + 'costOfCustomerId': costOfCustomerId, + 'costOfCustomerName': costOfCustomerName, + 'taxId': taxId, + 'taxName': taxName, + 'custCategoryId': custCategoryId, + 'custCategoryName': custCategoryName, + 'custTypeId': custTypeId, + 'custTypeName': custTypeName, + 'custGroupId': custGroupId, + 'custGroupName': custGroupName, + 'invCollectionRep': invCollectionRep, + 'salesRep': salesRep, + 'cityId': cityId, + 'cityName': cityName, + 'collectionPeriod_1Id': collectionPeriod1Id, + 'collectionPeriod_1Name': collectionPeriod1Name, + 'collectionPeriod_2Id': collectionPeriod2Id, + 'collectionPeriod_2Name': collectionPeriod2Name, + 'creditLimit': creditLimit, + 'salesSubRepId': salesSubRepId, + 'salesSubRepName': salesSubRepName, + 'initialLetterText': initialLetterText, + 'assignedEmployeeId': assignedEmployeeId, + 'assignedEmployeeUserName': assignedEmployeeUserName, + 'groupLeaderId': groupLeaderId, + 'groupLeaderUserName': groupLeaderUserName, + 'organizationId': organizationId, + 'orgCode': orgCode, + 'orgName': orgName, + 'orgPostalCode': orgPostalCode, + 'attachments': attachments, + 'buildings': buildings?.map((e) => e.toJson()).toList(), + 'operatingUnitNumber': operatingUnitNumber, + 'operatingUnitName': operatingUnitName, + 'custEndPoints': custEndPoints, + 'createdBy': createdBy, + 'createdDate': createdDate, + 'modifiedBy': modifiedBy, + 'modifiedDate': modifiedDate, + }; +} + +class MappedTranslation { + int? id; + int? customerId; + int? langId; + String? langName; + String? nameValue; + + MappedTranslation(); + + MappedTranslation.fromJson(Map json) { + id = json['id']; + + customerId = json['customerId']; + langId = json['langId']; + langName = json['langName']; + nameValue = json['nameValue']; + } + + Map toJson() => { + 'id': id, + 'customerId': customerId, + 'langId': langId, + 'langName': langName, + 'nameValue': nameValue, + }; +} + +class MappedBuilding extends Base { + int? id; + int? customerId; + int? clientBuildingId; + String? clientBuildingName; + List? floors; + + MappedBuilding({ + this.id, + this.customerId, + this.clientBuildingId, + this.clientBuildingName, + this.floors, + }) : super(identifier: id?.toString() ?? '', name: clientBuildingName); + + MappedBuilding.fromJson(Map json) { + id = json['id']; + identifier = id?.toString() ?? ''; + customerId = json['customerId']; + clientBuildingId = json['clientBuildingId']; + clientBuildingName = json['clientBuildingName']; + name = clientBuildingName; + floors = (json['floors'] as List?)?.map((e) => MappedFloor.fromJson(e)).toList(); + } + + Map toJson() => { + 'id': id, + 'customerId': customerId, + 'clientBuildingId': clientBuildingId, + 'clientBuildingName': clientBuildingName, + 'floors': floors?.map((e) => e.toJson()).toList(), + }; +} + +class MappedFloor extends Base { + int? id; + int? buildingId; + int? clientFloorId; + String? clientFloorName; + List? departments; + + MappedFloor({ + this.id, + this.buildingId, + this.clientFloorId, + this.clientFloorName, + this.departments, + }) : super(identifier: id?.toString() ?? '', name: clientFloorName); + + MappedFloor.fromJson(Map json) { + id = json['id']; + identifier = id?.toString() ?? ''; + + buildingId = json['buildingId']; + clientFloorId = json['clientFloorId']; + clientFloorName = json['clientFloorName']; + name = clientFloorName; + departments = (json['departments'] as List?)?.map((e) => MappedDepartment.fromJson(e)).toList(); + } + + Map toJson() => { + 'id': id, + 'buildingId': buildingId, + 'clientFloorId': clientFloorId, + 'clientFloorName': clientFloorName, + 'departments': departments?.map((e) => e.toJson()).toList(), + }; +} + +class MappedDepartment extends Base { + int? id; + int? floorId; + int? departmentId; + String? departmentName; + List? rooms; + + MappedDepartment({ + this.id, + this.floorId, + this.departmentId, + this.departmentName, + this.rooms, + }) : super(identifier: id?.toString() ?? '', name: departmentName); + + MappedDepartment.fromJson(Map json) { + id = json['id']; + identifier = id?.toString() ?? ''; + floorId = json['floorId']; + departmentId = json['departmentId']; + departmentName = json['departmentName']; + name = departmentName; + // rooms = json['rooms']; + } + + Map toJson() => { + 'id': id, + 'floorId': floorId, + 'departmentId': departmentId, + 'departmentName': departmentName, + 'rooms': rooms, + }; +} diff --git a/lib/models/new_models/task_request/task_request_model.dart b/lib/models/new_models/task_request/task_request_model.dart index c6dbc606..08d1df59 100644 --- a/lib/models/new_models/task_request/task_request_model.dart +++ b/lib/models/new_models/task_request/task_request_model.dart @@ -3,6 +3,7 @@ import 'package:test_sa/models/lookup.dart'; import 'package:test_sa/models/new_models/assistant_employee.dart'; import 'package:test_sa/models/new_models/building.dart'; import 'package:test_sa/models/new_models/floor.dart'; +import 'package:test_sa/models/new_models/mapped_sites.dart'; import 'package:test_sa/models/new_models/site.dart'; import 'package:test_sa/models/new_models/department.dart'; import 'package:test_sa/models/new_models/room_model.dart'; @@ -629,10 +630,10 @@ class AddTaskModel { int? id; int? taskTypeId; List? assetIds = []; - Site? site; - Building? building; - Floor? floor; - Department? department; + MappedSite? site; + MappedBuilding? building; + MappedFloor? floor; + MappedDepartment? department; Rooms? room; String? callComment; Lookup? typeOfAlert; @@ -673,9 +674,9 @@ class AddTaskModel { 'taskTypeId': taskTypeId, 'assetIds': assetIds ?? [], 'siteId': site?.id, - 'buildingId': building?.id, - 'floorId': floor?.id, - 'departmentId': department?.id, + 'buildingId': building?.clientBuildingId, + 'floorId': floor?.clientFloorId, + 'departmentId': department?.departmentId, 'roomId': room?.id, 'callComment': callComment, 'typeOfAlertId': typeOfAlert?.id, diff --git a/lib/new_views/common_widgets/app_floating_action_button.dart b/lib/new_views/common_widgets/app_floating_action_button.dart index 73f6d38d..f3fee96e 100644 --- a/lib/new_views/common_widgets/app_floating_action_button.dart +++ b/lib/new_views/common_widgets/app_floating_action_button.dart @@ -8,7 +8,7 @@ // import 'package:test_sa/extensions/widget_extensions.dart'; // import 'package:test_sa/models/enums/user_types.dart'; // import 'package:test_sa/models/user.dart'; -// import 'package:test_sa/new_views/pages/new_gas_refill_request_page.dart'; +// import 'package:test_sa/new_views/pages/gas_refill_request_form.dart'; // import 'package:test_sa/views/pages/device_transfer/create__device_transfer_request.dart'; // import 'package:test_sa/views/pages/user/requests/create_service_request_page.dart'; // // todo @delete file diff --git a/lib/new_views/pages/new_gas_refill_request_page.dart b/lib/new_views/pages/gas_refill_request_form.dart similarity index 75% rename from lib/new_views/pages/new_gas_refill_request_page.dart rename to lib/new_views/pages/gas_refill_request_form.dart index b6e00f74..12a6b215 100644 --- a/lib/new_views/pages/new_gas_refill_request_page.dart +++ b/lib/new_views/pages/gas_refill_request_form.dart @@ -1,7 +1,5 @@ import 'dart:convert'; -import 'dart:developer'; import 'dart:io'; - import 'package:flutter/material.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:provider/provider.dart'; @@ -12,11 +10,8 @@ import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; import 'package:test_sa/models/enums/user_types.dart'; import 'package:test_sa/models/lookup.dart'; -import 'package:test_sa/models/new_models/building.dart'; -import 'package:test_sa/models/new_models/department.dart'; -import 'package:test_sa/models/new_models/floor.dart'; import 'package:test_sa/models/new_models/gas_refill_model.dart'; -import 'package:test_sa/models/new_models/site.dart'; +import 'package:test_sa/models/new_models/mapped_sites.dart'; import 'package:test_sa/new_views/app_style/app_color.dart'; import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart'; @@ -29,20 +24,19 @@ import 'package:test_sa/providers/loading_list_notifier.dart'; import 'package:test_sa/service_request_latest/utilities/service_request_utils.dart'; import 'package:test_sa/service_request_latest/views/components/action_button/footer_action_button.dart'; import 'package:test_sa/views/widgets/images/multi_image_picker.dart'; - import '../../controllers/providers/api/gas_refill_provider.dart'; import '../common_widgets/default_app_bar.dart'; -class NewGasRefillRequestPage extends StatefulWidget { - static const String routeName = "/new_gas_refill_request_page"; +class GasRefillRequestForm extends StatefulWidget { + static const String routeName = "/gas_refill_request_form"; - const NewGasRefillRequestPage({Key? key}) : super(key: key); + const GasRefillRequestForm({Key? key}) : super(key: key); @override - State createState() => _NewGasRefillRequestPageState(); + State createState() => _GasRefillRequestFormState(); } -class _NewGasRefillRequestPageState extends State { +class _GasRefillRequestFormState extends State { late GasRefillDetails _currentDetails; late GasRefillModel _gasModel; Lookup? _requestedQuantity; @@ -62,7 +56,6 @@ class _NewGasRefillRequestPageState extends State { void initState() { super.initState(); _gasRefillProvider ??= Provider.of(context, listen: false); - _gasModel =GasRefillModel(); _currentDetails = GasRefillDetails(); _gasModel = GasRefillModel(gasRefillDetails: []); } @@ -74,7 +67,6 @@ class _NewGasRefillRequestPageState extends State { @override Widget build(BuildContext context) { - return Scaffold( appBar: DefaultAppBar(title: context.translation.newGasRefillRequest), body: Column( @@ -134,37 +126,37 @@ class _NewGasRefillRequestPageState extends State { 8.height, Row( children: [ - SingleItemDropDownMenu( + SingleItemDropDownMenu( context: context, title: context.translation.site, - initialValue: _gasModel.site, + initialValue: _gasModel.mapSite, showAsBottomSheet: true, backgroundColor: AppColor.neutral100, showShadow: false, onSelect: (value) { setState(() { - _gasModel.site = value; - _gasModel.building = null; - _gasModel.floor = null; - _gasModel.department = null; + _gasModel.mapSite = value; + _gasModel.mappedBuilding = null; + _gasModel.mappedFloor = null; + _gasModel.mappedDepartment = null; }); }, ).expanded, 8.width, - SingleItemDropDownMenu( + SingleItemDropDownMenu( context: context, title: context.translation.building, - initialValue: _gasModel.building, - enabled: _gasModel.site?.buildings?.isNotEmpty ?? false, - staticData: _gasModel.site?.buildings ?? [], + initialValue: _gasModel.mappedBuilding, + enabled: _gasModel.mapSite?.buildings?.isNotEmpty ?? false, + staticData: _gasModel.mapSite?.buildings ?? [], showAsBottomSheet: true, backgroundColor: AppColor.neutral100, showShadow: false, onSelect: (value) { setState(() { - _gasModel.building = value; - _gasModel.floor = null; - _gasModel.department = null; + _gasModel.mappedBuilding = value; + _gasModel.mappedFloor = null; + _gasModel.mappedDepartment = null; }); }, ).expanded, @@ -173,34 +165,34 @@ class _NewGasRefillRequestPageState extends State { 8.height, Row( children: [ - SingleItemDropDownMenu( + SingleItemDropDownMenu( context: context, title: context.translation.floor, - initialValue: _gasModel.floor, - enabled: _gasModel.building?.floors?.isNotEmpty ?? false, - staticData: _gasModel.building?.floors ?? [], + initialValue: _gasModel.mappedFloor, + enabled: _gasModel.mappedBuilding?.floors?.isNotEmpty ?? false, + staticData: _gasModel.mappedBuilding?.floors ?? [], showAsBottomSheet: true, backgroundColor: AppColor.neutral100, showShadow: false, onSelect: (value) { setState(() { - _gasModel.floor = value; + _gasModel.mappedFloor = value; _gasModel.department = null; }); }, ).expanded, 8.width, - SingleItemDropDownMenu( + SingleItemDropDownMenu( context: context, title: context.translation.department, - initialValue: _gasModel.department, - enabled: _gasModel.floor?.departments?.isNotEmpty ?? false, - staticData: _gasModel.floor?.departments ?? [], + initialValue: _gasModel.mappedDepartment, + enabled: _gasModel.mappedFloor?.departments?.isNotEmpty ?? false, + staticData: _gasModel.mappedFloor?.departments ?? [], showAsBottomSheet: true, backgroundColor: AppColor.neutral100, showShadow: false, onSelect: (value) { - _gasModel.department = value; + _gasModel.mappedDepartment = value; }, ).expanded, ], @@ -214,7 +206,7 @@ class _NewGasRefillRequestPageState extends State { backgroundColor: AppColor.neutral100, showShadow: false, controller: _commentController, - onChange: (value){ + onChange: (value) { _gasModel.comment = value; }, onSaved: (value) {}, @@ -222,7 +214,7 @@ class _NewGasRefillRequestPageState extends State { 8.height, MultiFilesPicker( label: context.translation.attachFiles, - files:_files, + files: _files, buttonColor: AppColor.black10, onlyImages: false, buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120), @@ -238,40 +230,49 @@ class _NewGasRefillRequestPageState extends State { } Future _submit() async { - if (_currentDetails.gasType==null) { - Fluttertoast.showToast(msg: context.translation.youHaveToAddRequests); - return; - } - _gasModel.gasRefillDetails=[]; - _gasModel.gasRefillDetails?.add(_currentDetails); - _gasModel.gasRefillAttachments = []; - for (var item in _files) { - _gasModel.gasRefillAttachments?.add(GasRefillAttachments( - id: 0, gasRefillId: _gasModel.id ?? 0, attachmentName: ServiceRequestUtils.isLocalUrl(item.path) ? "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}" : item.path)); - } - await _gasRefillProvider?.addGasRefillRequest( - context: context, - model: _gasModel, - ); - if(_gasRefillProvider?.stateCode==200){ - DashBoardProvider dashBoardProvider = Provider.of(context,listen: false); - dashBoardProvider.refreshDashboard(context: context,userType: UsersTypes.nurse); + if (await validateRequest()) { + _gasModel.gasRefillDetails = []; + _gasModel.gasRefillDetails?.add(_currentDetails); + _gasModel.gasRefillAttachments = []; + for (var item in _files) { + _gasModel.gasRefillAttachments?.add(GasRefillAttachments( + id: 0, gasRefillId: _gasModel.id ?? 0, attachmentName: ServiceRequestUtils.isLocalUrl(item.path) ? "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}" : item.path)); + } + await _gasRefillProvider?.addGasRefillRequest( + context: context, + model: _gasModel, + ); + if (_gasRefillProvider?.stateCode == 200) { + DashBoardProvider dashBoardProvider = Provider.of(context, listen: false); + dashBoardProvider.refreshDashboard(context: context, userType: UsersTypes.nurse); + } } } - void _add() async { - if (_currentDetails.validate(context) && _gasModel.validate(context)) { - _gasModel.gasRefillDetails!.add(_currentDetails); - _currentDetails = GasRefillDetails(); - _requestedQuantity = null; - setState(() {}); + Future validateRequest() async { + if (_currentDetails.gasType == null) { + await Fluttertoast.showToast(msg: "Please Select Gas Type"); + return false; + } + if (_gasModel.mapSite == null) { + await Fluttertoast.showToast(msg: "Please Select Site"); + return false; + } + if (_gasModel.mappedBuilding == null) { + await Fluttertoast.showToast(msg: "Please Select Building"); + return false; } + if (_gasModel.mappedFloor == null) { + await Fluttertoast.showToast(msg: "Please Select Floor"); + return false; + } + if (_gasModel.mappedDepartment == null) { + await Fluttertoast.showToast(msg: "Please Select Department"); + return false; + } + return true; } - void _delete(index) { - _gasModel.gasRefillDetails!.remove(_gasModel.gasRefillDetails![index]); - setState(() {}); - } //older code.... // if (_gasModel.gasRefillDetails?.isEmpty ?? true) // AppFilledButton( diff --git a/lib/new_views/pages/land_page/create_request-type_bottomsheet.dart b/lib/new_views/pages/land_page/create_request-type_bottomsheet.dart index 14b00184..8d0c8c31 100644 --- a/lib/new_views/pages/land_page/create_request-type_bottomsheet.dart +++ b/lib/new_views/pages/land_page/create_request-type_bottomsheet.dart @@ -3,7 +3,7 @@ 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'; -import 'package:test_sa/new_views/pages/new_gas_refill_request_page.dart'; +import 'package:test_sa/new_views/pages/gas_refill_request_form.dart'; import 'package:test_sa/service_request_latest/views/nurse/create_new_request_view.dart'; import 'package:test_sa/views/pages/device_transfer/create__device_transfer_request.dart'; import 'package:test_sa/views/pages/user/tasks_request/create_task_view.dart'; @@ -56,7 +56,7 @@ class CreateRequestTypeBottomSheet extends StatelessWidget { label: context.translation.gasRefill, onTap: () { //NewGasRefillRequestPage.routeName) - Navigator.pushReplacementNamed(context, NewGasRefillRequestPage.routeName); + Navigator.pushReplacementNamed(context, GasRefillRequestForm.routeName); }, ), listCard( diff --git a/lib/providers/gas_request_providers/site_provider.dart b/lib/providers/gas_request_providers/site_provider.dart index 5d55cb88..008008df 100644 --- a/lib/providers/gas_request_providers/site_provider.dart +++ b/lib/providers/gas_request_providers/site_provider.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'package:http/http.dart'; +import 'package:test_sa/models/new_models/mapped_sites.dart'; import 'package:test_sa/models/new_models/site.dart'; import 'package:test_sa/providers/loading_list_notifier.dart'; @@ -17,7 +18,6 @@ class SiteProvider extends LoadingListNotifier { Response response = await ApiManager.instance.get(URLs.getSiteAutoCompleteWithoutConditionSites); stateCode = response.statusCode; if (response.statusCode >= 200 && response.statusCode < 300) { - // client's request was successfully received List categoriesListJson = json.decode(response.body)["data"]; items = categoriesListJson.map((item) => Site.fromJson(item)).toList(); } @@ -32,3 +32,28 @@ class SiteProvider extends LoadingListNotifier { } } } + +class MappedSiteProvider extends LoadingListNotifier { + @override + Future getDate() async { + if (loading ?? false) return -2; + loading = true; + notifyListeners(); + try { + Response response = await ApiManager.instance.post(URLs.getSites, body: {}); + stateCode = response.statusCode; + if (response.statusCode >= 200 && response.statusCode < 300) { + List categoriesListJson = json.decode(response.body)["data"]; + items = categoriesListJson.map((item) => MappedSite.fromJson(item)).toList(); + } + loading = false; + notifyListeners(); + return response.statusCode; + } catch (error) { + loading = false; + stateCode = -1; + notifyListeners(); + return -1; + } + } +} diff --git a/lib/views/pages/device_transfer/create__device_transfer_request.dart b/lib/views/pages/device_transfer/create__device_transfer_request.dart index f2bcadeb..49a97b2a 100644 --- a/lib/views/pages/device_transfer/create__device_transfer_request.dart +++ b/lib/views/pages/device_transfer/create__device_transfer_request.dart @@ -78,9 +78,7 @@ class _CreateDeviceTransferRequestState extends State attachement = []; for (var item in _deviceImages) { - attachement.add(AssetTransferAttachment(id: 0, attachmentName: "${item.path - .split("/") - .last}|${base64Encode(item.readAsBytesSync())}")); + attachement.add(AssetTransferAttachment(id: 0, attachmentName: "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}")); } _transferModel.attachments = attachement; @@ -103,7 +101,6 @@ class _CreateDeviceTransferRequestState extends State(builder: (cxt, snapshot, _) { try { @@ -337,4 +333,4 @@ class _CreateDeviceTransferRequestState extends State { padding: const EdgeInsets.all(16), child: informationCard(_model), ).expanded, - if (_userProvider.user!.type == UsersTypes.engineer && (_model.status!.value! != 2)) + + if (_userProvider.user!.type == UsersTypes.engineer && (_model.status!.value! != 2)) ...[ AppFilledButton( onPressed: () async { - await Navigator.of(context).push(MaterialPageRoute(builder: (_) => GasRefillForm(gasRefillModel: _model))); + await Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateGasRefillRequest(gasRefillModel: _model))); // getVisitData(); }, label: context.translation.updateRequest, ).paddingAll(16) + ] + // else if(_model.status!.value! == 0)...[ + // AppFilledButton( + // onPressed: () async { + // await Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateGasRefillRequest(gasRefillModel: _model))); + // // getVisitData(); + // }, + // label: context.translation.updateRequest, + // ).paddingAll(16) + // ], ], ); } @@ -167,7 +178,7 @@ class _GasRefillDetailsPageState extends State { style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50), ), 8.height, - FilesList(images: _model?.gasRefillAttachments?.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []), + FilesList(images: _model.gasRefillAttachments?.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []), ], ], ).expanded, diff --git a/lib/views/pages/user/gas_refill/gas_refill_form.dart b/lib/views/pages/user/gas_refill/update_gas_refill_request.dart similarity index 68% rename from lib/views/pages/user/gas_refill/gas_refill_form.dart rename to lib/views/pages/user/gas_refill/update_gas_refill_request.dart index f572c7b5..ce5a4598 100644 --- a/lib/views/pages/user/gas_refill/gas_refill_form.dart +++ b/lib/views/pages/user/gas_refill/update_gas_refill_request.dart @@ -12,6 +12,7 @@ import 'package:test_sa/controllers/providers/settings/setting_provider.dart'; import 'package:test_sa/extensions/context_extension.dart'; import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; +import 'package:test_sa/models/enums/user_types.dart'; import 'package:test_sa/models/lookup.dart'; import 'package:test_sa/models/timer_model.dart'; import 'package:test_sa/new_views/app_style/app_color.dart'; @@ -30,25 +31,21 @@ import '../../../../new_views/common_widgets/default_app_bar.dart'; import '../../../../new_views/common_widgets/single_item_drop_down_menu.dart'; import '../../../widgets/timer/app_timer.dart'; -class GasRefillForm extends StatefulWidget { +class UpdateGasRefillRequest extends StatefulWidget { static const String id = "/gas-refill-form"; final GasRefillModel? gasRefillModel; - const GasRefillForm({this.gasRefillModel, Key? key}) : super(key: key); + const UpdateGasRefillRequest({this.gasRefillModel, Key? key}) : super(key: key); @override - State createState() => _GasRefillFormState(); + State createState() => _UpdateGasRefillRequestState(); } -class _GasRefillFormState extends State { +class _UpdateGasRefillRequestState extends State { final bool _isLoading = false; - bool _validate = false; - Uint8List? _engineerSignature; - Uint8List? _nurseSignature; double totalWorkingHours = 0.0; late UserProvider _userProvider; - late SettingProvider _settingProvider; GasRefillProvider? _gasRefillProvider; GasRefillDetails _currentDetails = GasRefillDetails(); final TextEditingController _deliveredQuantityController = TextEditingController(); @@ -57,7 +54,6 @@ class _GasRefillFormState extends State { final GasRefillModel _formModel = GasRefillModel(gasRefillDetails: []); final GlobalKey _formKey = GlobalKey(); - final GlobalKey _DetailsKey = GlobalKey(); final GlobalKey _scaffoldKey = GlobalKey(); bool _firstTime = true; @@ -164,11 +160,9 @@ class _GasRefillFormState extends State { @override Widget build(BuildContext context) { _userProvider = Provider.of(context); - _settingProvider = Provider.of(context); if (_firstTime) { String? clientName; if (widget.gasRefillModel != null) { - //_formModel.status = widget.gasRefillModel?.status ?? Lookup(value: 0); _gasRefillProvider!.expectedDateTime = DateTime.tryParse(_formModel.expectedDate ?? ""); _formModel.timer = TimerModel(startAt: DateTime.tryParse(widget.gasRefillModel?.startDate ?? ""), endAt: DateTime.tryParse(widget.gasRefillModel?.endDate ?? "")); clientName = _formModel.site?.custName; @@ -176,15 +170,6 @@ class _GasRefillFormState extends State { _formModel.timer = null; clientName = _userProvider.user?.clientName; } - - // HospitalsProvider().getHospitalsListByVal(searchVal: clientName ?? '').then((value) { - // _gasRefillProvider!.hospital = value.firstWhere((element) => element.name == clientName, orElse: null); - // _gasRefillProvider!.building = _gasRefillProvider!.hospital?.buildings?.firstWhere((element) => element.name == widget.gasRefillModel?.building?.name, orElse: null); - // _gasRefillProvider!.floor = _gasRefillProvider!.building?.floors?.firstWhere((element) => element.name == widget.gasRefillModel?.floor?.name, orElse: null); - // _gasRefillProvider!.department = _gasRefillProvider!.floor?.departments?.firstWhere((element) => element.name == widget.gasRefillModel?.department?.departmentName, orElse: null); - // _firstTime = false; - // setState(() {}); - // }); } double totalWorkingHours = _formModel.gasRefillTimers?.fold(0.0, (sum, item) => (sum ?? 0) + DateTime.parse(item.endDate!).difference(DateTime.parse(item.startDate!)).inSeconds) ?? 0; @@ -212,24 +197,13 @@ class _GasRefillFormState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - // Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // context.translation.gasRefill.heading5(context), - // 8.height, - // '${context.translation.gasRequest}: ${widget.gasRefillModel!.gasRefillDetails![0].gasType!.name}'.bodyText(context), - // '${context.translation.cylinderType}: ${widget.gasRefillModel!.gasRefillDetails![0].cylinderType!.name}'.bodyText(context), - // '${context.translation.cylinderSize}: ${widget.gasRefillModel!.gasRefillDetails![0].cylinderSize!.name}'.bodyText(context), - // '${context.translation.quantity}: ${widget.gasRefillModel!.gasRefillDetails![0].requestedQty ?? 0}'.bodyText(context), - // '${context.translation.site}: ${widget.gasRefillModel!.site?.name}'.bodyText(context), - // ], - // ).toShadowContainer(context), 8.height, SingleItemDropDownMenu( context: context, title: context.translation.quantity, backgroundColor: AppColor.neutral100, showShadow: false, + showAsBottomSheet: true, initialValue: _deliveredQuantity, staticData: deliveredQuantity, onSelect: (value) { @@ -238,43 +212,8 @@ class _GasRefillFormState extends State { }, ), 8.height, - // AppTextFormField( - // initialValue: _formModel.gasRefillDetails?[0].deliverdQty?.toString() ?? "", - // labelText: context.translation.deliveredQuantity, - // onSaved: (value) { - // _currentDetails.deliverdQty = double.tryParse(value); - // }, - // textInputType: TextInputType.number, - // controller: _deliveredQuantityController, - // validator: (value) => value == null || value.isEmpty - // ? context.translation.requiredField - // : Validator.isNumeric(value) - // ? null - // : context.translation.onlyNumbers, - // ), - // 8.height, _timerWidget(context, totalWorkingHours), 8.height, - // SingleItemDropDownMenu( - // context: context, - // title: context.translation.requestStatus, - // initialValue: _formModel.status, - // onSelect: (value) { - // if (value?.value == 0) { - // "Status cannot be change to ${value?.name}.".addTranslation.showToast; - // setState(() {}); - // return; - // } - // if (value != null) { - // _formModel.status = value; - // } - // }, - // ), - // 8.height, - - // 8.height, - - /// TBD AppTextFormField( labelText: context.translation.technicalComment, textInputType: TextInputType.multiline, @@ -296,29 +235,6 @@ class _GasRefillFormState extends State { buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120), ), 8.height, - // ESignature( - // title: "Engineer Signature", - // oldSignature: widget.gasRefillModel?.engSignature, - // newSignature: _engineerSignature, - // onSaved: (signature) { - // _engineerSignature = signature; - // if (signature == null || signature.isEmpty) return; - // _formModel.engSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}"; - // //base64Encode(signature); - // }, - // ), - // 8.height, - // ESignature( - // title: "Nurse Signature", - // oldSignature: widget.gasRefillModel?.nurseSignature, - // newSignature: _nurseSignature, - // onSaved: (signature) { - // _nurseSignature = signature; - // if (signature == null || signature.isEmpty) return; - // _formModel.nurseSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}"; - // //base64Encode(signature); - // }, - // ), ], ).toShadowContainer(context), ).expanded, diff --git a/lib/views/pages/user/land_page.dart b/lib/views/pages/user/land_page.dart index a425bfec..5c08319e 100644 --- a/lib/views/pages/user/land_page.dart +++ b/lib/views/pages/user/land_page.dart @@ -9,7 +9,7 @@ // import 'package:test_sa/controllers/providers/api/user_provider.dart'; // import 'package:test_sa/controllers/providers/settings/setting_provider.dart'; // import 'package:test_sa/extensions/context_extension.dart'; -// import 'package:test_sa/new_views/pages/new_gas_refill_request_page.dart'; +// import 'package:test_sa/new_views/pages/gas_refill_request_form.dart'; // import 'package:test_sa/views/app_style/sizing.dart'; // import 'package:test_sa/views/pages/device_transfer/track_device_transfer.dart'; // import 'package:test_sa/views/pages/user/gas_refill/track_gas_refill.dart'; diff --git a/lib/views/pages/user/tasks_request/create_task_view.dart b/lib/views/pages/user/tasks_request/create_task_view.dart index 29723bfc..aae73285 100644 --- a/lib/views/pages/user/tasks_request/create_task_view.dart +++ b/lib/views/pages/user/tasks_request/create_task_view.dart @@ -1,6 +1,5 @@ import 'dart:convert'; import 'dart:io'; - import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:test_sa/dashboard_latest/dashboard_provider.dart'; @@ -13,6 +12,7 @@ import 'package:test_sa/models/enums/user_types.dart'; import 'package:test_sa/models/lookup.dart'; import 'package:test_sa/models/new_models/building.dart'; import 'package:test_sa/models/new_models/floor.dart'; +import 'package:test_sa/models/new_models/mapped_sites.dart'; import 'package:test_sa/models/new_models/room_model.dart'; import 'package:test_sa/models/new_models/task_request/task_request_model.dart'; import 'package:test_sa/models/new_models/task_request/task_type_model.dart'; @@ -29,7 +29,6 @@ import 'package:test_sa/service_request_latest/views/components/action_button/fo import 'package:test_sa/views/widgets/date_and_time/date_picker.dart'; import 'package:test_sa/views/widgets/equipment/asset_picker.dart'; import 'package:test_sa/views/widgets/images/multi_image_picker.dart'; - import '../../../../../../new_views/common_widgets/default_app_bar.dart'; import '../../../../models/new_models/department.dart'; import '../../../../models/new_models/site.dart'; @@ -147,7 +146,7 @@ class _CreateTaskViewState extends State with TickerProviderStat return Column( children: [ 8.height, - SingleItemDropDownMenu( + SingleItemDropDownMenu( context: context, title: context.translation.destinationSite, initialValue: _addTaskModel?.site, @@ -163,7 +162,7 @@ class _CreateTaskViewState extends State with TickerProviderStat }, ), 8.height, - SingleItemDropDownMenu( + SingleItemDropDownMenu( context: context, title: context.translation.building, backgroundColor: AppColor.neutral100, @@ -180,7 +179,7 @@ class _CreateTaskViewState extends State with TickerProviderStat }, ), 8.height, - SingleItemDropDownMenu( + SingleItemDropDownMenu( context: context, showAsBottomSheet: true, backgroundColor: AppColor.neutral100, @@ -196,7 +195,7 @@ class _CreateTaskViewState extends State with TickerProviderStat }, ), 8.height, - SingleItemDropDownMenu( + SingleItemDropDownMenu( context: context, title: context.translation.department, backgroundColor: AppColor.neutral100, diff --git a/lib/views/pages/user/tasks_request/task_request_detail_view.dart b/lib/views/pages/user/tasks_request/task_request_detail_view.dart index ea945dbf..d485c6f9 100644 --- a/lib/views/pages/user/tasks_request/task_request_detail_view.dart +++ b/lib/views/pages/user/tasks_request/task_request_detail_view.dart @@ -10,7 +10,7 @@ import 'package:test_sa/models/all_requests_and_count_model.dart'; import 'package:test_sa/models/new_models/task_request/task_request_model.dart'; import 'package:test_sa/new_views/common_widgets/default_app_bar.dart'; import 'package:test_sa/providers/task_request_provider/task_request_provider.dart'; -import 'package:test_sa/views/pages/user/tasks_request/task_request_form_view.dart'; +import 'package:test_sa/views/pages/user/tasks_request/update_task_request_view.dart'; import 'package:test_sa/views/widgets/images/files_list.dart'; import 'package:test_sa/views/widgets/loaders/app_loading.dart'; @@ -141,7 +141,7 @@ class _TaskRequestDetailsViewState extends State { if (taskProvider.taskRequestModel?.taskType?.isInstallation == true) { taskProvider.getSiteData(siteId: taskProvider.taskRequestModel?.asset?.siteId); } - Navigator.of(context).push(MaterialPageRoute(builder: (_) => TaskRequestForm(taskId: widget.taskId))); + Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateTaskRequest(taskId: widget.taskId))); }, label: context.translation.updateRequest, ).paddingAll(16) diff --git a/lib/views/pages/user/tasks_request/task_request_item_view.dart b/lib/views/pages/user/tasks_request/task_request_item_view.dart index 7a3abfd9..d56e3cc5 100644 --- a/lib/views/pages/user/tasks_request/task_request_item_view.dart +++ b/lib/views/pages/user/tasks_request/task_request_item_view.dart @@ -12,7 +12,7 @@ import 'package:test_sa/models/plan_preventive_visit/plan_preventive_visit_model import 'package:test_sa/new_views/app_style/app_color.dart'; import 'package:test_sa/views/pages/user/ppm/ppm_work_order/recurrent_wo/recurrent_work_order_view.dart'; import 'package:test_sa/views/pages/user/tasks_request/task_request_detail_view.dart'; -import 'package:test_sa/views/pages/user/tasks_request/task_request_form_view.dart'; +import 'package:test_sa/views/pages/user/tasks_request/update_task_request_view.dart'; import 'package:test_sa/views/widgets/requests/request_status.dart'; class TaskRequestItemView extends StatelessWidget { diff --git a/lib/views/pages/user/tasks_request/task_request_form_view.dart b/lib/views/pages/user/tasks_request/update_task_request_view.dart similarity index 99% rename from lib/views/pages/user/tasks_request/task_request_form_view.dart rename to lib/views/pages/user/tasks_request/update_task_request_view.dart index fcf35f7a..4b65bf21 100644 --- a/lib/views/pages/user/tasks_request/task_request_form_view.dart +++ b/lib/views/pages/user/tasks_request/update_task_request_view.dart @@ -36,16 +36,16 @@ import 'package:test_sa/views/widgets/timer/app_timer.dart'; import '../../../../models/new_models/site.dart'; import '../../../../models/new_models/work_order_detail_model.dart'; -class TaskRequestForm extends StatefulWidget { +class UpdateTaskRequest extends StatefulWidget { final int taskId; - const TaskRequestForm({Key? key, required this.taskId}) : super(key: key); + const UpdateTaskRequest({Key? key, required this.taskId}) : super(key: key); @override - State createState() => _TaskRequestFormState(); + State createState() => _UpdateTaskRequestState(); } -class _TaskRequestFormState extends State { +class _UpdateTaskRequestState extends State { TaskRequestProvider? _taskProvider; final TextEditingController _requestedQuantityController = TextEditingController(); final GlobalKey _formKey = GlobalKey();