|
|
|
|
@ -80,211 +80,209 @@ class _UpdateDeliveryNotesState extends State<UpdateDeliveryNotes> {
|
|
|
|
|
// _update(context: context);
|
|
|
|
|
// },
|
|
|
|
|
),
|
|
|
|
|
body: SafeArea(
|
|
|
|
|
child: Form(
|
|
|
|
|
key: _formKey,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
ListView(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
ADatePicker(
|
|
|
|
|
label: "Delivered Date",
|
|
|
|
|
hideShadow: true,
|
|
|
|
|
backgroundColor: AppColor.fieldBgColor(context),
|
|
|
|
|
from: DateTime.now().subtract(const Duration(days: 365 * 3)),
|
|
|
|
|
date: formModel.deliveredDate,
|
|
|
|
|
formatDateWithTime: true,
|
|
|
|
|
onDatePicker: (selectedDate) {
|
|
|
|
|
showTimePicker(
|
|
|
|
|
context: context,
|
|
|
|
|
initialTime: TimeOfDay.now(),
|
|
|
|
|
).then((selectedTime) {
|
|
|
|
|
if (selectedTime != null) {
|
|
|
|
|
formModel.deliveredDate = DateTime(selectedDate.year, selectedDate.month, selectedDate.day, selectedTime.hour, selectedTime.minute);
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
16.height,
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
initialValue: formModel.deliveryNoteNumber,
|
|
|
|
|
labelText: "Delivery Notes",
|
|
|
|
|
// validator: (value) {
|
|
|
|
|
// if ((value ?? "").isEmpty) return "Delivery Notes Required";
|
|
|
|
|
// return null;
|
|
|
|
|
// },
|
|
|
|
|
backgroundColor: AppColor.fieldBgColor(context),
|
|
|
|
|
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
|
|
|
|
floatingLabelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
|
|
|
|
showShadow: false,
|
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
|
makeMultiLinesNull: true,
|
|
|
|
|
onChange: (value) {
|
|
|
|
|
formModel.deliveryNoteNumber = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
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,
|
|
|
|
|
body: Form(
|
|
|
|
|
key: _formKey,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
ListView(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
ADatePicker(
|
|
|
|
|
label: "Delivered Date",
|
|
|
|
|
hideShadow: true,
|
|
|
|
|
backgroundColor: AppColor.fieldBgColor(context),
|
|
|
|
|
from: DateTime.now().subtract(const Duration(days: 365 * 3)),
|
|
|
|
|
date: formModel.deliveredDate,
|
|
|
|
|
formatDateWithTime: true,
|
|
|
|
|
onDatePicker: (selectedDate) {
|
|
|
|
|
showTimePicker(
|
|
|
|
|
context: context,
|
|
|
|
|
initialTime: TimeOfDay.now(),
|
|
|
|
|
).then((selectedTime) {
|
|
|
|
|
if (selectedTime != null) {
|
|
|
|
|
formModel.deliveredDate = DateTime(selectedDate.year, selectedDate.month, selectedDate.day, selectedTime.hour, selectedTime.minute);
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
16.height,
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
initialValue: formModel.deliveryNoteNumber,
|
|
|
|
|
labelText: "Delivery Notes",
|
|
|
|
|
// validator: (value) {
|
|
|
|
|
// if ((value ?? "").isEmpty) return "Delivery Notes Required";
|
|
|
|
|
// return null;
|
|
|
|
|
// },
|
|
|
|
|
backgroundColor: AppColor.fieldBgColor(context),
|
|
|
|
|
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
|
|
|
|
floatingLabelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
|
|
|
|
showShadow: false,
|
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
|
makeMultiLinesNull: true,
|
|
|
|
|
onChange: (value) {
|
|
|
|
|
formModel.deliveryNoteNumber = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
16.height,
|
|
|
|
|
|
|
|
|
|
AttachmentPicker(
|
|
|
|
|
label: 'Upload Attachment',
|
|
|
|
|
attachment: formModel.attachments,
|
|
|
|
|
buttonColor: AppColor.primary10,
|
|
|
|
|
// showAsListView: true,
|
|
|
|
|
onlyImages: false,
|
|
|
|
|
buttonIcon: 'attachment_icon'.toSvgAsset(
|
|
|
|
|
color: AppColor.primary10,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
16.height,
|
|
|
|
|
//should create a reusable widget.
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Checkbox(
|
|
|
|
|
value: formModel.isPressureChecked,
|
|
|
|
|
visualDensity: const VisualDensity(horizontal: -4.0, vertical: -4.0),
|
|
|
|
|
activeColor: AppColor.blueStatus(context),
|
|
|
|
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
formModel.isPressureChecked = value!;
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
12.width,
|
|
|
|
|
"I Acknowledge that the received medical gases cylinders have been tested for pressure."
|
|
|
|
|
.addTranslation
|
|
|
|
|
.bodyText(context)
|
|
|
|
|
.custom(color: context.isDark ? AppColor.primary50 : AppColor.neutral120)
|
|
|
|
|
.expanded,
|
|
|
|
|
],
|
|
|
|
|
//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,
|
|
|
|
|
Row(
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Checkbox(
|
|
|
|
|
value: formModel.isInspectedGasLeak,
|
|
|
|
|
visualDensity: const VisualDensity(horizontal: -4.0, vertical: -4.0),
|
|
|
|
|
activeColor: AppColor.blueStatus(context),
|
|
|
|
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
formModel.isInspectedGasLeak = value!;
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
12.width,
|
|
|
|
|
"I Acknowledge that the received medical gases cylinders have been inspected for leak test."
|
|
|
|
|
.addTranslation
|
|
|
|
|
.bodyText(context)
|
|
|
|
|
.custom(color: context.isDark ? AppColor.primary50 : AppColor.neutral120)
|
|
|
|
|
.expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
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);
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context, padding: 12),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
FooterActionButton.footerContainer(
|
|
|
|
|
context: context,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
AppFilledButton(
|
|
|
|
|
buttonColor: AppColor.primary10,
|
|
|
|
|
label: 'Save'.addTranslation,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
_update(context: context);
|
|
|
|
|
},
|
|
|
|
|
// buttonColor: AppColor.primary10,
|
|
|
|
|
).expanded,
|
|
|
|
|
8.width,
|
|
|
|
|
AppFilledButton(
|
|
|
|
|
16.height,
|
|
|
|
|
|
|
|
|
|
AttachmentPicker(
|
|
|
|
|
label: 'Upload Attachment',
|
|
|
|
|
attachment: formModel.attachments,
|
|
|
|
|
buttonColor: AppColor.primary10,
|
|
|
|
|
label: 'Submit'.addTranslation,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
_update(context: context, isSubmitted: true);
|
|
|
|
|
},
|
|
|
|
|
// buttonColor: AppColor.primary10,
|
|
|
|
|
).expanded,
|
|
|
|
|
// showAsListView: true,
|
|
|
|
|
onlyImages: false,
|
|
|
|
|
buttonIcon: 'attachment_icon'.toSvgAsset(
|
|
|
|
|
color: AppColor.primary10,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
16.height,
|
|
|
|
|
//should create a reusable widget.
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Checkbox(
|
|
|
|
|
value: formModel.isPressureChecked,
|
|
|
|
|
visualDensity: const VisualDensity(horizontal: -4.0, vertical: -4.0),
|
|
|
|
|
activeColor: AppColor.blueStatus(context),
|
|
|
|
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
formModel.isPressureChecked = value!;
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
12.width,
|
|
|
|
|
"I Acknowledge that the received medical gases cylinders have been tested for pressure."
|
|
|
|
|
.addTranslation
|
|
|
|
|
.bodyText(context)
|
|
|
|
|
.custom(color: context.isDark ? AppColor.primary50 : AppColor.neutral120)
|
|
|
|
|
.expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Row(
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Checkbox(
|
|
|
|
|
value: formModel.isInspectedGasLeak,
|
|
|
|
|
visualDensity: const VisualDensity(horizontal: -4.0, vertical: -4.0),
|
|
|
|
|
activeColor: AppColor.blueStatus(context),
|
|
|
|
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
formModel.isInspectedGasLeak = value!;
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
12.width,
|
|
|
|
|
"I Acknowledge that the received medical gases cylinders have been inspected for leak test."
|
|
|
|
|
.addTranslation
|
|
|
|
|
.bodyText(context)
|
|
|
|
|
.custom(color: context.isDark ? AppColor.primary50 : AppColor.neutral120)
|
|
|
|
|
.expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
).toShadowContainer(context, padding: 12),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
FooterActionButton.footerContainer(
|
|
|
|
|
context: context,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
AppFilledButton(
|
|
|
|
|
buttonColor: AppColor.primary10,
|
|
|
|
|
label: 'Save'.addTranslation,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
_update(context: context);
|
|
|
|
|
},
|
|
|
|
|
// buttonColor: AppColor.primary10,
|
|
|
|
|
).expanded,
|
|
|
|
|
8.width,
|
|
|
|
|
AppFilledButton(
|
|
|
|
|
buttonColor: AppColor.primary10,
|
|
|
|
|
label: 'Submit'.addTranslation,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
_update(context: context, isSubmitted: true);
|
|
|
|
|
},
|
|
|
|
|
// buttonColor: AppColor.primary10,
|
|
|
|
|
).expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
// .handlePopScope(
|
|
|
|
|
|