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
|
// /flow/<id>/end
|
||||||
Future<List<String>?> endFlow(String id, {List<SupplyForm>? produced}) async {
|
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?.map((x) => x.json()).toList()}));
|
||||||
var resp = jsonDecode(
|
|
||||||
await postRequest("$instance/$id/end", {"produced": produced}));
|
|
||||||
|
|
||||||
if (produced != null) {
|
if (produced != null) {
|
||||||
return resp["produced"] as List<String>;
|
return resp["produced"] as List<String>;
|
||||||
|
@ -384,12 +382,12 @@ class Transaction {
|
||||||
late String item;
|
late String item;
|
||||||
late String variant;
|
late String variant;
|
||||||
late Price price;
|
late Price price;
|
||||||
late String? origin;
|
String? origin;
|
||||||
late int timestamp;
|
late int timestamp;
|
||||||
late ConsumeInfo? consumed;
|
ConsumeInfo? consumed;
|
||||||
late bool expired;
|
late bool expired;
|
||||||
late String? note;
|
String? note;
|
||||||
late Location? location;
|
Location? location;
|
||||||
|
|
||||||
Transaction(Map<String, dynamic> json) {
|
Transaction(Map<String, dynamic> json) {
|
||||||
uuid = json["uuid"];
|
uuid = json["uuid"];
|
||||||
|
@ -404,11 +402,11 @@ class Transaction {
|
||||||
location = json["location"] != null ? Location(json["location"]) : null;
|
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) {
|
String? origin, Location? location, String? note) {
|
||||||
uuid = "";
|
uuid = "";
|
||||||
item = itemID;
|
item = itemID;
|
||||||
variant = variant;
|
variant = variantID;
|
||||||
this.price = Price.fromString(price);
|
this.price = Price.fromString(price);
|
||||||
origin = origin;
|
origin = origin;
|
||||||
timestamp = 0;
|
timestamp = 0;
|
||||||
|
|
|
@ -38,7 +38,7 @@ class _SupplyPageState extends State<SupplyPage> {
|
||||||
availableVariants =
|
availableVariants =
|
||||||
widget.onlyVariants ?? widget.item.variants.keys.toList();
|
widget.onlyVariants ?? widget.item.variants.keys.toList();
|
||||||
|
|
||||||
variant = widget.item.variants.keys.first;
|
variant = availableVariants.first;
|
||||||
|
|
||||||
_selectedOrigin = widget.forceOrigin ?? "";
|
_selectedOrigin = widget.forceOrigin ?? "";
|
||||||
_priceController = TextEditingController(text: widget.forcePrice ?? "");
|
_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({
|
SupplyForm({
|
||||||
required this.itemID,
|
required this.itemID,
|
||||||
required this.variant,
|
required this.variant,
|
||||||
|
|
Loading…
Reference in a new issue