fix
This commit is contained in:
parent
70b798f65f
commit
543bdfcffb
2 changed files with 20 additions and 11 deletions
18
lib/api.dart
18
lib/api.dart
|
@ -251,10 +251,8 @@ class API {
|
|||
|
||||
// /flow/<id>/end
|
||||
Future<List<String>?> endFlow(String id, {List<SupplyForm>? produced}) async {
|
||||
// todo : update api for supplyform
|
||||
|
||||
var resp = jsonDecode(
|
||||
await postRequest("$instance/$id/end", {"produced": produced}));
|
||||
var resp = jsonDecode(await postRequest("$instance/$id/end",
|
||||
{"produced": produced?.map((x) => x.json()).toList()}));
|
||||
|
||||
if (produced != null) {
|
||||
return resp["produced"] as List<String>;
|
||||
|
@ -384,12 +382,12 @@ class Transaction {
|
|||
late String item;
|
||||
late String variant;
|
||||
late Price price;
|
||||
late String? origin;
|
||||
String? origin;
|
||||
late int timestamp;
|
||||
late ConsumeInfo? consumed;
|
||||
ConsumeInfo? consumed;
|
||||
late bool expired;
|
||||
late String? note;
|
||||
late Location? location;
|
||||
String? note;
|
||||
Location? location;
|
||||
|
||||
Transaction(Map<String, dynamic> json) {
|
||||
uuid = json["uuid"];
|
||||
|
@ -404,11 +402,11 @@ class Transaction {
|
|||
location = json["location"] != null ? Location(json["location"]) : null;
|
||||
}
|
||||
|
||||
Transaction.inMemory(String itemID, String variant, String price,
|
||||
Transaction.inMemory(String itemID, String variantID, String price,
|
||||
String? origin, Location? location, String? note) {
|
||||
uuid = "";
|
||||
item = itemID;
|
||||
variant = variant;
|
||||
variant = variantID;
|
||||
this.price = Price.fromString(price);
|
||||
origin = origin;
|
||||
timestamp = 0;
|
||||
|
|
|
@ -38,7 +38,7 @@ class _SupplyPageState extends State<SupplyPage> {
|
|||
availableVariants =
|
||||
widget.onlyVariants ?? widget.item.variants.keys.toList();
|
||||
|
||||
variant = widget.item.variants.keys.first;
|
||||
variant = availableVariants.first;
|
||||
|
||||
_selectedOrigin = widget.forceOrigin ?? "";
|
||||
_priceController = TextEditingController(text: widget.forcePrice ?? "");
|
||||
|
@ -310,6 +310,17 @@ class SupplyForm {
|
|||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> json() {
|
||||
return {
|
||||
"item": itemID,
|
||||
"variant": variant,
|
||||
"price": price,
|
||||
"origin": origin,
|
||||
"location": location,
|
||||
"note": note
|
||||
};
|
||||
}
|
||||
|
||||
SupplyForm({
|
||||
required this.itemID,
|
||||
required this.variant,
|
||||
|
|
Loading…
Reference in a new issue