fix profile
This commit is contained in:
@@ -93,6 +93,24 @@ class PackageModel extends BaseModel {
|
||||
.createPackages(packages, user.fcsID);
|
||||
}
|
||||
|
||||
Future<void> createPackage(User user, Package package, List<File> files,
|
||||
List<String> deletedUrls) async {
|
||||
if (user != null) {
|
||||
package.fcsID = user.fcsID;
|
||||
}
|
||||
if (files != null) {
|
||||
if (files.length > 5) throw Exception("Exceed number of file upload");
|
||||
package.photoUrls = package.photoUrls == null ? [] : package.photoUrls;
|
||||
for (File f in files) {
|
||||
String path = Path.join(pkg_files_path);
|
||||
String url = await uploadStorage(path, f);
|
||||
package.photoUrls.add(url);
|
||||
}
|
||||
package.photoUrls.removeWhere((e) => deletedUrls.contains(e));
|
||||
}
|
||||
return Services.instance.packageService.createPackage(package);
|
||||
}
|
||||
|
||||
Future<void> completeProcessing(
|
||||
Package package, List<File> files, List<String> deletedUrls) async {
|
||||
if (files != null) {
|
||||
@@ -105,7 +123,7 @@ class PackageModel extends BaseModel {
|
||||
}
|
||||
package.photoUrls.removeWhere((e) => deletedUrls.contains(e));
|
||||
}
|
||||
await request("/packages", "PUT",
|
||||
await request("/package", "PUT",
|
||||
payload: package.toJson(), token: await getToken());
|
||||
}
|
||||
|
||||
|
||||
@@ -185,9 +185,11 @@ class _PackageInfoState extends State<PackageInfo> {
|
||||
? Ionicons.ios_airplane
|
||||
: e.status == "delivered"
|
||||
? MaterialCommunityIcons.truck_fast
|
||||
: e.status == "processed"
|
||||
? MaterialIcons.check
|
||||
: Octicons.package,
|
||||
: e.status == "packed"
|
||||
? MaterialCommunityIcons.package
|
||||
: e.status == "processed"
|
||||
? FontAwesome.dropbox
|
||||
: MaterialCommunityIcons.inbox_arrow_down,
|
||||
color: Colors.white,
|
||||
)))
|
||||
.toList();
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/market/market_editor.dart';
|
||||
import 'package:fcs/pages/market/model/market_model.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/widgets/barcode_scanner.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||
import 'package:fcs/pages/widgets/input_text.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
@@ -163,13 +164,8 @@ class _TrackingIDPageState extends State<TrackingIDPage> {
|
||||
}
|
||||
|
||||
try {
|
||||
String barcode = await BarcodeScanner.scan();
|
||||
String barcode = await scanBarcode();
|
||||
if (barcode != null) {
|
||||
String gs = String.fromCharCode(29);
|
||||
if (barcode.contains(gs)) {
|
||||
var codes = barcode.split(gs);
|
||||
barcode = codes.length >= 2 ? codes[1] : barcode;
|
||||
}
|
||||
setState(() {
|
||||
_transcationIDCtl.text = barcode;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user