Merge branch 'pharmacy_module_feature_home_page' into 'pharmacy'

commit

See merge request Cloud_Solution/diplomatic-quarter!153
merge-requests/176/head
haroon amjad 4 years ago
commit a85ef855f5

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 737 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

@ -356,6 +356,8 @@ const GET_E_REFERRALS = "Services/Patients.svc/REST/GetEReferrals";
// const GET_WISHLIST = "http://swd-pharapp-01:7200/api/shopping_cart_items/";
// pharmacy
const PHARMACY_VERIFY_CUSTOMER = "epharmacy/api/VerifyCustomer";
const PHARMACY_CREATE_CUSTOMER = "epharmacy/api/CreateCustomer";
const GET_PHARMACY_BANNER = "epharmacy/api/promotionbanners";
const GET_PHARMACY_TOP_MANUFACTURER = "epharmacy/api/topmanufacturer";
const GET_PHARMACY_BEST_SELLER_PRODUCT = "epharmacy/api/bestsellerproducts";
@ -365,6 +367,19 @@ const GET_WISHLIST = "epharmacy/api/shopping_cart_items/";
const GET_ORDER = "orders?";
const GET_ORDER_DETAILS = "epharmacy/api/orders/";
const GET_ADDRESS = "epharmacy/api/Customers/272843?fields=addresses";
const GET_SHOPPING_CART = "epharmacy/api/shopping_cart_items/";
const GET_SHIPPING_OPTIONS = "epharmacy/api/get_shipping_option/";
const DELETE_SHOPPING_CART = "epharmacy/api/delete_shopping_cart_items/";
const DELETE_SHOPPING_CART_ALL = "epharmacy/api/delete_shopping_cart_item_by_customer/";
const ORDER_SHOPPING_CART = "epharmacy/api/orders";
const GET_LACUM_ACCOUNT_INFORMATION = "Services/Patients.svc/REST/GetLakumAccountInformation";
const GET_LACUM_GROUP_INFORMATION = "Services/Patients.svc/REST/GetlakumInQueryInfoGrouping";
const LACUM_ACCOUNT_ACTIVATE = "Services/Patients.svc/REST/LakumAccountActivation";
const LACUM_ACCOUNT_DEACTIVATE = "Services/Patients.svc/REST/LakumAccountDeactivation";
const CREATE_LAKUM_ACCOUNT = "Services/Patients.svc/REST/PHR_CreateLakumAccount";
const TRANSFER_YAHALA_LOYALITY_POINTS = "Services/Patients.svc/REST/TransferYaHalaLoyaltyPoints";
const LAKUM_GET_USER_TERMS_AND_CONDITIONS = "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy";
// Home Health Care
const HHC_GET_ALL_SERVICES =
"Services/Patients.svc/REST/PatientER_HHC_GetAllServices";

@ -646,7 +646,6 @@ const Map localizedValues = {
"shippingAddresses": {"en": "Shipping Addresses", "ar": "عناوين الشحن"},
"reachUs": {"en": "Reach Us", "ar": "الوصول لنا"},
"ourLocations": {"en": "Our Locations", "ar": "مواقعنا"},
"changeAddress": {"en": "Change Address", "ar": "تغيير العنوان"},
"edit": {"en": "Edit", "ar": "تعديل"},
"delete": {"en": "Delete", "ar": " حذف"},
"addAddress": {"en": "ADD A NEW ADDRESS", "ar": " اضافة عنوان جديد"},
@ -671,14 +670,12 @@ const Map localizedValues = {
"en": "Your reviews help other to choose better product",
"ar": " تقييمك سوف يساعد الأخرين في اختيار المنتج الأفضل"
},
"shippingAddress": {"en": "SHIPPING ADDRESS", "ar": " عنوان الشحن"},
"shippedMethod": {"en": "SHIP BY:", "ar": " الشحن بواسطة:"},
"orderDetail": {"en": "Order Detail", "ar": " تفاصيل الطلب"},
"orderSummary": {"en": "Order Summary", "ar": " تفاصيل المنتج"},
"subtotal": {"en": "Subtotal", "ar": " المجموع"},
"shipping": {"en": "Shipping", "ar": " الشحن"},
"vat": {"en": "VAT (15%)", "ar": "(15%) القيمة المضافة"},
"total": {"en": "TOTAL", "ar": " المجموع الكلي"},
"sar": {"en": "SAR", "ar": " ر.س "},
"payOnline": {"en": "PAY ONLINE", "ar": "اتمام عملية الدفع "},
"cancelOrder": {"en": "CANCEL ORDER", "ar": "الغاء الطلب "},
@ -751,10 +748,93 @@ const Map localizedValues = {
"en": "SEARCH & SCAN FOR MEDICATION",
"ar": "البحث والمسح للأدوية"
},
"shopByBrands": {"en": "Shop By Brands", "ar": "تسوق حسب الماركات"},
"recentlyViewed": {"en": "Recently Viewed", "ar": "شوهدت مؤخرا"},
"bestSellers": {"en": "Best Sellers", "ar": "أفضل البائعين"},
"deleteAllItems": {"en": "Delete All Items", "ar": "حذف كافة العناصر"},
"shopByBrands": {
"en": "Shop By Brands",
"ar": "تسوق حسب الماركات"
},
"recentlyViewed": {
"en": "Recently Viewed",
"ar": "شوهدت مؤخرا"
},
"bestSellers": {
"en": "Best Sellers",
"ar": "أفضل البائعين"
},
"deleteAllItems": {
"en": "Delete All Items",
"ar": "حذف كافة العناصر"
},
"total": {
"en": "Total",
"ar": "المجموع"
},
"selectAddress": {
"en": "Select Address",
"ar": "حدد العنوان"
},
"shippingAddress": {
"en": "SHIPPING ADDRESS",
"ar": "عنوان الشحن"
},
"changeAddress": {
"en": "Change Address",
"ar": "تغيير العنوان"
},
"selectPaymentOption": {
"en": "Select Payment Option",
"ar": "حدد خيار الدفع"
},
"changeMethod": {
"en": "Change Method",
"ar": "تغيير خيار الدفع"
},
"reviewOrder": {
"en": "Review Order",
"ar": "مراجعة الطلب"
},
"active": {
"en": "ACTIVE",
"ar": "فعال"
},
"inactive": {
"en": "INACTIVE",
"ar": "غير فعال"
},
"balance": {
"en": "BALANCE",
"ar": "الحالي"
},
"gained": {
"en": "GAINED",
"ar": "المكتسب"
},
"consumed": {
"en": "CONSUMED",
"ar": "المستهلك"
},
"transferred": {
"en": "TRANSFERRED",
"ar": "المحول"
},
"checkBeneficiary": {
"en": "CHECK BENEFICIARY",
"ar": "تحقق من المستفيد"
},
"beneficiaryName": {
"en": "Beneficiary Name",
"ar": "اسم المستفيد"
},
"accountActivation": {
"en": "Account Activation",
"ar": "تفعيل الحساب"
},
"acceptLbl": {
"en": "Accept",
"ar": "موافقة"
},
"select-gender": {"en": "Select Gender", "ar": "اختر الجنس"},
"i-am-a": {"en": "I am a ...", "ar": "أنا ..."},
"select-age": {"en": "Select Your Age", "ar": "حدد العمر"},
@ -1201,5 +1281,9 @@ const Map localizedValues = {
"en": "The referral request has been submitted successfully, you will be contacted ASAP to complete the process. Referral request no is ",
"ar": " تم إرسال طلب الإحالة بنجاح ، وسيتم الاتصال بك في أسرع وقت ممكن لإكمال العملية. رقم طلب الإحالة"
},
"Year": {"en": "YEAR", "ar": "السنة"},
"Month": {"en": "MONTH", "ar": "الشهر"},
"point": {"en": "POINT", "ar": "النقاط"},
"riyal": {"en": "RIYAL", "ar": "الريال"},
};

