From ded53e20058a146d260a347ddd34e6731e7aa39e Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 13 Aug 2023 17:04:46 +0300 Subject: [PATCH] Documents --- lib/ui/product/view/product_view.dart | 81 ++++++++++++++++----------- 1 file changed, 47 insertions(+), 34 deletions(-) diff --git a/lib/ui/product/view/product_view.dart b/lib/ui/product/view/product_view.dart index fcb78245e..fa3c336da 100644 --- a/lib/ui/product/view/product_view.dart +++ b/lib/ui/product/view/product_view.dart @@ -76,51 +76,64 @@ class _ProductViewState extends State Widget build(BuildContext context) { final localization = AppLocalization.of(context); final viewModel = widget.viewModel; + final state = viewModel.state; + final company = state.company; final product = viewModel.product; final documents = product.documents; return ViewScaffold( isFilter: widget.isFilter, entity: product, - appBarBottom: TabBar( - controller: _controller, - isScrollable: false, - tabs: [ - Tab( - text: localization.overview, - ), - Tab( - text: documents.isEmpty - ? localization.documents - : '${localization.documents} (${documents.length})', - ), - ], - ), + appBarBottom: company.isModuleEnabled(EntityType.document) + ? TabBar( + controller: _controller, + isScrollable: false, + tabs: [ + Tab( + text: localization.overview, + ), + Tab( + text: documents.isEmpty + ? localization.documents + : '${localization.documents} (${documents.length})', + ), + ], + ) + : null, body: Builder(builder: (context) { return Column( children: [ Expanded( - child: TabBarView( - controller: _controller, - children: [ - RefreshIndicator( - onRefresh: () => viewModel.onRefreshed(context), - child: ProductOverview( - viewModel: viewModel, - key: ValueKey(viewModel.product.id), - //isFilter: widget.isFilter, + child: company.isModuleEnabled(EntityType.document) + ? TabBarView( + controller: _controller, + children: [ + RefreshIndicator( + onRefresh: () => viewModel.onRefreshed(context), + child: ProductOverview( + viewModel: viewModel, + key: ValueKey(viewModel.product.id), + //isFilter: widget.isFilter, + ), + ), + RefreshIndicator( + onRefresh: () => viewModel.onRefreshed(context), + child: ProductViewDocuments( + viewModel: viewModel, + key: ValueKey(viewModel.product.id), + //client: viewModel.client, + ), + ), + ], + ) + : RefreshIndicator( + onRefresh: () => viewModel.onRefreshed(context), + child: ProductOverview( + viewModel: viewModel, + key: ValueKey(viewModel.product.id), + //isFilter: widget.isFilter, + ), ), - ), - RefreshIndicator( - onRefresh: () => viewModel.onRefreshed(context), - child: ProductViewDocuments( - viewModel: viewModel, - key: ValueKey(viewModel.product.id), - //client: viewModel.client, - ), - ), - ], - ), ), BottomButtons( entity: product,