diff --git a/lib/controllers/api_routes/urls.dart b/lib/controllers/api_routes/urls.dart index 39818fc7..522b7853 100644 --- a/lib/controllers/api_routes/urls.dart +++ b/lib/controllers/api_routes/urls.dart @@ -4,14 +4,14 @@ class URLs { static const String appReleaseBuildNumber = "28"; // static const host1 = "https://atomsm.hmg.com"; // production url - static const host1 = "https://atomsmdev.hmg.com"; // local DEV url - // static const host1 = "https://atomsmuat.hmg.com"; // local UAT url + // static const host1 = "https://atomsmdev.hmg.com"; // local DEV url + static const host1 = "https://atomsmuat.hmg.com"; // local UAT url // static const host1 = "http://10.201.111.125:9495"; // temporary Server UAT url // static String _baseUrl = "$_host/mobile"; - // static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis - static final String _baseUrl = "$_host/v3/mobile"; // for asset delivery module + static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis + // static final String _baseUrl = "$_host/v3/mobile"; // for asset delivery module // static final String _baseUrl = "$_host/mobile"; // host local UAT and for internal audit dev // static final String _baseUrl = "$_host/v3/mobile"; // v3 for production CM,PM,TM // static final String _baseUrl = "$_host/v5/mobile"; // v5 for data segregation diff --git a/lib/modules/medical_gas_inspection/create_medical_gas_request_page.dart b/lib/modules/medical_gas_inspection/create_medical_gas_request_page.dart index d8c017ff..0bbd9e66 100644 --- a/lib/modules/medical_gas_inspection/create_medical_gas_request_page.dart +++ b/lib/modules/medical_gas_inspection/create_medical_gas_request_page.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:fluttertoast/fluttertoast.dart'; import 'package:provider/provider.dart'; import 'package:test_sa/extensions/context_extension.dart'; import 'package:test_sa/extensions/int_extensions.dart'; @@ -289,6 +290,9 @@ class _CreateMedicalGasRequestPageState extends State { }, ), 16.height, - MultipleItemDropDownMenu( - context: context, - showAsBottomSheet: true, - backgroundColor: AppColor.neutral100, - showShadow: false, - showCancel: true, - requestById: context.userProvider.user?.clientId, - title: 'Delivered Items'.addTranslation, - staticData: formModel.deliveredItemList, - initialValue: selectedItemList, - onSelect: (value) { - if ((value ?? []).isNotEmpty) { - WidgetsBinding.instance.addPostFrameCallback((_) { - if (!mounted) return; - setState(() { - selectedItemList = value ?? []; - }); - }); - } - }, - ), - if (selectedItemList.isNotEmpty) ...[ - 8.height, - ListView.separated( - separatorBuilder: (_, __) => 12.height, - itemCount: selectedItemList.length, - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - itemBuilder: (context, index) { - MedicalGasRequestDetailModel model = selectedItemList[index]; - return AppTextFormField( - labelText: '${model.name} (Req Qty =${model.requestedQuantity})', - hintText: 'Enter Delivered Quantity'.addTranslation, - backgroundColor: AppColor.fieldBgColor(context), - initialValue: model.deliveredQuantity != null ? model.deliveredQuantity?.toInt().toString() : '', - textAlign: TextAlign.center, - enable: true, - textInputType: TextInputType.number, - labelStyle: AppTextStyles.textFieldLabelStyle, - showShadow: false, - onChange: (value) { - if (value.isNotEmpty) { - model.deliveredQuantity = double.tryParse(value); - } - }, - style: Theme.of(context).textTheme.titleMedium, - ); - }, - ) - ], - 16.height, AppTextFormField( initialValue: formModel.deliveryNoteNumber, labelText: "Delivery Notes", @@ -174,6 +123,77 @@ class _UpdateDeliveryNotesState extends State { }, ), 16.height, + + //Older design code + // MultipleItemDropDownMenu( + // context: context, + // showAsBottomSheet: true, + // backgroundColor: AppColor.neutral100, + // showShadow: false, + // showCancel: true, + // requestById: context.userProvider.user?.clientId, + // title: 'Delivered Items'.addTranslation, + // staticData: formModel.deliveredItemList, + // initialValue: selectedItemList, + // onSelect: (value) { + // if ((value ?? []).isNotEmpty) { + // WidgetsBinding.instance.addPostFrameCallback((_) { + // if (!mounted) return; + // setState(() { + // selectedItemList = value ?? []; + // }); + // }); + // } + // }, + // ), + // if (selectedItemList.isNotEmpty) ...[ + // 8.height, + // ListView.separated( + // separatorBuilder: (_, __) => 12.height, + // itemCount: selectedItemList.length, + // shrinkWrap: true, + // physics: const NeverScrollableScrollPhysics(), + // itemBuilder: (context, index) { + // MedicalGasRequestDetailModel model = selectedItemList[index]; + // return AppTextFormField( + // labelText: '${model.name} (Req Qty =${model.requestedQuantity})', + // hintText: 'Enter Delivered Quantity'.addTranslation, + // backgroundColor: AppColor.fieldBgColor(context), + // initialValue: model.deliveredQuantity != null ? model.deliveredQuantity?.toInt().toString() : '', + // textAlign: TextAlign.center, + // enable: true, + // textInputType: TextInputType.number, + // labelStyle: AppTextStyles.textFieldLabelStyle, + // showShadow: false, + // onChange: (value) { + // if (value.isNotEmpty) { + // model.deliveredQuantity = double.tryParse(value); + // } + // }, + // style: Theme.of(context).textTheme.titleMedium, + // ); + // }, + // ) + // ], + if (formModel.deliveredItemList.isNotEmpty) ...[ + _ItemRowLayout( + left: 'Items'.addTranslation.bodyText(context).custom(color: AppColor.textColor(context)), + right: 'Delivered Qty'.addTranslation.bodyText(context).custom(color: AppColor.textColor(context)), + ), + 8.height, + ListView.separated( + separatorBuilder: (_, __) => 12.height, + itemCount: formModel.deliveredItemList.length, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (context, index) { + MedicalGasRequestDetailModel model = formModel.deliveredItemList[index]; + return itemQuantityFieldWidget(index: index, model: model, context: context); + }, + ) + ], + 16.height, + AttachmentPicker( label: 'Upload Attachment', attachment: formModel.attachments, @@ -285,4 +305,73 @@ class _UpdateDeliveryNotesState extends State { } }); } + + Widget itemQuantityFieldWidget({ + required int index, + required MedicalGasRequestDetailModel model, + required BuildContext context, + }) { + final border = OutlineInputBorder( + borderRadius: BorderRadius.circular(4), + borderSide: const BorderSide(color: AppColor.white70, width: 0), + ); + + return _ItemRowLayout( + left: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.itemName!.bodyText2(context).custom( + color: context.isDark ? Colors.white : AppColor.white936, + fontWeight: FontWeight.w500, + ), + 'Req Qty ${model.requestedQuantity}'.bodyText2(context).custom( + color: context.isDark ? Colors.white : AppColor.white936, + fontWeight: FontWeight.w500, + ), + ], + ), + right: TextFormField( + keyboardType: TextInputType.number, + initialValue: model.deliveredQuantity != null ? model.deliveredQuantity.toString() : '', + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric(horizontal: 5.toScreenWidth), + filled: true, + fillColor: AppColor.fieldBgColor(context), + constraints: BoxConstraints( + maxHeight: 30.toScreenHeight, + ), + border: border, + enabledBorder: border, + focusedBorder: border, + ), + onChanged: (value) { + model.deliveredQuantity = int.tryParse(value); + }, + ), + ); + } +} + +class _ItemRowLayout extends StatelessWidget { + final Widget left; + final Widget right; + + const _ItemRowLayout({ + required this.left, + required this.right, + }); + + @override + Widget build(BuildContext context) { + return Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded(child: left), // Items column + SizedBox( + width: 100.toScreenWidth, // Delivered Qty column + child: right, + ), + ], + ); + } } diff --git a/lib/new_views/pages/land_page/my_request/all_requests_filter_page.dart b/lib/new_views/pages/land_page/my_request/all_requests_filter_page.dart index 26076417..c134fecd 100644 --- a/lib/new_views/pages/land_page/my_request/all_requests_filter_page.dart +++ b/lib/new_views/pages/land_page/my_request/all_requests_filter_page.dart @@ -81,6 +81,7 @@ class _AllRequestsFilterPageState extends State { types[context.translation.recurrentWo] = 5; types["Equipment Internal Audit".addTranslation] = 10; types["System Internal Audit".addTranslation] = 11; + types["Medical Gas Inspection".addTranslation] = 14; } if (context.settingProvider.isUserFlowMedical && isEngineer) {