medical gas ui added.

design_3.0_medical_gas_inspection
Sikander Saleem 1 month ago
parent d765bf0b83
commit 86f96a8f62

@ -93,6 +93,7 @@ class _UpdateEquipmentInternalAuditPageState extends State<UpdateEquipmentIntern
_onSubmit(BuildContext context) async { _onSubmit(BuildContext context) async {
bool isTimerPickerEnable = ApiManager.instance.assetGroup?.enabledEngineerTimer ?? false; bool isTimerPickerEnable = ApiManager.instance.assetGroup?.enabledEngineerTimer ?? false;
/// Need to refactor this code when timer requirements clear keep picker or both. /// Need to refactor this code when timer requirements clear keep picker or both.
// formModel.auditTimers ??= []; // formModel.auditTimers ??= [];
// if (formModel.auditTimePicker != null) { // if (formModel.auditTimePicker != null) {
@ -118,7 +119,7 @@ class _UpdateEquipmentInternalAuditPageState extends State<UpdateEquipmentIntern
// ); // );
// }); // });
InternalAuditProvider provider = Provider.of<InternalAuditProvider>(context, listen: false); InternalAuditProvider provider = Provider.of<InternalAuditProvider>(context, listen: false);
if ( formModel.startTime == null) { if (formModel.startTime == null) {
Fluttertoast.showToast(msg: "Working Hours Required"); Fluttertoast.showToast(msg: "Working Hours Required");
return; return;
} }
@ -138,12 +139,12 @@ class _UpdateEquipmentInternalAuditPageState extends State<UpdateEquipmentIntern
final success = await provider.updateEquipmentInternalAudit(model: formModel); final success = await provider.updateEquipmentInternalAudit(model: formModel);
Navigator.pop(context); Navigator.pop(context);
// if (formModel.isComplete == true) { // if (formModel.isComplete == true) {
if (success) { if (success) {
Navigator.of(context).pop(true); Navigator.of(context).pop(true);
} else { } else {
Fluttertoast.showToast(msg: 'Failed to update'); Fluttertoast.showToast(msg: 'Failed to update');
} }
//Navigate to List screen. //Navigate to List screen.
// } else if (formModel.isComplete == false) { // } else if (formModel.isComplete == false) {
// //Navigate to Detail screen. // //Navigate to Detail screen.
// if (success) { // if (success) {

@ -19,6 +19,7 @@ import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/models/new_models/site.dart'; import 'package:test_sa/models/new_models/site.dart';
import 'package:test_sa/models/new_models/task_request/task_type_model.dart'; import 'package:test_sa/models/new_models/task_request/task_type_model.dart';
import 'package:test_sa/models/new_models/work_order_detail_model.dart'; import 'package:test_sa/models/new_models/work_order_detail_model.dart';
import 'package:test_sa/models/service_request/supplier_details.dart';
import 'package:test_sa/modules/cm_module/cm_request_utils.dart'; import 'package:test_sa/modules/cm_module/cm_request_utils.dart';
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart'; import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
import 'package:test_sa/modules/loan_module/models/loan_form_model.dart'; import 'package:test_sa/modules/loan_module/models/loan_form_model.dart';
@ -34,8 +35,10 @@ import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart
import 'package:test_sa/providers/department_provider.dart'; import 'package:test_sa/providers/department_provider.dart';
import 'package:test_sa/providers/gas_request_providers/site_provider.dart'; import 'package:test_sa/providers/gas_request_providers/site_provider.dart';
import 'package:test_sa/providers/loading_list_notifier.dart'; import 'package:test_sa/providers/loading_list_notifier.dart';
import 'package:test_sa/providers/work_order/vendor_provider.dart';
import 'package:test_sa/views/widgets/images/multi_image_picker.dart'; import 'package:test_sa/views/widgets/images/multi_image_picker.dart';
import '../../../../../../new_views/common_widgets/default_app_bar.dart'; import '../../../../../../new_views/common_widgets/default_app_bar.dart';
import 'medical_gas_inspection_detail_page.dart';
class CreateMedicalGasRequestPage extends StatefulWidget { class CreateMedicalGasRequestPage extends StatefulWidget {
static const String id = "/create-medical-gas"; static const String id = "/create-medical-gas";
@ -55,7 +58,7 @@ class _CreateMedicalGasRequestPageState extends State<CreateMedicalGasRequestPag
TextEditingController commentController = TextEditingController(); TextEditingController commentController = TextEditingController();
// bool get isBackUpRequest => widget.workOrderId != null; SupplierDetails? supplier;
// List<Lookup> loanTypes = []; // List<Lookup> loanTypes = [];
@ -84,7 +87,11 @@ class _CreateMedicalGasRequestPageState extends State<CreateMedicalGasRequestPag
children: [ children: [
SingleItemDropDownMenu<Lookup, NullableLoadingProvider>( SingleItemDropDownMenu<Lookup, NullableLoadingProvider>(
context: context, context: context,
title: "Loan Type", title: "Order Type",
validator: (value) {
if (value == null) return "Mandatory";
return null;
},
enabled: false, enabled: false,
staticData: [], staticData: [],
initialValue: null, initialValue: null,
@ -93,15 +100,77 @@ class _CreateMedicalGasRequestPageState extends State<CreateMedicalGasRequestPag
showAsBottomSheet: true, showAsBottomSheet: true,
onSelect: (value) {}, onSelect: (value) {},
), ),
// 16.height, 8.height,
SingleItemDropDownMenu<Lookup, NullableLoadingProvider>(
// ...contactInfoSection(), context: context,
// 16.height, title: "Item Type",
...itemDetailsSection(), validator: (value) {
16.height, if (value == null) return "Mandatory";
...doctorInfoSection(), return null;
16.height, },
...vendorDetailsSection(), enabled: false,
staticData: [],
initialValue: null,
showShadow: false,
backgroundColor: AppColor.fieldBgColor(context),
showAsBottomSheet: true,
onSelect: (value) {},
),
8.height,
SingleItemDropDownMenu<Site, SiteProvider>(
context: context,
title: context.translation.site,
initialValue: _loanFormModel.site,
showShadow: false,
validator: (value) {
if (value == null) return "Please select a site";
return null;
},
backgroundColor: AppColor.fieldBgColor(context),
showAsBottomSheet: true,
onSelect: (value) {
_loanFormModel.site = value;
setState(() {});
},
),
8.height,
SingleItemDropDownMenu<MedicalDepartmentModel, MedicalDepartmentProvider>(
context: context,
title: context.translation.department,
showShadow: false,
validator: (value) {
if (value == null) return "Please select a department";
return null;
},
showAsBottomSheet: true,
initialValue: _loanFormModel.department,
requestById: context.userProvider.user?.clientId,
backgroundColor: AppColor.fieldBgColor(context),
onSelect: (value) {
_loanFormModel.department = value;
setState(() {});
},
),
8.height,
SingleItemDropDownMenu<SupplierDetails, VendorProvider>(
context: context,
title: context.translation.supplier,
backgroundColor: AppColor.fieldBgColor(context),
initialValue: supplier,
showAsBottomSheet: true,
showShadow: false,
showCancel: true,
onSelect: (_supplier) {
supplier = _supplier;
setState(() {});
},
),
8.height,
if (supplier != null) ...[
'Name: ${supplier?.name ?? "-"}'.addTranslation.bodyText(context).custom(color: AppColor.black10),
'Email: ${supplier?.email ?? "-"}'.addTranslation.bodyText(context).custom(color: AppColor.black10),
'Contact: ${supplier?.contact ?? "-"}'.addTranslation.bodyText(context).custom(color: AppColor.black10),
],
16.height, 16.height,
AttachmentPicker( AttachmentPicker(
label: context.translation.attachments, label: context.translation.attachments,
@ -133,293 +202,8 @@ class _CreateMedicalGasRequestPageState extends State<CreateMedicalGasRequestPag
); );
} }
List<Widget> doctorInfoSection() {
return [
context.translation.contactInfo.bodyText(context).custom(color: AppColor.black10),
8.height,
AppTextFormField(
initialValue: "",
labelText: "Doctor Name",
validator: (value) {
if ((value ?? "").isEmpty) return "Mandatory";
return null;
},
style: Theme.of(context).textTheme.titleMedium,
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
showShadow: false,
textInputType: TextInputType.text,
onChange: (value) {
_loanFormModel.docName = value;
},
),
8.height,
AppTextFormField(
initialValue: "",
labelText: "Doctor Number",
validator: (value) {
if ((value ?? "").isEmpty) return "Mandatory";
return null;
},
style: Theme.of(context).textTheme.titleMedium,
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
showShadow: false,
textInputType: TextInputType.phone,
onChange: (value) {
_loanFormModel.docNumber = value;
},
),
8.height,
AppTextFormField(
initialValue: "",
labelText: "Doctor Email",
validator: (value) {
if ((value ?? "").isEmpty) {
return "Mandatory";
} else {
return Validator.isEmail(value!) ? null : context.translation.emailValidateMessage;
}
},
style: Theme.of(context).textTheme.titleMedium,
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
showShadow: false,
textInputType: TextInputType.emailAddress,
onChange: (value) {
_loanFormModel.docEmail = value;
},
),
];
}
List<Widget> itemDetailsSection() {
return [
'Item Details'.addTranslation.bodyText(context).custom(color: AppColor.black10),
8.height,
SingleItemDropDownMenu<Site, SiteProvider>(
context: context,
title: context.translation.site,
initialValue: _loanFormModel.site,
showShadow: false,
validator: (value) {
if (value == null) return "Please select a site";
return null;
},
backgroundColor: AppColor.fieldBgColor(context),
showAsBottomSheet: true,
onSelect: (value) {
_loanFormModel.site = value;
setState(() {});
},
),
8.height,
SingleItemDropDownMenu<MedicalDepartmentModel, MedicalDepartmentProvider>(
context: context,
title: context.translation.department,
showShadow: false,
validator: (value) {
if (value == null) return "Please select a department";
return null;
},
showAsBottomSheet: true,
initialValue: _loanFormModel.department,
requestById: context.userProvider.user?.clientId,
backgroundColor: AppColor.fieldBgColor(context),
onSelect: (value) {
_loanFormModel.department = value;
setState(() {});
},
),
8.height,
AppTextFormField(
labelText: "Item Description",
validator: (value) {
if ((value ?? "").isEmpty) return "Mandatory";
return null;
},
style: Theme.of(context).textTheme.titleMedium,
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
floatingLabelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
showShadow: false,
textInputType: TextInputType.text,
textInputAction: TextInputAction.next,
onChange: (value) {
_loanFormModel.itemDescription = value;
},
),
8.height,
Row(
children: [
"help-circle".toSvgAsset(height: 16, width: 16),
8.width,
Text(
"Specify the purpose of the loan (e.g., equipment needed for a scheduled procedure or patient case)",
style: AppTextStyles.tinyFont2.copyWith(fontWeight: FontWeight.w400, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)),
).expanded,
],
),
8.height,
AppTextFormField(
labelText: "Request Description",
validator: (value) {
if ((value ?? "").isEmpty) return "Mandatory";
return null;
},
style: Theme.of(context).textTheme.titleMedium,
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
floatingLabelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
showShadow: false,
textInputType: TextInputType.text,
textInputAction: TextInputAction.next,
onChange: (value) {
_loanFormModel.requestDescription = value;
},
),
8.height,
AppTextFormField(
labelText: "Model",
validator: (value) {
if ((value ?? "").isEmpty) return "Mandatory";
return null;
},
style: Theme.of(context).textTheme.titleMedium,
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
floatingLabelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
showShadow: false,
textInputType: TextInputType.text,
textInputAction: TextInputAction.next,
onChange: (value) {
_loanFormModel.model = value;
},
),
8.height,
AppTextFormField(
labelText: "Manufacturer",
validator: (value) {
if ((value ?? "").isEmpty) return "Mandatory";
return null;
},
style: Theme.of(context).textTheme.titleMedium,
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
floatingLabelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
showShadow: false,
textInputType: TextInputType.text,
textInputAction: TextInputAction.next,
onChange: (value) {
_loanFormModel.manufacturer = value;
},
),
8.height,
SingleItemDropDownMenu<Lookup, LoanPeriodProvider>(
context: context,
height: 56.toScreenHeight,
title: 'Loan Period'.addTranslation,
showShadow: false,
validator: (value) {
if (value == null) return "Please select loan period";
return null;
},
backgroundColor: AppColor.fieldBgColor(context),
showAsBottomSheet: true,
initialValue: _loanFormModel.loanProvided,
onSelect: (status) {
if (status != null) {
_loanFormModel.loanProvided = status;
setState(() {});
}
},
),
8.height,
];
}
List<Widget> vendorDetailsSection() {
return [
'Vendor Details'.addTranslation.bodyText(context).custom(color: AppColor.black10),
8.height,
AppTextFormField(
initialValue: "",
labelText: "Vendor Name",
validator: (value) {
if ((value ?? "").isEmpty) return "Mandatory";
return null;
},
style: Theme.of(context).textTheme.titleMedium,
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
showShadow: false,
textInputType: TextInputType.name,
textInputAction: TextInputAction.next,
onChange: (value) {
_loanFormModel.vendorName = value;
},
),
8.height,
AppTextFormField(
initialValue: "",
labelText: "Vendor Representative Name",
validator: (value) {
if ((value ?? "").isEmpty) return "Mandatory";
return null;
},
style: Theme.of(context).textTheme.titleMedium,
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
showShadow: false,
textInputType: TextInputType.name,
textInputAction: TextInputAction.next,
onChange: (value) {
_loanFormModel.vendorRepresentativeName = value;
},
),
8.height,
AppTextFormField(
initialValue: "",
labelText: "Vendor Number",
validator: (value) {
if ((value ?? "").isEmpty) return "Mandatory";
return null;
},
style: Theme.of(context).textTheme.titleMedium,
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
showShadow: false,
textInputType: TextInputType.phone,
textInputAction: TextInputAction.next,
onChange: (value) {
_loanFormModel.vendorNumber = value;
},
),
8.height,
AppTextFormField(
initialValue: "",
labelText: "Vendor Email",
validator: (value) {
if ((value ?? "").isEmpty) {
return "Mandatory";
} else {
return Validator.isEmail(value!) ? null : context.translation.emailValidateMessage;
}
},
style: Theme.of(context).textTheme.titleMedium,
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
showShadow: false,
textInputType: TextInputType.emailAddress,
textInputAction: TextInputAction.next,
onChange: (value) {
_loanFormModel.vendorEmail = value;
},
),
];
}
Future<void> _submit() async { Future<void> _submit() async {
Navigator.of(context).push(MaterialPageRoute(builder: (_) => MedicalGasInspectionDetailPage(inspectionId: 0)));
return; return;
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
if (_formKey.currentState!.validate()) { if (_formKey.currentState!.validate()) {

@ -0,0 +1,143 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/string_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
import 'package:test_sa/modules/internal_audit_module/models/internal_audit_attachment_model.dart';
import 'package:test_sa/modules/internal_audit_module/models/system_internal_audit_data_model.dart';
import 'package:test_sa/modules/internal_audit_module/pages/equipment_internal_audit/update_equipment_internal_audit_page.dart';
import 'package:test_sa/modules/internal_audit_module/pages/system_internal_audit/update_system_internal_audit_page.dart';
import 'package:test_sa/modules/internal_audit_module/provider/internal_audit_provider.dart';
import 'package:test_sa/modules/loan_module/models/loan_attachment_model.dart';
import 'package:test_sa/modules/loan_module/models/loan_request_model.dart';
import 'package:test_sa/modules/loan_module/provider/loan_provider.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
import 'package:test_sa/views/widgets/images/files_list.dart';
import 'package:test_sa/views/widgets/loaders/app_loading.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
import 'package:test_sa/views/widgets/requests/request_status.dart';
import 'update_medical_gas_inspection_page.dart';
class MedicalGasInspectionDetailPage extends StatelessWidget {
static const String id = "/medical-gas-inspection-detail-page";
final int inspectionId;
MedicalGasInspectionDetailPage({Key? key, required this.inspectionId}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: const DefaultAppBar(title: "Request Details"),
body: SafeArea(
child: FutureBuilder<LoanRequestModel?>(
future: Provider.of<LoanProvider>(context, listen: false).getLoanById(0),
builder: (BuildContext context, AsyncSnapshot<LoanRequestModel?> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) return const CircularProgressIndicator(color: AppColor.primary10).center;
// if (snapshot.data == null) return const NoDataFound().center;
//
List<LoanAttachmentModel> allAttachments = snapshot.data?.loanAttachments ?? [];
return Column(
children: [
ListView(
padding: const EdgeInsets.all(16),
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Row(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// StatusLabel(
// label: snapshot.data!.loanStatusName!,
// textColor: AppColor.getRequestStatusTextColorByName(context, snapshot.data!.loanStatusName!),
// backgroundColor: AppColor.getRequestStatusColorByName(context, snapshot.data!.loanStatusName!),
// ),
// 1.width.expanded,
// Text(
// snapshot.data!.createdDate?.toServiceRequestCardFormat ?? "-",
// textAlign: TextAlign.end,
// style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
// ),
// ],
// ),
Text("Request Details", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
'${context.translation.requestNo}: ${"model?.requestNo" ?? '-'}'.bodyText(context),
'Order Type: ${"model?.Order Type" ?? '-'}'.bodyText(context),
'Item Type: ${"model?.Item Type" ?? '-'}'.bodyText(context),
'Site: ${"model?.Site" ?? '-'}'.bodyText(context),
'Cylinders: ${"model?.Cylinders" ?? '-'}'.bodyText(context),
'LOX: ${"model?.LOX" ?? '-'}'.bodyText(context),
'Supplier Name: ${"model?.Supplier Name" ?? '-'}'.bodyText(context),
'Supplier Contact: ${"model?.Supplier Contact" ?? '-'}'.bodyText(context),
'Supplier Email: ${"model?.Supplier Email" ?? '-'}'.bodyText(context),
if (allAttachments.isNotEmpty) ...[
const Divider().defaultStyle(context),
Text(
"Attachments".addTranslation,
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
FilesList(images: allAttachments.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []),
],
],
).toShadowContainer(context, padding: 12),
],
).expanded,
if (context.userProvider.isEngineer)
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(
buttonColor: AppColor.primary10,
label: "Upload Delivery Note",
onPressed: () async {
Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateMedicalGasInspectionPage(inspectionId: 0)));
}),
),
],
);
}),
));
}
Widget labelValueText(BuildContext context, String label, String? value) {
if (value == null || value.isEmpty) return const SizedBox.shrink();
return Padding(
padding: const EdgeInsets.only(bottom: 4),
child: Text(
'$label: $value',
style: AppTextStyles.bodyText.copyWith(
color: context.isDark ? AppColor.neutral30 : AppColor.neutral120,
),
),
);
}
Widget checklistWidget(BuildContext context, {required String value}) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Checkbox(
value: true,
activeColor: AppColor.neutral120,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
visualDensity: const VisualDensity(horizontal: -4, vertical: -3),
onChanged: (value) {},
),
value.bodyText(context),
],
);
}
}

