Fixed the notes list

master_new_changes
Faiz Hashmi 1 year ago
parent f0a9c294c2
commit bb954b9771

@ -645,5 +645,7 @@
"searchByVehicleModel": "البحث حسب طراز المركبة", "searchByVehicleModel": "البحث حسب طراز المركبة",
"customerCarePrompt": "هل لديك أي استفسار؟ نحن هنا لخدمتك. انقر هنا للتحدث مع خدمة العملاء لدينا الآن.", "customerCarePrompt": "هل لديك أي استفسار؟ نحن هنا لخدمتك. انقر هنا للتحدث مع خدمة العملاء لدينا الآن.",
"callNow": "اتصل الآن", "callNow": "اتصل الآن",
"condition": "الحالة" "condition": "الحالة",
"servicesNotAvailableHomeLocation": "بعض الخدمات غير متوفرة في الموقع المنزلي.",
"additionalChargesNotice": "هذه الرسوم إضافية على رسوم الخدمة الفعلية. قد تختلف الرسوم للعناصر الثقيلة."
} }

@ -646,5 +646,7 @@
"searchByVehicleModel": "Search By Vehicle Model", "searchByVehicleModel": "Search By Vehicle Model",
"customerCarePrompt": "Got any question? We are here to service. Click here to talk to our customer care right now.", "customerCarePrompt": "Got any question? We are here to service. Click here to talk to our customer care right now.",
"callNow": "Call Now", "callNow": "Call Now",
"condition": "Condition" "condition": "Condition",
"servicesNotAvailableHomeLocation": "Some services are not available on home location.",
"additionalChargesNotice": "These charges are additional to the actual service charges. For heavy items the charges may vary."
} }

@ -661,7 +661,9 @@ class CodegenLoader extends AssetLoader{
"searchByVehicleModel": "البحث حسب طراز المركبة", "searchByVehicleModel": "البحث حسب طراز المركبة",
"customerCarePrompt": "هل لديك أي استفسار؟ نحن هنا لخدمتك. انقر هنا للتحدث مع خدمة العملاء لدينا الآن.", "customerCarePrompt": "هل لديك أي استفسار؟ نحن هنا لخدمتك. انقر هنا للتحدث مع خدمة العملاء لدينا الآن.",
"callNow": "اتصل الآن", "callNow": "اتصل الآن",
"condition": "الحالة" "condition": "الحالة",
"servicesNotAvailableHomeLocation": "بعض الخدمات غير متوفرة في الموقع المنزلي.",
"additionalChargesNotice": "هذه الرسوم إضافية على رسوم الخدمة الفعلية. قد تختلف الرسوم للعناصر الثقيلة."
}; };
static const Map<String,dynamic> en_US = { static const Map<String,dynamic> en_US = {
"firstTimeLogIn": "First Time Log In", "firstTimeLogIn": "First Time Log In",
@ -1311,7 +1313,9 @@ static const Map<String,dynamic> en_US = {
"searchByVehicleModel": "Search By Vehicle Model", "searchByVehicleModel": "Search By Vehicle Model",
"customerCarePrompt": "Got any question? We are here to service. Click here to talk to our customer care right now.", "customerCarePrompt": "Got any question? We are here to service. Click here to talk to our customer care right now.",
"callNow": "Call Now", "callNow": "Call Now",
"condition": "Condition" "condition": "Condition",
"servicesNotAvailableHomeLocation": "Some services are not available on home location.",
"additionalChargesNotice": "These charges are additional to the actual service charges. For heavy items the charges may vary."
}; };
static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US};
} }

@ -625,5 +625,7 @@ abstract class LocaleKeys {
static const customerCarePrompt = 'customerCarePrompt'; static const customerCarePrompt = 'customerCarePrompt';
static const callNow = 'callNow'; static const callNow = 'callNow';
static const condition = 'condition'; static const condition = 'condition';
static const servicesNotAvailableHomeLocation = 'servicesNotAvailableHomeLocation';
static const additionalChargesNotice = 'additionalChargesNotice';
} }

