finish pharmacy home page , cart page, orders and payment page, recently viewed , and lakum module almost finished
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 447 B |
After Width: | Height: | Size: 383 B |
After Width: | Height: | Size: 782 B |
After Width: | Height: | Size: 503 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 737 B |
After Width: | Height: | Size: 387 B |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 534 B |
After Width: | Height: | Size: 373 B |
After Width: | Height: | Size: 648 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 4.9 KiB |
@ -0,0 +1,84 @@
|
||||
class BillingAddress {
|
||||
String id;
|
||||
String firstName;
|
||||
String lastName;
|
||||
String email;
|
||||
String company;
|
||||
int countryId;
|
||||
String country;
|
||||
String stateProvinceId;
|
||||
String city;
|
||||
String address1;
|
||||
String address2;
|
||||
String zipPostalCode;
|
||||
String phoneNumber;
|
||||
String faxNumber;
|
||||
String customerAttributes;
|
||||
String createdOnUtc;
|
||||
String province;
|
||||
String latLong;
|
||||
|
||||
BillingAddress(
|
||||
{this.id,
|
||||
this.firstName,
|
||||
this.lastName,
|
||||
this.email,
|
||||
this.company,
|
||||
this.countryId,
|
||||
this.country,
|
||||
this.stateProvinceId,
|
||||
this.city,
|
||||
this.address1,
|
||||
this.address2,
|
||||
this.zipPostalCode,
|
||||
this.phoneNumber,
|
||||
this.faxNumber,
|
||||
this.customerAttributes,
|
||||
this.createdOnUtc,
|
||||
this.province,
|
||||
this.latLong});
|
||||
|
||||
BillingAddress.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
firstName = json['first_name'];
|
||||
lastName = json['last_name'];
|
||||
email = json['email'];
|
||||
company = json['company'];
|
||||
countryId = json['country_id'];
|
||||
country = json['country'];
|
||||
stateProvinceId = json['state_province_id'];
|
||||
city = json['city'];
|
||||
address1 = json['address1'];
|
||||
address2 = json['address2'];
|
||||
zipPostalCode = json['zip_postal_code'];
|
||||
phoneNumber = json['phone_number'];
|
||||
faxNumber = json['fax_number'];
|
||||
customerAttributes = json['customer_attributes'];
|
||||
createdOnUtc = json['created_on_utc'];
|
||||
province = json['province'];
|
||||
latLong = json['lat_long'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['first_name'] = this.firstName;
|
||||
data['last_name'] = this.lastName;
|
||||
data['email'] = this.email;
|
||||
data['company'] = this.company;
|
||||
data['country_id'] = this.countryId;
|
||||
data['country'] = this.country;
|
||||
data['state_province_id'] = this.stateProvinceId;
|
||||
data['city'] = this.city;
|
||||
data['address1'] = this.address1;
|
||||
data['address2'] = this.address2;
|
||||
data['zip_postal_code'] = this.zipPostalCode;
|
||||
data['phone_number'] = this.phoneNumber;
|
||||
data['fax_number'] = this.faxNumber;
|
||||
data['customer_attributes'] = this.customerAttributes;
|
||||
data['created_on_utc'] = this.createdOnUtc;
|
||||
data['province'] = this.province;
|
||||
data['lat_long'] = this.latLong;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,155 @@
|
||||
import 'PointsAmountPerYear.dart';
|
||||
import 'PointsDetails.dart';
|
||||
|
||||
class LakumInquiryInformationObjVersion {
|
||||
int accountNumber;
|
||||
String accountStatus;
|
||||
String barCode;
|
||||
int consumedPoints;
|
||||
String consumedPointsAmount;
|
||||
List<PointsAmountPerYear> consumedPointsAmountPerYear;
|
||||
List<PointsDetails> consumedPointsDetails;
|
||||
String createdDate;
|
||||
int expiredPoints;
|
||||
String expiryDate;
|
||||
int gainedPoints;
|
||||
List<PointsAmountPerYear> gainedPointsAmountPerYear;
|
||||
List<PointsDetails> gainedPointsDetails;
|
||||
String lakumMessageStatus;
|
||||
String memberName;
|
||||
String memberUniversalId;
|
||||
String mobileNumber;
|
||||
int pointsBalance;
|
||||
int pointsBalanceAmount;
|
||||
int pointsWillBeExpired;
|
||||
String prefLang;
|
||||
int statusCode;
|
||||
int transferPoints;
|
||||
List<PointsAmountPerYear> transferPointsAmountPerYear;
|
||||
List<PointsDetails> transferPointsDetails;
|
||||
double waitingPoints;
|
||||
int loyalityAmount;
|
||||
int loyalityPoints;
|
||||
int purchaseRate;
|
||||
|
||||
LakumInquiryInformationObjVersion(
|
||||
{this.accountNumber,
|
||||
this.accountStatus,
|
||||
this.barCode,
|
||||
this.consumedPoints,
|
||||
this.consumedPointsAmount,
|
||||
this.consumedPointsAmountPerYear,
|
||||
this.consumedPointsDetails,
|
||||
this.createdDate,
|
||||
this.expiredPoints,
|
||||
this.expiryDate,
|
||||
this.gainedPoints,
|
||||
this.gainedPointsAmountPerYear,
|
||||
this.gainedPointsDetails,
|
||||
this.lakumMessageStatus,
|
||||
this.memberName,
|
||||
this.memberUniversalId,
|
||||
this.mobileNumber,
|
||||
this.pointsBalance,
|
||||
this.pointsBalanceAmount,
|
||||
this.pointsWillBeExpired,
|
||||
this.prefLang,
|
||||
this.statusCode,
|
||||
this.transferPoints,
|
||||
this.transferPointsAmountPerYear,
|
||||
this.transferPointsDetails,
|
||||
this.waitingPoints,
|
||||
this.loyalityAmount,
|
||||
this.loyalityPoints,
|
||||
this.purchaseRate});
|
||||
|
||||
LakumInquiryInformationObjVersion.fromJson(Map<String, dynamic> json) {
|
||||
accountNumber = json['AccountNumber'];
|
||||
accountStatus = json['AccountStatus'];
|
||||
barCode = json['BarCode'];
|
||||
consumedPoints = json['ConsumedPoints'];
|
||||
consumedPointsAmount = json['ConsumedPointsAmount'];
|
||||
consumedPointsAmountPerYear = json['ConsumedPointsAmountPerYear'];
|
||||
if (json['ConsumedPointsDetails'] != null) {
|
||||
consumedPointsDetails = new List<Null>();
|
||||
json['ConsumedPointsDetails'].forEach((v) {
|
||||
consumedPointsDetails.add(v);
|
||||
});
|
||||
}
|
||||
createdDate = json['CreatedDate'];
|
||||
expiredPoints = json['ExpiredPoints'];
|
||||
expiryDate = json['ExpiryDate'];
|
||||
gainedPoints = json['GainedPoints'];
|
||||
gainedPointsAmountPerYear = json['GainedPointsAmountPerYear'];
|
||||
if (json['GainedPointsDetails'] != null) {
|
||||
gainedPointsDetails = new List<Null>();
|
||||
json['GainedPointsDetails'].forEach((v) {
|
||||
gainedPointsDetails.add(v);
|
||||
});
|
||||
}
|
||||
lakumMessageStatus = json['LakumMessageStatus'];
|
||||
memberName = json['MemberName'];
|
||||
memberUniversalId = json['MemberUniversalId'];
|
||||
mobileNumber = json['MobileNumber'];
|
||||
pointsBalance = json['PointsBalance'];
|
||||
pointsBalanceAmount = json['PointsBalanceAmount'];
|
||||
pointsWillBeExpired = json['PointsWillBeExpired'];
|
||||
prefLang = json['PrefLang'];
|
||||
statusCode = json['StatusCode'];
|
||||
transferPoints = json['TransferPoints'];
|
||||
transferPointsAmountPerYear = json['TransferPointsAmountPerYear'];
|
||||
if (json['TransferPointsDetails'] != null) {
|
||||
transferPointsDetails = new List<Null>();
|
||||
json['TransferPointsDetails'].forEach((v) {
|
||||
transferPointsDetails.add(v);
|
||||
});
|
||||
}
|
||||
waitingPoints = json['WaitingPoints'];
|
||||
loyalityAmount = json['loyalityAmount'];
|
||||
loyalityPoints = json['loyalityPoints'];
|
||||
purchaseRate = json['purchaseRate'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['AccountNumber'] = this.accountNumber;
|
||||
data['AccountStatus'] = this.accountStatus;
|
||||
data['BarCode'] = this.barCode;
|
||||
data['ConsumedPoints'] = this.consumedPoints;
|
||||
data['ConsumedPointsAmount'] = this.consumedPointsAmount;
|
||||
data['ConsumedPointsAmountPerYear'] = this.consumedPointsAmountPerYear;
|
||||
if (this.consumedPointsDetails != null) {
|
||||
data['ConsumedPointsDetails'] =
|
||||
this.consumedPointsDetails.map((v) => v).toList();
|
||||
}
|
||||
data['CreatedDate'] = this.createdDate;
|
||||
data['ExpiredPoints'] = this.expiredPoints;
|
||||
data['ExpiryDate'] = this.expiryDate;
|
||||
data['GainedPoints'] = this.gainedPoints;
|
||||
data['GainedPointsAmountPerYear'] = this.gainedPointsAmountPerYear;
|
||||
if (this.gainedPointsDetails != null) {
|
||||
data['GainedPointsDetails'] =
|
||||
this.gainedPointsDetails.map((v) => v).toList();
|
||||
}
|
||||
data['LakumMessageStatus'] = this.lakumMessageStatus;
|
||||
data['MemberName'] = this.memberName;
|
||||
data['MemberUniversalId'] = this.memberUniversalId;
|
||||
data['MobileNumber'] = this.mobileNumber;
|
||||
data['PointsBalance'] = this.pointsBalance;
|
||||
data['PointsBalanceAmount'] = this.pointsBalanceAmount;
|
||||
data['PointsWillBeExpired'] = this.pointsWillBeExpired;
|
||||
data['PrefLang'] = this.prefLang;
|
||||
data['StatusCode'] = this.statusCode;
|
||||
data['TransferPoints'] = this.transferPoints;
|
||||
data['TransferPointsAmountPerYear'] = this.transferPointsAmountPerYear;
|
||||
if (this.transferPointsDetails != null) {
|
||||
data['TransferPointsDetails'] =
|
||||
this.transferPointsDetails.map((v) => v).toList();
|
||||
}
|
||||
data['WaitingPoints'] = this.waitingPoints;
|
||||
data['loyalityAmount'] = this.loyalityAmount;
|
||||
data['loyalityPoints'] = this.loyalityPoints;
|
||||
data['purchaseRate'] = this.purchaseRate;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
class ListUserAgreement {
|
||||
String userAgreementLAKUM;
|
||||
String userAgreementLAKUMn;
|
||||
String userAgreementTxt;
|
||||
String userAgreementTxtn;
|
||||
|
||||
ListUserAgreement(
|
||||
{this.userAgreementLAKUM,
|
||||
this.userAgreementLAKUMn,
|
||||
this.userAgreementTxt,
|
||||
this.userAgreementTxtn});
|
||||
|
||||
ListUserAgreement.fromJson(Map<String, dynamic> json) {
|
||||
userAgreementLAKUM = json['UserAgreementLAKUM'];
|
||||
userAgreementLAKUMn = json['UserAgreementLAKUMn'];
|
||||
userAgreementTxt = json['UserAgreementTxt'];
|
||||
userAgreementTxtn = json['UserAgreementTxtn'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['UserAgreementLAKUM'] = this.userAgreementLAKUM;
|
||||
data['UserAgreementLAKUMn'] = this.userAgreementLAKUMn;
|
||||
data['UserAgreementTxt'] = this.userAgreementTxt;
|
||||
data['UserAgreementTxtn'] = this.userAgreementTxtn;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -1,149 +1,538 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/Specifications.dart';
|
||||
|
||||
import 'PharmacyImageObject.dart';
|
||||
import 'Reviews.dart';
|
||||
|
||||
class PharmacyProduct {
|
||||
String id;
|
||||
bool visibleIndividually;
|
||||
String name;
|
||||
String namen;
|
||||
String shortDescription;
|
||||
String shortDescriptionn;
|
||||
String fullDescription;
|
||||
String fullDescriptionn;
|
||||
bool markasNew;
|
||||
bool showOnHomePage;
|
||||
String metaKeywords;
|
||||
String metaDescription;
|
||||
String metaTitle;
|
||||
bool allowCustomerReviews;
|
||||
int approvedRatingSum;
|
||||
int notApprovedRatingSum;
|
||||
int approvedTotalReviews;
|
||||
int notApprovedTotalReviews;
|
||||
String sku;
|
||||
bool isRx;
|
||||
bool prescriptionRequired;
|
||||
String rxMessage;
|
||||
String rxMessagen;
|
||||
String manufacturerPartNumber;
|
||||
String gtin;
|
||||
bool isGiftCard;
|
||||
bool requireOtherProducts;
|
||||
bool automaticallyAddRequiredProducts;
|
||||
bool isDownload;
|
||||
bool unlimitedDownloads;
|
||||
int maxNumberOfDownloads;
|
||||
String downloadExpirationDays;
|
||||
bool hasSampleDownload;
|
||||
bool hasUserAgreement;
|
||||
bool isRecurring;
|
||||
int recurringCycleLength;
|
||||
int recurringTotalCycles;
|
||||
bool isRental;
|
||||
int rentalPriceLength;
|
||||
bool isShipEnabled;
|
||||
bool isFreeShipping;
|
||||
bool shipSeparately;
|
||||
double additionalShippingCharge;
|
||||
bool isTaxExempt;
|
||||
bool isTelecommunicationsOrBroadcastingOrElectronicServices;
|
||||
bool useMultipleWarehouses;
|
||||
int manageInventoryMethodId;
|
||||
int stockQuantity;
|
||||
String stockAvailability;
|
||||
String stockAvailabilityn;
|
||||
bool displayStockAvailability;
|
||||
bool displayStockQuantity;
|
||||
int minStockQuantity;
|
||||
int notifyAdminForQuantityBelow;
|
||||
bool allowBackInStockSubscriptions;
|
||||
int orderMinimumQuantity;
|
||||
int orderMaximumQuantity;
|
||||
String allowedQuantities;
|
||||
bool allowAddingOnlyExistingAttributeCombinations;
|
||||
bool disableBuyButton;
|
||||
bool disableWishlistButton;
|
||||
bool availableForPreOrder;
|
||||
String preOrderAvailabilityStartDateTimeUtc;
|
||||
bool callForPrice;
|
||||
double price;
|
||||
double oldPrice;
|
||||
double productCost;
|
||||
String specialPrice;
|
||||
String specialPriceStartDateTimeUtc;
|
||||
String specialPriceEndDateTimeUtc;
|
||||
bool customerEntersPrice;
|
||||
double minimumCustomerEnteredPrice;
|
||||
double maximumCustomerEnteredPrice;
|
||||
bool basepriceEnabled;
|
||||
double basepriceAmount;
|
||||
double basepriceBaseAmount;
|
||||
bool hasTierPrices;
|
||||
bool hasDiscountsApplied;
|
||||
String discountName;
|
||||
String discountNamen;
|
||||
String discountDescription;
|
||||
String discountDescriptionn;
|
||||
String discountPercentage;
|
||||
String currency;
|
||||
String currencyn;
|
||||
double weight;
|
||||
double length;
|
||||
double width;
|
||||
double height;
|
||||
String availableStartDateTimeUtc;
|
||||
String availableEndDateTimeUtc;
|
||||
int displayOrder;
|
||||
bool published;
|
||||
bool deleted;
|
||||
String createdOnUtc;
|
||||
String updatedOnUtc;
|
||||
String productType;
|
||||
int parentGroupedProductId;
|
||||
List<int> roleIds;
|
||||
List<int> discountIds;
|
||||
List<int> storeIds;
|
||||
List<int> manufacturerIds;
|
||||
List<Reviews> reviews;
|
||||
List<PharmacyImageObject> images;
|
||||
List<String> attributes;
|
||||
List<Specifications> specifications;
|
||||
List<String> associatedProductIds;
|
||||
List<String> tags;
|
||||
int vendorId;
|
||||
String seName;
|
||||
|
||||
|
||||
PharmacyProduct(
|
||||
{this.id,
|
||||
this.visibleIndividually,
|
||||
this.name,
|
||||
this.namen,
|
||||
this.shortDescription,
|
||||
this.shortDescriptionn,
|
||||
this.fullDescription,
|
||||
this.fullDescriptionn,
|
||||
this.markasNew,
|
||||
this.showOnHomePage,
|
||||
this.metaKeywords,
|
||||
this.metaDescription,
|
||||
this.metaTitle,
|
||||
this.allowCustomerReviews,
|
||||
this.approvedRatingSum,
|
||||
this.notApprovedRatingSum,
|
||||
this.approvedTotalReviews,
|
||||
this.notApprovedTotalReviews,
|
||||
this.sku,
|
||||
this.isRx,
|
||||
this.prescriptionRequired,
|
||||
this.rxMessage,
|
||||
this.rxMessagen,
|
||||
this.manufacturerPartNumber,
|
||||
this.gtin,
|
||||
this.isGiftCard,
|
||||
this.requireOtherProducts,
|
||||
this.automaticallyAddRequiredProducts,
|
||||
this.isDownload,
|
||||
this.unlimitedDownloads,
|
||||
this.maxNumberOfDownloads,
|
||||
this.downloadExpirationDays,
|
||||
this.hasSampleDownload,
|
||||
this.hasUserAgreement,
|
||||
this.isRecurring,
|
||||
this.recurringCycleLength,
|
||||
this.recurringTotalCycles,
|
||||
this.isRental,
|
||||
this.rentalPriceLength,
|
||||
this.isShipEnabled,
|
||||
this.isFreeShipping,
|
||||
this.shipSeparately,
|
||||
this.additionalShippingCharge,
|
||||
this.isTaxExempt,
|
||||
this.isTelecommunicationsOrBroadcastingOrElectronicServices,
|
||||
this.useMultipleWarehouses,
|
||||
this.manageInventoryMethodId,
|
||||
this.stockQuantity,
|
||||
this.stockAvailability,
|
||||
this.stockAvailabilityn,
|
||||
this.displayStockAvailability,
|
||||
this.displayStockQuantity,
|
||||
this.minStockQuantity,
|
||||
this.notifyAdminForQuantityBelow,
|
||||
this.allowBackInStockSubscriptions,
|
||||
this.orderMinimumQuantity,
|
||||
this.orderMaximumQuantity,
|
||||
this.allowedQuantities,
|
||||
this.allowAddingOnlyExistingAttributeCombinations,
|
||||
this.disableBuyButton,
|
||||
this.disableWishlistButton,
|
||||
this.availableForPreOrder,
|
||||
this.preOrderAvailabilityStartDateTimeUtc,
|
||||
this.callForPrice,
|
||||
this.price,
|
||||
this.oldPrice,
|
||||
this.productCost,
|
||||
this.specialPrice,
|
||||
this.specialPriceStartDateTimeUtc,
|
||||
this.specialPriceEndDateTimeUtc,
|
||||
this.customerEntersPrice,
|
||||
this.minimumCustomerEnteredPrice,
|
||||
this.maximumCustomerEnteredPrice,
|
||||
this.basepriceEnabled,
|
||||
this.basepriceAmount,
|
||||
this.basepriceBaseAmount,
|
||||
this.hasTierPrices,
|
||||
this.hasDiscountsApplied,
|
||||
this.discountName,
|
||||
this.discountNamen,
|
||||
this.discountDescription,
|
||||
this.discountDescriptionn,
|
||||
this.discountPercentage,
|
||||
this.currency,
|
||||
this.currencyn,
|
||||
this.weight,
|
||||
this.length,
|
||||
this.width,
|
||||
this.height,
|
||||
this.availableStartDateTimeUtc,
|
||||
this.availableEndDateTimeUtc,
|
||||
this.displayOrder,
|
||||
this.published,
|
||||
this.deleted,
|
||||
this.createdOnUtc,
|
||||
this.updatedOnUtc,
|
||||
this.productType,
|
||||
this.parentGroupedProductId,
|
||||
this.roleIds,
|
||||
this.discountIds,
|
||||
this.storeIds,
|
||||
this.manufacturerIds,
|
||||
this.reviews,
|
||||
this.images});
|
||||
this.images,
|
||||
this.attributes,
|
||||
this.specifications,
|
||||
this.associatedProductIds,
|
||||
this.tags,
|
||||
this.vendorId,
|
||||
this.seName});
|
||||
|
||||
PharmacyProduct.fromJson(Map<String, dynamic> json) {
|
||||
try {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
namen = json['namen'];
|
||||
shortDescription = json['short_description'];
|
||||
fullDescription = json['full_description'];
|
||||
fullDescriptionn = json['full_descriptionn'];
|
||||
approvedRatingSum = json['approved_rating_sum'];
|
||||
approvedTotalReviews = json['approved_total_reviews'];
|
||||
sku = json['sku'];
|
||||
isRx = json['is_rx'];
|
||||
rxMessage = json['rx_message'];
|
||||
rxMessagen = json['rx_messagen'];
|
||||
stockQuantity = json['stock_quantity'];
|
||||
stockAvailability = json['stock_availability'];
|
||||
stockAvailabilityn = json['stock_availabilityn'];
|
||||
allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions'];
|
||||
orderMinimumQuantity = json['order_minimum_quantity'];
|
||||
orderMaximumQuantity = json['order_maximum_quantity'];
|
||||
price = json['price'];
|
||||
oldPrice = json['old_price'];
|
||||
discountName = json['discount_name'];
|
||||
discountNamen = json['discount_namen'];
|
||||
discountPercentage = json['discount_percentage'];
|
||||
displayOrder = json['display_order'];
|
||||
if (json['discount_ids'] != null) {
|
||||
discountIds = new List<int>();
|
||||
json['discount_ids'].forEach((v) {
|
||||
discountIds.add(v);
|
||||
});
|
||||
}
|
||||
if (json['reviews'] != null) {
|
||||
reviews = new List<Reviews>();
|
||||
json['reviews'].forEach((v) {
|
||||
reviews.add(new Reviews.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['images'] != null) {
|
||||
images = new List<PharmacyImageObject>();
|
||||
json['images'].forEach((v) {
|
||||
images.add(new PharmacyImageObject.fromJson(v));
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
print(e);
|
||||
id = json['id'];
|
||||
visibleIndividually = json['visible_individually'];
|
||||
name = json['name'];
|
||||
namen = json['namen'];
|
||||
shortDescription = json['short_description'];
|
||||
shortDescriptionn = json['short_descriptionn'];
|
||||
fullDescription = json['full_description'];
|
||||
fullDescriptionn = json['full_descriptionn'];
|
||||
markasNew = json['markas_new'];
|
||||
showOnHomePage = json['show_on_home_page'];
|
||||
metaKeywords = json['meta_keywords'];
|
||||
metaDescription = json['meta_description'];
|
||||
metaTitle = json['meta_title'];
|
||||
allowCustomerReviews = json['allow_customer_reviews'];
|
||||
approvedRatingSum = json['approved_rating_sum'];
|
||||
notApprovedRatingSum = json['not_approved_rating_sum'];
|
||||
approvedTotalReviews = json['approved_total_reviews'];
|
||||
notApprovedTotalReviews = json['not_approved_total_reviews'];
|
||||
sku = json['sku'];
|
||||
isRx = json['is_rx'];
|
||||
prescriptionRequired = json['prescription_required'];
|
||||
rxMessage = json['rx_message'];
|
||||
rxMessagen = json['rx_messagen'];
|
||||
manufacturerPartNumber = json['manufacturer_part_number'];
|
||||
gtin = json['gtin'];
|
||||
isGiftCard = json['is_gift_card'];
|
||||
requireOtherProducts = json['require_other_products'];
|
||||
automaticallyAddRequiredProducts =
|
||||
json['automatically_add_required_products'];
|
||||
isDownload = json['is_download'];
|
||||
unlimitedDownloads = json['unlimited_downloads'];
|
||||
maxNumberOfDownloads = json['max_number_of_downloads'];
|
||||
downloadExpirationDays = json['download_expiration_days'];
|
||||
hasSampleDownload = json['has_sample_download'];
|
||||
hasUserAgreement = json['has_user_agreement'];
|
||||
isRecurring = json['is_recurring'];
|
||||
recurringCycleLength = json['recurring_cycle_length'];
|
||||
recurringTotalCycles = json['recurring_total_cycles'];
|
||||
isRental = json['is_rental'];
|
||||
rentalPriceLength = json['rental_price_length'];
|
||||
isShipEnabled = json['is_ship_enabled'];
|
||||
isFreeShipping = json['is_free_shipping'];
|
||||
shipSeparately = json['ship_separately'];
|
||||
additionalShippingCharge = json['additional_shipping_charge'];
|
||||
isTaxExempt = json['is_tax_exempt'];
|
||||
isTelecommunicationsOrBroadcastingOrElectronicServices =
|
||||
json['is_telecommunications_or_broadcasting_or_electronic_services'];
|
||||
useMultipleWarehouses = json['use_multiple_warehouses'];
|
||||
manageInventoryMethodId = json['manage_inventory_method_id'];
|
||||
stockQuantity = json['stock_quantity'];
|
||||
stockAvailability = json['stock_availability'];
|
||||
stockAvailabilityn = json['stock_availabilityn'];
|
||||
displayStockAvailability = json['display_stock_availability'];
|
||||
displayStockQuantity = json['display_stock_quantity'];
|
||||
minStockQuantity = json['min_stock_quantity'];
|
||||
notifyAdminForQuantityBelow = json['notify_admin_for_quantity_below'];
|
||||
allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions'];
|
||||
orderMinimumQuantity = json['order_minimum_quantity'];
|
||||
orderMaximumQuantity = json['order_maximum_quantity'];
|
||||
allowedQuantities = json['allowed_quantities'];
|
||||
allowAddingOnlyExistingAttributeCombinations =
|
||||
json['allow_adding_only_existing_attribute_combinations'];
|
||||
disableBuyButton = json['disable_buy_button'];
|
||||
disableWishlistButton = json['disable_wishlist_button'];
|
||||
availableForPreOrder = json['available_for_pre_order'];
|
||||
preOrderAvailabilityStartDateTimeUtc =
|
||||
json['pre_order_availability_start_date_time_utc'];
|
||||
callForPrice = json['call_for_price'];
|
||||
price = json['price'];
|
||||
oldPrice = json['old_price'];
|
||||
productCost = json['product_cost'];
|
||||
specialPrice = json['special_price'];
|
||||
specialPriceStartDateTimeUtc = json['special_price_start_date_time_utc'];
|
||||
specialPriceEndDateTimeUtc = json['special_price_end_date_time_utc'];
|
||||
customerEntersPrice = json['customer_enters_price'];
|
||||
minimumCustomerEnteredPrice = json['minimum_customer_entered_price'];
|
||||
maximumCustomerEnteredPrice = json['maximum_customer_entered_price'];
|
||||
basepriceEnabled = json['baseprice_enabled'];
|
||||
basepriceAmount = json['baseprice_amount'];
|
||||
basepriceBaseAmount = json['baseprice_base_amount'];
|
||||
hasTierPrices = json['has_tier_prices'];
|
||||
hasDiscountsApplied = json['has_discounts_applied'];
|
||||
discountName = json['discount_name'];
|
||||
discountNamen = json['discount_namen'];
|
||||
discountDescription = json['discount_description'];
|
||||
discountDescriptionn = json['discount_Descriptionn'];
|
||||
discountPercentage = json['discount_percentage'];
|
||||
currency = json['currency'];
|
||||
currencyn = json['currencyn'];
|
||||
weight = json['weight'];
|
||||
length = json['length'];
|
||||
width = json['width'];
|
||||
height = json['height'];
|
||||
availableStartDateTimeUtc = json['available_start_date_time_utc'];
|
||||
availableEndDateTimeUtc = json['available_end_date_time_utc'];
|
||||
displayOrder = json['display_order'];
|
||||
published = json['published'];
|
||||
deleted = json['deleted'];
|
||||
createdOnUtc = json['created_on_utc'];
|
||||
updatedOnUtc = json['updated_on_utc'];
|
||||
productType = json['product_type'];
|
||||
parentGroupedProductId = json['parent_grouped_product_id'];
|
||||
if (json['role_ids'] != null) {
|
||||
roleIds = new List<int>();
|
||||
json['role_ids'].forEach((v) {
|
||||
roleIds.add(v);
|
||||
});
|
||||
}
|
||||
if (json['discount_ids'] != null) {
|
||||
discountIds = new List<int>();
|
||||
json['discount_ids'].forEach((v) {
|
||||
discountIds.add(v);
|
||||
});
|
||||
}
|
||||
if (json['store_ids'] != null) {
|
||||
storeIds = new List<int>();
|
||||
json['store_ids'].forEach((v) {
|
||||
storeIds.add(v);
|
||||
});
|
||||
}
|
||||
if (json['manufacturer_ids'] != null) {
|
||||
manufacturerIds = new List<int>();
|
||||
json['manufacturer_ids'].forEach((v) {
|
||||
manufacturerIds.add(v);
|
||||
});
|
||||
}
|
||||
if (json['reviews'] != null) {
|
||||
reviews = new List<Reviews>();
|
||||
json['reviews'].forEach((v) {
|
||||
reviews.add(new Reviews.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['images'] != null) {
|
||||
images = new List<PharmacyImageObject>();
|
||||
json['images'].forEach((v) {
|
||||
images.add(new PharmacyImageObject.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['attributes'] != null) {
|
||||
attributes = new List<String>();
|
||||
json['attributes'].forEach((v) {
|
||||
attributes.add(v);
|
||||
});
|
||||
}
|
||||
if (json['specifications'] != null) {
|
||||
specifications = new List<Specifications>();
|
||||
json['specifications'].forEach((v) {
|
||||
specifications.add(new Specifications.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['associated_product_ids'] != null) {
|
||||
associatedProductIds = new List<String>();
|
||||
json['associated_product_ids'].forEach((v) {
|
||||
associatedProductIds.add(v);
|
||||
});
|
||||
}
|
||||
if (json['tags'] != null) {
|
||||
tags = new List<String>();
|
||||
json['tags'].forEach((v) {
|
||||
tags.add(v);
|
||||
});
|
||||
}
|
||||
vendorId = json['vendor_id'];
|
||||
seName = json['se_name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['visible_individually'] = this.visibleIndividually;
|
||||
data['name'] = this.name;
|
||||
data['namen'] = this.namen;
|
||||
data['short_description'] = this.shortDescription;
|
||||
data['short_descriptionn'] = this.shortDescriptionn;
|
||||
data['full_description'] = this.fullDescription;
|
||||
data['full_descriptionn'] = this.fullDescriptionn;
|
||||
data['markas_new'] = this.markasNew;
|
||||
data['show_on_home_page'] = this.showOnHomePage;
|
||||
data['meta_keywords'] = this.metaKeywords;
|
||||
data['meta_description'] = this.metaDescription;
|
||||
data['meta_title'] = this.metaTitle;
|
||||
data['allow_customer_reviews'] = this.allowCustomerReviews;
|
||||
data['approved_rating_sum'] = this.approvedRatingSum;
|
||||
data['not_approved_rating_sum'] = this.notApprovedRatingSum;
|
||||
data['approved_total_reviews'] = this.approvedTotalReviews;
|
||||
data['not_approved_total_reviews'] = this.notApprovedTotalReviews;
|
||||
data['sku'] = this.sku;
|
||||
data['is_rx'] = this.isRx;
|
||||
data['prescription_required'] = this.prescriptionRequired;
|
||||
data['rx_message'] = this.rxMessage;
|
||||
data['rx_messagen'] = this.rxMessagen;
|
||||
data['manufacturer_part_number'] = this.manufacturerPartNumber;
|
||||
data['gtin'] = this.gtin;
|
||||
data['is_gift_card'] = this.isGiftCard;
|
||||
data['require_other_products'] = this.requireOtherProducts;
|
||||
data['automatically_add_required_products'] =
|
||||
this.automaticallyAddRequiredProducts;
|
||||
data['is_download'] = this.isDownload;
|
||||
data['unlimited_downloads'] = this.unlimitedDownloads;
|
||||
data['max_number_of_downloads'] = this.maxNumberOfDownloads;
|
||||
data['download_expiration_days'] = this.downloadExpirationDays;
|
||||
data['has_sample_download'] = this.hasSampleDownload;
|
||||
data['has_user_agreement'] = this.hasUserAgreement;
|
||||
data['is_recurring'] = this.isRecurring;
|
||||
data['recurring_cycle_length'] = this.recurringCycleLength;
|
||||
data['recurring_total_cycles'] = this.recurringTotalCycles;
|
||||
data['is_rental'] = this.isRental;
|
||||
data['rental_price_length'] = this.rentalPriceLength;
|
||||
data['is_ship_enabled'] = this.isShipEnabled;
|
||||
data['is_free_shipping'] = this.isFreeShipping;
|
||||
data['ship_separately'] = this.shipSeparately;
|
||||
data['additional_shipping_charge'] = this.additionalShippingCharge;
|
||||
data['is_tax_exempt'] = this.isTaxExempt;
|
||||
data['is_telecommunications_or_broadcasting_or_electronic_services'] =
|
||||
this.isTelecommunicationsOrBroadcastingOrElectronicServices;
|
||||
data['use_multiple_warehouses'] = this.useMultipleWarehouses;
|
||||
data['manage_inventory_method_id'] = this.manageInventoryMethodId;
|
||||
data['stock_quantity'] = this.stockQuantity;
|
||||
data['stock_availability'] = this.stockAvailability;
|
||||
data['stock_availabilityn'] = this.stockAvailabilityn;
|
||||
data['display_stock_availability'] = this.displayStockAvailability;
|
||||
data['display_stock_quantity'] = this.displayStockQuantity;
|
||||
data['min_stock_quantity'] = this.minStockQuantity;
|
||||
data['notify_admin_for_quantity_below'] = this.notifyAdminForQuantityBelow;
|
||||
data['allow_back_in_stock_subscriptions'] =
|
||||
this.allowBackInStockSubscriptions;
|
||||
data['order_minimum_quantity'] = this.orderMinimumQuantity;
|
||||
data['order_maximum_quantity'] = this.orderMaximumQuantity;
|
||||
data['allowed_quantities'] = this.allowedQuantities;
|
||||
data['allow_adding_only_existing_attribute_combinations'] =
|
||||
this.allowAddingOnlyExistingAttributeCombinations;
|
||||
data['disable_buy_button'] = this.disableBuyButton;
|
||||
data['disable_wishlist_button'] = this.disableWishlistButton;
|
||||
data['available_for_pre_order'] = this.availableForPreOrder;
|
||||
data['pre_order_availability_start_date_time_utc'] =
|
||||
this.preOrderAvailabilityStartDateTimeUtc;
|
||||
data['call_for_price'] = this.callForPrice;
|
||||
data['price'] = this.price;
|
||||
data['old_price'] = this.oldPrice;
|
||||
data['product_cost'] = this.productCost;
|
||||
data['special_price'] = this.specialPrice;
|
||||
data['special_price_start_date_time_utc'] =
|
||||
this.specialPriceStartDateTimeUtc;
|
||||
data['special_price_end_date_time_utc'] = this.specialPriceEndDateTimeUtc;
|
||||
data['customer_enters_price'] = this.customerEntersPrice;
|
||||
data['minimum_customer_entered_price'] = this.minimumCustomerEnteredPrice;
|
||||
data['maximum_customer_entered_price'] = this.maximumCustomerEnteredPrice;
|
||||
data['baseprice_enabled'] = this.basepriceEnabled;
|
||||
data['baseprice_amount'] = this.basepriceAmount;
|
||||
data['baseprice_base_amount'] = this.basepriceBaseAmount;
|
||||
data['has_tier_prices'] = this.hasTierPrices;
|
||||
data['has_discounts_applied'] = this.hasDiscountsApplied;
|
||||
data['discount_name'] = this.discountName;
|
||||
data['discount_namen'] = this.discountNamen;
|
||||
data['discount_description'] = this.discountDescription;
|
||||
data['discount_Descriptionn'] = this.discountDescriptionn;
|
||||
data['discount_percentage'] = this.discountPercentage;
|
||||
data['currency'] = this.currency;
|
||||
data['currencyn'] = this.currencyn;
|
||||
data['weight'] = this.weight;
|
||||
data['length'] = this.length;
|
||||
data['width'] = this.width;
|
||||
data['height'] = this.height;
|
||||
data['available_start_date_time_utc'] = this.availableStartDateTimeUtc;
|
||||
data['available_end_date_time_utc'] = this.availableEndDateTimeUtc;
|
||||
data['display_order'] = this.displayOrder;
|
||||
if (this.discountIds != String) {
|
||||
data['published'] = this.published;
|
||||
data['deleted'] = this.deleted;
|
||||
data['created_on_utc'] = this.createdOnUtc;
|
||||
data['updated_on_utc'] = this.updatedOnUtc;
|
||||
data['product_type'] = this.productType;
|
||||
data['parent_grouped_product_id'] = this.parentGroupedProductId;
|
||||
if (this.roleIds != null) {
|
||||
data['role_ids'] = this.roleIds.map((v) => v).toList();
|
||||
}
|
||||
if (this.discountIds != null) {
|
||||
data['discount_ids'] = this.discountIds.map((v) => v).toList();
|
||||
}
|
||||
if (this.reviews != String) {
|
||||
if (this.storeIds != null) {
|
||||
data['store_ids'] = this.storeIds.map((v) => v).toList();
|
||||
}
|
||||
data['manufacturer_ids'] = this.manufacturerIds;
|
||||
if (this.reviews != null) {
|
||||
data['reviews'] = this.reviews.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.images != String) {
|
||||
if (this.images != null) {
|
||||
data['images'] = this.images.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.attributes != null) {
|
||||
data['attributes'] = this.attributes.map((v) => v).toList();
|
||||
}
|
||||
if (this.specifications != null) {
|
||||
data['specifications'] =
|
||||
this.specifications.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.associatedProductIds != null) {
|
||||
data['associated_product_ids'] =
|
||||
this.associatedProductIds.map((v) => v).toList();
|
||||
}
|
||||
if (this.tags != null) {
|
||||
data['tags'] = this.tags.map((v) => v).toList();
|
||||
}
|
||||
data['vendor_id'] = this.vendorId;
|
||||
data['se_name'] = this.seName;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
import 'PointsAmountPerday.dart';
|
||||
|
||||
class PointsAmountPerMonth {
|
||||
double amountPerMonth;
|
||||
String month;
|
||||
int monthNumber;
|
||||
List<PointsAmountPerday> pointsAmountPerday;
|
||||
double pointsPerMonth;
|
||||
|
||||
PointsAmountPerMonth(
|
||||
{this.amountPerMonth,
|
||||
this.month,
|
||||
this.monthNumber,
|
||||
this.pointsAmountPerday,
|
||||
this.pointsPerMonth});
|
||||
|
||||
PointsAmountPerMonth.fromJson(Map<String, dynamic> json) {
|
||||
amountPerMonth = json['AmountPerMonth'];
|
||||
month = json['Month'];
|
||||
monthNumber = json['MonthNumber'];
|
||||
if (json['PointsAmountPerday'] != null) {
|
||||
pointsAmountPerday = new List<PointsAmountPerday>();
|
||||
json['PointsAmountPerday'].forEach((v) {
|
||||
pointsAmountPerday.add(new PointsAmountPerday.fromJson(v));
|
||||
});
|
||||
}
|
||||
pointsPerMonth = json['PointsPerMonth'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['AmountPerMonth'] = this.amountPerMonth;
|
||||
data['Month'] = this.month;
|
||||
data['MonthNumber'] = this.monthNumber;
|
||||
if (this.pointsAmountPerday != null) {
|
||||
data['PointsAmountPerday'] =
|
||||
this.pointsAmountPerday.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['PointsPerMonth'] = this.pointsPerMonth;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
import 'PointsAmountPerMonth.dart';
|
||||
|
||||
class PointsAmountPerYear {
|
||||
double amountPerYear;
|
||||
List<PointsAmountPerMonth> pointsAmountPerMonth;
|
||||
double pointsPerYear;
|
||||
int year;
|
||||
|
||||
PointsAmountPerYear(
|
||||
{this.amountPerYear,
|
||||
this.pointsAmountPerMonth,
|
||||
this.pointsPerYear,
|
||||
this.year});
|
||||
|
||||
PointsAmountPerYear.fromJson(Map<String, dynamic> json) {
|
||||
amountPerYear = json['AmountPerYear'];
|
||||
if (json['PointsAmountPerMonth'] != null) {
|
||||
pointsAmountPerMonth = new List<PointsAmountPerMonth>();
|
||||
json['PointsAmountPerMonth'].forEach((v) {
|
||||
pointsAmountPerMonth.add(new PointsAmountPerMonth.fromJson(v));
|
||||
});
|
||||
}
|
||||
pointsPerYear = json['PointsPerYear'];
|
||||
year = json['Year'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['AmountPerYear'] = this.amountPerYear;
|
||||
if (this.pointsAmountPerMonth != null) {
|
||||
data['PointsAmountPerMonth'] =
|
||||
this.pointsAmountPerMonth.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['PointsPerYear'] = this.pointsPerYear;
|
||||
data['Year'] = this.year;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
import 'PointsDetails.dart';
|
||||
|
||||
class PointsAmountPerday {
|
||||
double amountPerDay;
|
||||
String day;
|
||||
List<PointsDetails> pointsDetails;
|
||||
double pointsPerDay;
|
||||
String transationDate;
|
||||
|
||||
PointsAmountPerday(
|
||||
{this.amountPerDay,
|
||||
this.day,
|
||||
this.pointsDetails,
|
||||
this.pointsPerDay,
|
||||
this.transationDate});
|
||||
|
||||
PointsAmountPerday.fromJson(Map<String, dynamic> json) {
|
||||
amountPerDay = json['AmountPerDay'];
|
||||
day = json['Day'];
|
||||
if (json['PointsDetails'] != null) {
|
||||
pointsDetails = new List<PointsDetails>();
|
||||
json['PointsDetails'].forEach((v) {
|
||||
pointsDetails.add(new PointsDetails.fromJson(v));
|
||||
});
|
||||
}
|
||||
pointsPerDay = json['PointsPerDay'];
|
||||
transationDate = json['TransationDate'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['AmountPerDay'] = this.amountPerDay;
|
||||
data['Day'] = this.day;
|
||||
if (this.pointsDetails != null) {
|
||||
data['PointsDetails'] =
|
||||
this.pointsDetails.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['PointsPerDay'] = this.pointsPerDay;
|
||||
data['TransationDate'] = this.transationDate;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
class PointsDetails {
|
||||
int accNumber;
|
||||
String accountStatus;
|
||||
double amount;
|
||||
int lineItemNo;
|
||||
String operationType;
|
||||
double points;
|
||||
double purchasePoints;
|
||||
int subTransactionType;
|
||||
String subTransactionTypeDescription;
|
||||
String transactionDate;
|
||||
|
||||
PointsDetails(
|
||||
{this.accNumber,
|
||||
this.accountStatus,
|
||||
this.amount,
|
||||
this.lineItemNo,
|
||||
this.operationType,
|
||||
this.points,
|
||||
this.purchasePoints,
|
||||
this.subTransactionType,
|
||||
this.subTransactionTypeDescription,
|
||||
this.transactionDate});
|
||||
|
||||
PointsDetails.fromJson(Map<String, dynamic> json) {
|
||||
accNumber = json['AccNumber'];
|
||||
accountStatus = json['AccountStatus'];
|
||||
amount = json['Amount'];
|
||||
lineItemNo = json['LineItemNo'];
|
||||
operationType = json['OperationType'];
|
||||
points = json['Points'];
|
||||
purchasePoints = json['PurchasePoints'];
|
||||
subTransactionType = json['SubTransactionType'];
|
||||
subTransactionTypeDescription = json['SubTransactionTypeDescription'];
|
||||
transactionDate = json['TransactionDate'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['AccNumber'] = this.accNumber;
|
||||
data['AccountStatus'] = this.accountStatus;
|
||||
data['Amount'] = this.amount;
|
||||
data['LineItemNo'] = this.lineItemNo;
|
||||
data['OperationType'] = this.operationType;
|
||||
data['Points'] = this.points;
|
||||
data['PurchasePoints'] = this.purchasePoints;
|
||||
data['SubTransactionType'] = this.subTransactionType;
|
||||
data['SubTransactionTypeDescription'] = this.subTransactionTypeDescription;
|
||||
data['TransactionDate'] = this.transactionDate;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
class ShippingOption {
|
||||
String shippingRateComputationMethodSystemName;
|
||||
double rate;
|
||||
double rateVat;
|
||||
double rateVatPercent;
|
||||
String name;
|
||||
String namen;
|
||||
String description;
|
||||
String descriptionn;
|
||||
bool allowShippingSunday;
|
||||
bool allowShippingMonday;
|
||||
bool allowShippingTuesday;
|
||||
bool allowShippingWednesday;
|
||||
bool allowShippingThursday;
|
||||
bool allowShippingFriday;
|
||||
bool allowShippingSaturday;
|
||||
String allowShippingTime1From;
|
||||
String allowShippingTime1To;
|
||||
String allowShippingTime2From;
|
||||
String allowShippingTime2To;
|
||||
String allowShippingNote;
|
||||
String allowShippingNoten;
|
||||
|
||||
ShippingOption(
|
||||
{this.shippingRateComputationMethodSystemName,
|
||||
this.rate,
|
||||
this.rateVat,
|
||||
this.rateVatPercent,
|
||||
this.name,
|
||||
this.namen,
|
||||
this.description,
|
||||
this.descriptionn,
|
||||
this.allowShippingSunday,
|
||||
this.allowShippingMonday,
|
||||
this.allowShippingTuesday,
|
||||
this.allowShippingWednesday,
|
||||
this.allowShippingThursday,
|
||||
this.allowShippingFriday,
|
||||
this.allowShippingSaturday,
|
||||
this.allowShippingTime1From,
|
||||
this.allowShippingTime1To,
|
||||
this.allowShippingTime2From,
|
||||
this.allowShippingTime2To,
|
||||
this.allowShippingNote,
|
||||
this.allowShippingNoten});
|
||||
|
||||
ShippingOption.fromJson(Map<String, dynamic> json) {
|
||||
shippingRateComputationMethodSystemName =
|
||||
json['shipping_rate_computation_method_system_name'];
|
||||
rate = json['rate'];
|
||||
rateVat = json['rate_vat'];
|
||||
rateVatPercent = json['rate_vat_percent'];
|
||||
name = json['name'];
|
||||
namen = json['namen'];
|
||||
description = json['description'];
|
||||
descriptionn = json['descriptionn'];
|
||||
allowShippingSunday = json['AllowShippingSunday'];
|
||||
allowShippingMonday = json['AllowShippingMonday'];
|
||||
allowShippingTuesday = json['AllowShippingTuesday'];
|
||||
allowShippingWednesday = json['AllowShippingWednesday'];
|
||||
allowShippingThursday = json['AllowShippingThursday'];
|
||||
allowShippingFriday = json['AllowShippingFriday'];
|
||||
allowShippingSaturday = json['AllowShippingSaturday'];
|
||||
allowShippingTime1From = json['AllowShippingTime1From'];
|
||||
allowShippingTime1To = json['AllowShippingTime1To'];
|
||||
allowShippingTime2From = json['AllowShippingTime2From'];
|
||||
allowShippingTime2To = json['AllowShippingTime2To'];
|
||||
allowShippingNote = json['AllowShippingNote'];
|
||||
allowShippingNoten = json['AllowShippingNoten'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['shipping_rate_computation_method_system_name'] =
|
||||
this.shippingRateComputationMethodSystemName;
|
||||
data['rate'] = this.rate;
|
||||
data['rate_vat'] = this.rateVat;
|
||||
data['rate_vat_percent'] = this.rateVatPercent;
|
||||
data['name'] = this.name;
|
||||
data['namen'] = this.namen;
|
||||
data['description'] = this.description;
|
||||
data['descriptionn'] = this.descriptionn;
|
||||
data['AllowShippingSunday'] = this.allowShippingSunday;
|
||||
data['AllowShippingMonday'] = this.allowShippingMonday;
|
||||
data['AllowShippingTuesday'] = this.allowShippingTuesday;
|
||||
data['AllowShippingWednesday'] = this.allowShippingWednesday;
|
||||
data['AllowShippingThursday'] = this.allowShippingThursday;
|
||||
data['AllowShippingFriday'] = this.allowShippingFriday;
|
||||
data['AllowShippingSaturday'] = this.allowShippingSaturday;
|
||||
data['AllowShippingTime1From'] = this.allowShippingTime1From;
|
||||
data['AllowShippingTime1To'] = this.allowShippingTime1To;
|
||||
data['AllowShippingTime2From'] = this.allowShippingTime2From;
|
||||
data['AllowShippingTime2To'] = this.allowShippingTime2To;
|
||||
data['AllowShippingNote'] = this.allowShippingNote;
|
||||
data['AllowShippingNoten'] = this.allowShippingNoten;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/Customer.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
||||
|
||||
class ShoppingCart {
|
||||
int languageId;
|
||||
String id;
|
||||
// List<Null> productAttributes;
|
||||
double customerEnteredPrice;
|
||||
int quantity;
|
||||
String discountAmountInclTax;
|
||||
String subtotal;
|
||||
String subtotalWithVat;
|
||||
String subtotalVatAmount;
|
||||
String subtotalVatRate;
|
||||
String currency;
|
||||
String currencyn;
|
||||
String rentalStartDateUtc;
|
||||
String rentalEndDateUtc;
|
||||
String createdOnUtc;
|
||||
String updatedOnUtc;
|
||||
String shoppingCartType;
|
||||
int productId;
|
||||
PharmacyProduct product;
|
||||
int customerId;
|
||||
Customer customer;
|
||||
|
||||
ShoppingCart(
|
||||
{this.languageId,
|
||||
this.id,
|
||||
// this.productAttributes,
|
||||
this.customerEnteredPrice,
|
||||
this.quantity,
|
||||
this.discountAmountInclTax,
|
||||
this.subtotal,
|
||||
this.subtotalWithVat,
|
||||
this.subtotalVatAmount,
|
||||
this.subtotalVatRate,
|
||||
this.currency,
|
||||
this.currencyn,
|
||||
this.rentalStartDateUtc,
|
||||
this.rentalEndDateUtc,
|
||||
this.createdOnUtc,
|
||||
this.updatedOnUtc,
|
||||
this.shoppingCartType,
|
||||
this.productId,
|
||||
this.product,
|
||||
this.customerId,
|
||||
this.customer});
|
||||
|
||||
ShoppingCart.fromJson(Map<String, dynamic> json) {
|
||||
languageId = json['language_id'];
|
||||
id = json['id'];
|
||||
/*if (json['product_attributes'] != null) {
|
||||
productAttributes = new List<Null>();
|
||||
json['product_attributes'].forEach((v) {
|
||||
productAttributes.add(new Null.fromJson(v));
|
||||
});
|
||||
}*/
|
||||
customerEnteredPrice = json['customer_entered_price'];
|
||||
quantity = json['quantity'];
|
||||
discountAmountInclTax = json['discount_amount_incl_tax'];
|
||||
subtotal = json['subtotal'];
|
||||
subtotalWithVat = json['subtotal_with_vat'];
|
||||
subtotalVatAmount = json['subtotal_vat_amount'];
|
||||
subtotalVatRate = json['subtotal_vat_rate'];
|
||||
currency = json['currency'];
|
||||
currencyn = json['currencyn'];
|
||||
rentalStartDateUtc = json['rental_start_date_utc'];
|
||||
rentalEndDateUtc = json['rental_end_date_utc'];
|
||||
createdOnUtc = json['created_on_utc'];
|
||||
updatedOnUtc = json['updated_on_utc'];
|
||||
shoppingCartType = json['shopping_cart_type'];
|
||||
productId = json['product_id'];
|
||||
product = json['product'] != null
|
||||
? new PharmacyProduct.fromJson(json['product'])
|
||||
: null;
|
||||
customerId = json['customer_id'];
|
||||
customer = json['customer'] != null
|
||||
? new Customer.fromJson(json['customer'])
|
||||
: null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['language_id'] = this.languageId;
|
||||
data['id'] = this.id;
|
||||
/*if (this.productAttributes != null) {
|
||||
data['product_attributes'] =
|
||||
this.productAttributes.map((v) => v.toJson()).toList();
|
||||
}*/
|
||||
data['customer_entered_price'] = this.customerEnteredPrice;
|
||||
data['quantity'] = this.quantity;
|
||||
data['discount_amount_incl_tax'] = this.discountAmountInclTax;
|
||||
data['subtotal'] = this.subtotal;
|
||||
data['subtotal_with_vat'] = this.subtotalWithVat;
|
||||
data['subtotal_vat_amount'] = this.subtotalVatAmount;
|
||||
data['subtotal_vat_rate'] = this.subtotalVatRate;
|
||||
data['currency'] = this.currency;
|
||||
data['currencyn'] = this.currencyn;
|
||||
data['rental_start_date_utc'] = this.rentalStartDateUtc;
|
||||
data['rental_end_date_utc'] = this.rentalEndDateUtc;
|
||||
data['created_on_utc'] = this.createdOnUtc;
|
||||
data['updated_on_utc'] = this.updatedOnUtc;
|
||||
data['shopping_cart_type'] = this.shoppingCartType;
|
||||
data['product_id'] = this.productId;
|
||||
if (this.product != null) {
|
||||
data['product'] = this.product.toJson();
|
||||
}
|
||||
data['customer_id'] = this.customerId;
|
||||
if (this.customer != null) {
|
||||
data['customer'] = this.customer.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ShoppingCartResponse with ChangeNotifier {
|
||||
int itemCount;
|
||||
int quantityCount;
|
||||
double subtotal;
|
||||
double subtotalWithVat;
|
||||
double subtotalVatAmount;
|
||||
double subtotalVatRate;
|
||||
List<ShoppingCart> shoppingCarts;
|
||||
|
||||
ShoppingCartResponse(
|
||||
{this.itemCount,
|
||||
this.quantityCount,
|
||||
this.subtotal,
|
||||
this.subtotalWithVat,
|
||||
this.subtotalVatAmount,
|
||||
this.subtotalVatRate,
|
||||
this.shoppingCarts});
|
||||
|
||||
void updateShoppingCard() {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
ShoppingCartResponse.fromJson(Map<String, dynamic> json) {
|
||||
itemCount = json['item_count'];
|
||||
quantityCount = json['quantity_count'];
|
||||
subtotal = json['subtotal'];
|
||||
subtotalWithVat = json['subtotal_with_vat'];
|
||||
subtotalVatAmount = json['subtotal_vat_amount'];
|
||||
subtotalVatRate = json['subtotal_vat_rate'];
|
||||
if (json['shopping_carts'] != null) {
|
||||
shoppingCarts = new List<ShoppingCart>();
|
||||
json['shopping_carts'].forEach((v) {
|
||||
shoppingCarts.add(new ShoppingCart.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['item_count'] = this.itemCount;
|
||||
data['quantity_count'] = this.quantityCount;
|
||||
data['subtotal'] = this.subtotal;
|
||||
data['subtotal_with_vat'] = this.subtotalWithVat;
|
||||
data['subtotal_vat_amount'] = this.subtotalVatAmount;
|
||||
data['subtotal_vat_rate'] = this.subtotalVatRate;
|
||||
if (this.shoppingCarts != null) {
|
||||
data['shopping_carts'] =
|
||||
this.shoppingCarts.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
class Specifications {
|
||||
int id;
|
||||
int displayOrder;
|
||||
String defaultValue;
|
||||
String defaultValuen;
|
||||
String name;
|
||||
String nameN;
|
||||
|
||||
Specifications(
|
||||
{this.id,
|
||||
this.displayOrder,
|
||||
this.defaultValue,
|
||||
this.defaultValuen,
|
||||
this.name,
|
||||
this.nameN});
|
||||
|
||||
Specifications.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
displayOrder = json['display_order'];
|
||||
defaultValue = json['default_value'];
|
||||
defaultValuen = json['default_valuen'];
|
||||
name = json['name'];
|
||||
nameN = json['nameN'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['display_order'] = this.displayOrder;
|
||||
data['default_value'] = this.defaultValue;
|
||||
data['default_valuen'] = this.defaultValuen;
|
||||
data['name'] = this.name;
|
||||
data['nameN'] = this.nameN;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'ShippingOption.dart';
|
||||
|
||||
class PaymentCheckoutData with ChangeNotifier{
|
||||
Addresses address;
|
||||
PaymentOption paymentOption;
|
||||
LacumAccountInformation lacumInformation;
|
||||
bool cartDataVisible;
|
||||
ShippingOption shippingOption;
|
||||
int usedLakumPoints;
|
||||
|
||||
PaymentCheckoutData({this.address, this.paymentOption, this.lacumInformation, this.cartDataVisible = false, this.shippingOption, this.usedLakumPoints = 0});
|
||||
|
||||
void updateData() {
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
import 'package:diplomaticquarterapp/config/config.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/ListUserAgreement.dart';
|
||||
|
||||
import 'lacum-service.dart';
|
||||
|
||||
class LacumRegistrationService extends LacumService{
|
||||
|
||||
ListUserAgreement listUserAgreement;
|
||||
|
||||
Future getLacumAccountInformationById(String patientIdentificationNo) async {
|
||||
hasError = false;
|
||||
super.error = "";
|
||||
|
||||
Map<String, dynamic> body = Map();
|
||||
body['IdentificationNo'] = patientIdentificationNo;
|
||||
|
||||
try {
|
||||
await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION,
|
||||
onSuccess: (response, statusCode) async {
|
||||
lacumInformation = LacumAccountInformation.fromJson(response);
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
Future getUserTermsAndConditionsForEPharmcy() async {
|
||||
hasError = false;
|
||||
super.error = "";
|
||||
|
||||
Map<String, dynamic> body = Map();
|
||||
|
||||
try {
|
||||
await baseAppClient.post(LAKUM_GET_USER_TERMS_AND_CONDITIONS,
|
||||
onSuccess: (response, statusCode) async {
|
||||
listUserAgreement = ListUserAgreement.fromJson(response['ListUserAgreement'][0]);
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
import 'package:diplomaticquarterapp/config/config.dart';
|
||||
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/base_service.dart';
|
||||
|
||||
class LacumService extends BaseService{
|
||||
bool isFinished = true;
|
||||
bool hasError = false;
|
||||
String errorMsg = '';
|
||||
String successMsg = '';
|
||||
|
||||
LacumAccountInformation lacumInformation;
|
||||
LacumAccountInformation lacumGroupInformation;
|
||||
|
||||
Future getLacumAccountInformation() async {
|
||||
hasError = false;
|
||||
super.error = "";
|
||||
|
||||
Map<String, dynamic> body = Map();
|
||||
body['IdentificationNo'] = user.patientIdentificationNo;
|
||||
|
||||
try {
|
||||
await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION,
|
||||
onSuccess: (response, statusCode) async {
|
||||
lacumInformation = LacumAccountInformation.fromJson(response);
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
Future getLacumGroupInformation() async {
|
||||
hasError = false;
|
||||
super.error = "";
|
||||
|
||||
Map<String, dynamic> body = Map();
|
||||
body['IdentificationNo'] = user.patientIdentificationNo;
|
||||
body['AccountNumber'] = "${lacumInformation.yahalaAccountNo}";
|
||||
|
||||
try {
|
||||
await baseAppClient.post(GET_LACUM_GROUP_INFORMATION,
|
||||
onSuccess: (response, statusCode) async {
|
||||
lacumGroupInformation = LacumAccountInformation.fromJson(response);
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
Future makeAccountActivate() async {
|
||||
hasError = false;
|
||||
super.error = "";
|
||||
int yahalaAccountNo = lacumInformation.yahalaAccountNo;
|
||||
|
||||
Map<String, dynamic> body = Map();
|
||||
body['CreatedBy'] = 103;
|
||||
body['YahalaAccountNumber'] = yahalaAccountNo;
|
||||
|
||||
try {
|
||||
await baseAppClient.post(LACUM_ACCOUNT_ACTIVATE,
|
||||
onSuccess: (response, statusCode) async {
|
||||
// lacumInformation = LacumAccountInformation.fromJson(response);
|
||||
// lacumInformation.yahalaAccountNo = yahalaAccountNo;
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
Future makeAccountDeactivate() async {
|
||||
hasError = false;
|
||||
super.error = "";
|
||||
int yahalaAccountNo = lacumInformation.yahalaAccountNo;
|
||||
|
||||
Map<String, dynamic> body = Map();
|
||||
body['CreatedBy'] = 103;
|
||||
body['YahalaAccountNumber'] = yahalaAccountNo;
|
||||
|
||||
try {
|
||||
await baseAppClient.post(LACUM_ACCOUNT_DEACTIVATE,
|
||||
onSuccess: (response, statusCode) async {
|
||||
// lacumInformation = LacumAccountInformation.fromJson(response);
|
||||
// lacumInformation.yahalaAccountNo = yahalaAccountNo;
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
Future createLakumAccount(String name, String phone, int accountID, String patientIdentificationID, var prefLang) async {
|
||||
hasError = false;
|
||||
super.error = "";
|
||||
if(prefLang == null){
|
||||
var languageID =
|
||||
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'en');
|
||||
prefLang = languageID == 'ar' ? 1 : 2;
|
||||
}
|
||||
|
||||
|
||||
Map<String, dynamic> body = Map();
|
||||
body['PrefLang'] = prefLang;
|
||||
body['AccountID'] = accountID;
|
||||
body['FullName'] = name;
|
||||
body['MobileNo'] = phone;
|
||||
body['PatientIdentificationID'] = patientIdentificationID;
|
||||
body['PatientID'] = user.patientID;
|
||||
|
||||
try {
|
||||
await baseAppClient.post(CREATE_LAKUM_ACCOUNT,
|
||||
onSuccess: (response, statusCode) async {
|
||||
successMsg = LacumAccountInformation.fromJson(response).message;
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
import 'package:diplomaticquarterapp/config/config.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart';
|
||||
|
||||
import 'lacum-service.dart';
|
||||
|
||||
class LacumTransferService extends LacumService{
|
||||
LacumAccountInformation lacumReceiverInformation;
|
||||
|
||||
Future getLacumGroupDataBuAccountId(String accountId) async {
|
||||
hasError = false;
|
||||
super.error = "";
|
||||
|
||||
Map<String, dynamic> body = Map();
|
||||
body['IdentificationNo'] = user.patientIdentificationNo;
|
||||
body['AccountNumber'] = accountId;
|
||||
|
||||
try {
|
||||
await baseAppClient.post(GET_LACUM_GROUP_INFORMATION,
|
||||
onSuccess: (response, statusCode) async {
|
||||
lacumReceiverInformation = LacumAccountInformation.fromJson(response);
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
return null;
|
||||
}, body: body);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
Future transferYaHalaLoyaltyPoints(String points) async {
|
||||
hasError = false;
|
||||
super.error = "";
|
||||
|
||||
Map<String, dynamic> body = Map();
|
||||
body['MobileNo'] = lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber;
|
||||
body['UserName'] = lacumGroupInformation.lakumInquiryInformationObjVersion.memberName;
|
||||
body['YaHalaSenderAccNumber'] = lacumGroupInformation.lakumInquiryInformationObjVersion.accountNumber;
|
||||
body['Yahala_IdentificationNo'] = lacumGroupInformation.lakumInquiryInformationObjVersion.memberUniversalId;
|
||||
body['YaHalaPointsToTransfer'] = points;
|
||||
body['YaHalaReceiverAccNumber'] = lacumReceiverInformation.lakumInquiryInformationObjVersion.accountNumber;
|
||||
body['YaHalaReceiverMobileNumber'] = lacumReceiverInformation.lakumInquiryInformationObjVersion.mobileNumber;
|
||||
body['YaHalaReceiverName'] = lacumReceiverInformation.lakumInquiryInformationObjVersion.memberName;
|
||||
|
||||
try {
|
||||
await baseAppClient.post(TRANSFER_YAHALA_LOYALITY_POINTS,
|
||||
onSuccess: (response, statusCode) async {
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,29 +1,248 @@
|
||||
import 'package:diplomaticquarterapp/config/config.dart';
|
||||
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/base_service.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
|
||||
|
||||
class OrderPreviewService extends BaseService{
|
||||
class OrderPreviewService extends BaseService {
|
||||
bool isFinished = true;
|
||||
bool hasError = false;
|
||||
String errorMsg = '';
|
||||
|
||||
List<Addresses> addresses = List();
|
||||
LacumAccountInformation lacumInformation;
|
||||
LacumAccountInformation lacumGroupInformation;
|
||||
|
||||
Future getBannerListList() async {
|
||||
Future getAddresses() async {
|
||||
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
|
||||
Map<String, String> queryParams = {'fields': 'addresses'};
|
||||
hasError = false;
|
||||
try {
|
||||
await baseAppClient.get(GET_CUSTOMERS_ADDRESSES,
|
||||
await baseAppClient.get("$GET_CUSTOMERS_ADDRESSES$customerId",
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
addresses.clear();
|
||||
response['customers'][0]['addresses'].forEach((item) {
|
||||
addresses.add(Addresses.fromJson(item));
|
||||
});
|
||||
addresses.clear();
|
||||
response['customers'][0]['addresses'].forEach((item) {
|
||||
addresses.add(Addresses.fromJson(item));
|
||||
});
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, queryParams: queryParams);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
Future<Map> getShippingOption(Addresses selectedAddress) async {
|
||||
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
|
||||
Map<String, String> queryParams = Map();
|
||||
dynamic localRes;
|
||||
hasError = false;
|
||||
try {
|
||||
await baseAppClient.get("$GET_SHIPPING_OPTIONS$customerId/${selectedAddress.id}",
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
localRes = response['shipping_option'][0];
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
});
|
||||
}, queryParams: queryParams);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
return Future.value(localRes);
|
||||
}
|
||||
|
||||
Future<Map> getShoppingCart() async {
|
||||
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
|
||||
Map<String, String> queryParams = {'shopping_cart_type': '1'};
|
||||
dynamic localRes;
|
||||
hasError = false;
|
||||
try {
|
||||
await baseAppClient.get("$GET_SHOPPING_CART$customerId",
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
localRes = response;
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, queryParams: queryParams);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
return Future.value(localRes);
|
||||
}
|
||||
|
||||
Future<Map> changeProductQuantity(
|
||||
String productId, ShoppingCart product) async {
|
||||
hasError = false;
|
||||
super.error = "";
|
||||
dynamic localRes;
|
||||
Map<String, dynamic> choppingCartObject = Map();
|
||||
choppingCartObject['id'] = product.id;
|
||||
choppingCartObject['quantity'] = product.quantity;
|
||||
choppingCartObject['shopping_cart_type'] = "1";
|
||||
choppingCartObject['product_id'] = product.productId;
|
||||
choppingCartObject['customer_id'] = product.customerId;
|
||||
|
||||
Map<String, dynamic> body = Map();
|
||||
body["shopping_cart_item"] = choppingCartObject;
|
||||
|
||||
await baseAppClient.post("$GET_SHOPPING_CART$productId",
|
||||
onSuccess: (response, statusCode) async {
|
||||
localRes = response;
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
|
||||
return Future.value(localRes);
|
||||
}
|
||||
|
||||
Future<Map> deleteProduct(String productId) async {
|
||||
hasError = false;
|
||||
super.error = "";
|
||||
dynamic localRes;
|
||||
|
||||
Map<String, dynamic> body = Map();
|
||||
|
||||
await baseAppClient.post("$DELETE_SHOPPING_CART$productId",
|
||||
onSuccess: (response, statusCode) async {
|
||||
localRes = response;
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
|
||||
return Future.value(localRes);
|
||||
}
|
||||
|
||||
Future<Map> deleteShoppingCart() async {
|
||||
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
|
||||
|
||||
hasError = false;
|
||||
super.error = "";
|
||||
dynamic localRes;
|
||||
|
||||
await baseAppClient.get("$DELETE_SHOPPING_CART_ALL$customerId/ShoppingCart",
|
||||
onSuccess: (response, statusCode) async {
|
||||
localRes = response;
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
});
|
||||
|
||||
return Future.value(localRes);
|
||||
}
|
||||
|
||||
Future getLacumAccountInformation() async {
|
||||
hasError = false;
|
||||
super.error = "";
|
||||
|
||||
Map<String, dynamic> body = Map();
|
||||
body['IdentificationNo'] = user.patientIdentificationNo;
|
||||
|
||||
try {
|
||||
await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION,
|
||||
onSuccess: (response, statusCode) async {
|
||||
lacumInformation = LacumAccountInformation.fromJson(response);
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
Future getLacumGroupInformation() async {
|
||||
hasError = false;
|
||||
super.error = "";
|
||||
|
||||
Map<String, dynamic> body = Map();
|
||||
body['IdentificationNo'] = user.patientIdentificationNo;
|
||||
body['AccountNumber'] = "${lacumInformation.yahalaAccountNo}";
|
||||
|
||||
try {
|
||||
await baseAppClient.post(GET_LACUM_GROUP_INFORMATION,
|
||||
onSuccess: (response, statusCode) async {
|
||||
lacumGroupInformation = LacumAccountInformation.fromJson(response);
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
Future makeOrder(PaymentCheckoutData paymentCheckoutData, List<ShoppingCart> shoppingCarts) async {
|
||||
paymentCheckoutData.address.isChecked = true;
|
||||
hasError = false;
|
||||
super.error = "";
|
||||
|
||||
var languageID =
|
||||
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'en');
|
||||
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
|
||||
|
||||
Map<String, dynamic> orderBody = Map();
|
||||
orderBody['rx_attachments'] = "";
|
||||
orderBody['customer_language_id'] = languageID == 'ar' ? 1 : 2;
|
||||
orderBody['billing_address'] = paymentCheckoutData.address;
|
||||
orderBody['pick_up_in_store'] = false;
|
||||
orderBody['payment_method_system_name'] = "Payments.PayFort";
|
||||
orderBody['shipping_method'] = languageID == 'ar' ? paymentCheckoutData.shippingOption.namen : paymentCheckoutData.shippingOption.name ;
|
||||
orderBody['shipping_rate_computation_method_system_name'] = paymentCheckoutData.shippingOption.shippingRateComputationMethodSystemName;
|
||||
orderBody['customer_id'] = customerId;
|
||||
orderBody['custom_values_xml'] = "PaymentOption:${getPaymentOptionName(paymentCheckoutData.paymentOption)}";
|
||||
orderBody['shippingOption'] = paymentCheckoutData.shippingOption;
|
||||
orderBody['shipping_address'] = paymentCheckoutData.address;
|
||||
orderBody['lakum_amount'] = paymentCheckoutData.usedLakumPoints;
|
||||
|
||||
List<Map<String, dynamic>> itemsList = List();
|
||||
shoppingCarts.forEach((item) {
|
||||
Map<String, dynamic> orderItemsBody = Map();
|
||||
orderItemsBody['product_id'] = item.product.id;
|
||||
orderItemsBody['quantity'] = item.quantity;
|
||||
itemsList.add(orderItemsBody);
|
||||
});
|
||||
orderBody['order_items'] = itemsList;
|
||||
|
||||
Map<String, dynamic> body = Map();
|
||||
body['order'] = orderBody;
|
||||
|
||||
try {
|
||||
await baseAppClient.post(ORDER_SHOPPING_CART,
|
||||
onSuccess: (response, statusCode) async {
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
String getPaymentOptionName(PaymentOption paymentOption) {
|
||||
switch (paymentOption.index) {
|
||||
case 0:
|
||||
return "MADA";
|
||||
break;
|
||||
case 1:
|
||||
return "SADAD";
|
||||
break;
|
||||
case 2:
|
||||
return "VISA";
|
||||
break;
|
||||
case 3:
|
||||
return "MASTERCARD";
|
||||
break;
|
||||
case 4:
|
||||
return "INSTALLMENT";
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,58 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/ListUserAgreement.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/parmacyModule/lacum-registration-service.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/parmacyModule/lacum-transfer-service.dart';
|
||||
|
||||
import '../../../locator.dart';
|
||||
import 'lacum-viewmodel.dart';
|
||||
|
||||
class LacumRegistrationViewModel extends LacumViewModel {
|
||||
LacumRegistrationService _lacumService = locator<LacumRegistrationService>();
|
||||
|
||||
ListUserAgreement get listUserAgreement => _lacumService.listUserAgreement;
|
||||
|
||||
Future<int> checkLacumAccountActivation(String patientIdentificationNo) async {
|
||||
setState(ViewState.Busy);
|
||||
await _lacumService.getLacumAccountInformationById(patientIdentificationNo);
|
||||
if (_lacumService.hasError) {
|
||||
error = _lacumService.error;
|
||||
setState(ViewState.Error);
|
||||
return 404;
|
||||
} else {
|
||||
if(_lacumService.lacumInformation.yahalaAccountNo != 0){
|
||||
error = "The account has already been activated";
|
||||
setState(ViewState.Error);
|
||||
return 404;
|
||||
} else {
|
||||
setState(ViewState.Idle);
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future getUserTermsAndConditionsForEPharmcy() async {
|
||||
setState(ViewState.Busy);
|
||||
await _lacumService.getUserTermsAndConditionsForEPharmcy();
|
||||
if (_lacumService.hasError) {
|
||||
error = _lacumService.error;
|
||||
setState(ViewState.Error);
|
||||
} else {
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
|
||||
Future<int> createNewLakumAccount(String name, String phone, String identificationNo, int languageId) async {
|
||||
setState(ViewState.Busy);
|
||||
await _lacumService.createLakumAccount(name, phone, 0, identificationNo, languageId);
|
||||
if (_lacumService.hasError) {
|
||||
error = _lacumService.error;
|
||||
setState(ViewState.Error);
|
||||
return 404;
|
||||
} else {
|
||||
setState(ViewState.Idle);
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/parmacyModule/lacum-transfer-service.dart';
|
||||
|
||||
import '../../../locator.dart';
|
||||
import 'lacum-viewmodel.dart';
|
||||
|
||||
class LacumTranferViewModel extends LacumViewModel {
|
||||
LacumTransferService _lacumService = locator<LacumTransferService>();
|
||||
|
||||
LacumAccountInformation get lacumReceiverInformation =>
|
||||
_lacumService.lacumReceiverInformation;
|
||||
|
||||
Future getLacumGroupDataBuAccountId(String accountId) async {
|
||||
setState(ViewState.Busy);
|
||||
await _lacumService.getLacumGroupDataBuAccountId(accountId);
|
||||
if (_lacumService.hasError) {
|
||||
error = _lacumService.error;
|
||||
setState(ViewState.Error);
|
||||
} else {
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
|
||||
Future<int> transferYaHalaLoyaltyPoints(String points) async {
|
||||
setState(ViewState.Busy);
|
||||
await _lacumService.transferYaHalaLoyaltyPoints(points);
|
||||
if (_lacumService.hasError) {
|
||||
error = _lacumService.error;
|
||||
setState(ViewState.Error);
|
||||
return 404;
|
||||
} else {
|
||||
setState(ViewState.Idle);
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
|
||||
setLakumData(LacumAccountInformation lacumInformation, LacumAccountInformation lacumGroupInformation){
|
||||
_lacumService.lacumInformation = lacumInformation;
|
||||
_lacumService.lacumGroupInformation = lacumGroupInformation;
|
||||
}
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/parmacyModule/lacum-service.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||
import 'dart:async';
|
||||
import 'dart:convert' as convert;
|
||||
|
||||
import '../../../locator.dart';
|
||||
import '../base_view_model.dart';
|
||||
|
||||
class LacumViewModel extends BaseViewModel {
|
||||
LacumService _lacumService = locator<LacumService>();
|
||||
|
||||
LacumAccountInformation get lacumInformation =>
|
||||
_lacumService.lacumInformation;
|
||||
|
||||
LacumAccountInformation get lacumGroupInformation =>
|
||||
_lacumService.lacumGroupInformation;
|
||||
|
||||
Future getLacumData() async {
|
||||
await getLacumAccountData();
|
||||
getLacumGroupData();
|
||||
}
|
||||
|
||||
Future getLacumAccountData() async {
|
||||
setState(ViewState.Busy);
|
||||
await _lacumService.getLacumAccountInformation();
|
||||
if (_lacumService.hasError) {
|
||||
error = _lacumService.error;
|
||||
setState(ViewState.Error);
|
||||
} else {
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
|
||||
Future getLacumGroupData() async {
|
||||
setState(ViewState.Busy);
|
||||
await _lacumService.getLacumGroupInformation();
|
||||
if (_lacumService.hasError) {
|
||||
error = _lacumService.error;
|
||||
setState(ViewState.Error);
|
||||
} else {
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
|
||||
Future makeAccountActivate() async {
|
||||
setState(ViewState.Busy);
|
||||
await _lacumService.makeAccountActivate();
|
||||
if (_lacumService.hasError) {
|
||||
error = _lacumService.error;
|
||||
setState(ViewState.Error);
|
||||
} else {
|
||||
lacumGroupInformation.lakumInquiryInformationObjVersion.accountStatus = "Active";
|
||||
getLacumAccountData();
|
||||
}
|
||||
}
|
||||
|
||||
Future makeAccountDeactivate() async {
|
||||
setState(ViewState.Busy);
|
||||
await _lacumService.makeAccountDeactivate();
|
||||
if (_lacumService.hasError) {
|
||||
error = _lacumService.error;
|
||||
setState(ViewState.Error);
|
||||
} else {
|
||||
lacumGroupInformation.lakumInquiryInformationObjVersion.accountStatus = "Cancelled";
|
||||
getLacumAccountData();
|
||||
}
|
||||
}
|
||||
|
||||
Future<int> createLakumAccount(String name, String phone) async {
|
||||
setState(ViewState.Busy);
|
||||
await _lacumService.createLakumAccount(name, phone, lacumInformation.yahalaAccountNo, lacumInformation.identificationNo, null);
|
||||
if (_lacumService.hasError) {
|
||||
error = _lacumService.error;
|
||||
setState(ViewState.Error);
|
||||
return 404;
|
||||
} else {
|
||||
setState(ViewState.Idle);
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
|
||||
String formatCreatedDateToString() {
|
||||
DateTime createdDate = DateUtil.convertStringToDate(
|
||||
lacumGroupInformation.lakumInquiryInformationObjVersion.createdDate);
|
||||
return DateUtil.getFormattedDate(createdDate, "MMM dd,yyyy");
|
||||
}
|
||||
|
||||
Uint8List convertBase64ToBarCodeImage() {
|
||||
try {
|
||||
final _byteImage = convert.base64Decode(
|
||||
lacumGroupInformation.lakumInquiryInformationObjVersion.barCode);
|
||||
return _byteImage;
|
||||
} catch (e) {
|
||||
print(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
setLakumData(LacumAccountInformation lacumInformation, LacumAccountInformation lacumGroupInformation){
|
||||
_lacumService.lacumInformation = lacumInformation;
|
||||
_lacumService.lacumGroupInformation = lacumGroupInformation;
|
||||
}
|
||||
|
||||
clearLakumGroupData(){
|
||||
_lacumService.lacumGroupInformation = null;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class IdNamePair with ChangeNotifier{
|
||||
var id;
|
||||
var name;
|
||||
|
||||
IdNamePair(this.id, this.name);
|
||||
|
||||
void updateData() {
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AddressSelectPageTest extends StatelessWidget {
|
||||
final List<Addresses> addresses;
|
||||
|
||||
AddressSelectPageTest(this.addresses);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
title: "test",
|
||||
isShowAppBar: true,
|
||||
isShowDecPage: false,
|
||||
body: Column(
|
||||
children: [
|
||||
Container(
|
||||
child: RaisedButton(
|
||||
onPressed: () => {Navigator.pop(context, addresses[0])},
|
||||
child: new Text(
|
||||
"Set address",
|
||||
style: new TextStyle(color: Colors.white, fontSize: 14),
|
||||
),
|
||||
color: Colors.blueAccent,
|
||||
disabledColor: Colors.blueAccent,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,354 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-preview.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class CartOrderPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
PreferredSizeWidget appBarWidget =
|
||||
AppBarWidget("Shopping Cart", null, true);
|
||||
final height = mediaQuery.size.height -
|
||||
appBarWidget.preferredSize.height -
|
||||
mediaQuery.padding.top;
|
||||
|
||||
return BaseView<OrderPreviewViewModel>(
|
||||
onModelReady: (model) => model.getOrderPreviewData(),
|
||||
builder: (_, model, wi) => ChangeNotifierProvider.value(
|
||||
value: model.cartResponse,
|
||||
child: AppScaffold(
|
||||
title: "Shopping Cart",
|
||||
isShowAppBar: true,
|
||||
isShowDecPage: false,
|
||||
baseViewModel: model,
|
||||
appBarWidget: appBarWidget,
|
||||
backgroundColor: Colors.white,
|
||||
body: !(model.cartResponse.shoppingCarts == null ||
|
||||
model.cartResponse.shoppingCarts.length == 0)
|
||||
? Container(
|
||||
height: height * 0.85,
|
||||
width: double.infinity,
|
||||
child: Consumer<ShoppingCartResponse>(
|
||||
builder: (ctx, cart, _) => Container(
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
GestureIconButton(
|
||||
TranslationBase.of(context).deleteAllItems,
|
||||
Icon(
|
||||
Icons.delete_outline_sharp,
|
||||
color: Colors.grey.shade700,
|
||||
),
|
||||
onTap: () => {model.deleteShoppingCart()},
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Container(
|
||||
child: Column(
|
||||
children: [
|
||||
...List.generate(
|
||||
cart.shoppingCarts != null
|
||||
? cart.shoppingCarts.length
|
||||
: 0,
|
||||
(index) => ProductOrderItem(
|
||||
cart.shoppingCarts[index], () {
|
||||
print(cart.shoppingCarts[index]
|
||||
.quantity);
|
||||
model.changeProductQuantity(
|
||||
cart.shoppingCarts[index]);
|
||||
},
|
||||
() => model.deleteProduct(
|
||||
cart.shoppingCarts[index])))
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 2,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
"Subtotal",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
Texts(
|
||||
"SAR ${(cart.subtotal).toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
"VAT (15%)",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
Texts(
|
||||
"SAR ${(cart.subtotalVatAmount).toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).total,
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Texts(
|
||||
"SAR ${(cart.subtotal).toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/payment_image.png",
|
||||
width: mediaQuery.size.width - 20,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
bottomSheet: Container(
|
||||
height: height * 0.15,
|
||||
color: Colors.white,
|
||||
child: OrderBottomWidget(model.addresses, height),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class OrderBottomWidget extends StatefulWidget {
|
||||
final List<Addresses> addresses;
|
||||
final double height;
|
||||
|
||||
OrderBottomWidget(this.addresses, this.height);
|
||||
|
||||
@override
|
||||
_OrderBottomWidgetState createState() => _OrderBottomWidgetState();
|
||||
}
|
||||
|
||||
class _OrderBottomWidgetState extends State<OrderBottomWidget> {
|
||||
bool isAgree = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
|
||||
child: Consumer<ShoppingCartResponse>(
|
||||
builder: (ctx, cart, _) => !(cart.shoppingCarts == null ||
|
||||
cart.shoppingCarts.length == 0)
|
||||
? Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 1,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Container(
|
||||
height: widget.height * 0.070,
|
||||
color: Color(0xffe6ffe0),
|
||||
padding: EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
isAgree = !isAgree;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
width: 25.0,
|
||||
height: widget.height * 0.070,
|
||||
decoration: new BoxDecoration(
|
||||
color: !isAgree ? Color(0xffeeeeee) : Colors.green,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: !isAgree
|
||||
? null
|
||||
: Padding(
|
||||
padding: const EdgeInsets.all(0.0),
|
||||
child: Icon(
|
||||
Icons.check,
|
||||
color: Colors.white,
|
||||
size: 25,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 4),
|
||||
margin: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: Texts(
|
||||
"I agree with the terms of service and I adhere to them unconditionally",
|
||||
fontSize: 13,
|
||||
color: Colors.grey.shade800,
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: Icon(
|
||||
Icons.info,
|
||||
size: 25,
|
||||
color: Color(0xff005aff),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: widget.height * 0.065,
|
||||
margin: EdgeInsets.symmetric(vertical: 2),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 0, vertical: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
Texts(
|
||||
"SAR ${(cart.subtotal).toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 4),
|
||||
child: Texts(
|
||||
"(inclusive VAT)",
|
||||
fontSize: 8,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Texts(
|
||||
"${cart.quantityCount} item(s)",
|
||||
fontSize: 10,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
],
|
||||
),
|
||||
RaisedButton(
|
||||
onPressed: isAgree
|
||||
? () => {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: OrderPreviewPage(
|
||||
widget.addresses)))
|
||||
}
|
||||
: null,
|
||||
child: new Text(
|
||||
"CHECK OUT",
|
||||
style: new TextStyle(
|
||||
color: isAgree
|
||||
? Colors.white
|
||||
: Colors.grey.shade300,
|
||||
fontSize: 14),
|
||||
),
|
||||
color: Color(0xff005aff),
|
||||
disabledColor: Color(0xff005aff),
|
||||
),
|
||||
/* SecondaryButton(
|
||||
label: "CHECK OUT",
|
||||
color: Colors.blueAccent,
|
||||
textColor: Colors.white,
|
||||
onTap: (() {
|
||||
Navigator.push(
|
||||
context, FadePage(page: OrderPreviewPage(widget.addresses)));
|
||||
}),
|
||||
disabled: isAgree ? false : true,
|
||||
)*/
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
));
|
||||
}
|
||||
}
|
@ -0,0 +1,815 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/address-select-page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
|
||||
class OrderPreviewPage extends StatelessWidget {
|
||||
final List<Addresses> addresses;
|
||||
|
||||
OrderPreviewPage(this.addresses);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
PreferredSizeWidget appBarWidget = AppBarWidget("Check out", null, true);
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
final height = mediaQuery.size.height -
|
||||
appBarWidget.preferredSize.height -
|
||||
mediaQuery.padding.top;
|
||||
|
||||
return BaseView<OrderPreviewViewModel>(
|
||||
onModelReady: (model) => model.getShoppingCart(),
|
||||
builder: (_, model, wi) => ChangeNotifierProvider.value(
|
||||
value: model.paymentCheckoutData,
|
||||
child: AppScaffold(
|
||||
title: "Check out",
|
||||
isShowAppBar: true,
|
||||
isShowDecPage: false,
|
||||
appBarWidget: appBarWidget,
|
||||
backgroundColor: Colors.white,
|
||||
baseViewModel: model,
|
||||
body: Container(
|
||||
height: height * 0.90,
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
color: Color(0xFFF1F1F1),
|
||||
child: Column(
|
||||
children: [
|
||||
SelectAddressWidget(model, addresses),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
SelectPaymentOptionWidget(model),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Consumer<PaymentCheckoutData>(
|
||||
builder: (ctx, paymentData, _) =>
|
||||
paymentData.lacumInformation != null
|
||||
? Container(
|
||||
child: Column(
|
||||
children: [
|
||||
LakumWidget(model),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container()),
|
||||
Container(
|
||||
color: Colors.white,
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).reviewOrder,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
...List.generate(
|
||||
model.cartResponse.shoppingCarts != null
|
||||
? model.cartResponse.shoppingCarts.length
|
||||
: 0,
|
||||
(index) => ProductOrderPreviewItem(
|
||||
model.cartResponse.shoppingCarts[index]),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(8),
|
||||
child: model.cartResponse.subtotal != null
|
||||
? Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context)
|
||||
.orderSummary,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
"Subtotal",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
Texts(
|
||||
"SAR ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
"Shipping",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
Texts(
|
||||
"SAR ${(model.totalAdditionalShippingCharge).toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
"VAT (15%)",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
Texts(
|
||||
"SAR ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).total,
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Texts(
|
||||
"SAR ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomSheet: Container(
|
||||
height: height * 0.10,
|
||||
color: Colors.white,
|
||||
child: PaymentBottomWidget(model),
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
class SelectAddressWidget extends StatefulWidget {
|
||||
final OrderPreviewViewModel model;
|
||||
final List<Addresses> addresses;
|
||||
|
||||
SelectAddressWidget(this.model, this.addresses);
|
||||
|
||||
@override
|
||||
_SelectAddressWidgetState createState() => _SelectAddressWidgetState();
|
||||
}
|
||||
|
||||
class _SelectAddressWidgetState extends State<SelectAddressWidget> {
|
||||
Addresses address;
|
||||
|
||||
_navigateToAddressPage() {
|
||||
Navigator.push(
|
||||
context, FadePage(page: AddressSelectPageTest(widget.addresses)))
|
||||
.then((result) {
|
||||
address = result;
|
||||
widget.model.paymentCheckoutData.address = address;
|
||||
widget.model.getInformationsByAddress();
|
||||
/* setState(() {
|
||||
if (result != null) {
|
||||
address = result;
|
||||
widget.model.paymentCheckoutData.address = address;
|
||||
widget.model.getInformationsByAddress();
|
||||
}
|
||||
})*/
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.model.paymentCheckoutData.address != null) {
|
||||
address = widget.model.paymentCheckoutData.address;
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<PaymentCheckoutData>(
|
||||
builder: (ctx, paymentData, _) => Container(
|
||||
color: Colors.white,
|
||||
child: address == null
|
||||
? InkWell(
|
||||
onTap: () => {_navigateToAddressPage()},
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/ic_shipping_address.png",
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
|
||||
child: Texts(
|
||||
TranslationBase.of(context).selectAddress,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xff0000ff),
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 20,
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/ic_shipping_mark.png",
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 0, horizontal: 6),
|
||||
child: Texts(
|
||||
TranslationBase.of(context).shippingAddress,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => {_navigateToAddressPage()},
|
||||
child: Texts(
|
||||
TranslationBase.of(context).changeAddress,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Color(0xff0000ff),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Texts(
|
||||
"${address.firstName} ${address.lastName}",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Texts(
|
||||
"${address.address1} ${address.address2} ${address.address2},, ${address.city}, ${address.country} ${address.zipPostalCode}",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.grey.shade500,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.only(right: 8),
|
||||
child: Icon(
|
||||
Icons.phone,
|
||||
size: 20,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
Texts(
|
||||
"${address.phoneNumber}",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.grey,
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 8),
|
||||
child: SizedBox(
|
||||
height: 2,
|
||||
width: double.infinity,
|
||||
child: Container(
|
||||
color: Color(0xffefefef),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/ic_shipping_truck.png",
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 0, horizontal: 6),
|
||||
child: Texts(
|
||||
"SHIP BY:",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: Image.asset(
|
||||
paymentData.shippingOption
|
||||
.shippingRateComputationMethodSystemName ==
|
||||
"Shipping.FixedOrByWeight"
|
||||
? "assets/images/pharmacy_module/payment/hmg_shipping_logo.png"
|
||||
: "assets/images/pharmacy_module/payment/aramex_shipping_logo.png",
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
margin: EdgeInsets.symmetric(horizontal: 8),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
), // ic_shipping_mark.png
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SelectPaymentOptionWidget extends StatefulWidget {
|
||||
final OrderPreviewViewModel model;
|
||||
|
||||
SelectPaymentOptionWidget(this.model);
|
||||
|
||||
@override
|
||||
_SelectPaymentOptionWidgetState createState() =>
|
||||
_SelectPaymentOptionWidgetState();
|
||||
}
|
||||
|
||||
class _SelectPaymentOptionWidgetState extends State<SelectPaymentOptionWidget> {
|
||||
PaymentOption paymentOption;
|
||||
|
||||
_navigateToPaymentOption() {
|
||||
Navigator.push(context, FadePage(page: PaymentMethodSelectPage()))
|
||||
.then((result) => {
|
||||
setState(() {
|
||||
if (result != null) {
|
||||
paymentOption = result;
|
||||
widget.model.paymentCheckoutData.paymentOption =
|
||||
paymentOption;
|
||||
widget.model.paymentCheckoutData.updateData();
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.model.paymentCheckoutData.paymentOption != null) {
|
||||
paymentOption = widget.model.paymentCheckoutData.paymentOption;
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
child: paymentOption == null
|
||||
? InkWell(
|
||||
onTap: () => {_navigateToPaymentOption()},
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/ic_payment_option.png",
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
|
||||
child: Texts(
|
||||
TranslationBase.of(context).selectPaymentOption,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xff0000ff),
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 20,
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/ic_payment_option.png",
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 8),
|
||||
padding: EdgeInsets.symmetric(horizontal: 4, vertical: 0),
|
||||
decoration: new BoxDecoration(
|
||||
color: Colors.grey.shade100,
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Image.asset(
|
||||
widget.model.getPaymentOptionImage(paymentOption),
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6),
|
||||
child: Texts(
|
||||
widget.model.getPaymentOptionName(paymentOption),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => {_navigateToPaymentOption()},
|
||||
child: Texts(
|
||||
TranslationBase.of(context).changeMethod,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Color(0xff0000ff),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class LakumWidget extends StatefulWidget {
|
||||
final OrderPreviewViewModel model;
|
||||
|
||||
LakumWidget(this.model);
|
||||
|
||||
@override
|
||||
_LakumWidgetState createState() => _LakumWidgetState();
|
||||
}
|
||||
|
||||
class _LakumWidgetState extends State<LakumWidget> {
|
||||
TextEditingController _pointsController = new TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/lakum/lakum_checkout.png",
|
||||
width: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(color: Color(0x99ffffff)),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
"Lakum Points",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Texts(
|
||||
"${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount}",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(color: Color(0x99ffffff)),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Texts(
|
||||
"Riyal",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 4),
|
||||
width: 60,
|
||||
height: 40,
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.black, width: 0.2),
|
||||
gapPadding: 0,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(8),
|
||||
bottomLeft: Radius.circular(8)),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.black, width: 0.4),
|
||||
gapPadding: 0,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(8),
|
||||
bottomLeft: Radius.circular(8)),
|
||||
),
|
||||
),
|
||||
controller: _pointsController,
|
||||
keyboardType: TextInputType.number,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: widget
|
||||
.model
|
||||
.paymentCheckoutData
|
||||
.lacumInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.pointsBalanceAmount >
|
||||
0
|
||||
? Colors.black
|
||||
: Colors.grey,
|
||||
),
|
||||
enabled: widget
|
||||
.model
|
||||
.paymentCheckoutData
|
||||
.lacumInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.pointsBalanceAmount ==
|
||||
0
|
||||
? false
|
||||
: true,
|
||||
onChanged: (val) {
|
||||
var value = int.tryParse(val);
|
||||
if (value != null &&
|
||||
value <=
|
||||
widget
|
||||
.model
|
||||
.paymentCheckoutData
|
||||
.lacumInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.pointsBalanceAmount) {
|
||||
widget.model.paymentCheckoutData.usedLakumPoints =
|
||||
value;
|
||||
} else {
|
||||
widget.model.paymentCheckoutData.usedLakumPoints = 0;
|
||||
}
|
||||
_pointsController.text =
|
||||
"${widget.model.paymentCheckoutData.usedLakumPoints}";
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 40,
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
|
||||
decoration: new BoxDecoration(
|
||||
color: Color(0xff3666E0),
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.only(
|
||||
topRight: Radius.circular(6),
|
||||
bottomRight: Radius.circular(6)),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: Color(0xff3666E0),
|
||||
width: 0.8,
|
||||
)),
|
||||
),
|
||||
child: Texts(
|
||||
"USE",
|
||||
fontSize: 12,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class PaymentBottomWidget extends StatelessWidget {
|
||||
final OrderPreviewViewModel model;
|
||||
|
||||
PaymentBottomWidget(this.model);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final scaffold = Scaffold.of(context);
|
||||
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
|
||||
child: Consumer<PaymentCheckoutData>(
|
||||
builder: (ctx, paymentData, _) => paymentData.cartDataVisible
|
||||
? Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 0, vertical: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
Texts(
|
||||
"SAR ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xff929295),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Texts(
|
||||
"(inclusive VAT)",
|
||||
fontSize: 8,
|
||||
color: Color(0xff929295),
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Texts(
|
||||
"${model.cartResponse.quantityCount} item(s)",
|
||||
fontSize: 10,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
child: RaisedButton(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(
|
||||
color: Color(0xff929295),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
onPressed: (paymentData.address != null &&
|
||||
paymentData.paymentOption != null)
|
||||
? () => {
|
||||
model.makeOrder().then((_) {
|
||||
if (model.state != ViewState.Idle) {
|
||||
SnackBar snackBar = SnackBar(
|
||||
content: Text(
|
||||
'Order has been placed successfully!!'));
|
||||
scaffold.showSnackBar(snackBar);
|
||||
}
|
||||
|
||||
// Navigator.pushAndRemoveUntil(
|
||||
// context,
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// PharmacyPage()),
|
||||
// (Route<dynamic> r) => false);
|
||||
})
|
||||
}
|
||||
: null,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
child: new Text(
|
||||
"PROCEED TO PAY",
|
||||
style: new TextStyle(
|
||||
color: (paymentData.address != null &&
|
||||
paymentData.paymentOption != null)
|
||||
? Colors.white
|
||||
: Colors.grey.shade400,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12),
|
||||
),
|
||||
),
|
||||
color: (paymentData.address != null &&
|
||||
paymentData.paymentOption != null)
|
||||
? Colors.green
|
||||
: Color(0xff929295),
|
||||
disabledColor: (paymentData.address != null &&
|
||||
paymentData.paymentOption != null)
|
||||
? Colors.green
|
||||
: Color(0xff929295),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'lacum-registration-page.dart';
|
||||
|
||||
class LakumActivationVidaPage extends StatelessWidget {
|
||||
TextEditingController _identificationNumberController =
|
||||
new TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
|
||||
return BaseView<LacumRegistrationViewModel>(
|
||||
builder: (_, model, wi) => AppScaffold(
|
||||
title: "Acount Activation",
|
||||
isShowAppBar: true,
|
||||
isShowDecPage: false,
|
||||
backgroundColor: Colors.white,
|
||||
baseViewModel: model,
|
||||
body: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 16, horizontal: 12),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Texts(
|
||||
" This service allows you to activate your LAKUM account after registering through the Vida system. ",
|
||||
fontSize: 14,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextField(
|
||||
controller: _identificationNumberController,
|
||||
decoration: new InputDecoration(
|
||||
hintText: 'Enter Identification Number',
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey.shade700,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 4),
|
||||
child: BorderedButton(
|
||||
TranslationBase.of(context).accountActivation,
|
||||
backgroundColor:
|
||||
_identificationNumberController.text != null &&
|
||||
_identificationNumberController.text != ""
|
||||
? Color(0xff60686b)
|
||||
: Color(0xffb0b4b5),
|
||||
textColor: Colors.white,
|
||||
fontSize: 16,
|
||||
hPadding: 8,
|
||||
vPadding: 12,
|
||||
handler: _identificationNumberController.text != null &&
|
||||
_identificationNumberController.text != ""
|
||||
? () {
|
||||
model
|
||||
.checkLacumAccountActivation(
|
||||
_identificationNumberController.text)
|
||||
.then((status) => {
|
||||
if (status == 200)
|
||||
{
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: LakumRegistrationPage(
|
||||
_identificationNumberController
|
||||
.text)))
|
||||
.then((status) => {
|
||||
if (status == 200)
|
||||
{Navigator.pop(context, "")}
|
||||
// back to previous page
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
: null,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,236 @@
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart';
|
||||
import 'package:diplomaticquarterapp/models/id-name-pair.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/dialogs/radio-group-dialog.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'lakum-terms-conditions-page.dart';
|
||||
|
||||
class LakumRegistrationPage extends StatefulWidget {
|
||||
final String patientIdentificationNo;
|
||||
|
||||
LakumRegistrationPage(this.patientIdentificationNo);
|
||||
|
||||
@override
|
||||
_LakumRegistrationPageState createState() => _LakumRegistrationPageState();
|
||||
}
|
||||
|
||||
class _LakumRegistrationPageState extends State<LakumRegistrationPage> {
|
||||
final TextEditingController _firstNameController = TextEditingController();
|
||||
|
||||
final TextEditingController _lastNameController = TextEditingController();
|
||||
|
||||
final TextEditingController _mobileNumberController = TextEditingController();
|
||||
|
||||
List<IdNamePair> languages = List();
|
||||
|
||||
IdNamePair selectedLanguage;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
PreferredSizeWidget appBarWidget = AppBarWidget("Lakum", null, true);
|
||||
languages.clear();
|
||||
languages.add(IdNamePair(1, TranslationBase.of(context).arabic));
|
||||
languages.add(IdNamePair(2, TranslationBase.of(context).english));
|
||||
|
||||
bool canSubmit = _firstNameController.text != null &&
|
||||
_firstNameController.text != "" &&
|
||||
_lastNameController.text != null &&
|
||||
_lastNameController.text != "" &&
|
||||
_mobileNumberController.text != null &&
|
||||
_mobileNumberController.text != "" &&
|
||||
selectedLanguage != null;
|
||||
|
||||
return BaseView<LacumRegistrationViewModel>(
|
||||
builder: (_, model, wi) => AppScaffold(
|
||||
title: "Register Lakum",
|
||||
isShowAppBar: true,
|
||||
isShowDecPage: false,
|
||||
backgroundColor: Colors.white,
|
||||
appBarWidget: appBarWidget,
|
||||
baseViewModel: model,
|
||||
body: Container(
|
||||
width: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: SizedBox(
|
||||
height: mediaQuery.size.height -
|
||||
appBarWidget.preferredSize.height -
|
||||
mediaQuery.padding.top,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/lakum/lakum_card_front_bg.png",
|
||||
fit: BoxFit.fill,
|
||||
height: 150,
|
||||
width: mediaQuery.size.width,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).firstName,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Color(0xff8a8a8a),
|
||||
),
|
||||
TextField(
|
||||
controller: _firstNameController,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).lastName,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Color(0xff8a8a8a),
|
||||
),
|
||||
TextField(
|
||||
controller: _lastNameController,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).mobileNumber,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Color(0xff8a8a8a),
|
||||
),
|
||||
TextField(
|
||||
controller: _mobileNumberController,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context)
|
||||
.prefferedLanguage,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Color(0xff8a8a8a),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
RadioGroupDialog dialog =
|
||||
new RadioGroupDialog(
|
||||
context: context,
|
||||
title: TranslationBase.of(context)
|
||||
.prefferedLanguage,
|
||||
okText:
|
||||
TranslationBase.of(context)
|
||||
.confirm,
|
||||
cancelText:
|
||||
TranslationBase.of(context)
|
||||
.cancel_nocaps,
|
||||
list: languages,
|
||||
okFunction: (selectedValue) {
|
||||
setState(() {
|
||||
selectedLanguage =
|
||||
selectedValue;
|
||||
});
|
||||
print(
|
||||
"selectedLanguage = ${selectedValue.name}");
|
||||
},
|
||||
cancelFunction: () => {});
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return dialog;
|
||||
},
|
||||
);
|
||||
},
|
||||
child: TextField(
|
||||
enabled: false,
|
||||
decoration: InputDecoration(
|
||||
suffixIcon:
|
||||
Icon(Icons.arrow_drop_down),
|
||||
hintText: selectedLanguage == null
|
||||
? "${TranslationBase.of(context).prefferedLanguage}"
|
||||
: "${selectedLanguage.name}",
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.black,
|
||||
)),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey.shade700,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
color: Colors.green,
|
||||
margin: EdgeInsets.all(8),
|
||||
child: BorderedButton(
|
||||
TranslationBase.of(context).register,
|
||||
backgroundColor: canSubmit
|
||||
? Color(0xff339933)
|
||||
: Color(0xff99cc99),
|
||||
textColor: Colors.white,
|
||||
fontSize: 16,
|
||||
hPadding: 8,
|
||||
vPadding: 12,
|
||||
handler: canSubmit
|
||||
? () {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: LakumTermsConditions(
|
||||
widget
|
||||
.patientIdentificationNo,
|
||||
_firstNameController.text,
|
||||
_lastNameController.text,
|
||||
_mobileNumberController
|
||||
.text,
|
||||
selectedLanguage.id)))
|
||||
.then((status) => {
|
||||
if (status == 200)
|
||||
{Navigator.pop(context, "")}
|
||||
// back to previous page
|
||||
});
|
||||
}
|
||||
: null,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
@ -0,0 +1,240 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/lacum-banner-widget.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LakumSettingPage extends StatefulWidget {
|
||||
final LacumAccountInformation lacumInformation;
|
||||
final LacumAccountInformation lacumGroupInformation;
|
||||
|
||||
LakumSettingPage(this.lacumInformation, this.lacumGroupInformation);
|
||||
|
||||
@override
|
||||
_LakumSettingPageState createState() => _LakumSettingPageState();
|
||||
}
|
||||
|
||||
class _LakumSettingPageState extends State<LakumSettingPage> {
|
||||
bool _lakumAccountActivated = false;
|
||||
TextEditingController _nameController = new TextEditingController();
|
||||
TextEditingController _phoneController = new TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_lakumAccountActivated = widget.lacumGroupInformation
|
||||
.lakumInquiryInformationObjVersion.accountStatus ==
|
||||
"Active";
|
||||
super.initState();
|
||||
_nameController.text = widget.lacumGroupInformation.lakumInquiryInformationObjVersion.memberName;
|
||||
_phoneController.text = widget.lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
PreferredSizeWidget appBarWidget = AppBarWidget("Lakum", null, true);
|
||||
|
||||
return BaseView<LacumViewModel>(
|
||||
onModelReady: (model) => model.setLakumData(
|
||||
widget.lacumInformation, widget.lacumGroupInformation),
|
||||
builder: (_, model, wi) => AppScaffold(
|
||||
title: "Lakum",
|
||||
isShowAppBar: true,
|
||||
isShowDecPage: false,
|
||||
backgroundColor: Colors.white,
|
||||
appBarWidget: appBarWidget,
|
||||
baseViewModel: model,
|
||||
body: Container(
|
||||
width: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: SizedBox(
|
||||
height: mediaQuery.size.height -
|
||||
appBarWidget.preferredSize.height -
|
||||
mediaQuery.padding.top,
|
||||
child: _buildSettingScreen(mediaQuery, model),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_buildSettingScreen(MediaQueryData mediaQuery, LacumViewModel model) {
|
||||
bool canUpdate = (_nameController.text != "" &&
|
||||
_phoneController.text != "" &&
|
||||
(_nameController.text != widget.lacumGroupInformation.lakumInquiryInformationObjVersion.memberName ||
|
||||
_phoneController.text != widget.lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber));
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
Container(
|
||||
height: mediaQuery.size.height * 0.15,
|
||||
color: Colors.grey.shade700,
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: mediaQuery.size.height * 0.05,
|
||||
),
|
||||
Container(
|
||||
width: mediaQuery.size.width * 1,
|
||||
child: LakumBannerWidget(model, mediaQuery, false)),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(
|
||||
height: 1,
|
||||
width: double.infinity,
|
||||
child: Container(
|
||||
color: Color(0xffefefef),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
"Activate LAKUM Account",
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black,
|
||||
),
|
||||
Switch.adaptive(
|
||||
activeColor: Color.fromRGBO(51, 153, 51, 1),
|
||||
inactiveThumbColor: Colors.red,
|
||||
activeTrackColor: Colors.grey,
|
||||
inactiveTrackColor: Colors.grey,
|
||||
value: _lakumAccountActivated,
|
||||
onChanged: (val) {
|
||||
if (_lakumAccountActivated) {
|
||||
model.makeAccountDeactivate();
|
||||
} else {
|
||||
model.makeAccountActivate();
|
||||
}
|
||||
setState(() {
|
||||
_lakumAccountActivated = val;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).name,
|
||||
fontSize: 13,
|
||||
fontWeight: _lakumAccountActivated
|
||||
? FontWeight.bold
|
||||
: FontWeight.normal,
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
_lakumAccountActivated
|
||||
? TextField(
|
||||
controller: _nameController,
|
||||
enabled: _lakumAccountActivated ? true : false,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: _lakumAccountActivated
|
||||
? Colors.black
|
||||
: Colors.white38,
|
||||
),
|
||||
)
|
||||
: Texts(
|
||||
_nameController.text,
|
||||
fontSize: 16,
|
||||
color: Colors.grey.shade600,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).mobileNumber,
|
||||
fontSize: 13,
|
||||
fontWeight: _lakumAccountActivated
|
||||
? FontWeight.bold
|
||||
: FontWeight.normal,
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
_lakumAccountActivated
|
||||
? TextField(
|
||||
controller: _phoneController,
|
||||
enabled: _lakumAccountActivated ? true : false,
|
||||
keyboardType: TextInputType.phone,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: _lakumAccountActivated
|
||||
? Colors.black
|
||||
: Colors.white38,
|
||||
),
|
||||
)
|
||||
: Texts(
|
||||
_phoneController.text,
|
||||
fontSize: 16,
|
||||
color: Colors.grey.shade600,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 2,
|
||||
width: double.infinity,
|
||||
child: Container(
|
||||
color: Color(0xffefefef),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.all(8),
|
||||
child: BorderedButton(
|
||||
TranslationBase.of(context).save,
|
||||
backgroundColor:
|
||||
canUpdate ? Color(0xff60686b) : Color(0xffb0b4b5),
|
||||
textColor: Colors.white,
|
||||
fontSize: 16,
|
||||
hPadding: 8,
|
||||
vPadding: 12,
|
||||
handler: canUpdate
|
||||
? () {
|
||||
model.createLakumAccount(_nameController.text, _phoneController.text).then((status) => {
|
||||
if (status == 200) {Navigator.pop(context, "")}
|
||||
// back to previous page
|
||||
});
|
||||
}
|
||||
: null,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,317 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-trasnfer-viewModel.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LacumTransferPage extends StatefulWidget {
|
||||
final LacumAccountInformation lacumInformation;
|
||||
final LacumAccountInformation lacumGroupInformation;
|
||||
|
||||
LacumTransferPage(this.lacumInformation, this.lacumGroupInformation);
|
||||
|
||||
@override
|
||||
_LacumTransferPageState createState() => _LacumTransferPageState();
|
||||
}
|
||||
|
||||
class _LacumTransferPageState extends State<LacumTransferPage> {
|
||||
TextEditingController _beneficieryAccountController =
|
||||
new TextEditingController();
|
||||
TextEditingController _transferPointsController = new TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_beneficieryAccountController.text = "";
|
||||
_transferPointsController.text = "0";
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
PreferredSizeWidget appBarWidget = AppBarWidget("Lakum", null, true);
|
||||
|
||||
return BaseView<LacumTranferViewModel>(
|
||||
onModelReady: (model) => model.setLakumData(
|
||||
widget.lacumInformation, widget.lacumGroupInformation),
|
||||
builder: (_, model, wi) => AppScaffold(
|
||||
title: "Lakum",
|
||||
isShowAppBar: true,
|
||||
isShowDecPage: false,
|
||||
backgroundColor: Colors.white,
|
||||
appBarWidget: appBarWidget,
|
||||
baseViewModel: model,
|
||||
body: Container(
|
||||
width: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: SizedBox(
|
||||
height:
|
||||
mediaQuery.size.height - 58 - mediaQuery.padding.top,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
height: 100,
|
||||
width: mediaQuery.size.width / 2 - 26,
|
||||
padding: EdgeInsets.only(
|
||||
top: 12, left: 8, right: 8, bottom: 4),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: Color(0xffe1e1e1),
|
||||
width: 0.4,
|
||||
)),
|
||||
color: Color(0xff6294ed),
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
child: Texts(
|
||||
"Point Balance",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 8),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.end,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.end,
|
||||
children: [
|
||||
Texts(
|
||||
"0",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Container(
|
||||
height: 100,
|
||||
width: mediaQuery.size.width / 2 - 26,
|
||||
padding: EdgeInsets.only(
|
||||
top: 12, left: 8, right: 8, bottom: 4),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: Color(0xffe1e1e1),
|
||||
width: 0.4,
|
||||
)),
|
||||
color: Color(0xff339933),
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
child: Texts(
|
||||
"Riyal Balance",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 8),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.end,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.end,
|
||||
children: [
|
||||
Texts(
|
||||
"0",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 16),
|
||||
child: TextField(
|
||||
controller: _beneficieryAccountController,
|
||||
decoration: new InputDecoration(
|
||||
hintText: 'Enter Beneficiary Account No.',
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey.shade700,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 4),
|
||||
child: BorderedButton(
|
||||
TranslationBase.of(context).checkBeneficiary,
|
||||
backgroundColor:
|
||||
_beneficieryAccountController.text != ""
|
||||
? Color(0xff60686b)
|
||||
: Color(0xffb0b4b5),
|
||||
textColor: Colors.white,
|
||||
fontSize: 16,
|
||||
hPadding: 8,
|
||||
vPadding: 12,
|
||||
handler:
|
||||
_beneficieryAccountController.text != ""
|
||||
? () {
|
||||
model.getLacumGroupDataBuAccountId(
|
||||
_beneficieryAccountController
|
||||
.text);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
),
|
||||
(model.lacumReceiverInformation != null &&
|
||||
model.lacumReceiverInformation
|
||||
.lakumInquiryInformationObjVersion !=
|
||||
null)
|
||||
? Container(
|
||||
margin: EdgeInsets.only(top: 8),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context)
|
||||
.beneficiaryName,
|
||||
color: Colors.black,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8),
|
||||
child: TextField(
|
||||
enabled: false,
|
||||
decoration: new InputDecoration(
|
||||
hintText:
|
||||
"${model.lacumReceiverInformation.lakumInquiryInformationObjVersion.memberName}",
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey.shade600,
|
||||
)),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey.shade700,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
width: double.infinity,
|
||||
),
|
||||
Texts(
|
||||
"Point's to Transfer :",
|
||||
color: Colors.black,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8),
|
||||
child: TextField(
|
||||
controller:
|
||||
_transferPointsController,
|
||||
decoration: new InputDecoration(
|
||||
focusColor: Colors.green,
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey.shade600,
|
||||
)),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey.shade700,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container()
|
||||
],
|
||||
),
|
||||
if (model.lacumReceiverInformation != null &&
|
||||
model.lacumReceiverInformation
|
||||
.lakumInquiryInformationObjVersion !=
|
||||
null)
|
||||
Container(
|
||||
margin: EdgeInsets.all(8),
|
||||
child: BorderedButton(
|
||||
"LACUM TRANSFER",
|
||||
backgroundColor: Color(0xff339933),
|
||||
textColor: Colors.white,
|
||||
fontSize: 18,
|
||||
hPadding: 8,
|
||||
radius: 12,
|
||||
vPadding: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
handler: () {
|
||||
model
|
||||
.transferYaHalaLoyaltyPoints(
|
||||
_transferPointsController.text)
|
||||
.then((status) => {
|
||||
if (status == 200)
|
||||
{Navigator.pop(context, "")}
|
||||
// back to previous page
|
||||
});
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
@ -0,0 +1,554 @@
|
||||
import 'package:diplomaticquarterapp/config/config.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/PointsAmountPerYear.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-setting-page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-transfer-page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-points-year-page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/lacum-banner-widget.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'lacum-activitaion-vida-page.dart';
|
||||
|
||||
class LakumMainPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
|
||||
return BaseView<LacumViewModel>(
|
||||
onModelReady: (model) => model.getLacumData(),
|
||||
builder: (_, model, wi) => AppScaffold(
|
||||
title: "Lakum",
|
||||
isShowAppBar: true,
|
||||
isShowDecPage: false,
|
||||
backgroundColor: Colors.white,
|
||||
baseViewModel: model,
|
||||
appBarIcons: _buildAppBarICons(context, model),
|
||||
// preferredSize: mediaQuery.size.height * 0.20,
|
||||
body: Container(
|
||||
width: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: (model.lacumGroupInformation != null &&
|
||||
model.lacumGroupInformation
|
||||
.lakumInquiryInformationObjVersion !=
|
||||
null)
|
||||
? Column(
|
||||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
Container(
|
||||
height: mediaQuery.size.height * 0.15,
|
||||
color: Colors.grey.shade700,
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: mediaQuery.size.height * 0.05,
|
||||
),
|
||||
Container(
|
||||
width: mediaQuery.size.width * 1,
|
||||
child: LakumBannerWidget(
|
||||
model, mediaQuery, true)),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
LakumHomeButtons(mediaQuery, model),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Container(
|
||||
height: 100,
|
||||
margin: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: ListView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
children: <Widget>[
|
||||
LacumPointsWidget(
|
||||
mediaQuery,
|
||||
1,
|
||||
TranslationBase.of(context).balance,
|
||||
model
|
||||
.lacumGroupInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.pointsBalanceAmount,
|
||||
model
|
||||
.lacumGroupInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.pointsBalance,
|
||||
null),
|
||||
SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
LacumPointsWidget(
|
||||
mediaQuery,
|
||||
2,
|
||||
TranslationBase.of(context).gained,
|
||||
model
|
||||
.lacumGroupInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.pointsBalanceAmount,
|
||||
model
|
||||
.lacumGroupInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.gainedPoints,
|
||||
model
|
||||
.lacumGroupInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.gainedPointsAmountPerYear),
|
||||
SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
LacumPointsWidget(
|
||||
mediaQuery,
|
||||
3,
|
||||
TranslationBase.of(context).consumed,
|
||||
model
|
||||
.lacumGroupInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.consumedPointsAmount !=
|
||||
null
|
||||
? int.parse(model
|
||||
.lacumGroupInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.consumedPointsAmount)
|
||||
: 0,
|
||||
model
|
||||
.lacumGroupInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.consumedPoints,
|
||||
model
|
||||
.lacumGroupInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.consumedPointsAmountPerYear),
|
||||
SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
LacumPointsWidget(
|
||||
mediaQuery,
|
||||
4,
|
||||
TranslationBase.of(context).transferred,
|
||||
0,
|
||||
model
|
||||
.lacumGroupInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.transferPoints,
|
||||
model
|
||||
.lacumGroupInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.transferPointsAmountPerYear),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
width: double.infinity,
|
||||
child: Container(
|
||||
color: Color(0xffefefef),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(
|
||||
vertical: 16, horizontal: 8),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/lakum/expired_icon.png",
|
||||
fit: BoxFit.fill,
|
||||
width: 25,
|
||||
height: 25,
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Texts(
|
||||
"Expired",
|
||||
fontSize: 14,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Texts(
|
||||
"${model.lacumGroupInformation.lakumInquiryInformationObjVersion.expiredPoints} Points",
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 2,
|
||||
width: double.infinity,
|
||||
child: Container(
|
||||
color: Color(0xffefefef),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(
|
||||
vertical: 16, horizontal: 8),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/lakum/waiting_gained_icon.png",
|
||||
fit: BoxFit.fill,
|
||||
width: 20,
|
||||
height: 25,
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Texts(
|
||||
"Waiting gained",
|
||||
fontSize: 14,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Texts(
|
||||
"${model.lacumGroupInformation.lakumInquiryInformationObjVersion.waitingPoints} Points",
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 2,
|
||||
width: double.infinity,
|
||||
child: Container(
|
||||
color: Color(0xffefefef),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(
|
||||
vertical: 16, horizontal: 8),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/lakum/will_be_expired_icon.png",
|
||||
fit: BoxFit.fill,
|
||||
width: 25,
|
||||
height: 25,
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Texts(
|
||||
"Will Be Expired",
|
||||
fontSize: 14,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Texts(
|
||||
"${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsWillBeExpired} Points",
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 2,
|
||||
width: double.infinity,
|
||||
child: Container(
|
||||
color: Color(0xffefefef),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
List<Widget> _buildAppBarICons(BuildContext context, LacumViewModel model) {
|
||||
return [
|
||||
IconButton(
|
||||
icon: Icon(Icons.settings),
|
||||
color: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: LakumSettingPage(
|
||||
model.lacumInformation, model.lacumGroupInformation)))
|
||||
.then((result) => {model.getLacumGroupData()});
|
||||
},
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
class LakumHomeButtons extends StatelessWidget {
|
||||
final MediaQueryData mediaQuery;
|
||||
final LacumViewModel model;
|
||||
|
||||
LakumHomeButtons(this.mediaQuery, this.model);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
print("Account activate click");
|
||||
Navigator.push(
|
||||
context, FadePage(page: LakumActivationVidaPage()))
|
||||
.then((result) => {model.getLacumGroupData()});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: Color(0xffe1e1e1),
|
||||
width: 0.4,
|
||||
)),
|
||||
color: Color(0xffe1e1e1)),
|
||||
height: mediaQuery.size.height * 0.08,
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/lakum/Account_activation_icon.png",
|
||||
fit: BoxFit.fill,
|
||||
width: 30,
|
||||
height: 30,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Texts(
|
||||
"Account Activation",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
print("Lacum transfer click");
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: LacumTransferPage(model.lacumInformation,
|
||||
model.lacumGroupInformation)))
|
||||
.then((result) => {model.getLacumGroupData()});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: Color(0xffe1e1e1),
|
||||
width: 0.4,
|
||||
)),
|
||||
color: Color(0xffe1e1e1)),
|
||||
height: mediaQuery.size.height * 0.08,
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/lakum/Lakum_transfer_icon.png",
|
||||
fit: BoxFit.fill,
|
||||
width: 35,
|
||||
height: 30,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Texts(
|
||||
"Lakum Transfer",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class LacumPointsWidget extends StatelessWidget {
|
||||
final MediaQueryData mediaQuery;
|
||||
final int pointType; // 1. balance, 2. gained, 3. consume, 4. transfer
|
||||
final String title;
|
||||
final int riyal;
|
||||
final int point;
|
||||
Color titleColor;
|
||||
final List<PointsAmountPerYear> pointsAmountPerYear;
|
||||
|
||||
LacumPointsWidget(this.mediaQuery, this.pointType, this.title, this.riyal,
|
||||
this.point, this.pointsAmountPerYear) {
|
||||
if (pointType == 1) {
|
||||
titleColor = Color(0xffefefef);
|
||||
} else if (pointType == 2) {
|
||||
titleColor = Color(0xff004bcc);
|
||||
} else if (pointType == 3) {
|
||||
titleColor = Color(0xff339933);
|
||||
} else {
|
||||
titleColor = Color(0xffffa500);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (pointType != 1) {
|
||||
if (pointsAmountPerYear != null && pointsAmountPerYear.length > 0) {
|
||||
Navigator.push(context,
|
||||
FadePage(page: LakumPointsYearPage(pointsAmountPerYear)));
|
||||
} else {
|
||||
// show snackBar No Details Points are there
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: mediaQuery.size.width / 2 - 16,
|
||||
padding: EdgeInsets.only(top: 12, left: 8, right: 8, bottom: 4),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: Color(0xffe1e1e1),
|
||||
width: 0.4,
|
||||
)),
|
||||
color: pointType == 1 ? Color(0xff004bcc) : Color(0xffefefef),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
child: Texts(
|
||||
title,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: titleColor,
|
||||
),
|
||||
),
|
||||
if (pointType != 1)
|
||||
Icon(
|
||||
Icons.arrow_forward,
|
||||
color: titleColor,
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
if (pointType != 4)
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
"RIYAL",
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: pointType == 1 ? Colors.white : Colors.black,
|
||||
),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Texts(
|
||||
"$riyal",
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: pointType == 1 ? Colors.white : Colors.black,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (pointType != 4)
|
||||
SizedBox(
|
||||
child: Container(
|
||||
color: pointType == 1 ? Colors.white : Colors.grey,
|
||||
),
|
||||
width: 1,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
"POINT",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: pointType == 1 ? Colors.white : Colors.black,
|
||||
),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Texts(
|
||||
"$point",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: pointType == 1 ? Colors.white : Colors.black,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/PointsAmountPerYear.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LakumPointsYearPage extends StatefulWidget {
|
||||
final List<PointsAmountPerYear> pointsAmountPerYear;
|
||||
int selectedIndexYear = 0;
|
||||
|
||||
LakumPointsYearPage(this.pointsAmountPerYear);
|
||||
|
||||
@override
|
||||
_LakumPointsYearPageState createState() => _LakumPointsYearPageState();
|
||||
}
|
||||
|
||||
class _LakumPointsYearPageState extends State<LakumPointsYearPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
|
||||
return BaseView<LacumViewModel>(
|
||||
builder: (_, model, wi) => AppScaffold(
|
||||
title: "Lakum points",
|
||||
isShowAppBar: true,
|
||||
isShowDecPage: false,
|
||||
backgroundColor: Colors.white,
|
||||
baseViewModel: model,
|
||||
body: Container(
|
||||
width: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 100,
|
||||
margin: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: ListView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
children: <Widget>[
|
||||
...List.generate(
|
||||
widget.pointsAmountPerYear.length,
|
||||
(index) => LacumPointsYearWidget(
|
||||
mediaQuery,
|
||||
widget.selectedIndexYear == index,
|
||||
widget.pointsAmountPerYear[index],
|
||||
() {})),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class LacumPointsYearWidget extends StatelessWidget {
|
||||
final MediaQueryData mediaQuery;
|
||||
final bool isSelected;
|
||||
final PointsAmountPerYear yearPoints;
|
||||
final Function yearOnTap;
|
||||
|
||||
LacumPointsYearWidget(
|
||||
this.mediaQuery, this.isSelected, this.yearPoints, this.yearOnTap);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: yearOnTap,
|
||||
child: Container(
|
||||
width: mediaQuery.size.width / 2 - 16,
|
||||
padding: EdgeInsets.only(top: 12, left: 8, right: 8, bottom: 4),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: Color(0xffe1e1e1),
|
||||
width: 0.4,
|
||||
)),
|
||||
color: isSelected ? Color(0xff004bcc) : Color(0xffefefef),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
child: Texts(
|
||||
"YEAR: ${yearPoints.year}",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isSelected ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
"POINT",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isSelected ? Colors.white : Colors.black,
|
||||
),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Texts(
|
||||
"${yearPoints.pointsPerYear}",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isSelected ? Colors.white : Colors.black,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
child: Container(
|
||||
color: isSelected ? Colors.white : Colors.grey,
|
||||
),
|
||||
width: 1,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
"RIYAL",
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isSelected ? Colors.white : Colors.black,
|
||||
),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Texts(
|
||||
"${yearPoints.amountPerYear}",
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isSelected ? Colors.white : Colors.black,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_html/flutter_html.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class LakumTermsConditions extends StatelessWidget {
|
||||
final String firstName, lastName, mobileNo, identificationNo;
|
||||
final int languageId;
|
||||
|
||||
LakumTermsConditions(this.identificationNo, this.firstName, this.lastName,
|
||||
this.mobileNo, this.languageId);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProjectViewModel projectProvider = Provider.of(context);
|
||||
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
PreferredSizeWidget appBarWidget = AppBarWidget("Lakum", null, true);
|
||||
double height = mediaQuery.size.height -
|
||||
appBarWidget.preferredSize.height -
|
||||
mediaQuery.padding.top;
|
||||
|
||||
return BaseView<LacumRegistrationViewModel>(
|
||||
onModelReady: (model) => model.getUserTermsAndConditionsForEPharmcy(),
|
||||
builder: (_, model, wi) => AppScaffold(
|
||||
title: "Register Lakum",
|
||||
isShowAppBar: true,
|
||||
isShowDecPage: false,
|
||||
backgroundColor: Colors.white,
|
||||
baseViewModel: model,
|
||||
appBarWidget: appBarWidget,
|
||||
body: Container(
|
||||
margin: EdgeInsets.all(8),
|
||||
width: double.infinity,
|
||||
child: Stack(
|
||||
children: [
|
||||
SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (model.listUserAgreement != null &&
|
||||
model.listUserAgreement.userAgreementLAKUM !=
|
||||
null)
|
||||
Html(
|
||||
data: projectProvider.isArabic
|
||||
? model.listUserAgreement.userAgreementLAKUMn
|
||||
: model.listUserAgreement.userAgreementLAKUM,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Container(
|
||||
height: 50,
|
||||
margin: EdgeInsets.all(8),
|
||||
child: BorderedButton(
|
||||
TranslationBase.of(context).acceptLbl,
|
||||
backgroundColor: Color(0xff60686b),
|
||||
textColor: Colors.white,
|
||||
fontSize: 16,
|
||||
hPadding: 8,
|
||||
vPadding: 12,
|
||||
handler: () {
|
||||
model.createNewLakumAccount("$firstName $lastName", mobileNo, identificationNo, languageId).then((status) => {
|
||||
if (status == 200) {Navigator.pop(context, "")}
|
||||
// back to previous page
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class OrderPreviewPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<OrderPreviewViewModel>(
|
||||
builder: (_, model, wi) => AppScaffold(
|
||||
title: "Shopping Cart",
|
||||
isShowAppBar: true,
|
||||
isShowDecPage: false,
|
||||
baseViewModel: model,
|
||||
backgroundColor: Colors.white,
|
||||
body: Container(
|
||||
width: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
GestureIconButton(
|
||||
TranslationBase.of(context).deleteAllItems,
|
||||
Icon(Icons.delete_outline_sharp, color: Colors.grey.shade800,),
|
||||
onTap: () => {},
|
||||
),
|
||||
const Divider(
|
||||
color: Colors.grey,
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,202 @@
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PaymentMethodSelectPage extends StatefulWidget {
|
||||
@override
|
||||
_PaymentMethodSelectPageState createState() =>
|
||||
_PaymentMethodSelectPageState();
|
||||
}
|
||||
|
||||
class _PaymentMethodSelectPageState extends State<PaymentMethodSelectPage> {
|
||||
PaymentOption selectedPaymentOption;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Size screenSize = MediaQuery.of(context).size;
|
||||
double cardWidth = screenSize.width / 2 - 32;
|
||||
|
||||
return AppScaffold(
|
||||
title: "Payment method",
|
||||
isShowAppBar: true,
|
||||
isShowDecPage: false,
|
||||
body: Container(
|
||||
width: double.infinity,
|
||||
margin: EdgeInsets.symmetric(horizontal: 0, vertical: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Center(
|
||||
child: Texts(
|
||||
TranslationBase.of(context).selectPaymentOption,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 0, vertical: 16),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
PaymentMethodCard(
|
||||
cardWidth,
|
||||
selectedPaymentOption,
|
||||
PaymentOption.meda,
|
||||
() => {
|
||||
setState(() {
|
||||
selectedPaymentOption = PaymentOption.meda;
|
||||
})
|
||||
}),
|
||||
PaymentMethodCard(
|
||||
cardWidth,
|
||||
selectedPaymentOption,
|
||||
PaymentOption.sadad,
|
||||
() => {
|
||||
setState(() {
|
||||
selectedPaymentOption = PaymentOption.sadad;
|
||||
})
|
||||
}),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
PaymentMethodCard(
|
||||
cardWidth,
|
||||
selectedPaymentOption,
|
||||
PaymentOption.visa,
|
||||
() => {
|
||||
setState(() {
|
||||
selectedPaymentOption = PaymentOption.visa;
|
||||
})
|
||||
}),
|
||||
PaymentMethodCard(
|
||||
cardWidth,
|
||||
selectedPaymentOption,
|
||||
PaymentOption.mastercard,
|
||||
() => {
|
||||
setState(() {
|
||||
selectedPaymentOption =
|
||||
PaymentOption.mastercard;
|
||||
})
|
||||
}),
|
||||
],
|
||||
),
|
||||
PaymentMethodCard(
|
||||
(cardWidth * 2 + 32),
|
||||
selectedPaymentOption,
|
||||
PaymentOption.installments,
|
||||
() => {
|
||||
setState(() {
|
||||
selectedPaymentOption =
|
||||
PaymentOption.installments;
|
||||
})
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomSheet: Container(
|
||||
height: screenSize.height * 0.08,
|
||||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: BorderedButton(
|
||||
TranslationBase.of(context).next,
|
||||
backgroundColor: Color(0xff5AB154),
|
||||
textColor: Colors.white,
|
||||
fontSize: 16,
|
||||
hPadding: 8,
|
||||
vPadding: 12,
|
||||
handler: selectedPaymentOption != null
|
||||
? () => {Navigator.pop(context, selectedPaymentOption)}
|
||||
: null,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class PaymentMethodCard extends StatelessWidget {
|
||||
final double cardWidth;
|
||||
final PaymentOption selectedPaymentOption;
|
||||
final PaymentOption paymentOption;
|
||||
final Function selectMethod;
|
||||
|
||||
PaymentMethodCard(this.cardWidth, this.selectedPaymentOption,
|
||||
this.paymentOption, this.selectMethod);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bool isSelected = false;
|
||||
if (selectedPaymentOption != null &&
|
||||
selectedPaymentOption == paymentOption) {
|
||||
isSelected = true;
|
||||
}
|
||||
|
||||
return InkWell(
|
||||
onTap: selectMethod,
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 2, vertical: 0),
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
||||
margin: EdgeInsets.symmetric(horizontal: 14, vertical: 8),
|
||||
decoration: new BoxDecoration(
|
||||
color: Colors.grey.shade100,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: isSelected ? Color(0xff20BC11) : Colors.grey.shade300,
|
||||
width: 0.8,
|
||||
)),
|
||||
),
|
||||
width: cardWidth,
|
||||
child: Image.asset(
|
||||
getPaymentOptionImage(paymentOption),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
if (isSelected)
|
||||
Positioned(
|
||||
right: 1,
|
||||
child: Icon(
|
||||
Icons.check_circle,
|
||||
color: Color(0xff20BC11),
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String getPaymentOptionImage(PaymentOption paymentOption) {
|
||||
String assetFile = "assets/images/pharmacy_module/payment/";
|
||||
switch (paymentOption.index) {
|
||||
case 0:
|
||||
return "${assetFile}mada.png";
|
||||
break;
|
||||
case 1:
|
||||
return "${assetFile}sadad.png";
|
||||
break;
|
||||
case 2:
|
||||
return "${assetFile}visa.png";
|
||||
break;
|
||||
case 3:
|
||||
return "${assetFile}mastercard.png";
|
||||
break;
|
||||
case 4:
|
||||
return "${assetFile}installment.png";
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,239 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ProductOrderItem extends StatefulWidget {
|
||||
final ShoppingCart item;
|
||||
final VoidCallback changeCartItems;
|
||||
final VoidCallback deleteCartItems;
|
||||
|
||||
ProductOrderItem(this.item, this.changeCartItems, this.deleteCartItems);
|
||||
|
||||
@override
|
||||
_ProductOrderItemState createState() => _ProductOrderItemState();
|
||||
}
|
||||
|
||||
class _ProductOrderItemState extends State<ProductOrderItem> {
|
||||
TextEditingController _quantityController = new TextEditingController();
|
||||
String _totalPrice = "0";
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_quantityController.text = "${widget.item.quantity}";
|
||||
_totalPrice =
|
||||
"${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}";
|
||||
super.initState();
|
||||
}
|
||||
|
||||
class ProductOrderItem extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
leading: Icon(
|
||||
Icons.delete_outline_sharp,
|
||||
color: Colors.grey.shade800,
|
||||
),
|
||||
ProjectViewModel projectProvider = Provider.of(context);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: InkWell(
|
||||
onTap: () => {widget.deleteCartItems()},
|
||||
child: Icon(
|
||||
Icons.delete_outline_sharp,
|
||||
color: Colors.grey.shade700,
|
||||
),
|
||||
),
|
||||
title: Container(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
(widget.item.product.images != null && widget.item.product.images.length > 0)
|
||||
? Image.network(
|
||||
widget.item.product.images[0].src,
|
||||
fit: BoxFit.cover,
|
||||
height: 80,
|
||||
)
|
||||
: Image.asset(
|
||||
"assets/images/no_image.png",
|
||||
fit: BoxFit.cover,
|
||||
height: 80,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin:
|
||||
const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
||||
child: Container(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
child: Texts(
|
||||
projectProvider.isArabic
|
||||
? widget.item.product.namen
|
||||
: widget.item.product.name,
|
||||
regular: true,
|
||||
textAlign: TextAlign.justify,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
margin: const EdgeInsets.only(bottom: 4),
|
||||
),
|
||||
Container(
|
||||
child: Texts(
|
||||
"${(widget.item.product.price).toStringAsFixed(2)} ${projectProvider.isArabic ? widget.item.currencyn : widget.item.currency}",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
margin: const EdgeInsets.only(bottom: 4),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () =>
|
||||
{_quantityOnChangeClick(Operation.dec)},
|
||||
child: Container(
|
||||
width: 25,
|
||||
height: 25,
|
||||
child: Center(
|
||||
child: Texts(
|
||||
"-",
|
||||
color: Colors.grey.shade400,
|
||||
)),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.grey.shade400,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin:
|
||||
const EdgeInsets.symmetric(horizontal: 4),
|
||||
width: 25,
|
||||
height: 25,
|
||||
color: Colors.grey.shade300,
|
||||
child: Center(
|
||||
child: TextField(
|
||||
cursorColor: Colors.black,
|
||||
keyboardType: TextInputType.number,
|
||||
controller: _quantityController,
|
||||
textAlign: TextAlign.center,
|
||||
onChanged: (text) {
|
||||
setState(() {
|
||||
var value = int.tryParse(text);
|
||||
if (value == null) {
|
||||
widget.item.quantity = 0;
|
||||
} else {
|
||||
widget.item.quantity = int.parse(text);
|
||||
}
|
||||
_totalPrice =
|
||||
"${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}";
|
||||
});
|
||||
},
|
||||
)),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () =>
|
||||
{_quantityOnChangeClick(Operation.inc)},
|
||||
child: Container(
|
||||
width: 25,
|
||||
height: 25,
|
||||
child: Center(
|
||||
child: Texts(
|
||||
"+",
|
||||
color: Colors.grey.shade400,
|
||||
)),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.grey.shade400,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).total,
|
||||
color: Colors.grey.shade500,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
Texts(
|
||||
"$_totalPrice ${projectProvider.isArabic ? widget.item.currencyn : widget.item.currency}",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 15,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
_quantityOnChangeClick(Operation operation) {
|
||||
int newValue = 0;
|
||||
setState(() {
|
||||
switch (operation) {
|
||||
case Operation.inc:
|
||||
{
|
||||
newValue = widget.item.quantity + 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case Operation.dec:
|
||||
{
|
||||
newValue = widget.item.quantity - 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
//statements;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (newValue > 0) {
|
||||
widget.item.quantity = newValue;
|
||||
_quantityController.text = "${widget.item.quantity}";
|
||||
_totalPrice =
|
||||
"${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}";
|
||||
}
|
||||
});
|
||||
if (newValue > 0) {
|
||||
widget.changeCartItems();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// Clean up the controller when the widget is removed from the
|
||||
// widget tree.
|
||||
_quantityController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
enum Operation { inc, dec }
|
||||
|
@ -0,0 +1,111 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ProductOrderPreviewItem extends StatelessWidget {
|
||||
final ShoppingCart item;
|
||||
|
||||
ProductOrderPreviewItem(this.item);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProjectViewModel projectProvider = Provider.of(context);
|
||||
|
||||
return Container(
|
||||
margin: EdgeInsets.only(top: 16),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
(item.product.images != null && item.product.images.length > 0)
|
||||
? Image.network(
|
||||
item.product.images[0].src,
|
||||
fit: BoxFit.cover,
|
||||
height: 80,
|
||||
)
|
||||
: Image.asset(
|
||||
"assets/images/no_image.png",
|
||||
fit: BoxFit.cover,
|
||||
height: 80,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
||||
child: Container(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
child: Texts(
|
||||
projectProvider.isArabic
|
||||
? item.product.namen
|
||||
: item.product.name,
|
||||
regular: true,
|
||||
textAlign: TextAlign.justify,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
margin: const EdgeInsets.only(bottom: 4),
|
||||
),
|
||||
Container(
|
||||
child: Texts(
|
||||
"${(item.product.price).toStringAsFixed(2)} ${projectProvider.isArabic ? item.currencyn : item.currency}",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
margin: const EdgeInsets.only(bottom: 4),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.centerRight,
|
||||
child: Texts(
|
||||
TranslationBase.of(context).total,
|
||||
color: Colors.grey.shade700,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Texts(
|
||||
"QTY: ${item.quantity}",
|
||||
color: Colors.grey.shade500,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Texts(
|
||||
"${(item.product.price * item.quantity).toStringAsFixed(2)} ${projectProvider.isArabic ? item.currencyn : item.currency}",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 0,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,289 @@
|
||||
import 'package:carousel_slider/carousel_slider.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LakumBannerWidget extends StatefulWidget {
|
||||
final LacumViewModel model;
|
||||
final MediaQueryData mediaQuery;
|
||||
final bool isLacumHomePage;
|
||||
|
||||
LakumBannerWidget(this.model, this.mediaQuery, this.isLacumHomePage);
|
||||
|
||||
@override
|
||||
_LakumBannerWidgetState createState() => _LakumBannerWidgetState();
|
||||
}
|
||||
|
||||
class _LakumBannerWidgetState extends State<LakumBannerWidget> {
|
||||
int _current = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
child: Stack(
|
||||
children: [
|
||||
CarouselSlider(
|
||||
options: CarouselOptions(
|
||||
enableInfiniteScroll: false,
|
||||
enlargeCenterPage: false,
|
||||
viewportFraction: 1.0,
|
||||
scrollPhysics: widget.isLacumHomePage
|
||||
? ScrollPhysics()
|
||||
: NeverScrollableScrollPhysics(),
|
||||
initialPage: 0,
|
||||
onPageChanged: (index, reason) {
|
||||
setState(() {
|
||||
_current = index;
|
||||
});
|
||||
},
|
||||
),
|
||||
items: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: Colors.grey,
|
||||
width: 0.4,
|
||||
)),
|
||||
),
|
||||
margin: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Stack(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/lakum/lakum_card_front_bg.png",
|
||||
fit: BoxFit.fill,
|
||||
width: widget.mediaQuery.size.width * 1.0,
|
||||
height: widget.mediaQuery.size.width * 1.0,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.fromLTRB(12, 70, 12, 4),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.memberName,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
Texts(
|
||||
"${widget.model.lacumInformation.yahalaAccountNo}",
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black,
|
||||
),
|
||||
],
|
||||
),
|
||||
BorderedButton(
|
||||
widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.accountStatus == "Active"
|
||||
? TranslationBase.of(context).active
|
||||
: TranslationBase.of(context).inactive,
|
||||
textColor: widget.model.lacumInformation
|
||||
.accountStatus ==
|
||||
1
|
||||
? Colors.green
|
||||
: Colors.red,
|
||||
hasBorder: true,
|
||||
borderColor: widget.model.lacumInformation
|
||||
.accountStatus ==
|
||||
1
|
||||
? Colors.green
|
||||
: Colors.red,
|
||||
radius: 16,
|
||||
rPadding: 16,
|
||||
icon: widget.model.lacumInformation
|
||||
.accountStatus ==
|
||||
1
|
||||
? Icon(
|
||||
Icons.check_circle,
|
||||
size: 25,
|
||||
color: Colors.green,
|
||||
)
|
||||
: Image.asset(
|
||||
"assets/images/pharmacy_module/lakum/inactive_cross.png",
|
||||
fit: BoxFit.fill,
|
||||
width: 25,
|
||||
height: 25,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
"IDENTIFICATION #",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
Texts(
|
||||
widget.model.lacumInformation
|
||||
.identificationNo,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black,
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Texts(
|
||||
"MEMBER SINCE",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
Texts(
|
||||
widget.model.formatCreatedDateToString(),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
"MOBILE #",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
Texts(
|
||||
widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black,
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).language,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
Texts(
|
||||
widget.model.lacumInformation.prefLang ==
|
||||
"1"
|
||||
? TranslationBase.of(context).lanEnglish
|
||||
: TranslationBase.of(context).lanArabic,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
widget.isLacumHomePage
|
||||
? Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: Colors.grey,
|
||||
width: 0.4,
|
||||
)),
|
||||
),
|
||||
margin: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Stack(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/lakum/lakum_card_front_bg.png",
|
||||
fit: BoxFit.fill,
|
||||
width: widget.mediaQuery.size.width * 1.0,
|
||||
height: widget.mediaQuery.size.width * 1.0,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.fromLTRB(12, 70, 12, 4),
|
||||
child: widget.model.convertBase64ToBarCodeImage() !=
|
||||
null
|
||||
? Image.memory(
|
||||
widget.model.convertBase64ToBarCodeImage())
|
||||
: Container(),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
],
|
||||
),
|
||||
widget.isLacumHomePage
|
||||
? Positioned(
|
||||
bottom: 1,
|
||||
left: 1,
|
||||
right: 1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: _current == 0 ? 12.0 : 8.0,
|
||||
height: 4.0,
|
||||
margin: EdgeInsets.symmetric(
|
||||
vertical: 0.0, horizontal: 2.0),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
color: _current == 0
|
||||
? Color(0xff5ab145)
|
||||
: Color.fromRGBO(0, 0, 0, 0.4),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: _current == 1 ? 12.0 : 8.0,
|
||||
height: 4.0,
|
||||
margin: EdgeInsets.symmetric(
|
||||
vertical: 0.0, horizontal: 2.0),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
color: _current == 1
|
||||
? Color(0xff5ab145)
|
||||
: Color.fromRGBO(0, 0, 0, 0.4),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LakumPointTableRowWidget extends StatefulWidget {
|
||||
final bool isTableTitle; // true : title , false: row
|
||||
final String tableType; // month, day
|
||||
final double points;
|
||||
final double riyal;
|
||||
final Function onTap;
|
||||
final int rowIndex;
|
||||
|
||||
LakumPointTableRowWidget(
|
||||
this.isTableTitle, this.tableType, this.points, this.riyal, this.onTap, this.rowIndex);
|
||||
|
||||
@override
|
||||
_LakumPointTableRowWidgetState createState() =>
|
||||
_LakumPointTableRowWidgetState();
|
||||
}
|
||||
|
||||
class _LakumPointTableRowWidgetState extends State<LakumPointTableRowWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bool isEven = widget.rowIndex % 2 == 0;
|
||||
return Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 1,
|
||||
thickness: 2,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
import 'package:diplomaticquarterapp/models/id-name-pair.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// AppToast.showErrorToast(message: "Please select Time Slot to continue");
|
||||
|
||||
class RadioGroupDialog extends StatefulWidget {
|
||||
|
||||
final BuildContext context;
|
||||
final title;
|
||||
final List<IdNamePair> list;
|
||||
final okText;
|
||||
final cancelText;
|
||||
final Function(IdNamePair) okFunction;
|
||||
final Function cancelFunction;
|
||||
IdNamePair selectedValue;
|
||||
|
||||
RadioGroupDialog(
|
||||
{@required this.context,
|
||||
@required this.title,
|
||||
@required this.list,
|
||||
@required this.okText,
|
||||
@required this.cancelText,
|
||||
@required this.okFunction,
|
||||
@required this.cancelFunction});
|
||||
|
||||
|
||||
@override
|
||||
RadioGroupState createState() => RadioGroupState();
|
||||
}
|
||||
|
||||
class RadioGroupState extends State<RadioGroupDialog> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
widget.selectedValue = widget.selectedValue ?? widget.list[0];
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return showAlertDialog(context);
|
||||
}
|
||||
|
||||
showAlertDialog(BuildContext context) {
|
||||
// set up the buttons
|
||||
Widget cancelButton = FlatButton(
|
||||
child: Text(this.widget.cancelText),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
Widget continueButton =
|
||||
FlatButton(child: Text(this.widget.okText), onPressed: () {
|
||||
this.widget.okFunction(widget.selectedValue);
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
|
||||
// set up the AlertDialog
|
||||
AlertDialog alert = AlertDialog(
|
||||
title: Text(widget.title),
|
||||
content: createDialogGroup(),
|
||||
actions: [
|
||||
cancelButton,
|
||||
continueButton,
|
||||
],
|
||||
);
|
||||
return alert;
|
||||
}
|
||||
|
||||
static closeAlertDialog(BuildContext context) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
Widget createDialogGroup(){
|
||||
return Container(
|
||||
height: MediaQuery.of(context).size.height * 0.3,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Column(
|
||||
children:
|
||||
widget.list.map((data) => RadioListTile(
|
||||
title: Text("${data.name}"),
|
||||
groupValue: widget.selectedValue.id,
|
||||
value: data.id,
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
widget.selectedValue = data ;
|
||||
});
|
||||
},
|
||||
)).toList(),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|