mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 05:26:47 +00:00
Cleanup
This commit is contained in:
parent
0c4803b889
commit
c2aa51ed95
@ -155,7 +155,7 @@ class InvenTreePart extends InvenTreeModel {
|
||||
// Request stock items for this part
|
||||
Future<void> getStockItems(BuildContext context, {bool showDialog=false}) async {
|
||||
|
||||
InvenTreeStockItem().list(
|
||||
await InvenTreeStockItem().list(
|
||||
context,
|
||||
filters: {
|
||||
"part": "${pk}",
|
||||
|
@ -287,6 +287,11 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
return 'SN ${serialNumber}';
|
||||
}
|
||||
|
||||
// Is an integer?
|
||||
if (quantity.toInt() == quantity) {
|
||||
return '${quantity.toInt()}';
|
||||
}
|
||||
|
||||
return '${quantity}';
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,6 @@ class _InvenTreeLoginSettingsState extends State<InvenTreeLoginSettingsWidget> {
|
||||
|
||||
_reload();
|
||||
|
||||
print("CONNECT FROM A");
|
||||
// Attempt server login (this will load the newly selected profile
|
||||
InvenTreeAPI().connectToServer(context).then((result) {
|
||||
_reload();
|
||||
@ -210,7 +209,6 @@ class _InvenTreeLoginSettingsState extends State<InvenTreeLoginSettingsWidget> {
|
||||
if (InvenTreeAPI().isConnected() && profile.key == InvenTreeAPI().profile.key) {
|
||||
// Attempt server login (this will load the newly selected profile
|
||||
|
||||
print("Connect froM A");
|
||||
InvenTreeAPI().connectToServer(context).then((result) {
|
||||
_reload();
|
||||
});
|
||||
|
@ -234,7 +234,7 @@ class SubcategoryList extends StatelessWidget {
|
||||
return ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: ClampingScrollPhysics(),
|
||||
separatorBuilder: (_, __) => const Divider(),
|
||||
separatorBuilder: (_, __) => const Divider(height: 3),
|
||||
itemBuilder: _build, itemCount: _categories.length);
|
||||
}
|
||||
}
|
||||
@ -286,7 +286,7 @@ class PartList extends StatelessWidget {
|
||||
return ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: ClampingScrollPhysics(),
|
||||
separatorBuilder: (_, __) => const Divider(height: 1),
|
||||
separatorBuilder: (_, __) => const Divider(height: 3),
|
||||
itemBuilder: _build, itemCount: _parts.length);
|
||||
}
|
||||
}
|
||||
|
@ -45,19 +45,19 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
||||
|
||||
}
|
||||
|
||||
void _scan() {
|
||||
void _scan(BuildContext context) {
|
||||
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||
|
||||
scanQrCode(context);
|
||||
}
|
||||
|
||||
void _parts() {
|
||||
void _parts(BuildContext context) {
|
||||
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => CategoryDisplayWidget(null)));
|
||||
}
|
||||
|
||||
void _stock() {
|
||||
void _stock(BuildContext context) {
|
||||
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => LocationDisplayWidget(null)));
|
||||
@ -82,7 +82,12 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
||||
}
|
||||
|
||||
void _selectProfile() {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => InvenTreeLoginSettingsWidget()));
|
||||
Navigator.push(
|
||||
context, MaterialPageRoute(builder: (context) => InvenTreeLoginSettingsWidget())
|
||||
).then((context) {
|
||||
// Once we return
|
||||
_loadProfile();
|
||||
});
|
||||
}
|
||||
|
||||
void _unsupported() {
|
||||
@ -109,7 +114,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
||||
if (_profile != null) {
|
||||
if (!InvenTreeAPI().isConnected() && !InvenTreeAPI().isConnecting()) {
|
||||
|
||||
print("Connect from C");
|
||||
// Attempt server connection
|
||||
InvenTreeAPI().connectToServer(_context).then((result) {
|
||||
setState(() {});
|
||||
});
|
||||
@ -234,7 +239,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
||||
IconButton(
|
||||
icon: new FaIcon(FontAwesomeIcons.barcode),
|
||||
tooltip: I18N.of(context).scanBarcode,
|
||||
onPressed: _scan,
|
||||
onPressed: () { _scan(context); },
|
||||
),
|
||||
Text(I18N.of(context).scanBarcode),
|
||||
],
|
||||
@ -250,7 +255,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
||||
IconButton(
|
||||
icon: new FaIcon(FontAwesomeIcons.shapes),
|
||||
tooltip: I18N.of(context).parts,
|
||||
onPressed: _parts,
|
||||
onPressed: () { _parts(context); },
|
||||
),
|
||||
Text(I18N.of(context).parts),
|
||||
],
|
||||
@ -260,7 +265,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
||||
IconButton(
|
||||
icon: new FaIcon(FontAwesomeIcons.boxes),
|
||||
tooltip: I18N.of(context).stock,
|
||||
onPressed: _stock,
|
||||
onPressed: () { _stock(context); },
|
||||
),
|
||||
Text(I18N.of(context).stock),
|
||||
],
|
||||
|
@ -305,7 +305,7 @@ class SublocationList extends StatelessWidget {
|
||||
shrinkWrap: true,
|
||||
physics: ClampingScrollPhysics(),
|
||||
itemBuilder: _build,
|
||||
separatorBuilder: (_, __) => const Divider(),
|
||||
separatorBuilder: (_, __) => const Divider(height: 3),
|
||||
itemCount: _locations.length
|
||||
);
|
||||
}
|
||||
@ -349,7 +349,7 @@ class StockList extends StatelessWidget {
|
||||
return ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: ClampingScrollPhysics(),
|
||||
separatorBuilder: (_, __) => const Divider(),
|
||||
separatorBuilder: (_, __) => const Divider(height: 3),
|
||||
itemBuilder: _build, itemCount: _items.length);
|
||||
}
|
||||
}
|
@ -214,7 +214,7 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
||||
// Stock information
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text("Stock"),
|
||||
title: Text(I18N.of(context).stock),
|
||||
leading: FaIcon(FontAwesomeIcons.boxes),
|
||||
trailing: Text("${part.inStock}"),
|
||||
onTap: () {
|
||||
@ -230,7 +230,9 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
||||
title: Text("On Order"),
|
||||
leading: FaIcon(FontAwesomeIcons.shoppingCart),
|
||||
trailing: Text("${part.onOrder}"),
|
||||
onTap: null,
|
||||
onTap: () {
|
||||
// TODO: Click through to show items on order
|
||||
},
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ class _PartStockDisplayState extends RefreshableState<PartStockDetailWidget> {
|
||||
@override
|
||||
Future<void> onBuild(BuildContext context) async {
|
||||
refresh();
|
||||
print("onBuild");
|
||||
}
|
||||
|
||||
@override
|
||||
@ -104,7 +103,7 @@ class PartStockList extends StatelessWidget {
|
||||
shrinkWrap: true,
|
||||
physics: ClampingScrollPhysics(),
|
||||
itemBuilder: _build,
|
||||
separatorBuilder: (_, __) => const Divider(height: 1),
|
||||
separatorBuilder: (_, __) => const Divider(height: 3),
|
||||
itemCount: _items.length
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user