@ -20,3 +20,4 @@ const IS_VIBRATION = 'is_vibration';
const THEME_VALUE = 'is_vibration';
const MAIN_USER = 'main-user';
const PHARMACY_LAST_VISITED_PRODUCTS = 'last-visited';
const PHARMACY_CUSTOMER_ID = 'costumer-id';

@ -17,6 +17,7 @@ class Addresses {
String createdOnUtc;
String province;
String latLong;
bool isChecked;
Addresses(
{this.id,
@ -36,7 +37,8 @@ class Addresses {
this.customerAttributes,
this.createdOnUtc,
this.province,
this.latLong});
this.latLong,
this.isChecked = false});
Addresses.fromJson(Map<String, dynamic> json) {
id = json['id'];
@ -57,6 +59,7 @@ class Addresses {
createdOnUtc = json['created_on_utc'];
province = json['province'];
latLong = json['lat_long'];
isChecked = json['isChecked'];
}
Map<String, dynamic> toJson() {
@ -79,6 +82,7 @@ class Addresses {
data['created_on_utc'] = this.createdOnUtc;
data['province'] = this.province;
data['lat_long'] = this.latLong;
data['isChecked'] = this.isChecked;
return data;
}

@ -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;
}
}

@ -1,4 +1,10 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/BillingAddress.dart';
class Customer {
BillingAddress billingAddress;
BillingAddress shippingAddress;
List<Addresses> addresses;
String fileNumber;
String iqamaNumber;
int isOutSa;
@ -8,8 +14,6 @@ class Customer {
String phone;
String countryCode;
String yahalaAccountno;
String billingAddress;
String shippingAddress;
String id;
String username;
String email;
@ -17,20 +21,23 @@ class Customer {
String lastName;
String languageId;
String adminComment;
String isTaxExempt;
String hasShoppingCartItems;
String active;
String deleted;
String isSystemAccount;
bool isTaxExempt;
bool hasShoppingCartItems;
bool active;
bool deleted;
bool isSystemAccount;
String systemName;
String lastIpAddress;
String createdOnUtc;
String lastLoginDateUtc;
String lastActivityDateUtc;
String registeredInStoreId;
int registeredInStoreId;
Customer(
{this.fileNumber,
{this.billingAddress,
this.shippingAddress,
this.addresses,
this.fileNumber,
this.iqamaNumber,
this.isOutSa,
this.patientType,
@ -39,8 +46,6 @@ class Customer {
this.phone,
this.countryCode,
this.yahalaAccountno,
this.billingAddress,
this.shippingAddress,
this.id,
this.username,
this.email,
@ -61,6 +66,18 @@ class Customer {
this.registeredInStoreId});
Customer.fromJson(Map<String, dynamic> json) {
billingAddress = json['billing_address'] != null
? new BillingAddress.fromJson(json['billing_address'])
: null;
shippingAddress = json['shipping_address'] != null
? new BillingAddress.fromJson(json['shipping_address'])
: null;
if (json['addresses'] != null) {
addresses = new List<Addresses>();
json['addresses'].forEach((v) {
addresses.add(new Addresses.fromJson(v));
});
}
fileNumber = json['file_number'];
iqamaNumber = json['iqama_number'];
isOutSa = json['is_out_sa'];
@ -70,8 +87,6 @@ class Customer {
phone = json['phone'];
countryCode = json['country_code'];
yahalaAccountno = json['yahala_accountno'];
billingAddress = json['billing_address'];
shippingAddress = json['shipping_address'];
id = json['id'];
username = json['username'];
email = json['email'];
@ -94,6 +109,15 @@ class Customer {
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.billingAddress != null) {
data['billing_address'] = this.billingAddress.toJson();
}
if (this.shippingAddress != null) {
data['shipping_address'] = this.shippingAddress.toJson();
}
if (this.addresses != null) {
data['addresses'] = this.addresses.map((v) => v.toJson()).toList();
}
data['file_number'] = this.fileNumber;
data['iqama_number'] = this.iqamaNumber;
data['is_out_sa'] = this.isOutSa;
@ -103,8 +127,6 @@ class Customer {
data['phone'] = this.phone;
data['country_code'] = this.countryCode;
data['yahala_accountno'] = this.yahalaAccountno;
data['billing_address'] = this.billingAddress;
data['shipping_address'] = this.shippingAddress;
data['id'] = this.id;
data['username'] = this.username;
data['email'] = this.email;

File diff suppressed because it is too large Load Diff

@ -0,0 +1,179 @@
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;
int 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'];
if (json['ConsumedPointsAmountPerYear'] != null) {
consumedPointsAmountPerYear = new List<PointsAmountPerYear>();
json['ConsumedPointsAmountPerYear'].forEach((v) {
consumedPointsAmountPerYear.add(PointsAmountPerYear.fromJson(v));
});
}
if (json['ConsumedPointsDetails'] != null) {
consumedPointsDetails = new List<PointsDetails>();
json['ConsumedPointsDetails'].forEach((v) {
consumedPointsDetails.add(PointsDetails.fromJson(v));
});
}
createdDate = json['CreatedDate'];
expiredPoints = json['ExpiredPoints'];
expiryDate = json['ExpiryDate'];
gainedPoints = json['GainedPoints'];
if (json['GainedPointsAmountPerYear'] != null) {
gainedPointsAmountPerYear = new List<PointsAmountPerYear>();
json['GainedPointsAmountPerYear'].forEach((v) {
gainedPointsAmountPerYear.add(PointsAmountPerYear.fromJson(v));
});
}
if (json['GainedPointsDetails'] != null) {
gainedPointsDetails = new List<PointsDetails>();
json['GainedPointsDetails'].forEach((v) {
gainedPointsDetails.add(PointsDetails.fromJson(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'];
if (json['TransferPointsAmountPerYear'] != null) {
transferPointsAmountPerYear = new List<PointsAmountPerYear>();
json['TransferPointsAmountPerYear'].forEach((v) {
transferPointsAmountPerYear.add(PointsAmountPerYear.fromJson(v));
});
}
if (json['TransferPointsDetails'] != null) {
transferPointsDetails = new List<PointsDetails>();
json['TransferPointsDetails'].forEach((v) {
transferPointsDetails.add(PointsDetails.fromJson(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;
if (this.consumedPointsAmountPerYear != null) {
data['ConsumedPointsAmountPerYear'] =
this.consumedPointsAmountPerYear.map((v) => v).toList();
}
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;
if (this.gainedPointsAmountPerYear != null) {
data['GainedPointsAmountPerYear'] =
this.gainedPointsAmountPerYear.map((v) => v).toList();
}
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;
if (this.transferPointsAmountPerYear != null) {
data['TransferPointsAmountPerYear'] =
this.transferPointsAmountPerYear.map((v) => v).toList();
}
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,96 +1,360 @@
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'];
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) {
@ -103,47 +367,172 @@ class PharmacyProduct {
images.add(new PharmacyImageObject.fromJson(v));
});
}
} catch (e) {
print(e);
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 {
int amountPerYear;
List<PointsAmountPerMonth> pointsAmountPerMonth;
int 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,57 @@
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'];
var purchasePoints = json['PurchasePoints'];
if(purchasePoints is int){
this.purchasePoints = (purchasePoints).roundToDouble();
}else {
this.purchasePoints = 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();
}
}

@ -145,10 +145,15 @@ class BaseAppClient {
onSuccess(parsed, statusCode);
} else if (parsed['Result'] == 'OK') {
onSuccess(parsed, statusCode);
} else {
if (parsed != null) {
onSuccess(parsed, statusCode);
} else {
onFailure(
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
logout();
}
}
} else if (parsed['MessageStatus'] == 1 ||
parsed['SMSLoginRequired'] == true) {
@ -160,6 +165,9 @@ class BaseAppClient {
} else {
if (parsed['SameClinicApptList'] != null) {
onSuccess(parsed, statusCode);
} else {
if (parsed['message'] != null) {
onFailure(parsed['message'] ?? parsed['message'], statusCode);
} else {
onFailure(
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
@ -168,6 +176,7 @@ class BaseAppClient {
}
}
}
}
} else {
onFailure('Please Check The Internet Connection', -1);
}

@ -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,133 @@
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}";
body['IsDetailsRequired'] = true;
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,6 +1,11 @@
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 {
bool isFinished = true;
@ -8,11 +13,15 @@ class OrderPreviewService extends BaseService{
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) {
@ -21,9 +30,219 @@ class OrderPreviewService extends BaseService{
}, 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 "";
}
}
}

@ -4,8 +4,10 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
class PharmacyModuleService extends BaseService {
final AppSharedPreferences sharedPref = AppSharedPreferences();
bool isFinished = true;
bool hasError = false;
String errorMsg = '';
@ -15,6 +17,56 @@ class PharmacyModuleService extends BaseService {
List<PharmacyProduct> bestSellerProducts = List();
List<PharmacyProduct> lastVisitedProducts = List();
Future makeVerifyCustomer() async {
var data = await sharedPref.getObject(USER_PROFILE);
Map<String, String> queryParams = {'FileNumber': data['PatientID'].toString()};
hasError = false;
try {
await baseAppClient.get(PHARMACY_VERIFY_CUSTOMER,
onSuccess: (dynamic response, int statusCode) {
if (response['UserName'] != null) {
sharedPref.setString(PHARMACY_CUSTOMER_ID, response['CustomerId'].toString());
print(response);
} else {
createUser();
}
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, queryParams: queryParams);
} catch (error) {
throw error;
}
}
Future createUser() async {
var data = await sharedPref.getObject(USER_PROFILE);
var languageID = await sharedPref.getString(APP_LANGUAGE);
Map<String, String> queryParams = {
'Phone': data['MobileNumber'],
'Email': data['EmailAddress'],
'FileNumber': data['PatientID'].toString(),
'Language': languageID.toString(),
'Gender': data['Gender'].toString(),
'FirstName': data['FirstName'],
'LastName': data['LastName'],
'LanguageId': languageID.toString(),
'CountryCode': data['ZipCode'],
};
hasError = false;
try {
await baseAppClient.get(PHARMACY_CREATE_CUSTOMER,
onSuccess: (dynamic response, int statusCode) {
if (!response['IsRegistered']) {}
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, queryParams: queryParams);
} catch (error) {
throw error;
}
}
Future getBannerListList() async {
hasError = false;
try {
@ -40,7 +92,10 @@ class PharmacyModuleService extends BaseService {
onSuccess: (dynamic response, int statusCode) {
manufacturerList.clear();
response['manufacturer'].forEach((item) {
Manufacturer manufacturer = Manufacturer.fromJson(item);
if(manufacturer.image != null){
manufacturerList.add(Manufacturer.fromJson(item));
}
});
}, onFailure: (String error, int statusCode) {
hasError = true;

@ -1,3 +1,11 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShippingOption.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart';
import '../../../locator.dart';
@ -5,4 +13,183 @@ import '../base_view_model.dart';
class OrderPreviewViewModel extends BaseViewModel {
OrderPreviewService _orderService = locator<OrderPreviewService>();
List<Addresses> get addresses => _orderService.addresses;
LacumAccountInformation get lacumInformation =>
_orderService.lacumInformation;
ShoppingCartResponse cartResponse = ShoppingCartResponse();
PaymentCheckoutData paymentCheckoutData = PaymentCheckoutData();
double totalAdditionalShippingCharge = 0;
Future getOrderPreviewData() async {
setState(ViewState.Busy);
await _orderService.getAddresses();
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
} else {
getShoppingCart();
}
}
getShoppingCart() async {
setState(ViewState.Busy);
await _orderService.getShoppingCart().then((res) {
_handleGetShoppingCartResponse(res);
});
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
} else {
if (paymentCheckoutData != null) {
paymentCheckoutData.cartDataVisible = true;
}
setState(ViewState.Idle);
}
}
changeProductQuantity(ShoppingCart product) async {
setState(ViewState.Busy);
await _orderService.changeProductQuantity(product.id, product).then((res) {
_handleGetShoppingCartResponse(res);
});
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
deleteProduct(ShoppingCart product) async {
setState(ViewState.Busy);
await _orderService.deleteProduct(product.id).then((res) {
_handleGetShoppingCartResponse(res);
});
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
deleteShoppingCart() async {
setState(ViewState.Busy);
await _orderService.deleteShoppingCart().then((res) {
_handleGetShoppingCartResponse(res);
});
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
_handleGetShoppingCartResponse(Map res) {
totalAdditionalShippingCharge = 0;
if (res == null) {
error = "response is null";
setState(ViewState.Error);
return;
}
print(res);
cartResponse.itemCount = res["item_count"];
cartResponse.quantityCount = res["quantity_count"];
cartResponse.subtotal = res["subtotal"];
cartResponse.subtotalWithVat = res["subtotal_with_vat"];
cartResponse.subtotalVatAmount = res["subtotal_vat_amount"];
cartResponse.subtotalVatRate = res["subtotal_vat_rate"];
cartResponse.shoppingCarts = List();
res["shopping_carts"].forEach((item) {
ShoppingCart shoppingCart = ShoppingCart.fromJson(item);
cartResponse.shoppingCarts.add(shoppingCart);
totalAdditionalShippingCharge += shoppingCart.product.additionalShippingCharge;
});
cartResponse.updateShoppingCard();
}
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 "";
}
}
String getPaymentOptionName(PaymentOption paymentOption) {
return _orderService.getPaymentOptionName(paymentOption);
}
getInformationsByAddress() async {
await getLacumAccountInformation();
await getShippingOption();
}
getLacumAccountInformation() async {
setState(ViewState.Busy);
await _orderService.getLacumAccountInformation();
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
} else {
getLacumGroupData();
}
}
Future getLacumGroupData() async {
setState(ViewState.Busy);
await _orderService.getLacumGroupInformation();
paymentCheckoutData.lacumInformation = _orderService.lacumGroupInformation;
paymentCheckoutData.usedLakumPoints = paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount;
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
getShippingOption() async {
setState(ViewState.Busy);
await _orderService.getShippingOption(paymentCheckoutData.address).then((res) {
paymentCheckoutData.shippingOption = ShippingOption.fromJson(res);
paymentCheckoutData.updateData();
});
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
Future makeOrder() async {
setState(ViewState.Busy);
await _orderService.makeOrder(paymentCheckoutData, cartResponse.shoppingCarts);
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
}
enum PaymentOption { meda, sadad, visa, mastercard, installments }

@ -0,0 +1,55 @@
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 checkLacumAccountActivation(String patientIdentificationNo) async {
setState(ViewState.Busy);
await _lacumService.getLacumAccountInformationById(patientIdentificationNo);
if (_lacumService.hasError) {
error = _lacumService.error;
setState(ViewState.Error);
} else {
if(_lacumService.lacumInformation.yahalaAccountNo != 0){
error = "The account has already been activated";
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
}
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;
}
}

@ -1,3 +1,4 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart';
@ -22,6 +23,12 @@ class PharmacyModuleViewModel extends BaseViewModel {
Future getPharmacyHomeData() async {
setState(ViewState.Busy);
await _pharmacyService.makeVerifyCustomer();
// here must call getShoppingCard()
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
await _pharmacyService.getBannerListList();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
@ -30,6 +37,7 @@ class PharmacyModuleViewModel extends BaseViewModel {
_getTopManufacturerList();
}
}
}
List<String> getBannerImagesUrl() {
List<String> images = List();
@ -47,6 +55,7 @@ class PharmacyModuleViewModel extends BaseViewModel {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
_getBestSellerProducts();
}
}
@ -70,4 +79,18 @@ class PharmacyModuleViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
}
Future<bool> checkUserIsActivated() async {
if (authenticatedUserObject.isLogin) {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
if (customerId != null) {
return true;
} else {
return false;
}
} else {
// go to login page
return false;
}
}
}

@ -46,6 +46,9 @@ import 'core/service/medical/prescriptions_service.dart';
import 'core/service/medical/radiology_service.dart';
import 'core/service/medical/reports_monthly_service.dart';
import 'core/service/medical/vital_sign_service.dart';
import 'core/service/parmacyModule/lacum-registration-service.dart';
import 'core/service/parmacyModule/lacum-service.dart';
import 'core/service/parmacyModule/lacum-transfer-service.dart';
import 'core/service/parmacyModule/order-preview-service.dart';
import 'core/service/notifications_service.dart';
import 'core/viewModels/AlHabibMedicalService/cmc_view_model.dart';
@ -88,6 +91,9 @@ import 'core/service/pharmacies_service.dart';
import 'core/service/insurance_service.dart';
import 'core/viewModels/insurance_card_View_model.dart';
import 'core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'core/viewModels/pharmacyModule/lacum-registration-viewModel.dart';
import 'core/viewModels/pharmacyModule/lacum-trasnfer-viewModel.dart';
import 'core/viewModels/pharmacyModule/lacum-viewmodel.dart';
import 'core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'core/viewModels/qr_view_model.dart';
import 'core/viewModels/vaccine_view_model.dart';
@ -145,6 +151,9 @@ void setupLocator() {
locator.registerLazySingleton(() => NotificationService());
locator.registerLazySingleton(() => PharmacyModuleService());
locator.registerLazySingleton(() => OrderPreviewService());
locator.registerLazySingleton(() => LacumService());
locator.registerLazySingleton(() => LacumTransferService());
locator.registerLazySingleton(() => LacumRegistrationService());
locator.registerLazySingleton(() => OrderService());
locator.registerLazySingleton(() => PharmacyAddressService());
locator.registerLazySingleton(() => OrderDetailsService());
@ -198,4 +207,8 @@ void setupLocator() {
locator.registerFactory(() => PharmacyModuleViewModel());
locator.registerFactory(() => OrderPreviewViewModel());
locator.registerFactory(() => LacumViewModel());
locator.registerFactory(() => LacumTranferViewModel());
locator.registerFactory(() => LacumRegistrationViewModel());
}

@ -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();
}
}

@ -489,7 +489,7 @@ class _HomePageState extends State<HomePage> {
),
DashboardItem(
onTap: () => Navigator.push(
context, FadePage(page: OrderPage())),
context, FadePage(page: PharmacyPage())),
child: Center(
child: Padding(

@ -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,101 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
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((_) => {
if (model.state == ViewState.Idle)
{
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.green,
),
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,555 @@
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,
isPharmacy: 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.green,
),
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,271 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PointsAmountPerMonth.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/lakum-point-table-row-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:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class LakumPointMonthPage extends StatefulWidget {
final PointsAmountPerMonth pointsAmountPerMonth;
final int year;
int expandedItemIndex = -1;
LakumPointMonthPage(this.pointsAmountPerMonth, this.year);
@override
_LakumPointsMonthPageState createState() => _LakumPointsMonthPageState();
}
class _LakumPointsMonthPageState extends State<LakumPointMonthPage> {
@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: mediaQuery.size.height * 0.25,
child: Stack(
children: [
Image.asset(
"assets/images/pharmacy_module/lakum/lakum_card_front_bg.png",
fit: BoxFit.fill,
width: mediaQuery.size.width * 1.0,
),
Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Container(
height: mediaQuery.size.height * 0.06,
margin: EdgeInsets.symmetric(
vertical: 16, horizontal: 24),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context).month,
color: Colors.grey.shade600,
fontSize: 16,
),
Texts(
"${widget.pointsAmountPerMonth.month}, ${widget.year}",
color: Colors.grey.shade700,
fontWeight: FontWeight.bold,
fontSize: 16,
),
],
),
),
Expanded(
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
Expanded(
child: Column(
mainAxisAlignment:
MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Texts(
TranslationBase.of(context).point,
color: Colors.grey.shade600,
fontSize: 16,
),
Texts(
"${widget.pointsAmountPerMonth.pointsPerMonth}",
color: Colors.grey.shade700,
fontWeight: FontWeight.bold,
fontSize: 16,
),
],
),
),
SizedBox(
child: Container(
color: Colors.grey,
),
width: 1,
),
Expanded(
child: Column(
mainAxisAlignment:
MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Texts(
TranslationBase.of(context).riyal,
color: Colors.grey.shade600,
fontSize: 16,
),
Texts(
"${widget.pointsAmountPerMonth.amountPerMonth}",
color: Colors.grey.shade700,
fontWeight: FontWeight.bold,
fontSize: 16,
),
],
),
),
],
),
),
],
),
),
],
),
],
),
),
SizedBox(
height: 10,
),
LakumPointTableRowWidget(true, "DAY", 0, 0, null, 0),
...List.generate(
widget.pointsAmountPerMonth.pointsAmountPerday.length,
(index) => LakumPointTableRowWidget(
false,
widget.pointsAmountPerMonth.pointsAmountPerday[index].day,
widget.pointsAmountPerMonth.pointsAmountPerday[index]
.pointsPerDay,
widget.pointsAmountPerMonth.pointsAmountPerday[index]
.amountPerDay,
() {
setState(() {
if (widget.expandedItemIndex == index) {
widget.expandedItemIndex = -1;
} else {
widget.expandedItemIndex = index;
}
});
},
index,
expandFlag: widget.expandedItemIndex == index,
collapsed: Column(
children: [
...List.generate(
widget.pointsAmountPerMonth.pointsAmountPerday[index]
.pointsDetails.length,
(index) => DayPointsDetailWidget(
widget
.pointsAmountPerMonth
.pointsAmountPerday[index]
.pointsDetails[index]
.subTransactionTypeDescription,
widget
.pointsAmountPerMonth
.pointsAmountPerday[index]
.pointsDetails[index].purchasePoints,
widget
.pointsAmountPerMonth
.pointsAmountPerday[index]
.pointsDetails[index].amount),
),
],
),
),
),
],
),
),
),
),
);
}
}
class DayPointsDetailWidget extends StatelessWidget {
final String rowTitle;
final double points;
final double riyal;
DayPointsDetailWidget(this.rowTitle, this.points, this.riyal);
@override
Widget build(BuildContext context) {
return Container(
color: Color(0xffe4e4e4),
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 12),
child: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Row(
children: [
Expanded(
child: Container(
child: Column(
children: [
Texts(
"TYPE",
fontSize: 12,
fontWeight: FontWeight.bold,
),
SizedBox(
height: 4,
),
Texts(
rowTitle,
fontSize: 14,
fontWeight: FontWeight.normal,
),
],
crossAxisAlignment: CrossAxisAlignment.start,
),
)),
Expanded(
child: Container(
child: Texts(
"$points",
fontSize: 14,
fontWeight: FontWeight.normal,
),
)),
Expanded(
child: Container(
child: Texts(
"$riyal",
fontSize: 14,
fontWeight: FontWeight.normal,
),
)),
Expanded(child: Container()),
],
),
),
const Divider(
color: Color(0xFFD6D6D6),
height: 1,
thickness: 1,
indent: 0,
endIndent: 0,
),
],
),
);
}
}

