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/dashboard/widget/general_appointment_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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/routes.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/models/appointments_models/appointment_list_model.dart';
import 'package:mc_common_app/theme/colors.dart';
@ -47,7 +44,7 @@ class _UpdateAppointmentPageState extends State<UpdateAppointmentPage> {
return RefreshIndicator(
onRefresh: () async => _updateAppointment(context, appointmentListModel.branchId ?? 0),
child: Column(
children: [
children: [
Expanded(
child: ListView(
padding: const EdgeInsets.all(21),
@ -86,7 +83,7 @@ class _UpdateAppointmentPageState extends State<UpdateAppointmentPage> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(child: showPayNowButton(context, appointmentsVM)),
Expanded(child: showPayNowButton(context, appointmentsVM, color: MyColors.greenColor)),
12.width,
Expanded(child: showCancelButton(context, appointmentsVM)),
],
@ -97,7 +94,13 @@ class _UpdateAppointmentPageState extends State<UpdateAppointmentPage> {
appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.defaultStatus))
Column(
children: [
showArrivedButton(context, appointmentsVM),
Row(
children: [
Expanded(child: showArrivedButton(context, appointmentsVM)),
12.width,
Expanded(child: showCancelButton(context, appointmentsVM)),
],
),
],
).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(
title: LocaleKeys.payNow.tr(),
maxWidth: double.infinity,
backgroundColor: color ?? MyColors.darkPrimaryColor,
onPressed: () async {
Utils.showLoading(context);
bool status = await appointmentsVM.updateAppointmentPaymentStatus({"appointmentID": appointmentListModel.id.toString(), "appointmentServicePaymentStatusID": 2});
@ -240,6 +244,8 @@ class _UpdateAppointmentPageState extends State<UpdateAppointmentPage> {
return ShowFillButton(
title: LocaleKeys.arrived.tr(),
maxWidth: double.infinity,
txtColor: MyColors.white,
backgroundColor: MyColors.greenColor,
onPressed: () async {
Utils.showLoading(context);
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(
title: LocaleKeys.cancel.tr(),
maxWidth: double.infinity,
isFilled: false,
txtColor: MyColors.redColor,
borderColor: MyColors.redColor,
txtColor: MyColors.white,
backgroundColor: MyColors.redColor,
onPressed: () {
showMyBottomSheet(
context,
child: ShowCollectPaymentSheet(
onClickYes: () {},
onClickNo: () {},
),
);
showModalBottomSheet(
context: pContext,
isScrollControlled: true,
builder: (context) => CancelAppointmentReasonSheet(
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:mc_common_app/classes/consts.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/models/chat_models/chat_message_model.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/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:easy_localization/easy_localization.dart';
class ShowCollectPaymentSheet extends StatelessWidget {
Function() onClickYes;
Function() onClickNo;
final Function() onClickYes;
final Function() onClickNo;
ShowCollectPaymentSheet(
{required this.onClickYes, required this.onClickNo, Key? key})
: super(key: key);
const ShowCollectPaymentSheet({required this.onClickYes, required this.onClickNo, super.key});
@override
Widget build(BuildContext context) {
@ -26,9 +25,9 @@ class ShowCollectPaymentSheet extends StatelessWidget {
child: Column(
children: [
LocaleKeys.collectMoneyBefore.tr().toText(
fontSize: 24,
isBold: true,
),
fontSize: 24,
isBold: true,
),
21.height,
Row(
children: [
@ -55,134 +54,91 @@ class ShowCollectPaymentSheet extends StatelessWidget {
}
}
class Reason {
String title;
bool isSelected;
Reason(this.title, this.isSelected);
}
class CancelAppointmentReasonSheet extends StatefulWidget {
Function(String) onCancelClick;
final Function(String) onCancelClick;
CancelAppointmentReasonSheet({required this.onCancelClick, Key? key})
: super(key: key);
const CancelAppointmentReasonSheet({required this.onCancelClick, super.key});
@override
State<CancelAppointmentReasonSheet> createState() =>
_CancelAppointmentReasonSheetState();
State<CancelAppointmentReasonSheet> createState() => _CancelAppointmentReasonSheetState();
}
class _CancelAppointmentReasonSheetState
extends State<CancelAppointmentReasonSheet> {
class _CancelAppointmentReasonSheetState extends State<CancelAppointmentReasonSheet> {
String reason = "";
List<Reason> reasonList = [
Reason("Operational Issue", true),
Reason("Material Issue", false),
Reason("The customer no longer responding", false),
Reason("Other", false),
List<OfferRequestCommentModel> reasonList = [
OfferRequestCommentModel(title: LocaleKeys.operationalIssue.tr(), isSelected: true, index: 0),
OfferRequestCommentModel(title: LocaleKeys.materialIssue.tr(), isSelected: false, index: 1),
OfferRequestCommentModel(title: LocaleKeys.customerNotResponding.tr(), isSelected: false, index: 2),
OfferRequestCommentModel(title: LocaleKeys.otherVar.tr(), isSelected: false, index: 3),
];
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.only(left: 21, right: 21, top: 12, bottom: 21),
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.reason.tr().toText(fontSize: 24, isBold: true),
ListView.separated(
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.only(top: 12, bottom: 12),
child: Row(
children: [
Container(
width: 14,
height: 14,
decoration: BoxDecoration(
color: reasonList[index].isSelected
? MyColors.darkPrimaryColor
: Colors.transparent,
borderRadius: BorderRadius.circular(122),
border: Border.all(
color: reasonList[index].isSelected
? MyColors.darkPrimaryColor
: borderColor,
width: 1),
),
child: const Icon(
Icons.done,
size: 12,
color: Colors.white,
),
return InfoBottomSheet(
title: LocaleKeys.pleaseSpecify.tr().toText(fontSize: 28, isBold: true, letterSpacing: -1.44, height: 1),
description: Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.selectReasonBeforeCancel.tr().toText(fontSize: 13, color: MyColors.lightTextColor, fontWeight: MyFonts.Medium),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
12.height,
ListView.separated(
shrinkWrap: true,
itemCount: reasonList.length,
separatorBuilder: (BuildContext context, int index) {
return const Divider(thickness: 0.5);
},
itemBuilder: (BuildContext context, int index) {
OfferRequestCommentModel offerRequestCommentModel = reasonList[index];
return CircleCheckBoxWithTitle(
isChecked: offerRequestCommentModel.isSelected ?? false,
title: '${offerRequestCommentModel.title}',
onSelected: () {
for (var element in reasonList) {
element.isSelected = false;
}
setState(() {
reason = reasonList[index].title ?? "";
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,
Expanded(
child: ShowFillButton(
title: LocaleKeys.yes.tr(),
onPressed: () {
if (reason.isEmpty || reason == "Other") {
Utils.showToast(LocaleKeys.pleaseSelectReason.tr());
} else {
widget.onCancelClick(reason);
pop(context);
}
},
),
25.height,
ShowFillButton(
title: LocaleKeys.cancel.tr(),
onPressed: () {
if (reason.isEmpty && reason == LocaleKeys.otherVar.tr()) {
Utils.showToast(LocaleKeys.pleaseSelectReason.tr());
} else {
widget.onCancelClick(reason);
}
},
maxWidth: double.infinity,
),
19.height,
],
)
],
),
);
),
));
}
}

@ -180,7 +180,7 @@ class _DefineBranchViewState extends State<DefineBranchView> {
text: LocaleKeys.attachImage.tr(),
icon: MyAssets.attachmentIcon.buildSvg(),
),
],
],
if (serviceVM.branchImageError != "") ...[
10.height,
Row(
@ -249,8 +249,8 @@ class _DefineBranchViewState extends State<DefineBranchView> {
closedTime: serviceVM.closedTime,
cityID: serviceVM.cityId,
address: serviceVM.address,
latitude: widget.branchData!.latitude ?? "0",
longitude: widget.branchData!.longitude ?? "0",
latitude: (serviceVM.latitude).toString(),
longitude: (serviceVM.longitude).toString(),
);
},
).horPaddingMain(),

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

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

Loading…
Cancel
Save