mirror of
https://github.com/inventree/inventree-app.git
synced 2026-04-25 19:03:25 +00:00
ea132599d8
* WIP * Remove debug msg * Add required roles * More roles * Fix refresh for BuildDetail widget * Add attachments widget * Translated text * Further updates * More translations * Form field updates * Cleanup * Code formatting * Fix duplicate import * formatting * Remove duplicate switch case * Update to match modern app * Improved required parts list * Filtering for build outputs * Display list of allocated stock items * Display source and destination locations * Fix typo * Add build orders to drawer * Fix hard-coded string * Set default filter value * Tweak build fields (remove "notes") * Fixes * Add "start_date" to build edit form * Disable editing of build line * Tweak build item / build detail views * Remove unused func * Remove unused import --------- Co-authored-by: Asterix\Oliver <oliver@currawongeng.com> Co-authored-by: Oliver Walters <oliver.henry.walters@gmail.com>
137 lines
3.6 KiB
Dart
137 lines
3.6 KiB
Dart
import "package:flutter/material.dart";
|
|
import "package:flutter_speed_dial/flutter_speed_dial.dart";
|
|
import "package:flutter_tabler_icons/flutter_tabler_icons.dart";
|
|
|
|
import "package:inventree/api.dart";
|
|
import "package:inventree/app_colors.dart";
|
|
import "package:inventree/l10.dart";
|
|
|
|
import "package:inventree/inventree/part.dart";
|
|
import "package:inventree/inventree/build.dart";
|
|
|
|
import "package:inventree/widget/progress.dart";
|
|
import "package:inventree/widget/refreshable_state.dart";
|
|
|
|
/*
|
|
* Widget for displaying detail view of a single BuildOrderLineItem
|
|
*/
|
|
class BuildLineDetailWidget extends StatefulWidget {
|
|
const BuildLineDetailWidget(this.item, {Key? key}) : super(key: key);
|
|
|
|
final InvenTreeBuildLine item;
|
|
|
|
@override
|
|
_BuildLineDetailWidgetState createState() => _BuildLineDetailWidgetState();
|
|
}
|
|
|
|
/*
|
|
* State for the BuildLineDetailWidget
|
|
*/
|
|
class _BuildLineDetailWidgetState
|
|
extends RefreshableState<BuildLineDetailWidget> {
|
|
_BuildLineDetailWidgetState();
|
|
|
|
@override
|
|
String getAppBarTitle() => L10().lineItem;
|
|
|
|
@override
|
|
List<Widget> appBarActions(BuildContext context) {
|
|
List<Widget> actions = [];
|
|
|
|
return actions;
|
|
}
|
|
|
|
@override
|
|
List<SpeedDialChild> actionButtons(BuildContext context) {
|
|
// Currently, no action buttons are needed as allocation/deallocation
|
|
// is done at the build order level instead of individual line level
|
|
return [];
|
|
}
|
|
|
|
@override
|
|
Future<void> request(BuildContext context) async {
|
|
await widget.item.reload();
|
|
}
|
|
|
|
@override
|
|
List<Widget> getTiles(BuildContext context) {
|
|
List<Widget> tiles = [];
|
|
|
|
// Reference to the part
|
|
tiles.add(
|
|
ListTile(
|
|
title: Text(L10().part),
|
|
subtitle: Text(widget.item.partName),
|
|
leading:
|
|
widget.item.part != null && widget.item.part!.thumbnail.isNotEmpty
|
|
? SizedBox(
|
|
width: 32,
|
|
height: 32,
|
|
child: InvenTreeAPI().getThumbnail(widget.item.part!.thumbnail),
|
|
)
|
|
: Icon(TablerIcons.box, color: COLOR_ACTION),
|
|
trailing: const Icon(TablerIcons.chevron_right),
|
|
onTap: () async {
|
|
showLoadingOverlay();
|
|
var part = await InvenTreePart().get(widget.item.partId);
|
|
hideLoadingOverlay();
|
|
|
|
if (part is InvenTreePart) {
|
|
part.goToDetailPage(context);
|
|
}
|
|
},
|
|
),
|
|
);
|
|
|
|
// Required quantity
|
|
tiles.add(
|
|
ListTile(
|
|
title: Text(L10().quantity),
|
|
subtitle: Text(widget.item.requiredQuantity.toString()),
|
|
leading: const Icon(TablerIcons.list),
|
|
),
|
|
);
|
|
|
|
// Allocated quantity
|
|
tiles.add(
|
|
ListTile(
|
|
title: Text(L10().allocated),
|
|
subtitle: ProgressBar(
|
|
widget.item.allocatedQuantity / widget.item.requiredQuantity,
|
|
),
|
|
trailing: Text(
|
|
"${widget.item.allocatedQuantity.toInt()} / ${widget.item.requiredQuantity.toInt()}",
|
|
style: TextStyle(
|
|
color: widget.item.isFullyAllocated ? COLOR_SUCCESS : COLOR_WARNING,
|
|
),
|
|
),
|
|
leading: const Icon(TablerIcons.progress),
|
|
),
|
|
);
|
|
|
|
// Reference
|
|
if (widget.item.reference.isNotEmpty) {
|
|
tiles.add(
|
|
ListTile(
|
|
title: Text(L10().reference),
|
|
subtitle: Text(widget.item.reference),
|
|
leading: const Icon(TablerIcons.hash),
|
|
),
|
|
);
|
|
}
|
|
|
|
// Notes
|
|
if (widget.item.notes.isNotEmpty) {
|
|
tiles.add(
|
|
ListTile(
|
|
title: Text(L10().notes),
|
|
subtitle: Text(widget.item.notes),
|
|
leading: const Icon(TablerIcons.note),
|
|
),
|
|
);
|
|
}
|
|
|
|
return tiles;
|
|
}
|
|
}
|