2020-10-08 03:32:52 +06:30
|
|
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
|
|
|
|
|
2020-10-07 14:42:07 +06:30
|
|
|
class FcsShipment {
|
2021-09-10 14:27:38 +06:30
|
|
|
String? id;
|
|
|
|
|
String? shipmentNumber;
|
|
|
|
|
DateTime? cutoffDate;
|
2024-09-25 21:49:09 +06:30
|
|
|
DateTime? etaDate;
|
2024-03-01 17:27:56 +06:30
|
|
|
String? shipmentTypeId;
|
2024-09-25 21:49:09 +06:30
|
|
|
String? shipmentTypeName;
|
2021-09-10 14:27:38 +06:30
|
|
|
DateTime? departureDate;
|
2024-09-25 21:49:09 +06:30
|
|
|
String? consigneeId;
|
|
|
|
|
String? consigneeName;
|
|
|
|
|
String? loadingPortId;
|
|
|
|
|
String? loadingPortName;
|
|
|
|
|
String? destinationPortId;
|
|
|
|
|
String? destinationPortName;
|
2021-09-10 14:27:38 +06:30
|
|
|
String? status;
|
|
|
|
|
String? reportName;
|
|
|
|
|
|
2020-10-08 03:32:52 +06:30
|
|
|
FcsShipment({
|
|
|
|
|
this.id,
|
|
|
|
|
this.shipmentNumber,
|
|
|
|
|
this.cutoffDate,
|
2024-03-01 17:27:56 +06:30
|
|
|
this.shipmentTypeId,
|
2024-09-25 21:49:09 +06:30
|
|
|
this.shipmentTypeName,
|
2020-10-08 03:32:52 +06:30
|
|
|
this.status,
|
2024-09-25 21:49:09 +06:30
|
|
|
this.etaDate,
|
2020-10-08 03:32:52 +06:30
|
|
|
this.departureDate,
|
2024-09-25 21:49:09 +06:30
|
|
|
this.consigneeId,
|
|
|
|
|
this.consigneeName,
|
|
|
|
|
this.loadingPortId,
|
|
|
|
|
this.loadingPortName,
|
|
|
|
|
this.destinationPortId,
|
|
|
|
|
this.destinationPortName,
|
2020-10-28 05:11:06 +06:30
|
|
|
this.reportName,
|
2020-10-08 03:32:52 +06:30
|
|
|
});
|
|
|
|
|
|
|
|
|
|
factory FcsShipment.fromMap(Map<String, dynamic> map, String docID) {
|
2024-01-23 16:28:08 +06:30
|
|
|
var _cutoffDate =
|
|
|
|
|
map['cutoff_date'] == null ? null : (map['cutoff_date'] as Timestamp);
|
|
|
|
|
var _arrivalDate =
|
2024-09-25 21:49:09 +06:30
|
|
|
map['eta_date'] == null ? null : (map['eta_date'] as Timestamp);
|
2020-10-08 03:32:52 +06:30
|
|
|
|
|
|
|
|
return FcsShipment(
|
2024-09-25 21:49:09 +06:30
|
|
|
id: docID,
|
|
|
|
|
cutoffDate: _cutoffDate != null ? _cutoffDate.toDate() : null,
|
|
|
|
|
etaDate: _arrivalDate != null ? _arrivalDate.toDate() : null,
|
|
|
|
|
shipmentNumber: map['shipment_number'],
|
|
|
|
|
shipmentTypeId: map['shipment_type_id'] ?? "",
|
|
|
|
|
shipmentTypeName: map['shipment_type_name'],
|
|
|
|
|
status: map['status'],
|
|
|
|
|
consigneeId: map['shipment_consignee_id'],
|
|
|
|
|
consigneeName: map['shipment_consignee_name'],
|
|
|
|
|
loadingPortId: map['loading_port_id'],
|
|
|
|
|
loadingPortName: map['loading_port_name'],
|
|
|
|
|
destinationPortId: map['destination_port_id'],
|
|
|
|
|
destinationPortName: map['destination_port_name']);
|
2020-10-08 03:32:52 +06:30
|
|
|
}
|
2020-10-07 17:22:01 +06:30
|
|
|
|
|
|
|
|
Map<String, dynamic> toMap() {
|
|
|
|
|
return {
|
2024-03-02 18:15:05 +06:30
|
|
|
'id': id,
|
2020-10-07 17:22:01 +06:30
|
|
|
'shipment_number': shipmentNumber,
|
2021-09-10 14:27:38 +06:30
|
|
|
'cutoff_date': cutoffDate?.toUtc().toIso8601String(),
|
2024-09-25 21:49:09 +06:30
|
|
|
'eta_date': etaDate?.toUtc().toIso8601String(),
|
|
|
|
|
'shipment_type_id': shipmentTypeId,
|
|
|
|
|
'shipment_consignee_id': consigneeId,
|
|
|
|
|
'loading_port_id': loadingPortId,
|
|
|
|
|
'destination_port_id': destinationPortId
|
2020-10-07 17:22:01 +06:30
|
|
|
};
|
|
|
|
|
}
|
2020-10-08 03:32:52 +06:30
|
|
|
|
2020-12-08 20:24:15 +06:30
|
|
|
bool isChangedForEdit(FcsShipment fcsShipment) {
|
|
|
|
|
return fcsShipment.shipmentNumber != this.shipmentNumber ||
|
|
|
|
|
fcsShipment.cutoffDate != this.cutoffDate ||
|
2024-09-25 21:49:09 +06:30
|
|
|
fcsShipment.etaDate != this.etaDate ||
|
2024-03-01 17:27:56 +06:30
|
|
|
fcsShipment.shipmentTypeId != this.shipmentTypeId ||
|
2024-09-25 21:49:09 +06:30
|
|
|
fcsShipment.consigneeId != this.consigneeId ||
|
|
|
|
|
fcsShipment.loadingPortId != this.loadingPortId ||
|
|
|
|
|
fcsShipment.destinationPortId != this.destinationPortId;
|
2020-12-08 20:24:15 +06:30
|
|
|
}
|
2024-02-02 18:00:51 +06:30
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
bool operator ==(Object other) => other is FcsShipment && other.id == id;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
int get hashCode => id.hashCode;
|
2020-09-15 07:13:41 +06:30
|
|
|
}
|