delivery notes item design updated

design_3.0_medical_gas
WaseemAbbasi22 1 day ago
parent c2068544db
commit 3c9688fdcb

@ -4,14 +4,14 @@ class URLs {
static const String appReleaseBuildNumber = "28"; static const String appReleaseBuildNumber = "28";
// static const host1 = "https://atomsm.hmg.com"; // production url // static const host1 = "https://atomsm.hmg.com"; // production url
static const host1 = "https://atomsmdev.hmg.com"; // local DEV 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://atomsmuat.hmg.com"; // local UAT url
// static const host1 = "http://10.201.111.125:9495"; // temporary Server UAT url // static const host1 = "http://10.201.111.125:9495"; // temporary Server UAT url
// static String _baseUrl = "$_host/mobile"; // static String _baseUrl = "$_host/mobile";
// static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis 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/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/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/v3/mobile"; // v3 for production CM,PM,TM
// static final String _baseUrl = "$_host/v5/mobile"; // v5 for data segregation // static final String _baseUrl = "$_host/v5/mobile"; // v5 for data segregation

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:test_sa/extensions/context_extension.dart'; import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/int_extensions.dart';
@ -289,6 +290,9 @@ class _CreateMedicalGasRequestPageState extends State<CreateMedicalGasRequestPag
Navigator.pop(context); Navigator.pop(context);
if (status) { if (status) {
Navigator.pop(context, true); Navigator.pop(context, true);
} else {
//This should be handled from backend.
Fluttertoast.showToast(msg: 'No gas available for selected site', toastLength: Toast.LENGTH_LONG);
} }
}); });
} }

@ -90,6 +90,7 @@ class _MedicalGasInspectionDetailPageState extends State<MedicalGasInspectionDet
8.height, 8.height,
Text("Request Details", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)), Text("Request Details", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
'${context.translation.requestNo}: ${model?.requestNumber ?? '-'}'.bodyText(context), '${context.translation.requestNo}: ${model?.requestNumber ?? '-'}'.bodyText(context),
'Requested by: ${model?.requestedBy ?? '-'}'.bodyText(context),
'Order Type: ${model?.requestOrderType ?? '-'}'.bodyText(context), 'Order Type: ${model?.requestOrderType ?? '-'}'.bodyText(context),
'Item Type: ${model?.itemType ?? '-'}'.bodyText(context), 'Item Type: ${model?.itemType ?? '-'}'.bodyText(context),
'Site: ${model?.site ?? '-'}'.bodyText(context), 'Site: ${model?.site ?? '-'}'.bodyText(context),

@ -105,57 +105,6 @@ class _UpdateDeliveryNotesState extends State<UpdateDeliveryNotes> {
}, },
), ),
16.height, 16.height,
MultipleItemDropDownMenu<MedicalGasRequestDetailModel, NullableLoadingProvider>(
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( AppTextFormField(
initialValue: formModel.deliveryNoteNumber, initialValue: formModel.deliveryNoteNumber,
labelText: "Delivery Notes", labelText: "Delivery Notes",
@ -174,6 +123,77 @@ class _UpdateDeliveryNotesState extends State<UpdateDeliveryNotes> {
}, },
), ),
16.height, 16.height,
//Older design code
// MultipleItemDropDownMenu<MedicalGasRequestDetailModel, NullableLoadingProvider>(
// 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( AttachmentPicker(
label: 'Upload Attachment', label: 'Upload Attachment',
attachment: formModel.attachments, attachment: formModel.attachments,
@ -285,4 +305,73 @@ class _UpdateDeliveryNotesState extends State<UpdateDeliveryNotes> {
} }
}); });
} }
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,
),
],
);
}
} }

@ -81,6 +81,7 @@ class _AllRequestsFilterPageState extends State<AllRequestsFilterPage> {
types[context.translation.recurrentWo] = 5; types[context.translation.recurrentWo] = 5;
types["Equipment Internal Audit".addTranslation] = 10; types["Equipment Internal Audit".addTranslation] = 10;
types["System Internal Audit".addTranslation] = 11; types["System Internal Audit".addTranslation] = 11;
types["Medical Gas Inspection".addTranslation] = 14;
} }
if (context.settingProvider.isUserFlowMedical && isEngineer) { if (context.settingProvider.isUserFlowMedical && isEngineer) {

Loading…
Cancel
Save