add packages
This commit is contained in:
@@ -3,6 +3,8 @@ const user_collection = "users";
|
||||
const invitations_collection = "invitations";
|
||||
const setting_doc_id = "setting";
|
||||
const privilege_collection = "privileges";
|
||||
const markets_collection = "markets";
|
||||
const packages_collection = "packages";
|
||||
|
||||
const ok_doc_id = "ok";
|
||||
|
||||
|
||||
28
lib/fcs/common/domain/entities/market.dart
Normal file
28
lib/fcs/common/domain/entities/market.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
class Market {
|
||||
String id;
|
||||
String name;
|
||||
|
||||
Market({
|
||||
this.id,
|
||||
this.name,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'id': id,
|
||||
'name': name,
|
||||
};
|
||||
}
|
||||
|
||||
factory Market.fromMap(Map<String, dynamic> map, String id) {
|
||||
return Market(
|
||||
id: id,
|
||||
name: map['name'],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Market{id: $id, name: $name}';
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,19 @@
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:fcs/fcs/common/domain/vo/shipment_status.dart';
|
||||
|
||||
class Package {
|
||||
String id;
|
||||
String trackingID;
|
||||
String userID;
|
||||
String fcsID;
|
||||
String userName;
|
||||
String phoneNumber;
|
||||
String status;
|
||||
String currentStatus;
|
||||
DateTime currentStatusDate;
|
||||
List<Map<String, dynamic>> allStatus;
|
||||
List<String> photoUrls;
|
||||
|
||||
String status;
|
||||
String shipmentNumber;
|
||||
String senderFCSID;
|
||||
String senderName;
|
||||
@@ -39,6 +45,9 @@ class Package {
|
||||
this.id,
|
||||
this.trackingID,
|
||||
this.userID,
|
||||
this.userName,
|
||||
this.fcsID,
|
||||
this.phoneNumber,
|
||||
this.shipmentNumber,
|
||||
this.senderFCSID,
|
||||
this.senderName,
|
||||
@@ -57,5 +66,36 @@ class Package {
|
||||
this.cargoDesc,
|
||||
this.market,
|
||||
this.shipmentHistory,
|
||||
this.allStatus,
|
||||
this.currentStatus,
|
||||
this.currentStatusDate,
|
||||
this.photoUrls,
|
||||
});
|
||||
|
||||
factory Package.fromMap(Map<String, dynamic> map, String docID) {
|
||||
var _currentStatusDate = (map['current_status_date'] as Timestamp);
|
||||
|
||||
List<Map<String, dynamic>> _allStatus = List.from(map['all_status'])
|
||||
.map((e) => Map<String, dynamic>.from(e))
|
||||
.toList();
|
||||
List<String> _photoUrls =
|
||||
map['photo_urls'] == null ? [] : map['photo_urls'].cast<List<String>>();
|
||||
|
||||
return Package(
|
||||
id: docID,
|
||||
userID: map['user_id'],
|
||||
fcsID: map['fcs_id'],
|
||||
trackingID: map['tracking_id'],
|
||||
market: map['market'],
|
||||
userName: map['user_name'],
|
||||
phoneNumber: map['phone_number'],
|
||||
currentStatus: map['current_status'],
|
||||
currentStatusDate:
|
||||
_currentStatusDate != null ? _currentStatusDate.toDate() : null,
|
||||
photoUrls: _photoUrls,
|
||||
allStatus: _allStatus);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() =>
|
||||
{'id': id, 'tracking_id': trackingID, 'market': market, 'fcs_id': fcsID};
|
||||
}
|
||||
|
||||
@@ -116,6 +116,7 @@ class Setting {
|
||||
factory Setting.fromMap(Map<String, dynamic> map) {
|
||||
var ts = (map['price_last_update'] as Timestamp);
|
||||
var list = (map['bank_accounts'] as List);
|
||||
|
||||
List<BankAccount> bankAccounts = [];
|
||||
if (list != null) {
|
||||
list.asMap().forEach((index, item) {
|
||||
|
||||
Reference in New Issue
Block a user