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