From cea77ff7f70f5c27834c7af72ad13e48caffb309 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 28 Jan 2026 12:13:44 +0300 Subject: [PATCH] evaluation form added. --- lib/controllers/api_routes/urls.dart | 40 +- lib/modules/demo_module/demo_provider.dart | 14 + .../demo_module/evaluation_form_page.dart | 350 ++++++++++++++++++ .../single_item_drop_down_menu.dart | 8 +- 4 files changed, 406 insertions(+), 6 deletions(-) create mode 100644 lib/modules/demo_module/evaluation_form_page.dart diff --git a/lib/controllers/api_routes/urls.dart b/lib/controllers/api_routes/urls.dart index e6c1f6e5..f1c4fbac 100644 --- a/lib/controllers/api_routes/urls.dart +++ b/lib/controllers/api_routes/urls.dart @@ -66,11 +66,15 @@ class URLs { //service request new flow urls. static get nurseDashboardCountUrl => '$_baseUrl/ServiceRequest/GetDashboardNurseCount'; + static get qaAuditorCount => '$_baseUrl/ServiceRequest/GetDashboardQAAuditorCount'; + static get commissioningEngineerCount => '$_baseUrl/ServiceRequest/GetDashboardCommissioningEngineerCount'; static get nurseDashboardDetailsUrl => '$_baseUrl/ServiceRequest/GetDashboardNurseDetails'; + static get qaAuditorDetails => '$_baseUrl/ServiceRequest/GetDashboardQAAuditorDetails'; + static get commissioningEngineerDetails => '$_baseUrl/ServiceRequest/GetDashboardCommissioningEngineerDetails'; static get nurseRejectUrl => '$_baseUrl/ServiceRequest/NurseReject'; @@ -246,7 +250,9 @@ class URLs { static get getTrafRequestTypeLookup => "$_baseUrl/Lookups/GetLookup?lookupEnum=416"; static get getYesNoRequestTypeLookup => "$_baseUrl/Lookups/GetLookup?lookupEnum=4"; + static get getDemoPeriodLookup => "$_baseUrl/Lookups/GetLookup?lookupEnum=4101"; + static get getDemoDocumentTypes => "$_baseUrl/Lookups/GetLookup?lookupEnum=4104"; static get getClassificationTypeLookup => "$_baseUrl/Lookups/GetLookup?lookupEnum=450"; @@ -398,6 +404,8 @@ class URLs { static get addLoan => '$_baseUrl/Loan/AddLoan'; + static get addDemoTrialOutcome => '$_baseUrl/DemoRequest/addDemoTrialOutcome'; + //Asset Delivery Module static get getAssetDeliveryDetailsById => '$_baseUrl/AssetDeliveryExternal/GetAssetDeliveryExternalById'; @@ -414,44 +422,70 @@ class URLs { static get getOracleUserList => '$_baseUrl/AssetDeliveryExternal/GetEmployeesFromOracle'; static get getLineFromExternalPo => '$_baseUrl/AssetDeliveryExternalDeliveryInspection/GetLineFromExternalPo'; + static get getCostCenterListToLineDeliveryInspection => '$_baseUrl/AssetDeliveryExternalDeliveryInspection/GetCostCenterToLineDeliveryInspection'; + static get getCostCenterAndSerialNoToLineDeliveryInspection => '$_baseUrl/AssetDeliveryExternalDeliveryInspection/GetCostCenterAndSerialNoToLineDeliveryInspection'; + static get getCostCenterToPo => '$_baseUrl/AssetDeliveryExternalDeliveryInspection/GetCostCenterToPo'; + static get saveCostCenterToLineDeliveryInspection => '$_baseUrl/AssetDeliveryExternalDeliveryInspection/SaveCostCenterToLineDeliveryInspection'; + static get saveCostCenterAndSerialNoToLineDeliveryInspection => '$_baseUrl/AssetDeliveryExternalDeliveryInspection/SaveCostCenterAndSerialNoToLineDeliveryInspection'; + static get getDeliveryHistories => '$_baseUrl/AssetDeliveryExternalDelivery/GetDeliveryHistories'; + //Technical Inscption... static get getLineFromTechnicalInspection => '$_baseUrl/AssetDeliveryExternalTechnicalInspection/GetLineFromDeliveryInspection'; + static get getTechnicalInspectionByDetailId => '$_baseUrl/AssetDeliveryExternalTechnicalInspection/GetTechnicalInspectionByDetailId'; + static get powerSupplyTypeLookUp => "$_baseUrl/Lookups/GetLookup?lookupEnum=527"; + static get saveTechnicalInspection => "$_baseUrl/AssetDeliveryExternalTechnicalInspection/SaveTechnicalInspection"; + static get getTechnicalInspectionParentData => "$_baseUrl/AssetDeliveryExternalTechnicalInspection/GetTechnicalInspectionItemByCostCenterId"; + static get getAssetFromInternalTechnicalInspection => "$_baseUrl/AssetDeliveryExternalTechnicalInspection/GetAssetFromInternal"; + static get getAssetDetailsByAssetId => "$_baseUrl/AssetDeliveryExternalTechnicalInspection/GetAssetByIdFromInternal"; + static get saveTechnicalInspectionAsset => "$_baseUrl/AssetDeliveryExternalTechnicalInspection/SaveTechnicalInspectionItem"; + static get getAttachments => "$_baseUrl/AssetDeliveryExternalDeliveryAttachment/GetAttachmentsBasedOnType"; + static get saveAttachments => "$_baseUrl/AssetDeliveryExternalDeliveryAttachment/Save"; + //End user Acceptance... static get getEndUserAcceptanceCostCenter => "$_baseUrl/AssetDeliveryEndUserAcceptance/GetEndUserAcceptanceCostCenter"; + static get getCostCenterAssetList => "$_baseUrl/AssetDeliveryEndUserAcceptance/GetItemByCostCenter"; + static get saveEndUserFormData => "$_baseUrl/AssetDeliveryEndUserAcceptance/SaveMaster"; + static get saveEndUserAssetData => "$_baseUrl/AssetDeliveryEndUserAcceptance/SaveDetail"; + static get endUserStatusLookup => "$_baseUrl/Lookups/GetLookup?lookupEnum=534"; + // static get endUserRejectionReasonLookup => "$_baseUrl/Lookups/GetLookup?lookupEnum=5007"; static get endUserRejectionReasonLookup => "$_baseUrl/Lookups/GetLookup?lookupEnum=415"; + static get attachmentTypeLookup => "$_baseUrl/Lookups/GetLookup?lookupEnum=5009"; //Medical Gas Request.. // 4004 static get orderTypeLookUp => "$_baseUrl/Lookups/GetLookup?lookupEnum=4004"; + // static get itemTypeLookUp => "$_baseUrl/Lookups/GetLookup?lookupEnum=4005"; static get itemTypeLookUp => "$_baseUrl/MedicalGas/GetItemTypeLookup?lookupEnum=4002"; + static get getMedicalGasSupplierList => "$_baseUrl/MedicalGas/GetMedicalGasSupplierAsync"; + static get getMedicalGasInfoBySupplier => "$_baseUrl/MedicalGas/GetMedicalGasInfoBySupplierAsync"; - static get addMedicalGasRequest => "$_baseUrl/MedicalGas/AddUpdateMedicalGasRequestAsync"; - static get getMedicalGasById => "$_baseUrl/MedicalGas/GetMedicalGasRequestByIdAsync"; - static get updateDeliveryNote => "$_baseUrl/MedicalGas/MedicalGasRequestDeliveryNotesAsync"; + static get addMedicalGasRequest => "$_baseUrl/MedicalGas/AddUpdateMedicalGasRequestAsync"; + static get getMedicalGasById => "$_baseUrl/MedicalGas/GetMedicalGasRequestByIdAsync"; + static get updateDeliveryNote => "$_baseUrl/MedicalGas/MedicalGasRequestDeliveryNotesAsync"; } diff --git a/lib/modules/demo_module/demo_provider.dart b/lib/modules/demo_module/demo_provider.dart index 18e64600..3d78c627 100644 --- a/lib/modules/demo_module/demo_provider.dart +++ b/lib/modules/demo_module/demo_provider.dart @@ -35,4 +35,18 @@ class DemoProvider extends ChangeNotifier { } return loanData; } + + Future addDemoTrialOutcome(Map body) async { + try { + Response response = await ApiManager.instance.post(URLs.addDemoTrialOutcome, body: body, showToast: false); + if (response.statusCode >= 200 && response.statusCode < 300) { + String message = (jsonDecode(response.body)["data"] ?? "") + " " + (jsonDecode(response.body)["message"] ?? ""); + Fluttertoast.showToast(msg: message ?? "", toastLength: Toast.LENGTH_LONG); + return true; + } + return false; + } catch (error) { + return false; + } + } } diff --git a/lib/modules/demo_module/evaluation_form_page.dart b/lib/modules/demo_module/evaluation_form_page.dart new file mode 100644 index 00000000..50904023 --- /dev/null +++ b/lib/modules/demo_module/evaluation_form_page.dart @@ -0,0 +1,350 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:test_sa/extensions/context_extension.dart'; +import 'package:test_sa/extensions/int_extensions.dart'; +import 'package:test_sa/extensions/string_extensions.dart'; +import 'package:test_sa/extensions/text_extensions.dart'; +import 'package:test_sa/extensions/widget_extensions.dart'; +import 'package:test_sa/helper/utils.dart'; +import 'package:test_sa/models/lookup.dart'; +import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart'; +import 'package:test_sa/modules/demo_module/demo_provider.dart'; +import 'package:test_sa/modules/loan_module/provider/loan_provider.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'; +import 'package:test_sa/new_views/common_widgets/default_app_bar.dart'; +import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart'; +import 'package:test_sa/providers/loading_list_notifier.dart'; + +class EvaluationFormPage extends StatefulWidget { + EvaluationFormPage({Key? key}) : super(key: key); + + @override + _EvaluationFormPageState createState() { + return _EvaluationFormPageState(); + } +} + +class _EvaluationFormPageState extends State { + final GlobalKey _formKey = GlobalKey(); + + bool isAcknowledged = false; + + static List rating = [ + Lookup(name: "1", id: 1, value: 1), + Lookup(name: "2", id: 2, value: 2), + Lookup(name: "3", id: 3, value: 3), + Lookup(name: "4", id: 4, value: 4), + Lookup(name: "5", id: 5, value: 5) + ]; + Map formData = {}; + + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar(title: 'Evaluation'.addTranslation), + body: Form( + key: _formKey, + child: Column( + children: [ + SingleChildScrollView( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + questionnaire(), + 16.height, + ratingQuestions(), + 16.height, + optionQuestions(), + ], + ), + ).expanded, + FooterActionButton.footerContainer( + context: context, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Checkbox( + value: isAcknowledged, + visualDensity: const VisualDensity(horizontal: -4, vertical: -4), + activeColor: AppColor.blueStatus(context), + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + onChanged: (value) { + setState(() { + isAcknowledged = value!; + }); + }), + 8.width, + "I Acknowledge that the above information is correct and reflects my experience with the medical equipment." + .bodyText(context) + .custom(color: context.isDark ? AppColor.primary50 : AppColor.neutral120) + .expanded, + ], + ), + 16.height, + AppFilledButton( + buttonColor: AppColor.primary10, + label: context.translation.submitRequest, + disableButton: !isAcknowledged, + onPressed: _submit, + // buttonColor: AppColor.primary10, + ), + ], + ), + ), + ], + ), + ), + ); + } + + Widget questionnaire() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + 'Clinical practice after using the new technology'.addTranslation.bodyText(context).custom(color: AppColor.black10), + 16.height, + AppTextFormField( + initialValue: "", + hintText: "Some Comments", + labelText: "How did the new technology improve the practice compared with current technology", + validator: (value) { + if ((value ?? "").isEmpty) return "Mandatory"; + return null; + }, + style: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)), + labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff767676)), + floatingLabelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)), + backgroundColor: AppColor.fieldBgColor(context), + showShadow: false, + textInputType: TextInputType.multiline, + makeMultiLinesNull: false, + onChange: (value) { + formData['practiceImprovementDescription'] = value; + }, + ), + 8.height, + AppTextFormField( + initialValue: "", + hintText: "Some Comments", + labelText: "Does it suit the clinical needs?", + validator: (value) { + if ((value ?? "").isEmpty) return "Mandatory"; + return null; + }, + style: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)), + labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff767676)), + floatingLabelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)), + backgroundColor: AppColor.fieldBgColor(context), + showShadow: false, + textInputType: TextInputType.multiline, + makeMultiLinesNull: false, + onChange: (value) { + formData['suitsClinicalNeeds'] = value; + }, + ), + 8.height, + AppTextFormField( + initialValue: "", + labelText: "Did the technology save time?", + hintText: "Some Comments", + validator: (value) { + if ((value ?? "").isEmpty) return "Mandatory"; + return null; + }, + style: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)), + labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff767676)), + floatingLabelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)), + backgroundColor: AppColor.fieldBgColor(context), + showShadow: false, + textInputType: TextInputType.multiline, + makeMultiLinesNull: false, + onChange: (value) { + formData['technologySavedTime'] = value; + }, + ), + ], + ).toShadowContainer(context, borderRadius: 20); + } + + Widget ratingQuestions() { + return Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ + 'Rating the following.'.addTranslation.bodyText(context).custom(color: AppColor.black10), + 16.height, + SingleItemDropDownMenu( + context: context, + title: "Ease of Use", + backgroundColor: AppColor.fieldBgColor(context), + showShadow: false, + showAsBottomSheet: true, + initialValue: formData['easeOfUse'], + staticData: rating, + validator: (value) { + if (value == null) return "Mandatory"; + return null; + }, + onSelect: (value) { + formData['easeOfUse'] = value; + }, + ), + 8.height, + SingleItemDropDownMenu( + context: context, + title: "Ease of Application", + backgroundColor: AppColor.fieldBgColor(context), + showShadow: false, + showAsBottomSheet: true, + initialValue: formData['easeOfApplication'], + staticData: rating, + validator: (value) { + if (value == null) return "Mandatory"; + return null; + }, + onSelect: (value) { + formData['easeOfApplication'] = value; + }, + ), + 8.height, + SingleItemDropDownMenu( + context: context, + title: "Ease to apply on patient & switch between patients", + backgroundColor: AppColor.fieldBgColor(context), + showShadow: false, + showAsBottomSheet: true, + initialValue: formData['easeOfPatientSwitch'], + staticData: rating, + validator: (value) { + if (value == null) return "Mandatory"; + return null; + }, + onSelect: (value) { + formData['easeOfPatientSwitch'] = value; + }, + ), + 8.height, + SingleItemDropDownMenu( + context: context, + title: "Patient Comfort", + backgroundColor: AppColor.fieldBgColor(context), + showShadow: false, + showAsBottomSheet: true, + initialValue: formData['patientComfort'], + staticData: rating, + validator: (value) { + if (value == null) return "Mandatory"; + return null; + }, + onSelect: (value) { + formData['patientComfort'] = value; + }, + ), + 8.height, + SingleItemDropDownMenu( + context: context, + title: "Patient Comfort", + backgroundColor: AppColor.fieldBgColor(context), + showShadow: false, + showAsBottomSheet: true, + initialValue: formData['patientComfort'], + staticData: rating, + validator: (value) { + if (value == null) return "Mandatory"; + return null; + }, + onSelect: (value) { + formData['patientComfort'] = value; + }, + ), + // 8.height, + // SingleItemDropDownMenu( + // context: context, + // title: "Overall Rating", + // backgroundColor: AppColor.fieldBgColor(context), + // showShadow: false, + // showAsBottomSheet: true, + // initialValue: formData['patientComfort'], + // staticData: rating, + // validator: (value) { + // if (value == null) return "Mandatory"; + // return null; + // }, + // onSelect: (value) { + // formData['patientComfort'] = value; + // }, + // ), + // 8.height, + // SingleItemDropDownMenu( + // context: context, + // title: "Equipment Overall Rate", + // backgroundColor: AppColor.fieldBgColor(context), + // showShadow: false, + // showAsBottomSheet: true, + // initialValue: formData['patientComfort'], + // staticData: rating, + // validator: (value) { + // if (value == null) return "Mandatory"; + // return null; + // }, + // onSelect: (value) { + // formData['patientComfort'] = value; + // }, + // ), + ]).toShadowContainer(context, borderRadius: 20); + } + + Widget optionQuestions() { + return Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ + 'Addition Information & Comments'.addTranslation.bodyText(context).custom(color: AppColor.black10), + 16.height, + AppTextFormField( + initialValue: "", + labelText: "Some Comments", + style: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)), + labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff767676)), + floatingLabelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)), + backgroundColor: AppColor.fieldBgColor(context), + showShadow: false, + textInputType: TextInputType.multiline, + makeMultiLinesNull: false, + onChange: (value) { + // _demoFormModel.docName = value; + }, + ), + ]).toShadowContainer(context, borderRadius: 20); + } + + Future _submit() async { + FocusScope.of(context).unfocus(); + if (_formKey.currentState!.validate()) { + _formKey.currentState!.save(); + Utils.showLoading(context); + DemoProvider demoProvider = Provider.of(context, listen: false); + formData["id"] = 0; + formData["isAcknowledged"] = isAcknowledged; + + bool isSuccess = await demoProvider.addDemoTrialOutcome(formData); + Utils.hideLoading(context); + if (isSuccess) { + Navigator.pop(context); + } + } + } +} diff --git a/lib/new_views/common_widgets/single_item_drop_down_menu.dart b/lib/new_views/common_widgets/single_item_drop_down_menu.dart index ce7f7838..0dfeda3d 100644 --- a/lib/new_views/common_widgets/single_item_drop_down_menu.dart +++ b/lib/new_views/common_widgets/single_item_drop_down_menu.dart @@ -205,9 +205,11 @@ class _SingleItemDropDownMenuState( value: _selectedItem,