daynimic listing

merge-requests/279/head
hussam al-habibeh 4 years ago
parent 299a1bed25
commit 2723422bbf

@ -4,29 +4,29 @@ import 'PharmacyImageObject.dart';
import 'Reviews.dart'; import 'Reviews.dart';
class PharmacyProduct { class PharmacyProduct {
String id; dynamic id;
bool visibleIndividually; bool visibleIndividually;
String name; dynamic name;
String namen; dynamic namen;
String shortDescription; dynamic shortDescription;
String shortDescriptionn; dynamic shortDescriptionn;
String fullDescription; dynamic fullDescription;
String fullDescriptionn; dynamic fullDescriptionn;
bool markasNew; bool markasNew;
bool showOnHomePage; bool showOnHomePage;
String metaKeywords; dynamic metaKeywords;
String metaDescription; dynamic metaDescription;
String metaTitle; dynamic metaTitle;
bool allowCustomerReviews; bool allowCustomerReviews;
int approvedRatingSum; int approvedRatingSum;
int notApprovedRatingSum; int notApprovedRatingSum;
int approvedTotalReviews; int approvedTotalReviews;
int notApprovedTotalReviews; int notApprovedTotalReviews;
String sku; dynamic sku;
bool isRx; bool isRx;
bool prescriptionRequired; bool prescriptionRequired;
String rxMessage; dynamic rxMessage;
String rxMessagen; dynamic rxMessagen;
String manufacturerPartNumber; String manufacturerPartNumber;
String gtin; String gtin;
bool isGiftCard; bool isGiftCard;
@ -115,118 +115,117 @@ class PharmacyProduct {
int vendorId; int vendorId;
String seName; String seName;
PharmacyProduct( PharmacyProduct(
{this.id, {this.id,
this.visibleIndividually, this.visibleIndividually,
this.name, this.name,
this.namen, this.namen,
this.shortDescription, this.shortDescription,
this.shortDescriptionn, this.shortDescriptionn,
this.fullDescription, this.fullDescription,
this.fullDescriptionn, this.fullDescriptionn,
this.markasNew, this.markasNew,
this.showOnHomePage, this.showOnHomePage,
this.metaKeywords, this.metaKeywords,
this.metaDescription, this.metaDescription,
this.metaTitle, this.metaTitle,
this.allowCustomerReviews, this.allowCustomerReviews,
this.approvedRatingSum, this.approvedRatingSum,
this.notApprovedRatingSum, this.notApprovedRatingSum,
this.approvedTotalReviews, this.approvedTotalReviews,
this.notApprovedTotalReviews, this.notApprovedTotalReviews,
this.sku, this.sku,
this.isRx, this.isRx,
this.prescriptionRequired, this.prescriptionRequired,
this.rxMessage, this.rxMessage,
this.rxMessagen, this.rxMessagen,
this.manufacturerPartNumber, this.manufacturerPartNumber,
this.gtin, this.gtin,
this.isGiftCard, this.isGiftCard,
this.requireOtherProducts, this.requireOtherProducts,
this.automaticallyAddRequiredProducts, this.automaticallyAddRequiredProducts,
this.isDownload, this.isDownload,
this.unlimitedDownloads, this.unlimitedDownloads,
this.maxNumberOfDownloads, this.maxNumberOfDownloads,
this.downloadExpirationDays, this.downloadExpirationDays,
this.hasSampleDownload, this.hasSampleDownload,
this.hasUserAgreement, this.hasUserAgreement,
this.isRecurring, this.isRecurring,
this.recurringCycleLength, this.recurringCycleLength,
this.recurringTotalCycles, this.recurringTotalCycles,
this.isRental, this.isRental,
this.rentalPriceLength, this.rentalPriceLength,
this.isShipEnabled, this.isShipEnabled,
this.isFreeShipping, this.isFreeShipping,
this.shipSeparately, this.shipSeparately,
this.additionalShippingCharge, this.additionalShippingCharge,
this.isTaxExempt, this.isTaxExempt,
this.isTelecommunicationsOrBroadcastingOrElectronicServices, this.isTelecommunicationsOrBroadcastingOrElectronicServices,
this.useMultipleWarehouses, this.useMultipleWarehouses,
this.manageInventoryMethodId, this.manageInventoryMethodId,
this.stockQuantity, this.stockQuantity,
this.stockAvailability, this.stockAvailability,
this.stockAvailabilityn, this.stockAvailabilityn,
this.displayStockAvailability, this.displayStockAvailability,
this.displayStockQuantity, this.displayStockQuantity,
this.minStockQuantity, this.minStockQuantity,
this.notifyAdminForQuantityBelow, this.notifyAdminForQuantityBelow,
this.allowBackInStockSubscriptions, this.allowBackInStockSubscriptions,
this.orderMinimumQuantity, this.orderMinimumQuantity,
this.orderMaximumQuantity, this.orderMaximumQuantity,
this.allowedQuantities, this.allowedQuantities,
this.allowAddingOnlyExistingAttributeCombinations, this.allowAddingOnlyExistingAttributeCombinations,
this.disableBuyButton, this.disableBuyButton,
this.disableWishlistButton, this.disableWishlistButton,
this.availableForPreOrder, this.availableForPreOrder,
this.preOrderAvailabilityStartDateTimeUtc, this.preOrderAvailabilityStartDateTimeUtc,
this.callForPrice, this.callForPrice,
this.price, this.price,
this.oldPrice, this.oldPrice,
this.productCost, this.productCost,
this.specialPrice, this.specialPrice,
this.specialPriceStartDateTimeUtc, this.specialPriceStartDateTimeUtc,
this.specialPriceEndDateTimeUtc, this.specialPriceEndDateTimeUtc,
this.customerEntersPrice, this.customerEntersPrice,
this.minimumCustomerEnteredPrice, this.minimumCustomerEnteredPrice,
this.maximumCustomerEnteredPrice, this.maximumCustomerEnteredPrice,
this.basepriceEnabled, this.basepriceEnabled,
this.basepriceAmount, this.basepriceAmount,
this.basepriceBaseAmount, this.basepriceBaseAmount,
this.hasTierPrices, this.hasTierPrices,
this.hasDiscountsApplied, this.hasDiscountsApplied,
this.discountName, this.discountName,
this.discountNamen, this.discountNamen,
this.discountDescription, this.discountDescription,
this.discountDescriptionn, this.discountDescriptionn,
this.discountPercentage, this.discountPercentage,
this.currency, this.currency,
this.currencyn, this.currencyn,
this.weight, this.weight,
this.length, this.length,
this.width, this.width,
this.height, this.height,
this.availableStartDateTimeUtc, this.availableStartDateTimeUtc,
this.availableEndDateTimeUtc, this.availableEndDateTimeUtc,
this.displayOrder, this.displayOrder,
this.published, this.published,
this.deleted, this.deleted,
this.createdOnUtc, this.createdOnUtc,
this.updatedOnUtc, this.updatedOnUtc,
this.productType, this.productType,
this.parentGroupedProductId, this.parentGroupedProductId,
this.roleIds, this.roleIds,
this.discountIds, this.discountIds,
this.storeIds, this.storeIds,
this.manufacturerIds, this.manufacturerIds,
this.reviews, this.reviews,
this.images, this.images,
this.attributes, this.attributes,
this.specifications, this.specifications,
this.associatedProductIds, this.associatedProductIds,
this.tags, this.tags,
this.vendorId, this.vendorId,
this.seName}); this.seName});
PharmacyProduct.fromJson(Map<String, dynamic> json) { PharmacyProduct.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'];
@ -257,7 +256,7 @@ class PharmacyProduct {
isGiftCard = json['is_gift_card']; isGiftCard = json['is_gift_card'];
requireOtherProducts = json['require_other_products']; requireOtherProducts = json['require_other_products'];
automaticallyAddRequiredProducts = automaticallyAddRequiredProducts =
json['automatically_add_required_products']; json['automatically_add_required_products'];
isDownload = json['is_download']; isDownload = json['is_download'];
unlimitedDownloads = json['unlimited_downloads']; unlimitedDownloads = json['unlimited_downloads'];
maxNumberOfDownloads = json['max_number_of_downloads']; maxNumberOfDownloads = json['max_number_of_downloads'];
@ -275,7 +274,7 @@ class PharmacyProduct {
additionalShippingCharge = json['additional_shipping_charge']; additionalShippingCharge = json['additional_shipping_charge'];
isTaxExempt = json['is_tax_exempt']; isTaxExempt = json['is_tax_exempt'];
isTelecommunicationsOrBroadcastingOrElectronicServices = isTelecommunicationsOrBroadcastingOrElectronicServices =
json['is_telecommunications_or_broadcasting_or_electronic_services']; json['is_telecommunications_or_broadcasting_or_electronic_services'];
useMultipleWarehouses = json['use_multiple_warehouses']; useMultipleWarehouses = json['use_multiple_warehouses'];
manageInventoryMethodId = json['manage_inventory_method_id']; manageInventoryMethodId = json['manage_inventory_method_id'];
stockQuantity = json['stock_quantity']; stockQuantity = json['stock_quantity'];
@ -290,12 +289,12 @@ class PharmacyProduct {
orderMaximumQuantity = json['order_maximum_quantity']; orderMaximumQuantity = json['order_maximum_quantity'];
allowedQuantities = json['allowed_quantities']; allowedQuantities = json['allowed_quantities'];
allowAddingOnlyExistingAttributeCombinations = allowAddingOnlyExistingAttributeCombinations =
json['allow_adding_only_existing_attribute_combinations']; json['allow_adding_only_existing_attribute_combinations'];
disableBuyButton = json['disable_buy_button']; disableBuyButton = json['disable_buy_button'];
disableWishlistButton = json['disable_wishlist_button']; disableWishlistButton = json['disable_wishlist_button'];
availableForPreOrder = json['available_for_pre_order']; availableForPreOrder = json['available_for_pre_order'];
preOrderAvailabilityStartDateTimeUtc = preOrderAvailabilityStartDateTimeUtc =
json['pre_order_availability_start_date_time_utc']; json['pre_order_availability_start_date_time_utc'];
callForPrice = json['call_for_price']; callForPrice = json['call_for_price'];
price = json['price']; price = json['price'];
oldPrice = json['old_price']; oldPrice = json['old_price'];

@ -112,7 +112,7 @@ class PharmacyCategoriseService extends BaseService {
); );
} }
Future getBrands() async { Future getBrands({String id}) async {
hasError = false; hasError = false;
_brandsList.clear(); _brandsList.clear();
await baseAppClient.getPharmacy( await baseAppClient.getPharmacy(

@ -55,11 +55,11 @@ class PharmacyCategoriseViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getBrands() async { Future getBrands({String id}) async {
hasError = false; hasError = false;
// _insuranceCardService.clearInsuranceCard(); // _insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy); setState(ViewState.Busy);
await _pharmacyCategoriseService.getBrands(); await _pharmacyCategoriseService.getBrands(id: id);
if (_pharmacyCategoriseService.hasError) { if (_pharmacyCategoriseService.hasError) {
error = _pharmacyCategoriseService.error; error = _pharmacyCategoriseService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -105,7 +105,7 @@ class PharmacyCategoriseViewModel extends BaseViewModel {
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else } else
await getParentProducts(i: i); await getParentProducts(i: i);
await getBrands(); await getBrands(id: i);
} }
Future getParentProducts({String i}) async { Future getParentProducts({String i}) async {

File diff suppressed because it is too large Load Diff

@ -56,7 +56,6 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
baseViewModel: model, baseViewModel: model,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
height: MediaQuery.of(context).size.height * 5.97,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -596,7 +595,9 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
styleOne == true styleOne == true
? Container( ? Container(
height: MediaQuery.of(context).size.height * 3.85, height: model.subProducts.length *
MediaQuery.of(context).size.height *
0.15,
child: GridView.builder( child: GridView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
gridDelegate: gridDelegate:
@ -604,7 +605,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
crossAxisCount: 2, crossAxisCount: 2,
crossAxisSpacing: 0.5, crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0, mainAxisSpacing: 2.0,
childAspectRatio: 1.0, childAspectRatio: 0.9,
), ),
itemCount: model.subProducts.length, itemCount: model.subProducts.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
@ -798,7 +799,9 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
) )
: Container( : Container(
height: MediaQuery.of(context).size.height * 5.0, height: model.subProducts.length *
MediaQuery.of(context).size.height *
0.122,
child: ListView.builder( child: ListView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemCount: model.subProducts.length, itemCount: model.subProducts.length,

@ -0,0 +1,170 @@
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class ProcedureListWidget extends StatefulWidget {
final PharmacyCategoriseViewModel model;
final Function addSelectedHistories;
final Function(CategoriseParentModel) removeHistory;
final Function(CategoriseParentModel) addHistory;
final Function(CategoriseParentModel) addRemarks;
final bool Function(CategoriseParentModel) isEntityListSelected;
final List<CategoriseParentModel> masterList;
ProcedureListWidget(
{Key key,
this.model,
this.addSelectedHistories,
this.removeHistory,
this.masterList,
this.addHistory,
this.isEntityListSelected,
this.addRemarks})
: super(key: key);
@override
_ProcedureListWidgetState createState() => _ProcedureListWidgetState();
}
class _ProcedureListWidgetState extends State<ProcedureListWidget> {
int selectedType = 0;
int typeUrgent;
int typeRegular;
setSelectedType(int val) {
setState(() {
selectedType = val;
});
}
List<CategoriseParentModel> items = List();
List<String> remarksList = List();
List<int> typeList = List();
@override
void initState() {
items.addAll(widget.masterList);
super.initState();
}
TextEditingController remarksController = TextEditingController();
@override
Widget build(BuildContext context) {
return Container(
child: Column(
children: [
NetworkBaseView(
baseViewModel: widget.model,
child: Container(
height: MediaQuery.of(context).size.height * 0.35,
child: Center(
child: Container(
margin: EdgeInsets.only(top: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: ListView(
children: [
// TextFields(
// hintText:
// 'sss', //TranslationBase.of(context).searchProcedures,
// suffixIcon: EvaIcons.search,
// onChanged: (value) {
// filterSearchResults(value);
// },
// ),
SizedBox(
height: 15,
),
items.length != 0
? Column(
children: items.map((historyInfo) {
return Column(
children: [
Row(
children: [
Checkbox(
value: widget.isEntityListSelected(
historyInfo),
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {
if (widget.isEntityListSelected(
historyInfo)) {
widget
.removeHistory(historyInfo);
} else {
widget.addHistory(historyInfo);
}
});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts(historyInfo.name,
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
),
Divider(
height: 1,
),
],
);
}).toList(),
)
: Center(
child: Container(
child: AppText(
"There's no procedures for this category",
color: Color(0xFFB9382C)),
),
)
],
),
)),
),
),
SizedBox(
height: 10,
),
],
),
);
}
void filterSearchResults(String query) {
List<CategoriseParentModel> dummySearchList = List();
dummySearchList.addAll(widget.masterList);
if (query.isNotEmpty) {
List<CategoriseParentModel> dummyListData = List();
dummySearchList.forEach((item) {
if (item.name.toLowerCase().contains(query.toLowerCase())) {
dummyListData.add(item);
}
});
setState(() {
items.clear();
items.addAll(dummyListData);
});
return;
} else {
setState(() {
items.clear();
items.addAll(widget.masterList);
});
}
}
}
Loading…
Cancel
Save