Dropped the JIRA Count to 23

aamir_dev
Faiz Hashmi 1 year ago
parent 48ce588021
commit 5cdcb46183

@ -1,13 +1,10 @@
import 'package:car_provider_app/config/provider_routes.dart';
import 'package:car_provider_app/views/appoinments/widget/sheets.dart'; import 'package:car_provider_app/views/appoinments/widget/sheets.dart';
import 'package:car_provider_app/views/dashboard/widget/general_appointment_widget.dart'; import 'package:car_provider_app/views/dashboard/widget/general_appointment_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mc_common_app/classes/app_state.dart'; import 'package:mc_common_app/classes/app_state.dart';
import 'package:mc_common_app/config/dependency_injection.dart'; import 'package:mc_common_app/config/dependency_injection.dart';
import 'package:mc_common_app/config/routes.dart'; import 'package:mc_common_app/config/routes.dart';
import 'package:mc_common_app/extensions/int_extensions.dart'; import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart'; import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/models/appointments_models/appointment_list_model.dart'; import 'package:mc_common_app/models/appointments_models/appointment_list_model.dart';
import 'package:mc_common_app/theme/colors.dart'; import 'package:mc_common_app/theme/colors.dart';
@ -86,7 +83,7 @@ class _UpdateAppointmentPageState extends State<UpdateAppointmentPage> {
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Expanded(child: showPayNowButton(context, appointmentsVM)), Expanded(child: showPayNowButton(context, appointmentsVM, color: MyColors.greenColor)),
12.width, 12.width,
Expanded(child: showCancelButton(context, appointmentsVM)), Expanded(child: showCancelButton(context, appointmentsVM)),
], ],
@ -97,7 +94,13 @@ class _UpdateAppointmentPageState extends State<UpdateAppointmentPage> {
appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.defaultStatus)) appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.defaultStatus))
Column( Column(
children: [ children: [
showArrivedButton(context, appointmentsVM), Row(
children: [
Expanded(child: showArrivedButton(context, appointmentsVM)),
12.width,
Expanded(child: showCancelButton(context, appointmentsVM)),
],
),
], ],
).paddingAll(21), ).paddingAll(21),
@ -220,10 +223,11 @@ class _UpdateAppointmentPageState extends State<UpdateAppointmentPage> {
); );
} }
Widget showPayNowButton(BuildContext context, AppointmentsVM appointmentsVM) { Widget showPayNowButton(BuildContext context, AppointmentsVM appointmentsVM, {Color? color}) {
return ShowFillButton( return ShowFillButton(
title: LocaleKeys.payNow.tr(), title: LocaleKeys.payNow.tr(),
maxWidth: double.infinity, maxWidth: double.infinity,
backgroundColor: color ?? MyColors.darkPrimaryColor,
onPressed: () async { onPressed: () async {
Utils.showLoading(context); Utils.showLoading(context);
bool status = await appointmentsVM.updateAppointmentPaymentStatus({"appointmentID": appointmentListModel.id.toString(), "appointmentServicePaymentStatusID": 2}); bool status = await appointmentsVM.updateAppointmentPaymentStatus({"appointmentID": appointmentListModel.id.toString(), "appointmentServicePaymentStatusID": 2});
@ -240,6 +244,8 @@ class _UpdateAppointmentPageState extends State<UpdateAppointmentPage> {
return ShowFillButton( return ShowFillButton(
title: LocaleKeys.arrived.tr(), title: LocaleKeys.arrived.tr(),
maxWidth: double.infinity, maxWidth: double.infinity,
txtColor: MyColors.white,
backgroundColor: MyColors.greenColor,
onPressed: () async { onPressed: () async {
Utils.showLoading(context); Utils.showLoading(context);
bool status = await appointmentsVM.updateAppointmentStatus(appointmentId: appointmentListModel.id!, appointmentStatusEnum: AppointmentStatusEnum.arrived); bool status = await appointmentsVM.updateAppointmentStatus(appointmentId: appointmentListModel.id!, appointmentStatusEnum: AppointmentStatusEnum.arrived);
@ -280,21 +286,26 @@ class _UpdateAppointmentPageState extends State<UpdateAppointmentPage> {
); );
} }
Widget showCancelButton(BuildContext context, AppointmentsVM appointmentsVM) { Widget showCancelButton(BuildContext pContext, AppointmentsVM appointmentsVM) {
return ShowFillButton( return ShowFillButton(
title: LocaleKeys.cancel.tr(), title: LocaleKeys.cancel.tr(),
maxWidth: double.infinity, maxWidth: double.infinity,
isFilled: false, txtColor: MyColors.white,
txtColor: MyColors.redColor, backgroundColor: MyColors.redColor,
borderColor: MyColors.redColor,
onPressed: () { onPressed: () {
showMyBottomSheet( showModalBottomSheet(
context, context: pContext,
child: ShowCollectPaymentSheet( isScrollControlled: true,
onClickYes: () {}, builder: (context) => CancelAppointmentReasonSheet(
onClickNo: () {}, onCancelClick: (String reason) async {
), pop(context);
); await appointmentsVM.onCancelAppointmentPressed(context: pContext, appointmentListModel: appointmentListModel).whenComplete(() async {
await _updateAppointment(pContext, appointmentListModel.branchId ?? 0);
pop(pContext);
pop(pContext);
});
},
));
}, },
); );
} }

@ -1,23 +1,22 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/extensions/int_extensions.dart'; import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_extensions.dart'; import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart'; import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/models/chat_models/chat_message_model.dart';
import 'package:mc_common_app/theme/colors.dart'; import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/utils/navigator.dart';
import 'package:mc_common_app/utils/utils.dart'; import 'package:mc_common_app/utils/utils.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/extensions/extensions_widget.dart'; import 'package:mc_common_app/widgets/checkbox_with_title_desc.dart';
import 'package:mc_common_app/widgets/common_widgets/info_bottom_sheet.dart';
import 'package:mc_common_app/widgets/txt_field.dart'; import 'package:mc_common_app/widgets/txt_field.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
class ShowCollectPaymentSheet extends StatelessWidget { class ShowCollectPaymentSheet extends StatelessWidget {
Function() onClickYes; final Function() onClickYes;
Function() onClickNo; final Function() onClickNo;
ShowCollectPaymentSheet( const ShowCollectPaymentSheet({required this.onClickYes, required this.onClickNo, super.key});
{required this.onClickYes, required this.onClickNo, Key? key})
: super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -26,9 +25,9 @@ class ShowCollectPaymentSheet extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
LocaleKeys.collectMoneyBefore.tr().toText( LocaleKeys.collectMoneyBefore.tr().toText(
fontSize: 24, fontSize: 24,
isBold: true, isBold: true,
), ),
21.height, 21.height,
Row( Row(
children: [ children: [
@ -55,134 +54,91 @@ class ShowCollectPaymentSheet extends StatelessWidget {
} }
} }
class Reason {
String title;
bool isSelected;
Reason(this.title, this.isSelected);
}
class CancelAppointmentReasonSheet extends StatefulWidget { class CancelAppointmentReasonSheet extends StatefulWidget {
Function(String) onCancelClick; final Function(String) onCancelClick;
CancelAppointmentReasonSheet({required this.onCancelClick, Key? key}) const CancelAppointmentReasonSheet({required this.onCancelClick, super.key});
: super(key: key);
@override @override
State<CancelAppointmentReasonSheet> createState() => State<CancelAppointmentReasonSheet> createState() => _CancelAppointmentReasonSheetState();
_CancelAppointmentReasonSheetState();
} }
class _CancelAppointmentReasonSheetState class _CancelAppointmentReasonSheetState extends State<CancelAppointmentReasonSheet> {
extends State<CancelAppointmentReasonSheet> {
String reason = ""; String reason = "";
List<Reason> reasonList = [ List<OfferRequestCommentModel> reasonList = [
Reason("Operational Issue", true), OfferRequestCommentModel(title: LocaleKeys.operationalIssue.tr(), isSelected: true, index: 0),
Reason("Material Issue", false), OfferRequestCommentModel(title: LocaleKeys.materialIssue.tr(), isSelected: false, index: 1),
Reason("The customer no longer responding", false), OfferRequestCommentModel(title: LocaleKeys.customerNotResponding.tr(), isSelected: false, index: 2),
Reason("Other", false), OfferRequestCommentModel(title: LocaleKeys.otherVar.tr(), isSelected: false, index: 3),
]; ];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return InfoBottomSheet(
padding: const EdgeInsets.only(left: 21, right: 21, top: 12, bottom: 21), title: LocaleKeys.pleaseSpecify.tr().toText(fontSize: 28, isBold: true, letterSpacing: -1.44, height: 1),
width: double.infinity, description: Padding(
child: Column( padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
LocaleKeys.reason.tr().toText(fontSize: 24, isBold: true), children: [
ListView.separated( LocaleKeys.selectReasonBeforeCancel.tr().toText(fontSize: 13, color: MyColors.lightTextColor, fontWeight: MyFonts.Medium),
itemBuilder: (context, index) { Column(
return Padding( crossAxisAlignment: CrossAxisAlignment.start,
padding: const EdgeInsets.only(top: 12, bottom: 12), children: [
child: Row( 12.height,
children: [ ListView.separated(
Container( shrinkWrap: true,
width: 14, itemCount: reasonList.length,
height: 14, separatorBuilder: (BuildContext context, int index) {
decoration: BoxDecoration( return const Divider(thickness: 0.5);
color: reasonList[index].isSelected },
? MyColors.darkPrimaryColor itemBuilder: (BuildContext context, int index) {
: Colors.transparent, OfferRequestCommentModel offerRequestCommentModel = reasonList[index];
borderRadius: BorderRadius.circular(122), return CircleCheckBoxWithTitle(
border: Border.all( isChecked: offerRequestCommentModel.isSelected ?? false,
color: reasonList[index].isSelected title: '${offerRequestCommentModel.title}',
? MyColors.darkPrimaryColor onSelected: () {
: borderColor, for (var element in reasonList) {
width: 1), element.isSelected = false;
), }
child: const Icon(
Icons.done, setState(() {
size: 12, reason = reasonList[index].title ?? "";
color: Colors.white, reasonList[index].isSelected = true;
), });
},
selectedColor: MyColors.darkPrimaryColor,
);
},
),
if (reason == LocaleKeys.otherVar.tr()) ...[
12.height,
TxtField(
maxLines: 5,
keyboardType: TextInputType.text,
hint: LocaleKeys.description.tr(),
onChanged: (v) {
reason = v;
},
), ),
12.width,
reasonList[index].title.toText(isBold: true)
], ],
), ],
).onPress(() {
for (var element in reasonList) {
element.isSelected = false;
}
setState(() {
reason = reasonList[index].title;
reasonList[index].isSelected = true;
});
});
},
separatorBuilder: (context, index) {
return Container(
width: double.infinity,
height: 1,
color: MyColors.borderColor,
);
},
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: reasonList.length,
),
if (reason == "Other")
TxtField(
hint: LocaleKeys.typeHere.tr(),
maxLines: 5,
onChanged: (v) {
reason = v;
},
),
12.height,
Row(
children: [
Expanded(
child: ShowFillButton(
title: LocaleKeys.no.tr(),
isFilled: false,
txtColor: MyColors.darkPrimaryColor,
onPressed: () {
pop(context);
},
),
), ),
12.width, 25.height,
Expanded( ShowFillButton(
child: ShowFillButton( title: LocaleKeys.cancel.tr(),
title: LocaleKeys.yes.tr(), onPressed: () {
onPressed: () { if (reason.isEmpty && reason == LocaleKeys.otherVar.tr()) {
if (reason.isEmpty || reason == "Other") { Utils.showToast(LocaleKeys.pleaseSelectReason.tr());
Utils.showToast(LocaleKeys.pleaseSelectReason.tr()); } else {
} else { widget.onCancelClick(reason);
widget.onCancelClick(reason); }
pop(context); },
} maxWidth: double.infinity,
},
),
), ),
19.height,
], ],
) ),
], ));
),
);
} }
} }

@ -249,8 +249,8 @@ class _DefineBranchViewState extends State<DefineBranchView> {
closedTime: serviceVM.closedTime, closedTime: serviceVM.closedTime,
cityID: serviceVM.cityId, cityID: serviceVM.cityId,
address: serviceVM.address, address: serviceVM.address,
latitude: widget.branchData!.latitude ?? "0", latitude: (serviceVM.latitude).toString(),
longitude: widget.branchData!.longitude ?? "0", longitude: (serviceVM.longitude).toString(),
); );
}, },
).horPaddingMain(), ).horPaddingMain(),

@ -207,7 +207,7 @@ class _AddSchedulesPageState extends State<AddSchedulesPage> {
size: 16, size: 16,
), ),
value: endDate, value: endDate,
isNeedClickAll: true, isNeedClickAll: true,
onTap: () async { onTap: () async {
DateTime? firstDate; DateTime? firstDate;
DateTime? sDate; DateTime? sDate;

@ -133,19 +133,26 @@ class _CreateServicesPage3State extends State<CreateServicesPage3> {
description: LocaleKeys.bookAppointmentForServices.tr(), description: LocaleKeys.bookAppointmentForServices.tr(),
onSelection: (bool v) { onSelection: (bool v) {
isAppointmentAvailable = v; isAppointmentAvailable = v;
if (!isAppointmentAvailable) {
isHomeAppointmentAvailable = false;
}
model.setState(ViewState.idle); model.setState(ViewState.idle);
}, },
), ),
20.height, 20.height,
CheckBoxWithTitleDescription( if (isAppointmentAvailable)
isSelected: isHomeAppointmentAvailable, CheckBoxWithTitleDescription(
title: LocaleKeys.allowingHomeService.tr(), isSelected: isHomeAppointmentAvailable,
description: LocaleKeys.bookAppointmentAtLocation.tr(), title: LocaleKeys.allowingHomeService.tr(),
onSelection: (bool v) { description: LocaleKeys.bookAppointmentAtLocation.tr(),
isHomeAppointmentAvailable = v; onSelection: (bool v) {
model.setState(ViewState.idle); isHomeAppointmentAvailable = v;
}, if (isHomeAppointmentAvailable && !isAppointmentAvailable) {
), isAppointmentAvailable = true;
}
model.setState(ViewState.idle);
},
),
20.height, 20.height,
if (isHomeAppointmentAvailable) if (isHomeAppointmentAvailable)
Column( Column(
@ -268,6 +275,13 @@ class _CreateServicesPage3State extends State<CreateServicesPage3> {
updateService(BuildContext context, ServiceVM model) async { updateService(BuildContext context, ServiceVM model) async {
List<Map<String, dynamic>> map = []; List<Map<String, dynamic>> map = [];
if (isHomeAppointmentAvailable) {
if (serviceRage == 0 || chargersPerKm.isEmpty || double.parse(chargersPerKm) < 1) {
Utils.showToast(LocaleKeys.chargesAndServiceRangeGreaterThanZero.tr());
return;
}
}
if (isHomeAppointmentAvailable) { if (isHomeAppointmentAvailable) {
map = [ map = [
{ {

Loading…
Cancel
Save