mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-02-04 14:53:17 +00:00
Part requirements (#761)
* Add setting to control if part requirements are shown * Split settings for Part and Stock * Fetch part requirements information * Add "building" indicator * Show order allocation progress for part requirements * Bump release notes * Remove unused import
This commit is contained in:
parent
e38c51e947
commit
ee553af93b
10 changed files with 357 additions and 70 deletions
|
|
@ -15,9 +15,7 @@ class _InvenTreePartSettingsState extends State<InvenTreePartSettingsWidget> {
|
|||
|
||||
bool partShowBom = true;
|
||||
bool partShowPricing = true;
|
||||
bool stockShowHistory = false;
|
||||
bool stockShowTests = false;
|
||||
bool stockConfirmScan = false;
|
||||
bool partShowRequirements = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
@ -35,16 +33,8 @@ class _InvenTreePartSettingsState extends State<InvenTreePartSettingsWidget> {
|
|||
INV_PART_SHOW_PRICING,
|
||||
true,
|
||||
);
|
||||
stockShowHistory = await InvenTreeSettingsManager().getBool(
|
||||
INV_STOCK_SHOW_HISTORY,
|
||||
false,
|
||||
);
|
||||
stockShowTests = await InvenTreeSettingsManager().getBool(
|
||||
INV_STOCK_SHOW_TESTS,
|
||||
true,
|
||||
);
|
||||
stockConfirmScan = await InvenTreeSettingsManager().getBool(
|
||||
INV_STOCK_CONFIRM_SCAN,
|
||||
partShowRequirements = await InvenTreeSettingsManager().getBool(
|
||||
INV_PART_SHOW_REQUIREMENTS,
|
||||
false,
|
||||
);
|
||||
|
||||
|
|
@ -94,54 +84,19 @@ class _InvenTreePartSettingsState extends State<InvenTreePartSettingsWidget> {
|
|||
},
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
ListTile(
|
||||
title: Text(L10().stockItemHistory),
|
||||
subtitle: Text(L10().stockItemHistoryDetail),
|
||||
leading: Icon(TablerIcons.history),
|
||||
title: Text(L10().partRequirements),
|
||||
subtitle: Text(L10().partRequirementsSettingDetail),
|
||||
leading: Icon(TablerIcons.list),
|
||||
trailing: Switch(
|
||||
value: stockShowHistory,
|
||||
value: partShowRequirements,
|
||||
onChanged: (bool value) {
|
||||
InvenTreeSettingsManager().setValue(
|
||||
INV_STOCK_SHOW_HISTORY,
|
||||
INV_PART_SHOW_REQUIREMENTS,
|
||||
value,
|
||||
);
|
||||
setState(() {
|
||||
stockShowHistory = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(L10().testResults),
|
||||
subtitle: Text(L10().testResultsDetail),
|
||||
leading: Icon(TablerIcons.test_pipe),
|
||||
trailing: Switch(
|
||||
value: stockShowTests,
|
||||
onChanged: (bool value) {
|
||||
InvenTreeSettingsManager().setValue(
|
||||
INV_STOCK_SHOW_TESTS,
|
||||
value,
|
||||
);
|
||||
setState(() {
|
||||
stockShowTests = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(L10().confirmScan),
|
||||
subtitle: Text(L10().confirmScanDetail),
|
||||
leading: Icon(TablerIcons.qrcode),
|
||||
trailing: Switch(
|
||||
value: stockConfirmScan,
|
||||
onChanged: (bool value) {
|
||||
InvenTreeSettingsManager().setValue(
|
||||
INV_STOCK_CONFIRM_SCAN,
|
||||
value,
|
||||
);
|
||||
setState(() {
|
||||
stockConfirmScan = value;
|
||||
partShowRequirements = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import "package:flutter/material.dart";
|
||||
import "package:flutter_tabler_icons/flutter_tabler_icons.dart";
|
||||
import "package:inventree/settings/stock_settings.dart";
|
||||
import "package:package_info_plus/package_info_plus.dart";
|
||||
|
||||
import "package:inventree/app_colors.dart";
|
||||
|
|
@ -119,6 +120,20 @@ class _InvenTreeSettingsState extends State<InvenTreeSettingsWidget> {
|
|||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(L10().stock),
|
||||
subtitle: Text(L10().stockSettings),
|
||||
leading: Icon(TablerIcons.packages, color: COLOR_ACTION),
|
||||
trailing: LinkIcon(),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => InvenTreeStockSettingsWidget(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(L10().purchaseOrder),
|
||||
subtitle: Text(L10().purchaseOrderSettings),
|
||||
|
|
|
|||
110
lib/settings/stock_settings.dart
Normal file
110
lib/settings/stock_settings.dart
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
import "package:flutter/material.dart";
|
||||
import "package:flutter_tabler_icons/flutter_tabler_icons.dart";
|
||||
import "package:inventree/app_colors.dart";
|
||||
import "package:inventree/l10.dart";
|
||||
import "package:inventree/preferences.dart";
|
||||
|
||||
class InvenTreeStockSettingsWidget extends StatefulWidget {
|
||||
@override
|
||||
_InvenTreeStockSettingsState createState() => _InvenTreeStockSettingsState();
|
||||
}
|
||||
|
||||
class _InvenTreeStockSettingsState extends State<InvenTreeStockSettingsWidget> {
|
||||
_InvenTreeStockSettingsState();
|
||||
|
||||
bool stockShowHistory = false;
|
||||
bool stockShowTests = false;
|
||||
bool stockConfirmScan = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
Future<void> loadSettings() async {
|
||||
stockShowHistory = await InvenTreeSettingsManager().getBool(
|
||||
INV_STOCK_SHOW_HISTORY,
|
||||
false,
|
||||
);
|
||||
stockShowTests = await InvenTreeSettingsManager().getBool(
|
||||
INV_STOCK_SHOW_TESTS,
|
||||
true,
|
||||
);
|
||||
stockConfirmScan = await InvenTreeSettingsManager().getBool(
|
||||
INV_STOCK_CONFIRM_SCAN,
|
||||
false,
|
||||
);
|
||||
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(L10().stockSettings),
|
||||
backgroundColor: COLOR_APP_BAR,
|
||||
),
|
||||
body: Container(
|
||||
child: ListView(
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text(L10().stockItemHistory),
|
||||
subtitle: Text(L10().stockItemHistoryDetail),
|
||||
leading: Icon(TablerIcons.history),
|
||||
trailing: Switch(
|
||||
value: stockShowHistory,
|
||||
onChanged: (bool value) {
|
||||
InvenTreeSettingsManager().setValue(
|
||||
INV_STOCK_SHOW_HISTORY,
|
||||
value,
|
||||
);
|
||||
setState(() {
|
||||
stockShowHistory = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(L10().testResults),
|
||||
subtitle: Text(L10().testResultsDetail),
|
||||
leading: Icon(TablerIcons.test_pipe),
|
||||
trailing: Switch(
|
||||
value: stockShowTests,
|
||||
onChanged: (bool value) {
|
||||
InvenTreeSettingsManager().setValue(
|
||||
INV_STOCK_SHOW_TESTS,
|
||||
value,
|
||||
);
|
||||
setState(() {
|
||||
stockShowTests = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(L10().confirmScan),
|
||||
subtitle: Text(L10().confirmScanDetail),
|
||||
leading: Icon(TablerIcons.qrcode),
|
||||
trailing: Switch(
|
||||
value: stockConfirmScan,
|
||||
onChanged: (bool value) {
|
||||
InvenTreeSettingsManager().setValue(
|
||||
INV_STOCK_CONFIRM_SCAN,
|
||||
value,
|
||||
);
|
||||
setState(() {
|
||||
stockConfirmScan = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue