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) {
@ -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(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.reason.tr().toText(fontSize: 24, isBold: true), LocaleKeys.selectReasonBeforeCancel.tr().toText(fontSize: 13, color: MyColors.lightTextColor, fontWeight: MyFonts.Medium),
ListView.separated( Column(
itemBuilder: (context, index) { crossAxisAlignment: CrossAxisAlignment.start,
return Padding(
padding: const EdgeInsets.only(top: 12, bottom: 12),
child: Row(
children: [ children: [
Container( 12.height,
width: 14, ListView.separated(
height: 14, shrinkWrap: true,
decoration: BoxDecoration( itemCount: reasonList.length,
color: reasonList[index].isSelected separatorBuilder: (BuildContext context, int index) {
? MyColors.darkPrimaryColor return const Divider(thickness: 0.5);
: Colors.transparent, },
borderRadius: BorderRadius.circular(122), itemBuilder: (BuildContext context, int index) {
border: Border.all( OfferRequestCommentModel offerRequestCommentModel = reasonList[index];
color: reasonList[index].isSelected return CircleCheckBoxWithTitle(
? MyColors.darkPrimaryColor isChecked: offerRequestCommentModel.isSelected ?? false,
: borderColor, title: '${offerRequestCommentModel.title}',
width: 1), onSelected: () {
),
child: const Icon(
Icons.done,
size: 12,
color: Colors.white,
),
),
12.width,
reasonList[index].title.toText(isBold: true)
],
),
).onPress(() {
for (var element in reasonList) { for (var element in reasonList) {
element.isSelected = false; element.isSelected = false;
} }
setState(() { setState(() {
reason = reasonList[index].title; reason = reasonList[index].title ?? "";
reasonList[index].isSelected = true; reasonList[index].isSelected = true;
}); });
});
}, },
separatorBuilder: (context, index) { selectedColor: MyColors.darkPrimaryColor,
return Container(
width: double.infinity,
height: 1,
color: MyColors.borderColor,
); );
}, },
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: reasonList.length,
), ),
if (reason == "Other") if (reason == LocaleKeys.otherVar.tr()) ...[
12.height,
TxtField( TxtField(
hint: LocaleKeys.typeHere.tr(),
maxLines: 5, maxLines: 5,
keyboardType: TextInputType.text,
hint: LocaleKeys.description.tr(),
onChanged: (v) { onChanged: (v) {
reason = 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 == "Other") { if (reason.isEmpty && reason == LocaleKeys.otherVar.tr()) {
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(),

@ -133,16 +133,23 @@ 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,
if (isAppointmentAvailable)
CheckBoxWithTitleDescription( CheckBoxWithTitleDescription(
isSelected: isHomeAppointmentAvailable, isSelected: isHomeAppointmentAvailable,
title: LocaleKeys.allowingHomeService.tr(), title: LocaleKeys.allowingHomeService.tr(),
description: LocaleKeys.bookAppointmentAtLocation.tr(), description: LocaleKeys.bookAppointmentAtLocation.tr(),
onSelection: (bool v) { onSelection: (bool v) {
isHomeAppointmentAvailable = v; isHomeAppointmentAvailable = v;
if (isHomeAppointmentAvailable && !isAppointmentAvailable) {
isAppointmentAvailable = true;
}
model.setState(ViewState.idle); model.setState(ViewState.idle);
}, },
), ),
@ -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