add packages, receiving & processing
This commit is contained in:
@@ -18,6 +18,8 @@ import 'package:provider/provider.dart';
|
||||
import 'package:timeline_list/timeline.dart';
|
||||
import 'package:timeline_list/timeline_model.dart';
|
||||
|
||||
import 'receiving_editor.dart';
|
||||
|
||||
final DateFormat dateFormat = DateFormat("d MMM yyyy");
|
||||
|
||||
class ReceivingInfo extends StatefulWidget {
|
||||
@@ -40,9 +42,9 @@ class _ReceivingInfoState extends State<ReceivingInfo> {
|
||||
}
|
||||
|
||||
initPackage(Package package) {
|
||||
multiImgController.setImageUrls = package.photoUrls;
|
||||
setState(() {
|
||||
_package = package;
|
||||
multiImgController.setImageUrls = package.photoUrls;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -89,18 +91,22 @@ class _ReceivingInfoState extends State<ReceivingInfo> {
|
||||
backgroundColor: Colors.white,
|
||||
title: LocalText(
|
||||
context,
|
||||
"package.info.title",
|
||||
"receiving.info",
|
||||
fontSize: 20,
|
||||
color: primaryColor,
|
||||
),
|
||||
actions: <Widget>[
|
||||
isCustomer
|
||||
? Container()
|
||||
: IconButton(
|
||||
actions: isCustomer
|
||||
? null
|
||||
: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete, color: primaryColor),
|
||||
onPressed: _delete,
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.edit, color: primaryColor),
|
||||
onPressed: _edit,
|
||||
)
|
||||
],
|
||||
],
|
||||
),
|
||||
body: Card(
|
||||
child: Column(
|
||||
@@ -113,19 +119,9 @@ class _ReceivingInfoState extends State<ReceivingInfo> {
|
||||
_package.userID != null ? customerNameBox : Container(),
|
||||
_package.photoUrls.length == 0 ? Container() : img,
|
||||
remarkBox,
|
||||
ExpansionTile(
|
||||
initiallyExpanded: true,
|
||||
title: Text(
|
||||
'Status',
|
||||
style: TextStyle(
|
||||
color: primaryColor, fontWeight: FontWeight.bold),
|
||||
),
|
||||
children: <Widget>[
|
||||
StatusTree(
|
||||
shipmentHistory: _package.shipmentHistory,
|
||||
currentStatus: _package.currentStatus),
|
||||
],
|
||||
),
|
||||
StatusTree(
|
||||
shipmentHistory: _package.shipmentHistory,
|
||||
currentStatus: _package.currentStatus),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
)
|
||||
@@ -138,6 +134,19 @@ class _ReceivingInfoState extends State<ReceivingInfo> {
|
||||
);
|
||||
}
|
||||
|
||||
_edit() async {
|
||||
await Navigator.push(
|
||||
context,
|
||||
BottomUpPageRoute(ReceivingEditor(
|
||||
package: widget.package,
|
||||
)),
|
||||
);
|
||||
PackageModel packageModel =
|
||||
Provider.of<PackageModel>(context, listen: false);
|
||||
var pkg = await packageModel.getPackage(widget.package.id);
|
||||
initPackage(pkg);
|
||||
}
|
||||
|
||||
_delete() {
|
||||
showConfirmDialog(context, "receiving.delete.confirm", _deleteReceiving);
|
||||
}
|
||||
@@ -149,7 +158,7 @@ class _ReceivingInfoState extends State<ReceivingInfo> {
|
||||
try {
|
||||
PackageModel packageModel =
|
||||
Provider.of<PackageModel>(context, listen: false);
|
||||
await packageModel.deletePackage(_package);
|
||||
await packageModel.deleteReceiving(_package);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
|
||||
Reference in New Issue
Block a user