Compare commits

..

No commits in common. 'master' and 'fatima_dev' have entirely different histories.

@ -6,7 +6,7 @@ import 'dart:ui';
import 'package:easy_localization/easy_localization.dart' show AssetLoader; import 'package:easy_localization/easy_localization.dart' show AssetLoader;
class CodegenLoader extends AssetLoader { class CodegenLoader extends AssetLoader{
const CodegenLoader(); const CodegenLoader();
@override @override
@ -14,7 +14,7 @@ class CodegenLoader extends AssetLoader {
return Future.value(mapLocales[locale.toString()]); return Future.value(mapLocales[locale.toString()]);
} }
static const Map<String, dynamic> _ar_SA = { static const Map<String,dynamic> _ar_SA = {
"firstTimeLogIn": "تسجيل الدخول لأول مره", "firstTimeLogIn": "تسجيل الدخول لأول مره",
"signUp": "التسجيل", "signUp": "التسجيل",
"changeMobile": "تغيير رقم الجوال", "changeMobile": "تغيير رقم الجوال",
@ -101,7 +101,11 @@ class CodegenLoader extends AssetLoader {
"msg_named": "{} are written in the {lang} language", "msg_named": "{} are written in the {lang} language",
"clickMe": "انقر فوق لي", "clickMe": "انقر فوق لي",
"profile": { "profile": {
"reset_password": {"label": "إعادة تعيين كلمة المرور", "username": "اسم المستخدم", "password": "كلمة المرور"} "reset_password": {
"label": "إعادة تعيين كلمة المرور",
"username": "اسم المستخدم",
"password": "كلمة المرور"
}
}, },
"clicked": { "clicked": {
"zero": "You clicked {} times!", "zero": "You clicked {} times!",
@ -111,11 +115,21 @@ class CodegenLoader extends AssetLoader {
"many": "You clicked {} times!", "many": "You clicked {} times!",
"other": "You clicked {} times!" "other": "You clicked {} times!"
}, },
"amount": {"zero": "Your amount : {} ", "one": "Your amount : {} ", "two": "Your amount : {} ", "few": "Your amount : {} ", "many": "Your amount : {} ", "other": "Your amount : {} "}, "amount": {
"zero": "Your amount : {} ",
"one": "Your amount : {} ",
"two": "Your amount : {} ",
"few": "Your amount : {} ",
"many": "Your amount : {} ",
"other": "Your amount : {} "
},
"gender": { "gender": {
"male": "Hi man ;) ", "male": "Hi man ;) ",
"female": "Hello girl :)", "female": "Hello girl :)",
"with_arg": {"male": "Hi man ;) {}", "female": "Hello girl :) {}"} "with_arg": {
"male": "Hi man ;) {}",
"female": "Hello girl :) {}"
}
}, },
"reset_locale": "إعادة ضبط اللغة", "reset_locale": "إعادة ضبط اللغة",
"welcomeDes": "أنت مكان واحد لكل ما تحتاجه سيارتك", "welcomeDes": "أنت مكان واحد لكل ما تحتاجه سيارتك",
@ -339,8 +353,7 @@ class CodegenLoader extends AssetLoader {
"damagePartPictures": "صور الأجزاء المتضررة", "damagePartPictures": "صور الأجزاء المتضررة",
"qrCode": "رمز الاستجابة السريعة", "qrCode": "رمز الاستجابة السريعة",
"downgradeAppliedAfterExpiry": "سيتم تطبيق هذه الباقة تلقائيًا بعد انتهاء صلاحية باقتك الحالية.", "downgradeAppliedAfterExpiry": "سيتم تطبيق هذه الباقة تلقائيًا بعد انتهاء صلاحية باقتك الحالية.",
"downgradeDeactivateInstruction": "downgradeDeactivateInstruction": "لتحديد هذا الاشتراك، يجب عليك إلغاء تفعيل الفروع والمستخدمين حيث أن هذه الباقة تدعم فقط {branches} و {users}. يمكنك إعادة تفعيل هذه الفروع لاحقًا بعد ترقية الباقة",
"لتحديد هذا الاشتراك، يجب عليك إلغاء تفعيل الفروع والمستخدمين حيث أن هذه الباقة تدعم فقط {branches} و {users}. يمكنك إعادة تفعيل هذه الفروع لاحقًا بعد ترقية الباقة",
"vehicleDamagePart": "جزء المركبة المتضرر", "vehicleDamagePart": "جزء المركبة المتضرر",
"duration": "المدة", "duration": "المدة",
"specialServices": "الخدمات الخاصة", "specialServices": "الخدمات الخاصة",
@ -813,8 +826,7 @@ class CodegenLoader extends AssetLoader {
"selectBranchToCopyServices": "حدد الفرع لنسخ العناصر الخاصة بهم إلى هذا الفرع. يمكنك تعديل الاختيار في أي وقت.", "selectBranchToCopyServices": "حدد الفرع لنسخ العناصر الخاصة بهم إلى هذا الفرع. يمكنك تعديل الاختيار في أي وقت.",
"tapToSeeItems": "اضغط لرؤية العناصر", "tapToSeeItems": "اضغط لرؤية العناصر",
"tapToSelect": "اضغط للاختيار", "tapToSelect": "اضغط للاختيار",
"noteCopyItemsExplanation": "noteCopyItemsExplanation": "ملاحظة: ستتمكن من نسخ العناصر من خدمة إلى أخرى في الفئة المحددة. يجب عليك إنشاء الخدمات أولاً ويجب أن تكون معتمدة. ثم ستتمكن من الحصول على الخدمات المتاحة التي يمكنك نسخ جميع العناصر منها أو تحديد العناصر التي تريد نسخها.",
"ملاحظة: ستتمكن من نسخ العناصر من خدمة إلى أخرى في الفئة المحددة. يجب عليك إنشاء الخدمات أولاً ويجب أن تكون معتمدة. ثم ستتمكن من الحصول على الخدمات المتاحة التي يمكنك نسخ جميع العناصر منها أو تحديد العناصر التي تريد نسخها.",
"requestCreatedOn": "تم إنشاء الطلب في", "requestCreatedOn": "تم إنشاء الطلب في",
"online": "عبر الإنترنت", "online": "عبر الإنترنت",
"deliveryStatus": "حالة توصيلك / الشحن هي:", "deliveryStatus": "حالة توصيلك / الشحن هي:",
@ -947,8 +959,8 @@ class CodegenLoader extends AssetLoader {
"appts": "مواعيد", "appts": "مواعيد",
"approvalPending": "بانتظار الموافقة", "approvalPending": "بانتظار الموافقة",
"activateNow": "تفعيل الآن" "activateNow": "تفعيل الآن"
}; };
static const Map<String, dynamic> _en_US = { static const Map<String,dynamic> _en_US = {
"firstTimeLogIn": "First Time Log In", "firstTimeLogIn": "First Time Log In",
"signUp": "Sign Up", "signUp": "Sign Up",
"changeMobile": "Change Mobile", "changeMobile": "Change Mobile",
@ -1038,7 +1050,11 @@ class CodegenLoader extends AssetLoader {
"msg_named": "{} are written in the {lang} language", "msg_named": "{} are written in the {lang} language",
"clickMe": "Click me", "clickMe": "Click me",
"profile": { "profile": {
"reset_password": {"label": "Reset Password", "username": "Username", "password": "password"} "reset_password": {
"label": "Reset Password",
"username": "Username",
"password": "password"
}
}, },
"clicked": { "clicked": {
"zero": "You clicked {} times!", "zero": "You clicked {} times!",
@ -1048,11 +1064,21 @@ class CodegenLoader extends AssetLoader {
"many": "You clicked {} times!", "many": "You clicked {} times!",
"other": "You clicked {} times!" "other": "You clicked {} times!"
}, },
"amount": {"zero": "Your amount : {} ", "one": "Your amount : {} ", "two": "Your amount : {} ", "few": "Your amount : {} ", "many": "Your amount : {} ", "other": "Your amount : {} "}, "amount": {
"zero": "Your amount : {} ",
"one": "Your amount : {} ",
"two": "Your amount : {} ",
"few": "Your amount : {} ",
"many": "Your amount : {} ",
"other": "Your amount : {} "
},
"gender": { "gender": {
"male": "Hi man ;) ", "male": "Hi man ;) ",
"female": "Hello girl :)", "female": "Hello girl :)",
"with_arg": {"male": "Hi man ;) {}", "female": "Hello girl :) {}"} "with_arg": {
"male": "Hi man ;) {}",
"female": "Hello girl :) {}"
}
}, },
"reset_locale": "Reset Language", "reset_locale": "Reset Language",
"welcomeDes": "You one stop place all your car needs", "welcomeDes": "You one stop place all your car needs",
@ -1276,8 +1302,7 @@ class CodegenLoader extends AssetLoader {
"damagePartPictures": "Damage Part Pictures", "damagePartPictures": "Damage Part Pictures",
"qrCode": "QR Code", "qrCode": "QR Code",
"downgradeAppliedAfterExpiry": "This package will be applied automatically after your current package expires.", "downgradeAppliedAfterExpiry": "This package will be applied automatically after your current package expires.",
"downgradeDeactivateInstruction": "downgradeDeactivateInstruction": "To select this subscription you need to deactivate your branches and users as this package only supports {branches} and {users}. You can reactivate these branches later after upgrading the package",
"To select this subscription you need to deactivate your branches and users as this package only supports {branches} and {users}. You can reactivate these branches later after upgrading the package",
"vehicleDamagePart": "Vehicle Damage Part", "vehicleDamagePart": "Vehicle Damage Part",
"duration": "Duration", "duration": "Duration",
"specialServices": "Special Services", "specialServices": "Special Services",
@ -1734,8 +1759,7 @@ class CodegenLoader extends AssetLoader {
"selectBranchToCopyServices": "Select the branch to copy their items to this branch. You can modify the selection at any time.", "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", "tapToSeeItems": "Tap to see items",
"noteCopyItemsExplanation": "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.",
"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", "requestCreatedOn": "Request created on",
"online": "Online", "online": "Online",
"searchByCreatedDate": "Search By Created Date", "searchByCreatedDate": "Search By Created Date",
@ -1879,6 +1903,6 @@ class CodegenLoader extends AssetLoader {
"appts": "appts", "appts": "appts",
"approvalPending": "Approval Pending", "approvalPending": "Approval Pending",
"activateNow": "Activate Now" "activateNow": "Activate Now"
}; };
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};
} }

@ -712,7 +712,7 @@ class AdVM extends BaseVM {
SelectionModel vehicleTypeId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: ""); SelectionModel vehicleTypeId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
Future<void> updateSelectionVehicleTypeId(SelectionModel id, {bool isForSearch = false}) async { void updateSelectionVehicleTypeId(SelectionModel id, {bool isForSearch = false}) async {
if (isForSearch) { if (isForSearch) {
VehicleTypeModel vehicleTypeModel = vehicleTypesForFilters.firstWhere((element) => element.id == id.selectedId); VehicleTypeModel vehicleTypeModel = vehicleTypesForFilters.firstWhere((element) => element.id == id.selectedId);
DropValue vehicleTypeVValue = DropValue(vehicleTypeModel.id ?? 0, vehicleTypeModel.vehicleTypeName ?? "", ""); DropValue vehicleTypeVValue = DropValue(vehicleTypeModel.id ?? 0, vehicleTypeModel.vehicleTypeName ?? "", "");
@ -1368,14 +1368,24 @@ class AdVM extends BaseVM {
void onBackButtonPressed(BuildContext context) { void onBackButtonPressed(BuildContext context) {
switch (currentProgressStep) { switch (currentProgressStep) {
case AdCreationStepsEnum.vehicleDetails: case AdCreationStepsEnum.vehicleDetails:
// Only offer to save as a draft once both brand AND model are selected. Brand // Check if user has entered any data
// has no field of its own in the draft payload -- it's only ever recoverable by bool hasData = vehicleTypeId.selectedId != -1 ||
// looking up model.vehicleBrandID when a draft is reopened. Confirmed on a real vehicleBrandId.selectedId != -1 ||
// device: saving with a brand picked but no model meant the brand was silently vehicleModelId.selectedId != -1 ||
// lost on reopen, since there was nothing to derive it from. Any other field vehicleModelYearId.selectedId != -1 ||
// (description, images, etc.) being filled in isn't enough on its own -- a draft vehicleColorId.selectedId != -1 ||
// without a vehicle identified isn't meaningfully recoverable either. vehicleCategoryId.selectedId != -1 ||
bool hasData = vehicleBrandId.selectedId != -1 && vehicleModelId.selectedId != -1; vehicleConditionId.selectedId != -1 ||
vehicleMileageId.selectedId != -1 ||
vehicleTransmissionId.selectedId != -1 ||
vehicleCountryId.selectedId != -1 ||
vehicleCityId.selectedId != -1 ||
vehicleDemandAmount.isNotEmpty ||
vehicleVin.isNotEmpty ||
vehicleTitle.isNotEmpty ||
warrantyDuration.isNotEmpty ||
vehicleDescription.isNotEmpty ||
pickedPostingImages.isNotEmpty;
if (hasData) { if (hasData) {
// Skip save confirmation when extending ad // Skip save confirmation when extending ad
@ -2902,7 +2912,7 @@ class AdVM extends BaseVM {
return []; return [];
} }
Future<void> onEditUpdateAdPressed({required BuildContext context, required AdDetailsModel previousDetails, required bool isFromExtendAd, bool isForDraft = false}) async { void onEditUpdateAdPressed({required BuildContext context, required AdDetailsModel previousDetails, required bool isFromExtendAd, bool isForDraft = false}) {
log("previousDetails: ${previousDetails.vehiclePostingID}"); log("previousDetails: ${previousDetails.vehiclePostingID}");
log("previousDetails: ${previousDetails.vehicle?.id}"); log("previousDetails: ${previousDetails.vehicle?.id}");
@ -2913,16 +2923,10 @@ class AdVM extends BaseVM {
log("previousAdDetails: ${previousAdDetails?.vehicle?.id}"); log("previousAdDetails: ${previousAdDetails?.vehicle?.id}");
// These used to all fire without awaiting, so autoFillSelectedVehicleAdsDetails could autoFillSelectedVehicleType();
// start (and look up vehicleBrands/vehicleModels for this draft) before
// autoFillSelectedVehicleType had actually finished setting vehicleTypeId and fetching
// brands for it -- type must resolve before brand, which must resolve before
// model/year/color/etc, since each step's dropdown options are fetched using the
// previous step's selected id.
await autoFillSelectedVehicleType();
autoFillSelectedVehicleAdsDuration(); autoFillSelectedVehicleAdsDuration();
// if (isForDraft) { // if (isForDraft) {
await autoFillSelectedVehicleAdsDetails(context); autoFillSelectedVehicleAdsDetails(context);
// } // }
navigateWithName(context, AppRoutes.selectAdTypeView, arguments: [AppState().currentAppType == AppType.provider, isFromExtendAd, previousDetails.id]); navigateWithName(context, AppRoutes.selectAdTypeView, arguments: [AppState().currentAppType == AppType.provider, isFromExtendAd, previousDetails.id]);
} }
@ -2949,7 +2953,7 @@ class AdVM extends BaseVM {
} }
} }
Future<void> autoFillSelectedVehicleType() async { void autoFillSelectedVehicleType() async {
if (vehicleTypes.isEmpty) { if (vehicleTypes.isEmpty) {
await getVehicleTypes(); await getVehicleTypes();
// return; // return;
@ -2960,14 +2964,6 @@ class AdVM extends BaseVM {
if (vehicle.id == previousAdDetails!.vehicle?.vehicleType) { if (vehicle.id == previousAdDetails!.vehicle?.vehicleType) {
vehicle.isSelected = true; vehicle.isSelected = true;
log("Hi: ${vehicle.vehicleTypeName}"); log("Hi: ${vehicle.vehicleTypeName}");
// This used to only flip isSelected on the type-picker list item, never
// vehicleTypeId itself -- confirmed on a real device: that left vehicleTypeId
// at whatever stale value (or -1) it already had from a previous session, which
// then fed the wrong/empty vehicleTypeId into getVehicleBrandsByVehicleTypeId()
// -> getVehicleDetailsByVehicleBrandId() below, so the model/year/color/etc.
// dropdown option lists never matched the draft's actual selections even though
// their IDs were set correctly.
await updateSelectionVehicleTypeId(SelectionModel(selectedId: vehicle.id!, selectedOption: vehicle.vehicleTypeName ?? ""));
break; break;
} }
} }
@ -3008,7 +3004,7 @@ class AdVM extends BaseVM {
notifyListeners(); notifyListeners();
} }
Future<void> autoFillSelectedVehicleAdsDetails(BuildContext context) async { void autoFillSelectedVehicleAdsDetails(BuildContext context) async {
bool isArabic = AppState().isArabic(context); bool isArabic = AppState().isArabic(context);
if (vehicleBrands.isEmpty) { if (vehicleBrands.isEmpty) {

@ -181,7 +181,8 @@ class AdDurationSelectionSheet extends StatelessWidget {
if (adVM.isFetchingLists) { if (adVM.isFetchingLists) {
return; return;
} else { } else {
if (isFromExtendAd && !isUpdateAdSelected) { if (isFromExtendAd && !isUpdateAdSelected && AppState().currentAppType == AppType.provider) {
final subscriptionsVM = context.read<SubscriptionsVM>();
List<bool> statuses = List<bool> statuses =
await adVM.createAdExtensionOrder(context, adId: adsID, adsDurationId: adVM.vehicleAdDurationId.selectedId); // [0] Means API response [1] means isPaymentRequired await adVM.createAdExtensionOrder(context, adId: adsID, adsDurationId: adVM.vehicleAdDurationId.selectedId); // [0] Means API response [1] means isPaymentRequired
if (statuses[0] && statuses[1]) { if (statuses[0] && statuses[1]) {
@ -190,12 +191,7 @@ class AdDurationSelectionSheet extends StatelessWidget {
pop(context); pop(context);
pop(context); pop(context);
pop(context); pop(context);
// SubscriptionsVM is only registered in the provider app -- reading it
// for a customer would throw, since customers don't have subscriptions.
if (AppState().currentAppType == AppType.provider) {
final subscriptionsVM = context.read<SubscriptionsVM>();
await subscriptionsVM.getSubscriptionBySP(AppState().getUser.data?.userInfo?.providerId.toString() ?? "", true); await subscriptionsVM.getSubscriptionBySP(AppState().getUser.data?.userInfo?.providerId.toString() ?? "", true);
}
adVM.applyFilterOnMyAds(adPostStatusEnum: AdPostStatus.active); adVM.applyFilterOnMyAds(adPostStatusEnum: AdPostStatus.active);
} }
} else { } else {

@ -80,13 +80,8 @@ class BuildFooterButton extends StatelessWidget {
case AdCreationStepsEnum.vehicleDetails: case AdCreationStepsEnum.vehicleDetails:
return Row( return Row(
children: [ children: [
// Hide "Save as Draft" when extending ad, and until brand+model are both // Hide "Save as Draft" when extending ad
// selected -- brand has no field of its own in the draft payload, it's if (!adVm.isExtendAdEditEnabled) ...[
// only ever recoverable via model.vehicleBrandID on reload, so saving with
// a brand picked but no model silently loses the brand (confirmed on a
// real device). Same gate as the back-button confirmation in
// onBackButtonPressed.
if (!adVm.isExtendAdEditEnabled && adVm.vehicleBrandId.selectedId != -1 && adVm.vehicleModelId.selectedId != -1) ...[
Expanded( Expanded(
child: ShowFillButton( child: ShowFillButton(
txtColor: MyColors.black, txtColor: MyColors.black,

Loading…
Cancel
Save