@ -0,0 +1,201 @@
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/widgets/lakum-point-table-row-widget.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 'lakum-points-month-page.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, vertical: 16),
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
...List.generate(
widget.pointsAmountPerYear.length,
(index) => LacumPointsYearWidget(
mediaQuery,
widget.selectedIndexYear == index,
widget.pointsAmountPerYear[index], () {
setState(() {
widget.selectedIndexYear = index;
});
})),
],
),
),
SizedBox(
height: 0,
),
LakumPointTableRowWidget(true, "MONTH", 0, 0, null, 0),
...List.generate(
widget.pointsAmountPerYear[widget.selectedIndexYear]
.pointsAmountPerMonth.length,
(index) => LakumPointTableRowWidget(
false,
widget.pointsAmountPerYear[widget.selectedIndexYear]
.pointsAmountPerMonth[index].month,
widget.pointsAmountPerYear[widget.selectedIndexYear]
.pointsAmountPerMonth[index].pointsPerMonth,
widget.pointsAmountPerYear[widget.selectedIndexYear]
.pointsAmountPerMonth[index].amountPerMonth,
(){
Navigator.push(context,
FadePage(page: LakumPointMonthPage(widget.pointsAmountPerYear[widget.selectedIndexYear]
.pointsAmountPerMonth[index], widget.pointsAmountPerYear[widget.selectedIndexYear].year)));
},
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.center,
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 "";
}
}
}

