|
|
|
|
@ -5,6 +5,8 @@ import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dar
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/pharmacy/scan_qr_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/service/pharmacy_categorise_service.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/locator.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
|
|
|
|
|
import 'base_view_model.dart';
|
|
|
|
|
|
|
|
|
|
@ -97,23 +99,29 @@ class PharmacyCategoriseViewModel extends BaseViewModel {
|
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future getCategoriseParent({String i, int pageIndex, bool isLoading}) async {
|
|
|
|
|
Future getCategoriseParent(
|
|
|
|
|
{String i, int pageIndex, bool isLoading, BuildContext context}) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
// _insuranceCardService.clearInsuranceCard();
|
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
|
// GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await _pharmacyCategoriseService.getCategoriseParent(id: i);
|
|
|
|
|
if (_pharmacyCategoriseService.hasError) {
|
|
|
|
|
error = _pharmacyCategoriseService.error;
|
|
|
|
|
setState(ViewState.ErrorLocal);
|
|
|
|
|
} else
|
|
|
|
|
await getBrands(id: i);
|
|
|
|
|
await getParentProducts(i: i, pageIndex: pageIndex, isLoading: isLoading);
|
|
|
|
|
await getParentProducts(
|
|
|
|
|
i: i, pageIndex: pageIndex, isLoading: isLoading, context: context);
|
|
|
|
|
// GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future getParentProducts({String i, int pageIndex, bool isLoading}) async {
|
|
|
|
|
Future getParentProducts(
|
|
|
|
|
{String i, int pageIndex, bool isLoading, BuildContext context}) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
// _insuranceCardService.clearInsuranceCard();
|
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
|
//GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await _pharmacyCategoriseService.getParentProducts(
|
|
|
|
|
id: i, pageNumber: pageIndex, isLoading: isLoading);
|
|
|
|
|
if (_pharmacyCategoriseService.hasError) {
|
|
|
|
|
@ -121,6 +129,7 @@ class PharmacyCategoriseViewModel extends BaseViewModel {
|
|
|
|
|
setState(ViewState.ErrorLocal);
|
|
|
|
|
} else
|
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
|
//GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future getSubCategorise({String i}) async {
|
|
|
|
|
|