add shipments
This commit is contained in:
@@ -41,6 +41,19 @@ class Box {
|
||||
shipmentNumber + "-" + receiverNumber + " #" + boxNumber;
|
||||
double get price => rate.toDouble() * weight;
|
||||
|
||||
double getShipmentWeight(double volumetricRatio) {
|
||||
if (length == null ||
|
||||
length <= 0 ||
|
||||
width == null ||
|
||||
width <= 0 ||
|
||||
height == null ||
|
||||
height <= 0 ||
|
||||
volumetricRatio == null ||
|
||||
volumetricRatio <= 0) return 0;
|
||||
|
||||
return (length * width * height) / volumetricRatio;
|
||||
}
|
||||
|
||||
List<ShipmentStatus> shipmentHistory;
|
||||
|
||||
Box(
|
||||
|
||||
@@ -3,4 +3,15 @@ class Cargo {
|
||||
int price;
|
||||
int weight;
|
||||
Cargo({this.type, this.price, this.weight});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => other is Cargo && other.type == type;
|
||||
|
||||
@override
|
||||
int get hashCode => type.hashCode;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class Package {
|
||||
List<String> photoUrls;
|
||||
List<ShipmentStatus> shipmentHistory;
|
||||
String desc;
|
||||
String deliveryAddressID;
|
||||
|
||||
String status;
|
||||
String shipmentNumber;
|
||||
@@ -70,7 +71,8 @@ class Package {
|
||||
this.currentStatusDate,
|
||||
this.photoUrls,
|
||||
this.desc,
|
||||
this.isChecked =false});
|
||||
this.deliveryAddressID,
|
||||
this.isChecked = false});
|
||||
|
||||
factory Package.fromMap(Map<String, dynamic> map, String docID) {
|
||||
var _currentStatusDate = (map['current_status_date'] as Timestamp);
|
||||
@@ -92,6 +94,7 @@ class Package {
|
||||
remark: map['remark'],
|
||||
desc: map['desc'],
|
||||
currentStatus: map['current_status'],
|
||||
deliveryAddressID: map['delivery_address_id'],
|
||||
currentStatusDate:
|
||||
_currentStatusDate != null ? _currentStatusDate.toDate() : null,
|
||||
photoUrls: _photoUrls,
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import 'package:fcs/domain/entities/cargo.dart';
|
||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||
|
||||
List<Day> dayLists = [
|
||||
Day(id: 1, name: 'Sun'),
|
||||
Day(id: 2, name: 'Mon'),
|
||||
@@ -23,24 +26,32 @@ class Setting {
|
||||
final String termsEng;
|
||||
final String termsMm;
|
||||
String about;
|
||||
double volumetricRatio;
|
||||
|
||||
List<String> shipmentTypes;
|
||||
Map<String, int> cargoTypes;
|
||||
List<Cargo> get cargoTypesList => cargoTypes.entries
|
||||
.map((e) => Cargo(type: e.key, price: e.value))
|
||||
.toList();
|
||||
Cargo get defaultCargoType =>
|
||||
cargoTypesList.firstWhere((e) => e.type == "General");
|
||||
|
||||
Setting({
|
||||
this.supportBuildNum,
|
||||
this.usaAddress,
|
||||
this.mmAddress,
|
||||
this.usaContactNumber,
|
||||
this.mmContactNumber,
|
||||
this.emailAddress,
|
||||
this.facebookLink,
|
||||
this.inviteRequired,
|
||||
this.appUrl,
|
||||
this.termsEng,
|
||||
this.termsMm,
|
||||
this.about,
|
||||
this.shipmentTypes,
|
||||
});
|
||||
Setting(
|
||||
{this.supportBuildNum,
|
||||
this.usaAddress,
|
||||
this.mmAddress,
|
||||
this.usaContactNumber,
|
||||
this.mmContactNumber,
|
||||
this.emailAddress,
|
||||
this.facebookLink,
|
||||
this.inviteRequired,
|
||||
this.appUrl,
|
||||
this.termsEng,
|
||||
this.termsMm,
|
||||
this.about,
|
||||
this.shipmentTypes,
|
||||
this.volumetricRatio,
|
||||
this.cargoTypes});
|
||||
|
||||
factory Setting.fromMap(Map<String, dynamic> map) {
|
||||
return Setting(
|
||||
@@ -56,7 +67,11 @@ class Setting {
|
||||
about: map['about'],
|
||||
termsEng: map['terms_eng'],
|
||||
termsMm: map['terms_mm'],
|
||||
volumetricRatio: map['volumetric_ratio'],
|
||||
shipmentTypes: List.from(map['shipment_types']),
|
||||
cargoTypes: map['cargo_types'] == null
|
||||
? []
|
||||
: Map<String, int>.from(map['cargo_types']),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user