@ -2,7 +2,8 @@ import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/landing/home_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/order-preview-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/BannerPager.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductTileItem.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/manufacturerItem.dart';
@ -13,12 +14,12 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
class PharmacyPage extends StatelessWidget {
import 'lacum-activitaion-vida-page.dart';
class PharmacyPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BaseView<PharmacyModuleViewModel>(
// onModelReady: (model) => model.getPharmacyHomeData(),
onModelReady: (model) => model.getPharmacyHomeData(),
builder: (_, model, wi) => AppScaffold(
title: "",
@ -33,8 +34,7 @@ class PharmacyPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
BannerPager(model),
GridViewButtons(),
/*BannerPager(model.getBannerImagesUrl()),*/
GridViewButtons(model),
Container(
margin: EdgeInsets.fromLTRB(10, 0, 10, 0),
child: Row(
@ -48,8 +48,9 @@ class PharmacyPage extends StatelessWidget {
TranslationBase.of(context).viewAll,
hasBorder: true,
vPadding: 6,
hPadding: 4,
borderColor: Colors.green,
color: Colors.green,
textColor: Colors.green,
handler: () {},
),
],
@ -77,15 +78,18 @@ class PharmacyPage extends StatelessWidget {
TranslationBase.of(context).viewAll,
hasBorder: true,
vPadding: 6,
hPadding: 4,
borderColor: Colors.green,
color: Colors.green,
textColor: Colors.green,
handler: () {},
),
],
),
),
Container(
height: model.lastVisitedProducts.length > 0 ? MediaQuery.of(context).size.height / 4 : 0,
height: model.lastVisitedProducts.length > 0
? MediaQuery.of(context).size.height / 4 + 20
: 0,
child: ListView.builder(
itemBuilder: (ctx, i) =>
ProductTileItem(model.lastVisitedProducts[i]),
@ -106,15 +110,16 @@ class PharmacyPage extends StatelessWidget {
TranslationBase.of(context).viewAll,
hasBorder: true,
borderColor: Colors.green,
color: Colors.green,
textColor: Colors.green,
vPadding: 6,
hPadding: 4,
handler: () {},
),
],
),
),
Container(
height: MediaQuery.of(context).size.height / 4,
height: MediaQuery.of(context).size.height / 4 + 20,
child: ListView.builder(
itemBuilder: (ctx, i) =>
ProductTileItem(model.bestSellerProduct[i]),
@ -132,6 +137,10 @@ class PharmacyPage extends StatelessWidget {
}
class GridViewButtons extends StatelessWidget {
final PharmacyModuleViewModel model;
GridViewButtons(this.model);
@override
Widget build(BuildContext context) {
final gridHeight = (MediaQuery.of(context).size.width * 0.3) * 1.8;
@ -153,9 +162,8 @@ class GridViewButtons extends StatelessWidget {
opacity: 0.8,
child: GridViewCard(
TranslationBase.of(context).offersAndPromotions,
'assets/images/pharmacy_module/offer_icon.png',
() {
Navigator.push(context, FadePage(page: OrderPreviewPage()));
'assets/images/pharmacy_module/offer_icon.png', () {
Navigator.push(context, FadePage(page: CartOrderPage()));
}),
),
DashboardItem(
@ -163,7 +171,16 @@ class GridViewButtons extends StatelessWidget {
opacity: 0,
hasColorFilter: false,
child: GridViewCard(TranslationBase.of(context).medicationRefill,
'assets/images/pharmacy_module/medication_icon.png', () {}),
'assets/images/pharmacy_module/medication_icon.png', () {
model.checkUserIsActivated().then((isActivated) {
if (isActivated) {
Navigator.push(context, FadePage(page: LakumMainPage()));
} else {
Navigator.push(
context, FadePage(page: LakumActivationVidaPage()));
}
});
}),
),
DashboardItem(
imageName: 'pharmacy_module/bg_3.png',
@ -219,11 +236,16 @@ class GridViewCard extends StatelessWidget {
),
),
),
Expanded(
child: BorderedButton(
Row(
children: [
BorderedButton(
TranslationBase.of(context).viewAll,
handler: handler,
tPadding: 0,
bPadding: 0,
),
Expanded(child: Container()),
],
),
],
),

@ -26,6 +26,7 @@ class _BannerPagerState extends State<BannerPager> {
enlargeCenterPage: true,
enableInfiniteScroll: false,
initialPage: 0,
viewportFraction: 0.8,
autoPlay: true,
autoPlayInterval: Duration(seconds: 3),
autoPlayAnimationDuration: Duration(milliseconds: 800),

@ -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(
ProjectViewModel projectProvider = Provider.of(context);
return Column(
children: [
ListTile(
leading: InkWell(
onTap: () => {widget.deleteCartItems()},
child: Icon(
Icons.delete_outline_sharp,
color: Colors.grey.shade800,
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,
),
],
),
);
}
}

@ -23,6 +23,7 @@ class ProductTileItem extends StatelessWidget {
void _saveLastVisitProducts() async {
String lastVisited = "";
bool isIdExist = false;
// var data = await sharedPref.getObject(USER_PROFILE) ; // data['PatientID']
if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) !=
null) {
lastVisited =
@ -69,10 +70,16 @@ class ProductTileItem extends StatelessWidget {
Container(
margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
alignment: Alignment.center,
child: Image.network(
child: (item.images != null && item.images.length > 0)
? Image.network(
item.images[0].src,
fit: BoxFit.cover,
height: 80,
)
: Image.asset(
"assets/images/no_image.png",
fit: BoxFit.cover,
height: 80,
),
),
Container(
@ -104,7 +111,7 @@ class ProductTileItem extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
projectProvider.isArabic ? item.name : item.namen,
projectProvider.isArabic ? item.namen : item.name,
regular: true,
fontSize: 12,
fontWeight: FontWeight.w400,
@ -119,19 +126,21 @@ class ProductTileItem extends StatelessWidget {
),
Row(
children: [
StarRating(
Expanded(
child: StarRating(
totalAverage: item.approvedTotalReviews > 0
? (item.approvedRatingSum.toDouble() /
item.approvedTotalReviews.toDouble())
.toDouble()
: 0,
forceStars: true),
Texts(
),
/*Texts(
"(${item.approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
)
),*/
],
),
],

@ -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,116 @@
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
import 'package:diplomaticquarterapp/widgets/others/points-expandable-notifier.dart';
import 'package:expandable/expandable.dart';
import 'package:flutter/material.dart';
class LakumPointTableRowWidget extends StatefulWidget {
final bool isTableTitle; // true : title , false: row
final String rowTitle;
final double points;
final double riyal;
final Function onTap;
final int rowIndex;
final Widget collapsed;
final bool expandFlag;
LakumPointTableRowWidget(this.isTableTitle, this.rowTitle, this.points,
this.riyal, this.onTap, this.rowIndex,
{this.collapsed, this.expandFlag = false});
@override
_LakumPointTableRowWidgetState createState() =>
_LakumPointTableRowWidgetState();
}
class _LakumPointTableRowWidgetState extends State<LakumPointTableRowWidget> {
@override
Widget build(BuildContext context) {
return InkWell(
onTap: widget.onTap,
child: Column(
children: <Widget>[
Column(
children: [
widget.collapsed != null
? PointsExpandableNotifier(
headerWidget: buildPointRowBody(),
// bodyWidget: widget.collapsed != null ? widget.collapsed : null,
bodyWidget: widget.collapsed,
isExpand: widget.expandFlag,
)
: buildPointRowBody(),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 1,
thickness: 1,
indent: 0,
endIndent: 0,
),
],
),
);
}
Widget buildPointRowBody() {
bool isEven = widget.rowIndex % 2 == 0;
return Container(
padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
color: widget.expandFlag ? Color(0xffe4e4e4) : isEven && !widget.isTableTitle ? Color(0xffefefef) : Colors.white,
child: Column(
children: [
Row(
children: [
Expanded(
child: Container(
child: Texts(
widget.rowTitle,
fontSize: 14,
fontWeight:
widget.isTableTitle ? FontWeight.bold : FontWeight.normal,
),
)),
Expanded(
child: Container(
child: Texts(
widget.isTableTitle ? "POINTS" : "${widget.points}",
fontSize: 14,
fontWeight:
widget.isTableTitle ? FontWeight.bold : FontWeight.normal,
),
)),
Expanded(
child: Container(
child: Texts(
widget.isTableTitle ? "RIYAL" : "${widget.riyal}",
fontSize: 14,
fontWeight:
widget.isTableTitle ? FontWeight.bold : FontWeight.normal,
),
)),
Expanded(
child: widget.isTableTitle
? Container()
: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Icon(
widget.collapsed == null
? Icons.keyboard_arrow_right
: widget.expandFlag
? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down,
size: 25,
color: Colors.grey.shade700,
),
],
)),
],
),
],
),
);
}
}

@ -310,6 +310,11 @@ class DateUtil {
return "";
}
static String getFormattedDate(DateTime dateTime, String formattedString){
return DateFormat(formattedString)
.format(dateTime);
}
static convertISODateToJsonDate(String isoDate) {
return "/Date(" +
DateFormat('mm-dd-yyy')

@ -710,8 +710,6 @@ String get fileno => localizedValues['fileno'][locale.languageCode];
String get reachUs => localizedValues['reachUs'][locale.languageCode];
String get ourLocations =>
localizedValues['ourLocations'][locale.languageCode];
String get changeAddress =>
localizedValues['changeAddress'][locale.languageCode];
String get edit => localizedValues['edit'][locale.languageCode];
String get delete => localizedValues['delete'][locale.languageCode];
String get addAddress => localizedValues['addAddress'][locale.languageCode];
@ -732,13 +730,9 @@ String get fileno => localizedValues['fileno'][locale.languageCode];
localizedValues['reviewShared'][locale.languageCode];
String get reviewComment =>
localizedValues['reviewComment'][locale.languageCode];
String get shippingAddress =>
localizedValues['shippingAddress'][locale.languageCode];
String get shippedMethod =>
localizedValues['shippedMethod'][locale.languageCode];
String get orderDetail => localizedValues['orderDetail'][locale.languageCode];
String get orderSummary =>
localizedValues['orderSummary'][locale.languageCode];
String get subtotal => localizedValues['subtotal'][locale.languageCode];
String get shipping => localizedValues['shipping'][locale.languageCode];
String get vat => localizedValues['vat'][locale.languageCode];
@ -786,8 +780,24 @@ String get fileno => localizedValues['fileno'][locale.languageCode];
String get recentlyViewed =>
localizedValues['recentlyViewed'][locale.languageCode];
String get bestSellers => localizedValues['bestSellers'][locale.languageCode];
String get deleteAllItems =>
localizedValues['deleteAllItems'][locale.languageCode];
String get deleteAllItems => localizedValues['deleteAllItems'][locale.languageCode];
String get selectAddress => localizedValues['selectAddress'][locale.languageCode];
String get shippingAddress => localizedValues['shippingAddress'][locale.languageCode];
String get changeAddress => localizedValues['changeAddress'][locale.languageCode];
String get selectPaymentOption => localizedValues['selectPaymentOption'][locale.languageCode];
String get changeMethod => localizedValues['changeMethod'][locale.languageCode];
String get reviewOrder => localizedValues['reviewOrder'][locale.languageCode];
String get orderSummary => localizedValues['orderSummary'][locale.languageCode];
String get active => localizedValues['active'][locale.languageCode];
String get inactive => localizedValues['inactive'][locale.languageCode];
String get balance => localizedValues['balance'][locale.languageCode];
String get gained => localizedValues['gained'][locale.languageCode];
String get consumed => localizedValues['consumed'][locale.languageCode];
String get transferred => localizedValues['transferred'][locale.languageCode];
String get checkBeneficiary => localizedValues['checkBeneficiary'][locale.languageCode];
String get beneficiaryName => localizedValues['beneficiaryName'][locale.languageCode];
String get accountActivation => localizedValues['accountActivation'][locale.languageCode];
String get acceptLbl => localizedValues['acceptLbl'][locale.languageCode];
String get termsService =>
localizedValues['TermsService'][locale.languageCode];
@ -967,7 +977,10 @@ String get fileno => localizedValues['fileno'][locale.languageCode];
String get addedChild => localizedValues['added-child'][locale.languageCode];
String get appUpdate => localizedValues['appUpdate'][locale.languageCode];
String get ereferralSaveSuccess => localizedValues['ereferralSaveSuccess'][locale.languageCode];
String get year => localizedValues['Year'][locale.languageCode];
String get month => localizedValues['Month'][locale.languageCode];
String get point => localizedValues['point'][locale.languageCode];
String get riyal => localizedValues['riyal'][locale.languageCode];
}

@ -29,6 +29,7 @@ class _GestureIconButtonState extends State<GestureIconButton> {
setState(() => _buttonLongPress = !_buttonLongPress),
onLongPressEnd: (_) =>
setState(() => _buttonLongPress = !_buttonLongPress),
onTap: () => {widget.onTap()},
child: Wrap(
children: [
Container(

@ -4,55 +4,79 @@ import 'package:flutter/material.dart';
class BorderedButton extends StatelessWidget {
final String text;
final Function handler;
final Color color;
final Color textColor;
final bool hasBorder;
final Color borderColor;
final Color backgroundColor;
final double vPadding;
final double hPadding;
final double radius;
final double lPadding;
final double tPadding;
final double rPadding;
final double bPadding;
final double fontSize;
final Widget icon;
final FontWeight fontWeight;
BorderedButton(
this.text, {
this.handler,
this.color,
this.textColor,
this.hasBorder = false,
this.borderColor,
this.backgroundColor,
this.vPadding = 0,
this.hPadding = 0,
this.radius = 4.0,
this.lPadding = 4.0,
this.tPadding = 0.0,
this.rPadding = 4.0,
this.bPadding = 0.0,
this.fontSize = 0,
this.icon,
this.fontWeight,
});
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 4, vertical: 4),
child: ButtonTheme(
//adds padding inside the button
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
//limits the touch area to the button area
minWidth: 0,
//wraps child's width
height: 0,
//wraps child's height
child: RaisedButton(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
padding: EdgeInsets.symmetric(horizontal: 12, vertical: vPadding),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4.0),
side: BorderSide(color: hasBorder ? borderColor : Colors.white, width: 0.8),),
return GestureDetector(
onTap: () {
handler();
},
child: Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: backgroundColor ?? Colors.white,
textColor: color ?? Color(0xffc4aa54),
disabledTextColor: color ?? Colors.black,
disabledColor: backgroundColor ?? Colors.white,
onPressed: handler,
borderRadius: BorderRadius.circular(radius),
border: Border.fromBorderSide(BorderSide(
color: hasBorder ? borderColor : Colors.white,
width: 0.8,
)),
),
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
icon != null ? icon : Container(),
Container(
padding: (hPadding > 0 || vPadding > 0)
? EdgeInsets.symmetric(
vertical: vPadding, horizontal: hPadding)
: EdgeInsets.fromLTRB(
lPadding, tPadding, rPadding, bPadding),
child: Text(
text,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: SizeConfig.textMultiplier * 1.6,
fontWeight: FontWeight.normal),
fontSize: fontSize == 0 ? SizeConfig.textMultiplier * 1.6 : fontSize,
fontWeight: fontWeight != null ? fontWeight : FontWeight.normal,
color: textColor ?? Color(0xffc4aa54)),
),
),
],
),
),
), //your original button
),
);
}

@ -217,6 +217,7 @@ class _TextsState extends State<Texts> {
: TextOverflow.ellipsis)
: null,
maxLines: widget.maxLines ?? null,
style: widget.style != null
? _getFontStyle().copyWith(
fontStyle: widget.italic ? FontStyle.italic : null,

@ -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(),
),
),
],
),
),
);
}
}

