|
|
|
|
@ -77,9 +77,11 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
),
|
|
|
|
|
]);
|
|
|
|
|
model = results[0] as DeliveryInspectionFormModel;
|
|
|
|
|
setState(() {
|
|
|
|
|
isLoading = false;
|
|
|
|
|
});
|
|
|
|
|
if (mounted) {
|
|
|
|
|
setState(() {
|
|
|
|
|
isLoading = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -91,12 +93,6 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
|
// appBar: DefaultAppBar(
|
|
|
|
|
// title: 'Delivery Inspection'.addTranslation,
|
|
|
|
|
// onBackPress: () {
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
body: isLoading
|
|
|
|
|
? const CircularProgressIndicator(color: AppColor.primary10).center
|
|
|
|
|
: Form(
|
|
|
|
|
@ -104,51 +100,38 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
SingleChildScrollView(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
if (!viewOnly) ...[inspectionDetailsForm()] else ...[inspectionDetails()],
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
'Total Time'.addTranslation,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
formatInspectionDuration(model.totalTime),
|
|
|
|
|
style: AppTextStyles.bodyText2.copyWith(
|
|
|
|
|
color: context.isDark ? AppColor.neutral30 : AppColor.neutral120,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
// Text(
|
|
|
|
|
// model.totalTime != null ? '${model.totalTime.toString()} hours' : '-',
|
|
|
|
|
// style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
|
|
|
|
|
// ),
|
|
|
|
|
8.height,
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
Text(
|
|
|
|
|
"Lines",
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
linesList(context),
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context, borderRadius: 20, padding: 12))
|
|
|
|
|
.expanded,
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
if (!viewOnly) ...[inspectionDetailsForm()] else ...[inspectionDetails()],
|
|
|
|
|
20.height,
|
|
|
|
|
Text(
|
|
|
|
|
"Lines",
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
linesList(context),
|
|
|
|
|
],
|
|
|
|
|
)).expanded,
|
|
|
|
|
FooterActionButton.footerContainer(
|
|
|
|
|
context: context,
|
|
|
|
|
child: !viewOnly
|
|
|
|
|
? Column(
|
|
|
|
|
children: [
|
|
|
|
|
AppFilledButton(
|
|
|
|
|
buttonColor: AppColor.primary10,
|
|
|
|
|
label: 'Attachments'.addTranslation,
|
|
|
|
|
maxWidth: true,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
HelperFunction.attachmentTap(context: context, assetDeliveryProvider: assetDeliveryProvider!, deliveryTableItemId: widget.deliveryTableModel.id);
|
|
|
|
|
}),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
AppFilledButton(buttonColor: AppColor.primary10, label: 'Save'.addTranslation, maxWidth: true, onPressed: _saveTap).expanded,
|
|
|
|
|
8.width,
|
|
|
|
|
AppFilledButton(
|
|
|
|
|
buttonColor: AppColor.primary10,
|
|
|
|
|
label: 'Attachments'.addTranslation,
|
|
|
|
|
maxWidth: true,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
HelperFunction.attachmentTap(context: context, assetDeliveryProvider: assetDeliveryProvider!, deliveryTableItemId: widget.deliveryTableModel.id);
|
|
|
|
|
}).expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
16.height,
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
@ -247,6 +230,7 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
|
|
|
|
|
Widget inspectionDetailsForm() {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
_inspectionTile(
|
|
|
|
|
title: 'Inspected by'.addTranslation,
|
|
|
|
|
@ -264,7 +248,6 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
8.height,
|
|
|
|
|
_inspectionTile(
|
|
|
|
|
title: 'Approved by'.addTranslation,
|
|
|
|
|
@ -285,13 +268,13 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
if (widget.requestModel?.paymentTerm?.value == 2) ...[
|
|
|
|
|
8.height,
|
|
|
|
|
_inspectionTile(
|
|
|
|
|
title: 'Third Approved by'.addTranslation,
|
|
|
|
|
title: 'ThirdApprover'.addTranslation,
|
|
|
|
|
model: model.thirdApprovalModel,
|
|
|
|
|
isHmg: widget.requestModel?.isHMG == true,
|
|
|
|
|
onTap: () async {
|
|
|
|
|
final result = await showInspectionBottomSheet(
|
|
|
|
|
context,
|
|
|
|
|
title: 'Third Approved by'.addTranslation,
|
|
|
|
|
title: 'ThirdApprover'.addTranslation,
|
|
|
|
|
isHmg: widget.requestModel?.isHMG == true,
|
|
|
|
|
initialModel: model.thirdApprovalModel ?? InspectionPersonModel(),
|
|
|
|
|
);
|
|
|
|
|
@ -301,57 +284,6 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
// if (widget.requestModel?.isHMG == true) ...[
|
|
|
|
|
// OracleUserAutoCompleteField(
|
|
|
|
|
// clearAfterPick: false,
|
|
|
|
|
// initialValue: model.deliveryInspectionInspectedBy ?? '',
|
|
|
|
|
// label: 'Inspected by'.addTranslation,
|
|
|
|
|
// onPick: (value) {
|
|
|
|
|
// model.deliveryInspectionInspectedBy = value.fullName;
|
|
|
|
|
// setState(() {});
|
|
|
|
|
// },
|
|
|
|
|
// onChanged: (value) {},
|
|
|
|
|
// ),
|
|
|
|
|
// 8.height,
|
|
|
|
|
// OracleUserAutoCompleteField(
|
|
|
|
|
// clearAfterPick: false,
|
|
|
|
|
// initialValue: model.deliveryInspectionApprovedBy ?? '',
|
|
|
|
|
// label: 'Approved by'.addTranslation,
|
|
|
|
|
// onChanged: (value) {},
|
|
|
|
|
// onPick: (value) {
|
|
|
|
|
// model.deliveryInspectionApprovedBy = value.fullName;
|
|
|
|
|
// setState(() {});
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ] //No HMG user free text insted of dropdown ...
|
|
|
|
|
// else ...[
|
|
|
|
|
// AppTextFormField(
|
|
|
|
|
// labelText: 'Inspected by'.addTranslation,
|
|
|
|
|
// backgroundColor: AppColor.fieldBgColor(context),
|
|
|
|
|
// initialValue: model.deliveryInspectionInspectedBy ?? '',
|
|
|
|
|
// textAlign: TextAlign.center,
|
|
|
|
|
// labelStyle: AppTextStyles.textFieldLabelStyle,
|
|
|
|
|
// showShadow: false,
|
|
|
|
|
// onChange: (value) {
|
|
|
|
|
// model.deliveryInspectionInspectedBy = value;
|
|
|
|
|
// },
|
|
|
|
|
// style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
// ),
|
|
|
|
|
// 8.height,
|
|
|
|
|
// AppTextFormField(
|
|
|
|
|
// labelText: 'Approved by'.addTranslation,
|
|
|
|
|
// backgroundColor: AppColor.fieldBgColor(context),
|
|
|
|
|
// initialValue: model.deliveryInspectionApprovedBy ?? '',
|
|
|
|
|
// textAlign: TextAlign.center,
|
|
|
|
|
// labelStyle: AppTextStyles.textFieldLabelStyle,
|
|
|
|
|
// showShadow: false,
|
|
|
|
|
// onChange: (value) {
|
|
|
|
|
// model.deliveryInspectionApprovedBy = value;
|
|
|
|
|
// },
|
|
|
|
|
// style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
8.height,
|
|
|
|
|
ADatePicker(
|
|
|
|
|
label: 'Inspected Date/Time From'.addTranslation,
|
|
|
|
|
@ -385,7 +317,6 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
8.height,
|
|
|
|
|
ADatePicker(
|
|
|
|
|
label: 'Inspected Date/Time To'.addTranslation,
|
|
|
|
|
@ -424,8 +355,20 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
'Total Time'.addTranslation,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
formatInspectionDuration(model.totalTime),
|
|
|
|
|
style: AppTextStyles.bodyText2.copyWith(
|
|
|
|
|
color: context.isDark ? AppColor.neutral30 : AppColor.neutral120,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
).toShadowContainer(context, borderRadius: 20, padding: 12);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool _validateInspectionDates({DateTime? from, DateTime? to}) {
|
|
|
|
|
@ -552,8 +495,20 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
model.deliveryInspectionInspectedDateTo != null ? model.deliveryInspectionInspectedDateTo!.toString().toServiceRequestDetailsFormat : '-',
|
|
|
|
|
style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
'Total Time'.addTranslation,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
formatInspectionDuration(model.totalTime),
|
|
|
|
|
style: AppTextStyles.bodyText2.copyWith(
|
|
|
|
|
color: context.isDark ? AppColor.neutral30 : AppColor.neutral120,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
).toShadowContainer(context, borderRadius: 20, padding: 12);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _inspectionTile({
|
|
|
|
|
@ -603,24 +558,6 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<Lookup?> showAttachmentTypePicker() {
|
|
|
|
|
return showDialog<Lookup>(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (_) {
|
|
|
|
|
return AlertDialog(
|
|
|
|
|
content: SingleItemDropDownMenu<Lookup, AttachmentTypeLookupProvider>(
|
|
|
|
|
context: context,
|
|
|
|
|
title: context.translation.reason,
|
|
|
|
|
showAsFullScreenDialog: false,
|
|
|
|
|
onSelect: (value) {
|
|
|
|
|
Navigator.pop(context, value);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _cancelTap() async {
|
|
|
|
|
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
|
|
|
|
|
await assetDeliveryProvider!.changeDeliveryStatusToCancel(itemId: widget.deliveryTableModel.id).then((status) async {
|
|
|
|
|
@ -632,6 +569,19 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _saveTap() async {
|
|
|
|
|
_formKey.currentState!.save();
|
|
|
|
|
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
|
|
|
|
|
model.assetDeliveryExternalDeliveryId = widget.deliveryTableModel.id;
|
|
|
|
|
await assetDeliveryProvider!.saveMasterInfoDeliveryInspection(requestPayload: model.toJson()).then((status) async {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
if (status) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
await assetDeliveryProvider!.getAssetDeliveryTableListById(requestId: widget.requestModel?.id);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _nextTap() {
|
|
|
|
|
if (widget.deliveryTableModel.isContainsTechnicalInspection == true) {
|
|
|
|
|
// Navigator.push(
|
|
|
|
|
@ -678,8 +628,8 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
void _changeStatusTap() async {
|
|
|
|
|
_formKey.currentState!.save();
|
|
|
|
|
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
|
|
|
|
|
model.assetDeliveryExternalDeliveryId = widget.deliveryTableModel.id;
|
|
|
|
|
await assetDeliveryProvider!.changeDeliveryStatus(requestPayload: model.toJson()).then((status) async {
|
|
|
|
|
// await assetDeliveryProvider!.changeDeliveryStatus(requestPayload: model.toJson()).then((status) async {
|
|
|
|
|
await assetDeliveryProvider!.changeDeliveryStatus(itemId: widget.deliveryTableModel.id).then((status) async {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
if (status) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
@ -707,6 +657,7 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
return InspectionPersonBottomSheet(
|
|
|
|
|
title: title,
|
|
|
|
|
isHmg: isHmg,
|
|
|
|
|
tableId: widget.deliveryTableModel.id,
|
|
|
|
|
model: InspectionPersonModel(
|
|
|
|
|
name: initialModel.name,
|
|
|
|
|
email: initialModel.email,
|
|
|
|
|
|