fix issues
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import 'package:fcs/domain/constants.dart';
|
import 'package:fcs/domain/constants.dart';
|
||||||
import 'package:fcs/domain/entities/cargo_type.dart';
|
|
||||||
import 'package:fcs/domain/entities/carton.dart';
|
import 'package:fcs/domain/entities/carton.dart';
|
||||||
import 'package:fcs/domain/entities/package.dart';
|
import 'package:fcs/domain/entities/package.dart';
|
||||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
@@ -23,7 +22,6 @@ import 'package:provider/provider.dart';
|
|||||||
|
|
||||||
import 'carton_cargo_table.dart';
|
import 'carton_cargo_table.dart';
|
||||||
import 'carton_editor.dart';
|
import 'carton_editor.dart';
|
||||||
import 'carton_mix_table.dart';
|
|
||||||
import 'carton_package_table.dart';
|
import 'carton_package_table.dart';
|
||||||
import 'model/carton_model.dart';
|
import 'model/carton_model.dart';
|
||||||
import 'widgets.dart';
|
import 'widgets.dart';
|
||||||
@@ -41,11 +39,6 @@ class CartonInfo extends StatefulWidget {
|
|||||||
class _CartonInfoState extends State<CartonInfo> {
|
class _CartonInfoState extends State<CartonInfo> {
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
Carton _box;
|
Carton _box;
|
||||||
String _selectedCartonType;
|
|
||||||
List<Package> _packages = [];
|
|
||||||
List<Carton> _mixBoxes = [];
|
|
||||||
Carton _selectedShipmentBox = new Carton();
|
|
||||||
List<CargoType> _cargoTypes = [];
|
|
||||||
DeliveryAddress _deliveryAddress = new DeliveryAddress();
|
DeliveryAddress _deliveryAddress = new DeliveryAddress();
|
||||||
TextEditingController _widthController = new TextEditingController();
|
TextEditingController _widthController = new TextEditingController();
|
||||||
TextEditingController _heightController = new TextEditingController();
|
TextEditingController _heightController = new TextEditingController();
|
||||||
@@ -63,7 +56,6 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_box = widget.box;
|
_box = widget.box;
|
||||||
_selectedCartonType = _box.cartonType;
|
|
||||||
|
|
||||||
//for shipment weight
|
//for shipment weight
|
||||||
volumetricRatio = Provider.of<ShipmentRateModel>(context, listen: false)
|
volumetricRatio = Provider.of<ShipmentRateModel>(context, listen: false)
|
||||||
@@ -81,7 +73,6 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
_widthController.text = _box.width.toString();
|
_widthController.text = _box.width.toString();
|
||||||
_heightController.text = _box.height.toString();
|
_heightController.text = _box.height.toString();
|
||||||
_lengthController.text = _box.length.toString();
|
_lengthController.text = _box.length.toString();
|
||||||
_cargoTypes = _box.cargoTypes;
|
|
||||||
_deliveryAddress = _box.deliveryAddress;
|
_deliveryAddress = _box.deliveryAddress;
|
||||||
isMixBox = _box.cartonType == carton_mix_box;
|
isMixBox = _box.cartonType == carton_mix_box;
|
||||||
isFromShipments = _box.cartonType == carton_from_shipments;
|
isFromShipments = _box.cartonType == carton_from_shipments;
|
||||||
@@ -101,7 +92,8 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
List<Package> packages = await packageModel.getPackages(_box.userID, [
|
List<Package> packages = await packageModel.getPackages(_box.userID, [
|
||||||
package_processed_status,
|
package_processed_status,
|
||||||
package_packed_status,
|
package_packed_status,
|
||||||
package_shipped_status
|
package_shipped_status,
|
||||||
|
package_delivered_status
|
||||||
]);
|
]);
|
||||||
packages = packages.where((p) => _box.packageIDs.contains(p.id)).toList();
|
packages = packages.where((p) => _box.packageIDs.contains(p.id)).toList();
|
||||||
packages.forEach((p) {
|
packages.forEach((p) {
|
||||||
@@ -155,38 +147,6 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
iconData: Icons.person,
|
iconData: Icons.person,
|
||||||
);
|
);
|
||||||
|
|
||||||
final shipmentBoxTitle = Container(
|
|
||||||
padding: EdgeInsets.only(left: 15, right: 10.0, top: 20),
|
|
||||||
child: Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child:
|
|
||||||
LocalText(context, 'box.shipment_number', color: Colors.grey),
|
|
||||||
),
|
|
||||||
LocalText(context, 'box.shipment.desc', color: Colors.grey),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
final shipmentBoxRow = Container(
|
|
||||||
padding: EdgeInsets.only(left: 15.0, right: 10.0, top: 5.0, bottom: 5.0),
|
|
||||||
child: Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: new Text(
|
|
||||||
_selectedShipmentBox.shipmentNumber == null
|
|
||||||
? ""
|
|
||||||
: _selectedShipmentBox.shipmentNumber,
|
|
||||||
style: textStyle,
|
|
||||||
)),
|
|
||||||
new Text(
|
|
||||||
_selectedShipmentBox.desc == null ? "" : _selectedShipmentBox.desc,
|
|
||||||
style: textStyle,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
final lengthBox = LengthPicker(
|
final lengthBox = LengthPicker(
|
||||||
controller: _lengthController,
|
controller: _lengthController,
|
||||||
lableKey: "box.length",
|
lableKey: "box.length",
|
||||||
@@ -276,30 +236,6 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
packages: _box.packages,
|
packages: _box.packages,
|
||||||
)
|
)
|
||||||
: Container(),
|
: Container(),
|
||||||
isFromPackages
|
|
||||||
? Container()
|
|
||||||
: isFromShipments
|
|
||||||
? Column(
|
|
||||||
children: [
|
|
||||||
LocalTitle(textKey: "box.shipment.boxes"),
|
|
||||||
shipmentBoxTitle,
|
|
||||||
Divider(
|
|
||||||
color: Colors.grey[400],
|
|
||||||
),
|
|
||||||
shipmentBoxRow
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: Container(),
|
|
||||||
// : _selectedCartonType == "Mix carton"
|
|
||||||
// ? CartonMixTable(
|
|
||||||
// cartons: _box.cartons,
|
|
||||||
// onSelect: (c, check) {
|
|
||||||
// setState(() {
|
|
||||||
// c.isChecked = check;
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// )
|
|
||||||
// : Container(),
|
|
||||||
isMixBox ? Container() : LocalTitle(textKey: "box.cargo.type"),
|
isMixBox ? Container() : LocalTitle(textKey: "box.cargo.type"),
|
||||||
isMixBox ? Container() : cargoTableBox,
|
isMixBox ? Container() : cargoTableBox,
|
||||||
...(isFromPackages
|
...(isFromPackages
|
||||||
|
|||||||
@@ -99,7 +99,8 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
|
|||||||
List<Package> packages = await packageModel.getPackages(_box.userID, [
|
List<Package> packages = await packageModel.getPackages(_box.userID, [
|
||||||
package_processed_status,
|
package_processed_status,
|
||||||
package_packed_status,
|
package_packed_status,
|
||||||
package_shipped_status
|
package_shipped_status,
|
||||||
|
package_delivered_status
|
||||||
]);
|
]);
|
||||||
packages = packages.where((p) => _box.packageIDs.contains(p.id)).toList();
|
packages = packages.where((p) => _box.packageIDs.contains(p.id)).toList();
|
||||||
packages.forEach((p) {
|
packages.forEach((p) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import 'discount_editor.dart';
|
|||||||
class DiscountList extends StatefulWidget {
|
class DiscountList extends StatefulWidget {
|
||||||
final bool selectionMode;
|
final bool selectionMode;
|
||||||
|
|
||||||
const DiscountList({Key key, this.selectionMode}) : super(key: key);
|
const DiscountList({Key key, this.selectionMode = false}) : super(key: key);
|
||||||
@override
|
@override
|
||||||
_DiscountListState createState() => _DiscountListState();
|
_DiscountListState createState() => _DiscountListState();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,7 +186,6 @@ class PackageModel extends BaseModel {
|
|||||||
.where("status", whereIn: status)
|
.where("status", whereIn: status)
|
||||||
.where("user_id", isEqualTo: userID)
|
.where("user_id", isEqualTo: userID)
|
||||||
.where("is_deleted", isEqualTo: false)
|
.where("is_deleted", isEqualTo: false)
|
||||||
.where("is_delivered", isEqualTo: false)
|
|
||||||
.getDocuments(source: Source.server);
|
.getDocuments(source: Source.server);
|
||||||
packages = snaps.documents.map((documentSnapshot) {
|
packages = snaps.documents.map((documentSnapshot) {
|
||||||
var p =
|
var p =
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
|
||||||
import 'package:fcs/helpers/firebase_helper.dart';
|
|
||||||
import 'package:path/path.dart' as Path;
|
|
||||||
|
|
||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
import 'package:fcs/data/services/services.dart';
|
import 'package:fcs/data/services/services.dart';
|
||||||
import 'package:fcs/domain/constants.dart';
|
import 'package:fcs/domain/constants.dart';
|
||||||
import 'package:fcs/domain/entities/shipment.dart';
|
import 'package:fcs/domain/entities/shipment.dart';
|
||||||
import 'package:fcs/domain/vo/message.dart';
|
|
||||||
import 'package:fcs/helpers/paginator.dart';
|
import 'package:fcs/helpers/paginator.dart';
|
||||||
import 'package:fcs/pages/main/model/base_model.dart';
|
import 'package:fcs/pages/main/model/base_model.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
@@ -132,6 +128,11 @@ class ShipmentModel extends BaseModel {
|
|||||||
shipment_courier_dropoff
|
shipment_courier_dropoff
|
||||||
];
|
];
|
||||||
|
|
||||||
|
Shipment getActiveShipment(String shipmentID) {
|
||||||
|
return _shipments?.firstWhere((e) => e.id == shipmentID,
|
||||||
|
orElse: () => null);
|
||||||
|
}
|
||||||
|
|
||||||
Future<Shipment> getShipment(String shipmentID) async {
|
Future<Shipment> getShipment(String shipmentID) async {
|
||||||
String path = "/$shipments_collection";
|
String path = "/$shipments_collection";
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user