fix shipment detail click in noti
This commit is contained in:
@@ -35,6 +35,7 @@ const page_rates = "rates";
|
|||||||
// Message type
|
// Message type
|
||||||
const message_type_package = "t_p";
|
const message_type_package = "t_p";
|
||||||
const message_type_profile = "t_profile";
|
const message_type_profile = "t_profile";
|
||||||
|
const message_type_shipment = "t_s";
|
||||||
|
|
||||||
// Fcs shipment status
|
// Fcs shipment status
|
||||||
const fcs_shipment_confirmed_status = "confirmed";
|
const fcs_shipment_confirmed_status = "confirmed";
|
||||||
|
|||||||
@@ -391,6 +391,7 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
|
|
||||||
final createBtn = LocalButton(
|
final createBtn = LocalButton(
|
||||||
textKey: "box.create.btn",
|
textKey: "box.create.btn",
|
||||||
|
callBack: _save,
|
||||||
);
|
);
|
||||||
|
|
||||||
final completeBtn = LocalButton(
|
final completeBtn = LocalButton(
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:fcs/domain/constants.dart';
|
import 'package:fcs/domain/constants.dart';
|
||||||
import 'package:fcs/domain/entities/package.dart';
|
import 'package:fcs/domain/entities/package.dart';
|
||||||
|
import 'package:fcs/domain/entities/shipment.dart';
|
||||||
import 'package:fcs/domain/entities/user.dart';
|
import 'package:fcs/domain/entities/user.dart';
|
||||||
import 'package:fcs/domain/vo/message.dart';
|
import 'package:fcs/domain/vo/message.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
@@ -7,11 +8,12 @@ import 'package:fcs/pages/chat/model/message_model.dart';
|
|||||||
import 'package:fcs/pages/customer/customer_editor.dart';
|
import 'package:fcs/pages/customer/customer_editor.dart';
|
||||||
import 'package:fcs/pages/customer/model/customer_model.dart';
|
import 'package:fcs/pages/customer/model/customer_model.dart';
|
||||||
import 'package:fcs/pages/main/model/main_model.dart';
|
import 'package:fcs/pages/main/model/main_model.dart';
|
||||||
|
import 'package:fcs/pages/main/util.dart';
|
||||||
import 'package:fcs/pages/package/model/package_model.dart';
|
import 'package:fcs/pages/package/model/package_model.dart';
|
||||||
import 'package:fcs/pages/package/package_info.dart';
|
import 'package:fcs/pages/package/package_info.dart';
|
||||||
import 'package:fcs/pages/profile/profile_page.dart';
|
import 'package:fcs/pages/profile/profile_page.dart';
|
||||||
import 'package:fcs/pages/main/util.dart';
|
import 'package:fcs/pages/shipment/model/shipment_model.dart';
|
||||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
import 'package:fcs/pages/shipment/shipment_info.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@@ -195,5 +197,20 @@ class MessageDetail extends StatelessWidget {
|
|||||||
builder: (context) => CustomerEditor(customer: user)));
|
builder: (context) => CustomerEditor(customer: user)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (message.messageType == message_type_shipment &&
|
||||||
|
message.messageID != null &&
|
||||||
|
message.messageID != "") {
|
||||||
|
ShipmentModel shipmentModel =
|
||||||
|
Provider.of<ShipmentModel>(context, listen: false);
|
||||||
|
Shipment s = await shipmentModel.getShipment(message.messageID);
|
||||||
|
if (s == null) return;
|
||||||
|
await Navigator.push<bool>(
|
||||||
|
context,
|
||||||
|
CupertinoPageRoute(
|
||||||
|
builder: (context) => ShipmentInfo(
|
||||||
|
shipment: s,
|
||||||
|
isCustomer: true,
|
||||||
|
)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import 'package:fcs/pages/widgets/input_date.dart';
|
|||||||
import 'package:fcs/pages/widgets/input_text.dart';
|
import 'package:fcs/pages/widgets/input_text.dart';
|
||||||
import 'package:fcs/pages/widgets/local_button.dart';
|
import 'package:fcs/pages/widgets/local_button.dart';
|
||||||
import 'package:fcs/pages/widgets/local_text.dart';
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
import 'package:fcs/pages/widgets/popupmenu.dart';
|
|
||||||
import 'package:fcs/pages/widgets/progress.dart';
|
import 'package:fcs/pages/widgets/progress.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -256,7 +255,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
|||||||
var shipmentModel = Provider.of<FcsShipmentModel>(context, listen: false);
|
var shipmentModel = Provider.of<FcsShipmentModel>(context, listen: false);
|
||||||
try {
|
try {
|
||||||
await shipmentModel.update(fcsShipment);
|
await shipmentModel.update(fcsShipment);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context, true);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showMsgDialog(context, "Error", e.toString());
|
showMsgDialog(context, "Error", e.toString());
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_fcsShipment = widget.fcsShipment;
|
_fcsShipment = widget.fcsShipment;
|
||||||
|
_load();
|
||||||
|
}
|
||||||
|
|
||||||
|
_load() {
|
||||||
_shipmentNumberController.text = _fcsShipment.shipmentNumber;
|
_shipmentNumberController.text = _fcsShipment.shipmentNumber;
|
||||||
_cutoffDateController.text = dateFormatter.format(_fcsShipment.cutoffDate);
|
_cutoffDateController.text = dateFormatter.format(_fcsShipment.cutoffDate);
|
||||||
_arrivalDateController.text =
|
_arrivalDateController.text =
|
||||||
@@ -177,11 +181,19 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_edit() async {
|
_edit() async {
|
||||||
await Navigator.push(
|
bool updated = await Navigator.push<bool>(
|
||||||
context,
|
context,
|
||||||
CupertinoPageRoute(
|
CupertinoPageRoute(
|
||||||
builder: (context) => FcsShipmentEditor(shipment: _fcsShipment)),
|
builder: (context) => FcsShipmentEditor(shipment: _fcsShipment)),
|
||||||
);
|
);
|
||||||
|
if (updated) {
|
||||||
|
var shipmentModel = Provider.of<FcsShipmentModel>(context, listen: false);
|
||||||
|
var f = await shipmentModel.getFcsShipment(_fcsShipment.id);
|
||||||
|
setState(() {
|
||||||
|
_fcsShipment = f;
|
||||||
|
});
|
||||||
|
_load();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget menuPopWidget(BuildContext context) {
|
Widget menuPopWidget(BuildContext context) {
|
||||||
|
|||||||
@@ -116,6 +116,21 @@ class FcsShipmentModel extends BaseModel {
|
|||||||
return fcsShipments;
|
return fcsShipments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<FcsShipment> getFcsShipment(String id) async {
|
||||||
|
try {
|
||||||
|
var snap = await Firestore.instance
|
||||||
|
.collection("/$fcs_shipment_collection")
|
||||||
|
.document(id)
|
||||||
|
.get(source: Source.server);
|
||||||
|
var fcs = FcsShipment.fromMap(snap.data, snap.documentID);
|
||||||
|
|
||||||
|
return fcs;
|
||||||
|
} catch (e) {
|
||||||
|
log.warning("Error!! $e");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
void initUser(user) {
|
void initUser(user) {
|
||||||
super.initUser(user);
|
super.initUser(user);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user