addnew service fix

aamir_dev
Faiz Hashmi 11 months ago
parent 07c3fa4164
commit 618a27ab4d

@ -757,5 +757,8 @@
"noAvailableOfficesInCity": "لا توجد مكاتب متاحة في مدينتك لخدمتك.",
"searchByItem": "البحث حسب العنصر",
"selectBranchToCopyServices": "حدد الفرع لنسخ العناصر الخاصة بهم إلى هذا الفرع. يمكنك تعديل الاختيار في أي وقت.",
"tapToSelect": "Tap to select"
"tapToSeeItems": "اضغط لرؤية العناصر",
"tapToSelect": "اضغط للاختيار",
"noteCopyItemsExplanation": "ملاحظة: ستتمكن من نسخ العناصر من خدمة إلى أخرى في الفئة المحددة. يجب عليك إنشاء الخدمات أولاً ويجب أن تكون معتمدة. ثم ستتمكن من الحصول على الخدمات المتاحة التي يمكنك نسخ جميع العناصر منها أو تحديد العناصر التي تريد نسخها.",
"requestCreatedOn": "تم إنشاء الطلب في"
}

@ -755,5 +755,8 @@
"noAvailableOfficesInCity": "There are no available offices in your city for your service.",
"searchByItem": "Search By Item",
"selectBranchToCopyServices": "Select the branch to copy their items to this branch. You can modify the selection at any time.",
"tapToSelect": "Tap to select"
"tapToSelect": "Tap to select",
"tapToSeeItems": "Tap to see items",
"noteCopyItemsExplanation": "Note: You will be able to copy items from one service to another in a selected category. You must create the services first and they should be approved. Then you will be able to get the available services from which you can copy all or selected items.",
"requestCreatedOn": "Request created on"
}

@ -773,7 +773,10 @@ class CodegenLoader extends AssetLoader{
"noAvailableOfficesInCity": "لا توجد مكاتب متاحة في مدينتك لخدمتك.",
"searchByItem": "البحث حسب العنصر",
"selectBranchToCopyServices": "حدد الفرع لنسخ العناصر الخاصة بهم إلى هذا الفرع. يمكنك تعديل الاختيار في أي وقت.",
"tapToSelect": "Tap to select"
"tapToSeeItems": "اضغط لرؤية العناصر",
"tapToSelect": "اضغط للاختيار",
"noteCopyItemsExplanation": "ملاحظة: ستتمكن من نسخ العناصر من خدمة إلى أخرى في الفئة المحددة. يجب عليك إنشاء الخدمات أولاً ويجب أن تكون معتمدة. ثم ستتمكن من الحصول على الخدمات المتاحة التي يمكنك نسخ جميع العناصر منها أو تحديد العناصر التي تريد نسخها.",
"requestCreatedOn": "تم إنشاء الطلب في"
};
static const Map<String,dynamic> en_US = {
"firstTimeLogIn": "First Time Log In",
@ -1532,7 +1535,10 @@ static const Map<String,dynamic> en_US = {
"noAvailableOfficesInCity": "There are no available offices in your city for your service.",
"searchByItem": "Search By Item",
"selectBranchToCopyServices": "Select the branch to copy their items to this branch. You can modify the selection at any time.",
"tapToSelect": "Tap to select"
"tapToSelect": "Tap to select",
"tapToSeeItems": "Tap to see items",
"noteCopyItemsExplanation": "Note: You will be able to copy items from one service to another in a selected category. You must create the services first and they should be approved. Then you will be able to get the available services from which you can copy all or selected items.",
"requestCreatedOn": "Request created on"
};
static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US};
}

@ -736,6 +736,9 @@ abstract class LocaleKeys {
static const noAvailableOfficesInCity = 'noAvailableOfficesInCity';
static const searchByItem = 'searchByItem';
static const selectBranchToCopyServices = 'selectBranchToCopyServices';
static const tapToSeeItems = 'tapToSeeItems';
static const tapToSelect = 'tapToSelect';
static const noteCopyItemsExplanation = 'noteCopyItemsExplanation';
static const requestCreatedOn = 'requestCreatedOn';
}

