diff --git a/lib/views/branch_management/branch/branch_detail_page.dart b/lib/views/branch_management/branch/branch_detail_page.dart index ce8a2c4..b3e8904 100644 --- a/lib/views/branch_management/branch/branch_detail_page.dart +++ b/lib/views/branch_management/branch/branch_detail_page.dart @@ -60,7 +60,9 @@ class _BranchDetailPageState extends State { bool validation(BuildContext context) { bool isValid = false; - for (var element in context.read().allProviderDealersList) { + for (var element in context + .read() + .allProviderDealersList) { if (element.isBranchUser ?? false) { isValid = true; } @@ -112,6 +114,7 @@ class _BranchDetailPageState extends State { onPressed: () async { showMyBottomSheet( context, + isScrollControlled: true, child: AssignDealerUserSheet( branchId: widget.branchData.id.toString(), callBackFunc: () { @@ -170,43 +173,46 @@ class _BranchDetailPageState extends State { 8.width, Expanded( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ - serviceVM.categories[pIndex].categoryName.toString().toText(fontSize: 16), - ], - ), - 8.height, - Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Expanded( - child: ListView.builder( - itemBuilder: (context, index) { - return Container( - child: (EasyLocalization.of(context)?.currentLocale?.countryCode == "SA" + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + serviceVM.categories[pIndex].categoryName.toString().toText(fontSize: 16), + ], + ), + 8.height, + Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded( + child: ListView.builder( + itemBuilder: (context, index) { + return Container( + child: (EasyLocalization + .of(context) + ?.currentLocale + ?.countryCode == "SA" ? serviceVM.categories[pIndex].services![index].serviceDescriptionN.toString() : serviceVM.categories[pIndex].services![index].serviceDescription.toString()) - .toText( - fontSize: 12, - color: MyColors.lightTextColor, - ), - ); - }, - itemCount: serviceVM.categories[pIndex].services?.length, - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - padding: EdgeInsets.zero, - ), - ), + .toText( + fontSize: 12, + color: MyColors.lightTextColor, + ), + ); + }, + itemCount: serviceVM.categories[pIndex].services?.length, + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.zero, + ), + ), + ], + ).withArrow(isArrowEnabled: true) ], - ).withArrow(isArrowEnabled: true) - ], - )), + )), ], ).toWhiteContainer(width: double.infinity, allPading: 12); } @@ -281,27 +287,29 @@ class _BranchDetailPageState extends State { 8.width, Expanded( child: LocaleKeys.setorEditBranchSchedule.tr().toText( - isUnderLine: true, - fontSize: 12, - color: Colors.white, - decorationColor: MyColors.white, - ), + isUnderLine: true, + fontSize: 12, + color: Colors.white, + decorationColor: MyColors.white, + ), ), ], ) .withArrow( - isArrowEnabled: true, - color: Colors.white, - arrowWidth: 16.16, - arrowHeight: 11.75, - ) + isArrowEnabled: true, + color: Colors.white, + arrowWidth: 16.16, + arrowHeight: 11.75, + ) .margin(right: 5), ).onPress(() { if (widget.branchData.branchStatus == BranchStatusEnum.pending || widget.branchData.branchStatus == BranchStatusEnum.rejected) { Utils.showToast(LocaleKeys.waitForBranchVerification.tr()); return; } - context.read().currentSelectedBranchName = widget.branchData.branchName.toString(); + context + .read() + .currentSelectedBranchName = widget.branchData.branchName.toString(); navigateWithName(context, AppRoutes.schedulesList, arguments: widget.branchData.id.toString()); }), 10.height, @@ -332,7 +340,7 @@ class _BranchDetailPageState extends State { )).horPaddingMain(), // Row( // crossAxisAlignment: CrossAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.center, + // mainAxisAlignment: MainAxisAlignment.center,Assign // children: [ // const Icon( // Icons.add, @@ -363,38 +371,39 @@ class _BranchDetailPageState extends State { const Center( child: CircularProgressIndicator(), ), - ] else ...[ - ListView.separated( - itemBuilder: (context, pIndex) { - return buildServiceTileWidget(pIndex, serviceVM).onPress(() { - serviceVM.categories[pIndex].branchId = widget.branchData.id.toString(); - serviceVM.categories[pIndex].branchName = widget.branchData.branchName.toString(); - // CategoryData categoryData = serviceVM.categories[pIndex]; - serviceVM.applyFilterOnBranchServices(serviceStatusEnum: ServiceStatusEnum.approvedOrActive); + ] else + ...[ + ListView.separated( + itemBuilder: (context, pIndex) { + return buildServiceTileWidget(pIndex, serviceVM).onPress(() { + serviceVM.categories[pIndex].branchId = widget.branchData.id.toString(); + serviceVM.categories[pIndex].branchName = widget.branchData.branchName.toString(); + // CategoryData categoryData = serviceVM.categories[pIndex]; + serviceVM.applyFilterOnBranchServices(serviceStatusEnum: ServiceStatusEnum.approvedOrActive); - CategoryData categoryData = CategoryData( - id: serviceVM.categories[pIndex].id, - branchId: serviceVM.categories[pIndex].branchId, - branchName: serviceVM.categories[pIndex].branchName, - categoryName: serviceVM.categories[pIndex].categoryName, - categoryNameN: serviceVM.categories[pIndex].categoryNameN, - serviceCategoryIconUrl: serviceVM.categories[pIndex].serviceCategoryIconUrl, - serviceCategoryImageUrl: serviceVM.categories[pIndex].serviceCategoryImageUrl, - services: [], - ); + CategoryData categoryData = CategoryData( + id: serviceVM.categories[pIndex].id, + branchId: serviceVM.categories[pIndex].branchId, + branchName: serviceVM.categories[pIndex].branchName, + categoryName: serviceVM.categories[pIndex].categoryName, + categoryNameN: serviceVM.categories[pIndex].categoryNameN, + serviceCategoryIconUrl: serviceVM.categories[pIndex].serviceCategoryIconUrl, + serviceCategoryImageUrl: serviceVM.categories[pIndex].serviceCategoryImageUrl, + services: [], + ); - navigateWithName(context, AppRoutes.servicesList, arguments: categoryData); - }); - }, - itemCount: serviceVM.categories.length, - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - padding: const EdgeInsets.all(20), - separatorBuilder: (BuildContext context, int index) { - return 12.height; - }, - ), - ], + navigateWithName(context, AppRoutes.servicesList, arguments: categoryData); + }); + }, + itemCount: serviceVM.categories.length, + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: const EdgeInsets.all(20), + separatorBuilder: (BuildContext context, int index) { + return 12.height; + }, + ), + ], 12.height, ], ), diff --git a/lib/views/branch_management/branch/define_branch_view.dart b/lib/views/branch_management/branch/define_branch_view.dart index b682daa..8d13727 100644 --- a/lib/views/branch_management/branch/define_branch_view.dart +++ b/lib/views/branch_management/branch/define_branch_view.dart @@ -179,6 +179,7 @@ class _DefineBranchViewState extends State { onTap: () => serviceVM.pickMultipleImages(), text: LocaleKeys.attachImage.tr(), icon: MyAssets.attachmentIcon.buildSvg(), + extensions: GlobalConsts.allowedFileExtensions, ), ], if (serviceVM.branchImageError != "") ...[ diff --git a/lib/views/branch_management/schedule/add_schedules_page.dart b/lib/views/branch_management/schedule/add_schedules_page.dart index 19fdec1..04ee071 100644 --- a/lib/views/branch_management/schedule/add_schedules_page.dart +++ b/lib/views/branch_management/schedule/add_schedules_page.dart @@ -184,10 +184,13 @@ class _AddSchedulesPageState extends State { initial: tomorrowDate, firstDate: DateTime.now(), ); + if (scheduleID != null) { + endDate = ""; + } if (endDate.isNotEmpty) { - DateTime sDate = DateTime.parse(startDate); - DateTime eDate = DateTime.parse(endDate); + DateTime sDate = DateHelper.parseStringToDate(startDate); + DateTime eDate = DateHelper.parseStringToDate(endDate); if (sDate.isAfter(eDate)) { startDate = ""; @@ -215,18 +218,24 @@ class _AddSchedulesPageState extends State { Utils.showToast(LocaleKeys.pleaseEnterStartDateFirst.tr()); return; } else { - sDate = DateTime.parse(startDate); + // sDate = DateTime.parse(startDate); + sDate = DateHelper.parseStringToDate(startDate); firstDate = sDate.add(const Duration(days: 1)).subtract( Duration(hours: DateTime.now().hour, minutes: DateTime.now().minute, seconds: DateTime.now().second, microseconds: DateTime.now().microsecond), ); } + + if (startDate != null && startDate.isNotEmpty) { + tomorrowDate = firstDate; + } + // endDate = await Utils.pickDateFromDatePicker( context, initial: tomorrowDate, firstDate: firstDate ?? tomorrowDate, ); - DateTime eDate = DateTime.parse(endDate); + DateTime eDate = DateHelper.parseStringToDate(endDate); if (!eDate.isAfter(sDate)) { endDate = ""; @@ -259,6 +268,7 @@ class _AddSchedulesPageState extends State { Expanded( child: TxtField( hint: LocaleKeys.shiftStartTime.tr(), + maxLines: 1, postfixWidget: const Icon( Icons.access_time_filled_outlined, size: 16, @@ -286,6 +296,7 @@ class _AddSchedulesPageState extends State { Expanded( child: TxtField( hint: LocaleKeys.shiftEndTime.tr(), + maxLines: 1, postfixWidget: const Icon( Icons.access_time_filled_outlined, size: 16, diff --git a/lib/views/branch_management/services/create_item_page.dart b/lib/views/branch_management/services/create_item_page.dart index 71398ae..00f3c54 100644 --- a/lib/views/branch_management/services/create_item_page.dart +++ b/lib/views/branch_management/services/create_item_page.dart @@ -149,6 +149,7 @@ class _CreateItemPageState extends State { }, text: LocaleKeys.attachImage.tr(), icon: MyAssets.attachmentIcon.buildSvg(), + extensions: GlobalConsts.allowedFileExtensions, ) ], 20.height,