|
|
|
|
@ -38,9 +38,7 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
GasRefillModel _model = GasRefillModel(gasRefillDetails: []);
|
|
|
|
|
late UserProvider _userProvider;
|
|
|
|
|
late GasRefillProvider gasRefillProvider;
|
|
|
|
|
final bool _isLoading = false;
|
|
|
|
|
|
|
|
|
|
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
|
|
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
|
List<File> _attachments = [];
|
|
|
|
|
|
|
|
|
|
@ -76,7 +74,7 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
child: informationCard(_model),
|
|
|
|
|
).expanded,
|
|
|
|
|
if (_userProvider.user!.type == UsersTypes.engineer && (_model.status!.value! != 2))//TODO need to ask backend for status of complete and cancelled request.
|
|
|
|
|
if (_userProvider.user!.type == UsersTypes.engineer && (_model.status!.value! != 2))
|
|
|
|
|
AppFilledButton(
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
await Navigator.of(context).push(MaterialPageRoute(builder: (_) => GasRefillForm(gasRefillModel: _model)));
|
|
|
|
|
@ -122,31 +120,53 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
context.translation.gasRefillRequest.heading5(context),
|
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
|
|
'${context.translation.gasType}: ${gasRefillModel.gasRefillDetails![0].gasType?.name}'.bodyText(context),
|
|
|
|
|
'${context.translation.cylinderType}: ${gasRefillModel.gasRefillDetails![0].cylinderType?.name}'.bodyText(context),
|
|
|
|
|
'${context.translation.cylinderSize}: ${gasRefillModel.gasRefillDetails![0].cylinderSize?.name}'.bodyText(context),
|
|
|
|
|
'${context.translation.site}: ${gasRefillModel.site?.name?.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context),
|
|
|
|
|
'${context.translation.department}: ${gasRefillModel.department?.name?.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context),
|
|
|
|
|
'${context.translation.requestNo}: ${gasRefillModel.gasRefillNo}'.bodyText(context),
|
|
|
|
|
// context.translation.gasRefillRequest.heading5(context),
|
|
|
|
|
Text(
|
|
|
|
|
"Request Details".addTranslation,
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
infoText(label: context.translation.requestNo, value:gasRefillModel.gasRefillNo),
|
|
|
|
|
infoText(label: context.translation.gasType, value:gasRefillModel.gasRefillDetails?[0].gasType?.name),
|
|
|
|
|
infoText(label: context.translation.cylinderType, value:gasRefillModel.gasRefillDetails?[0].cylinderType?.name),
|
|
|
|
|
infoText(label: context.translation.cylinderSize, value:gasRefillModel.gasRefillDetails?[0].cylinderSize?.name),
|
|
|
|
|
infoText(label: context.translation.site, value:gasRefillModel.site?.name?.cleanupWhitespace.capitalizeFirstOfEach),
|
|
|
|
|
infoText(label: context.translation.building, value:gasRefillModel.building?.name),
|
|
|
|
|
infoText(label: context.translation.floor, value:gasRefillModel.floor?.name),
|
|
|
|
|
infoText(label: context.translation.department, value:gasRefillModel.department?.name),
|
|
|
|
|
infoText(label: context.translation.requestedQuantity, value:gasRefillModel.gasRefillDetails?[0].requestedQty.toString()),
|
|
|
|
|
infoText(label: context.translation.deliveredQuantity, value:gasRefillModel.gasRefillDetails![0].deliverdQty.toString()),
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
Text(
|
|
|
|
|
"Created By".addTranslation,
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
infoText(label: context.translation.employeeId, value: gasRefillModel.employeeId),
|
|
|
|
|
infoText(label: context.translation.name, value: gasRefillModel.name),
|
|
|
|
|
infoText(label: context.translation.createdDate, value: gasRefillModel.createdDate?.toInitialVisitCardFormat),
|
|
|
|
|
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
'${context.translation.requestedQuantity}: ${gasRefillModel.gasRefillDetails![0].requestedQty ?? 0}'.bodyText(context),
|
|
|
|
|
'${context.translation.deliveredQuantity}: ${gasRefillModel.gasRefillDetails![0].deliverdQty ?? 0}'.bodyText(context),
|
|
|
|
|
8.height,
|
|
|
|
|
if (gasRefillModel.comment?.isNotEmpty ?? false) ...[
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
Text(
|
|
|
|
|
"Comments".addTranslation,
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
gasRefillModel.comment!.bodyText(context),
|
|
|
|
|
8.height,
|
|
|
|
|
],
|
|
|
|
|
if (gasRefillModel.techComment?.isNotEmpty ?? false) ...[
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
Text(
|
|
|
|
|
"Technical Comments".addTranslation,
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
gasRefillModel.techComment!.bodyText(context),
|
|
|
|
|
8.height,
|
|
|
|
|
],
|
|
|
|
|
if (_attachments.isNotEmpty) ...[
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
context.translation.attachments.bodyText(context),
|
|
|
|
|
Text(
|
|
|
|
|
"Attachments".addTranslation,
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
MultiFilesPicker(
|
|
|
|
|
label: context.translation.attachments,
|
|
|
|
|
@ -168,67 +188,7 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
|
|
|
|
|
).paddingOnly(top: 16, start: 16, end: 16),
|
|
|
|
|
|
|
|
|
|
/// TBD
|
|
|
|
|
// (_userProvider.user!.type == UsersTypes.normal_user
|
|
|
|
|
// ? Container(
|
|
|
|
|
// height: 50,
|
|
|
|
|
// padding: const EdgeInsets.only(left: 16, right: 16),
|
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
|
// width: double.infinity,
|
|
|
|
|
// decoration: ShapeDecoration(
|
|
|
|
|
// color: context.isDark ? AppColor.neutral50 : AppColor.neutral30,
|
|
|
|
|
// shape: const RoundedRectangleBorder(
|
|
|
|
|
// borderRadius: BorderRadius.only(
|
|
|
|
|
// bottomLeft: Radius.circular(14),
|
|
|
|
|
// bottomRight: Radius.circular(14),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// child: Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// Text(
|
|
|
|
|
// '${context.translation.commentHere}...',
|
|
|
|
|
// style: AppTextStyles.heading6.copyWith(
|
|
|
|
|
// color: (context.isDark ? AppColor.neutral30 : AppColor.neutral50).withOpacity(.6),
|
|
|
|
|
// ),
|
|
|
|
|
// ).expanded,
|
|
|
|
|
// "comment_send".toSvgAsset(width: 24, color: context.isDark ? AppColor.primary50 : AppColor.primary70),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// )
|
|
|
|
|
// : Column(
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// const Divider().defaultStyle(context),
|
|
|
|
|
// 8.height,
|
|
|
|
|
// Row(
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
// children: [
|
|
|
|
|
// Text(
|
|
|
|
|
// context.translation.viewComments,
|
|
|
|
|
// style: AppTextStyles.bodyText.copyWith(color: AppColor.blueStatus(context)),
|
|
|
|
|
// ),
|
|
|
|
|
// 4.width,
|
|
|
|
|
// Icon(
|
|
|
|
|
// Icons.arrow_forward,
|
|
|
|
|
// color: AppColor.blueStatus(context),
|
|
|
|
|
// size: 14,
|
|
|
|
|
// )
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ).paddingOnly(bottom: 16, start: 16, end: 16))
|
|
|
|
|
// .onPress(() {
|
|
|
|
|
// showModalBottomSheet(
|
|
|
|
|
// context: context,
|
|
|
|
|
// useSafeArea: true,
|
|
|
|
|
// isScrollControlled: true,
|
|
|
|
|
// useRootNavigator: true,
|
|
|
|
|
// backgroundColor: Colors.transparent,
|
|
|
|
|
// builder: (context) => GasRefillCommentsBottomSheet(requestId: gasRefillModel.id.toString()),
|
|
|
|
|
// );
|
|
|
|
|
// }),
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context, padding: 0);
|
|
|
|
|
}
|
|
|
|
|
@ -237,7 +197,7 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
String? label,
|
|
|
|
|
String? value,
|
|
|
|
|
}) {
|
|
|
|
|
if (value == null || value.isEmpty) {
|
|
|
|
|
if (value == null || value.isEmpty||value.toLowerCase()=='null') {
|
|
|
|
|
return const SizedBox();
|
|
|
|
|
} else {
|
|
|
|
|
return '$label: $value'.bodyText(context);
|
|
|
|
|
|