@ -43,6 +43,9 @@ class AppScaffold extends StatelessWidget {
final bool isShowDecPage;
final List<String> infoList;
final Color backgroundColor;
final double preferredSize;
final List<Widget> appBarIcons;
final PreferredSizeWidget appBarWidget;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
@ -60,24 +63,99 @@ class AppScaffold extends StatelessWidget {
this.title,
this.description,
this.isShowDecPage = true,
this.backgroundColor,
this.isBottomBar,
this.backgroundColor,
this.preferredSize = 0.0,
this.appBarIcons,
this.appBarWidget,
this.image,
this.infoList});
@override
Widget build(BuildContext context) {
AppGlobal.context = context;
PreferredSizeWidget appBar;
if (this.appBarWidget == null) {
PreferredSizeWidget appBarWidget = AppBarWidget(
appBarTitle,
appBarIcons,
isShowAppBar,
isPharmacy: isPharmacy,
isShowDecPage: isShowDecPage,
image: image,
);
appBar = preferredSize == 0
? appBarWidget
: PreferredSize(
child: appBarWidget,
preferredSize: Size.fromHeight(preferredSize));
} else {
appBar = this.appBarWidget;
}
return Scaffold(
backgroundColor:
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
appBar: isShowAppBar
appBar: appBar,
body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
isShowDecPage)
? NotAutPage(
title: appBarTitle,
description: description,
infoList: infoList,
)
: baseViewModel != null
? NetworkBaseView(
child: buildBodyWidget(),
baseViewModel: baseViewModel,
)
: buildBodyWidget(),
bottomSheet: bottomSheet,
//floatingActionButton: floatingActionButton ?? floatingActionButton,
// bottomNavigationBar:
// this.isBottomBar == true ? BottomBarSearch() : SizedBox()
// floatingActionButton: FloatingSearchButton(),
);
}
buildAppLoaderWidget(bool isLoading) {
return isLoading ? AppLoaderWidget() : Container();
}
buildBodyWidget() {
// return body; //Stack(children: <Widget>[body, buildAppLoaderWidget(isLoading)]);
return Stack(children: <Widget>[
body, /*FloatingSearchButton()*/
]);
}
}
class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
final AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
final String appBarTitle;
final List<Widget> appBarIcons;
final bool isShowAppBar;
final bool isPharmacy;
final bool isShowDecPage;
final String image;
AppBarWidget(this.appBarTitle, this.appBarIcons, this.isShowAppBar,
{this.isPharmacy = true, this.isShowDecPage = true, this.image});
@override
Widget build(BuildContext context) {
return buildAppBar(context);
}
Widget buildAppBar(BuildContext context) {
return isShowAppBar
? AppBar(
elevation: 0,
backgroundColor: isPharmacy
? Colors.green
: Theme.of(context).appBarTheme.color,
backgroundColor:
isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color,
textTheme: TextTheme(
headline6:
TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
@ -134,38 +212,15 @@ class AppScaffold extends StatelessWidget {
(Route<dynamic> r) => false);
},
),
if (appBarIcons != null) ...appBarIcons
],
)
: null,
body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
isShowDecPage)
? NotAutPage(
title: appBarTitle,
description: description,
infoList: infoList,
)
: baseViewModel != null
? NetworkBaseView(
child: buildBodyWidget(),
baseViewModel: baseViewModel,
)
: buildBodyWidget(),
bottomSheet: bottomSheet,
//floatingActionButton: floatingActionButton ?? floatingActionButton,
// bottomNavigationBar:
// this.isBottomBar == true ? BottomBarSearch() : SizedBox()
// floatingActionButton: FloatingSearchButton(),
: Container(
height: 0,
width: 0,
);
}
buildAppLoaderWidget(bool isLoading) {
return isLoading ? AppLoaderWidget() : Container();
}
buildBodyWidget() {
// return body; //Stack(children: <Widget>[body, buildAppLoaderWidget(isLoading)]);
return Stack(children: <Widget>[
body, /*FloatingSearchButton()*/
]);
}
@override
Size get preferredSize => Size(double.maxFinite, 60);
}

