|
|
|
|
@ -36,6 +36,8 @@ class _UpdateDeliveryNotesState extends State<UpdateDeliveryNotes> {
|
|
|
|
|
late MedicalGasInspectionProvider medicalGasInspectionProvider;
|
|
|
|
|
bool pressureTestAcknowledgement = false;
|
|
|
|
|
bool leakTestAcknowledgement = false;
|
|
|
|
|
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
|
|
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
|
|
|
|
|
|
// List<MedicalGasRequestDetailModel> selectedItemList = [];
|
|
|
|
|
|
|
|
|
|
@ -56,7 +58,7 @@ class _UpdateDeliveryNotesState extends State<UpdateDeliveryNotes> {
|
|
|
|
|
MedicalGasDataModel dataModel = widget.dataModel!;
|
|
|
|
|
formModel = DeliveryNotesFormModel(
|
|
|
|
|
id: dataModel.id,
|
|
|
|
|
deliveredItemList: dataModel.requestDetailDtos,
|
|
|
|
|
deliveredItemList: dataModel.requestDetailDtos.where((item) => item.requestedQuantity! > 0).toList(),
|
|
|
|
|
isInspectedGasLeak: dataModel.isInspectedGasLeak,
|
|
|
|
|
isPressureChecked: dataModel.isPressureChecked,
|
|
|
|
|
deliveredDate: dataModel.deliveredDate,
|
|
|
|
|
@ -79,6 +81,8 @@ class _UpdateDeliveryNotesState extends State<UpdateDeliveryNotes> {
|
|
|
|
|
// },
|
|
|
|
|
),
|
|
|
|
|
body: SafeArea(
|
|
|
|
|
child: Form(
|
|
|
|
|
key: _formKey,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
ListView(
|
|
|
|
|
@ -110,10 +114,10 @@ class _UpdateDeliveryNotesState extends State<UpdateDeliveryNotes> {
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
initialValue: formModel.deliveryNoteNumber,
|
|
|
|
|
labelText: "Delivery Notes",
|
|
|
|
|
validator: (value) {
|
|
|
|
|
if ((value ?? "").isEmpty) return "Mandatory";
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
// 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)),
|
|
|
|
|
@ -281,6 +285,7 @@ class _UpdateDeliveryNotesState extends State<UpdateDeliveryNotes> {
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
// .handlePopScope(
|
|
|
|
|
// cxt: context,
|
|
|
|
|
@ -290,6 +295,24 @@ class _UpdateDeliveryNotesState extends State<UpdateDeliveryNotes> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _update({required BuildContext context, bool isSubmitted = false}) async {
|
|
|
|
|
if (!_formKey.currentState!.validate()) return;
|
|
|
|
|
if (formModel.deliveredDate == null) {
|
|
|
|
|
'Delivered Date Required'.addTranslation.showToast;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (formModel.deliveryNoteNumber == null) {
|
|
|
|
|
'Delivery Notes Required'.addTranslation.showToast;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (formModel.isPressureChecked == null || formModel.isPressureChecked == false) {
|
|
|
|
|
'Please acknowledge cylinders are tested for pressure'.addTranslation.showToast;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (formModel.isInspectedGasLeak == null || formModel.isInspectedGasLeak == false) {
|
|
|
|
|
'Please acknowledge cylinders have been inspected for leak test'.addTranslation.showToast;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
_formKey.currentState?.save();
|
|
|
|
|
formModel.gasDeliveredQuantityDtos = [];
|
|
|
|
|
formModel.isSubmitted = isSubmitted;
|
|
|
|
|
for (var item in formModel.deliveredItemList) {
|
|
|
|
|
@ -331,7 +354,7 @@ class _UpdateDeliveryNotesState extends State<UpdateDeliveryNotes> {
|
|
|
|
|
color: context.isDark ? Colors.white : AppColor.white936,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
),
|
|
|
|
|
'Req Qty ${model.requestedQuantity}'.bodyText2(context).custom(
|
|
|
|
|
'Req Qty ${model.requestedQuantity?.toStringAsFixed(0)}'.bodyText2(context).custom(
|
|
|
|
|
color: context.isDark ? Colors.white : AppColor.white936,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
),
|
|
|
|
|
@ -357,16 +380,32 @@ class _UpdateDeliveryNotesState extends State<UpdateDeliveryNotes> {
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
contentPadding: EdgeInsets.symmetric(horizontal: 5.toScreenWidth),
|
|
|
|
|
isDense: true,
|
|
|
|
|
contentPadding: EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 5.toScreenWidth,
|
|
|
|
|
vertical: 6, // keeps normal height ~30
|
|
|
|
|
),
|
|
|
|
|
filled: true,
|
|
|
|
|
fillColor: AppColor.fieldBgColor(context),
|
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
|
maxHeight: 30.toScreenHeight,
|
|
|
|
|
),
|
|
|
|
|
border: border,
|
|
|
|
|
enabledBorder: border,
|
|
|
|
|
focusedBorder: border,
|
|
|
|
|
errorStyle: const TextStyle(
|
|
|
|
|
height: 1.2, // controls extra height when error appears
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// decoration: InputDecoration(
|
|
|
|
|
// contentPadding: EdgeInsets.symmetric(horizontal: 5.toScreenWidth),
|
|
|
|
|
// filled: true,
|
|
|
|
|
// fillColor: AppColor.fieldBgColor(context),
|
|
|
|
|
// constraints: BoxConstraints(
|
|
|
|
|
// maxHeight: 40.toScreenHeight,
|
|
|
|
|
// ),
|
|
|
|
|
// border: border,
|
|
|
|
|
// enabledBorder: border,
|
|
|
|
|
// focusedBorder: border,
|
|
|
|
|
// ),
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
model.deliveredQuantity = int.tryParse(value);
|
|
|
|
|
},
|
|
|
|
|
@ -387,7 +426,7 @@ class _ItemRowLayout extends StatelessWidget {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(child: left), // Items column
|
|
|
|
|
SizedBox(
|
|
|
|
|
|