Offers and discount and Item for sale changes done.

sultan-dev
Sultan khan 2 years ago
parent e65d876223
commit 3b2ef69f7c

@ -514,5 +514,8 @@
"startingIn": "يبدأ في",
"youAreOutOfContest": "أنت خارج المسابقة.",
"winners": "الفائزين!!!",
"fakeLocation": ".لقد تتبعنا أنك تحاول استخدام موقع مزيف! يعتبر هذا مخالفة وقد تم إخطار الموارد البشرية"
"fakeLocation": ".لقد تتبعنا أنك تحاول استخدام موقع مزيف! يعتبر هذا مخالفة وقد تم إخطار الموارد البشرية",
"expireAfter":"تنتهي بعد",
"oneWeek":"أسبوع 1",
"twoWeek":"2 أسبوع"
}

@ -514,5 +514,8 @@
"startingIn": "Starting in",
"youAreOutOfContest": "You are out of the contest.",
"winners": "WINNERS!!!",
"fakeLocation": "We traced out that you try to use a fake location! This is considered a violation, and HR has been notified."
"fakeLocation": "We traced out that you try to use a fake location! This is considered a violation, and HR has been notified.",
"expireAfter":"Expires After",
"oneWeek":"1 Week",
"twoWeek":"2 Week"
}

