diff --git a/lib/views/branch_management/branch/branch_detail_page.dart b/lib/views/branch_management/branch/branch_detail_page.dart index ac282fe..f729996 100644 --- a/lib/views/branch_management/branch/branch_detail_page.dart +++ b/lib/views/branch_management/branch/branch_detail_page.dart @@ -330,6 +330,7 @@ class BranchDetailPage extends StatelessWidget { arguments: CreateBranchModel( branchId: branchData.id.toString(), branchName: branchData.branchName.toString(), + isForEdit: false, ), ); }), diff --git a/lib/views/branch_management/services/create_services_page3.dart b/lib/views/branch_management/services/create_services_page3.dart index 024b6f3..2cbdf35 100644 --- a/lib/views/branch_management/services/create_services_page3.dart +++ b/lib/views/branch_management/services/create_services_page3.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:developer'; import 'package:mc_common_app/generated/locale_keys.g.dart'; import 'package:mc_common_app/models/general_models/generic_resp_model.dart'; import 'package:mc_common_app/utils/navigator.dart'; @@ -48,13 +49,11 @@ class _CreateServicesPage3State extends State { super.initState(); scheduleMicrotask(() async { ServiceVM serviceVM = context.read(); + log("widget.branchModel!.categoryId: ${widget.branchModel!.categoryId}"); if (widget.branchModel!.categoryId != null) { await serviceVM.fetchServicesByCategoryId(int.parse(widget.branchModel!.categoryId ?? "0")); - category = DropValue(int.parse(widget.branchModel!.categoryId ?? "0"), widget.branchModel!.categoryName ?? "", ""); - service = serviceVM.servicesDropList.firstWhere((element) => element.id == widget.branchModel!.serviceProviderService!.serviceId); - isAppointmentAvailable = widget.branchModel?.serviceProviderService?.isAllowAppointment ?? false; serviceRage = widget.branchModel?.serviceProviderService?.customerLocationRange ?? 0; if (serviceRage > 0) { @@ -63,6 +62,8 @@ class _CreateServicesPage3State extends State { chargersPerKm = widget.branchModel?.serviceProviderService?.rangePricePerKm ?? ""; serviceId = widget.branchModel?.serviceProviderService?.serviceProviderServiceId ?? -1; setState(() {}); + } else { + serviceVM.fetchBranchCategory(EasyLocalization.of(context)?.currentLocale?.countryCode ?? "SA"); } }); } @@ -84,17 +85,17 @@ class _CreateServicesPage3State extends State { padding: const EdgeInsets.all(20.0), child: Column( children: [ - (widget.branchModel!.categoryId != null) + (model.state == ViewState.idle) ? DropdownField( - isSelectAble: false, + isSelectAble: !widget.branchModel!.isForEdit, (DropValue value) async { - // categoryId = value.id; - // category = value; - // service = null; - // serviceId = -1; - // isAppointmentAvailable = false; - // isHomeAppointmentAvailable = false; - // model.fetchServicesByCategoryId(value.id); + categoryId = value.id; + category = value; + service = null; + serviceId = -1; + isAppointmentAvailable = false; + isHomeAppointmentAvailable = false; + model.fetchServicesByCategoryId(value.id); }, dropdownValue: category, list: model.categoryDropList, @@ -106,6 +107,7 @@ class _CreateServicesPage3State extends State { ? DropdownField( (DropValue value) { service = value; + serviceId = value.id; isAppointmentAvailable = false; isHomeAppointmentAvailable = false; model.setState(ViewState.idle); diff --git a/lib/views/branch_management/services/services_list_page.dart b/lib/views/branch_management/services/services_list_page.dart index 6891e31..43da2a8 100644 --- a/lib/views/branch_management/services/services_list_page.dart +++ b/lib/views/branch_management/services/services_list_page.dart @@ -27,6 +27,7 @@ class CreateBranchModel { final String? categoryId; final String? categoryName; final ServiceModel? serviceProviderService; + final bool isForEdit; CreateBranchModel({ required this.branchId, @@ -34,6 +35,7 @@ class CreateBranchModel { this.categoryId, this.categoryName, this.serviceProviderService, + required this.isForEdit, }); } @@ -131,22 +133,15 @@ class _ServicesListPageState extends State { height: 16, ), ).onPress(() { - // log("${categoryData.branchId}"); - // log("${categoryData.branchName}"); - // log("${categoryData.id}"); - // log("${categoryData.categoryName}"); - // log("${services[index].serviceDescription}"); - navigateWithName( - context, - ProviderAppRoutes.createServices3, - arguments: CreateBranchModel( - branchId: categoryData.branchId ?? '', - branchName: categoryData.branchName ?? '', - categoryId: categoryData.id.toString(), - categoryName: categoryData.categoryName, - serviceProviderService: services[index], - ), - ); + navigateWithName(context, ProviderAppRoutes.createServices3, + arguments: CreateBranchModel( + branchId: categoryData.branchId ?? '', + branchName: categoryData.branchName ?? '', + categoryId: categoryData.id.toString(), + categoryName: categoryData.categoryName, + serviceProviderService: services[index], + isForEdit: true, + )); }), ], ), diff --git a/lib/views/subscriptions/all_subscriptions_page.dart b/lib/views/subscriptions/all_subscriptions_page.dart index 93f06a7..58aa18c 100644 --- a/lib/views/subscriptions/all_subscriptions_page.dart +++ b/lib/views/subscriptions/all_subscriptions_page.dart @@ -44,7 +44,7 @@ class _SubscriptionsPageState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: CustomAppBar( + appBar: CustomAppBar( title: LocaleKeys.subscriptions.tr(), ), body: SizedBox(