@ -0,0 +1,308 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/string_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/generic_attachment_model.dart';
import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
import 'package:test_sa/modules/internal_audit_module/models/internal_audit_attachment_model.dart';
import 'package:test_sa/modules/internal_audit_module/models/system_internal_audit_data_model.dart';
import 'package:test_sa/modules/internal_audit_module/pages/equipment_internal_audit/update_equipment_internal_audit_page.dart';
import 'package:test_sa/modules/internal_audit_module/pages/system_internal_audit/update_system_internal_audit_page.dart';
import 'package:test_sa/modules/internal_audit_module/provider/internal_audit_provider.dart';
import 'package:test_sa/modules/loan_module/models/loan_attachment_model.dart';
import 'package:test_sa/modules/loan_module/models/loan_request_model.dart';
import 'package:test_sa/modules/loan_module/provider/loan_provider.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
import 'package:test_sa/new_views/common_widgets/multiple_item_drop_down_menu.dart';
import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart';
import 'package:test_sa/providers/loading_list_notifier.dart';
import 'package:test_sa/views/widgets/date_and_time/date_picker.dart';
import 'package:test_sa/views/widgets/images/files_list.dart';
import 'package:test_sa/views/widgets/images/multi_image_picker.dart';
import 'package:test_sa/views/widgets/loaders/app_loading.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
import 'package:test_sa/views/widgets/requests/request_status.dart';
class UpdateMedicalGasInspectionPage extends StatefulWidget {
final int inspectionId;
UpdateMedicalGasInspectionPage({Key? key, required this.inspectionId}) : super(key: key);
@override
_UpdateMedicalGasInspectionPageState createState() {
return _UpdateMedicalGasInspectionPageState();
}
}
class _UpdateMedicalGasInspectionPageState extends State<UpdateMedicalGasInspectionPage> {
List<GenericAttachmentModel> _attachments = [];
bool pressureTestAcknowledgement = false;
bool leakTestAcknowledgement = false;
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: DefaultAppBar(
title: "Upload Delivery Note",
onWillPopScope: () {
_onUpdate(context);
},
),
body: SafeArea(
child: FutureBuilder<LoanRequestModel?>(
future: Provider.of<LoanProvider>(context, listen: false).getLoanById(0),
builder: (BuildContext context, AsyncSnapshot<LoanRequestModel?> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) return const CircularProgressIndicator(color: AppColor.primary10).center;
// if (snapshot.data == null) return const NoDataFound().center;
//
// List<LoanAttachmentModel> allAttachments = snapshot.data!.loanAttachments!;
return Column(
children: [
ListView(
padding: const EdgeInsets.all(16),
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Row(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// StatusLabel(
// label: snapshot.data!.loanStatusName!,
// textColor: AppColor.getRequestStatusTextColorByName(context, snapshot.data!.loanStatusName!),
// backgroundColor: AppColor.getRequestStatusColorByName(context, snapshot.data!.loanStatusName!),
// ),
// 1.width.expanded,
// Text(
// snapshot.data!.createdDate?.toServiceRequestCardFormat ?? "-",
// textAlign: TextAlign.end,
// style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
// ),
// ],
// ),
MultipleItemDropDownMenu<Lookup, NullableLoadingProvider>(
context: context,
showAsBottomSheet: true,
backgroundColor: AppColor.neutral100,
showShadow: false,
showCancel: true,
requestById: context.userProvider.user?.clientId,
title: 'Delivered Items'.addTranslation,
// initialValue: _equipmentinternalAuditModel.findings,
onSelect: (value) {
// if ((value ?? []).isNotEmpty) {
// Lookup? noFindingElement;
// try {
// noFindingElement = value!.singleWhere((element) => element.value == noFindingValue);
// } catch (ex) {}
// if (noFindingElement != null) {
// value!.removeWhere((element) => element.value != noFindingElement!.value);
// }
// }
// _equipmentinternalAuditModel.findings = value ?? [];
},
),
16.height,
ADatePicker(
label: "EDD",
hideShadow: true,
backgroundColor: AppColor.fieldBgColor(context),
// initialDate: DateTime.tryParse(updateAssetModel?.edd ?? ""),
from: DateTime.now().subtract(const Duration(days: 365 * 3)),
to: DateTime.now(),
// date: DateTime.now(),
formatDateWithTime: true,
onDatePicker: (selectedDate) {
showTimePicker(
context: context,
initialTime: TimeOfDay.now(),
).then((selectedTime) {
// Handle the selected date and time here.
if (selectedTime != null) {
DateTime? selectedDateTime = DateTime(
selectedDate.year,
selectedDate.month,
selectedDate.day,
selectedTime.hour,
selectedTime.minute,
);
// if (updateAssetModel?.edd != null &&
// selectedDateTime.isBefore(DateTime.parse(updateAssetModel!.edd!))) {
// "Return To Service Date time must be greater then previous date".showToast;
// return;
// }
}
});
},
),
16.height,
SingleItemDropDownMenu<Lookup, NullableLoadingProvider>(
context: context,
title: "PO Number",
validator: (value) {
if (value == null) return "Mandatory";
return null;
},
enabled: false,
staticData: [],
initialValue: null,
showShadow: false,
backgroundColor: AppColor.fieldBgColor(context),
showAsBottomSheet: true,
onSelect: (value) {},
),
16.height,
AppTextFormField(
initialValue: "",
labelText: "Delivery Notes",
validator: (value) {
if ((value ?? "").isEmpty) return "Mandatory";
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) {
// trafRequest?.purposeAnswer = value;
},
),
16.height,
AttachmentPicker(
label: 'Upload Attachment',
attachment: _attachments,
buttonColor: AppColor.primary10,
showAsListView: true,
onlyImages: false,
buttonIcon: 'attachment_icon'.toSvgAsset(
color: AppColor.primary10,
),
),
16.height,
Row(
children: [
Checkbox(
value: pressureTestAcknowledgement,
visualDensity: const VisualDensity(horizontal: -4.0, vertical: -4.0),
activeColor: AppColor.blueStatus(context),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onChanged: (value) {
setState(() {
pressureTestAcknowledgement = 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: leakTestAcknowledgement,
visualDensity: const VisualDensity(horizontal: -4.0, vertical: -4.0),
activeColor: AppColor.blueStatus(context),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onChanged: (value) {
setState(() {
leakTestAcknowledgement = 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,
if (context.userProvider.isEngineer)
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(
buttonColor: AppColor.primary10,
label: "Update",
onPressed: () async {
// Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateEquipmentInternalAuditPage(model: model)));
}),
),
],
);
}),
)).handlePopScope(
cxt: context,
onSave: () {
_onUpdate(context);
});
}
void _onUpdate(BuildContext context) async {}
Widget labelValueText(BuildContext context, String label, String? value) {
if (value == null || value.isEmpty) return const SizedBox.shrink();
return Padding(
padding: const EdgeInsets.only(bottom: 4),
child: Text(
'$label: $value',
style: AppTextStyles.bodyText.copyWith(
color: context.isDark ? AppColor.neutral30 : AppColor.neutral120,
),
),
);
}
Widget checklistWidget(BuildContext context, {required String value}) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Checkbox(
value: true,
activeColor: AppColor.neutral120,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
visualDensity: const VisualDensity(horizontal: -4, vertical: -3),
onChanged: (value) {},
),
value.bodyText(context),
],
);
}
}

@ -13,6 +13,7 @@ import 'package:test_sa/modules/cm_module/create_cm_request.dart';
import 'package:test_sa/modules/internal_audit_module/pages/equipment_internal_audit/create_equipment_internal_audit_form.dart'; import 'package:test_sa/modules/internal_audit_module/pages/equipment_internal_audit/create_equipment_internal_audit_form.dart';
import 'package:test_sa/modules/internal_audit_module/pages/system_internal_audit/create_system_internal_audit_form.dart'; import 'package:test_sa/modules/internal_audit_module/pages/system_internal_audit/create_system_internal_audit_form.dart';
import 'package:test_sa/modules/loan_module/pages/create_loan_request_page.dart'; import 'package:test_sa/modules/loan_module/pages/create_loan_request_page.dart';
import 'package:test_sa/modules/medical_gas_inspection/create_medical_gas_request_page.dart';
import 'package:test_sa/modules/tm_module/device_transfer/create_device_transfer_request.dart'; import 'package:test_sa/modules/tm_module/device_transfer/create_device_transfer_request.dart';
import 'package:test_sa/modules/tm_module/tasks/create_task_view.dart'; import 'package:test_sa/modules/tm_module/tasks/create_task_view.dart';
import 'package:test_sa/modules/traf_module/create_traf_request_page.dart'; import 'package:test_sa/modules/traf_module/create_traf_request_page.dart';
@ -123,6 +124,7 @@ class CreateRequestModel {
} }
//TODO uncommit this to enable task. //TODO uncommit this to enable task.
list.add(CreateRequestModel(context.translation.task, "add_icon", CreateTaskView.id)); list.add(CreateRequestModel(context.translation.task, "add_icon", CreateTaskView.id));
list.add(CreateRequestModel("Medical Gas Inspection", "add_icon", CreateMedicalGasRequestPage.id));
} else { } else {
list.add(CreateRequestModel(context.translation.correctiveMaintenance, "add_icon", CreateCMRequest.id)); list.add(CreateRequestModel(context.translation.correctiveMaintenance, "add_icon", CreateCMRequest.id));
list.add(CreateRequestModel(context.translation.gasRefill, "add_icon", GasRefillRequestForm.routeName)); list.add(CreateRequestModel(context.translation.gasRefill, "add_icon", GasRefillRequestForm.routeName));

Loading…
Cancel
Save