|
|
|
@ -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,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|