Offers and discount and Item for sale changes done.

merge-requests/143/head
Sultan khan 3 years ago
parent e65d876223
commit 3b2ef69f7c

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

@ -514,5 +514,8 @@
"startingIn": "Starting in", "startingIn": "Starting in",
"youAreOutOfContest": "You are out of the contest.", "youAreOutOfContest": "You are out of the contest.",
"winners": "WINNERS!!!", "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 = []; List<GetCategoriesList> getSaleCategoriesList = [];
String url = "${ApiConsts.cocRest}Mohemm_ITG_GetCategories"; 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); postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject( return await ApiClient().postJsonForObject(
@ -55,7 +55,7 @@ class OffersAndDiscountsApiClient {
(response) { (response) {
var body = json.decode(response['Mohemm_ITG_ResponseItem']); 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) { bodyData.forEach((v) {

@ -501,5 +501,7 @@ abstract class LocaleKeys {
static const youAreOutOfContest = 'youAreOutOfContest'; static const youAreOutOfContest = 'youAreOutOfContest';
static const winners = 'winners'; static const winners = 'winners';
static const fakeLocation = 'fakeLocation'; 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: lines_longer_than_80_chars
// ignore_for_file: depend_on_referenced_packages // 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:file_picker/_internal/file_picker_web.dart';
import 'package:firebase_core_web/firebase_core_web.dart'; import 'package:firebase_core_web/firebase_core_web.dart';
import 'package:firebase_messaging_web/firebase_messaging_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:geolocator_web/geolocator_web.dart';
import 'package:google_maps_flutter_web/google_maps_flutter_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: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:shared_preferences_web/shared_preferences_web.dart';
import 'package:url_launcher_web/url_launcher_web.dart'; import 'package:url_launcher_web/url_launcher_web.dart';
import 'package:video_player_web/video_player_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 // ignore: public_member_api_docs
void registerPlugins(Registrar registrar) { void registerPlugins(Registrar registrar) {
AudioSessionWeb.registerWith(registrar);
CameraPlugin.registerWith(registrar);
FilePickerWeb.registerWith(registrar); FilePickerWeb.registerWith(registrar);
FirebaseCoreWeb.registerWith(registrar); FirebaseCoreWeb.registerWith(registrar);
FirebaseMessagingWeb.registerWith(registrar); FirebaseMessagingWeb.registerWith(registrar);
@ -28,6 +34,8 @@ void registerPlugins(Registrar registrar) {
GeolocatorPlugin.registerWith(registrar); GeolocatorPlugin.registerWith(registrar);
GoogleMapsPlugin.registerWith(registrar); GoogleMapsPlugin.registerWith(registrar);
ImagePickerPlugin.registerWith(registrar); ImagePickerPlugin.registerWith(registrar);
JustAudioPlugin.registerWith(registrar);
RecordPluginWeb.registerWith(registrar);
SharedPreferencesPlugin.registerWith(registrar); SharedPreferencesPlugin.registerWith(registrar);
UrlLauncherPlugin.registerWith(registrar); UrlLauncherPlugin.registerWith(registrar);
VideoPlayerPlugin.registerWith(registrar); VideoPlayerPlugin.registerWith(registrar);

@ -11,7 +11,7 @@ class EmployeePostedAds {
String? countryName; String? countryName;
String? currencyCode; String? currencyCode;
String? startDate; String? startDate;
String? endDate; DateTime? endDate;
int? quotePrice; int? quotePrice;
int? employeeNumber; int? employeeNumber;
String? profilePicture; String? profilePicture;
@ -115,8 +115,7 @@ class EmployeePostedAds {
data['isApproved'] = this.isApproved; data['isApproved'] = this.isApproved;
data['status'] = this.status; data['status'] = this.status;
if (this.itemAttachments != null) { if (this.itemAttachments != null) {
data['itemAttachments'] = data['itemAttachments'] = this.itemAttachments!.map((v) => v.toJson()).toList();
this.itemAttachments!.map((v) => v.toJson()).toList();
} }
data['created'] = this.created; data['created'] = this.created;
data['isActive'] = this.isActive; data['isActive'] = this.isActive;
@ -138,16 +137,7 @@ class ItemAttachments {
String? content; String? content;
String? filePath; String? filePath;
ItemAttachments( ItemAttachments({this.attachmentId, this.fileName, this.contentType, this.attachFileStream, this.base64String, this.isActive, this.referenceItemId, this.content, this.filePath});
{this.attachmentId,
this.fileName,
this.contentType,
this.attachFileStream,
this.base64String,
this.isActive,
this.referenceItemId,
this.content,
this.filePath});
ItemAttachments.fromJson(Map<String, dynamic> json) { ItemAttachments.fromJson(Map<String, dynamic> json) {
attachmentId = json['attachmentId']; attachmentId = json['attachmentId'];

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

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

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

@ -37,7 +37,7 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
String itemTitle = ""; String itemTitle = "";
String itemDescription = ""; String itemDescription = "";
num itemPrice = 0; num itemPrice = 0;
String selectedItemCondition = "new"; String selectedItemCondition = "1";
List<GetRegionsList> getRegionsList = []; List<GetRegionsList> getRegionsList = [];
GetRegionsList selectedRegion = GetRegionsList(); GetRegionsList selectedRegion = GetRegionsList();
@ -88,16 +88,16 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
itemDescription = value; itemDescription = value;
}, },
).paddingOnly(top: 12), ).paddingOnly(top: 12),
LocaleKeys.itemCondition.tr().toText14().paddingOnly(top: 21), LocaleKeys.expireAfter.tr().toText14().paddingOnly(top: 21),
Row( Row(
children: [ children: [
ShowRadio(title: LocaleKeys.newString.tr(), value: "new", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() { ShowRadio(title: LocaleKeys.oneWeek.tr(), value: "1", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() {
selectedItemCondition = "new"; selectedItemCondition = "1";
setState(() {}); setState(() {});
}), }),
12.width, 12.width,
ShowRadio(title: LocaleKeys.used.tr(), value: "used", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() { ShowRadio(title: LocaleKeys.twoWeek.tr(), value: "2", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() {
selectedItemCondition = "used"; selectedItemCondition = "2";
setState(() {}); 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 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; return itemReviewModel;
} }
@ -259,6 +269,7 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
selectedItemCondition = body["itemCondition"].toString().toLowerCase(); selectedItemCondition = body["itemCondition"].toString().toLowerCase();
selectedRegionAd.regionID = body["selectedRegion"]["regionID"]; selectedRegionAd.regionID = body["selectedRegion"]["regionID"];
selectedRegionAd.regionName = body["selectedRegion"]["regionName"]; selectedRegionAd.regionName = body["selectedRegion"]["regionName"];
selectedRegion = selectedRegionAd; selectedRegion = selectedRegionAd;
itemPrice = body["itemPrice"]; itemPrice = body["itemPrice"];
selectedSaleCategoryAd.categoryID = body["selectedSaleCategory"]["categoryID"]; selectedSaleCategoryAd.categoryID = body["selectedSaleCategory"]["categoryID"];
@ -266,8 +277,8 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
if (body["itemPhotos"].length != 0) { if (body["itemPhotos"].length != 0) {
images.add(body["itemPhotos"][0]); images.add(body["itemPhotos"][0]);
} }
ItemReviewModel itemReviewModel = ItemReviewModel itemReviewModel = ItemReviewModel(
ItemReviewModel(body["itemTitle"], body["itemDescription"], body["itemCondition"].toString().toLowerCase(), selectedRegionAd, body["itemPrice"], images, selectedSaleCategoryAd); body["itemTitle"], body["itemDescription"], body["itemCondition"].toString().toLowerCase(), selectedRegionAd, body["itemPrice"], images, selectedSaleCategoryAd, getEndDate());
AddItemDetailsFragment.itemReviewModel = itemReviewModel; AddItemDetailsFragment.itemReviewModel = itemReviewModel;
SelectCategoryFragment.selectedSaleCategory = selectedSaleCategoryAd; SelectCategoryFragment.selectedSaleCategory = selectedSaleCategoryAd;

@ -27,12 +27,13 @@ class ItemReviewFragment extends StatefulWidget {
class _ItemReviewFragmentState extends State<ItemReviewFragment> { class _ItemReviewFragmentState extends State<ItemReviewFragment> {
ItemReviewModel? itemReviewModel; ItemReviewModel? itemReviewModel;
late bool isUpdate; late bool isUpdate;
String? validFor = '';
@override @override
void initState() { void initState() {
itemReviewModel = AddItemDetailsFragment.itemReviewModel; itemReviewModel = AddItemDetailsFragment.itemReviewModel;
itemReviewModel!.selectedSaleCategory = SelectCategoryFragment.selectedSaleCategory; itemReviewModel!.selectedSaleCategory = SelectCategoryFragment.selectedSaleCategory;
isUpdate = AddItemDetailsFragment.isUpdate; isUpdate = AddItemDetailsFragment.isUpdate;
validFor = itemReviewModel?.itemCondition;
super.initState(); super.initState();
} }
@ -105,7 +106,7 @@ class _ItemReviewFragmentState extends State<ItemReviewFragment> {
size: 20, size: 20,
color: MyColors.redColor, color: MyColors.redColor,
).paddingOnly(top: 21), ).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(), const Spacer(),

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

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

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

Loading…
Cancel
Save