@ -236,7 +236,7 @@ class BranchRepoImp implements BranchRepo {
GenericRespModel adsGenericModel = await apiClient.getJsonForObject(
token: t,
(json) => GenericRespModel.fromJson(json),
(json) => GenericRespModel.fromJson(json),
ApiConsts.serviceProviderDDLGet,
);
List<ProviderBasicDataModel> providersList = List.generate(adsGenericModel.data.length, (index) => ProviderBasicDataModel.fromJson(adsGenericModel.data[index]));
@ -268,7 +268,8 @@ class BranchRepoImp implements BranchRepo {
serviceProviderBranchImages.add(imageMap);
}
String lat = "0", long = "0";
String lat = "0",
long = "0";
try {
lat = latitude.toString().substring(0, 9);
long = longitude.toString().substring(0, 9);
@ -340,7 +341,7 @@ class BranchRepoImp implements BranchRepo {
String t = AppState().getUser.data!.accessToken ?? "";
GenericRespModel genericRespModel = await apiClient.getJsonForObject(
(json) => GenericRespModel.fromJson(json),
(json) => GenericRespModel.fromJson(json),
ApiConsts.serviceProviderAppointmentGetByCategoryOrService,
queryParameters: map,
token: t,
@ -415,7 +416,7 @@ class BranchRepoImp implements BranchRepo {
String t = AppState().getUser.data!.accessToken ?? "";
GenericRespModel adsGenericModel = await apiClient.getJsonForObject(
(json) => GenericRespModel.fromJson(json),
(json) => GenericRespModel.fromJson(json),
ApiConsts.getAllNearBranches,
token: appState.getUser.data!.accessToken,
queryParameters: queryParameters,
@ -443,7 +444,7 @@ class BranchRepoImp implements BranchRepo {
"longitude": longitude.toString(),
};
GenericRespModel adsGenericModel = await apiClient.getJsonForObject(
(json) => GenericRespModel.fromJson(json),
(json) => GenericRespModel.fromJson(json),
ApiConsts.getAllNearBranches,
token: appState.getUser.data!.accessToken,
queryParameters: queryParameters,
@ -455,7 +456,7 @@ class BranchRepoImp implements BranchRepo {
@override
Future<List<BranchDetailModel>> getMyRecentBranchesWithServices() async {
GenericRespModel adsGenericModel = await apiClient.getJsonForObject(
(json) => GenericRespModel.fromJson(json),
(json) => GenericRespModel.fromJson(json),
ApiConsts.getMyRecentBranches,
token: appState.getUser.data!.accessToken,
);
@ -470,7 +471,7 @@ class BranchRepoImp implements BranchRepo {
};
GenericRespModel adsGenericModel = await apiClient.getJsonForObject(
(json) => GenericRespModel.fromJson(json),
(json) => GenericRespModel.fromJson(json),
ApiConsts.getServiceItems,
token: appState.getUser.data!.accessToken,
queryParameters: serviceId.toString() != "-1" ? queryParameters : null,
@ -490,7 +491,7 @@ class BranchRepoImp implements BranchRepo {
postParams.addAll({"Latitude": "$latitude"});
}
GenericRespModel adsGenericModel =
await apiClient.getJsonForObject((json) => GenericRespModel.fromJson(json), ApiConsts.branchesAndServices, token: appState.getUser.data!.accessToken, queryParameters: postParams);
await apiClient.getJsonForObject((json) => GenericRespModel.fromJson(json), ApiConsts.branchesAndServices, token: appState.getUser.data!.accessToken, queryParameters: postParams);
return ProviderProfileModel.fromJson(adsGenericModel.data);
}
@ -535,7 +536,7 @@ class BranchRepoImp implements BranchRepo {
};
GenericRespModel adsGenericModel = await apiClient.getJsonForObject(
(json) => GenericRespModel.fromJson(json),
(json) => GenericRespModel.fromJson(json),
ApiConsts.getAllNearBranches,
token: appState.getUser.data!.accessToken,
queryParameters: postParams,
@ -549,7 +550,7 @@ class BranchRepoImp implements BranchRepo {
var postParams = {"ServiceProviderBranchID": serviceProviderBranchID.toString()};
GenericRespModel adsGenericModel = await apiClient.getJsonForObject(
(json) => GenericRespModel.fromJson(json),
(json) => GenericRespModel.fromJson(json),
ApiConsts.getBranchRatings,
token: appState.getUser.data!.accessToken,
queryParameters: postParams,
@ -563,7 +564,7 @@ class BranchRepoImp implements BranchRepo {
final customerID = appState.getUser.data!.userInfo!.customerId;
final parameters = {"title": title, "review": review, "ratNo": ratingNo, "serviceProviderBranchID": serviceProviderBranchID, "customerID": "$customerID"};
GenericRespModel adsGenericModel = await apiClient.postJsonForObject(
(json) => GenericRespModel.fromJson(json),
(json) => GenericRespModel.fromJson(json),
ApiConsts.createBranchRatings,
parameters,
token: appState.getUser.data!.accessToken,
@ -579,7 +580,7 @@ class BranchRepoImp implements BranchRepo {
"customerID": customerID.toString(),
};
GenericRespModel adsGenericModel = await apiClient.postJsonForObject(
(json) => GenericRespModel.fromJson(json),
(json) => GenericRespModel.fromJson(json),
ApiConsts.favouriteServiceProviderCreate,
parameters,
token: appState.getUser.data!.accessToken,
@ -591,7 +592,7 @@ class BranchRepoImp implements BranchRepo {
Future<GenericRespModel> removeProviderFromFavourite({required int providerID}) async {
final parameters = {"id": providerID.toString()};
GenericRespModel adsGenericModel = await apiClient.postJsonForObject(
(json) => GenericRespModel.fromJson(json),
(json) => GenericRespModel.fromJson(json),
ApiConsts.unFavouriteServiceProvider,
parameters,
token: appState.getUser.data!.accessToken,
@ -606,7 +607,7 @@ class BranchRepoImp implements BranchRepo {
var postParams = {"customerID": customerID.toString()};
GenericRespModel adsGenericModel = await apiClient.getJsonForObject(
(json) => GenericRespModel.fromJson(json),
(json) => GenericRespModel.fromJson(json),
ApiConsts.favouriteServiceProviderGet,
token: appState.getUser.data!.accessToken,
queryParameters: postParams,

@ -219,7 +219,8 @@ class AdVM extends BaseVM {
notifyListeners();
}
int currentPage = 1;
int currentPageForExploreAds = 1;
int currentPageForMyAds = 1;
bool isLoadingMore = false;
bool hasMoreData = true;

@ -398,10 +398,14 @@ class AppointmentsVM extends BaseVM {
// Create a list of CustomerData instances
myFilteredAppointments2 = uniqueCustomerIDs.map((id) {
List<AppointmentListModel> list = myFilteredAppointments.where((item) => item.customerID == id).toList();
list.sort((a, b) => DateHelper.parseStringToDate(DateHelper.formatDateT(b.appointmentDate!))
.millisecondsSinceEpoch
.compareTo(DateHelper.parseStringToDate(DateHelper.formatDateT(a.appointmentDate!)).millisecondsSinceEpoch));
AppointmentListModel model = list.first;
model.customerAppointmentList = list;
return model;
}).toList();
// customersAppointments = uniqueCustomerIDs.map((id) {
// List<AppointmentListModel> list = myFilteredAppointments
// .where((item) => item.customerID == id)

@ -98,7 +98,7 @@ class ChatVM extends BaseVM {
}
List<int> indexesForCancelSpecialCarOffer = [0, 1, 5, 6, 10];
List<int> indexesForCancelSparePartOffer = [2, 5, 10];
List<int> indexesForCancelSparePartOffer = [2, 5, 6, 10];
List<int> indexesForRejectOffer = [3, 4, 10];
List<int> indexesForDealNotCompleted = [7, 4, 8, 9, 10];

@ -272,7 +272,11 @@ class ServiceVM extends BaseVM {
context,
allowMultiple: false,
);
if (files != null && files.any((element) => element.path.split('.').last.toLowerCase() != 'pdf')) {
if (files != null && files.any((element) =>
element.path
.split('.')
.last
.toLowerCase() != 'pdf')) {
Utils.showToast("Only PDF Files are allowed");
return;
}
@ -286,8 +290,8 @@ class ServiceVM extends BaseVM {
documentID == 1
? commerceCertificates.addAll(imageModels)
: documentID == 2
? commercialCertificates.addAll(imageModels)
: vatCertificates.addAll(imageModels);
? commercialCertificates.addAll(imageModels)
: vatCertificates.addAll(imageModels);
document!.data![index].document = Utils.convertFileToBase64(files.first);
document!.data![index].fileExt = Utils.checkFileExt(files.first.path);
document!.data![index].documentUrl = files.first.path;
@ -463,10 +467,10 @@ class ServiceVM extends BaseVM {
DropValue(
element.id ?? 0,
((element.categoryName!.isEmpty
? "N/A"
: countryCode == "SA"
? element.categoryNameN
: element.categoryName) ??
? "N/A"
: countryCode == "SA"
? element.categoryNameN
: element.categoryName) ??
"N/A"),
"",
),
@ -626,7 +630,7 @@ class ServiceVM extends BaseVM {
List<ServiceModel>? matchedServices;
bool isAllSelected = false;
Future<void> getAllMatchedServices(int oldBranchId, int newBranchId, int categoryId) async {
Future<void> getAllMatchedServices({required int oldBranchId, required int newBranchId, required int categoryId}) async {
matchedServices = null;
final GenericRespModel response = await branchRepo.getMatchedServices(oldBranchId, newBranchId, categoryId);
matchedServices = [];
@ -747,7 +751,9 @@ class ServiceVM extends BaseVM {
File file = File(imageModel.filePath!);
List<int> imageBytes = await file.readAsBytes();
String image = base64Encode(imageBytes);
String fileName = file.path.split('/').last;
String fileName = file.path
.split('/')
.last;
branchPostingImages = BranchPostingImages(
imageName: fileName,
imageStr: image,

@ -44,10 +44,10 @@ class AdsListWidget extends StatelessWidget {
}
return NotificationListener<ScrollNotification>(
onNotification: (ScrollNotification scrollInfo) {
if (scrollInfo.metrics.pixels == scrollInfo.metrics.maxScrollExtent && context
.read<AdVM>()
.hasMoreData) {
log("should call more ads api:");
if (scrollInfo.metrics.pixels == scrollInfo.metrics.maxScrollExtent && context.read<AdVM>().hasMoreData) {
if (onFetchMoreAds != null) {
onFetchMoreAds!();
}
}
return false;
},
@ -104,9 +104,7 @@ class AdCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
if (isAdsFragment && !context
.read<AdVM>()
.isExploreAdsTapped) ...[
if (isAdsFragment && !context.read<AdVM>().isExploreAdsTapped) ...[
Utils.statusContainerChip(text: adDetails.statuslabel!, chipColor: Utils.getChipColorByAdStatus(adDetails.adPostStatus!)),
],
(adDetails.vehicle!.vehicleTitle ?? "").toText(

@ -776,7 +776,7 @@ class _ChatMessageCustomWidgetState extends State<ChatMessageCustomWidget> {
],
Expanded(
child: Directionality(
textDirection: (widget.chatMessageModel.isMyMessage ?? false) ? TextDirection.ltr : TextDirection.rtl,
textDirection: TextDirection.ltr,
child: (widget.chatMessageModel.chatText ?? "").toText(
color: (widget.chatMessageModel.isMyMessage ?? false) ? MyColors.white : MyColors.lightTextColor,
fontSize: 12,
@ -901,19 +901,18 @@ class _ChatMessageCustomWidgetState extends State<ChatMessageCustomWidget> {
case ChatMessageTypeEnum.file:
case ChatMessageTypeEnum.offer:
messageTypeWidget = Column(
crossAxisAlignment: (widget.chatMessageModel.isMyMessage ?? false) ? CrossAxisAlignment.end : CrossAxisAlignment.start,
children: [
buildFreeTextDetailsInMessage(chatMessageTypeEnum: chatMessageTypeEnum),
if (widget.requestsTypeEnum == RequestsTypeEnum.serviceRequest) ...[
2.height,
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
"${LocaleKeys.deliveryAvailable.tr()} : ${(widget.chatMessageModel.reqOffer!.isDeliveryAvailable ?? false) ? LocaleKeys.yes.tr() : LocaleKeys.no.tr()}".toText(
fontSize: 10,
color: (widget.chatMessageModel.isMyMessage ?? false) ? MyColors.white : MyColors.lightTextColor,
fontWeight: MyFonts.Medium,
),
],
Directionality(
textDirection: TextDirection.ltr,
child: "${LocaleKeys.deliveryAvailable.tr()} : ${(widget.chatMessageModel.reqOffer!.isDeliveryAvailable ?? false) ? LocaleKeys.yes.tr() : LocaleKeys.no.tr()}".toText(
fontSize: 10,
color: (widget.chatMessageModel.isMyMessage ?? false) ? MyColors.white : MyColors.lightTextColor,
fontWeight: MyFonts.Medium,
),
),
],
if (widget.chatMessageModel.reqOffer!.reqOfferImages != null && widget.chatMessageModel.reqOffer!.reqOfferImages!.isNotEmpty) ...[

@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:mc_common_app/classes/app_state.dart';
@ -139,7 +141,9 @@ class AdsFragment extends StatelessWidget {
isAdsFragment: true,
shouldShowAdStatus: !adVM.isExploreAdsTapped,
adsList: getAdsList(adVM),
onFetchMoreAds: () {},
onFetchMoreAds: () {
log("fetch more ads");
},
),
),
)

@ -94,20 +94,25 @@ class _ReviewRequestOfferState extends State<ReviewRequestOffer> {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
LocaleKeys.locationInformation.tr().toText(fontSize: 18),
MyAssets.icEdit.buildSvg().onPress(() => buildLocationInformationEditBottomSheet(context, requestVM)),
],
),
LocaleKeys.locationInformation.tr().toText(fontSize: 18),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// LocaleKeys.locationInformation.tr().toText(fontSize: 18),
// MyAssets.icEdit.buildSvg().onPress(() => buildLocationInformationEditBottomSheet(context, requestVM)),
// ],
// ),
8.height,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SingleDetailWidget(text: requestVM.currentSelectedRequest!.address ?? "", type: LocaleKeys.location.tr()),
16.height,
SingleDetailWidget(text: requestVM.additionalAddressSparePartRequestDelivery.isNotEmpty ? requestVM.additionalAddressSparePartRequestDelivery : "N/A", type: LocaleKeys.additionalAddressDetails.tr()),
// 16.height,
// SingleDetailWidget(
// text: requestVM.additionalAddressSparePartRequestDelivery.isNotEmpty ? requestVM.additionalAddressSparePartRequestDelivery : "N/A",
// type: LocaleKeys.additionalAddressDetails.tr(),
// ),
],
),
],
@ -117,9 +122,13 @@ class _ReviewRequestOfferState extends State<ReviewRequestOffer> {
Widget buildServiceInformation(BuildContext context) {
final requestVM = context.read<RequestsVM>();
String formattedDate = "";
String manufacturedOnFormattedDate = "";
if (requestVM.acceptedRequestOffer!.manufacturedOn != null) {
formattedDate = DateHelper.formatAsDayMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(requestVM.acceptedRequestOffer!.manufacturedOn.toString() ?? "")));
manufacturedOnFormattedDate = DateHelper.formatAsDayMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(requestVM.acceptedRequestOffer!.manufacturedOn.toString() ?? "")));
}
String requestCreatedOn = "";
if (requestVM.currentSelectedRequest!.createdOn != null) {
requestCreatedOn = DateHelper.formatAsDayMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(requestVM.currentSelectedRequest!.createdOn.toString() ?? "")));
}
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -148,8 +157,8 @@ class _ReviewRequestOfferState extends State<ReviewRequestOffer> {
16.height,
SingleDetailWidget(text: (requestVM.acceptedRequestOffer!.manufacturedById ?? "").toString(), type: LocaleKeys.manufacturedBy.tr()),
],
16.height,
SingleDetailWidget(text: "${requestVM.acceptedRequestOffer!.price.toString()} SAR", type: LocaleKeys.offerPrice.tr()),
// 16.height,
// SingleDetailWidget(text: "${requestVM.acceptedRequestOffer!.price.toString()} ${LocaleKeys.sar.tr()}", type: LocaleKeys.offerPrice.tr()),
16.height,
SingleDetailWidget(text: requestVM.acceptedRequestOfferProviderName ?? "", type: LocaleKeys.providerName.tr()),
16.height,
@ -165,12 +174,18 @@ class _ReviewRequestOfferState extends State<ReviewRequestOffer> {
SingleDetailWidget(text: requestVM.currentSelectedRequest!.brand, type: LocaleKeys.vehicleBrand.tr()),
16.height,
SingleDetailWidget(text: requestVM.acceptedRequestOffer!.serviceItemName ?? "", type: LocaleKeys.serviceName.tr()),
if (formattedDate.isNotEmpty) ...[
if (manufacturedOnFormattedDate.isNotEmpty) ...[
16.height,
SingleDetailWidget(text: formattedDate, type: LocaleKeys.manufacturedOn.tr()),
SingleDetailWidget(text: manufacturedOnFormattedDate, type: LocaleKeys.manufacturedOn.tr()),
],
16.height,
SingleDetailWidget(text: "${requestVM.currentSelectedRequest!.price.toString()} SAR", type: LocaleKeys.totalPrice.tr()),
// SingleDetailWidget(text: "${requestVM.currentSelectedRequest!.price.toString()} ${LocaleKeys.sar.tr()}", type: LocaleKeys.totalPrice.tr()),
SingleDetailWidget(text: "${requestVM.acceptedRequestOffer!.price.toString()} ${LocaleKeys.sar.tr()}", type: LocaleKeys.offerPrice.tr()),
if (requestCreatedOn.isNotEmpty) ...[
16.height,
SingleDetailWidget(text: requestCreatedOn, type: LocaleKeys.requestCreatedOn.tr()),
],
],
),
),

@ -9,12 +9,14 @@ class CheckBoxWithTitleDescription extends StatelessWidget {
final String title, description;
final Function(bool) onSelection;
final bool isDisabled;
final CrossAxisAlignment? crossAxisAlignment;
const CheckBoxWithTitleDescription({
required this.isSelected,
required this.title,
required this.description,
required this.onSelection,
this.crossAxisAlignment,
this.isDisabled = false,
super.key,
});
@ -30,7 +32,7 @@ class CheckBoxWithTitleDescription extends StatelessWidget {
child: SizedBox(
width: double.infinity,
child: Row(
crossAxisAlignment: description.isNotEmpty ? CrossAxisAlignment.start : CrossAxisAlignment.center,
crossAxisAlignment: crossAxisAlignment == null ? (description.isNotEmpty ? CrossAxisAlignment.start : CrossAxisAlignment.center) : crossAxisAlignment!,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Checkbox(

Loading…
Cancel
Save