From 86f96a8f6221361989cf9b80b7fb7b247d3661c2 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Mon, 15 Dec 2025 16:56:22 +0300 Subject: [PATCH] medical gas ui added. --- .../update_equipment_internal_audit_page.dart | 15 +- .../create_medical_gas_request_page.dart | 378 ++++-------------- .../medical_gas_inspection_detail_page.dart | 143 +++++++ .../update_medical_gas_inspection_page.dart | 308 ++++++++++++++ .../create_request_type_bottom_sheet.dart | 2 + 5 files changed, 542 insertions(+), 304 deletions(-) create mode 100644 lib/modules/medical_gas_inspection/medical_gas_inspection_detail_page.dart create mode 100644 lib/modules/medical_gas_inspection/update_medical_gas_inspection_page.dart diff --git a/lib/modules/internal_audit_module/pages/equipment_internal_audit/update_equipment_internal_audit_page.dart b/lib/modules/internal_audit_module/pages/equipment_internal_audit/update_equipment_internal_audit_page.dart index 3ec44d60..fb317f1e 100644 --- a/lib/modules/internal_audit_module/pages/equipment_internal_audit/update_equipment_internal_audit_page.dart +++ b/lib/modules/internal_audit_module/pages/equipment_internal_audit/update_equipment_internal_audit_page.dart @@ -93,6 +93,7 @@ class _UpdateEquipmentInternalAuditPageState extends State(context, listen: false); - if ( formModel.startTime == null) { + if (formModel.startTime == null) { Fluttertoast.showToast(msg: "Working Hours Required"); return; } @@ -138,12 +139,12 @@ class _UpdateEquipmentInternalAuditPageState extends State widget.workOrderId != null; + SupplierDetails? supplier; // List loanTypes = []; @@ -84,7 +87,11 @@ class _CreateMedicalGasRequestPageState extends State( context: context, - title: "Loan Type", + title: "Order Type", + validator: (value) { + if (value == null) return "Mandatory"; + return null; + }, enabled: false, staticData: [], initialValue: null, @@ -93,15 +100,77 @@ class _CreateMedicalGasRequestPageState extends State( + context: context, + title: "Item Type", + validator: (value) { + if (value == null) return "Mandatory"; + return null; + }, + enabled: false, + staticData: [], + initialValue: null, + showShadow: false, + backgroundColor: AppColor.fieldBgColor(context), + showAsBottomSheet: true, + onSelect: (value) {}, + ), + 8.height, + SingleItemDropDownMenu( + 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( + 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( + 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, AttachmentPicker( label: context.translation.attachments, @@ -133,293 +202,8 @@ class _CreateMedicalGasRequestPageState extends State 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 itemDetailsSection() { - return [ - 'Item Details'.addTranslation.bodyText(context).custom(color: AppColor.black10), - 8.height, - SingleItemDropDownMenu( - 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( - 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( - 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 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 _submit() async { + Navigator.of(context).push(MaterialPageRoute(builder: (_) => MedicalGasInspectionDetailPage(inspectionId: 0))); return; FocusScope.of(context).unfocus(); if (_formKey.currentState!.validate()) { diff --git a/lib/modules/medical_gas_inspection/medical_gas_inspection_detail_page.dart b/lib/modules/medical_gas_inspection/medical_gas_inspection_detail_page.dart new file mode 100644 index 00000000..c34ddfe5 --- /dev/null +++ b/lib/modules/medical_gas_inspection/medical_gas_inspection_detail_page.dart @@ -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( + future: Provider.of(context, listen: false).getLoanById(0), + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) return const CircularProgressIndicator(color: AppColor.primary10).center; + + // if (snapshot.data == null) return const NoDataFound().center; + // + List 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), + ], + ); + } +} diff --git a/lib/modules/medical_gas_inspection/update_medical_gas_inspection_page.dart b/lib/modules/medical_gas_inspection/update_medical_gas_inspection_page.dart new file mode 100644 index 00000000..5a138600 --- /dev/null +++ b/lib/modules/medical_gas_inspection/update_medical_gas_inspection_page.dart @@ -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 { + List _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( + future: Provider.of(context, listen: false).getLoanById(0), + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) return const CircularProgressIndicator(color: AppColor.primary10).center; + + // if (snapshot.data == null) return const NoDataFound().center; + // + // List 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( + 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( + 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), + ], + ); + } +} diff --git a/lib/new_views/pages/land_page/create_request_type_bottom_sheet.dart b/lib/new_views/pages/land_page/create_request_type_bottom_sheet.dart index 030b2895..1508985c 100644 --- a/lib/new_views/pages/land_page/create_request_type_bottom_sheet.dart +++ b/lib/new_views/pages/land_page/create_request_type_bottom_sheet.dart @@ -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/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/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/tasks/create_task_view.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. list.add(CreateRequestModel(context.translation.task, "add_icon", CreateTaskView.id)); + list.add(CreateRequestModel("Medical Gas Inspection", "add_icon", CreateMedicalGasRequestPage.id)); } else { list.add(CreateRequestModel(context.translation.correctiveMaintenance, "add_icon", CreateCMRequest.id)); list.add(CreateRequestModel(context.translation.gasRefill, "add_icon", GasRefillRequestForm.routeName));