@ -0,0 +1,77 @@
import 'package:expandable/expandable.dart';
import 'package:flutter/material.dart';
class PointsExpandableNotifier extends StatefulWidget {
final Widget headerWidget;
final Widget bodyWidget;
final Widget collapsed;
final bool isExpand;
bool expandFlag = false;
var controller = new ExpandableController();
PointsExpandableNotifier(
{this.headerWidget, this.bodyWidget, this.collapsed, this.isExpand});
@override
_PointsExpandableNotifierState createState() =>
_PointsExpandableNotifierState();
}
class _PointsExpandableNotifierState extends State<PointsExpandableNotifier> {
@override
Widget build(BuildContext context) {
setState(() {
if (widget.isExpand == true) {
widget.expandFlag = widget.isExpand;
widget.controller.expanded = true;
}
});
return ExpandableNotifier(
child: Padding(
padding: const EdgeInsets.only(left: 0, right: 0),
child: Column(
children: <Widget>[
SizedBox(
child: widget.headerWidget,
),
ScrollOnExpand(
scrollOnExpand: true,
scrollOnCollapse: false,
child: ExpandablePanel(
theme: const ExpandableThemeData(
headerAlignment: ExpandablePanelHeaderAlignment.center,
tapBodyToCollapse: true,
),
// header: widget.headerWidget,
/*
// setState(() {
// widget.expandFlag = !widget.expandFlag;
// if (widget.expandFlag == true) {
// widget.controller.expanded = true;
// } else {
// widget.controller.expanded = false;
// }
// });
*/
collapsed: Container(),
expanded: widget.bodyWidget,
builder: (_, collapsed, expanded) {
return Padding(
padding: EdgeInsets.only(left: 0, right: 0, bottom: 0),
child: Expandable(
controller: widget.controller,
collapsed: collapsed,
expanded: expanded,
theme: const ExpandableThemeData(crossFadePoint: 0),
),
);
},
),
),
],
),
),
);
}
}

@ -184,6 +184,8 @@ flutter:
- assets/tracker/
- assets/images/AlHabibMedicalService/
- assets/images/pharmacy_module/
- assets/images/pharmacy_module/payment/
- assets/images/pharmacy_module/lakum/
fonts:

Loading…
Cancel
Save