fix issues
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
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/package.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_editor.dart';
|
||||
import 'carton_mix_table.dart';
|
||||
import 'carton_package_table.dart';
|
||||
import 'model/carton_model.dart';
|
||||
import 'widgets.dart';
|
||||
@@ -41,11 +39,6 @@ class CartonInfo extends StatefulWidget {
|
||||
class _CartonInfoState extends State<CartonInfo> {
|
||||
bool _isLoading = false;
|
||||
Carton _box;
|
||||
String _selectedCartonType;
|
||||
List<Package> _packages = [];
|
||||
List<Carton> _mixBoxes = [];
|
||||
Carton _selectedShipmentBox = new Carton();
|
||||
List<CargoType> _cargoTypes = [];
|
||||
DeliveryAddress _deliveryAddress = new DeliveryAddress();
|
||||
TextEditingController _widthController = new TextEditingController();
|
||||
TextEditingController _heightController = new TextEditingController();
|
||||
@@ -63,7 +56,6 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
_box = widget.box;
|
||||
_selectedCartonType = _box.cartonType;
|
||||
|
||||
//for shipment weight
|
||||
volumetricRatio = Provider.of<ShipmentRateModel>(context, listen: false)
|
||||
@@ -81,7 +73,6 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
_widthController.text = _box.width.toString();
|
||||
_heightController.text = _box.height.toString();
|
||||
_lengthController.text = _box.length.toString();
|
||||
_cargoTypes = _box.cargoTypes;
|
||||
_deliveryAddress = _box.deliveryAddress;
|
||||
isMixBox = _box.cartonType == carton_mix_box;
|
||||
isFromShipments = _box.cartonType == carton_from_shipments;
|
||||
@@ -101,7 +92,8 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
List<Package> packages = await packageModel.getPackages(_box.userID, [
|
||||
package_processed_status,
|
||||
package_packed_status,
|
||||
package_shipped_status
|
||||
package_shipped_status,
|
||||
package_delivered_status
|
||||
]);
|
||||
packages = packages.where((p) => _box.packageIDs.contains(p.id)).toList();
|
||||
packages.forEach((p) {
|
||||
@@ -155,38 +147,6 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
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(
|
||||
controller: _lengthController,
|
||||
lableKey: "box.length",
|
||||
@@ -276,30 +236,6 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
packages: _box.packages,
|
||||
)
|
||||
: 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() : cargoTableBox,
|
||||
...(isFromPackages
|
||||
|
||||
@@ -99,7 +99,8 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
|
||||
List<Package> packages = await packageModel.getPackages(_box.userID, [
|
||||
package_processed_status,
|
||||
package_packed_status,
|
||||
package_shipped_status
|
||||
package_shipped_status,
|
||||
package_delivered_status
|
||||
]);
|
||||
packages = packages.where((p) => _box.packageIDs.contains(p.id)).toList();
|
||||
packages.forEach((p) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import 'discount_editor.dart';
|
||||
class DiscountList extends StatefulWidget {
|
||||
final bool selectionMode;
|
||||
|
||||
const DiscountList({Key key, this.selectionMode}) : super(key: key);
|
||||
const DiscountList({Key key, this.selectionMode = false}) : super(key: key);
|
||||
@override
|
||||
_DiscountListState createState() => _DiscountListState();
|
||||
}
|
||||
|
||||
@@ -186,7 +186,6 @@ class PackageModel extends BaseModel {
|
||||
.where("status", whereIn: status)
|
||||
.where("user_id", isEqualTo: userID)
|
||||
.where("is_deleted", isEqualTo: false)
|
||||
.where("is_delivered", isEqualTo: false)
|
||||
.getDocuments(source: Source.server);
|
||||
packages = snaps.documents.map((documentSnapshot) {
|
||||
var p =
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
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:fcs/data/services/services.dart';
|
||||
import 'package:fcs/domain/constants.dart';
|
||||
import 'package:fcs/domain/entities/shipment.dart';
|
||||
import 'package:fcs/domain/vo/message.dart';
|
||||
import 'package:fcs/helpers/paginator.dart';
|
||||
import 'package:fcs/pages/main/model/base_model.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
@@ -132,6 +128,11 @@ class ShipmentModel extends BaseModel {
|
||||
shipment_courier_dropoff
|
||||
];
|
||||
|
||||
Shipment getActiveShipment(String shipmentID) {
|
||||
return _shipments?.firstWhere((e) => e.id == shipmentID,
|
||||
orElse: () => null);
|
||||
}
|
||||
|
||||
Future<Shipment> getShipment(String shipmentID) async {
|
||||
String path = "/$shipments_collection";
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user