@ -474,10 +474,9 @@ class AppointmentsVM extends BaseVM {
int selectedSubServicesCounter = 0; int selectedSubServicesCounter = 0;
void onItemUpdateOrSelected(int index, bool selected, int itemId) { void onItemUpdateOrSelected(int index, bool selected, int itemId) {
int serviceIndex = servicesInCurrentAppointment.indexWhere((element) => element.serviceId == currentServiceSelection!.serviceId!); int serviceIndex = 0;
// print("servicesInCurrentAppointment: ${servicesInCurrentAppointment.length}"); if (servicesInCurrentAppointment.isNotEmpty) {
if (serviceIndex == -1) { serviceIndex = servicesInCurrentAppointment.indexWhere((element) => element.serviceId == currentServiceSelection!.serviceId!);
return;
} }
log("index: $index"); log("index: $index");
@ -500,7 +499,6 @@ class AppointmentsVM extends BaseVM {
} }
} else { } else {
log("currentServiceSelection!.serviceItems: ${currentServiceSelection!.serviceItems!.length}"); log("currentServiceSelection!.serviceItems: ${currentServiceSelection!.serviceItems!.length}");
selectedSubServicesCounter = selectedSubServicesCounter - 1; selectedSubServicesCounter = selectedSubServicesCounter - 1;
currentServiceSelection!.serviceItems!.removeWhere((element) => element.id == itemId); currentServiceSelection!.serviceItems!.removeWhere((element) => element.id == itemId);
log("currentServiceSelection!.serviceItems: ${currentServiceSelection!.serviceItems!.length}"); log("currentServiceSelection!.serviceItems: ${currentServiceSelection!.serviceItems!.length}");

@ -34,7 +34,7 @@ class _DamagePicturesListState extends State<DamagePicturesList> {
child: Consumer<AppointmentsVM>( child: Consumer<AppointmentsVM>(
builder: (context, appointmentsVM, _) { builder: (context, appointmentsVM, _) {
if (appointmentsVM.state == ViewState.busy) { if (appointmentsVM.state == ViewState.busy) {
return Center(child: CircularProgressIndicator()); return const Center(child: CircularProgressIndicator());
} }
return appointmentsVM.serviceItemsFromApi.isEmpty return appointmentsVM.serviceItemsFromApi.isEmpty
? const EmptyWidget() ? const EmptyWidget()
@ -55,9 +55,9 @@ class _DamagePicturesListState extends State<DamagePicturesList> {
children: [ children: [
serviceItemModel.name.toString().toText(fontSize: 16, isBold: true), serviceItemModel.name.toString().toText(fontSize: 16, isBold: true),
4.height, 4.height,
showItem(LocaleKeys.availableforAppointment.tr() + ":", (serviceItemModel.isAllowAppointment ?? false) ? "Yes" : "No", valueColor: Colors.green), showItem("${LocaleKeys.availableforAppointment.tr()}:", (serviceItemModel.isAllowAppointment ?? false) ? "Yes" : "No", valueColor: Colors.green),
showItem(LocaleKeys.allowingWorkshopService.tr() + ":", (serviceItemModel.isAppointmentCompanyLoc ?? false) ? "Yes" : "No", valueColor: Colors.green), showItem("${LocaleKeys.allowingWorkshopService.tr()}:", (serviceItemModel.isAppointmentCompanyLoc ?? false) ? "Yes" : "No", valueColor: Colors.green),
showItem(LocaleKeys.allowingHomeService.tr() + ":", (serviceItemModel.isAppointmentCustomerLoc ?? false) ? "Yes" : "No", valueColor: Colors.green), showItem("${LocaleKeys.allowingHomeService.tr()}:", (serviceItemModel.isAppointmentCustomerLoc ?? false) ? "Yes" : "No", valueColor: Colors.green),
12.height, 12.height,
LocaleKeys.serviceAmount.tr().toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true), LocaleKeys.serviceAmount.tr().toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
Row( Row(

@ -1,18 +1,21 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.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/extensions/string_extensions.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/models/general_models/widgets_models.dart'; import 'package:mc_common_app/models/general_models/widgets_models.dart';
import 'package:mc_common_app/theme/colors.dart'; import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/utils/navigator.dart'; import 'package:mc_common_app/utils/navigator.dart';
import 'package:mc_common_app/view_models/appointments_view_model.dart'; import 'package:mc_common_app/view_models/appointments_view_model.dart';
import 'package:mc_common_app/views/location_views/pick_location_page.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/dropdown/dropdow_field.dart'; import 'package:mc_common_app/widgets/dropdown/dropdow_field.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/txt_field.dart'; import 'package:mc_common_app/widgets/txt_field.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class AppointmentServicePickBottomSheet extends StatelessWidget { class AppointmentServicePickBottomSheet extends StatelessWidget {
const AppointmentServicePickBottomSheet({Key? key}) : super(key: key); const AppointmentServicePickBottomSheet({Key? key}) : super(key: key);
@ -33,7 +36,7 @@ class AppointmentServicePickBottomSheet extends StatelessWidget {
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
"Select Category".toText(fontSize: 24, isBold: true), LocaleKeys.selectCategory.tr().toText(fontSize: 24, isBold: true),
], ],
), ),
30.height, 30.height,
@ -45,10 +48,8 @@ class AppointmentServicePickBottomSheet extends StatelessWidget {
return DropdownField( return DropdownField(
(DropValue value) => appointmentsVM.updateProviderCategoryId(SelectionModel(selectedId: value.id, selectedOption: value.value, itemPrice: value.subValue)), (DropValue value) => appointmentsVM.updateProviderCategoryId(SelectionModel(selectedId: value.id, selectedOption: value.value, itemPrice: value.subValue)),
list: appointmentsVM.branchCategories, list: appointmentsVM.branchCategories,
hint: "Select Category", hint: LocaleKeys.selectCategory.tr(),
dropdownValue: appointmentsVM.branchSelectedCategoryId.selectedId != -1 dropdownValue: appointmentsVM.branchSelectedCategoryId.selectedId != -1 ? DropValue(appointmentsVM.branchSelectedCategoryId.selectedId, appointmentsVM.branchSelectedCategoryId.selectedOption, "") : null,
? DropValue(appointmentsVM.branchSelectedCategoryId.selectedId, appointmentsVM.branchSelectedCategoryId.selectedOption, "")
: null,
); );
}, },
), ),
@ -75,10 +76,8 @@ class AppointmentServicePickBottomSheet extends StatelessWidget {
return DropdownField( return DropdownField(
(DropValue value) => appointmentsVM.updateBranchServiceId(SelectionModel(selectedId: value.id, selectedOption: value.value, itemPrice: value.subValue)), (DropValue value) => appointmentsVM.updateBranchServiceId(SelectionModel(selectedId: value.id, selectedOption: value.value, itemPrice: value.subValue)),
list: serviceCategories, list: serviceCategories,
hint: "Select Service", hint: LocaleKeys.selectService.tr(),
dropdownValue: appointmentsVM.branchSelectedServiceId.selectedId != -1 dropdownValue: appointmentsVM.branchSelectedServiceId.selectedId != -1 ? DropValue(appointmentsVM.branchSelectedServiceId.selectedId, appointmentsVM.branchSelectedServiceId.selectedOption, "") : null,
? DropValue(appointmentsVM.branchSelectedServiceId.selectedId, appointmentsVM.branchSelectedServiceId.selectedOption, "")
: null,
); );
}, },
), ),
@ -101,7 +100,7 @@ class AppointmentServicePickBottomSheet extends StatelessWidget {
child: ShowFillButton( child: ShowFillButton(
isFilled: appointmentsVM.isHomeTapped, isFilled: appointmentsVM.isHomeTapped,
maxHeight: 48, maxHeight: 48,
title: "Home", title: LocaleKeys.home.tr(),
txtColor: appointmentsVM.isHomeTapped ? MyColors.white : MyColors.darkTextColor, txtColor: appointmentsVM.isHomeTapped ? MyColors.white : MyColors.darkTextColor,
onPressed: () => appointmentsVM.updateIsHomeTapped(true), onPressed: () => appointmentsVM.updateIsHomeTapped(true),
), ),
@ -112,7 +111,7 @@ class AppointmentServicePickBottomSheet extends StatelessWidget {
isFilled: !appointmentsVM.isHomeTapped, isFilled: !appointmentsVM.isHomeTapped,
txtColor: !appointmentsVM.isHomeTapped ? MyColors.white : MyColors.darkTextColor, txtColor: !appointmentsVM.isHomeTapped ? MyColors.white : MyColors.darkTextColor,
maxHeight: 48, maxHeight: 48,
title: "Workshop", title: LocaleKeys.workshop.tr(),
onPressed: () => appointmentsVM.updateIsHomeTapped(false), onPressed: () => appointmentsVM.updateIsHomeTapped(false),
), ),
), ),
@ -121,32 +120,31 @@ class AppointmentServicePickBottomSheet extends StatelessWidget {
if (appointmentsVM.isHomeTapped) ...[ if (appointmentsVM.isHomeTapped) ...[
8.height, 8.height,
TxtField( TxtField(
hint: 'Pick Home Location', hint: LocaleKeys.pickLocation.tr(),
errorValue: appointmentsVM.pickHomeLocationError, errorValue: appointmentsVM.pickHomeLocationError,
value: appointmentsVM.pickedHomeLocation, value: appointmentsVM.pickedHomeLocation,
isNeedClickAll: true, isNeedClickAll: true,
postfixData: Icons.location_on, postfixData: Icons.location_on,
postFixDataColor: MyColors.darkTextColor, postFixDataColor: MyColors.darkTextColor,
onTap: () { onTap: () {
//TODO: open the place picked to pick the location and save it in provider. navigateTo(
appointmentsVM.updatePickedHomeLocation("PM58+F97, Al Olaya, Riyadh 12333"); context,
PickLocationPage(
onPickAddress: (double latitude, double longitude, String address) {
appointmentsVM.updatePickedHomeLocation(address);
appointmentsVM.setState(ViewState.idle);
},
),
);
}, },
), ),
14.height, 14.height,
Row( Row(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
const Icon( const Icon(Icons.warning, color: MyColors.adPendingStatusColor, size: 19).paddingOnly(bottom: 2),
Icons.warning,
color: MyColors.adPendingStatusColor,
size: 19,
).paddingOnly(bottom: 2),
3.width, 3.width,
"Some services are not available on home location.".toText( LocaleKeys.servicesNotAvailableHomeLocation.tr().toText(color: MyColors.adPendingStatusColor, fontSize: 12, isItalic: true),
color: MyColors.adPendingStatusColor,
fontSize: 12,
isItalic: true,
),
], ],
), ),
] ]
@ -165,10 +163,10 @@ class AppointmentServicePickBottomSheet extends StatelessWidget {
children: [ children: [
// TODO: This Price will be decided according to the service selected, We will calculate the KMs and multiple it with price per KMs // TODO: This Price will be decided according to the service selected, We will calculate the KMs and multiple it with price per KMs
150.toString().toText(fontSize: 30, isBold: true), 150.toString().toText(fontSize: 30, isBold: true),
"SAR".toText(fontSize: 15, isBold: true, color: MyColors.lightTextColor).paddingOnly(bottom: 5), LocaleKeys.sar.tr().toText(fontSize: 15, isBold: true, color: MyColors.lightTextColor).paddingOnly(bottom: 5),
], ],
), ),
"These charges are additional to the actual service charges. For heavy items the charges may vary.".toText(fontSize: 12, color: MyColors.lightTextColor), LocaleKeys.additionalChargesNotice.tr().toText(fontSize: 12, color: MyColors.lightTextColor),
22.height, 22.height,
], ],
SizedBox( SizedBox(
@ -176,7 +174,7 @@ class AppointmentServicePickBottomSheet extends StatelessWidget {
child: ShowFillButton( child: ShowFillButton(
maxHeight: 55, maxHeight: 55,
backgroundColor: !appointmentsVM.isServiceSelectionValidated() ? MyColors.lightTextColor.withOpacity(0.6) : MyColors.darkPrimaryColor, backgroundColor: !appointmentsVM.isServiceSelectionValidated() ? MyColors.lightTextColor.withOpacity(0.6) : MyColors.darkPrimaryColor,
title: "Next", title: LocaleKeys.next.tr(),
onPressed: () { onPressed: () {
bool isValidated = appointmentsVM.isServiceSelectionValidated(); bool isValidated = appointmentsVM.isServiceSelectionValidated();
if (isValidated) { if (isValidated) {

Loading…
Cancel
Save