From 4926b48e4f98d7d3c626f4bc1b5486c18d8e1344 Mon Sep 17 00:00:00 2001 From: venbaittech Date: Mon, 23 Jun 2025 16:10:39 +0530 Subject: [PATCH] sonumber added --- lib/Screens/itnerary/forex.dart | 94 +- lib/Screens/itnerary/visa.dart | 51 +- lib/Screens/itnerary_list/flight_list.dart | 64 +- lib/Screens/plans/create_plans.dart | 98 +- lib/Screens/policy/policyCriteria.dart | 3153 +++++++++-------- .../create_user/office_details.dart | 18 +- 6 files changed, 1990 insertions(+), 1488 deletions(-) diff --git a/lib/Screens/itnerary/forex.dart b/lib/Screens/itnerary/forex.dart index a174c32..2719308 100644 --- a/lib/Screens/itnerary/forex.dart +++ b/lib/Screens/itnerary/forex.dart @@ -260,6 +260,7 @@ class _ForexScreenState extends State { "country_code", "deposit_on_card", "deposit_on_cash", + "currency", // "card_number", ]; @@ -269,6 +270,14 @@ class _ForexScreenState extends State { requiredFields.add("delivery_location"); } else { requiredFields.add("card_number"); + // Check if card_number has at least 16 digits + } + + final cardNumber = data["card_number"]?.toString() ?? ''; + if (cardNumber.length < 16) { + // Show error or return false + print("Card number must be 16 digits"); + errorMessages["card_number"] = "Card number must be 16 digits"; } // Check validation for each field @@ -1267,14 +1276,25 @@ class _ForexScreenState extends State { countryList = widget.apiCountryData ?? []; // Map country codes to country names - countryMap = { - for (var item in countryList) - item['country_code'] as String: item['country_name'] as String, - }; + // countryMap = { + // for (var item in countryList) + // item['country_code'] as String: item['country_name'] as String, + // + // }; // Extract only country codes for processing + // countryCodes = countryMap.keys.toList(); + + countryMap = { + for (var country in countryList) + (country['country_code'] ?? ''): + '${country['country_name'] ?? ''} (${country['country_code'] ?? ''})', + }; + countryCodes = countryMap.keys.toList(); + Map tempCountryMap = {}; + selectedCountry ??= null; // // Set default selected value @@ -1375,18 +1395,45 @@ class _ForexScreenState extends State { menuProps: const MenuProps( backgroundColor: Colors.white, ), - itemBuilder: - (context, item, isSelected) => Container( - color: Colors.white, - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 6, - ), - child: Text( - item, - style: GoogleFonts.poppins(fontSize: 11.5), + itemBuilder: (context, item, isSelected) { + print("contryItem - $item"); + + final match = RegExp( + r'^(.*)\s\((.*)\)$', + ).firstMatch(item); + final countryName = match?.group(1) ?? ''; + final countryCode = match?.group(2) ?? ''; + + return Container( + color: Colors.white, + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 6, + ), + child: Padding( + padding: const EdgeInsets.only(right: 2.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + countryName, + style: GoogleFonts.poppins( + fontSize: 11.5, + ), + ), + Text( + countryCode, + style: GoogleFonts.poppins( + fontSize: 11.5, + color: Colors.grey, + ), + ), + ], ), ), + ); + }, searchFieldProps: TextFieldProps( decoration: InputDecoration( hintText: "Search ...", @@ -1489,6 +1536,13 @@ class _ForexScreenState extends State { ), ), ), + if (errorMessages["currency"] != null) ...[ + SizedBox(height: 5), // Space before error message + Text( + errorMessages["currency"]!, + style: TextStyle(color: Colors.red, fontSize: 12), + ), + ], ], ), // if (isDesktop)SizedBox(width: 8,) else SizedBox(height: 8,), @@ -2174,6 +2228,16 @@ class _ForexScreenState extends State { focusNode: focusNodes["_cardNumber"], controller: textControllers["_cardNumber"], style: const TextStyle(fontSize: 12), + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9\s]')), + LengthLimitingTextInputFormatter(16), + ], + onChanged: (value) { + setState(() { + errorMessages.remove("card_number"); + }); + }, + decoration: const InputDecoration( labelText: "Card Number", labelStyle: TextStyle(fontSize: 12, color: Colors.grey), @@ -2187,7 +2251,7 @@ class _ForexScreenState extends State { if (errorMessages["card_number"] != null) ...[ SizedBox(height: 5), // Space before error message Text( - "Required", + errorMessages["card_number"]!, style: TextStyle(color: Colors.red, fontSize: 12), ), ], diff --git a/lib/Screens/itnerary/visa.dart b/lib/Screens/itnerary/visa.dart index b841abd..2a660ec 100644 --- a/lib/Screens/itnerary/visa.dart +++ b/lib/Screens/itnerary/visa.dart @@ -353,9 +353,15 @@ class _VisaScreenState extends State { countryList = widget.apiCountryData ?? []; // Map country codes to country names + // countryMap = { + // for (var item in countryList) + // item['country_code'] as String: item['country_name'] as String, + // }; + countryMap = { - for (var item in countryList) - item['country_code'] as String: item['country_name'] as String, + for (var country in countryList) + (country['country_code'] ?? ''): + '${country['country_name'] ?? ''} (${country['country_code'] ?? ''})', }; // Extract only country codes for processing @@ -526,18 +532,39 @@ class _VisaScreenState extends State { fit: FlexFit.loose, constraints: BoxConstraints(maxHeight: 200), menuProps: const MenuProps(backgroundColor: Colors.white), - itemBuilder: - (context, item, isSelected) => Container( - color: Colors.white, - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 6, - ), - child: Text( - item, - style: GoogleFonts.poppins(fontSize: 11.5), + itemBuilder: (context, item, isSelected) { + print("contryItem - $item"); + + final match = RegExp(r'^(.*)\s\((.*)\)$').firstMatch(item); + final countryName = match?.group(1) ?? ''; + final countryCode = match?.group(2) ?? ''; + return Container( + color: Colors.white, + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 6, + ), + child: Padding( + padding: const EdgeInsets.only(right: 4.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + countryName, + style: GoogleFonts.poppins(fontSize: 11.5), + ), + Text( + countryCode, + style: GoogleFonts.poppins( + fontSize: 11.5, + color: Colors.grey, + ), + ), + ], ), ), + ); + }, searchFieldProps: TextFieldProps( decoration: InputDecoration( hintText: "Search ...", diff --git a/lib/Screens/itnerary_list/flight_list.dart b/lib/Screens/itnerary_list/flight_list.dart index 46b07bb..17bde3e 100644 --- a/lib/Screens/itnerary_list/flight_list.dart +++ b/lib/Screens/itnerary_list/flight_list.dart @@ -123,38 +123,40 @@ class _FlightListWidgetState extends State { // "Flight Booking List", // style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), // ), - MouseRegion( - cursor: - widget.isViewMode - ? SystemMouseCursors.forbidden - : SystemMouseCursors.click, - child: GestureDetector( - onTap: - widget.isViewMode - ? null - : () { - widget.onAddNew("Flight", true); - // checkClass(); - print("New data"); - }, - child: Row( - mainAxisSize: - MainAxisSize.min, // Ensures content fits nicely - children: [ - // Text( - // "Add New", - // style: TextStyle(fontSize: 13), - // ), - // SizedBox(width: 8), // spacing between icon and text - Icon( - Icons.add_circle_sharp, - size: 30, - color: Color(0xFF114D8B), + widget.flightList.isNotEmpty + ? MouseRegion( + cursor: + widget.isViewMode + ? SystemMouseCursors.forbidden + : SystemMouseCursors.click, + child: GestureDetector( + onTap: + widget.isViewMode + ? null + : () { + widget.onAddNew("Flight", true); + // checkClass(); + print("New data"); + }, + child: Row( + mainAxisSize: + MainAxisSize.min, // Ensures content fits nicely + children: [ + // Text( + // "Add New", + // style: TextStyle(fontSize: 13), + // ), + // SizedBox(width: 8), // spacing between icon and text + Icon( + Icons.add_circle_sharp, + size: 30, + color: Color(0xFF114D8B), + ), + ], ), - ], - ), - ), - ), + ), + ) + : SizedBox.shrink(), ], ), const SizedBox(height: 16), diff --git a/lib/Screens/plans/create_plans.dart b/lib/Screens/plans/create_plans.dart index 2661552..8a32d7d 100644 --- a/lib/Screens/plans/create_plans.dart +++ b/lib/Screens/plans/create_plans.dart @@ -383,6 +383,7 @@ class CreateNewPlansState extends State { final TextEditingController _tripTitleController = TextEditingController(); final TextEditingController _descriptionController = TextEditingController(); + final TextEditingController _soNumberController = TextEditingController(); final TextEditingController _excepntldescriptionController = TextEditingController(); final TextEditingController _remarksController = TextEditingController(); @@ -420,6 +421,7 @@ class CreateNewPlansState extends State { bool showDomestic = false; bool showInternational = false; bool hasAction = true; + bool hasSoNumber = false; bool hasExceptionalClass = false; late Map costCenterMap; @@ -478,7 +480,7 @@ class CreateNewPlansState extends State { "description": _descriptionController.text, "exceptional_plan_reason": _excepntldescriptionController.text, "functional_department": selectedFuncDept, - "so_number": "12345", + "so_number": _soNumberController.text, "created_by": selfId, "updated_by": selfId, "is_active": "1", @@ -503,6 +505,7 @@ class CreateNewPlansState extends State { "description", "excepntldescription", "functional_department", + "so_number", ]; void handleItineraryUpdate(String type, List> newList) { @@ -666,6 +669,12 @@ class CreateNewPlansState extends State { _descriptionController.text = widget.selectedPlanData['description'] ?? ''; + _soNumberController.text = widget.selectedPlanData['so_number'] ?? ''; + + if (_soNumberController.text != "") { + hasSoNumber = true; + } + _excepntldescriptionController.text = widget.selectedPlanData['exceptional_plan_reason'] ?? ''; @@ -1159,6 +1168,8 @@ class CreateNewPlansState extends State { "purpose_of_travel": selectedPurpose, if (hasExceptionalClass) "exceptional_plan_reason": _excepntldescriptionController.text, + + if (hasSoNumber) "so_number": _soNumberController.text, }; print("validateForm.....3"); for (var entry in requiredFields.entries) { @@ -1771,7 +1782,7 @@ class CreateNewPlansState extends State { children: [ _buildDescriptionColumn(isDesktop), SizedBox(height: 15), - _buildNonDescriptionColumn(), + if (hasExceptionalClass) _buildNonDescriptionColumn(), ], ), @@ -1895,6 +1906,10 @@ class CreateNewPlansState extends State { isFocused: false, padding: const EdgeInsets.symmetric(horizontal: 0), // isFocused: focusStates["trip_typeFocused"] ?? false, + width: + widget.isDesktop + ? MediaQuery.of(context).size.width * 0.32 + : MediaQuery.of(context).size.width * 0.88, isDesktop: widget.isDesktop, child: SizedBox( height: 35, @@ -2369,6 +2384,7 @@ class CreateNewPlansState extends State { ), SizedBox(height: 5), CustomTextFieldWrapper( + width: isDesktop ? MediaQuery.of(context).size.width * 0.15 : null, // isFocused: focusStates["cost_center_idFocused"] ?? isFocused: false, padding: const EdgeInsets.symmetric(horizontal: 0), @@ -2572,7 +2588,7 @@ class CreateNewPlansState extends State { CustomTextFieldWrapper( width: isDesktop - ? MediaQuery.of(context).size.width * 0.2 + ? MediaQuery.of(context).size.width * 0.15 : MediaQuery.of(context).size.width * 0.88, // isFocused: focusStates["purpose_of_travelFocused"] ?? false, isFocused: false, @@ -2907,11 +2923,26 @@ class CreateNewPlansState extends State { widget.isViewMode ? null : (Map? newValue) { + dynamic val = + newValue?['dropdown_value'] + .toString(); setState(() { selectedFuncDept = newValue?['dropdown_key'] .toString(); + + if (val == + " Others (Kindly enter SO number )") { + hasSoNumber = true; + } else { + hasSoNumber = false; + _soNumberController.text = ""; + } }); + + print( + "selectedFuncDept1 - ${newValue?['dropdown_value'].toString()}", + ); print( "selectedFuncDept - $selectedFuncDept", ); @@ -2959,6 +2990,56 @@ class CreateNewPlansState extends State { ), ], ), + SizedBox(width: 25, height: 5), + + hasSoNumber + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "SO Number *", // Your label + style: GoogleFonts.poppins( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xFF575A74), + ), + ), + SizedBox(height: 5), + CustomTextFieldWrapper( + isFocused: focusStates["so_numberFocused"] ?? false, + // isFocused: _isdescriptionFocused, + width: + widget.isDesktop + ? MediaQuery.of(context).size.width * 0.2 + : null, + isDesktop: widget.isDesktop, + child: SizedBox( + height: 35, + child: TextField( + focusNode: focusNodes["so_numberFocusNode"], + controller: _soNumberController, + style: TextStyle(fontSize: 12), + decoration: InputDecoration( + labelText: "SO Number", + labelStyle: TextStyle(fontSize: 12, color: Colors.grey), + floatingLabelBehavior: FloatingLabelBehavior.never, + border: InputBorder.none, + contentPadding: EdgeInsets.symmetric(vertical: 16), + ), + ), + ), + ), + if (validationErrors["so_number"] != null) + Padding( + padding: EdgeInsets.only(top: 4), + child: Text( + validationErrors["so_number"]!, + style: GoogleFonts.poppins(fontSize: 12, color: Colors.red), + ), + ), + ], + ) + : SizedBox.shrink(), ]; } @@ -2972,6 +3053,10 @@ class CreateNewPlansState extends State { return [ CustomTextFieldWrapper( // isFocused: focusStates["trip_plannedFocused"] ?? false, + width: + widget.isDesktop + ? MediaQuery.of(context).size.width * 0.32 + : MediaQuery.of(context).size.width * 0.88, isFocused: false, padding: const EdgeInsets.symmetric(horizontal: 0), isDesktop: isDesktop, @@ -3425,9 +3510,10 @@ class CreateNewPlansState extends State { CustomTextFieldWrapper( isFocused: focusStates["descriptionFocused"] ?? false, // isFocused: _isdescriptionFocused, - // width: isDesktop - // ? MediaQuery.of(context).size.width * 0.38 - // : MediaQuery.of(context).size.width * 0.85, + width: + widget.isDesktop + ? MediaQuery.of(context).size.width * 0.32 + : MediaQuery.of(context).size.width * 0.88, isDesktop: widget.isDesktop, child: SizedBox( height: 55, diff --git a/lib/Screens/policy/policyCriteria.dart b/lib/Screens/policy/policyCriteria.dart index e021f4b..d7a3db7 100644 --- a/lib/Screens/policy/policyCriteria.dart +++ b/lib/Screens/policy/policyCriteria.dart @@ -21,15 +21,16 @@ class PolicyCriteria extends StatefulWidget { final Function(List>?) onPolicyDataChanged; - PolicyCriteria( - {super.key, - required this.isDesktop, - required this.selectedService, - required this.selectedTabNotifier, - required this.userId, - required this.isClass, - required this.isCost, - required this.onPolicyDataChanged}); + PolicyCriteria({ + super.key, + required this.isDesktop, + required this.selectedService, + required this.selectedTabNotifier, + required this.userId, + required this.isClass, + required this.isCost, + required this.onPolicyDataChanged, + }); @override PolicyCriteriaState createState() => PolicyCriteriaState(); } @@ -61,13 +62,11 @@ class PolicyCriteriaState extends State { Map ThirdApproverAction = {}; Map SelectedParallelProcess = {}; - Map FirstExceptionalApproverAction = {}; Map SecondExceptionalApproverAction = {}; Map ThirdExceptionalApproverAction = {}; Map SelectedParallelExceptionalProcess = {}; - Map FirstAmendApproverAction = {}; Map SecondAmendApproverAction = {}; Map ThirdAmendApproverAction = {}; @@ -101,15 +100,13 @@ class PolicyCriteriaState extends State { super.initState(); fieldForPolicy(); - - widget.selectedTabNotifier.addListener(() { print("selectedTab changed: ${widget.selectedTabNotifier.value}"); -setState(() { - ServiceIndxId = widget.selectedTabNotifier.value ?? "1"; + setState(() { + ServiceIndxId = widget.selectedTabNotifier.value ?? "1"; - print("ServiceIndxId changed: $ServiceIndxId"); -}); + print("ServiceIndxId changed: $ServiceIndxId"); + }); fieldForPolicy(); fetchTrainFlightClass(); @@ -179,7 +176,8 @@ setState(() { "a1_exceptional_action": FirstExceptionalApproverAction[id], "a2_exceptional_action": SecondExceptionalApproverAction[id], "a3_exceptional_action": ThirdExceptionalApproverAction[id], - "exceptional_parallel_process_from": SelectedParallelExceptionalProcess[id], + "exceptional_parallel_process_from": + SelectedParallelExceptionalProcess[id], "a1_amendment_action": FirstAmendApproverAction[id], "a2_amendment_action": SecondAmendApproverAction[id], "a3_amendment_action": ThirdAmendApproverAction[id], @@ -197,8 +195,9 @@ setState(() { for (var item in details) { final serviceId = item['service_id'].toString(); - costController[serviceId] = - TextEditingController(text: item['cost'] ?? ''); + costController[serviceId] = TextEditingController( + text: item['cost'] ?? '', + ); // classAction[serviceId] = classAction[serviceId]?.toString(); @@ -210,15 +209,21 @@ setState(() { SelectedParallelProcess[serviceId] = item['parallel_process_from']?.toString() ?? "3"; - FirstExceptionalApproverAction[serviceId] = item['a1_exceptional_action']?.toString(); - SecondExceptionalApproverAction[serviceId] = item['a2_exceptional_action']?.toString(); - ThirdExceptionalApproverAction[serviceId] = item['a3_exceptional_action']?.toString(); + FirstExceptionalApproverAction[serviceId] = + item['a1_exceptional_action']?.toString(); + SecondExceptionalApproverAction[serviceId] = + item['a2_exceptional_action']?.toString(); + ThirdExceptionalApproverAction[serviceId] = + item['a3_exceptional_action']?.toString(); SelectedParallelExceptionalProcess[serviceId] = item['exceptional_parallel_process_from']?.toString() ?? "3"; - FirstAmendApproverAction[serviceId] = item['a1_amendment_action']?.toString(); - SecondAmendApproverAction[serviceId] = item['a2_amendment_action']?.toString(); - ThirdAmendApproverAction[serviceId] = item['a3_amendment_action']?.toString(); + FirstAmendApproverAction[serviceId] = + item['a1_amendment_action']?.toString(); + SecondAmendApproverAction[serviceId] = + item['a2_amendment_action']?.toString(); + ThirdAmendApproverAction[serviceId] = + item['a3_amendment_action']?.toString(); SelectedParallelAmendProcess[serviceId] = item['amendment_parallel_process_from']?.toString() ?? "3"; @@ -248,8 +253,9 @@ setState(() { void addOrUpdatePolicy(String serviceId) { print("addOrUpdatePolicyserviceId - $serviceId"); // 1. First, find existing item if any - final existingIndex = - policyData!.indexWhere((item) => item["service_id"] == serviceId); + final existingIndex = policyData!.indexWhere( + (item) => item["service_id"] == serviceId, + ); Map data = { "service_id": serviceId, @@ -263,12 +269,14 @@ setState(() { "a1_exceptional_action": FirstExceptionalApproverAction[serviceId], "a2_exceptional_action": SecondExceptionalApproverAction[serviceId], "a3_exceptional_action": ThirdExceptionalApproverAction[serviceId], - "exceptional_parallel_process_from": SelectedParallelExceptionalProcess[serviceId], + "exceptional_parallel_process_from": + SelectedParallelExceptionalProcess[serviceId], "a1_amendment_action": FirstAmendApproverAction[serviceId], "a2_amendment_action": SecondAmendApproverAction[serviceId], "a3_amendment_action": ThirdAmendApproverAction[serviceId], - "amendment_parallel_process_from": SelectedParallelAmendProcess[serviceId], - "created_by": widget.userId + "amendment_parallel_process_from": + SelectedParallelAmendProcess[serviceId], + "created_by": widget.userId, }; final cost = costController[serviceId]?.text ?? ""; @@ -292,15 +300,18 @@ setState(() { cost.trim().isNotEmpty || (travelClass?.isNotEmpty ?? false); bool allActionsNull = a1 == null && a2 == null && a3 == null; - bool someActionsMissing = [a1, a2, a3].where((a) => a != null).length > 0 && + bool someActionsMissing = + [a1, a2, a3].where((a) => a != null).length > 0 && [a1, a2, a3].where((a) => a == null).length > 0; bool allExceptionalActionsNull = ae1 == null && ae2 == null && ae3 == null; - bool someExceptionalActionsMissing = [ae1, ae2, ae3].where((a) => a != null).length > 0 && + bool someExceptionalActionsMissing = + [ae1, ae2, ae3].where((a) => a != null).length > 0 && [ae1, ae2, ae3].where((a) => a == null).length > 0; bool allAmendActionsNull = aa1 == null && aa2 == null && aa3 == null; - bool someAmendActionsMissing = [aa1, aa2, aa3].where((a) => a != null).length > 0 && + bool someAmendActionsMissing = + [aa1, aa2, aa3].where((a) => a != null).length > 0 && [aa1, aa2, aa3].where((a) => a == null).length > 0; if (someActionsMissing) { @@ -308,15 +319,20 @@ setState(() { return; } if (someExceptionalActionsMissing) { - validationErrors[serviceId] = "All 3 exceptional approver actions must be selected."; + validationErrors[serviceId] = + "All 3 exceptional approver actions must be selected."; return; } if (someAmendActionsMissing) { - validationErrors[serviceId] = "All 3 amendment approver actions must be selected."; + validationErrors[serviceId] = + "All 3 amendment approver actions must be selected."; return; } - if (hasValue && allActionsNull && allExceptionalActionsNull && allAmendActionsNull ) { + if (hasValue && + allActionsNull && + allExceptionalActionsNull && + allAmendActionsNull) { validationErrors[serviceId] = "Please select all actions."; return; } else { @@ -429,7 +445,8 @@ setState(() { if (ServiceId != null) { print("Calling addOrUpdatePolicy"); addOrUpdatePolicy( - ServiceId!); // 👈 Save current values for existing service + ServiceId!, + ); // 👈 Save current values for existing service } setState(() { ServiceId = widget.selectedTabNotifier.value ?? "1"; @@ -448,7 +465,6 @@ setState(() { ThirdExceptionalApproverAction.putIfAbsent(ServiceId!, () => "None"); SelectedParallelExceptionalProcess.putIfAbsent(ServiceId!, () => "3"); - FirstAmendApproverAction.putIfAbsent(ServiceId!, () => "None"); SecondAmendApproverAction.putIfAbsent(ServiceId!, () => "None"); ThirdAmendApproverAction.putIfAbsent(ServiceId!, () => "None"); @@ -488,34 +504,42 @@ setState(() { if (widget.isClass!) widget.isDesktop ? SizedBox(height: 1) : SizedBox(height: 1), Padding( - padding: widget.isDesktop - ? const EdgeInsets.only(left: 0.0) - : const EdgeInsets.only(left: 0), + padding: + widget.isDesktop + ? const EdgeInsets.only(left: 0.0) + : const EdgeInsets.only(left: 0), child: Row( children: [ Container( // color: Colors.grey, - padding: - const EdgeInsets.only(top: 2, bottom: 2, left: 5, right: 5), - child: widget.isDesktop - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - if (widget.isClass) - buildClassWidget(widget.isDesktop), - SizedBox(width: 45), - if (widget.isCost!) buildCostWidget(widget.isDesktop), - ], - ) - : Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (widget.isClass!) - buildClassWidget(widget.isDesktop), - SizedBox(height: 10), - if (widget.isCost!) buildCostWidget(widget.isDesktop), - ], - ), + padding: const EdgeInsets.only( + top: 2, + bottom: 2, + left: 5, + right: 5, + ), + child: + widget.isDesktop + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + if (widget.isClass) + buildClassWidget(widget.isDesktop), + SizedBox(width: 45), + if (widget.isCost!) + buildCostWidget(widget.isDesktop), + ], + ) + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (widget.isClass!) + buildClassWidget(widget.isDesktop), + SizedBox(height: 10), + if (widget.isCost!) + buildCostWidget(widget.isDesktop), + ], + ), ), ], ), @@ -524,11 +548,14 @@ setState(() { if (validationErrors[ServiceId] != null) Row( children: [ - Text(validationErrors[ServiceId]!, - style: GoogleFonts.poppins( - color: Colors.red, - fontSize: 10, - fontWeight: FontWeight.bold)) + Text( + validationErrors[ServiceId]!, + style: GoogleFonts.poppins( + color: Colors.red, + fontSize: 10, + fontWeight: FontWeight.bold, + ), + ), ], ), if (validationErrors[ServiceId] != null) SizedBox(height: 5), @@ -548,502 +575,16 @@ setState(() { // mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Container( - - - // color: Colors.yellow, - width: widget.isDesktop - ? MediaQuery.of(context).size.width * 0.18 - : 600, - height: widget.isDesktop - ? MediaQuery.of(context).size.height * 0.56 - : null, - child: - Column( - children: [ - Container( - margin: const EdgeInsets.only(right: 0), - decoration: BoxDecoration( - // color: Colors.grey.shade100, - // border: Border.all( - // color: Colors.grey.shade100, - // ), - ), - padding: const EdgeInsets.only( - top: 10, bottom: 0, left: 0, right: 35), - child: Row( - mainAxisAlignment: widget.isDesktop - ? MainAxisAlignment.spaceAround - : MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 3, - child: Align( - alignment: Alignment.center, - child: Text( - "Approver", - style: GoogleFonts.poppins( - color: Color(0xFF9E9DBD), - fontWeight: FontWeight.bold, - fontSize: 12), - ), - ), - ), - // Expanded( - // flex: 2, - // child: Text( - // "Actions", - // style: GoogleFonts.poppins( - // color: Color(0xFF9E9DBD), - // fontWeight: FontWeight.bold, - // fontSize: 12), - // ), - // ), - // Text( - // "Parallel Action", - // style: GoogleFonts.poppins( - // color: Color(0xFF9E9DBD), - // fontWeight: FontWeight.bold, - // fontSize: 12), - // ) - ], - ), - ), - Divider( - thickness: 0.2, - color: Colors.grey, - ), - SizedBox( - // height: 180, - - // scrollDirection: Axis.vertical, - child: Container( - // height: MediaQuery.of(context).size.height * 3, - // color: Colors.grey, - decoration: BoxDecoration( - border: Border( - right: BorderSide( - color: Colors.blueGrey.shade50, // Change this to your desired color - width: 1.0, // Change this to your desired width - ), - ), - ), - - margin: const EdgeInsets.only(right: 5, left: 0), - // color: Colors.grey.shade100, - child: Column(children: [ - Container( - padding: const EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - // "Approver 1", - "A1", - style: GoogleFonts.poppins(fontSize: 13), - ), - Spacer(), - CustomTextFieldUserWrapper( - width:MediaQuery.of(context).size.width * 0.12, - isFocused: false, - isDesktop: widget.isDesktop, - child: SizedBox( - height: 35, - child: DropdownSearch( - selectedItem: - FirstApproverAction[ServiceId], - // enabled: !isViewMode, - popupProps: PopupProps.menu( - // showSearchBox: true, - fit: FlexFit - .loose, // Allows flexible height - constraints: - BoxConstraints(maxHeight: 250), - itemBuilder: - (context, item, isSelected) => - Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0), - child: Text( - item, - style: GoogleFonts.poppins( - fontSize: - 12, // 👈 Smaller text size here - color: Colors - .black, // You can customize this - ), - ), - ), - ), - items: [ - "Approval", - "Notification", - "None" - ], - dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5), - ), - ), - dropdownBuilder: - (context, selectedItem) => Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B)), - ), - - onChanged: (String? newValue) { - setState(() { - // Find the country_code based on selected country_name - FirstApproverAction[ServiceId!] = - newValue; - - // print("selectedUserType - $selectedUserType"); - - // if (selectedCountry!.isNotEmpty) { - // errorMessages.remove("country_code"); - // } - }); - }, - ), - ), - ), - Spacer(), - GestureDetector( - onTap: () { - setState(() { - SelectedParallelProcess[ServiceId!] = - "1"; - }); - - print( - "SelectedParallelProcess - $SelectedParallelProcess"); - }, - child: Container( - height: 25, - width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: (SelectedParallelProcess[ - ServiceId] == - "1") - ? Colors.green - : Colors.grey, - width: 2), - ), - child: Icon( - Icons.check_circle, - size: 20, - color: (SelectedParallelProcess[ - ServiceId] == - "1") - ? Colors.green - : Colors.grey, - // color: Colors.grey, - )), - ), - ], - ), - ), - Container( - padding: const EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - // "Approver 2", - "A2", - style: GoogleFonts.poppins(fontSize: 13), - ), - Spacer(), - CustomTextFieldUserWrapper( - width:MediaQuery.of(context).size.width * 0.12, - isFocused: false, - isDesktop: widget.isDesktop, - child: SizedBox( - height: 35, - child: DropdownSearch( - selectedItem: - SecondApproverAction[ServiceId], - // enabled: !isViewMode, - popupProps: PopupProps.menu( - // showSearchBox: true, - fit: FlexFit - .loose, // Allows flexible height - constraints: - BoxConstraints(maxHeight: 250), - itemBuilder: - (context, item, isSelected) => - Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0), - child: Text( - item, - style: TextStyle( - fontSize: - 12, // 👈 Smaller text size here - color: Colors - .black, // You can customize this - ), - ), - ), - ), - items: [ - "Approval", - "Notification", - "None" - ], - dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5), - ), - ), - dropdownBuilder: - (context, selectedItem) => Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B)), - ), - - onChanged: (String? newValue) { - setState(() { - // Find the country_code based on selected country_name - SecondApproverAction[ServiceId!] = - newValue; - - // print("selectedUserType - $selectedUserType"); - - // if (selectedCountry!.isNotEmpty) { - // errorMessages.remove("country_code"); - // } - }); - }, - ), - ), - ), - Spacer(), - GestureDetector( - onTap: () { - setState(() { - SelectedParallelProcess[ServiceId!] = - "2"; - }); - - print( - "SelectedParallelProcess - $SelectedParallelProcess"); - }, - child: Container( - height: 25, - width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: ((SelectedParallelProcess[ - ServiceId] == - "1") || - (SelectedParallelProcess[ - ServiceId] == - "2")) - ? Colors.green - : Colors.grey, - width: 2), - ), - child: Icon( - Icons.check_circle, - size: 20, - color: ((SelectedParallelProcess[ - ServiceId] == - "1") || - (SelectedParallelProcess[ - ServiceId] == - "2")) - ? Colors.green - : Colors.grey, - // color: Colors.grey, - )), - ), - ], - ), - ), - Container( - padding: const EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - "A3", - style: GoogleFonts.poppins(fontSize: 13), - ), - Spacer(), - CustomTextFieldUserWrapper( - width:MediaQuery.of(context).size.width * 0.12, - isFocused: false, - isDesktop: widget.isDesktop, - child: SizedBox( - height: 35, - child: DropdownSearch( - selectedItem: - ThirdApproverAction[ServiceId], - // enabled: !isViewMode, - popupProps: PopupProps.menu( - // showSearchBox: true, - fit: FlexFit - .loose, // Allows flexible height - constraints: - BoxConstraints(maxHeight: 250), - itemBuilder: - (context, item, isSelected) => - Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0), - child: Text( - item, - style: GoogleFonts.poppins( - fontSize: - 12, // 👈 Smaller text size here - color: Colors - .black, // You can customize this - ), - ), - ), - ), - items: [ - "Approval", - "Notification", - "None" - ], - dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5), - ), - ), - dropdownBuilder: - (context, selectedItem) => - // Center-align selected item - Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B)), - ), - - onChanged: (String? newValue) { - setState(() { - // Find the country_code based on selected country_name - ThirdApproverAction[ServiceId!] = - newValue; - - // print("selectedUserType - $selectedUserType"); - - // if (selectedCountry!.isNotEmpty) { - // errorMessages.remove("country_code"); - // } - }); - }, - ), - ), - ), - Spacer(), - GestureDetector( - onTap: () { - setState(() { - SelectedParallelProcess[ServiceId!] = - "3"; - }); - print( - "SelectedParallelProcess - $SelectedParallelProcess[ServiceId]"); - }, - child: Container( - height: 25, - width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: - ((SelectedParallelProcess[ - ServiceId] == - "1") || - (SelectedParallelProcess[ - ServiceId] == - "2") || - (SelectedParallelProcess[ - ServiceId] == - "3")) - ? Colors.green - : Colors.grey, - width: 2), - ), - child: Icon( - Icons.check_circle, - size: 20, - color: - ((SelectedParallelProcess[ - ServiceId] == - "1") || - (SelectedParallelProcess[ - ServiceId] == - "2") || - (SelectedParallelProcess[ - ServiceId] == - "3")) - ? Colors.green - : Colors.grey, - // color: Colors.grey, - )), - ), - ], - ), - ), - ]), - ), - ), - ], - ), - - ), - - ], - ), - - Column( - // mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Container( - - width: widget.isDesktop - ? MediaQuery.of(context).size.width * 0.18 - : 600, - height: widget.isDesktop - ? MediaQuery.of(context).size.height * 0.56 - : null, - child: - Column( + // color: Colors.yellow, + width: + widget.isDesktop + ? MediaQuery.of(context).size.width * 0.18 + : 600, + height: + widget.isDesktop + ? MediaQuery.of(context).size.height * 0.56 + : null, + child: Column( children: [ Container( margin: const EdgeInsets.only(right: 0), @@ -1054,22 +595,28 @@ setState(() { // ), ), padding: const EdgeInsets.only( - top: 10, bottom: 0, left: 0, right: 35), + top: 10, + bottom: 0, + left: 0, + right: 35, + ), child: Row( - mainAxisAlignment: widget.isDesktop - ? MainAxisAlignment.spaceAround - : MainAxisAlignment.spaceBetween, + mainAxisAlignment: + widget.isDesktop + ? MainAxisAlignment.spaceAround + : MainAxisAlignment.spaceBetween, children: [ Expanded( flex: 3, child: Align( alignment: Alignment.center, child: Text( - "Exceptional Approver", + "Normal Approval", style: GoogleFonts.poppins( - color: Color(0xFF9E9DBD), - fontWeight: FontWeight.bold, - fontSize: 12), + color: Color(0xFF9E9DBD), + fontWeight: FontWeight.bold, + fontSize: 12, + ), ), ), ), @@ -1093,10 +640,7 @@ setState(() { ], ), ), - Divider( - thickness: 0.2, - color: Colors.grey, - ), + Divider(thickness: 0.2, color: Colors.grey), SizedBox( // height: 180, @@ -1107,426 +651,487 @@ setState(() { decoration: BoxDecoration( border: Border( right: BorderSide( - color: Colors.blueGrey.shade50, // Change this to your desired color - width: 1.0, // Change this to your desired width + color: + Colors + .blueGrey + .shade50, // Change this to your desired color + width: + 1.0, // Change this to your desired width ), ), ), + margin: const EdgeInsets.only(right: 5, left: 0), // color: Colors.grey.shade100, - child: Column(children: [ - Container( - padding: const EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - // "Approver 1", - "A1", - style: GoogleFonts.poppins(fontSize: 13), - ), - Spacer(), - CustomTextFieldUserWrapper( - width:MediaQuery.of(context).size.width * 0.12, - isFocused: false, - isDesktop: widget.isDesktop, - child: SizedBox( - height: 35, - child: DropdownSearch( - selectedItem: - FirstExceptionalApproverAction[ServiceId], - // enabled: !isViewMode, - popupProps: PopupProps.menu( - // showSearchBox: true, - fit: FlexFit - .loose, // Allows flexible height - constraints: - BoxConstraints(maxHeight: 250), - itemBuilder: - (context, item, isSelected) => - Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0), - child: Text( - item, - style: GoogleFonts.poppins( - fontSize: - 12, // 👈 Smaller text size here - color: Colors - .black, // You can customize this - ), - ), - ), - ), - items: [ - "Approval", - "Notification", - "None" - ], - dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5), - ), - ), - dropdownBuilder: - (context, selectedItem) => Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B)), - ), - - onChanged: (String? newValue) { - setState(() { - // Find the country_code based on selected country_name - FirstExceptionalApproverAction[ServiceId!] = - newValue; - - // print("selectedUserType - $selectedUserType"); - - // if (selectedCountry!.isNotEmpty) { - // errorMessages.remove("country_code"); - // } - }); - }, + child: Column( + children: [ + Container( + padding: const EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text( + // "Approver 1", + "A1", + style: GoogleFonts.poppins( + fontSize: 13, ), ), - ), - Spacer(), - GestureDetector( - onTap: () { - setState(() { - SelectedParallelExceptionalProcess[ServiceId!] = - "1"; - }); + Spacer(), + CustomTextFieldUserWrapper( + width: + MediaQuery.of( + context, + ).size.width * + 0.12, + isFocused: false, + isDesktop: widget.isDesktop, + child: SizedBox( + height: 35, + child: DropdownSearch( + selectedItem: + FirstApproverAction[ServiceId], + // enabled: !isViewMode, + popupProps: PopupProps.menu( + // showSearchBox: true, + fit: + FlexFit + .loose, // Allows flexible height + constraints: BoxConstraints( + maxHeight: 250, + ), + itemBuilder: + ( + context, + item, + isSelected, + ) => Padding( + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: GoogleFonts.poppins( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), + ), + ), + items: [ + "Approval", + "Notification", + "None", + ], + dropdownDecoratorProps: + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), + ), + dropdownBuilder: + ( + context, + selectedItem, + ) => Text( + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), - print( - "SelectedParallelExceptionalProcess - $SelectedParallelExceptionalProcess"); - }, - child: Container( + onChanged: (String? newValue) { + setState(() { + // Find the country_code based on selected country_name + FirstApproverAction[ServiceId!] = + newValue; + + // print("selectedUserType - $selectedUserType"); + + // if (selectedCountry!.isNotEmpty) { + // errorMessages.remove("country_code"); + // } + }); + }, + ), + ), + ), + Spacer(), + GestureDetector( + onTap: () { + setState(() { + SelectedParallelProcess[ServiceId!] = + "1"; + }); + + print( + "SelectedParallelProcess - $SelectedParallelProcess", + ); + }, + child: Container( height: 25, width: 25, decoration: BoxDecoration( shape: BoxShape.circle, border: Border.all( - color: (SelectedParallelExceptionalProcess[ - ServiceId] == - "1") - ? Colors.green - : Colors.grey, - width: 2), - ), - child: Icon( - Icons.check_circle, - size: 20, - color: (SelectedParallelExceptionalProcess[ - ServiceId] == - "1") - ? Colors.green - : Colors.grey, - // color: Colors.grey, - )), - ), - ], - ), - ), - Container( - padding: const EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - // "Approver 2", - "A2", - style: GoogleFonts.poppins(fontSize: 13), - ), - Spacer(), - CustomTextFieldUserWrapper( - width:MediaQuery.of(context).size.width * 0.12, - isFocused: false, - isDesktop: widget.isDesktop, - child: SizedBox( - height: 35, - child: DropdownSearch( - selectedItem: - SecondExceptionalApproverAction[ServiceId], - // enabled: !isViewMode, - popupProps: PopupProps.menu( - // showSearchBox: true, - fit: FlexFit - .loose, // Allows flexible height - constraints: - BoxConstraints(maxHeight: 250), - itemBuilder: - (context, item, isSelected) => - Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0), - child: Text( - item, - style: TextStyle( - fontSize: - 12, // 👈 Smaller text size here - color: Colors - .black, // You can customize this - ), - ), - ), - ), - items: [ - "Approval", - "Notification", - "None" - ], - dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5), + color: + (SelectedParallelProcess[ServiceId] == + "1") + ? Colors.green + : Colors.grey, + width: 2, ), ), - dropdownBuilder: - (context, selectedItem) => Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B)), - ), - - onChanged: (String? newValue) { - setState(() { - // Find the country_code based on selected country_name - SecondExceptionalApproverAction[ServiceId!] = - newValue; - - // print("selectedUserType - $selectedUserType"); - - // if (selectedCountry!.isNotEmpty) { - // errorMessages.remove("country_code"); - // } - }); - }, - ), - ), - ), - Spacer(), - GestureDetector( - onTap: () { - setState(() { - SelectedParallelExceptionalProcess[ServiceId!] = - "2"; - }); - - print( - "SelectedParallelExceptionalProcess - $SelectedParallelExceptionalProcess"); - }, - child: Container( - height: 25, - width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: ((SelectedParallelExceptionalProcess[ - ServiceId] == - "1") || - (SelectedParallelExceptionalProcess[ - ServiceId] == - "2")) - ? Colors.green - : Colors.grey, - width: 2), - ), - child: Icon( - Icons.check_circle, - size: 20, - color: ((SelectedParallelExceptionalProcess[ - ServiceId] == - "1") || - (SelectedParallelExceptionalProcess[ - ServiceId] == - "2")) - ? Colors.green - : Colors.grey, - // color: Colors.grey, - )), - ), - ], - ), - ), - Container( - padding: const EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - "A3", - style: GoogleFonts.poppins(fontSize: 13), - ), - Spacer(), - CustomTextFieldUserWrapper( - width:MediaQuery.of(context).size.width * 0.12, - isFocused: false, - isDesktop: widget.isDesktop, - child: SizedBox( - height: 35, - child: DropdownSearch( - selectedItem: - ThirdExceptionalApproverAction[ServiceId], - // enabled: !isViewMode, - popupProps: PopupProps.menu( - // showSearchBox: true, - fit: FlexFit - .loose, // Allows flexible height - constraints: - BoxConstraints(maxHeight: 250), - itemBuilder: - (context, item, isSelected) => - Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0), - child: Text( - item, - style: GoogleFonts.poppins( - fontSize: - 12, // 👈 Smaller text size here - color: Colors - .black, // You can customize this - ), - ), - ), - ), - items: [ - "Approval", - "Notification", - "None" - ], - dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5), - ), - ), - dropdownBuilder: - (context, selectedItem) => - // Center-align selected item - Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B)), - ), - - onChanged: (String? newValue) { - setState(() { - // Find the country_code based on selected country_name - ThirdExceptionalApproverAction[ServiceId!] = - newValue; - - // print("selectedUserType - $selectedUserType"); - - // if (selectedCountry!.isNotEmpty) { - // errorMessages.remove("country_code"); - // } - }); - }, - ), - ), - ), - Spacer(), - GestureDetector( - onTap: () { - setState(() { - SelectedParallelExceptionalProcess[ServiceId!] = - "3"; - }); - print( - "SelectedParallelExceptionalProcess - $SelectedParallelExceptionalProcess[ServiceId]"); - }, - child: Container( - height: 25, - width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: - ((SelectedParallelExceptionalProcess[ - ServiceId] == - "1") || - (SelectedParallelExceptionalProcess[ - ServiceId] == - "2") || - (SelectedParallelExceptionalProcess[ - ServiceId] == - "3")) - ? Colors.green - : Colors.grey, - width: 2), - ), child: Icon( Icons.check_circle, size: 20, color: - ((SelectedParallelExceptionalProcess[ - ServiceId] == - "1") || - (SelectedParallelExceptionalProcess[ - ServiceId] == - "2") || - (SelectedParallelExceptionalProcess[ - ServiceId] == - "3")) - ? Colors.green - : Colors.grey, + (SelectedParallelProcess[ServiceId] == + "1") + ? Colors.green + : Colors.grey, // color: Colors.grey, - )), - ), - ], + ), + ), + ), + ], + ), ), - ), - ]), + Container( + padding: const EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text( + // "Approver 2", + "A2", + style: GoogleFonts.poppins( + fontSize: 13, + ), + ), + Spacer(), + CustomTextFieldUserWrapper( + width: + MediaQuery.of( + context, + ).size.width * + 0.12, + isFocused: false, + isDesktop: widget.isDesktop, + child: SizedBox( + height: 35, + child: DropdownSearch( + selectedItem: + SecondApproverAction[ServiceId], + // enabled: !isViewMode, + popupProps: PopupProps.menu( + // showSearchBox: true, + fit: + FlexFit + .loose, // Allows flexible height + constraints: BoxConstraints( + maxHeight: 250, + ), + itemBuilder: + ( + context, + item, + isSelected, + ) => Padding( + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: TextStyle( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), + ), + ), + items: [ + "Approval", + "Notification", + "None", + ], + dropdownDecoratorProps: + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), + ), + dropdownBuilder: + ( + context, + selectedItem, + ) => Text( + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), + + onChanged: (String? newValue) { + setState(() { + // Find the country_code based on selected country_name + SecondApproverAction[ServiceId!] = + newValue; + + // print("selectedUserType - $selectedUserType"); + + // if (selectedCountry!.isNotEmpty) { + // errorMessages.remove("country_code"); + // } + }); + }, + ), + ), + ), + Spacer(), + GestureDetector( + onTap: () { + setState(() { + SelectedParallelProcess[ServiceId!] = + "2"; + }); + + print( + "SelectedParallelProcess - $SelectedParallelProcess", + ); + }, + child: Container( + height: 25, + width: 25, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all( + color: + ((SelectedParallelProcess[ServiceId] == + "1") || + (SelectedParallelProcess[ServiceId] == + "2")) + ? Colors.green + : Colors.grey, + width: 2, + ), + ), + child: Icon( + Icons.check_circle, + size: 20, + color: + ((SelectedParallelProcess[ServiceId] == + "1") || + (SelectedParallelProcess[ServiceId] == + "2")) + ? Colors.green + : Colors.grey, + // color: Colors.grey, + ), + ), + ), + ], + ), + ), + Container( + padding: const EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text( + "A3", + style: GoogleFonts.poppins( + fontSize: 13, + ), + ), + Spacer(), + CustomTextFieldUserWrapper( + width: + MediaQuery.of( + context, + ).size.width * + 0.12, + isFocused: false, + isDesktop: widget.isDesktop, + child: SizedBox( + height: 35, + child: DropdownSearch( + selectedItem: + ThirdApproverAction[ServiceId], + // enabled: !isViewMode, + popupProps: PopupProps.menu( + // showSearchBox: true, + fit: + FlexFit + .loose, // Allows flexible height + constraints: BoxConstraints( + maxHeight: 250, + ), + itemBuilder: + ( + context, + item, + isSelected, + ) => Padding( + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: GoogleFonts.poppins( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), + ), + ), + items: [ + "Approval", + "Notification", + "None", + ], + dropdownDecoratorProps: + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), + ), + dropdownBuilder: + (context, selectedItem) => + // Center-align selected item + Text( + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), + + onChanged: (String? newValue) { + setState(() { + // Find the country_code based on selected country_name + ThirdApproverAction[ServiceId!] = + newValue; + + // print("selectedUserType - $selectedUserType"); + + // if (selectedCountry!.isNotEmpty) { + // errorMessages.remove("country_code"); + // } + }); + }, + ), + ), + ), + Spacer(), + GestureDetector( + onTap: () { + setState(() { + SelectedParallelProcess[ServiceId!] = + "3"; + }); + print( + "SelectedParallelProcess - $SelectedParallelProcess[ServiceId]", + ); + }, + child: Container( + height: 25, + width: 25, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all( + color: + ((SelectedParallelProcess[ServiceId] == + "1") || + (SelectedParallelProcess[ServiceId] == + "2") || + (SelectedParallelProcess[ServiceId] == + "3")) + ? Colors.green + : Colors.grey, + width: 2, + ), + ), + child: Icon( + Icons.check_circle, + size: 20, + color: + ((SelectedParallelProcess[ServiceId] == + "1") || + (SelectedParallelProcess[ServiceId] == + "2") || + (SelectedParallelProcess[ServiceId] == + "3")) + ? Colors.green + : Colors.grey, + // color: Colors.grey, + ), + ), + ), + ], + ), + ), + ], + ), ), ), ], ), - ), - ], ), + Column( // mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Container( - //color: Colors.grey.shade100, - width: widget.isDesktop - ? MediaQuery.of(context).size.width * 0.18 - : 600, - height: widget.isDesktop - ? MediaQuery.of(context).size.height * 0.56 - : null, - child: - Column( + width: + widget.isDesktop + ? MediaQuery.of(context).size.width * 0.18 + : 600, + height: + widget.isDesktop + ? MediaQuery.of(context).size.height * 0.56 + : null, + child: Column( children: [ Container( margin: const EdgeInsets.only(right: 0), @@ -1537,22 +1142,28 @@ setState(() { // ), ), padding: const EdgeInsets.only( - top: 10, bottom: 0, left: 0, right: 35), + top: 10, + bottom: 0, + left: 0, + right: 35, + ), child: Row( - mainAxisAlignment: widget.isDesktop - ? MainAxisAlignment.spaceAround - : MainAxisAlignment.spaceBetween, + mainAxisAlignment: + widget.isDesktop + ? MainAxisAlignment.spaceAround + : MainAxisAlignment.spaceBetween, children: [ Expanded( flex: 3, child: Align( alignment: Alignment.center, child: Text( - "Amendment Approver", + "Exceptional Approval", style: GoogleFonts.poppins( - color: Color(0xFF9E9DBD), - fontWeight: FontWeight.bold, - fontSize: 12), + color: Color(0xFF9E9DBD), + fontWeight: FontWeight.bold, + fontSize: 12, + ), ), ), ), @@ -1576,10 +1187,553 @@ setState(() { ], ), ), - Divider( - thickness: 0.2, - color: Colors.grey, + Divider(thickness: 0.2, color: Colors.grey), + SizedBox( + // height: 180, + + // scrollDirection: Axis.vertical, + child: Container( + // height: MediaQuery.of(context).size.height * 3, + // color: Colors.grey, + decoration: BoxDecoration( + border: Border( + right: BorderSide( + color: + Colors + .blueGrey + .shade50, // Change this to your desired color + width: + 1.0, // Change this to your desired width + ), + ), + ), + margin: const EdgeInsets.only(right: 5, left: 0), + // color: Colors.grey.shade100, + child: Column( + children: [ + Container( + padding: const EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text( + // "Approver 1", + "A1", + style: GoogleFonts.poppins( + fontSize: 13, + ), + ), + Spacer(), + CustomTextFieldUserWrapper( + width: + MediaQuery.of( + context, + ).size.width * + 0.12, + isFocused: false, + isDesktop: widget.isDesktop, + child: SizedBox( + height: 35, + child: DropdownSearch( + selectedItem: + FirstExceptionalApproverAction[ServiceId], + // enabled: !isViewMode, + popupProps: PopupProps.menu( + // showSearchBox: true, + fit: + FlexFit + .loose, // Allows flexible height + constraints: BoxConstraints( + maxHeight: 250, + ), + itemBuilder: + ( + context, + item, + isSelected, + ) => Padding( + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: GoogleFonts.poppins( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), + ), + ), + items: [ + "Approval", + "Notification", + "None", + ], + dropdownDecoratorProps: + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), + ), + dropdownBuilder: + ( + context, + selectedItem, + ) => Text( + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), + + onChanged: (String? newValue) { + setState(() { + // Find the country_code based on selected country_name + FirstExceptionalApproverAction[ServiceId!] = + newValue; + + // print("selectedUserType - $selectedUserType"); + + // if (selectedCountry!.isNotEmpty) { + // errorMessages.remove("country_code"); + // } + }); + }, + ), + ), + ), + Spacer(), + GestureDetector( + onTap: () { + setState(() { + SelectedParallelExceptionalProcess[ServiceId!] = + "1"; + }); + + print( + "SelectedParallelExceptionalProcess - $SelectedParallelExceptionalProcess", + ); + }, + child: Container( + height: 25, + width: 25, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all( + color: + (SelectedParallelExceptionalProcess[ServiceId] == + "1") + ? Colors.green + : Colors.grey, + width: 2, + ), + ), + child: Icon( + Icons.check_circle, + size: 20, + color: + (SelectedParallelExceptionalProcess[ServiceId] == + "1") + ? Colors.green + : Colors.grey, + // color: Colors.grey, + ), + ), + ), + ], + ), + ), + Container( + padding: const EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text( + // "Approver 2", + "A2", + style: GoogleFonts.poppins( + fontSize: 13, + ), + ), + Spacer(), + CustomTextFieldUserWrapper( + width: + MediaQuery.of( + context, + ).size.width * + 0.12, + isFocused: false, + isDesktop: widget.isDesktop, + child: SizedBox( + height: 35, + child: DropdownSearch( + selectedItem: + SecondExceptionalApproverAction[ServiceId], + // enabled: !isViewMode, + popupProps: PopupProps.menu( + // showSearchBox: true, + fit: + FlexFit + .loose, // Allows flexible height + constraints: BoxConstraints( + maxHeight: 250, + ), + itemBuilder: + ( + context, + item, + isSelected, + ) => Padding( + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: TextStyle( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), + ), + ), + items: [ + "Approval", + "Notification", + "None", + ], + dropdownDecoratorProps: + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), + ), + dropdownBuilder: + ( + context, + selectedItem, + ) => Text( + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), + + onChanged: (String? newValue) { + setState(() { + // Find the country_code based on selected country_name + SecondExceptionalApproverAction[ServiceId!] = + newValue; + + // print("selectedUserType - $selectedUserType"); + + // if (selectedCountry!.isNotEmpty) { + // errorMessages.remove("country_code"); + // } + }); + }, + ), + ), + ), + Spacer(), + GestureDetector( + onTap: () { + setState(() { + SelectedParallelExceptionalProcess[ServiceId!] = + "2"; + }); + + print( + "SelectedParallelExceptionalProcess - $SelectedParallelExceptionalProcess", + ); + }, + child: Container( + height: 25, + width: 25, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all( + color: + ((SelectedParallelExceptionalProcess[ServiceId] == + "1") || + (SelectedParallelExceptionalProcess[ServiceId] == + "2")) + ? Colors.green + : Colors.grey, + width: 2, + ), + ), + child: Icon( + Icons.check_circle, + size: 20, + color: + ((SelectedParallelExceptionalProcess[ServiceId] == + "1") || + (SelectedParallelExceptionalProcess[ServiceId] == + "2")) + ? Colors.green + : Colors.grey, + // color: Colors.grey, + ), + ), + ), + ], + ), + ), + Container( + padding: const EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text( + "A3", + style: GoogleFonts.poppins( + fontSize: 13, + ), + ), + Spacer(), + CustomTextFieldUserWrapper( + width: + MediaQuery.of( + context, + ).size.width * + 0.12, + isFocused: false, + isDesktop: widget.isDesktop, + child: SizedBox( + height: 35, + child: DropdownSearch( + selectedItem: + ThirdExceptionalApproverAction[ServiceId], + // enabled: !isViewMode, + popupProps: PopupProps.menu( + // showSearchBox: true, + fit: + FlexFit + .loose, // Allows flexible height + constraints: BoxConstraints( + maxHeight: 250, + ), + itemBuilder: + ( + context, + item, + isSelected, + ) => Padding( + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: GoogleFonts.poppins( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), + ), + ), + items: [ + "Approval", + "Notification", + "None", + ], + dropdownDecoratorProps: + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), + ), + dropdownBuilder: + (context, selectedItem) => + // Center-align selected item + Text( + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), + + onChanged: (String? newValue) { + setState(() { + // Find the country_code based on selected country_name + ThirdExceptionalApproverAction[ServiceId!] = + newValue; + + // print("selectedUserType - $selectedUserType"); + + // if (selectedCountry!.isNotEmpty) { + // errorMessages.remove("country_code"); + // } + }); + }, + ), + ), + ), + Spacer(), + GestureDetector( + onTap: () { + setState(() { + SelectedParallelExceptionalProcess[ServiceId!] = + "3"; + }); + print( + "SelectedParallelExceptionalProcess - $SelectedParallelExceptionalProcess[ServiceId]", + ); + }, + child: Container( + height: 25, + width: 25, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all( + color: + ((SelectedParallelExceptionalProcess[ServiceId] == + "1") || + (SelectedParallelExceptionalProcess[ServiceId] == + "2") || + (SelectedParallelExceptionalProcess[ServiceId] == + "3")) + ? Colors.green + : Colors.grey, + width: 2, + ), + ), + child: Icon( + Icons.check_circle, + size: 20, + color: + ((SelectedParallelExceptionalProcess[ServiceId] == + "1") || + (SelectedParallelExceptionalProcess[ServiceId] == + "2") || + (SelectedParallelExceptionalProcess[ServiceId] == + "3")) + ? Colors.green + : Colors.grey, + // color: Colors.grey, + ), + ), + ), + ], + ), + ), + ], + ), + ), ), + ], + ), + ), + ], + ), + Column( + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Container( + //color: Colors.grey.shade100, + width: + widget.isDesktop + ? MediaQuery.of(context).size.width * 0.18 + : 600, + height: + widget.isDesktop + ? MediaQuery.of(context).size.height * 0.56 + : null, + child: Column( + children: [ + Container( + margin: const EdgeInsets.only(right: 0), + decoration: BoxDecoration( + // color: Colors.grey.shade100, + // border: Border.all( + // color: Colors.grey.shade100, + // ), + ), + padding: const EdgeInsets.only( + top: 10, + bottom: 0, + left: 0, + right: 35, + ), + child: Row( + mainAxisAlignment: + widget.isDesktop + ? MainAxisAlignment.spaceAround + : MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 3, + child: Align( + alignment: Alignment.center, + child: Text( + "Amendment Approval", + style: GoogleFonts.poppins( + color: Color(0xFF9E9DBD), + fontWeight: FontWeight.bold, + fontSize: 12, + ), + ), + ), + ), + // Expanded( + // flex: 2, + // child: Text( + // "Actions", + // style: GoogleFonts.poppins( + // color: Color(0xFF9E9DBD), + // fontWeight: FontWeight.bold, + // fontSize: 12), + // ), + // ), + // Text( + // "Parallel Action", + // style: GoogleFonts.poppins( + // color: Color(0xFF9E9DBD), + // fontWeight: FontWeight.bold, + // fontSize: 12), + // ) + ], + ), + ), + Divider(thickness: 0.2, color: Colors.grey), SizedBox( // height: 180, @@ -1589,404 +1743,459 @@ setState(() { // color: Colors.grey, margin: const EdgeInsets.only(right: 5, left: 0), // color: Colors.grey.shade100, - child: Column(children: [ - Container( - padding: const EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - // "Approver 1", - "A1", - style: GoogleFonts.poppins(fontSize: 13), - ), - Spacer(), - CustomTextFieldUserWrapper( - width:MediaQuery.of(context).size.width * 0.12, - isFocused: false, - isDesktop: widget.isDesktop, - child: SizedBox( - height: 35, - child: DropdownSearch( - selectedItem: - FirstAmendApproverAction[ServiceId], - // enabled: !isViewMode, - popupProps: PopupProps.menu( - // showSearchBox: true, - fit: FlexFit - .loose, // Allows flexible height - constraints: - BoxConstraints(maxHeight: 250), - itemBuilder: - (context, item, isSelected) => - Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0), - child: Text( - item, - style: GoogleFonts.poppins( - fontSize: - 12, // 👈 Smaller text size here - color: Colors - .black, // You can customize this - ), - ), - ), - ), - items: [ - "Approval", - "Notification", - "None" - ], - dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5), - ), - ), - dropdownBuilder: - (context, selectedItem) => Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B)), - ), - - onChanged: (String? newValue) { - setState(() { - // Find the country_code based on selected country_name - FirstAmendApproverAction[ServiceId!] = - newValue; - - // print("selectedUserType - $selectedUserType"); - - // if (selectedCountry!.isNotEmpty) { - // errorMessages.remove("country_code"); - // } - }); - }, + child: Column( + children: [ + Container( + padding: const EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text( + // "Approver 1", + "A1", + style: GoogleFonts.poppins( + fontSize: 13, ), ), - ), - Spacer(), - GestureDetector( - onTap: () { - setState(() { - SelectedParallelAmendProcess[ServiceId!] = - "1"; - }); + Spacer(), + CustomTextFieldUserWrapper( + width: + MediaQuery.of( + context, + ).size.width * + 0.12, + isFocused: false, + isDesktop: widget.isDesktop, + child: SizedBox( + height: 35, + child: DropdownSearch( + selectedItem: + FirstAmendApproverAction[ServiceId], + // enabled: !isViewMode, + popupProps: PopupProps.menu( + // showSearchBox: true, + fit: + FlexFit + .loose, // Allows flexible height + constraints: BoxConstraints( + maxHeight: 250, + ), + itemBuilder: + ( + context, + item, + isSelected, + ) => Padding( + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: GoogleFonts.poppins( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), + ), + ), + items: [ + "Approval", + "Notification", + "None", + ], + dropdownDecoratorProps: + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), + ), + dropdownBuilder: + ( + context, + selectedItem, + ) => Text( + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), - print( - "SelectedParallelAmendProcess - $SelectedParallelAmendProcess"); - }, - child: Container( + onChanged: (String? newValue) { + setState(() { + // Find the country_code based on selected country_name + FirstAmendApproverAction[ServiceId!] = + newValue; + + // print("selectedUserType - $selectedUserType"); + + // if (selectedCountry!.isNotEmpty) { + // errorMessages.remove("country_code"); + // } + }); + }, + ), + ), + ), + Spacer(), + GestureDetector( + onTap: () { + setState(() { + SelectedParallelAmendProcess[ServiceId!] = + "1"; + }); + + print( + "SelectedParallelAmendProcess - $SelectedParallelAmendProcess", + ); + }, + child: Container( height: 25, width: 25, decoration: BoxDecoration( shape: BoxShape.circle, border: Border.all( - color: (SelectedParallelAmendProcess[ - ServiceId] == - "1") - ? Colors.green - : Colors.grey, - width: 2), - ), - child: Icon( - Icons.check_circle, - size: 20, - color: (SelectedParallelAmendProcess[ - ServiceId] == - "1") - ? Colors.green - : Colors.grey, - // color: Colors.grey, - )), - ), - ], - ), - ), - Container( - padding: const EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - // "Approver 2", - "A2", - style: GoogleFonts.poppins(fontSize: 13), - ), - Spacer(), - CustomTextFieldUserWrapper( - width:MediaQuery.of(context).size.width * 0.12, - isFocused: false, - isDesktop: widget.isDesktop, - child: SizedBox( - height: 35, - child: DropdownSearch( - selectedItem: - SecondAmendApproverAction[ServiceId], - // enabled: !isViewMode, - popupProps: PopupProps.menu( - // showSearchBox: true, - fit: FlexFit - .loose, // Allows flexible height - constraints: - BoxConstraints(maxHeight: 250), - itemBuilder: - (context, item, isSelected) => - Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0), - child: Text( - item, - style: TextStyle( - fontSize: - 12, // 👈 Smaller text size here - color: Colors - .black, // You can customize this - ), - ), - ), - ), - items: [ - "Approval", - "Notification", - "None" - ], - dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5), + color: + (SelectedParallelAmendProcess[ServiceId] == + "1") + ? Colors.green + : Colors.grey, + width: 2, ), ), - dropdownBuilder: - (context, selectedItem) => Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B)), - ), - - onChanged: (String? newValue) { - setState(() { - // Find the country_code based on selected country_name - SecondAmendApproverAction[ServiceId!] = - newValue; - - // print("selectedUserType - $selectedUserType"); - - // if (selectedCountry!.isNotEmpty) { - // errorMessages.remove("country_code"); - // } - }); - }, - ), - ), - ), - Spacer(), - GestureDetector( - onTap: () { - setState(() { - SelectedParallelAmendProcess[ServiceId!] = - "2"; - }); - - print( - "SelectedParallelAmendProcess - $SelectedParallelAmendProcess"); - }, - child: Container( - height: 25, - width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: ((SelectedParallelAmendProcess[ - ServiceId] == - "1") || - (SelectedParallelAmendProcess[ - ServiceId] == - "2")) - ? Colors.green - : Colors.grey, - width: 2), - ), - child: Icon( - Icons.check_circle, - size: 20, - color: ((SelectedParallelAmendProcess[ - ServiceId] == - "1") || - (SelectedParallelAmendProcess[ - ServiceId] == - "2")) - ? Colors.green - : Colors.grey, - // color: Colors.grey, - )), - ), - ], - ), - ), - Container( - padding: const EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - "A3", - style: GoogleFonts.poppins(fontSize: 13), - ), - Spacer(), - CustomTextFieldUserWrapper( - width:MediaQuery.of(context).size.width * 0.12, - isFocused: false, - isDesktop: widget.isDesktop, - child: SizedBox( - height: 35, - child: DropdownSearch( - selectedItem: - ThirdAmendApproverAction[ServiceId], - // enabled: !isViewMode, - popupProps: PopupProps.menu( - // showSearchBox: true, - fit: FlexFit - .loose, // Allows flexible height - constraints: - BoxConstraints(maxHeight: 250), - itemBuilder: - (context, item, isSelected) => - Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0), - child: Text( - item, - style: GoogleFonts.poppins( - fontSize: - 12, // 👈 Smaller text size here - color: Colors - .black, // You can customize this - ), - ), - ), - ), - items: [ - "Approval", - "Notification", - "None" - ], - dropdownDecoratorProps: - DropDownDecoratorProps( - dropdownSearchDecoration: - InputDecoration( - border: InputBorder.none, - contentPadding: - EdgeInsets.symmetric( - horizontal: 1, - vertical: 5), - ), - ), - dropdownBuilder: - (context, selectedItem) => - // Center-align selected item - Text( - selectedItem ?? "Select", - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFF114D8B)), - ), - - onChanged: (String? newValue) { - setState(() { - // Find the country_code based on selected country_name - ThirdAmendApproverAction[ServiceId!] = - newValue; - - // print("selectedUserType - $selectedUserType"); - - // if (selectedCountry!.isNotEmpty) { - // errorMessages.remove("country_code"); - // } - }); - }, - ), - ), - ), - Spacer(), - GestureDetector( - onTap: () { - setState(() { - SelectedParallelAmendProcess[ServiceId!] = - "3"; - }); - print( - "SelectedParallelAmendProcess - $SelectedParallelAmendProcess[ServiceId]"); - }, - child: Container( - height: 25, - width: 25, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: - ((SelectedParallelAmendProcess[ - ServiceId] == - "1") || - (SelectedParallelAmendProcess[ - ServiceId] == - "2") || - (SelectedParallelAmendProcess[ - ServiceId] == - "3")) - ? Colors.green - : Colors.grey, - width: 2), - ), child: Icon( Icons.check_circle, size: 20, color: - ((SelectedParallelAmendProcess[ - ServiceId] == - "1") || - (SelectedParallelAmendProcess[ - ServiceId] == - "2") || - (SelectedParallelAmendProcess[ - ServiceId] == - "3")) - ? Colors.green - : Colors.grey, + (SelectedParallelAmendProcess[ServiceId] == + "1") + ? Colors.green + : Colors.grey, // color: Colors.grey, - )), - ), - ], + ), + ), + ), + ], + ), ), - ), - ]), + Container( + padding: const EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text( + // "Approver 2", + "A2", + style: GoogleFonts.poppins( + fontSize: 13, + ), + ), + Spacer(), + CustomTextFieldUserWrapper( + width: + MediaQuery.of( + context, + ).size.width * + 0.12, + isFocused: false, + isDesktop: widget.isDesktop, + child: SizedBox( + height: 35, + child: DropdownSearch( + selectedItem: + SecondAmendApproverAction[ServiceId], + // enabled: !isViewMode, + popupProps: PopupProps.menu( + // showSearchBox: true, + fit: + FlexFit + .loose, // Allows flexible height + constraints: BoxConstraints( + maxHeight: 250, + ), + itemBuilder: + ( + context, + item, + isSelected, + ) => Padding( + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: TextStyle( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), + ), + ), + items: [ + "Approval", + "Notification", + "None", + ], + dropdownDecoratorProps: + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), + ), + dropdownBuilder: + ( + context, + selectedItem, + ) => Text( + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), + + onChanged: (String? newValue) { + setState(() { + // Find the country_code based on selected country_name + SecondAmendApproverAction[ServiceId!] = + newValue; + + // print("selectedUserType - $selectedUserType"); + + // if (selectedCountry!.isNotEmpty) { + // errorMessages.remove("country_code"); + // } + }); + }, + ), + ), + ), + Spacer(), + GestureDetector( + onTap: () { + setState(() { + SelectedParallelAmendProcess[ServiceId!] = + "2"; + }); + + print( + "SelectedParallelAmendProcess - $SelectedParallelAmendProcess", + ); + }, + child: Container( + height: 25, + width: 25, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all( + color: + ((SelectedParallelAmendProcess[ServiceId] == + "1") || + (SelectedParallelAmendProcess[ServiceId] == + "2")) + ? Colors.green + : Colors.grey, + width: 2, + ), + ), + child: Icon( + Icons.check_circle, + size: 20, + color: + ((SelectedParallelAmendProcess[ServiceId] == + "1") || + (SelectedParallelAmendProcess[ServiceId] == + "2")) + ? Colors.green + : Colors.grey, + // color: Colors.grey, + ), + ), + ), + ], + ), + ), + Container( + padding: const EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text( + "A3", + style: GoogleFonts.poppins( + fontSize: 13, + ), + ), + Spacer(), + CustomTextFieldUserWrapper( + width: + MediaQuery.of( + context, + ).size.width * + 0.12, + isFocused: false, + isDesktop: widget.isDesktop, + child: SizedBox( + height: 35, + child: DropdownSearch( + selectedItem: + ThirdAmendApproverAction[ServiceId], + // enabled: !isViewMode, + popupProps: PopupProps.menu( + // showSearchBox: true, + fit: + FlexFit + .loose, // Allows flexible height + constraints: BoxConstraints( + maxHeight: 250, + ), + itemBuilder: + ( + context, + item, + isSelected, + ) => Padding( + padding: + const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), + child: Text( + item, + style: GoogleFonts.poppins( + fontSize: + 12, // 👈 Smaller text size here + color: + Colors + .black, // You can customize this + ), + ), + ), + ), + items: [ + "Approval", + "Notification", + "None", + ], + dropdownDecoratorProps: + DropDownDecoratorProps( + dropdownSearchDecoration: + InputDecoration( + border: + InputBorder.none, + contentPadding: + EdgeInsets.symmetric( + horizontal: 1, + vertical: 5, + ), + ), + ), + dropdownBuilder: + (context, selectedItem) => + // Center-align selected item + Text( + selectedItem ?? "Select", + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFF114D8B), + ), + ), + + onChanged: (String? newValue) { + setState(() { + // Find the country_code based on selected country_name + ThirdAmendApproverAction[ServiceId!] = + newValue; + + // print("selectedUserType - $selectedUserType"); + + // if (selectedCountry!.isNotEmpty) { + // errorMessages.remove("country_code"); + // } + }); + }, + ), + ), + ), + Spacer(), + GestureDetector( + onTap: () { + setState(() { + SelectedParallelAmendProcess[ServiceId!] = + "3"; + }); + print( + "SelectedParallelAmendProcess - $SelectedParallelAmendProcess[ServiceId]", + ); + }, + child: Container( + height: 25, + width: 25, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all( + color: + ((SelectedParallelAmendProcess[ServiceId] == + "1") || + (SelectedParallelAmendProcess[ServiceId] == + "2") || + (SelectedParallelAmendProcess[ServiceId] == + "3")) + ? Colors.green + : Colors.grey, + width: 2, + ), + ), + child: Icon( + Icons.check_circle, + size: 20, + color: + ((SelectedParallelAmendProcess[ServiceId] == + "1") || + (SelectedParallelAmendProcess[ServiceId] == + "2") || + (SelectedParallelAmendProcess[ServiceId] == + "3")) + ? Colors.green + : Colors.grey, + // color: Colors.grey, + ), + ), + ), + ], + ), + ), + ], + ), ), ), ], ), - ), - ], ), ], @@ -2005,26 +2214,34 @@ setState(() { // : (apiDataForClass?['train_class'] ?? []); // } - - if (ServiceIndxId != null) { - purposeList = (ServiceIndxId == "1") - ? (apiDataForClass?['flight_class'] ?? []) - : (ServiceIndxId == "2") - ? (apiDataForClass?['hotel_class'] ?? []) - : (apiDataForClass?['train_class'] ?? []); + purposeList = + (ServiceIndxId == "1") + ? (apiDataForClass?['flight_class'] ?? []) + : (ServiceIndxId == "2") + ? (apiDataForClass?['hotel_class'] ?? []) + : (apiDataForClass?['train_class'] ?? []); } - print("CLASSServiceId- $ServiceId"); print("CLASSpurposeList - $purposeList"); - List> dropdownItems = purposeList - .map((item) => DropdownMenuItem( - value: item['dropdown_key'], - child: Text(item['dropdown_value']), - )) - .toList(); + // ✅ Sort by dropdown_key + purposeList.sort((a, b) { + int aKey = int.tryParse(a['dropdown_key'].toString()) ?? 0; + int bKey = int.tryParse(b['dropdown_key'].toString()) ?? 0; + return aKey.compareTo(bKey); + }); + + List> dropdownItems = + purposeList + .map( + (item) => DropdownMenuItem( + value: item['dropdown_key'], + child: Text(item['dropdown_value']), + ), + ) + .toList(); print("CLASS 2 - "); @@ -2032,8 +2249,10 @@ setState(() { dropdownItems.add( DropdownMenuItem( value: null, - child: Text("No options available", - style: GoogleFonts.poppins(color: Colors.grey)), + child: Text( + "No options available", + style: GoogleFonts.poppins(color: Colors.grey), + ), ), ); } @@ -2067,59 +2286,146 @@ setState(() { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text("Class", - style: GoogleFonts.poppins( - fontSize: 12, - // fontWeight: FontWeight.w200, - color: Colors.black)), + Text( + "Class", + style: GoogleFonts.poppins( + fontSize: 12, + // fontWeight: FontWeight.w200, + color: Colors.black, + ), + ), SizedBox(height: 5), + + // CustomTextFieldUserWrapper( + // isFocused: false, + // isDesktop: widget.isDesktop, + // + // child: SizedBox( + // height: 40, + // child: ServiceId != null && (isLoading || dropdownItems.isEmpty) + // ? const Center(child: CircularProgressIndicator()) + // : DropdownButtonFormField( + // // Assign the correct focus node + // // controller: _hotelNameController, + // value: classAction[ServiceId], + // + // style: GoogleFonts.poppins(fontSize: 12), + // decoration: InputDecoration( + // hintText: "Select", + // hintStyle: GoogleFonts.poppins(fontSize: 12), + // border: InputBorder.none, + // contentPadding: EdgeInsets.symmetric( + // horizontal: 10), // Proper padding + // ), + // onChanged: (newValue) { + // if (ServiceId != null && newValue != null) { + // setState(() { + // classAction[ServiceId!] = newValue; + // }); + // } + // }, + // + // items: dropdownItems, + // ), + // ), + // ), CustomTextFieldUserWrapper( isFocused: false, - isDesktop: widget.isDesktop, - // child: SizedBox( - // height: 40, - // child: TextField( - // style: TextStyle(fontSize: 12), - // // controller: classController[ServiceId], - // // enabled: !isViewMode, - // onChanged: (value) {}, - // decoration: InputDecoration( - // labelText: "Class", - // labelStyle: TextStyle(fontSize: 12, color: Colors.grey), - // floatingLabelBehavior: FloatingLabelBehavior.never, - // border: InputBorder.none, - // contentPadding: EdgeInsets.symmetric(vertical: 16), - // ), - // ), - // ), - + isDesktop: isDesktop, child: SizedBox( height: 40, - child: ServiceId != null && (isLoading || dropdownItems.isEmpty) - ? const Center(child: CircularProgressIndicator()) - : DropdownButtonFormField( - // Assign the correct focus node - // controller: _hotelNameController, - value: classAction[ServiceId], + width: double.infinity, + child: + ServiceId != null && (isLoading || dropdownItems.isEmpty) + ? const Center(child: CircularProgressIndicator()) + : DropdownSearch>( + key: + classAction[ServiceId!] == null + ? UniqueKey() + : ValueKey(classAction[ServiceId!]), + items: purposeList.cast>(), - style: GoogleFonts.poppins(fontSize: 12), - decoration: InputDecoration( - hintText: "Select", - hintStyle: GoogleFonts.poppins(fontSize: 12), - border: InputBorder.none, - contentPadding: EdgeInsets.symmetric( - horizontal: 10), // Proper padding + // selectedItem: purposeList.firstWhere( + // (item) => item['dropdown_key'] == selectedClass, + // orElse: () => {}, + // ), + selectedItem: + classAction[ServiceId!] != null + ? purposeList.firstWhere( + (item) => + item['dropdown_key'] == + classAction[ServiceId!], + orElse: () => {}, + ) + : null, + itemAsString: (item) => item['dropdown_value'] ?? '', + popupProps: PopupProps.menu( + showSearchBox: false, + fit: FlexFit.loose, + menuProps: const MenuProps( + backgroundColor: Colors.white, + ), + itemBuilder: (context, item, isSelected) { + final bool isNotAllowed = + item['is_allowed'] == 'No'; + return Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, + ), + child: Text( + item['dropdown_value'] ?? '', + style: GoogleFonts.poppins( + fontSize: 12, + color: + isNotAllowed + ? Colors.redAccent + : Colors.black, + ), + ), + ); + }, + ), + dropdownDecoratorProps: const DropDownDecoratorProps( + dropdownSearchDecoration: InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), + ), + ), + dropdownBuilder: (context, selectedItem) { + if (selectedItem == null || selectedItem.isEmpty) { + return Text( + "Select ", + style: GoogleFonts.poppins( + color: Colors.grey, + fontSize: 13, + ), + ); + } + return Text( + selectedItem['dropdown_value'] ?? '', + style: GoogleFonts.poppins( + fontSize: 12, + color: Colors.black, + ), + ); + }, + onChanged: + purposeList.isNotEmpty + ? (Map? newValue) async { + setState(() { + classAction[ServiceId!] = + newValue?['dropdown_key']; + print( + "Selected Purpose: ${classAction[ServiceId!]}", + ); + }); + } + : null, ), - onChanged: (newValue) { - if (ServiceId != null && newValue != null) { - setState(() { - classAction[ServiceId!] = newValue; - }); - } - }, - - items: dropdownItems, - ), ), ), ], @@ -2134,11 +2440,14 @@ setState(() { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text("Cost", - style: GoogleFonts.poppins( - fontSize: 12, - // fontWeight: FontWeight.w200, - color: Colors.black)), + Text( + "Cost", + style: GoogleFonts.poppins( + fontSize: 12, + // fontWeight: FontWeight.w200, + color: Colors.black, + ), + ), SizedBox(height: 5), CustomTextFieldUserWrapper( isFocused: false, @@ -2154,8 +2463,10 @@ setState(() { }, decoration: InputDecoration( labelText: "Cost", - labelStyle: - GoogleFonts.poppins(fontSize: 12, color: Colors.grey), + labelStyle: GoogleFonts.poppins( + fontSize: 12, + color: Colors.grey, + ), floatingLabelBehavior: FloatingLabelBehavior.never, border: InputBorder.none, contentPadding: EdgeInsets.symmetric(vertical: 16), diff --git a/lib/Screens/userManagement/create_user/office_details.dart b/lib/Screens/userManagement/create_user/office_details.dart index 49b1fd2..7457a87 100644 --- a/lib/Screens/userManagement/create_user/office_details.dart +++ b/lib/Screens/userManagement/create_user/office_details.dart @@ -76,6 +76,7 @@ class _OfficeDetailsState extends State { late Future> futureUsers; List? resolvedUserData; + // String? userIdsApi; late List userIdsApi; late List groupIdsApi; late Map userMap; @@ -169,7 +170,7 @@ class _OfficeDetailsState extends State { label, field, value, - userId, + userId ?? "", ); if (response.isNotEmpty) { _clearError(field); @@ -224,6 +225,7 @@ class _OfficeDetailsState extends State { Future fetchUsers() async { try { + print("Test Users"); List users = await apiService.fetchUsers(); setState(() { // apiUserData = users; @@ -249,10 +251,12 @@ class _OfficeDetailsState extends State { Future fetchDepartment() async { try { + print("Test department"); List department = await apiService.fetchDepartmentCostCenter(); setState(() { apiCostData = department; }); + print("Test department Completeed- $apiCostData"); } catch (e) { print('Error fetching department list: $e'); } @@ -260,6 +264,7 @@ class _OfficeDetailsState extends State { Future fetchFindGroup() async { try { + print("Test Groups"); final result = await apiService.fetchAllGroup(); setState(() { apiAllGroups = result; @@ -430,14 +435,17 @@ class _OfficeDetailsState extends State { child: TextField( style: GoogleFonts.poppins(fontSize: 12, color: Colors.black), controller: widget.controllers["employeeCode"], + enabled: !widget.isViewMode, onChanged: (value) { _clearError("employee_code"); + + final updaterUserId = widget.userIdApi ?? ""; apiCheckDuplicate( "Employee Code", "employee_code", value, - widget.userIdApi, + updaterUserId, ); }, decoration: InputDecoration( @@ -526,7 +534,11 @@ class _OfficeDetailsState extends State { // Map department_id to department_name Map departmentMap = { for (var item in apiCostData ?? []) - item['department_id'] as String: item['name'] as String, + if (item['dropdown_key'] != null && + item['dropdown_value'] != null && + int.tryParse(item['dropdown_key'].toString()) != 5) + item['dropdown_key'].toString(): item['dropdown_value'].toString(), + // item['department_id'] as String: item['name'] as String, }; return Column(