@ -17,7 +17,7 @@ class OffersAndDiscountsApiClient {
List<GetCategoriesList> getSaleCategoriesList = [];
String url = "${ApiConsts.cocRest}Mohemm_ITG_GetCategories";
Map<String, dynamic> postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, "ItgPageSize": 100, "ItgPageNo": 1};
Map<String, dynamic> postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, "ItgPageSize": 100, "ItgPageNo": 1, "ItgIsActive": true};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject(
@ -55,12 +55,12 @@ class OffersAndDiscountsApiClient {
(response) {
var body = json.decode(response['Mohemm_ITG_ResponseItem']);
var bodyData = json.decode(body['result']['data']);
var bodyData = body['result']['data'];
if(bodyData != null) {
if (bodyData != null) {
bodyData.forEach((v) {
getSaleCategoriesList.add(OffersListModel.fromJson(v));
});
getSaleCategoriesList.add(OffersListModel.fromJson(v));
});
}
return getSaleCategoriesList;
},

@ -4,7 +4,7 @@ class ApiConsts {
//static String baseUrl = "http://10.200.204.20:2801/"; // Local server
// static String baseUrl = "https://erptstapp.srca.org.sa"; // SRCA server
static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server
// static String baseUrl = "https://hmgwebservices.com"; // Live server
// static String baseUrl = "https://hmgwebservices.com"; // Live server
static String baseUrlServices = baseUrl + "/Services/"; // server
// static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server
static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/";

@ -1,6 +1,6 @@
// DO NOT EDIT. This is code generated via package:easy_localization/generate.dart
abstract class LocaleKeys {
abstract class LocaleKeys {
static const mohemm = 'mohemm';
static const english = 'english';
static const arabic = 'arabic';
@ -250,7 +250,7 @@ abstract class LocaleKeys {
static const Payroll = 'Payroll';
static const civilIdentityNumber = 'civilIdentityNumber';
static const dateOfBirth = 'dateOfBirth';
static const maritalStatus = 'maritalStatus ';
static const maritalStatus = 'maritalStatus ';
static const fullName = 'fullName';
static const remove = 'remove';
static const submit = 'submit';
@ -280,7 +280,7 @@ abstract class LocaleKeys {
static const enterNewInfo = 'enterNewInfo';
static const endDate = 'endDate';
static const removeThisMember = 'removeThisMember';
static const wantUpdateThisMember = 'wantUpdateThisMember ';
static const wantUpdateThisMember = 'wantUpdateThisMember ';
static const addNewFamilyMember = 'addNewFamilyMember';
static const addRow = 'addRow';
static const pleaseSelect = 'pleaseSelect';
@ -501,5 +501,7 @@ abstract class LocaleKeys {
static const youAreOutOfContest = 'youAreOutOfContest';
static const winners = 'winners';
static const fakeLocation = 'fakeLocation';
static const expireAfter = 'expireAfter';
static const oneWeek = 'oneWeek';
static const twoWeek = 'twoWeek';
}

@ -6,6 +6,8 @@
// ignore_for_file: lines_longer_than_80_chars
// ignore_for_file: depend_on_referenced_packages
import 'package:audio_session/audio_session_web.dart';
import 'package:camera_web/camera_web.dart';
import 'package:file_picker/_internal/file_picker_web.dart';
import 'package:firebase_core_web/firebase_core_web.dart';
import 'package:firebase_messaging_web/firebase_messaging_web.dart';
@ -13,6 +15,8 @@ import 'package:fluttertoast/fluttertoast_web.dart';
import 'package:geolocator_web/geolocator_web.dart';
import 'package:google_maps_flutter_web/google_maps_flutter_web.dart';
import 'package:image_picker_for_web/image_picker_for_web.dart';
import 'package:just_audio_web/just_audio_web.dart';
import 'package:record_web/record_web.dart';
import 'package:shared_preferences_web/shared_preferences_web.dart';
import 'package:url_launcher_web/url_launcher_web.dart';
import 'package:video_player_web/video_player_web.dart';
@ -21,6 +25,8 @@ import 'package:flutter_web_plugins/flutter_web_plugins.dart';
// ignore: public_member_api_docs
void registerPlugins(Registrar registrar) {
AudioSessionWeb.registerWith(registrar);
CameraPlugin.registerWith(registrar);
FilePickerWeb.registerWith(registrar);
FirebaseCoreWeb.registerWith(registrar);
FirebaseMessagingWeb.registerWith(registrar);
@ -28,6 +34,8 @@ void registerPlugins(Registrar registrar) {
GeolocatorPlugin.registerWith(registrar);
GoogleMapsPlugin.registerWith(registrar);
ImagePickerPlugin.registerWith(registrar);
JustAudioPlugin.registerWith(registrar);
RecordPluginWeb.registerWith(registrar);
SharedPreferencesPlugin.registerWith(registrar);
UrlLauncherPlugin.registerWith(registrar);
VideoPlayerPlugin.registerWith(registrar);

@ -11,7 +11,7 @@ class EmployeePostedAds {
String? countryName;
String? currencyCode;
String? startDate;
String? endDate;
DateTime? endDate;
int? quotePrice;
int? employeeNumber;
String? profilePicture;
@ -29,32 +29,32 @@ class EmployeePostedAds {
EmployeePostedAds(
{this.itemSaleID,
this.title,
this.titleAr,
this.description,
this.descriptionAr,
this.categoryID,
this.categoryTitle,
this.regionID,
this.regionName,
this.countryName,
this.currencyCode,
this.startDate,
this.endDate,
this.quotePrice,
this.employeeNumber,
this.profilePicture,
this.fullName,
this.emailAddress,
this.mobileNumber,
this.isApproved,
this.status,
this.itemAttachments,
this.created,
this.isActive,
this.pageSize,
this.pageNo,
this.languageId});
this.title,
this.titleAr,
this.description,
this.descriptionAr,
this.categoryID,
this.categoryTitle,
this.regionID,
this.regionName,
this.countryName,
this.currencyCode,
this.startDate,
this.endDate,
this.quotePrice,
this.employeeNumber,
this.profilePicture,
this.fullName,
this.emailAddress,
this.mobileNumber,
this.isApproved,
this.status,
this.itemAttachments,
this.created,
this.isActive,
this.pageSize,
this.pageNo,
this.languageId});
EmployeePostedAds.fromJson(Map<String, dynamic> json) {
itemSaleID = json['itemSaleID'];
@ -115,8 +115,7 @@ class EmployeePostedAds {
data['isApproved'] = this.isApproved;
data['status'] = this.status;
if (this.itemAttachments != null) {
data['itemAttachments'] =
this.itemAttachments!.map((v) => v.toJson()).toList();
data['itemAttachments'] = this.itemAttachments!.map((v) => v.toJson()).toList();
}
data['created'] = this.created;
data['isActive'] = this.isActive;
@ -138,16 +137,7 @@ class ItemAttachments {
String? content;
String? filePath;
ItemAttachments(
{this.attachmentId,
this.fileName,
this.contentType,
this.attachFileStream,
this.base64String,
this.isActive,
this.referenceItemId,
this.content,
this.filePath});
ItemAttachments({this.attachmentId, this.fileName, this.contentType, this.attachFileStream, this.base64String, this.isActive, this.referenceItemId, this.content, this.filePath});
ItemAttachments.fromJson(Map<String, dynamic> json) {
attachmentId = json['attachmentId'];

@ -9,16 +9,8 @@ class ItemReviewModel {
num? itemPrice;
List<String>? itemPhotos;
GetSaleCategoriesList? selectedSaleCategory;
ItemReviewModel(
this.itemTitle,
this.itemDescription,
this.itemCondition,
this.selectedRegion,
this.itemPrice,
this.itemPhotos,
this.selectedSaleCategory,
);
DateTime endDate;
ItemReviewModel(this.itemTitle, this.itemDescription, this.itemCondition, this.selectedRegion, this.itemPrice, this.itemPhotos, this.selectedSaleCategory, this.endDate);
Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
@ -29,7 +21,7 @@ class ItemReviewModel {
data['itemPrice'] = this.itemPrice;
data['itemPhotos'] = this.itemPhotos;
data['selectedSaleCategory'] = this.selectedSaleCategory;
data['endDate'] = this.endDate;
return data;
}
}

@ -1,96 +1,192 @@
class OffersListModel {
String? title;
String? titleAR;
String? description;
String? descriptionAR;
int? offersDiscountId;
String? titleEn;
String? titleAr;
String? descriptionEn;
String? descriptionAr;
String? startDate;
String? endDate;
String? logo;
String? bannerImage;
String? discount;
String? rowID;
int? categoryId;
String? categoryNameEn;
String? categoryNameAr;
String? categoryID;
String? isHasLocation;
String? discount;
String? location;
int? statusId;
String? statusTitle;
bool? isHasLocation;
String? discountDescription;
String? websiteUrl;
bool? bookMarked;
bool? isHotDeal;
List<OffersDiscountImageColl>? offersDiscountImageColl;
dynamic locationList;
String? created;
String? publishedDesc;
String? published;
String? expireAfter;
String? status;
String? isActive;
String? totalItems;
String? bannerImage;
String? logo;
bool? isActive;
int? pageSize;
int? pageNo;
int? languageId;
OffersListModel(
{this.title,
this.titleAR,
this.description,
this.descriptionAR,
this.startDate,
this.endDate,
this.logo,
this.bannerImage,
this.discount,
this.rowID,
this.categoryNameEn,
this.categoryNameAr,
this.categoryID,
this.isHasLocation,
this.created,
this.publishedDesc,
this.published,
this.expireAfter,
this.status,
this.isActive,
this.totalItems});
{this.offersDiscountId,
this.titleEn,
this.titleAr,
this.descriptionEn,
this.descriptionAr,
this.startDate,
this.endDate,
this.categoryId,
this.categoryNameEn,
this.categoryNameAr,
this.discount,
this.location,
this.statusId,
this.statusTitle,
this.isHasLocation,
this.discountDescription,
this.websiteUrl,
this.bookMarked,
this.isHotDeal,
this.offersDiscountImageColl,
this.locationList,
this.created,
this.bannerImage,
this.logo,
this.isActive,
this.pageSize,
this.pageNo,
this.languageId});
OffersListModel.fromJson(Map<String, dynamic> json) {
title = json['Title'];
titleAR = json['Title_AR'];
description = json['Description'];
descriptionAR = json['Description_AR'];
startDate = json['Start Date'];
endDate = json['End Date'];
logo = json['Logo'];
bannerImage = json['Banner_Image'];
discount = json['Discount'];
rowID = json['rowID'];
offersDiscountId = json['offersDiscountId'];
titleEn = json['titleEn'];
titleAr = json['titleAr'];
descriptionEn = json['descriptionEn'];
descriptionAr = json['descriptionAr'];
startDate = json['startDate'];
endDate = json['endDate'];
categoryId = json['categoryId'];
categoryNameEn = json['categoryName_en'];
categoryNameAr = json['categoryName_ar'];
categoryID = json['categoryID'];
isHasLocation = json['IsHasLocation'];
discount = json['discount'];
location = json['location'];
statusId = json['statusId'];
statusTitle = json['statusTitle'];
isHasLocation = json['isHasLocation'];
discountDescription = json['discountDescription'];
websiteUrl = json['websiteUrl'];
bookMarked = json['bookMarked'];
isHotDeal = json['isHotDeal'];
if (json['offersDiscountImageColl'] != null) {
offersDiscountImageColl = <OffersDiscountImageColl>[];
json['offersDiscountImageColl'].forEach((v) {
offersDiscountImageColl!.add(new OffersDiscountImageColl.fromJson(v));
});
}
locationList = json['locationList'];
created = json['created'];
publishedDesc = json['PublishedDesc'];
published = json['Published'];
expireAfter = json['ExpireAfter'];
status = json['Status'];
isActive = json['IsActive'];
totalItems = json['TotalItems'];
bannerImage = json['banner_Image'];
logo = json['logo'];
isActive = json['isActive'];
pageSize = json['pageSize'];
pageNo = json['pageNo'];
languageId = json['languageId'];
}
Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
data['Title'] = this.title;
data['Title_AR'] = this.titleAR;
data['Description'] = this.description;
data['Description_AR'] = this.descriptionAR;
data['Start Date'] = this.startDate;
data['End Date'] = this.endDate;
data['Logo'] = this.logo;
data['Banner_Image'] = this.bannerImage;
data['Discount'] = this.discount;
data['rowID'] = this.rowID;
data['offersDiscountId'] = this.offersDiscountId;
data['titleEn'] = this.titleEn;
data['titleAr'] = this.titleAr;
data['descriptionEn'] = this.descriptionEn;
data['descriptionAr'] = this.descriptionAr;
data['startDate'] = this.startDate;
data['endDate'] = this.endDate;
data['categoryId'] = this.categoryId;
data['categoryName_en'] = this.categoryNameEn;
data['categoryName_ar'] = this.categoryNameAr;
data['categoryID'] = this.categoryID;
data['IsHasLocation'] = this.isHasLocation;
data['discount'] = this.discount;
data['location'] = this.location;
data['statusId'] = this.statusId;
data['statusTitle'] = this.statusTitle;
data['isHasLocation'] = this.isHasLocation;
data['discountDescription'] = this.discountDescription;
data['websiteUrl'] = this.websiteUrl;
data['bookMarked'] = this.bookMarked;
data['isHotDeal'] = this.isHotDeal;
if (this.offersDiscountImageColl != null) {
data['offersDiscountImageColl'] = this.offersDiscountImageColl!.map((v) => v.toJson()).toList();
}
data['locationList'] = this.locationList;
data['created'] = this.created;
data['PublishedDesc'] = this.publishedDesc;
data['Published'] = this.published;
data['ExpireAfter'] = this.expireAfter;
data['Status'] = this.status;
data['IsActive'] = this.isActive;
data['TotalItems'] = this.totalItems;
data['banner_Image'] = this.bannerImage;
data['logo'] = this.logo;
data['isActive'] = this.isActive;
data['pageSize'] = this.pageSize;
data['pageNo'] = this.pageNo;
data['languageId'] = this.languageId;
return data;
}
}
class OffersDiscountImageColl {
int? imageAttachmentId;
String? fileName;
String? contentType;
String? attachFileStream;
String? base64String;
int? referenceItemId;
String? filePath;
String? imageTag;
bool? isActive;
int? pageSize;
int? pageNo;
int? languageId;
OffersDiscountImageColl(
{this.imageAttachmentId,
this.fileName,
this.contentType,
this.attachFileStream,
this.base64String,
this.referenceItemId,
this.filePath,
this.imageTag,
this.isActive,
this.pageSize,
this.pageNo,
this.languageId});
OffersDiscountImageColl.fromJson(Map<String, dynamic> json) {
imageAttachmentId = json['imageAttachmentId'];
fileName = json['fileName'];
contentType = json['contentType'];
attachFileStream = json['attachFileStream'];
base64String = json['base64String'];
referenceItemId = json['referenceItemId'];
filePath = json['filePath'];
imageTag = json['imageTag'];
isActive = json['isActive'];
pageSize = json['pageSize'];
pageNo = json['pageNo'];
languageId = json['languageId'];
}
Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
data['imageAttachmentId'] = this.imageAttachmentId;
data['fileName'] = this.fileName;
data['contentType'] = this.contentType;
data['attachFileStream'] = this.attachFileStream;
data['base64String'] = this.base64String;
data['referenceItemId'] = this.referenceItemId;
data['filePath'] = this.filePath;
data['imageTag'] = this.imageTag;
data['isActive'] = this.isActive;
data['pageSize'] = this.pageSize;
data['pageNo'] = this.pageNo;
data['languageId'] = this.languageId;
return data;
}
}

@ -406,10 +406,10 @@ class _DashboardScreenState extends State<DashboardScreen> {
Radius.circular(50),
),
child: Hero(
tag: "ItemImage" + data.getOffersList[index].rowID!,
tag: "ItemImage" + data.getOffersList[index].offersDiscountId.toString()!,
transitionOnUserGestures: true,
child: Image.network(
data.getOffersList[index].bannerImage!,
data.getOffersList[index].bannerImage ?? "",
fit: BoxFit.contain,
),
),
@ -418,8 +418,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
4.height,
Expanded(
child: AppState().isArabic(context)
? data.getOffersList[index].titleAR!.toText12(isCenter: true, maxLine: 1)
: data.getOffersList[index].title!.toText12(isCenter: true, maxLine: 1),
? data.getOffersList[index].titleAr!.toText12(isCenter: true, maxLine: 1)
: data.getOffersList[index].titleEn!.toText12(isCenter: true, maxLine: 1),
),
],
),
@ -558,7 +558,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
data.getOffersList.forEach((OffersListModel element) {
if (counter <= 4) {
if (element.rowID != offersListModelObj.rowID) {
if (element.offersDiscountId != offersListModelObj.offersDiscountId) {
getOffersDetailList.add(element);
counter++;
}

@ -37,7 +37,7 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
String itemTitle = "";
String itemDescription = "";
num itemPrice = 0;
String selectedItemCondition = "new";
String selectedItemCondition = "1";
List<GetRegionsList> getRegionsList = [];
GetRegionsList selectedRegion = GetRegionsList();
@ -88,16 +88,16 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
itemDescription = value;
},
).paddingOnly(top: 12),
LocaleKeys.itemCondition.tr().toText14().paddingOnly(top: 21),
LocaleKeys.expireAfter.tr().toText14().paddingOnly(top: 21),
Row(
children: [
ShowRadio(title: LocaleKeys.newString.tr(), value: "new", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() {
selectedItemCondition = "new";
ShowRadio(title: LocaleKeys.oneWeek.tr(), value: "1", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() {
selectedItemCondition = "1";
setState(() {});
}),
12.width,
ShowRadio(title: LocaleKeys.used.tr(), value: "used", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() {
selectedItemCondition = "used";
ShowRadio(title: LocaleKeys.twoWeek.tr(), value: "2", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() {
selectedItemCondition = "2";
setState(() {});
}),
],
@ -166,8 +166,18 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
);
}
DateTime getEndDate() {
DateTime date = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day);
DateTime endDate;
if (selectedItemCondition == "1") {
return endDate = DateTime(date.year, date.month, date.day + 7);
} else {
return endDate = DateTime(date.year, date.month, date.day + 7);
}
}
ItemReviewModel getItemReviewObject() {
ItemReviewModel itemReviewModel = ItemReviewModel(itemTitle, itemDescription, selectedItemCondition, selectedRegion, itemPrice, images, widget.selectedSaleCategory);
ItemReviewModel itemReviewModel = ItemReviewModel(itemTitle, itemDescription, selectedItemCondition, selectedRegion, itemPrice, images, widget.selectedSaleCategory, getEndDate());
return itemReviewModel;
}
@ -246,7 +256,7 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
Future<void> getAdDetails() async {
// todo need to change this method later , its not a good approach to do it like this.
String details = await Utils.getStringFromPrefs(SharedPrefsConsts.editItemForSale);
if(details.isNotEmpty) {
if (details.isNotEmpty) {
var body = json.decode(details);
AddItemDetailsFragment.isUpdate = true;
@ -259,6 +269,7 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
selectedItemCondition = body["itemCondition"].toString().toLowerCase();
selectedRegionAd.regionID = body["selectedRegion"]["regionID"];
selectedRegionAd.regionName = body["selectedRegion"]["regionName"];
selectedRegion = selectedRegionAd;
itemPrice = body["itemPrice"];
selectedSaleCategoryAd.categoryID = body["selectedSaleCategory"]["categoryID"];
@ -266,8 +277,8 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
if (body["itemPhotos"].length != 0) {
images.add(body["itemPhotos"][0]);
}
ItemReviewModel itemReviewModel =
ItemReviewModel(body["itemTitle"], body["itemDescription"], body["itemCondition"].toString().toLowerCase(), selectedRegionAd, body["itemPrice"], images, selectedSaleCategoryAd);
ItemReviewModel itemReviewModel = ItemReviewModel(
body["itemTitle"], body["itemDescription"], body["itemCondition"].toString().toLowerCase(), selectedRegionAd, body["itemPrice"], images, selectedSaleCategoryAd, getEndDate());
AddItemDetailsFragment.itemReviewModel = itemReviewModel;
SelectCategoryFragment.selectedSaleCategory = selectedSaleCategoryAd;

@ -27,12 +27,13 @@ class ItemReviewFragment extends StatefulWidget {
class _ItemReviewFragmentState extends State<ItemReviewFragment> {
ItemReviewModel? itemReviewModel;
late bool isUpdate;
String? validFor = '';
@override
void initState() {
itemReviewModel = AddItemDetailsFragment.itemReviewModel;
itemReviewModel!.selectedSaleCategory = SelectCategoryFragment.selectedSaleCategory;
isUpdate = AddItemDetailsFragment.isUpdate;
validFor = itemReviewModel?.itemCondition;
super.initState();
}
@ -105,7 +106,7 @@ class _ItemReviewFragmentState extends State<ItemReviewFragment> {
size: 20,
color: MyColors.redColor,
).paddingOnly(top: 21),
"This ad will be valid for 2 weeks after approval.".toText11(color: MyColors.redColor).paddingOnly(left: 10, right: 10),
"This ad will be valid for $validFor weeks after approval.".toText11(color: MyColors.redColor).paddingOnly(left: 10, right: 10),
],
),
const Spacer(),

@ -154,7 +154,7 @@ class _MyPostedAdsFragmentState extends State<MyPostedAdsFragment> {
List<String> itemPhotos = [];
itemPhotos.add(employeePostedAdsList[index].itemAttachments![0].content!.toString());
ItemReviewModel itemReviewModel = ItemReviewModel(employeePostedAdsList[index].title, employeePostedAdsList[index].description, employeePostedAdsList[index].status,
selectedRegion, employeePostedAdsList[index].quotePrice, itemPhotos, selectedSaleCategory);
selectedRegion, employeePostedAdsList[index].quotePrice, itemPhotos, selectedSaleCategory, employeePostedAdsList[index].endDate!);
Utils.saveStringFromPrefs(SharedPrefsConsts.editItemForSale, jsonEncode(itemReviewModel.toJson()));
Navigator.pushNamed(context, AppRoutes.addNewItemForSale, arguments: 1);
}).expanded,
@ -188,6 +188,7 @@ class _MyPostedAdsFragmentState extends State<MyPostedAdsFragment> {
request.fields['ItgQuotePrice'] = employeePostedAds.quotePrice.toString();
request.fields['RegionID'] = employeePostedAds.regionID.toString();
request.fields['Itg_EndDate'] = employeePostedAds.endDate.toString();
request.fields['endDate'] = employeePostedAds.endDate.toString();
request.fields['Channel'] = "31";
request.fields['ItgIsActive'] = "false";
request.fields['LogInToken'] = loginTokenID!;

@ -57,14 +57,14 @@ class _OffersAndDiscountsDetailsState extends State<OffersAndDiscountsDetails> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Hero(
tag: "ItemImage" + getOffersList[0].rowID!,
tag: "ItemImage" + getOffersList[0].offersDiscountId.toString()!,
// transitionOnUserGestures: true,
child: RepaintBoundary(
key: _globalKey,
child: ClipRRect(
borderRadius: BorderRadius.circular(6),
child: Image.network(
getOffersList[0].bannerImage!,
getOffersList[0].bannerImage ?? "",
fit: BoxFit.contain,
),
).paddingAll(12),
@ -72,10 +72,10 @@ class _OffersAndDiscountsDetailsState extends State<OffersAndDiscountsDetails> {
),
8.height,
AppState().isArabic(context)
? getOffersList[0].titleAR!.toText22(isBold: true, color: const Color(0xff2B353E)).center
: getOffersList[0].title!.toText22(isBold: true, color: const Color(0xff2B353E)).center,
? getOffersList[0].titleAr!.toText22(isBold: true, color: const Color(0xff2B353E)).center
: getOffersList[0].titleEn!.toText22(isBold: true, color: const Color(0xff2B353E)).center,
Html(
data: AppState().isArabic(context) ? getOffersList[0].descriptionAR! : getOffersList[0].description ?? "",
data: AppState().isArabic(context) ? getOffersList[0].descriptionAr! : getOffersList[0].descriptionEn ?? "",
onLinkTap: (String? url, RenderContext context, Map<String, String> attributes, _) {
launchUrl(Uri.parse(url!));
},
@ -127,7 +127,7 @@ class _OffersAndDiscountsDetailsState extends State<OffersAndDiscountsDetails> {
Directory tempDir = await getTemporaryDirectory();
File file = await File('${tempDir.path}/${DateTime.now().toString()}.png').create();
await file.writeAsBytes(pngBytes);
await Share.shareFiles([(file.path)], text: AppState().isArabic(context) ? getOffersList[0].titleAR : getOffersList[0].title);
await Share.shareFiles([(file.path)], text: AppState().isArabic(context) ? getOffersList[0].titleAr : getOffersList[0].titleEn);
} catch (ex) {
debugPrint(ex.toString());
}
@ -155,21 +155,21 @@ class _OffersAndDiscountsDetailsState extends State<OffersAndDiscountsDetails> {
mainAxisSize: MainAxisSize.min,
children: [
Hero(
tag: "ItemImage" + getOffersList.rowID!,
tag: "ItemImage" + getOffersList.offersDiscountId.toString()!,
transitionOnUserGestures: true,
child: AspectRatio(
aspectRatio: 148 / 127,
child: ClipRRect(
borderRadius: BorderRadius.circular(6),
child: Image.network(
getOffersList.bannerImage!,
getOffersList.bannerImage ?? "",
fit: BoxFit.contain,
),
),
),
),
5.height,
getOffersList.title!.toText16(isBold: true, color: const Color(0xff2B353E), maxlines: 1),
getOffersList.titleEn!.toText16(isBold: true, color: const Color(0xff2B353E), maxlines: 1),
// Html(
// data: AppState().isArabic(context) ? getOffersList.descriptionAR! : getOffersList.description ?? "",
// // onLinkTap: (String? url, RenderContext context, Map<String, String> attributes, _) {
@ -178,7 +178,7 @@ class _OffersAndDiscountsDetailsState extends State<OffersAndDiscountsDetails> {
// ),
// getOffersList.description!.toText12(maxLine: 2, color: const Color(0xff535353)),
// 16.height,
getOffersList.discount!.toText14(isBold: true, maxlines: 1),
getOffersList.discountDescription!.toText14(isBold: true, maxlines: 1),
8.height,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -195,11 +195,12 @@ class _OffersAndDiscountsDetailsState extends State<OffersAndDiscountsDetails> {
void getOfferLocation() {}
Widget checkDate(String endDate) {
DateTime endDateObj = DateFormat("yyyy-MM-dd").parse(endDate);
if (endDateObj.isAfter(DateTime.now())) {
return "Offer Valid".toText16(isBold: true, color: MyColors.greenColor);
} else {
return "Offer Expired".toText16(isBold: true, color: MyColors.redColor);
}
// this new api always return valid offer and discount so commenting the expired one
// DateTime endDateObj = DateFormat("yyyy-MM-dd").parse(endDate);
// if (endDateObj.isAfter(DateTime.now())) {
return "Offer Valid".toText16(isBold: true, color: MyColors.greenColor);
// } else {
// return "Offer Expired".toText16(isBold: true, color: MyColors.redColor);
// }
}
}

@ -157,22 +157,22 @@ class _OffersAndDiscountsHomeState extends State<OffersAndDiscountsHome> {
mainAxisSize: MainAxisSize.min,
children: [
Hero(
tag: "ItemImage" + getOffersList.rowID!,
tag: "ItemImage" + getOffersList.offersDiscountId.toString()!,
transitionOnUserGestures: true,
child: AspectRatio(
aspectRatio: 118 / 127,
child: ClipRRect(
borderRadius: BorderRadius.circular(6),
child: Image.network(
getOffersList.bannerImage!,
getOffersList.bannerImage ?? "",
fit: BoxFit.contain,
),
),
),
),
AppState().isArabic(context)
? getOffersList.titleAR!.toText16(isBold: true, color: const Color(0xff2B353E), maxlines: 1)
: getOffersList.title!.toText16(isBold: true, color: const Color(0xff2B353E), maxlines: 1),
? getOffersList.titleAr!.toText16(isBold: true, color: const Color(0xff2B353E), maxlines: 1)
: getOffersList.titleEn!.toText16(isBold: true, color: const Color(0xff2B353E), maxlines: 1),
// Html(
// data: AppState().isArabic(context) ? getOffersList.descriptionAR! : getOffersList.description ?? "",
// // onLinkTap: (String? url, RenderContext context, Map<String, String> attributes, _) {
@ -181,7 +181,7 @@ class _OffersAndDiscountsHomeState extends State<OffersAndDiscountsHome> {
// ),
// getOffersList.description!.toText12(maxLine: 2, color: const Color(0xff535353)),
// 8.height,
getOffersList.discount!.toText14(isBold: true, maxlines: 1),
getOffersList.discountDescription!.toText14(isBold: true, maxlines: 1),
20.height,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -199,9 +199,9 @@ class _OffersAndDiscountsHomeState extends State<OffersAndDiscountsHome> {
results = getOffersList;
} else {
if (AppState().isArabic(context)) {
results = getOffersList.where((offer) => offer.titleAR!.toLowerCase().contains(enteredKeyword.toLowerCase())).toList();
results = getOffersList.where((offer) => offer.titleAr!.toLowerCase().contains(enteredKeyword.toLowerCase())).toList();
} else {
results = getOffersList.where((offer) => offer.title!.toLowerCase().contains(enteredKeyword.toLowerCase())).toList();
results = getOffersList.where((offer) => offer.titleEn!.toLowerCase().contains(enteredKeyword.toLowerCase())).toList();
}
}
setState(() {
@ -218,7 +218,7 @@ class _OffersAndDiscountsHomeState extends State<OffersAndDiscountsHome> {
getOffersList.forEach((element) {
if (counter <= 4) {
if (element.rowID != offersListModelObj.rowID) {
if (element.offersDiscountId != offersListModelObj.offersDiscountId) {
getOffersDetailList.add(element);
counter++;
}
@ -229,12 +229,13 @@ class _OffersAndDiscountsHomeState extends State<OffersAndDiscountsHome> {
}
Widget checkDate(String endDate) {
DateTime endDateObj = DateFormat("yyyy-MM-dd").parse(endDate);
if (endDateObj.isAfter(DateTime.now())) {
return LocaleKeys.offerValid.tr().toText14(isBold: true, color: MyColors.greenColor);
} else {
return LocaleKeys.offerExpired.tr().toText14(isBold: true, color: MyColors.redColor);
}
// this new api always return valid offer and discount so commenting the expired one
// DateTime endDateObj = DateFormat("yyyy-MM-dd").parse(endDate);
// if (endDateObj.isAfter(DateTime.now())) {
return LocaleKeys.offerValid.tr().toText14(isBold: true, color: MyColors.greenColor);
// } else {
// return LocaleKeys.offerExpired.tr().toText14(isBold: true, color: MyColors.redColor);
// }
}
void getCategoriesListAPI() async {

Loading…
Cancel
Save