|
|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
import 'dart:convert';
|
|
|
|
|
import 'dart:developer';
|
|
|
|
|
import 'package:date_picker_timeline/extra/color.dart';
|
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
@ -32,6 +33,8 @@ import 'package:test_sa/views/widgets/date_and_time/time_picker.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart';
|
|
|
|
|
import 'package:test_sa/new_views/swipe_module/dialoge/acknowledge_work_dialog.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/date_and_time/date_picker.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/item_views/info_header_widget.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/item_views/info_text_widget.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
|
|
|
|
|
import '../../../../new_views/common_widgets/app_filled_button.dart';
|
|
|
|
|
|
|
|
|
|
@ -103,17 +106,13 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
SingleChildScrollView(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
spacing: 12,
|
|
|
|
|
children: [
|
|
|
|
|
if (!viewOnly) ...[inspectionDetailsForm()] else ...[inspectionDetails()],
|
|
|
|
|
20.height,
|
|
|
|
|
Text(
|
|
|
|
|
"Lines",
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
InfoHeader16Widget("Lines"),
|
|
|
|
|
linesList(context),
|
|
|
|
|
],
|
|
|
|
|
)).expanded,
|
|
|
|
|
@ -183,7 +182,7 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
? const NoDataFound().center
|
|
|
|
|
: ListView.separated(
|
|
|
|
|
itemCount: linesList.length,
|
|
|
|
|
separatorBuilder: (_, __) => 8.height,
|
|
|
|
|
separatorBuilder: (_, __) => 12.height,
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
@ -234,6 +233,7 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
Widget inspectionDetailsForm() {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
spacing: 12,
|
|
|
|
|
children: [
|
|
|
|
|
_inspectionTile(
|
|
|
|
|
title: 'Inspected by'.addTranslation,
|
|
|
|
|
@ -251,7 +251,6 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
_inspectionTile(
|
|
|
|
|
title: 'Approved by'.addTranslation,
|
|
|
|
|
model: model.approvedByModel,
|
|
|
|
|
@ -269,7 +268,6 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
if (widget.requestModel?.paymentTerm?.value == 2) ...[
|
|
|
|
|
8.height,
|
|
|
|
|
_inspectionTile(
|
|
|
|
|
title: 'ThirdApprover'.addTranslation,
|
|
|
|
|
model: model.thirdApprovalModel,
|
|
|
|
|
@ -287,7 +285,6 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
8.height,
|
|
|
|
|
ADatePicker(
|
|
|
|
|
label: 'Inspected Date/Time From'.addTranslation,
|
|
|
|
|
hideShadow: true,
|
|
|
|
|
@ -314,12 +311,10 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
if (!_validateInspectionDates(from: fromDateTime, to: model.deliveryInspectionInspectedDateTo)) {
|
|
|
|
|
return; // invalid, do not assign
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model.deliveryInspectionInspectedDateFrom = fromDateTime;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
ADatePicker(
|
|
|
|
|
label: 'Inspected Date/Time To'.addTranslation,
|
|
|
|
|
hideShadow: true,
|
|
|
|
|
@ -356,18 +351,7 @@ 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,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
InfoTextWidget(label: 'Total Time'.addTranslation, value: formatInspectionDuration(model.totalTime)),
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context, borderRadius: 20, padding: 12);
|
|
|
|
|
}
|
|
|
|
|
@ -421,64 +405,18 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
return '${hours.toStringAsFixed(2)} hours';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget inspectionDetails() {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
spacing: 4,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
'Inspected by'.addTranslation,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
model.deliveryInspectionInspectedBy ?? '-',
|
|
|
|
|
style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
'Approved by'.addTranslation,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
model.deliveryInspectionApprovedBy ?? '-',
|
|
|
|
|
style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
'Inspected Date/Time From'.addTranslation,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
model.deliveryInspectionInspectedDateFrom != null ? model.deliveryInspectionInspectedDateFrom!.toString().toServiceRequestDetailsFormat : '-',
|
|
|
|
|
style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
'Inspected Date/Time To'.addTranslation,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
InfoTextWidget(label: "Inspected by", value: "\n${model.deliveryInspectionInspectedBy ?? '-'}"),
|
|
|
|
|
InfoTextWidget(label: "Approved by", value: "\n${model.deliveryInspectionApprovedBy ?? '-'}"),
|
|
|
|
|
InfoTextWidget(label: 'Inspected Date/Time From'.addTranslation, value: "\n${model.deliveryInspectionInspectedDateFrom?.toString().toServiceRequestDetailsFormat ?? '-'}"),
|
|
|
|
|
InfoTextWidget(label: 'Inspected Date/Time To'.addTranslation, value: "\n${model.deliveryInspectionInspectedDateTo?.toString().toServiceRequestDetailsFormat ?? '-'}"),
|
|
|
|
|
InfoTextWidget(label: 'Total Time'.addTranslation, value: "\n${formatInspectionDuration(model.totalTime) ?? '-'}"),
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context, borderRadius: 20, padding: 12);
|
|
|
|
|
).toShadowContainer(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _inspectionTile({
|
|
|
|
|
@ -493,8 +431,9 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: const EdgeInsets.all(12),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: AppColor.fieldBgColor(context),
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
color: AppColor.background(context),
|
|
|
|
|
border: Border.all(color: AppColor.border2Color(context), width: 1),
|
|
|
|
|
borderRadius: BorderRadius.circular(16),
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
@ -502,25 +441,9 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Text(title, style: AppTextStyles.textFieldLabelStyle),
|
|
|
|
|
6.height,
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
model?.name?.isNotEmpty == true ? model!.name! : 'Tap to add'.addTranslation,
|
|
|
|
|
style: AppTextStyles.bodyText,
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
///Need to display other info as well
|
|
|
|
|
// Text(
|
|
|
|
|
// model?.email?.isNotEmpty == true
|
|
|
|
|
// ? model!.email!
|
|
|
|
|
// : '',
|
|
|
|
|
// style: AppTextStyles.bodyText,
|
|
|
|
|
// ),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
InfoTextLabelWidget(label: title, textStyle: AppTextStyles.textFieldLabelStyle),
|
|
|
|
|
4.height,
|
|
|
|
|
InfoTextLabelWidget(label: model?.name?.isNotEmpty == true ? model!.name! : 'Tap to add'.addTranslation, textStyle: AppTextStyles.bodyText),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -630,6 +553,7 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
|
|
|
|
|
return showModalBottomSheet<InspectionPersonModel>(
|
|
|
|
|
context: context,
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
backgroundColor: AppColor.bottomSheetColor(context),
|
|
|
|
|
shape: const RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
|
|
|
|
),
|
|
|
|
|
|