add package return
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:fcs/domain/constants.dart';
|
||||
import 'package:fcs/domain/entities/package.dart';
|
||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
@@ -9,6 +10,7 @@ import 'package:fcs/pages/widgets/defalut_delivery_address.dart';
|
||||
import 'package:fcs/pages/widgets/delivery_address_selection.dart';
|
||||
import 'package:fcs/pages/widgets/display_text.dart';
|
||||
import 'package:fcs/pages/widgets/fcs_id_icon.dart';
|
||||
import 'package:fcs/pages/widgets/local_button.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/multi_img_controller.dart';
|
||||
import 'package:fcs/pages/widgets/multi_img_file.dart';
|
||||
@@ -25,6 +27,7 @@ final DateFormat dateFormat = DateFormat("d MMM yyyy");
|
||||
class PackageInfo extends StatefulWidget {
|
||||
final isSearchResult;
|
||||
final Package package;
|
||||
|
||||
PackageInfo({this.package, this.isSearchResult = false});
|
||||
|
||||
@override
|
||||
@@ -95,6 +98,11 @@ class _PackageInfoState extends State<PackageInfo> {
|
||||
controller: multiImgController,
|
||||
title: "Receipt File",
|
||||
);
|
||||
|
||||
final returnButton = LocalButton(
|
||||
textKey: "receiving.return.btn",
|
||||
callBack: _return,
|
||||
);
|
||||
final deliveryAddressBox = DefaultDeliveryAddress(
|
||||
deliveryAddress: _package.deliveryAddress,
|
||||
labelKey: "package.delivery.address",
|
||||
@@ -145,12 +153,15 @@ class _PackageInfoState extends State<PackageInfo> {
|
||||
_package.photoUrls.length == 0 ? Container() : img,
|
||||
widget.isSearchResult ? Container() : descBox,
|
||||
remarkBox,
|
||||
_package.status == package_processed_status
|
||||
? returnButton
|
||||
: Container(),
|
||||
widget.isSearchResult ? Container() : deliveryAddressBox,
|
||||
widget.isSearchResult
|
||||
? Container()
|
||||
: StatusTree(
|
||||
shipmentHistory: _package.shipmentHistory,
|
||||
currentStatus: _package.currentStatus),
|
||||
currentStatus: _package.status),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
)
|
||||
@@ -188,4 +199,26 @@ class _PackageInfoState extends State<PackageInfo> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_return() {
|
||||
showConfirmDialog(context, "receiving.return.confirm", _returnReceiving);
|
||||
}
|
||||
|
||||
_returnReceiving() async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
try {
|
||||
PackageModel packageModel =
|
||||
Provider.of<PackageModel>(context, listen: false);
|
||||
await packageModel.packageReturn(_package);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user