add mix carton
This commit is contained in:
@@ -286,14 +286,15 @@
|
|||||||
"box.popupmenu.delivered":"Delivered Cartons",
|
"box.popupmenu.delivered":"Delivered Cartons",
|
||||||
"box.cargo.total":"Total Weight",
|
"box.cargo.total":"Total Weight",
|
||||||
"box.delete.confirm":"Delete carton?",
|
"box.delete.confirm":"Delete carton?",
|
||||||
|
"box.mix.carton":"Go into mix carton",
|
||||||
"Boxes End ================================================================":"",
|
"Boxes End ================================================================":"",
|
||||||
|
|
||||||
"Delivery Start ================================================================":"",
|
"Delivery Start ================================================================":"",
|
||||||
"delivery.title":"Deliveries",
|
"delivery.title":"Deliveries",
|
||||||
"delivery":"Deliveries",
|
"delivery":"Deliveries",
|
||||||
"delivery.info.title":"Deliverie",
|
"delivery.info.title":"Delivery",
|
||||||
"delivery.popupmenu.active":"Active Cartons",
|
"delivery.popupmenu.active":"Active cartons",
|
||||||
"delivery.popupmenu.delivered":"Delivered Cartons",
|
"delivery.popupmenu.delivered":"Delivered cartons",
|
||||||
"Delivery End ================================================================":"",
|
"Delivery End ================================================================":"",
|
||||||
|
|
||||||
"FCS Shipment Start ================================================================":"",
|
"FCS Shipment Start ================================================================":"",
|
||||||
|
|||||||
@@ -286,6 +286,7 @@
|
|||||||
"box.popupmenu.delivered":"ပို့ပြီးသော သေတ္တာများ",
|
"box.popupmenu.delivered":"ပို့ပြီးသော သေတ္တာများ",
|
||||||
"box.cargo.total":"စုစုပေါင်း အလေးချိန်",
|
"box.cargo.total":"စုစုပေါင်း အလေးချိန်",
|
||||||
"box.delete.confirm":"Delete carton?",
|
"box.delete.confirm":"Delete carton?",
|
||||||
|
"box.mix.carton":"Go into mix carton",
|
||||||
"Boxes End ================================================================":"",
|
"Boxes End ================================================================":"",
|
||||||
|
|
||||||
"Delivery Start ================================================================":"",
|
"Delivery Start ================================================================":"",
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ const shipment_courier_dropoff = "Courier drop off";
|
|||||||
const carton_from_packages = "From packages";
|
const carton_from_packages = "From packages";
|
||||||
const carton_from_shipments = "From shipments";
|
const carton_from_shipments = "From shipments";
|
||||||
const carton_mix_box = "Mix carton";
|
const carton_mix_box = "Mix carton";
|
||||||
|
const carton_small_bag = "Small bag";
|
||||||
|
|
||||||
//Carton status
|
//Carton status
|
||||||
const carton_packed_status = "packed";
|
const carton_packed_status = "packed";
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ class Carton {
|
|||||||
String userID;
|
String userID;
|
||||||
String fcsShipmentID;
|
String fcsShipmentID;
|
||||||
String fcsShipmentNumber;
|
String fcsShipmentNumber;
|
||||||
|
String mixCartonID;
|
||||||
|
String mixCartonNumber;
|
||||||
|
|
||||||
int rate;
|
int rate;
|
||||||
int weight;
|
int weight;
|
||||||
@@ -134,12 +136,15 @@ class Carton {
|
|||||||
this.fcsShipmentNumber,
|
this.fcsShipmentNumber,
|
||||||
this.cartons,
|
this.cartons,
|
||||||
this.packageIDs,
|
this.packageIDs,
|
||||||
|
this.mixCartonID,
|
||||||
|
this.mixCartonNumber,
|
||||||
this.isShipmentCarton = false,
|
this.isShipmentCarton = false,
|
||||||
this.deliveryAddress});
|
this.deliveryAddress});
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
List _cargoTypes = cargoTypes.map((c) => c.toMap()).toList();
|
List _cargoTypes = cargoTypes.map((c) => c.toMap()).toList();
|
||||||
List _packages = packages?.map((c) => c.toJson())?.toList();
|
List _packages = packages?.map((c) => c.toJson())?.toList();
|
||||||
|
List _cartons = cartons?.map((c) => c.toMap())?.toList() ?? [];
|
||||||
return {
|
return {
|
||||||
"id": id,
|
"id": id,
|
||||||
'fcs_shipment_id': fcsShipmentID,
|
'fcs_shipment_id': fcsShipmentID,
|
||||||
@@ -151,6 +156,8 @@ class Carton {
|
|||||||
'height': height,
|
'height': height,
|
||||||
'delivery_address': deliveryAddress.toMap(),
|
'delivery_address': deliveryAddress.toMap(),
|
||||||
'carton_type': cartonType,
|
'carton_type': cartonType,
|
||||||
|
'cartons': _cartons,
|
||||||
|
'mix_carton_id': mixCartonID
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +165,8 @@ class Carton {
|
|||||||
var _arrivedDate = (map['arrived_date'] as Timestamp);
|
var _arrivedDate = (map['arrived_date'] as Timestamp);
|
||||||
var da = map['delivery_address'];
|
var da = map['delivery_address'];
|
||||||
var _da = da != null ? DeliveryAddress.fromMap(da, da["id"]) : null;
|
var _da = da != null ? DeliveryAddress.fromMap(da, da["id"]) : null;
|
||||||
var cargoTypesMaps = List<Map<String, dynamic>>.from(map['cargo_types']);
|
var cargoTypesMaps =
|
||||||
|
List<Map<String, dynamic>>.from(map['cargo_types'] ?? []);
|
||||||
var cargoTypes =
|
var cargoTypes =
|
||||||
cargoTypesMaps.map((e) => CargoType.fromMap(e, e["id"])).toList();
|
cargoTypesMaps.map((e) => CargoType.fromMap(e, e["id"])).toList();
|
||||||
return Carton(
|
return Carton(
|
||||||
@@ -178,6 +186,8 @@ class Carton {
|
|||||||
fcsShipmentID: map['fcs_shipment_id'],
|
fcsShipmentID: map['fcs_shipment_id'],
|
||||||
fcsShipmentNumber: map['fcs_shipment_number'],
|
fcsShipmentNumber: map['fcs_shipment_number'],
|
||||||
isShipmentCarton: map['is_shipment_carton'],
|
isShipmentCarton: map['is_shipment_carton'],
|
||||||
|
mixCartonID: map['mix_carton_id'],
|
||||||
|
mixCartonNumber: map['mix_carton_number'],
|
||||||
status: map['status'],
|
status: map['status'],
|
||||||
packageIDs: List<String>.from(map['package_ids'] ?? []),
|
packageIDs: List<String>.from(map['package_ids'] ?? []),
|
||||||
deliveryAddress: _da,
|
deliveryAddress: _da,
|
||||||
|
|||||||
@@ -123,6 +123,12 @@ class Package {
|
|||||||
currentStatusDate: DateTime.parse(json['status_date']));
|
currentStatusDate: DateTime.parse(json['status_date']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) => other is Package && other.id == id;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => id.hashCode;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'Package{id: $id, status: $status, market:$market, trackingID: $trackingID,}';
|
return 'Package{id: $id, status: $status, market:$market, trackingID: $trackingID,}';
|
||||||
|
|||||||
@@ -100,7 +100,8 @@ class _CargoTypeEditorState extends State<CargoTypeEditor> {
|
|||||||
)),
|
)),
|
||||||
body: Container(
|
body: Container(
|
||||||
padding: EdgeInsets.all(18),
|
padding: EdgeInsets.all(18),
|
||||||
child: Column(
|
child: ListView(
|
||||||
|
shrinkWrap: true,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
cargoTypeBox,
|
cargoTypeBox,
|
||||||
rateBox,
|
rateBox,
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
double shipmentWeight = 0;
|
double shipmentWeight = 0;
|
||||||
FcsShipment _fcsShipment;
|
FcsShipment _fcsShipment;
|
||||||
List<FcsShipment> _fcsShipments;
|
List<FcsShipment> _fcsShipments;
|
||||||
|
Carton _mixCarton;
|
||||||
|
List<Carton> _mixCartons;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -85,6 +87,7 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
_selectedCartonType = _carton.cartonType;
|
_selectedCartonType = _carton.cartonType;
|
||||||
_isNew = false;
|
_isNew = false;
|
||||||
_user = User(fcsID: _carton.fcsID, name: _carton.userName);
|
_user = User(fcsID: _carton.fcsID, name: _carton.userName);
|
||||||
|
_loadPackages();
|
||||||
} else {
|
} else {
|
||||||
_carton = Carton(cargoTypes: [], packages: [], cartons: []);
|
_carton = Carton(cargoTypes: [], packages: [], cartons: []);
|
||||||
_lengthController.text = "12";
|
_lengthController.text = "12";
|
||||||
@@ -93,6 +96,7 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
_isNew = true;
|
_isNew = true;
|
||||||
_selectedCartonType = carton_from_packages;
|
_selectedCartonType = carton_from_packages;
|
||||||
_loadFcsShipments();
|
_loadFcsShipments();
|
||||||
|
_loadMixCartons();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,25 +112,46 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_loadMixCartons() async {
|
||||||
|
if (_fcsShipment == null) return;
|
||||||
|
CartonModel cartonModel = Provider.of<CartonModel>(context, listen: false);
|
||||||
|
var mixCartons =
|
||||||
|
await cartonModel.getMixCartonsByFcsShipment(_fcsShipment.id);
|
||||||
|
setState(() {
|
||||||
|
_mixCartons = mixCartons;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
_loadPackages() async {
|
_loadPackages() async {
|
||||||
if (_user == null) return;
|
if (_user == null) return;
|
||||||
PackageModel packageModel =
|
PackageModel packageModel =
|
||||||
Provider.of<PackageModel>(context, listen: false);
|
Provider.of<PackageModel>(context, listen: false);
|
||||||
List<Package> packages = await packageModel.getPackages(_user.id);
|
List<Package> packages = await packageModel.getPackages(
|
||||||
String prevCompare;
|
_user.id, [package_processed_status, package_packed_status]);
|
||||||
packages.forEach((p) {
|
if (_isNew) {
|
||||||
String compare = (p.deliveryAddress?.fullName ?? "") +
|
String prevCompare;
|
||||||
(p.deliveryAddress?.phoneNumber ?? "");
|
packages.forEach((p) {
|
||||||
if (prevCompare != null && compare == prevCompare) {
|
String compare = (p.deliveryAddress?.fullName ?? "") +
|
||||||
p.isChecked = true;
|
(p.deliveryAddress?.phoneNumber ?? "");
|
||||||
} else {
|
if (prevCompare != null && compare == prevCompare) {
|
||||||
p.isChecked = false;
|
p.isChecked = true;
|
||||||
}
|
} else {
|
||||||
if (prevCompare == null) {
|
p.isChecked = false;
|
||||||
p.isChecked = true;
|
}
|
||||||
prevCompare = compare;
|
if (prevCompare == null) {
|
||||||
}
|
p.isChecked = true;
|
||||||
});
|
prevCompare = compare;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
packages.forEach((p) {
|
||||||
|
if (_carton.packages.contains(p)) {
|
||||||
|
p.isChecked = _carton.packages.firstWhere((cp) => cp == p).isChecked;
|
||||||
|
} else {
|
||||||
|
p.isChecked = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_carton.packages = packages;
|
_carton.packages = packages;
|
||||||
@@ -176,12 +201,17 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var boxModel = Provider.of<CartonModel>(context);
|
var boxModel = Provider.of<CartonModel>(context);
|
||||||
bool isMixBox = _selectedCartonType == carton_mix_box;
|
bool isMixBox = _selectedCartonType == carton_mix_box;
|
||||||
|
bool isSmallBag = _selectedCartonType == carton_small_bag;
|
||||||
final shipmentBox = DisplayText(
|
final shipmentBox = DisplayText(
|
||||||
text: _carton.fcsShipmentNumber,
|
text: _carton.fcsShipmentNumber,
|
||||||
labelTextKey: "box.fcs_shipment_num",
|
labelTextKey: "box.fcs_shipment_num",
|
||||||
iconData: Ionicons.ios_airplane,
|
iconData: Ionicons.ios_airplane,
|
||||||
);
|
);
|
||||||
|
final mixCartonNumberBox = DisplayText(
|
||||||
|
text: _carton.mixCartonNumber,
|
||||||
|
labelTextKey: "box.mix.carton",
|
||||||
|
iconData: MaterialCommunityIcons.package,
|
||||||
|
);
|
||||||
var fcsShipmentsBox = LocalDropdown<FcsShipment>(
|
var fcsShipmentsBox = LocalDropdown<FcsShipment>(
|
||||||
callback: (v) {
|
callback: (v) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -190,6 +220,9 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
if (_selectedCartonType == carton_mix_box) {
|
if (_selectedCartonType == carton_mix_box) {
|
||||||
_loadCartons();
|
_loadCartons();
|
||||||
}
|
}
|
||||||
|
if (_selectedCartonType == carton_small_bag) {
|
||||||
|
_loadMixCartons();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
labelKey: "shipment.pack.fcs.shipment",
|
labelKey: "shipment.pack.fcs.shipment",
|
||||||
iconData: Ionicons.ios_airplane,
|
iconData: Ionicons.ios_airplane,
|
||||||
@@ -198,6 +231,19 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
values: _fcsShipments,
|
values: _fcsShipments,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var mixCartonsBox = LocalDropdown<Carton>(
|
||||||
|
callback: (v) {
|
||||||
|
setState(() {
|
||||||
|
_mixCarton = v;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
labelKey: "box.mix.carton",
|
||||||
|
iconData: MaterialCommunityIcons.package,
|
||||||
|
display: (u) => u.cartonNumber,
|
||||||
|
selectedValue: _mixCarton,
|
||||||
|
values: _mixCartons,
|
||||||
|
);
|
||||||
|
|
||||||
final fcsIDBox = Row(
|
final fcsIDBox = Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -338,16 +384,19 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
cartonTypeBox,
|
cartonTypeBox,
|
||||||
LocalTitle(textKey: "box.shipment_info"),
|
LocalTitle(textKey: "box.shipment_info"),
|
||||||
_isNew ? fcsShipmentsBox : shipmentBox,
|
_isNew ? fcsShipmentsBox : shipmentBox,
|
||||||
|
isSmallBag
|
||||||
|
? _isNew ? mixCartonsBox : mixCartonNumberBox
|
||||||
|
: Container(),
|
||||||
...(isMixBox
|
...(isMixBox
|
||||||
? [
|
? [
|
||||||
CartonMixTable(
|
// CartonMixTable(
|
||||||
cartons: _carton.cartons,
|
// cartons: _carton.cartons,
|
||||||
onSelect: (c, check) {
|
// onSelect: (c, check) {
|
||||||
setState(() {
|
// setState(() {
|
||||||
c.isChecked = check;
|
// c.isChecked = check;
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
)
|
// )
|
||||||
]
|
]
|
||||||
: [
|
: [
|
||||||
fcsIDBox,
|
fcsIDBox,
|
||||||
@@ -368,9 +417,11 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
),
|
),
|
||||||
cargoTableTitleBox,
|
cargoTableTitleBox,
|
||||||
cargoTableBox,
|
cargoTableBox,
|
||||||
LocalTitle(textKey: "box.dimension"),
|
isSmallBag
|
||||||
dimBox,
|
? Container()
|
||||||
shipmentWeightBox,
|
: LocalTitle(textKey: "box.dimension"),
|
||||||
|
isSmallBag ? Container() : dimBox,
|
||||||
|
isSmallBag ? Container() : shipmentWeightBox,
|
||||||
LocalTitle(textKey: "box.delivery_address"),
|
LocalTitle(textKey: "box.delivery_address"),
|
||||||
DefaultDeliveryAddress(
|
DefaultDeliveryAddress(
|
||||||
deliveryAddress: _deliveryAddress,
|
deliveryAddress: _deliveryAddress,
|
||||||
@@ -413,7 +464,9 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_save() async {
|
_save() async {
|
||||||
if (_user == null) {
|
bool isFromShipment = _selectedCartonType == carton_from_shipments;
|
||||||
|
bool isSmallBag = _selectedCartonType == carton_small_bag;
|
||||||
|
if (_user == null && (isFromShipment || isSmallBag)) {
|
||||||
showMsgDialog(context, "Error", "Please select customer");
|
showMsgDialog(context, "Error", "Please select customer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -421,35 +474,40 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
showMsgDialog(context, "Error", "Please select FCS shipment");
|
showMsgDialog(context, "Error", "Please select FCS shipment");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((_carton.cargoTypes?.length ?? 0) == 0) {
|
if ((_carton.cargoTypes?.length ?? 0) == 0 &&
|
||||||
|
(isFromShipment || isSmallBag)) {
|
||||||
showMsgDialog(context, "Error", "Expect at least one cargo type");
|
showMsgDialog(context, "Error", "Expect at least one cargo type");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
double l = double.parse(_lengthController.text, (s) => 0);
|
double l = double.parse(_lengthController.text, (s) => 0);
|
||||||
double w = double.parse(_widthController.text, (s) => 0);
|
double w = double.parse(_widthController.text, (s) => 0);
|
||||||
double h = double.parse(_heightController.text, (s) => 0);
|
double h = double.parse(_heightController.text, (s) => 0);
|
||||||
if (l <= 0 || w <= 0 || h <= 0) {
|
if ((l <= 0 || w <= 0 || h <= 0) && isFromShipment) {
|
||||||
showMsgDialog(context, "Error", "Invalid dimension");
|
showMsgDialog(context, "Error", "Invalid dimension");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_deliveryAddress == null) {
|
if (_deliveryAddress == null && (isFromShipment || isSmallBag)) {
|
||||||
showMsgDialog(context, "Error", "Invalid delivery address");
|
showMsgDialog(context, "Error", "Invalid delivery address");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (isSmallBag && _mixCarton == null) {
|
||||||
|
showMsgDialog(context, "Error", "Invalid mix carton");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Carton carton = Carton();
|
Carton carton = Carton();
|
||||||
carton.id = _carton.id;
|
carton.id = _carton.id;
|
||||||
carton.cartonType = _selectedCartonType;
|
carton.cartonType = _selectedCartonType;
|
||||||
carton.fcsShipmentID = _isNew ? _fcsShipment.id : _carton.fcsShipmentID;
|
carton.fcsShipmentID = _isNew ? _fcsShipment.id : _carton.fcsShipmentID;
|
||||||
carton.userID = _user.id;
|
carton.userID = _user?.id;
|
||||||
carton.cargoTypes = _carton.cargoTypes;
|
carton.cargoTypes = _carton.cargoTypes;
|
||||||
carton.packages = _carton.packages.where((e) => e.isChecked).toList();
|
carton.packages = _carton.packages.where((e) => e.isChecked).toList();
|
||||||
|
carton.mixCartonID = _mixCarton?.id;
|
||||||
carton.length = l;
|
carton.length = l;
|
||||||
carton.width = w;
|
carton.width = w;
|
||||||
carton.height = h;
|
carton.height = h;
|
||||||
carton.deliveryAddress = _deliveryAddress;
|
carton.deliveryAddress = _deliveryAddress;
|
||||||
|
carton.cartons = _carton.cartons.where((c) => c.isChecked).toList();
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
|
|
||||||
bool isMixBox;
|
bool isMixBox;
|
||||||
bool isFromShipments;
|
bool isFromShipments;
|
||||||
bool isFromPackage;
|
bool isFromPackages;
|
||||||
|
bool isSmallBag;
|
||||||
bool isEdiable;
|
bool isEdiable;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -72,35 +73,39 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
_widthController.addListener(_calShipmentWeight);
|
_widthController.addListener(_calShipmentWeight);
|
||||||
_heightController.addListener(_calShipmentWeight);
|
_heightController.addListener(_calShipmentWeight);
|
||||||
|
|
||||||
|
_updateBoxData();
|
||||||
|
_loadPackages();
|
||||||
|
}
|
||||||
|
|
||||||
|
_updateBoxData() {
|
||||||
_widthController.text = _box.width.toString();
|
_widthController.text = _box.width.toString();
|
||||||
_heightController.text = _box.height.toString();
|
_heightController.text = _box.height.toString();
|
||||||
_lengthController.text = _box.length.toString();
|
_lengthController.text = _box.length.toString();
|
||||||
|
|
||||||
_cargoTypes = _box.cargoTypes;
|
_cargoTypes = _box.cargoTypes;
|
||||||
_deliveryAddress = _box.deliveryAddress;
|
_deliveryAddress = _box.deliveryAddress;
|
||||||
|
|
||||||
isMixBox = _box.cartonType == carton_mix_box;
|
isMixBox = _box.cartonType == carton_mix_box;
|
||||||
isFromShipments = _box.cartonType == carton_from_shipments;
|
isFromShipments = _box.cartonType == carton_from_shipments;
|
||||||
isFromPackage = _box.cartonType == carton_from_packages;
|
isFromPackages = _box.cartonType == carton_from_packages;
|
||||||
isEdiable =
|
isSmallBag = _box.cartonType == carton_small_bag;
|
||||||
(isMixBox || isFromPackage) && _box.status == carton_packed_status;
|
isEdiable = !isMixBox &&
|
||||||
|
(isFromPackages || isSmallBag) &&
|
||||||
if (isFromPackage) {
|
_box.status == carton_packed_status;
|
||||||
_loadPackages();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_loadPackages() async {
|
_loadPackages() async {
|
||||||
|
if (!isFromPackages && !isSmallBag) return;
|
||||||
|
|
||||||
if (_box.cartonType == carton_from_packages && _box.userID == null) return;
|
if (_box.cartonType == carton_from_packages && _box.userID == null) return;
|
||||||
PackageModel packageModel =
|
PackageModel packageModel =
|
||||||
Provider.of<PackageModel>(context, listen: false);
|
Provider.of<PackageModel>(context, listen: false);
|
||||||
List<Package> packages = await packageModel.getPackages(_box.userID);
|
List<Package> packages = await packageModel.getPackages(_box.userID, [
|
||||||
|
package_processed_status,
|
||||||
|
package_packed_status,
|
||||||
|
package_shipped_status
|
||||||
|
]);
|
||||||
|
packages = packages.where((p) => _box.packageIDs.contains(p.id)).toList();
|
||||||
packages.forEach((p) {
|
packages.forEach((p) {
|
||||||
if (_box.packageIDs.contains(p.id)) {
|
p.isChecked = true;
|
||||||
p.isChecked = true;
|
|
||||||
} else {
|
|
||||||
p.isChecked = false;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -219,6 +224,11 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
final cargoTableBox = CargoTable(
|
final cargoTableBox = CargoTable(
|
||||||
cargoTypes: _box.cargoTypes,
|
cargoTypes: _box.cargoTypes,
|
||||||
);
|
);
|
||||||
|
final mixCartonNumberBox = DisplayText(
|
||||||
|
text: _box.mixCartonNumber,
|
||||||
|
labelTextKey: "box.mix.carton",
|
||||||
|
iconData: MaterialCommunityIcons.package,
|
||||||
|
);
|
||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
@@ -250,65 +260,68 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
]
|
]
|
||||||
: [],
|
: [],
|
||||||
),
|
),
|
||||||
body: Card(
|
body: Padding(
|
||||||
child: Column(
|
padding: const EdgeInsets.all(10.0),
|
||||||
children: <Widget>[
|
child: ListView(children: <Widget>[
|
||||||
Expanded(
|
Center(child: getCartonNumberStatus(context, _box)),
|
||||||
child: Padding(
|
LocalTitle(textKey: "box.type.title"),
|
||||||
padding: const EdgeInsets.all(10.0),
|
cartonTypeBox,
|
||||||
child: ListView(children: <Widget>[
|
LocalTitle(textKey: "box.shipment_info"),
|
||||||
Center(child: getCartonNumberStatus(context, _box)),
|
shipmentBox,
|
||||||
LocalTitle(textKey: "box.type.title"),
|
isSmallBag ? mixCartonNumberBox : Container(),
|
||||||
cartonTypeBox,
|
isMixBox ? Container() : fcsIDBox,
|
||||||
LocalTitle(textKey: "box.shipment_info"),
|
isMixBox ? Container() : customerNameBox,
|
||||||
shipmentBox,
|
isFromPackages || isSmallBag
|
||||||
fcsIDBox,
|
? CartonPackageTable(
|
||||||
customerNameBox,
|
packages: _box.packages,
|
||||||
isFromPackage
|
)
|
||||||
? CartonPackageTable(
|
: Container(),
|
||||||
packages: _box.packages,
|
isFromPackages
|
||||||
)
|
? Container()
|
||||||
: Container(),
|
: isFromShipments
|
||||||
isFromPackage
|
? Column(
|
||||||
? Container()
|
children: [
|
||||||
: isFromShipments
|
LocalTitle(textKey: "box.shipment.boxes"),
|
||||||
? Column(
|
shipmentBoxTitle,
|
||||||
children: [
|
Divider(
|
||||||
LocalTitle(textKey: "box.shipment.boxes"),
|
color: Colors.grey[400],
|
||||||
shipmentBoxTitle,
|
),
|
||||||
Divider(
|
shipmentBoxRow
|
||||||
color: Colors.grey[400],
|
],
|
||||||
),
|
)
|
||||||
shipmentBoxRow
|
: Container(),
|
||||||
],
|
// : _selectedCartonType == "Mix carton"
|
||||||
)
|
// ? CartonMixTable(
|
||||||
: _selectedCartonType == "Mix carton"
|
// cartons: _box.cartons,
|
||||||
? CartonMixTable(
|
// onSelect: (c, check) {
|
||||||
cartons: _box.cartons,
|
// setState(() {
|
||||||
onSelect: (c, check) {
|
// c.isChecked = check;
|
||||||
setState(() {
|
// });
|
||||||
c.isChecked = check;
|
// },
|
||||||
});
|
// )
|
||||||
},
|
// : Container(),
|
||||||
)
|
isMixBox ? Container() : LocalTitle(textKey: "box.cargo.type"),
|
||||||
: Container(),
|
isMixBox ? Container() : cargoTableBox,
|
||||||
LocalTitle(textKey: "box.cargo.type"),
|
...(isFromPackages
|
||||||
cargoTableBox,
|
? [
|
||||||
LocalTitle(textKey: "box.dimension"),
|
LocalTitle(textKey: "box.dimension"),
|
||||||
dimBox,
|
dimBox,
|
||||||
shipmentWeightBox,
|
shipmentWeightBox,
|
||||||
LocalTitle(textKey: "box.delivery_address"),
|
]
|
||||||
DefaultDeliveryAddress(
|
: []),
|
||||||
|
isMixBox
|
||||||
|
? Container()
|
||||||
|
: LocalTitle(textKey: "box.delivery_address"),
|
||||||
|
isMixBox
|
||||||
|
? Container()
|
||||||
|
: DefaultDeliveryAddress(
|
||||||
deliveryAddress: _deliveryAddress,
|
deliveryAddress: _deliveryAddress,
|
||||||
labelKey: "box.delivery_address",
|
labelKey: "box.delivery_address",
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -324,6 +337,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
var c = await cartonModel.getCarton(widget.box.id);
|
var c = await cartonModel.getCarton(widget.box.id);
|
||||||
setState(() {
|
setState(() {
|
||||||
_box = c;
|
_box = c;
|
||||||
|
_updateBoxData();
|
||||||
});
|
});
|
||||||
_loadPackages();
|
_loadPackages();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,32 +7,20 @@ import 'package:flutter_icons/flutter_icons.dart';
|
|||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'carton_info.dart';
|
import 'carton_info.dart';
|
||||||
|
|
||||||
class CartonListRow extends StatefulWidget {
|
class CartonListRow extends StatelessWidget {
|
||||||
final Carton box;
|
final Carton box;
|
||||||
const CartonListRow({Key key, this.box}) : super(key: key);
|
CartonListRow({Key key, this.box}) : super(key: key);
|
||||||
|
|
||||||
@override
|
|
||||||
_CartonListRowState createState() => _CartonListRowState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _CartonListRowState extends State<CartonListRow> {
|
|
||||||
final double dotSize = 15.0;
|
final double dotSize = 15.0;
|
||||||
Carton _box = new Carton();
|
|
||||||
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_box = widget.box;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
CupertinoPageRoute(builder: (context) => CartonInfo(box: _box)),
|
CupertinoPageRoute(builder: (context) => CartonInfo(box: box)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -59,7 +47,7 @@ class _CartonListRowState extends State<CartonListRow> {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
child: new Text(
|
child: new Text(
|
||||||
_box.cartonNumber ?? "",
|
box.cartonNumber ?? "",
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.black),
|
fontSize: 15.0, color: Colors.black),
|
||||||
),
|
),
|
||||||
@@ -67,7 +55,7 @@ class _CartonListRowState extends State<CartonListRow> {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
||||||
child: new Text(
|
child: new Text(
|
||||||
_box.userName ?? "",
|
box.userName ?? "",
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.grey),
|
fontSize: 15.0, color: Colors.grey),
|
||||||
),
|
),
|
||||||
@@ -83,14 +71,14 @@ class _CartonListRowState extends State<CartonListRow> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(0),
|
padding: const EdgeInsets.all(0),
|
||||||
child: getStatus(_box.status == null ? "" : _box.status),
|
child: getStatus(box.status == null ? "" : box.status),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text(
|
new Text(
|
||||||
"${_box.actualWeight?.toString() ?? ''} lb",
|
"${box.actualWeight?.toString() ?? ''} lb",
|
||||||
style:
|
style:
|
||||||
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -31,45 +31,47 @@ class CartonMixTable extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
final rows = cartons.asMap().entries.map((p) {
|
final rows = cartons == null
|
||||||
return Container(
|
? []
|
||||||
color: p.value.isChecked
|
: cartons.asMap().entries.map((p) {
|
||||||
? Colors.grey.withOpacity(0.2)
|
return Container(
|
||||||
: Colors.grey[50].withOpacity(0.2),
|
color: p.value.isChecked
|
||||||
child: Container(
|
? Colors.grey.withOpacity(0.2)
|
||||||
padding:
|
: Colors.grey[50].withOpacity(0.2),
|
||||||
EdgeInsets.only(left: 0.0, right: 10.0, top: 3.0, bottom: 3.0),
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
padding: EdgeInsets.only(
|
||||||
border: Border(
|
left: 0.0, right: 10.0, top: 3.0, bottom: 3.0),
|
||||||
bottom: BorderSide(
|
decoration: BoxDecoration(
|
||||||
color: p.key == cartons.length - 1
|
border: Border(
|
||||||
? Colors.white
|
bottom: BorderSide(
|
||||||
: Colors.grey[350],
|
color: p.key == cartons.length - 1
|
||||||
width: 1),
|
? Colors.white
|
||||||
),
|
: Colors.grey[350],
|
||||||
),
|
width: 1),
|
||||||
child: Row(
|
),
|
||||||
children: <Widget>[
|
),
|
||||||
Checkbox(
|
child: Row(
|
||||||
value: p.value.isChecked,
|
children: <Widget>[
|
||||||
activeColor: primaryColor,
|
Checkbox(
|
||||||
onChanged: (bool check) {
|
value: p.value.isChecked,
|
||||||
if (onSelect != null) onSelect(p.value, check);
|
activeColor: primaryColor,
|
||||||
}),
|
onChanged: (bool check) {
|
||||||
Expanded(
|
if (onSelect != null) onSelect(p.value, check);
|
||||||
child: new Text(
|
}),
|
||||||
p.value.cartonNumber ?? "",
|
Expanded(
|
||||||
style: textStyle,
|
child: new Text(
|
||||||
)),
|
p.value.cartonNumber ?? "",
|
||||||
new Text(
|
style: textStyle,
|
||||||
p.value?.actualWeight?.toString() ?? "",
|
)),
|
||||||
style: textStyle,
|
new Text(
|
||||||
|
p.value?.actualWeight?.toString() ?? "",
|
||||||
|
style: textStyle,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
);
|
||||||
),
|
}).toList();
|
||||||
),
|
|
||||||
);
|
|
||||||
}).toList();
|
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -55,11 +55,16 @@ class CartonModel extends BaseModel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> cartonTypes = [carton_from_packages, carton_mix_box];
|
List<String> cartonTypes = [
|
||||||
|
carton_from_packages,
|
||||||
|
carton_mix_box,
|
||||||
|
carton_small_bag
|
||||||
|
];
|
||||||
List<String> cartonTypesInfo = [
|
List<String> cartonTypesInfo = [
|
||||||
carton_from_packages,
|
carton_from_packages,
|
||||||
carton_mix_box,
|
carton_mix_box,
|
||||||
carton_from_shipments
|
carton_from_shipments,
|
||||||
|
carton_small_bag
|
||||||
];
|
];
|
||||||
|
|
||||||
set selectedIndex(int index) {
|
set selectedIndex(int index) {
|
||||||
@@ -192,6 +197,19 @@ class CartonModel extends BaseModel {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<List<Carton>> getMixCartonsByFcsShipment(String fcsShipmentID) async {
|
||||||
|
String path = "/$cartons_collection";
|
||||||
|
var querySnap = await Firestore.instance
|
||||||
|
.collection(path)
|
||||||
|
.where("fcs_shipment_id", isEqualTo: fcsShipmentID)
|
||||||
|
.where("carton_type", isEqualTo: carton_mix_box)
|
||||||
|
.where("is_deleted", isEqualTo: false)
|
||||||
|
.getDocuments();
|
||||||
|
return querySnap.documents
|
||||||
|
.map((e) => Carton.fromMap(e.data, e.documentID))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
Future<Carton> getCarton(String id) async {
|
Future<Carton> getCarton(String id) async {
|
||||||
String path = "/$cartons_collection";
|
String path = "/$cartons_collection";
|
||||||
var snap = await Firestore.instance.collection(path).document(id).get();
|
var snap = await Firestore.instance.collection(path).document(id).get();
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'package:fcs/domain/entities/cargo_type.dart';
|
|||||||
import 'package:fcs/domain/entities/package.dart';
|
import 'package:fcs/domain/entities/package.dart';
|
||||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
|
import 'package:fcs/pages/carton/widgets.dart';
|
||||||
import 'package:fcs/pages/delivery/model/delivery_model.dart';
|
import 'package:fcs/pages/delivery/model/delivery_model.dart';
|
||||||
import 'package:fcs/pages/main/util.dart';
|
import 'package:fcs/pages/main/util.dart';
|
||||||
import 'package:fcs/pages/package/model/package_model.dart';
|
import 'package:fcs/pages/package/model/package_model.dart';
|
||||||
@@ -460,90 +461,80 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
|
|||||||
// ),
|
// ),
|
||||||
// ],
|
// ],
|
||||||
),
|
),
|
||||||
body: Card(
|
body: Padding(
|
||||||
child: Column(
|
padding: const EdgeInsets.all(10.0),
|
||||||
children: <Widget>[
|
child: ListView(children: <Widget>[
|
||||||
Expanded(
|
Center(child: getCartonNumberStatus(context, _box)),
|
||||||
child: Padding(
|
LocalTitle(textKey: "box.type.title"),
|
||||||
padding: const EdgeInsets.all(10.0),
|
cargoType,
|
||||||
child: ListView(children: <Widget>[
|
LocalTitle(textKey: "box.shipment_info"),
|
||||||
// Center(child: nameWidget(_box.packageNumber)),
|
shipmentBox,
|
||||||
SizedBox(
|
fcsIDBox,
|
||||||
height: 10,
|
customerNameBox,
|
||||||
),
|
_selectedCartonType == "From packages"
|
||||||
LocalTitle(textKey: "box.type.title"),
|
? Column(
|
||||||
cargoType,
|
children: [
|
||||||
LocalTitle(textKey: "box.shipment_info"),
|
LocalTitle(textKey: "box.packages"),
|
||||||
shipmentBox,
|
packageTitle,
|
||||||
fcsIDBox,
|
Divider(
|
||||||
customerNameBox,
|
color: Colors.grey[400],
|
||||||
_selectedCartonType == "From packages"
|
),
|
||||||
? Column(
|
Column(
|
||||||
children: [
|
children: getPackageRowList(),
|
||||||
LocalTitle(textKey: "box.packages"),
|
),
|
||||||
packageTitle,
|
],
|
||||||
Divider(
|
|
||||||
color: Colors.grey[400],
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
children: getPackageRowList(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: _selectedCartonType == "From shipments"
|
|
||||||
? Column(
|
|
||||||
children: [
|
|
||||||
LocalTitle(textKey: "box.shipment.boxes"),
|
|
||||||
shipmentBoxTitle,
|
|
||||||
Divider(
|
|
||||||
color: Colors.grey[400],
|
|
||||||
),
|
|
||||||
shipmentBoxRow
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: _selectedCartonType == "Mix carton"
|
|
||||||
? Column(
|
|
||||||
children: [
|
|
||||||
LocalTitle(textKey: "box.shipment.boxes"),
|
|
||||||
mixBoxTitle,
|
|
||||||
Divider(
|
|
||||||
color: Colors.grey[400],
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
children: getMixBoxRowList(),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: Container(),
|
|
||||||
LocalTitle(textKey: "box.cargo_type"),
|
|
||||||
cargoTitle,
|
|
||||||
Divider(
|
|
||||||
color: Colors.grey[400],
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
children: getCargoRowList(),
|
|
||||||
),
|
|
||||||
LocalTitle(textKey: "box.dimension"),
|
|
||||||
dimBox,
|
|
||||||
shipmentWeightBox,
|
|
||||||
LocalTitle(textKey: "box.delivery_address"),
|
|
||||||
DefaultDeliveryAddress(
|
|
||||||
deliveryAddress: _deliveryAddress,
|
|
||||||
labelKey: "box.delivery_address",
|
|
||||||
),
|
|
||||||
LocalTitle(textKey: "box.status"),
|
|
||||||
Container(
|
|
||||||
height: 230,
|
|
||||||
child: Timeline(
|
|
||||||
children: _models(), position: TimelinePosition.Left),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20,
|
|
||||||
)
|
)
|
||||||
]),
|
: _selectedCartonType == "From shipments"
|
||||||
)),
|
? Column(
|
||||||
],
|
children: [
|
||||||
),
|
LocalTitle(textKey: "box.shipment.boxes"),
|
||||||
|
shipmentBoxTitle,
|
||||||
|
Divider(
|
||||||
|
color: Colors.grey[400],
|
||||||
|
),
|
||||||
|
shipmentBoxRow
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: _selectedCartonType == "Mix carton"
|
||||||
|
? Column(
|
||||||
|
children: [
|
||||||
|
LocalTitle(textKey: "box.shipment.boxes"),
|
||||||
|
mixBoxTitle,
|
||||||
|
Divider(
|
||||||
|
color: Colors.grey[400],
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: getMixBoxRowList(),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
LocalTitle(textKey: "box.cargo_type"),
|
||||||
|
cargoTitle,
|
||||||
|
Divider(
|
||||||
|
color: Colors.grey[400],
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: getCargoRowList(),
|
||||||
|
),
|
||||||
|
LocalTitle(textKey: "box.dimension"),
|
||||||
|
dimBox,
|
||||||
|
shipmentWeightBox,
|
||||||
|
LocalTitle(textKey: "box.delivery_address"),
|
||||||
|
DefaultDeliveryAddress(
|
||||||
|
deliveryAddress: _deliveryAddress,
|
||||||
|
labelKey: "box.delivery_address",
|
||||||
|
),
|
||||||
|
LocalTitle(textKey: "box.status"),
|
||||||
|
Container(
|
||||||
|
height: 230,
|
||||||
|
child: Timeline(
|
||||||
|
children: _models(), position: TimelinePosition.Left),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
)
|
||||||
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,32 +8,20 @@ import 'package:intl/intl.dart';
|
|||||||
|
|
||||||
import 'delivery_info.dart';
|
import 'delivery_info.dart';
|
||||||
|
|
||||||
class DeliveryListRow extends StatefulWidget {
|
class DeliveryListRow extends StatelessWidget {
|
||||||
final Carton box;
|
final Carton box;
|
||||||
const DeliveryListRow({Key key,this.box}):super(key:key);
|
DeliveryListRow({Key key, this.box}) : super(key: key);
|
||||||
|
|
||||||
@override
|
|
||||||
_DeliveryListRowState createState() => _DeliveryListRowState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _DeliveryListRowState extends State<DeliveryListRow> {
|
|
||||||
final double dotSize = 15.0;
|
final double dotSize = 15.0;
|
||||||
Carton _box = new Carton();
|
|
||||||
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_box = widget.box;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
CupertinoPageRoute(builder: (context) => DeliveryInfo(box: _box)),
|
CupertinoPageRoute(builder: (context) => DeliveryInfo(box: box)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -42,7 +30,7 @@ class _DeliveryListRowState extends State<DeliveryListRow> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: new Padding(
|
child: new Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||||
child: new Row(
|
child: new Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
@@ -60,7 +48,7 @@ class _DeliveryListRowState extends State<DeliveryListRow> {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
child: new Text(
|
child: new Text(
|
||||||
_box.cartonNumber ?? "",
|
box.cartonNumber ?? "",
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.black),
|
fontSize: 15.0, color: Colors.black),
|
||||||
),
|
),
|
||||||
@@ -68,7 +56,7 @@ class _DeliveryListRowState extends State<DeliveryListRow> {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
||||||
child: new Text(
|
child: new Text(
|
||||||
_box.userName ?? "",
|
box.userName ?? "",
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.grey),
|
fontSize: 15.0, color: Colors.grey),
|
||||||
),
|
),
|
||||||
@@ -84,14 +72,14 @@ class _DeliveryListRowState extends State<DeliveryListRow> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(0),
|
padding: const EdgeInsets.all(0),
|
||||||
child: getStatus(_box.status == null ? "" : _box.status),
|
child: getStatus(box.status == null ? "" : box.status),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text(
|
new Text(
|
||||||
"${_box.actualWeight?.toString() ?? ''} lb",
|
"${box.actualWeight?.toString() ?? ''} lb",
|
||||||
style:
|
style:
|
||||||
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -112,7 +112,14 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
|
|||||||
shadowColor: Colors.transparent,
|
shadowColor: Colors.transparent,
|
||||||
title: LocalText(context, 'delivery_address',
|
title: LocalText(context, 'delivery_address',
|
||||||
color: primaryColor, fontSize: 18),
|
color: primaryColor, fontSize: 18),
|
||||||
actions: [IconButton(icon: Icon(Icons.delete), onPressed: _delete)],
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.delete,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
onPressed: _delete)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.only(left: 10.0, right: 10),
|
padding: const EdgeInsets.only(left: 10.0, right: 10),
|
||||||
|
|||||||
@@ -8,25 +8,12 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_icons/flutter_icons.dart';
|
import 'package:flutter_icons/flutter_icons.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
class DiscountListRow extends StatefulWidget {
|
class DiscountListRow extends StatelessWidget {
|
||||||
final Discount discount;
|
final Discount discount;
|
||||||
const DiscountListRow({Key key, this.discount}) : super(key: key);
|
DiscountListRow({Key key, this.discount}) : super(key: key);
|
||||||
|
|
||||||
@override
|
|
||||||
_DiscountListRowState createState() => _DiscountListRowState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _DiscountListRowState extends State<DiscountListRow> {
|
|
||||||
final double dotSize = 15.0;
|
|
||||||
Discount _discount;
|
|
||||||
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_discount = widget.discount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
@@ -34,7 +21,7 @@ class _DiscountListRowState extends State<DiscountListRow> {
|
|||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
CupertinoPageRoute(
|
CupertinoPageRoute(
|
||||||
builder: (context) => DiscountEditor(discount: _discount)),
|
builder: (context) => DiscountEditor(discount: discount)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -61,7 +48,7 @@ class _DiscountListRowState extends State<DiscountListRow> {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
child: new Text(
|
child: new Text(
|
||||||
_discount.code ?? "",
|
discount.code ?? "",
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.black),
|
fontSize: 15.0, color: Colors.black),
|
||||||
),
|
),
|
||||||
@@ -69,7 +56,7 @@ class _DiscountListRowState extends State<DiscountListRow> {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
||||||
child: new Text(
|
child: new Text(
|
||||||
_discount.customerName ?? "",
|
discount.customerName ?? "",
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.grey),
|
fontSize: 15.0, color: Colors.grey),
|
||||||
),
|
),
|
||||||
@@ -85,14 +72,14 @@ class _DiscountListRowState extends State<DiscountListRow> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(0),
|
padding: const EdgeInsets.all(0),
|
||||||
child: Text(_discount.status),
|
child: Text(discount.status),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text(
|
new Text(
|
||||||
"${_discount.amount ?? ''}",
|
"${discount.amount ?? ''}",
|
||||||
style:
|
style:
|
||||||
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -113,16 +113,16 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
|||||||
iconData: Icons.date_range,
|
iconData: Icons.date_range,
|
||||||
controller: _cutoffDateController,
|
controller: _cutoffDateController,
|
||||||
),
|
),
|
||||||
InputDate(
|
|
||||||
labelTextKey: "FCSshipment.ETA",
|
|
||||||
iconData: Icons.date_range,
|
|
||||||
controller: _arrivalDateController,
|
|
||||||
),
|
|
||||||
InputDate(
|
InputDate(
|
||||||
labelTextKey: "FCSshipment.departure_date",
|
labelTextKey: "FCSshipment.departure_date",
|
||||||
iconData: Icons.date_range,
|
iconData: Icons.date_range,
|
||||||
controller: _departureDateControler,
|
controller: _departureDateControler,
|
||||||
),
|
),
|
||||||
|
InputDate(
|
||||||
|
labelTextKey: "FCSshipment.ETA",
|
||||||
|
iconData: Icons.date_range,
|
||||||
|
controller: _arrivalDateController,
|
||||||
|
),
|
||||||
DropdownButtonFormField(
|
DropdownButtonFormField(
|
||||||
value: _currentShipmentType == "" ? null : _currentShipmentType,
|
value: _currentShipmentType == "" ? null : _currentShipmentType,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
|
|||||||
@@ -158,8 +158,8 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
|||||||
child: ListView(children: <Widget>[
|
child: ListView(children: <Widget>[
|
||||||
shipmentNumberBox,
|
shipmentNumberBox,
|
||||||
cutoffDateDBox,
|
cutoffDateDBox,
|
||||||
etaBox,
|
|
||||||
departureDateBox,
|
departureDateBox,
|
||||||
|
etaBox,
|
||||||
shipTypeBox,
|
shipTypeBox,
|
||||||
consigneeBox,
|
consigneeBox,
|
||||||
portBox,
|
portBox,
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ class PackageModel extends BaseModel {
|
|||||||
if (forCustomer) {
|
if (forCustomer) {
|
||||||
q = q.where("user_id", isEqualTo: user.id);
|
q = q.where("user_id", isEqualTo: user.id);
|
||||||
}
|
}
|
||||||
|
q = q.orderBy("tracking_id", descending: false);
|
||||||
listener = q.snapshots().listen((QuerySnapshot snapshot) {
|
listener = q.snapshots().listen((QuerySnapshot snapshot) {
|
||||||
_packages.clear();
|
_packages.clear();
|
||||||
_packages = snapshot.documents.map((documentSnapshot) {
|
_packages = snapshot.documents.map((documentSnapshot) {
|
||||||
@@ -197,13 +197,12 @@ class PackageModel extends BaseModel {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Package>> getPackages(String userID) async {
|
Future<List<Package>> getPackages(String userID, List<String> status) async {
|
||||||
List<Package> packages = [];
|
List<Package> packages = [];
|
||||||
try {
|
try {
|
||||||
var snaps = await Firestore.instance
|
var snaps = await Firestore.instance
|
||||||
.collection("/$packages_collection")
|
.collection("/$packages_collection")
|
||||||
.where("status",
|
.where("status", whereIn: status)
|
||||||
whereIn: [package_processed_status, package_packed_status])
|
|
||||||
.where("user_id", isEqualTo: userID)
|
.where("user_id", isEqualTo: userID)
|
||||||
.where("is_deleted", isEqualTo: false)
|
.where("is_deleted", isEqualTo: false)
|
||||||
.where("is_delivered", isEqualTo: false)
|
.where("is_delivered", isEqualTo: false)
|
||||||
|
|||||||
@@ -62,6 +62,9 @@ class _PackageInfoState extends State<PackageInfo> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
String id = Provider.of<MainModel>(context).user.id;
|
String id = Provider.of<MainModel>(context).user.id;
|
||||||
bool owner = _package.userID == id;
|
bool owner = _package.userID == id;
|
||||||
|
bool canChangeDeliveryAddress =
|
||||||
|
_package.status == package_received_status ||
|
||||||
|
_package.status == package_processed_status;
|
||||||
|
|
||||||
final trackingIdBox = DisplayText(
|
final trackingIdBox = DisplayText(
|
||||||
text: _package.trackingID,
|
text: _package.trackingID,
|
||||||
@@ -106,7 +109,7 @@ class _PackageInfoState extends State<PackageInfo> {
|
|||||||
final deliveryAddressBox = DefaultDeliveryAddress(
|
final deliveryAddressBox = DefaultDeliveryAddress(
|
||||||
deliveryAddress: _package.deliveryAddress,
|
deliveryAddress: _package.deliveryAddress,
|
||||||
labelKey: "package.delivery.address",
|
labelKey: "package.delivery.address",
|
||||||
onTap: owner
|
onTap: owner && canChangeDeliveryAddress
|
||||||
? () async {
|
? () async {
|
||||||
DeliveryAddress d = await Navigator.push<DeliveryAddress>(
|
DeliveryAddress d = await Navigator.push<DeliveryAddress>(
|
||||||
context,
|
context,
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class ShipmentRateModel extends BaseModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> deleteCustomDuty(String id) {
|
Future<void> deleteCustomDuty(String id) {
|
||||||
return Services.instance.rateService.deleteCargoType(id);
|
return Services.instance.rateService.deleteCustomDuty(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Discount by weight
|
//Discount by weight
|
||||||
|
|||||||
@@ -3,12 +3,10 @@ import 'package:fcs/domain/entities/custom_duty.dart';
|
|||||||
import 'package:fcs/domain/entities/discount_by_weight.dart';
|
import 'package:fcs/domain/entities/discount_by_weight.dart';
|
||||||
import 'package:fcs/domain/entities/rate.dart';
|
import 'package:fcs/domain/entities/rate.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/localization/app_translations.dart';
|
|
||||||
import 'package:fcs/pages/main/model/main_model.dart';
|
import 'package:fcs/pages/main/model/main_model.dart';
|
||||||
import 'package:fcs/pages/rates/cargo_type_list.dart';
|
import 'package:fcs/pages/rates/cargo_type_list.dart';
|
||||||
import 'package:fcs/pages/rates/custom_list.dart';
|
import 'package:fcs/pages/rates/custom_list.dart';
|
||||||
import 'package:fcs/pages/rates/model/shipment_rate_model.dart';
|
import 'package:fcs/pages/rates/model/shipment_rate_model.dart';
|
||||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
|
||||||
import 'package:fcs/pages/widgets/local_text.dart';
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
import 'package:fcs/pages/widgets/progress.dart';
|
import 'package:fcs/pages/widgets/progress.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|||||||
@@ -1,25 +1,21 @@
|
|||||||
import 'package:fcs/domain/entities/cargo_type.dart';
|
import 'package:fcs/domain/entities/cargo_type.dart';
|
||||||
import 'package:fcs/domain/entities/custom_duty.dart';
|
import 'package:fcs/domain/entities/custom_duty.dart';
|
||||||
import 'package:fcs/domain/entities/discount.dart';
|
|
||||||
import 'package:fcs/domain/entities/discount_by_weight.dart';
|
import 'package:fcs/domain/entities/discount_by_weight.dart';
|
||||||
import 'package:fcs/domain/entities/rate.dart';
|
import 'package:fcs/domain/entities/rate.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/localization/app_translations.dart';
|
import 'package:fcs/localization/app_translations.dart';
|
||||||
import 'package:fcs/pages/rates/model/shipment_rate_model.dart';
|
import 'package:fcs/pages/rates/model/shipment_rate_model.dart';
|
||||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
|
||||||
import 'package:fcs/pages/widgets/input_text.dart';
|
import 'package:fcs/pages/widgets/input_text.dart';
|
||||||
import 'package:fcs/pages/widgets/my_data_table.dart';
|
import 'package:fcs/pages/widgets/my_data_table.dart';
|
||||||
import 'package:fcs/pages/widgets/progress.dart';
|
import 'package:fcs/pages/widgets/progress.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import '../main/util.dart';
|
import '../main/util.dart';
|
||||||
import 'cargo_editor.dart';
|
import 'cargo_editor.dart';
|
||||||
import 'custom_editor.dart';
|
import 'custom_editor.dart';
|
||||||
import 'discount_by_weight_editor.dart';
|
|
||||||
|
|
||||||
class ShipmentRatesEdit extends StatefulWidget {
|
class ShipmentRatesEdit extends StatefulWidget {
|
||||||
ShipmentRatesEdit();
|
ShipmentRatesEdit();
|
||||||
@@ -34,14 +30,16 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
|||||||
TextEditingController _deliveryFee = new TextEditingController();
|
TextEditingController _deliveryFee = new TextEditingController();
|
||||||
TextEditingController _volumetricRatio = new TextEditingController();
|
TextEditingController _volumetricRatio = new TextEditingController();
|
||||||
|
|
||||||
bool _isNew = false;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_minWeight.text = "10";
|
var shipmentRateModel =
|
||||||
_deliveryFee.text = "5";
|
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||||
_volumetricRatio.text = "166.36";
|
Rate rate = shipmentRateModel.rate;
|
||||||
|
|
||||||
|
_minWeight.text = rate.freeDeliveryWeight?.toString() ?? "";
|
||||||
|
_deliveryFee.text = rate.deliveryFee?.toString() ?? "";
|
||||||
|
_volumetricRatio.text = rate.volumetricRatio?.toString() ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -91,202 +89,6 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
|||||||
feeBox,
|
feeBox,
|
||||||
ratioBox,
|
ratioBox,
|
||||||
SizedBox(height: 10),
|
SizedBox(height: 10),
|
||||||
// ExpansionTile(
|
|
||||||
// title: Text(
|
|
||||||
// 'Cargo Types',
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: primaryColor, fontWeight: FontWeight.bold),
|
|
||||||
// ),
|
|
||||||
// children: <Widget>[
|
|
||||||
// Container(
|
|
||||||
// child: SingleChildScrollView(
|
|
||||||
// scrollDirection: Axis.horizontal,
|
|
||||||
// child: MyDataTable(
|
|
||||||
// headingRowHeight: 40,
|
|
||||||
// columnSpacing: 50,
|
|
||||||
// columns: [
|
|
||||||
// MyDataColumn(
|
|
||||||
// label: Text("Cargo Type",
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 15,
|
|
||||||
// color: Colors.grey[600]))),
|
|
||||||
// MyDataColumn(
|
|
||||||
// label: Text("Rate",
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 15,
|
|
||||||
// color: Colors.grey[600]))),
|
|
||||||
// MyDataColumn(
|
|
||||||
// label: Text("Delete",
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 15,
|
|
||||||
// color: Colors.grey[600]))),
|
|
||||||
// ],
|
|
||||||
// rows: getCargoRows(
|
|
||||||
// shipmentRateModel.rate.cargoTypes),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Container(
|
|
||||||
// padding:
|
|
||||||
// EdgeInsets.only(top: 20, bottom: 15, right: 15),
|
|
||||||
// child: Align(
|
|
||||||
// alignment: Alignment.bottomRight,
|
|
||||||
// child: Container(
|
|
||||||
// width: 120,
|
|
||||||
// height: 40,
|
|
||||||
// child: FloatingActionButton.extended(
|
|
||||||
// materialTapTargetSize:
|
|
||||||
// MaterialTapTargetSize.shrinkWrap,
|
|
||||||
// icon: Icon(Icons.add),
|
|
||||||
// onPressed: () {
|
|
||||||
// Navigator.push(
|
|
||||||
// context,
|
|
||||||
// CupertinoPageRoute(
|
|
||||||
// builder: (context) => CargoEditor()),
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// label: Text(
|
|
||||||
// 'Add Cargo',
|
|
||||||
// style: TextStyle(fontSize: 12),
|
|
||||||
// ),
|
|
||||||
// backgroundColor: primaryColor,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ExpansionTile(
|
|
||||||
// title: Text(
|
|
||||||
// 'Custom Duties',
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: primaryColor, fontWeight: FontWeight.bold),
|
|
||||||
// ),
|
|
||||||
// children: <Widget>[
|
|
||||||
// Container(
|
|
||||||
// child: SingleChildScrollView(
|
|
||||||
// scrollDirection: Axis.horizontal,
|
|
||||||
// child: MyDataTable(
|
|
||||||
// headingRowHeight: 40,
|
|
||||||
// columnSpacing: 50,
|
|
||||||
// columns: [
|
|
||||||
// MyDataColumn(
|
|
||||||
// label: Text("Produt Type",
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 15,
|
|
||||||
// color: Colors.grey[600]))),
|
|
||||||
// MyDataColumn(
|
|
||||||
// label: Text("Fee",
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 15,
|
|
||||||
// color: Colors.grey[600]))),
|
|
||||||
// MyDataColumn(
|
|
||||||
// label: Text("Delete",
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 15,
|
|
||||||
// color: Colors.grey[600]))),
|
|
||||||
// ],
|
|
||||||
// rows: getCustomsRows(
|
|
||||||
// shipmentRateModel.rate.customDuties),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Container(
|
|
||||||
// padding:
|
|
||||||
// EdgeInsets.only(top: 20, bottom: 15, right: 15),
|
|
||||||
// child: Align(
|
|
||||||
// alignment: Alignment.bottomRight,
|
|
||||||
// child: Container(
|
|
||||||
// width: 120,
|
|
||||||
// height: 40,
|
|
||||||
// child: FloatingActionButton.extended(
|
|
||||||
// materialTapTargetSize:
|
|
||||||
// MaterialTapTargetSize.shrinkWrap,
|
|
||||||
// icon: Icon(Icons.add),
|
|
||||||
// onPressed: () {
|
|
||||||
// Navigator.push(
|
|
||||||
// context,
|
|
||||||
// CupertinoPageRoute(
|
|
||||||
// builder: (context) => CustomEditor()),
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// label: Text(
|
|
||||||
// 'Add Custom\nDuty',
|
|
||||||
// style: TextStyle(fontSize: 12),
|
|
||||||
// ),
|
|
||||||
// backgroundColor: primaryColor,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ExpansionTile(
|
|
||||||
// title: Text(
|
|
||||||
// 'Discounts by weight',
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: primaryColor, fontWeight: FontWeight.bold),
|
|
||||||
// ),
|
|
||||||
// children: <Widget>[
|
|
||||||
// Container(
|
|
||||||
// child: SingleChildScrollView(
|
|
||||||
// scrollDirection: Axis.horizontal,
|
|
||||||
// child: MyDataTable(
|
|
||||||
// headingRowHeight: 40,
|
|
||||||
// columnSpacing: 30,
|
|
||||||
// columns: [
|
|
||||||
// MyDataColumn(
|
|
||||||
// label: Text("Weight",
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 15,
|
|
||||||
// color: Colors.grey[600]))),
|
|
||||||
// MyDataColumn(
|
|
||||||
// label: Text("Discount Rate",
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 15,
|
|
||||||
// color: Colors.grey[600]))),
|
|
||||||
// MyDataColumn(
|
|
||||||
// label: Text("Delete",
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 15,
|
|
||||||
// color: Colors.grey[600]))),
|
|
||||||
// ],
|
|
||||||
// rows: getDiscounts(
|
|
||||||
// shipmentRateModel.rate.discountByWeights),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Container(
|
|
||||||
// padding:
|
|
||||||
// EdgeInsets.only(top: 20, bottom: 15, right: 15),
|
|
||||||
// child: Align(
|
|
||||||
// alignment: Alignment.bottomRight,
|
|
||||||
// child: Container(
|
|
||||||
// width: 130,
|
|
||||||
// height: 40,
|
|
||||||
// child: FloatingActionButton.extended(
|
|
||||||
// materialTapTargetSize:
|
|
||||||
// MaterialTapTargetSize.shrinkWrap,
|
|
||||||
// icon: Icon(Icons.add),
|
|
||||||
// onPressed: () {
|
|
||||||
// Navigator.push(
|
|
||||||
// context,
|
|
||||||
// CupertinoPageRoute(
|
|
||||||
// builder: (context) =>
|
|
||||||
// DiscountByWeightEditor()),
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// label: Text(
|
|
||||||
// 'Add Discount',
|
|
||||||
// style: TextStyle(fontSize: 12),
|
|
||||||
// ),
|
|
||||||
// backgroundColor: primaryColor,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -311,7 +113,7 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
|||||||
deliveryFee: double.parse(_deliveryFee.text),
|
deliveryFee: double.parse(_deliveryFee.text),
|
||||||
freeDeliveryWeight: double.parse(_minWeight.text),
|
freeDeliveryWeight: double.parse(_minWeight.text),
|
||||||
volumetricRatio: double.parse(_volumetricRatio.text));
|
volumetricRatio: double.parse(_volumetricRatio.text));
|
||||||
Rate r = new Rate();
|
Rate r = new Rate();
|
||||||
print('_rate =>$r');
|
print('_rate =>$r');
|
||||||
await shipmentRateModel.updateRate(_rate);
|
await shipmentRateModel.updateRate(_rate);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ class LengthPicker extends StatefulWidget {
|
|||||||
final String lableKey;
|
final String lableKey;
|
||||||
final bool isReadOnly;
|
final bool isReadOnly;
|
||||||
|
|
||||||
const LengthPicker({Key key, this.controller, this.lableKey, this.isReadOnly})
|
const LengthPicker(
|
||||||
|
{Key key, this.controller, this.lableKey, this.isReadOnly = false})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -42,9 +43,7 @@ class _LengthPickerState extends State<LengthPicker> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () => widget.isReadOnly == null
|
onTap: widget.isReadOnly ? null : () => _showDialog(context),
|
||||||
? _showDialog(context)
|
|
||||||
: widget.isReadOnly ? null : _showDialog(context),
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(left: 8, right: 8),
|
padding: EdgeInsets.only(left: 8, right: 8),
|
||||||
child: InputText(
|
child: InputText(
|
||||||
|
|||||||
Reference in New Issue
Block a user