update carton and fcs shipment
This commit is contained in:
@@ -16,35 +16,38 @@ class FcsShipment {
|
||||
String? destinationPortName;
|
||||
String? status;
|
||||
String? reportName;
|
||||
int packageCount;
|
||||
int cartonCount;
|
||||
|
||||
FcsShipment({
|
||||
this.id,
|
||||
this.shipmentNumber,
|
||||
this.cutoffDate,
|
||||
this.shipmentTypeId,
|
||||
this.shipmentTypeName,
|
||||
this.status,
|
||||
this.etaDate,
|
||||
this.departureDate,
|
||||
this.consigneeId,
|
||||
this.consigneeName,
|
||||
this.loadingPortId,
|
||||
this.loadingPortName,
|
||||
this.destinationPortId,
|
||||
this.destinationPortName,
|
||||
this.reportName,
|
||||
});
|
||||
FcsShipment(
|
||||
{this.id,
|
||||
this.shipmentNumber,
|
||||
this.cutoffDate,
|
||||
this.shipmentTypeId,
|
||||
this.shipmentTypeName,
|
||||
this.status,
|
||||
this.etaDate,
|
||||
this.departureDate,
|
||||
this.consigneeId,
|
||||
this.consigneeName,
|
||||
this.loadingPortId,
|
||||
this.loadingPortName,
|
||||
this.destinationPortId,
|
||||
this.destinationPortName,
|
||||
this.reportName,
|
||||
this.packageCount = 0,
|
||||
this.cartonCount = 0});
|
||||
|
||||
factory FcsShipment.fromMap(Map<String, dynamic> map, String docID) {
|
||||
var _cutoffDate =
|
||||
var cutoffDate =
|
||||
map['cutoff_date'] == null ? null : (map['cutoff_date'] as Timestamp);
|
||||
var _arrivalDate =
|
||||
var arrivalDate =
|
||||
map['eta_date'] == null ? null : (map['eta_date'] as Timestamp);
|
||||
|
||||
return FcsShipment(
|
||||
id: docID,
|
||||
cutoffDate: _cutoffDate != null ? _cutoffDate.toDate() : null,
|
||||
etaDate: _arrivalDate != null ? _arrivalDate.toDate() : null,
|
||||
cutoffDate: cutoffDate?.toDate(),
|
||||
etaDate: arrivalDate?.toDate(),
|
||||
shipmentNumber: map['shipment_number'],
|
||||
shipmentTypeId: map['shipment_type_id'] ?? "",
|
||||
shipmentTypeName: map['shipment_type_name'],
|
||||
@@ -54,7 +57,9 @@ class FcsShipment {
|
||||
loadingPortId: map['loading_port_id'],
|
||||
loadingPortName: map['loading_port_name'],
|
||||
destinationPortId: map['destination_port_id'],
|
||||
destinationPortName: map['destination_port_name']);
|
||||
destinationPortName: map['destination_port_name'],
|
||||
packageCount: map['package_count'] ?? 0,
|
||||
cartonCount: map['carton_count'] ?? 0);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
@@ -71,13 +76,13 @@ class FcsShipment {
|
||||
}
|
||||
|
||||
bool isChangedForEdit(FcsShipment fcsShipment) {
|
||||
return fcsShipment.shipmentNumber != this.shipmentNumber ||
|
||||
fcsShipment.cutoffDate != this.cutoffDate ||
|
||||
fcsShipment.etaDate != this.etaDate ||
|
||||
fcsShipment.shipmentTypeId != this.shipmentTypeId ||
|
||||
fcsShipment.consigneeId != this.consigneeId ||
|
||||
fcsShipment.loadingPortId != this.loadingPortId ||
|
||||
fcsShipment.destinationPortId != this.destinationPortId;
|
||||
return fcsShipment.shipmentNumber != shipmentNumber ||
|
||||
fcsShipment.cutoffDate != cutoffDate ||
|
||||
fcsShipment.etaDate != etaDate ||
|
||||
fcsShipment.shipmentTypeId != shipmentTypeId ||
|
||||
fcsShipment.consigneeId != consigneeId ||
|
||||
fcsShipment.loadingPortId != loadingPortId ||
|
||||
fcsShipment.destinationPortId != destinationPortId;
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -74,17 +74,20 @@ class Package {
|
||||
this.cartonIds = const []});
|
||||
|
||||
factory Package.fromMap(Map<String, dynamic> map, String docID) {
|
||||
var _currentStatusDate = (map['status_date'] as Timestamp);
|
||||
var currentStatusDate =
|
||||
map['status_date'] != null ? (map['status_date'] as Timestamp) : null;
|
||||
|
||||
List<ShipmentStatus> _shipmentStatus = List.from(map['all_status'])
|
||||
List<ShipmentStatus> shipmentStatus = List.from(map['all_status'])
|
||||
.map((e) => ShipmentStatus.fromMap(Map<String, dynamic>.from(e)))
|
||||
.toList();
|
||||
List<String> _photoUrls =
|
||||
List<String> photoUrls =
|
||||
map['photo_urls'] == null ? [] : List.from(map['photo_urls']);
|
||||
var da = map['delivery_address'];
|
||||
var _da = da != null ? DeliveryAddress.fromMap(da, da["id"]) : null;
|
||||
var deliveryAddress = map['delivery_address'];
|
||||
var da = deliveryAddress != null
|
||||
? DeliveryAddress.fromMap(deliveryAddress, deliveryAddress["id"])
|
||||
: null;
|
||||
|
||||
List<String> cartonIds =
|
||||
List<String> cartonIds =
|
||||
map['carton_ids'] == null ? [] : List.from(map['carton_ids']);
|
||||
|
||||
return Package(
|
||||
@@ -101,10 +104,10 @@ class Package {
|
||||
senderFCSID: map['sender_fcs_id'],
|
||||
senderName: map['sender_name'],
|
||||
senderPhoneNumber: map['sender_phone_number'],
|
||||
deliveryAddress: _da,
|
||||
currentStatusDate: _currentStatusDate.toDate().toLocal(),
|
||||
photoUrls: _photoUrls,
|
||||
shipmentHistory: _shipmentStatus,
|
||||
deliveryAddress: da,
|
||||
currentStatusDate: currentStatusDate?.toDate().toLocal(),
|
||||
photoUrls: photoUrls,
|
||||
shipmentHistory: shipmentStatus,
|
||||
cartonIds: cartonIds);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,13 +13,14 @@ class LocalPopupMenu {
|
||||
this.highlight = false,
|
||||
this.enabled = true});
|
||||
}
|
||||
|
||||
List<LocalPopupMenu> shipFiteringMenu = <LocalPopupMenu>[
|
||||
LocalPopupMenu(id: 0, text :"All"),
|
||||
LocalPopupMenu(id: 0, text: "All"),
|
||||
LocalPopupMenu(id: 1, text: "Pending"),
|
||||
LocalPopupMenu(id: 2, text: "Processed"),
|
||||
LocalPopupMenu(id: 3, text: "Shipped"),
|
||||
LocalPopupMenu(id: 4, text: "Arrived"),
|
||||
LocalPopupMenu(id: 5, text: "Invoiced"),
|
||||
LocalPopupMenu(id: 7, text: "Delivered"),
|
||||
LocalPopupMenu(id: 6, text: "Canceled"),
|
||||
];
|
||||
|
||||
|
||||
@@ -2,22 +2,22 @@ import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
|
||||
class ShipmentStatus {
|
||||
String status;
|
||||
DateTime date;
|
||||
DateTime? date;
|
||||
bool? done;
|
||||
String? staffId;
|
||||
String? staffName;
|
||||
ShipmentStatus(
|
||||
{required this.status,
|
||||
required this.date,
|
||||
this.date,
|
||||
this.done,
|
||||
this.staffId,
|
||||
this.staffName});
|
||||
|
||||
factory ShipmentStatus.fromMap(Map<String, dynamic> map) {
|
||||
var _date = (map['date'] as Timestamp);
|
||||
var _date = map['date'] != null ? (map['date'] as Timestamp) : null;
|
||||
return ShipmentStatus(
|
||||
status: map['status'],
|
||||
date: _date.toDate(),
|
||||
date: _date?.toDate(),
|
||||
done: map['done'],
|
||||
staffId: map['staff_id'],
|
||||
staffName: map['staff_name']);
|
||||
|
||||
Reference in New Issue
Block a user