add fcs shipment apis
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
|
||||
class FcsShipment {
|
||||
String id;
|
||||
DateTime shipDate;
|
||||
String shipmentNumber;
|
||||
DateTime cutoffDate;
|
||||
String shipType;
|
||||
@@ -10,25 +13,41 @@ class FcsShipment {
|
||||
String port;
|
||||
String destination;
|
||||
String status;
|
||||
String remark;
|
||||
FcsShipment(
|
||||
{this.id,
|
||||
this.shipDate,
|
||||
this.shipmentNumber,
|
||||
this.cutoffDate,
|
||||
this.shipType,
|
||||
this.status,
|
||||
this.arrivalDate,
|
||||
this.departureDate,
|
||||
this.consignee,
|
||||
this.port,
|
||||
this.destination,
|
||||
this.remark});
|
||||
FcsShipment({
|
||||
this.id,
|
||||
this.shipmentNumber,
|
||||
this.cutoffDate,
|
||||
this.shipType,
|
||||
this.status,
|
||||
this.arrivalDate,
|
||||
this.departureDate,
|
||||
this.consignee,
|
||||
this.port,
|
||||
this.destination,
|
||||
});
|
||||
|
||||
factory FcsShipment.fromMap(Map<String, dynamic> map, String docID) {
|
||||
var _cutoffDate = (map['cutoff_date'] as Timestamp);
|
||||
var _arrivalDate = (map['arrival_date'] as Timestamp);
|
||||
var _departureDate = (map['departure_date'] as Timestamp);
|
||||
|
||||
return FcsShipment(
|
||||
id: docID,
|
||||
cutoffDate: _cutoffDate != null ? _cutoffDate.toDate() : null,
|
||||
arrivalDate: _arrivalDate != null ? _arrivalDate.toDate() : null,
|
||||
departureDate: _departureDate != null ? _departureDate.toDate() : null,
|
||||
shipmentNumber: map['shipment_number'],
|
||||
shipType: map['shipment_type'],
|
||||
status: map['status'],
|
||||
consignee: map['consignee'],
|
||||
port: map['port'],
|
||||
destination: map['destination'],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"id": id,
|
||||
'shipment_date': shipDate?.toUtc()?.toIso8601String(),
|
||||
'shipment_number': shipmentNumber,
|
||||
'cutoff_date': cutoffDate?.toUtc()?.toIso8601String(),
|
||||
'shipment_type': shipType,
|
||||
@@ -38,7 +57,10 @@ class FcsShipment {
|
||||
'port': port,
|
||||
'destination': destination,
|
||||
'status': status,
|
||||
'remark': remark,
|
||||
};
|
||||
}
|
||||
|
||||
bool isConfirmed() {
|
||||
return status == fcs_shipment_confirmed_status;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user