Issues Fixed

aamir_dev
Faiz Hashmi 1 year ago
parent 7ba4a191bb
commit 7afe4683ed

@ -21,6 +21,7 @@ import 'package:mc_common_app/utils/navigator.dart';
import 'package:mc_common_app/widgets/bottom_sheet.dart'; import 'package:mc_common_app/widgets/bottom_sheet.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart'; import 'package:mc_common_app/widgets/button/show_fill_button.dart';
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart'; import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
import 'package:mc_common_app/widgets/common_widgets/custom_add_button_widget.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
import 'package:mc_common_app/widgets/row_with_arrow.dart'; import 'package:mc_common_app/widgets/row_with_arrow.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -51,7 +52,7 @@ class _BranchDetailPageState extends State<BranchDetailPage> {
}, },
); );
await serviceVM.filterUserBranchCategories(); serviceVM.filterUserBranchCategories();
}); });
} }
@ -144,15 +145,7 @@ class _BranchDetailPageState extends State<BranchDetailPage> {
], ],
), ),
12.height, 12.height,
ShowFillButton( Utils.buildStatusContainer(LocaleKeys.rejectedFormAdmin.tr(), marginAll: 0, fontSize: 16),
title: LocaleKeys.rejectedFormAdmin.tr(),
maxWidth: double.infinity,
backgroundColor: MyColors.darkWhiteColor,
borderColor: MyColors.darkPrimaryColor,
txtColor: MyColors.lightTextColor,
isFilled: true,
onPressed: () {},
),
], ],
); );
} }
@ -309,48 +302,60 @@ class _BranchDetailPageState extends State<BranchDetailPage> {
context.read<ScheduleVM>().currentSelectedBranchName = widget.branchData.branchName.toString(); context.read<ScheduleVM>().currentSelectedBranchName = widget.branchData.branchName.toString();
navigateWithName(context, AppRoutes.schedulesList, arguments: widget.branchData.id.toString()); navigateWithName(context, AppRoutes.schedulesList, arguments: widget.branchData.id.toString());
}), }),
Row( 10.height,
crossAxisAlignment: CrossAxisAlignment.center, CustomAddButton(
mainAxisAlignment: MainAxisAlignment.center, needsBorder: true,
children: [ bgColor: MyColors.white,
const Icon( onTap: () {
Icons.add, if (widget.branchData.branchStatus == BranchStatusEnum.pending || widget.branchData.branchStatus == BranchStatusEnum.rejected) {
color: Colors.white, Utils.showToast("Please wait for the branch verification.");
size: 18, return;
).toContainer( }
borderRadius: 100, navigateWithName(
paddingAll: 2, context,
backgroundColor: MyColors.darkIconColor, AppRoutes.createServices3,
), arguments: CreateBranchModel(
8.width, branchId: widget.branchData.id.toString(),
LocaleKeys.addNewService.tr().toText(fontSize: 15, color: MyColors.lightTextColor, letterSpacing: -0.52), branchName: widget.branchData.branchName.toString(),
], isForEdit: false,
) ),
.toContainer( );
borderRadius: 0, },
backgroundColor: MyColors.darkWhiteColor, text: LocaleKeys.addNewService.tr(),
width: double.infinity, icon: Container(
paddingAll: 25, height: 24,
margin: const EdgeInsets.only( width: 24,
left: 20, decoration: const BoxDecoration(shape: BoxShape.circle, color: MyColors.darkTextColor),
right: 20, child: const Icon(Icons.add, color: MyColors.white),
top: 20, )).horPaddingMain(),
)) // Row(
.onPress(() { // crossAxisAlignment: CrossAxisAlignment.center,
if (widget.branchData.branchStatus == BranchStatusEnum.pending || widget.branchData.branchStatus == BranchStatusEnum.rejected) { // mainAxisAlignment: MainAxisAlignment.center,
Utils.showToast("Please wait for the branch verification."); // children: [
return; // const Icon(
} // Icons.add,
navigateWithName( // color: Colors.white,
context, // size: 18,
AppRoutes.createServices3, // ).toContainer(
arguments: CreateBranchModel( // borderRadius: 100,
branchId: widget.branchData.id.toString(), // paddingAll: 2,
branchName: widget.branchData.branchName.toString(), // backgroundColor: MyColors.darkIconColor,
isForEdit: false, // ),
), // 8.width,
); // LocaleKeys.addNewService.tr().toText(fontSize: 15, color: MyColors.lightTextColor, letterSpacing: -0.52),
}), // ],
// )
// .toContainer(
// borderRadius: 0,
// backgroundColor: MyColors.darkWhiteColor,
// width: double.infinity,
// paddingAll: 25,
// margin: const EdgeInsets.only(
// left: 20,
// right: 20,
// top: 20,
// ))
// .onPress(() {}),
if (serviceVM.state == ViewState.busy) ...[ if (serviceVM.state == ViewState.busy) ...[
30.height, 30.height,
const Center( const Center(

@ -65,45 +65,45 @@ class BranchListPage extends StatelessWidget {
title: LocaleKeys.myBranches.tr(), title: LocaleKeys.myBranches.tr(),
isRemoveBackButton: true, isRemoveBackButton: true,
), ),
body: SizedBox( body: RefreshIndicator(
width: double.infinity, onRefresh: () async => await context.read<ServiceVM>().getBranchAndServices(),
height: double.infinity, child: SizedBox(
child: Column( width: double.infinity,
children: [ height: double.infinity,
Padding( child: Column(
padding: const EdgeInsets.only(left: 21, right: 21, top: 21), children: [
child: RoleTypeTab( Padding(
context.watch<ServiceVM>().selectedBranchStatus == 3 ? 0 : context.watch<ServiceVM>().selectedBranchStatus, padding: const EdgeInsets.only(left: 21, right: 21, top: 21),
[ child: RoleTypeTab(
DropValue(3, "Active", ""), context.watch<ServiceVM>().selectedBranchStatus == 3 ? 0 : context.watch<ServiceVM>().selectedBranchStatus,
DropValue(1, "Requested", ""), [
], DropValue(3, "Active", ""),
onSelect: (DropValue value) { DropValue(1, "Requested", ""),
context.read<ServiceVM>().updateSelectedBranchType(value.id); ],
}, onSelect: (DropValue value) {
context.read<ServiceVM>().updateSelectedBranchType(value.id);
},
),
), ),
), Expanded(
Expanded( child: Consumer<ServiceVM>(
child: Consumer<ServiceVM>( builder: (context, serviceVM, _) {
builder: (context, serviceVM, _) { if (serviceVM.state == ViewState.busy) {
if (serviceVM.state == ViewState.busy) { return const Center(child: CircularProgressIndicator());
return const Center(child: CircularProgressIndicator()); } else {
} else { List<BranchDetailModel> branches = [];
List<BranchDetailModel> branches = []; if (serviceVM.branches!.data != null) {
if (serviceVM.branches!.data != null) { if (serviceVM.selectedBranchStatus == 3) {
if (serviceVM.selectedBranchStatus == 3) { // 3 means active branch
// 3 means active branch branches = serviceVM.branches!.data!.serviceProviderBranch!.where((element) => element.statusId == 3).toList();
branches = serviceVM.branches!.data!.serviceProviderBranch!.where((element) => element.statusId == 3).toList(); } else {
} else { branches = serviceVM.branches!.data!.serviceProviderBranch!.where((element) {
branches = serviceVM.branches!.data!.serviceProviderBranch!.where((element) { return element.statusId != 3; // means rest of the branches
return element.statusId != 3; // means rest of the branches }).toList();
}).toList(); }
} }
}
return RefreshIndicator( return branches.isEmpty
onRefresh: () async => await context.read<ServiceVM>().getBranchAndServices(),
child: branches.isEmpty
? Center(child: LocaleKeys.no_branch.tr().toText(fontSize: 16, color: MyColors.lightTextColor, fontWeight: MyFonts.Medium)) ? Center(child: LocaleKeys.no_branch.tr().toText(fontSize: 16, color: MyColors.lightTextColor, fontWeight: MyFonts.Medium))
: ListView.separated( : ListView.separated(
itemBuilder: (context, index) { itemBuilder: (context, index) {
@ -189,13 +189,13 @@ class BranchListPage extends StatelessWidget {
}, },
separatorBuilder: (context, index) => 12.height, separatorBuilder: (context, index) => 12.height,
itemCount: branches.length, itemCount: branches.length,
).paddingAll(21), ).paddingAll(21);
); }
} },
}, ),
), ),
), ],
], ),
), ),
), ),
floatingActionButton: FloatingActionButton( floatingActionButton: FloatingActionButton(

@ -174,11 +174,13 @@ class _DefineBranchViewState extends State<DefineBranchView> {
}, },
), ),
12.height, 12.height,
DottedRectContainer( if (serviceVM.pickedBranchImages.isEmpty) ...[
onTap: () => serviceVM.pickMultipleImages(), DottedRectContainer(
text: LocaleKeys.attachImage.tr(), onTap: () => serviceVM.pickMultipleImages(),
icon: MyAssets.attachmentIcon.buildSvg(), text: LocaleKeys.attachImage.tr(),
), icon: MyAssets.attachmentIcon.buildSvg(),
),
],
if (serviceVM.branchImageError != "") ...[ if (serviceVM.branchImageError != "") ...[
10.height, 10.height,
Row( Row(

@ -93,7 +93,7 @@ class _SchedulesListPageState extends State<SchedulesListPage> {
: scheduleVM.schedule!.data!.isEmpty : scheduleVM.schedule!.data!.isEmpty
? EmptyWidget( ? EmptyWidget(
text: LocaleKeys.noSchedulesFound.tr(), text: LocaleKeys.noSchedulesFound.tr(),
) ).paddingAll(21)
: ListView.separated( : ListView.separated(
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Column( return Column(
@ -130,7 +130,7 @@ class _SchedulesListPageState extends State<SchedulesListPage> {
showItem("${LocaleKeys.shiftEndTime.tr()}:", scheduleVM.schedule!.data![index].endTime ?? ""), showItem("${LocaleKeys.shiftEndTime.tr()}:", scheduleVM.schedule!.data![index].endTime ?? ""),
showItem("${LocaleKeys.slotsTime.tr()}:", "${scheduleVM.schedule!.data![index].slotDurationMinute} Mins"), showItem("${LocaleKeys.slotsTime.tr()}:", "${scheduleVM.schedule!.data![index].slotDurationMinute} Mins"),
showItem("${LocaleKeys.appointmentPerSlot.tr()}:", scheduleVM.schedule!.data![index].perSlotAppointment.toString()), showItem("${LocaleKeys.appointmentPerSlot.tr()}:", scheduleVM.schedule!.data![index].perSlotAppointment.toString()),
showItem(LocaleKeys.serviceLocation.tr(), scheduleVM.schedule!.data![index].appointmentType ==1 ? "Company Location" : "Home Location"), showItem(LocaleKeys.serviceLocation.tr(), scheduleVM.schedule!.data![index].appointmentType == 1 ? "Company Location" : "Home Location"),
showItem("${LocaleKeys.offDays.tr()}:", offDays(scheduleVM.schedule!.data![index])), showItem("${LocaleKeys.offDays.tr()}:", offDays(scheduleVM.schedule!.data![index])),
12.height, 12.height,
"${LocaleKeys.services.tr()}:".toText(fontSize: 12, color: MyColors.lightTextColor), "${LocaleKeys.services.tr()}:".toText(fontSize: 12, color: MyColors.lightTextColor),

@ -40,7 +40,7 @@ class _CreateServicesPage3State extends State<CreateServicesPage3> {
bool isHomeAppointmentAvailable = false; bool isHomeAppointmentAvailable = false;
int serviceRage = 0; int serviceRage = 0;
String chargersPerKm = ""; String chargersPerKm = "";
int? categoryId; int? categoryId = -1;
int? serviceId = -1; int? serviceId = -1;
DropValue? category; DropValue? category;
DropValue? service; DropValue? service;
@ -71,6 +71,7 @@ class _CreateServicesPage3State extends State<CreateServicesPage3> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
log("categoryId: ${categoryId}");
return Scaffold( return Scaffold(
appBar: CustomAppBar(title: LocaleKeys.editServices.tr()), appBar: CustomAppBar(title: LocaleKeys.editServices.tr()),
body: SizedBox( body: SizedBox(
@ -86,39 +87,43 @@ class _CreateServicesPage3State extends State<CreateServicesPage3> {
padding: const EdgeInsets.all(20.0), padding: const EdgeInsets.all(20.0),
child: Column( child: Column(
children: [ children: [
DropdownField(
isSelectAble: !widget.branchModel!.isForEdit,
(DropValue value) async {
categoryId = value.id;
category = value;
service = null;
serviceId = -1;
isAppointmentAvailable = false;
isHomeAppointmentAvailable = false;
model.fetchServicesByCategoryId(value.id);
},
dropdownValue: category,
list: model.categoryDropList,
hint: category != null ? category!.value : LocaleKeys.selectServiceCategory.tr(),
),
12.height,
(model.state == ViewState.idle) (model.state == ViewState.idle)
? DropdownField( ? categoryId != -1 && model.servicesDropList.isNotEmpty
isSelectAble: !widget.branchModel!.isForEdit, ? DropdownField(
(DropValue value) async { (DropValue value) {
categoryId = value.id; service = value;
category = value; serviceId = value.id;
service = null; isAppointmentAvailable = false;
serviceId = -1; isHomeAppointmentAvailable = false;
isAppointmentAvailable = false; model.setState(ViewState.idle);
isHomeAppointmentAvailable = false; },
model.fetchServicesByCategoryId(value.id); dropdownValue: service,
}, list: model.servicesDropList,
dropdownValue: category, hint: LocaleKeys.defineServices.tr(),
list: model.categoryDropList, )
hint: category != null ? category!.value : LocaleKeys.selectServiceCategory.tr(), : categoryId == -1
) ? const SizedBox()
: model.state == ViewState.idle
? EmptyWidget(text: LocaleKeys.noServicesAvailable.tr())
: const SizedBox()
: const CircularProgressIndicator(), : const CircularProgressIndicator(),
12.height, 12.height,
categoryId != -1 && model.servicesDropList.isNotEmpty
? DropdownField(
(DropValue value) {
service = value;
serviceId = value.id;
isAppointmentAvailable = false;
isHomeAppointmentAvailable = false;
model.setState(ViewState.idle);
},
dropdownValue: service,
list: model.servicesDropList,
hint: LocaleKeys.defineServices.tr(),
)
: EmptyWidget(text: LocaleKeys.noServicesAvailable.tr()),
12.height,
if (serviceId != -1) ...[ if (serviceId != -1) ...[
Column( Column(
children: [ children: [

@ -79,7 +79,7 @@ class _UpgradePackageSheetState extends State<UpgradePackageSheet> {
12.height, 12.height,
packageItem( packageItem(
LocaleKeys.nowVar.tr(), LocaleKeys.nowVar.tr(),
(LocaleKeys.yourSubscriptionUpgradeAffectingFrom.tr() + " ${DateHelper.formatAsLongDate(widget.subscription.dateEnd ?? DateTime.now())}"), ("${LocaleKeys.yourSubscriptionUpgradeAffectingFrom.tr()} ${DateHelper.formatAsLongDate(widget.subscription.dateEnd ?? DateTime.now())}"),
double.parse(model.newPrice).toStringAsFixed(2), double.parse(model.newPrice).toStringAsFixed(2),
isNowSelected, isNowSelected,
).onPress(() { ).onPress(() {
@ -89,10 +89,10 @@ class _UpgradePackageSheetState extends State<UpgradePackageSheet> {
}); });
}), }),
6.height, 6.height,
if (!AppState().getproviderSubscription.first.isExpired!) if (AppState().getproviderSubscription.isNotEmpty && !AppState().getproviderSubscription.first.isExpired!)
packageItem( packageItem(
LocaleKeys.upgradeAfterCurrentExpiry.tr(), LocaleKeys.upgradeAfterCurrentExpiry.tr(),
(LocaleKeys.yourSubscriptionUpgradeCurrentSubscriptionAffectingFrom.tr() + " ${DateHelper.formatAsLongDate(widget.subscription.dateEnd ?? DateTime.now())}"), ("${LocaleKeys.yourSubscriptionUpgradeCurrentSubscriptionAffectingFrom.tr()} ${DateHelper.formatAsLongDate(widget.subscription.dateEnd ?? DateTime.now())}"),
widget.subscription.price.toString(), widget.subscription.price.toString(),
isNowSelected ? false : true, isNowSelected ? false : true,
).onPress(() { ).onPress(() {

Loading…
Cancel
Save