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';
class PharmacyProduct {
String id;
dynamic id;
bool visibleIndividually;
String name;
String namen;
String shortDescription;
String shortDescriptionn;
String fullDescription;
String fullDescriptionn;
dynamic name;
dynamic namen;
dynamic shortDescription;
dynamic shortDescriptionn;
dynamic fullDescription;
dynamic fullDescriptionn;
bool markasNew;
bool showOnHomePage;
String metaKeywords;
String metaDescription;
String metaTitle;
dynamic metaKeywords;
dynamic metaDescription;
dynamic metaTitle;
bool allowCustomerReviews;
int approvedRatingSum;
int notApprovedRatingSum;
int approvedTotalReviews;
int notApprovedTotalReviews;
String sku;
dynamic sku;
bool isRx;
bool prescriptionRequired;
String rxMessage;
String rxMessagen;
dynamic rxMessage;
dynamic rxMessagen;
String manufacturerPartNumber;
String gtin;
bool isGiftCard;
@ -115,118 +115,117 @@ class PharmacyProduct {
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.attributes,
this.specifications,
this.associatedProductIds,
this.tags,
this.vendorId,
this.seName});
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.attributes,
this.specifications,
this.associatedProductIds,
this.tags,
this.vendorId,
this.seName});
PharmacyProduct.fromJson(Map<String, dynamic> json) {
id = json['id'];
@ -257,7 +256,7 @@ class PharmacyProduct {
isGiftCard = json['is_gift_card'];
requireOtherProducts = json['require_other_products'];
automaticallyAddRequiredProducts =
json['automatically_add_required_products'];
json['automatically_add_required_products'];
isDownload = json['is_download'];
unlimitedDownloads = json['unlimited_downloads'];
maxNumberOfDownloads = json['max_number_of_downloads'];
@ -275,7 +274,7 @@ class PharmacyProduct {
additionalShippingCharge = json['additional_shipping_charge'];
isTaxExempt = json['is_tax_exempt'];
isTelecommunicationsOrBroadcastingOrElectronicServices =
json['is_telecommunications_or_broadcasting_or_electronic_services'];
json['is_telecommunications_or_broadcasting_or_electronic_services'];
useMultipleWarehouses = json['use_multiple_warehouses'];
manageInventoryMethodId = json['manage_inventory_method_id'];
stockQuantity = json['stock_quantity'];
@ -290,12 +289,12 @@ class PharmacyProduct {
orderMaximumQuantity = json['order_maximum_quantity'];
allowedQuantities = json['allowed_quantities'];
allowAddingOnlyExistingAttributeCombinations =
json['allow_adding_only_existing_attribute_combinations'];
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'];
json['pre_order_availability_start_date_time_utc'];
callForPrice = json['call_for_price'];
price = json['price'];
oldPrice = json['old_price'];

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

@ -55,11 +55,11 @@ class PharmacyCategoriseViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getBrands() async {
Future getBrands({String id}) async {
hasError = false;
// _insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _pharmacyCategoriseService.getBrands();
await _pharmacyCategoriseService.getBrands(id: id);
if (_pharmacyCategoriseService.hasError) {
error = _pharmacyCategoriseService.error;
setState(ViewState.ErrorLocal);
@ -105,7 +105,7 @@ class PharmacyCategoriseViewModel extends BaseViewModel {
setState(ViewState.ErrorLocal);
} else
await getParentProducts(i: i);
await getBrands();
await getBrands(id: i);
}
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,
body: SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height * 5.97,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -596,7 +595,9 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
),
styleOne == true
? Container(
height: MediaQuery.of(context).size.height * 3.85,
height: model.subProducts.length *
MediaQuery.of(context).size.height *
0.15,
child: GridView.builder(
physics: NeverScrollableScrollPhysics(),
gridDelegate:
@ -604,7 +605,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
crossAxisCount: 2,
crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0,
childAspectRatio: 1.0,
childAspectRatio: 0.9,
),
itemCount: model.subProducts.length,
itemBuilder: (BuildContext context, int index) {
@ -798,7 +799,9 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
),
)
: Container(
height: MediaQuery.of(context).size.height * 5.0,
height: model.subProducts.length *
MediaQuery.of(context).size.height *
0.122,
child: ListView.builder(
physics: NeverScrollableScrollPhysics(),
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