add prompt confirmation and update carton
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
"btn.ok": "Ok",
|
"btn.ok": "Ok",
|
||||||
"feet":"Feet",
|
"feet":"Feet",
|
||||||
"inch":"Inch",
|
"inch":"Inch",
|
||||||
"back.button_confirm":"Are you sure you want to continue without saving changes?",
|
"back.button_confirm":"Are you sure you want to continue without submitting changes?",
|
||||||
"Buttons End ================================================================":"",
|
"Buttons End ================================================================":"",
|
||||||
|
|
||||||
"Offline Start ================================================================":"",
|
"Offline Start ================================================================":"",
|
||||||
@@ -405,6 +405,7 @@
|
|||||||
"rate.custom.form.title":"Custom",
|
"rate.custom.form.title":"Custom",
|
||||||
"rate.cutom.product_type":"Product type",
|
"rate.cutom.product_type":"Product type",
|
||||||
"rate.custom.fee":"Fee",
|
"rate.custom.fee":"Fee",
|
||||||
|
"rate.custom.shipment_rate":"Shipment rate",
|
||||||
"rate.discount.weight":"Weight",
|
"rate.discount.weight":"Weight",
|
||||||
"rate.discount.rate":"Discount rate",
|
"rate.discount.rate":"Discount rate",
|
||||||
"rate.custom_duty.title":"Custom Fee",
|
"rate.custom_duty.title":"Custom Fee",
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"btn.ok": "အိုကေ",
|
"btn.ok": "အိုကေ",
|
||||||
"feet":"ပေ",
|
"feet":"ပေ",
|
||||||
"inch":"လက်မ",
|
"inch":"လက်မ",
|
||||||
"back.button_confirm":"Are you sure you want to continue without saving changes?",
|
"back.button_confirm":"Are you sure you want to continue without submitting changes?",
|
||||||
"Buttons End ================================================================":"",
|
"Buttons End ================================================================":"",
|
||||||
|
|
||||||
"Offline Start ================================================================":"",
|
"Offline Start ================================================================":"",
|
||||||
@@ -405,6 +405,7 @@
|
|||||||
"rate.custom.form.title":"အကောက်ခွန်",
|
"rate.custom.form.title":"အကောက်ခွန်",
|
||||||
"rate.cutom.product_type":"ကုန်ပစ္စည်းအမျိုးအစား",
|
"rate.cutom.product_type":"ကုန်ပစ္စည်းအမျိုးအစား",
|
||||||
"rate.custom.fee":"အခကြေးငွေ",
|
"rate.custom.fee":"အခကြေးငွေ",
|
||||||
|
"rate.custom.shipment_rate":"တင်ပို့နှုန်း",
|
||||||
"rate.discount.weight":"အလေးချိန်",
|
"rate.discount.weight":"အလေးချိန်",
|
||||||
"rate.discount.rate":"လျှော့စျေးနှုန်း",
|
"rate.discount.rate":"လျှော့စျေးနှုန်း",
|
||||||
"rate.custom_duty.title":"အကောက်ခွန်များ",
|
"rate.custom_duty.title":"အကောက်ခွန်များ",
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class CargoType {
|
|||||||
double weight;
|
double weight;
|
||||||
bool isChecked;
|
bool isChecked;
|
||||||
int qty;
|
int qty;
|
||||||
|
bool isCutomDuty = false;
|
||||||
|
|
||||||
double get calAmount => (calRate ?? 0) * (calWeight ?? 0);
|
double get calAmount => (calRate ?? 0) * (calWeight ?? 0);
|
||||||
|
|
||||||
@@ -29,7 +30,8 @@ class CargoType {
|
|||||||
this.calWeight,
|
this.calWeight,
|
||||||
this.calRate,
|
this.calRate,
|
||||||
this.isChecked = false,
|
this.isChecked = false,
|
||||||
this.qty = 0});
|
this.qty = 0,
|
||||||
|
this.isCutomDuty = false});
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {
|
||||||
@@ -56,4 +58,8 @@ class CargoType {
|
|||||||
String toString() {
|
String toString() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isChangedForEdit(CargoType cargoType) {
|
||||||
|
return cargoType.name != this.name || cargoType.rate != this.rate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ class CartonSize {
|
|||||||
double height;
|
double height;
|
||||||
CartonSize({this.id, this.name, this.length, this.width, this.height});
|
CartonSize({this.id, this.name, this.length, this.width, this.height});
|
||||||
|
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {
|
||||||
'id': id,
|
'id': id,
|
||||||
@@ -27,4 +26,10 @@ class CartonSize {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isChangedForEdit(CartonSize cartonSize) {
|
||||||
|
return cartonSize.name != this.name ||
|
||||||
|
cartonSize.length != this.length ||
|
||||||
|
cartonSize.width != this.width ||
|
||||||
|
cartonSize.height != this.height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ class CustomDuty {
|
|||||||
String productType;
|
String productType;
|
||||||
String desc;
|
String desc;
|
||||||
double fee;
|
double fee;
|
||||||
CustomDuty({this.id, this.productType, this.desc, this.fee});
|
double shipmentRate;
|
||||||
|
CustomDuty(
|
||||||
|
{this.id, this.productType, this.desc, this.fee, this.shipmentRate});
|
||||||
|
|
||||||
factory CustomDuty.fromMap(Map<String, dynamic> map, String id) {
|
factory CustomDuty.fromMap(Map<String, dynamic> map, String id) {
|
||||||
return CustomDuty(
|
return CustomDuty(
|
||||||
@@ -28,4 +30,11 @@ class CustomDuty {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => id.hashCode;
|
int get hashCode => id.hashCode;
|
||||||
|
|
||||||
|
bool isChangedForEdit(CustomDuty customDuty) {
|
||||||
|
return customDuty.productType != this.productType ||
|
||||||
|
customDuty.fee != this.fee
|
||||||
|
// ||customDuty.shipmentRate != this.shipmentRate
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,4 +35,10 @@ class Discount {
|
|||||||
status: map['status'],
|
status: map['status'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isChangedForEdit(Discount discount) {
|
||||||
|
return discount.code != this.code ||
|
||||||
|
discount.amount != this.amount ||
|
||||||
|
discount.customerId != this.customerId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,4 +20,9 @@ class DiscountByWeight {
|
|||||||
'discount': discount,
|
'discount': discount,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isChangedForEdit(DiscountByWeight discountByWeight) {
|
||||||
|
return discountByWeight.weight != this.weight ||
|
||||||
|
discountByWeight.discount != this.discount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,4 +66,14 @@ class FcsShipment {
|
|||||||
bool isConfirmed() {
|
bool isConfirmed() {
|
||||||
return status == fcs_shipment_confirmed_status;
|
return status == fcs_shipment_confirmed_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isChangedForEdit(FcsShipment fcsShipment) {
|
||||||
|
return fcsShipment.shipmentNumber != this.shipmentNumber ||
|
||||||
|
fcsShipment.cutoffDate != this.cutoffDate ||
|
||||||
|
fcsShipment.arrivalDate != this.arrivalDate ||
|
||||||
|
fcsShipment.shipType != this.shipType ||
|
||||||
|
fcsShipment.consignee != this.consignee ||
|
||||||
|
fcsShipment.port != this.port ||
|
||||||
|
fcsShipment.destination != this.destination;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,6 +131,12 @@ class Package {
|
|||||||
currentStatusDate: DateTime.parse(json['status_date']));
|
currentStatusDate: DateTime.parse(json['status_date']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isChangedForEdit(Package package) {
|
||||||
|
return package.trackingID != this.trackingID ||
|
||||||
|
package.remark != this.remark ||
|
||||||
|
package.fcsID != this.fcsID;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) => other is Package && other.id == id;
|
bool operator ==(Object other) => other is Package && other.id == id;
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ class Processing {
|
|||||||
@override
|
@override
|
||||||
int get hashCode => id.hashCode;
|
int get hashCode => id.hashCode;
|
||||||
|
|
||||||
|
bool isChangedForEdit(Processing processing) {
|
||||||
|
return processing.userID != this.userID ||
|
||||||
|
processing.fcsID != this.fcsID ||
|
||||||
|
processing.packages != this.packages;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'Processing{id: $id}';
|
return 'Processing{id: $id}';
|
||||||
|
|||||||
@@ -44,6 +44,12 @@ class Rate {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isChangedForEdit(Rate rate) {
|
||||||
|
return rate.freeDeliveryWeight != this.freeDeliveryWeight ||
|
||||||
|
rate.deliveryFee != this.deliveryFee ||
|
||||||
|
rate.volumetricRatio != this.volumetricRatio;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'Rate{deliveryFee:$deliveryFee,freeDeliveryWeight:$freeDeliveryWeight,volumetricRatio:$volumetricRatio}';
|
return 'Rate{deliveryFee:$deliveryFee,freeDeliveryWeight:$freeDeliveryWeight,volumetricRatio:$volumetricRatio}';
|
||||||
|
|||||||
@@ -41,4 +41,13 @@ class DeliveryAddress {
|
|||||||
'phone_number': phoneNumber,
|
'phone_number': phoneNumber,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isChangedForEdit(DeliveryAddress deliveryAddress) {
|
||||||
|
return deliveryAddress.fullName != this.fullName ||
|
||||||
|
deliveryAddress.phoneNumber != this.phoneNumber ||
|
||||||
|
deliveryAddress.addressLine1 != this.addressLine1 ||
|
||||||
|
deliveryAddress.addressLine2 != this.addressLine2 ||
|
||||||
|
deliveryAddress.state != this.state ||
|
||||||
|
deliveryAddress.city != this.city;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
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/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/pages/main/util.dart';
|
import 'package:fcs/pages/main/util.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/local_text.dart';
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
import 'package:fcs/pages/widgets/local_title.dart';
|
import 'package:fcs/pages/widgets/local_title.dart';
|
||||||
@@ -8,7 +10,6 @@ import 'package:fcs/pages/widgets/progress.dart';
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import 'input_text_border.dart';
|
import 'input_text_border.dart';
|
||||||
|
|
||||||
class CargoTypeAddition extends StatefulWidget {
|
class CargoTypeAddition extends StatefulWidget {
|
||||||
@@ -24,10 +25,12 @@ class _CargoTypeAdditionState extends State<CargoTypeAddition> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
cargos =
|
var shipmentRateModel =
|
||||||
Provider.of<ShipmentRateModel>(context, listen: false).rate.cargoTypes;
|
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||||
|
cargos = List.from(shipmentRateModel.rate.cargoTypes);
|
||||||
cargos.forEach((p) {
|
cargos.forEach((p) {
|
||||||
p.isChecked = false;
|
p.isChecked = false;
|
||||||
|
p.isCutomDuty = false;
|
||||||
p.weight = 0;
|
p.weight = 0;
|
||||||
p.qty = null;
|
p.qty = null;
|
||||||
});
|
});
|
||||||
@@ -55,7 +58,7 @@ class _CargoTypeAdditionState extends State<CargoTypeAddition> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 50,
|
width: 40,
|
||||||
),
|
),
|
||||||
LocalText(
|
LocalText(
|
||||||
context,
|
context,
|
||||||
@@ -95,40 +98,58 @@ class _CargoTypeAdditionState extends State<CargoTypeAddition> {
|
|||||||
}),
|
}),
|
||||||
Expanded(child: new Text(c.name, style: textStyle)),
|
Expanded(child: new Text(c.name, style: textStyle)),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 50,
|
width: c.isCutomDuty ? 50 : 40,
|
||||||
|
child: c.isCutomDuty
|
||||||
|
? InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
cargos.removeWhere((t) => t.name == c.name);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Icon(
|
||||||
|
Icons.remove_circle,
|
||||||
|
color: Colors.black45,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: 30,
|
height: 30,
|
||||||
width: 40,
|
width: 50,
|
||||||
child: InputTextBorder(
|
child: c.isCutomDuty
|
||||||
onAdd: (value) {
|
? InputTextBorder(
|
||||||
setState(() {
|
onAdd: (value) {
|
||||||
if (value == "" || value == null) {
|
setState(() {
|
||||||
c.isChecked = false;
|
if (value == "" || value == null) {
|
||||||
} else {
|
c.isChecked = false;
|
||||||
c.qty = int.parse(value);
|
} else {
|
||||||
c.isChecked = true;
|
c.qty = int.parse(value);
|
||||||
}
|
c.isChecked = true;
|
||||||
});
|
}
|
||||||
},
|
});
|
||||||
),
|
},
|
||||||
|
)
|
||||||
|
: Center(child: Text("-")),
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
Container(
|
Container(
|
||||||
height: 30,
|
height: 30,
|
||||||
width: 60,
|
width: 60,
|
||||||
child: InputTextBorder(
|
child: Center(
|
||||||
onAdd: (value) {
|
child: Text(
|
||||||
setState(() {
|
c.weight == null ? "" : c.weight.toStringAsFixed(2))),
|
||||||
if (value == "" || value == null) {
|
// child: InputTextBorder(
|
||||||
c.isChecked = false;
|
// onAdd: (value) {
|
||||||
} else {
|
// setState(() {
|
||||||
c.weight = double.parse(value);
|
// if (value == "" || value == null) {
|
||||||
c.isChecked = true;
|
// c.isChecked = false;
|
||||||
}
|
// } else {
|
||||||
});
|
// c.weight = double.parse(value);
|
||||||
},
|
// c.isChecked = true;
|
||||||
),
|
// }
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -146,6 +167,7 @@ class _CargoTypeAdditionState extends State<CargoTypeAddition> {
|
|||||||
Navigator.pop(context, _cargos);
|
Navigator.pop(context, _cargos);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
@@ -169,7 +191,21 @@ class _CargoTypeAdditionState extends State<CargoTypeAddition> {
|
|||||||
child: ListView(
|
child: ListView(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
LocalTitle(textKey: "box.select.cargo.title"),
|
LocalTitle(
|
||||||
|
textKey: "box.select.cargo.title",
|
||||||
|
trailing: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.add_circle,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
CustomDuty customDuty = await Navigator.of(context).push(
|
||||||
|
CupertinoPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
CustomList(selected: true)));
|
||||||
|
_addCustom(customDuty);
|
||||||
|
}),
|
||||||
|
),
|
||||||
cargoTableTitleBox,
|
cargoTableTitleBox,
|
||||||
Divider(
|
Divider(
|
||||||
color: Colors.grey[400],
|
color: Colors.grey[400],
|
||||||
@@ -186,4 +222,14 @@ class _CargoTypeAdditionState extends State<CargoTypeAddition> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_addCustom(CustomDuty customDuty) {
|
||||||
|
if (customDuty == null) return;
|
||||||
|
|
||||||
|
if (cargos.any((c) => c.name == customDuty.productType)) return;
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
cargos.add(CargoType(name: customDuty.productType, isCutomDuty: true));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,13 @@ class _CargoTableState extends State<CargoTable> {
|
|||||||
double totalWeight = 0;
|
double totalWeight = 0;
|
||||||
List<CargoType> _cargos = [];
|
List<CargoType> _cargos = [];
|
||||||
double remainingWeight = 0;
|
double remainingWeight = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
remainingWeight =
|
||||||
|
widget.cargoTypes.length == 0 ? this.totalWeight : remainingWeight;
|
||||||
|
this._cargos = widget.cargoTypes.length == 0 ? [] : this._cargos;
|
||||||
|
|
||||||
return MyDataTable(
|
return MyDataTable(
|
||||||
headingRowHeight: 40,
|
headingRowHeight: 40,
|
||||||
columns: [
|
columns: [
|
||||||
@@ -41,17 +46,10 @@ class _CargoTableState extends State<CargoTable> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
MyDataColumn(
|
MyDataColumn(
|
||||||
label: Row(
|
label: LocalText(
|
||||||
children: [
|
context,
|
||||||
Container(
|
"cargo.weight",
|
||||||
padding: EdgeInsets.only(left:50),
|
color: Colors.grey,
|
||||||
child: LocalText(
|
|
||||||
context,
|
|
||||||
"cargo.weight",
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -65,12 +63,48 @@ class _CargoTableState extends State<CargoTable> {
|
|||||||
}
|
}
|
||||||
List<String> _list = [];
|
List<String> _list = [];
|
||||||
List<String> _types = [];
|
List<String> _types = [];
|
||||||
double _total = 0;
|
|
||||||
|
|
||||||
var rows = widget.cargoTypes.map((c) {
|
var rows = widget.cargoTypes.map((c) {
|
||||||
_total += c.weight;
|
|
||||||
return MyDataRow(
|
return MyDataRow(
|
||||||
onSelectChanged: (bool selected) async {},
|
onSelectChanged: (bool selected) async {
|
||||||
|
if (this.totalWeight <= 0) {
|
||||||
|
showMsgDialog(context, "Error", "Please insert total weight");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c.isCutomDuty) return;
|
||||||
|
CargoType cargo = await Navigator.push<CargoType>(
|
||||||
|
context,
|
||||||
|
CupertinoPageRoute(
|
||||||
|
builder: (context) => CargoTypeEditor(
|
||||||
|
cargo: c,
|
||||||
|
)));
|
||||||
|
if (widget.onAdd != null) widget.onAdd(cargo);
|
||||||
|
if (cargo == null) return;
|
||||||
|
|
||||||
|
this._cargos.add(cargo);
|
||||||
|
if (this.remainingWeight <= 0) return;
|
||||||
|
this.remainingWeight -= cargo.weight;
|
||||||
|
|
||||||
|
this._cargos.forEach((c) {
|
||||||
|
_list.add(c.name);
|
||||||
|
});
|
||||||
|
widget.cargoTypes.forEach((c) {
|
||||||
|
_types.add(c.name);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this._cargos.length == widget.cargoTypes.length - 1) {
|
||||||
|
_types.forEach((t) {
|
||||||
|
if (!_list.contains(t)) {
|
||||||
|
widget.cargoTypes.forEach((c) {
|
||||||
|
if (c.name == t) {
|
||||||
|
c.weight = this.remainingWeight;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
cells: [
|
cells: [
|
||||||
MyDataCell(Row(
|
MyDataCell(Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -88,7 +122,8 @@ class _CargoTableState extends State<CargoTable> {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Text(c.weight.toStringAsFixed(2), style: textStyle),
|
Text(c.weight == null ? "0.00" : c.weight.toStringAsFixed(2),
|
||||||
|
style: textStyle),
|
||||||
widget.onRemove == null
|
widget.onRemove == null
|
||||||
? SizedBox(
|
? SizedBox(
|
||||||
width: 50,
|
width: 50,
|
||||||
@@ -134,35 +169,13 @@ class _CargoTableState extends State<CargoTable> {
|
|||||||
if (_t == null) return;
|
if (_t == null) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
totalWeight = _t;
|
totalWeight = _t;
|
||||||
this.remainingWeight = this.totalWeight - _total;
|
remainingWeight = totalWeight;
|
||||||
widget.cargoTypes.forEach((c) {
|
|
||||||
if (c.qty == null) {
|
|
||||||
this._cargos.add(c);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this._cargos.forEach((c) {
|
|
||||||
_list.add(c.name);
|
|
||||||
});
|
|
||||||
widget.cargoTypes.forEach((c) {
|
|
||||||
_types.add(c.name);
|
|
||||||
});
|
|
||||||
if (this._cargos.length == widget.cargoTypes.length - 1) {
|
|
||||||
_types.forEach((t) {
|
|
||||||
if (!_list.contains(t)) {
|
|
||||||
widget.cargoTypes.forEach((c) {
|
|
||||||
if (c.name == t) {
|
|
||||||
c.weight = this.remainingWeight;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(7.0),
|
padding: const EdgeInsets.all(7.0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: Colors.grey),
|
border: Border.all(color: primaryColor),
|
||||||
borderRadius: BorderRadius.all(Radius.circular(5.0)),
|
borderRadius: BorderRadius.all(Radius.circular(5.0)),
|
||||||
),
|
),
|
||||||
child: Text(totalWeight.toStringAsFixed(2),
|
child: Text(totalWeight.toStringAsFixed(2),
|
||||||
@@ -181,4 +194,78 @@ class _CargoTableState extends State<CargoTable> {
|
|||||||
double _r = this.totalWeight < total ? 0 : this.totalWeight - total;
|
double _r = this.totalWeight < total ? 0 : this.totalWeight - total;
|
||||||
return _r;
|
return _r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<MyDataRow> _getCargoRows(BuildContext context) {
|
||||||
|
if (widget.cargoTypes == null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
double total = 0;
|
||||||
|
var rows = widget.cargoTypes.map((c) {
|
||||||
|
total += c.weight;
|
||||||
|
return MyDataRow(
|
||||||
|
onSelectChanged: (bool selected) async {
|
||||||
|
CargoType cargo = await Navigator.push<CargoType>(
|
||||||
|
context,
|
||||||
|
CupertinoPageRoute(
|
||||||
|
builder: (context) => CargoTypeEditor(
|
||||||
|
cargo: c,
|
||||||
|
)));
|
||||||
|
if (widget.onAdd != null) widget.onAdd(cargo);
|
||||||
|
},
|
||||||
|
cells: [
|
||||||
|
MyDataCell(new Text(
|
||||||
|
c.name == null ? "" : c.name,
|
||||||
|
style: textStyle,
|
||||||
|
)),
|
||||||
|
MyDataCell(
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Text(c.weight == null ? "0" : c.weight.toStringAsFixed(2),
|
||||||
|
style: textStyle),
|
||||||
|
widget.onRemove == null
|
||||||
|
? SizedBox(
|
||||||
|
width: 50,
|
||||||
|
)
|
||||||
|
: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.remove_circle,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
if (widget.onRemove != null) widget.onRemove(c);
|
||||||
|
})
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
var totalRow = MyDataRow(
|
||||||
|
onSelectChanged: (bool selected) {},
|
||||||
|
cells: [
|
||||||
|
MyDataCell(Align(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
"shipment.cargo.total",
|
||||||
|
color: Colors.black87,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
MyDataCell(
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 48.0),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: Text(total.toStringAsFixed(2),
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold))),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
rows.add(totalRow);
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,10 +41,17 @@ class _CargoTableState extends State<CargoTable> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
MyDataColumn(
|
MyDataColumn(
|
||||||
label: LocalText(
|
label: Row(
|
||||||
context,
|
children: [
|
||||||
"cargo.weight",
|
Container(
|
||||||
color: Colors.grey,
|
padding: EdgeInsets.only(left: 50),
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
"cargo.weight",
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -58,50 +65,24 @@ class _CargoTableState extends State<CargoTable> {
|
|||||||
}
|
}
|
||||||
List<String> _list = [];
|
List<String> _list = [];
|
||||||
List<String> _types = [];
|
List<String> _types = [];
|
||||||
|
double _total = 0;
|
||||||
|
|
||||||
var rows = widget.cargoTypes.map((c) {
|
var rows = widget.cargoTypes.map((c) {
|
||||||
|
_total += c.weight;
|
||||||
return MyDataRow(
|
return MyDataRow(
|
||||||
onSelectChanged: (bool selected) async {
|
onSelectChanged: (bool selected) async {},
|
||||||
if (this.totalWeight <= 0) {
|
|
||||||
showMsgDialog(context, "Error", "Please insert total weight");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
CargoType cargo = await Navigator.push<CargoType>(
|
|
||||||
context,
|
|
||||||
CupertinoPageRoute(
|
|
||||||
builder: (context) => CargoTypeEditor(
|
|
||||||
cargo: c,
|
|
||||||
)));
|
|
||||||
if (widget.onAdd != null) widget.onAdd(cargo);
|
|
||||||
if (cargo == null) return;
|
|
||||||
|
|
||||||
this._cargos.add(cargo);
|
|
||||||
if (this.remainingWeight <= 0) return;
|
|
||||||
this.remainingWeight -= cargo.weight;
|
|
||||||
|
|
||||||
this._cargos.forEach((c) {
|
|
||||||
_list.add(c.name);
|
|
||||||
});
|
|
||||||
widget.cargoTypes.forEach((c) {
|
|
||||||
_types.add(c.name);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (this._cargos.length == widget.cargoTypes.length - 1) {
|
|
||||||
_types.forEach((t) {
|
|
||||||
if (!_list.contains(t)) {
|
|
||||||
widget.cargoTypes.forEach((c) {
|
|
||||||
if (c.name == t) {
|
|
||||||
c.weight = this.remainingWeight;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
cells: [
|
cells: [
|
||||||
MyDataCell(new Text(
|
MyDataCell(Row(
|
||||||
c.name == null ? "" : c.name,
|
children: [
|
||||||
style: textStyle,
|
new Text(
|
||||||
|
c.name == null ? "" : c.name,
|
||||||
|
style: textStyle,
|
||||||
|
),
|
||||||
|
new Text(
|
||||||
|
c.qty == null ? "" : " x ${c.qty.toString()}",
|
||||||
|
style: TextStyle(color: Colors.grey),
|
||||||
|
),
|
||||||
|
],
|
||||||
)),
|
)),
|
||||||
MyDataCell(
|
MyDataCell(
|
||||||
Row(
|
Row(
|
||||||
@@ -153,13 +134,35 @@ class _CargoTableState extends State<CargoTable> {
|
|||||||
if (_t == null) return;
|
if (_t == null) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
totalWeight = _t;
|
totalWeight = _t;
|
||||||
remainingWeight = _t;
|
this.remainingWeight = this.totalWeight - _total;
|
||||||
|
widget.cargoTypes.forEach((c) {
|
||||||
|
if (c.qty == null) {
|
||||||
|
this._cargos.add(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this._cargos.forEach((c) {
|
||||||
|
_list.add(c.name);
|
||||||
|
});
|
||||||
|
widget.cargoTypes.forEach((c) {
|
||||||
|
_types.add(c.name);
|
||||||
|
});
|
||||||
|
if (this._cargos.length == widget.cargoTypes.length - 1) {
|
||||||
|
_types.forEach((t) {
|
||||||
|
if (!_list.contains(t)) {
|
||||||
|
widget.cargoTypes.forEach((c) {
|
||||||
|
if (c.name == t) {
|
||||||
|
c.weight = this.remainingWeight;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(7.0),
|
padding: const EdgeInsets.all(7.0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: primaryColor),
|
border: Border.all(color: Colors.grey),
|
||||||
borderRadius: BorderRadius.all(Radius.circular(5.0)),
|
borderRadius: BorderRadius.all(Radius.circular(5.0)),
|
||||||
),
|
),
|
||||||
child: Text(totalWeight.toStringAsFixed(2),
|
child: Text(totalWeight.toStringAsFixed(2),
|
||||||
@@ -178,78 +181,4 @@ class _CargoTableState extends State<CargoTable> {
|
|||||||
double _r = this.totalWeight < total ? 0 : this.totalWeight - total;
|
double _r = this.totalWeight < total ? 0 : this.totalWeight - total;
|
||||||
return _r;
|
return _r;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<MyDataRow> _getCargoRows(BuildContext context) {
|
|
||||||
if (widget.cargoTypes == null) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
double total = 0;
|
|
||||||
var rows = widget.cargoTypes.map((c) {
|
|
||||||
total += c.weight;
|
|
||||||
return MyDataRow(
|
|
||||||
onSelectChanged: (bool selected) async {
|
|
||||||
CargoType cargo = await Navigator.push<CargoType>(
|
|
||||||
context,
|
|
||||||
CupertinoPageRoute(
|
|
||||||
builder: (context) => CargoTypeEditor(
|
|
||||||
cargo: c,
|
|
||||||
)));
|
|
||||||
if (widget.onAdd != null) widget.onAdd(cargo);
|
|
||||||
},
|
|
||||||
cells: [
|
|
||||||
MyDataCell(new Text(
|
|
||||||
c.name == null ? "" : c.name,
|
|
||||||
style: textStyle,
|
|
||||||
)),
|
|
||||||
MyDataCell(
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
Text(c.weight == null ? "0" : c.weight.toStringAsFixed(2),
|
|
||||||
style: textStyle),
|
|
||||||
widget.onRemove == null
|
|
||||||
? SizedBox(
|
|
||||||
width: 50,
|
|
||||||
)
|
|
||||||
: IconButton(
|
|
||||||
icon: Icon(
|
|
||||||
Icons.remove_circle,
|
|
||||||
color: primaryColor,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
if (widget.onRemove != null) widget.onRemove(c);
|
|
||||||
})
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}).toList();
|
|
||||||
|
|
||||||
var totalRow = MyDataRow(
|
|
||||||
onSelectChanged: (bool selected) {},
|
|
||||||
cells: [
|
|
||||||
MyDataCell(Align(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
child: LocalText(
|
|
||||||
context,
|
|
||||||
"shipment.cargo.total",
|
|
||||||
color: Colors.black87,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
MyDataCell(
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(right: 48.0),
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
child: Text(total.toStringAsFixed(2),
|
|
||||||
style: TextStyle(fontWeight: FontWeight.bold))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
rows.add(totalRow);
|
|
||||||
return rows;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,11 +99,11 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
_isNew = true;
|
_isNew = true;
|
||||||
_selectedCartonType = carton_from_packages;
|
_selectedCartonType = carton_from_packages;
|
||||||
_loadFcsShipments();
|
_loadFcsShipments();
|
||||||
_cartons = [
|
// _cartons = [
|
||||||
Carton(cartonNumber: "A100B-1#1"),
|
// Carton(cartonNumber: "A100B-1#1"),
|
||||||
Carton(cartonNumber: "A100B-1#2"),
|
// Carton(cartonNumber: "A100B-1#2"),
|
||||||
Carton(cartonNumber: "A100B-1#3")
|
// Carton(cartonNumber: "A100B-1#3")
|
||||||
];
|
// ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,9 +382,13 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
leading: new IconButton(
|
leading: new IconButton(
|
||||||
icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30),
|
icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
if (isDataChanged()) {
|
||||||
|
showConfirmDialog(context, "back.button_confirm", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
shadowColor: Colors.transparent,
|
shadowColor: Colors.transparent,
|
||||||
@@ -726,4 +730,12 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDataChanged() {
|
||||||
|
if (_isNew) {
|
||||||
|
return _fcsShipment != null || _user != null || _cartons.isNotEmpty;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,15 @@ typedef OnAdd(String value);
|
|||||||
|
|
||||||
class InputTextBorder extends StatelessWidget {
|
class InputTextBorder extends StatelessWidget {
|
||||||
final OnAdd onAdd;
|
final OnAdd onAdd;
|
||||||
|
final TextEditingController controller;
|
||||||
|
|
||||||
const InputTextBorder({Key key, this.onAdd}) : super(key: key);
|
const InputTextBorder({Key key, this.onAdd, this.controller})
|
||||||
|
: super(key: key);
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return TextFormField(
|
return TextFormField(
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
controller: controller,
|
||||||
onChanged: (v) {
|
onChanged: (v) {
|
||||||
if (onAdd != null) onAdd(v);
|
if (onAdd != null) onAdd(v);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
import 'package:fcs/domain/entities/cargo_type.dart';
|
|
||||||
import 'package:fcs/domain/entities/carton_size.dart';
|
import 'package:fcs/domain/entities/carton_size.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/pages/main/util.dart';
|
import 'package:fcs/pages/main/util.dart';
|
||||||
import 'package:fcs/pages/rates/model/shipment_rate_model.dart';
|
|
||||||
import 'package:fcs/pages/widgets/input_text.dart';
|
import 'package:fcs/pages/widgets/input_text.dart';
|
||||||
import 'package:fcs/pages/widgets/length_picker.dart';
|
import 'package:fcs/pages/widgets/length_picker.dart';
|
||||||
import 'package:fcs/pages/widgets/local_dropdown.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';
|
||||||
@@ -140,9 +137,13 @@ class _CartonSizeEditorState extends State<CartonSizeEditor> {
|
|||||||
icon:
|
icon:
|
||||||
new Icon(CupertinoIcons.back, color: primaryColor, size: 30),
|
new Icon(CupertinoIcons.back, color: primaryColor, size: 30),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
if (isDataChanged()) {
|
||||||
|
showConfirmDialog(context, "back.button_confirm", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
shadowColor: Colors.transparent,
|
shadowColor: Colors.transparent,
|
||||||
@@ -169,4 +170,21 @@ class _CartonSizeEditorState extends State<CartonSizeEditor> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDataChanged() {
|
||||||
|
if (_isNew) {
|
||||||
|
return _nameController.text != "" ||
|
||||||
|
_lengthController.text != "12" ||
|
||||||
|
_widthController.text != "12" ||
|
||||||
|
_heightController.text != "12";
|
||||||
|
} else {
|
||||||
|
double l = double.parse(_lengthController.text, (s) => 0);
|
||||||
|
double w = double.parse(_widthController.text, (s) => 0);
|
||||||
|
double h = double.parse(_heightController.text, (s) => 0);
|
||||||
|
CartonSize _cartonSize = CartonSize(
|
||||||
|
name: _nameController.text, length: l, width: w, height: h);
|
||||||
|
|
||||||
|
return widget.cartonSize.isChangedForEdit(_cartonSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,17 +29,21 @@ class _ContactEditorState extends State<ContactEditor> {
|
|||||||
TextEditingController _facebook = new TextEditingController();
|
TextEditingController _facebook = new TextEditingController();
|
||||||
|
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
|
bool isNew;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
if (widget.contact != null) {
|
if (widget.contact != null) {
|
||||||
|
isNew = false;
|
||||||
_usaPhone.text = widget.contact.usaContactNumber;
|
_usaPhone.text = widget.contact.usaContactNumber;
|
||||||
_mmPhone.text = widget.contact.mmContactNumber;
|
_mmPhone.text = widget.contact.mmContactNumber;
|
||||||
_usaAddress.text = widget.contact.usaAddress;
|
_usaAddress.text = widget.contact.usaAddress;
|
||||||
_mmAddress.text = widget.contact.mmAddress;
|
_mmAddress.text = widget.contact.mmAddress;
|
||||||
_email.text = widget.contact.emailAddress;
|
_email.text = widget.contact.emailAddress;
|
||||||
_facebook.text = widget.contact.facebookLink;
|
_facebook.text = widget.contact.facebookLink;
|
||||||
|
} else {
|
||||||
|
isNew = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,9 +87,7 @@ class _ContactEditorState extends State<ContactEditor> {
|
|||||||
leading: new IconButton(
|
leading: new IconButton(
|
||||||
icon: new Icon(CupertinoIcons.back, color: primaryColor),
|
icon: new Icon(CupertinoIcons.back, color: primaryColor),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
|
||||||
});
|
|
||||||
}),
|
}),
|
||||||
shadowColor: Colors.transparent,
|
shadowColor: Colors.transparent,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
|
|||||||
@@ -52,9 +52,13 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
|||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
if (isDataChanged()) {
|
||||||
|
showConfirmDialog(context, "back.button_confirm", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
title: LocalText(
|
title: LocalText(
|
||||||
@@ -166,4 +170,10 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDataChanged() {
|
||||||
|
String userName = _nameController.text;
|
||||||
|
String phoneNumber = _phoneController.text;
|
||||||
|
return userName != "" || phoneNumber != "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,9 +238,7 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
|
|||||||
leading: new IconButton(
|
leading: new IconButton(
|
||||||
icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30),
|
icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
shadowColor: Colors.transparent,
|
shadowColor: Colors.transparent,
|
||||||
|
|||||||
@@ -107,9 +107,13 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
|
|||||||
leading: new IconButton(
|
leading: new IconButton(
|
||||||
icon: new Icon(CupertinoIcons.back, color: primaryColor),
|
icon: new Icon(CupertinoIcons.back, color: primaryColor),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
if (isDataChanged()) {
|
||||||
|
showConfirmDialog(context, "back.button_confirm", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
@@ -252,4 +256,18 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDataChanged() {
|
||||||
|
if (_isNew) {
|
||||||
|
return _nameController.text != "" ||
|
||||||
|
_phoneController.text != "" ||
|
||||||
|
_address1Controller.text != "" ||
|
||||||
|
_address2Controller.text != "" ||
|
||||||
|
_cityController.text != "Yangon" ||
|
||||||
|
_stateController.text != "Yangon";
|
||||||
|
} else {
|
||||||
|
DeliveryAddress deliveryAddress = _getPayload();
|
||||||
|
return widget.deliveryAddress.isChangedForEdit(deliveryAddress);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,9 +98,13 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
|||||||
leading: new IconButton(
|
leading: new IconButton(
|
||||||
icon: new Icon(CupertinoIcons.back),
|
icon: new Icon(CupertinoIcons.back),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
if (isDataChanged()) {
|
||||||
|
showConfirmDialog(context, "back.button_confirm", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
@@ -192,4 +196,19 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDataChanged() {
|
||||||
|
if (_isNew) {
|
||||||
|
return _codeController.text != "" ||
|
||||||
|
_amountController.text != "" ||
|
||||||
|
customerName != "";
|
||||||
|
} else {
|
||||||
|
Discount _discount = Discount(
|
||||||
|
code: _codeController.text,
|
||||||
|
customerName: customerName,
|
||||||
|
customerId: customerId,
|
||||||
|
amount: double.parse(_amountController.text));
|
||||||
|
return widget.discount.isChangedForEdit(_discount);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,9 +127,13 @@ class _FAQEditorState extends State<FAQEditor> {
|
|||||||
leading: new IconButton(
|
leading: new IconButton(
|
||||||
icon: new Icon(CupertinoIcons.back, color: primaryColor),
|
icon: new Icon(CupertinoIcons.back, color: primaryColor),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
if (isDataChanged()) {
|
||||||
|
showConfirmDialog(context, "back.button_confirm", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
@@ -240,4 +244,15 @@ class _FAQEditorState extends State<FAQEditor> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDataChanged() {
|
||||||
|
return _sn.text != "" ||
|
||||||
|
_engQ.text != "" ||
|
||||||
|
_engA.text != "" ||
|
||||||
|
_mmQ.text != "" ||
|
||||||
|
_mmA.text != "" ||
|
||||||
|
_pageLabelEng.text != "" ||
|
||||||
|
_pageLabelMm.text != "" ||
|
||||||
|
_pageLink != info;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,9 +94,13 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
|||||||
leading: new IconButton(
|
leading: new IconButton(
|
||||||
icon: new Icon(CupertinoIcons.back, color: primaryColor),
|
icon: new Icon(CupertinoIcons.back, color: primaryColor),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
if (isDataChanged()) {
|
||||||
|
showConfirmDialog(context, "back.button_confirm", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
@@ -271,4 +275,20 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDataChanged() {
|
||||||
|
if (_isNew) {
|
||||||
|
var mainModel = Provider.of<MainModel>(context, listen: false);
|
||||||
|
return _shipmentNumberController.text != "" ||
|
||||||
|
_cutoffDateController.text != "" ||
|
||||||
|
_arrivalDateController.text != "" ||
|
||||||
|
_consigneeController.text != "" ||
|
||||||
|
_portController.text != "" ||
|
||||||
|
_destinationController.text != "" ||
|
||||||
|
_currentShipmentType != mainModel.setting.shipmentTypes[0];
|
||||||
|
} else {
|
||||||
|
FcsShipment fcsShipment = _getPayload();
|
||||||
|
return widget.shipment.isChangedForEdit(fcsShipment);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -316,9 +316,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
leading: new IconButton(
|
leading: new IconButton(
|
||||||
icon: new Icon(CupertinoIcons.back, color: primaryColor),
|
icon: new Icon(CupertinoIcons.back, color: primaryColor),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
|
|||||||
@@ -61,9 +61,13 @@ class _PaymentMethodEditorState extends State<PaymentMethodEditor> {
|
|||||||
leading: new IconButton(
|
leading: new IconButton(
|
||||||
icon: new Icon(CupertinoIcons.back, color: primaryColor),
|
icon: new Icon(CupertinoIcons.back, color: primaryColor),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
if (isDataChanged()) {
|
||||||
|
showConfirmDialog(context, "back.button_confirm", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
title: LocalText(
|
title: LocalText(
|
||||||
@@ -214,4 +218,13 @@ class _PaymentMethodEditorState extends State<PaymentMethodEditor> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDataChanged() {
|
||||||
|
return _nameController.text != "" ||
|
||||||
|
_accountNameController.text != "" ||
|
||||||
|
_accountNumberController.text != "" ||
|
||||||
|
_phoneController.text != "" ||
|
||||||
|
_mailController.text != "" ||
|
||||||
|
_linkController.text != "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,9 +118,13 @@ class _ProcessingEditEditorState extends State<ProcessingEditEditor> {
|
|||||||
leading: new IconButton(
|
leading: new IconButton(
|
||||||
icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30),
|
icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
if (isDataChanged()) {
|
||||||
|
showConfirmDialog(context, "back.button_confirm", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
shadowColor: Colors.transparent,
|
shadowColor: Colors.transparent,
|
||||||
@@ -261,4 +265,12 @@ class _ProcessingEditEditorState extends State<ProcessingEditEditor> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDataChanged() {
|
||||||
|
return _user.fcsID != "" ||
|
||||||
|
selectedMarket != "" ||
|
||||||
|
_descCtl.text != "" ||
|
||||||
|
_remarkCtl.text != "" ||
|
||||||
|
multiImgController.getAddedFile.isNotEmpty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,9 +172,13 @@ class _ProcesingEditorState extends State<ProcesingEditor> {
|
|||||||
icon:
|
icon:
|
||||||
new Icon(CupertinoIcons.back, color: primaryColor, size: 30),
|
new Icon(CupertinoIcons.back, color: primaryColor, size: 30),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
if (isDataChanged()) {
|
||||||
|
showConfirmDialog(context, "back.button_confirm", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
shadowColor: Colors.transparent,
|
shadowColor: Colors.transparent,
|
||||||
@@ -324,4 +328,14 @@ class _ProcesingEditorState extends State<ProcesingEditor> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDataChanged() {
|
||||||
|
if (_isNew) {
|
||||||
|
return this.packages.isNotEmpty || user != null || shipper != null;
|
||||||
|
} else {
|
||||||
|
Processing _processing = Processing(
|
||||||
|
userID: user.fcsID, fcsID: shipper.fcsID, packages: this.packages);
|
||||||
|
return widget.processing.isChangedForEdit(_processing);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,9 +60,7 @@ class _ProfileCurrencyEditState extends State<ProfileCurrencyEdit> {
|
|||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -75,9 +75,7 @@ class _ProfileEditState extends State<ProfileEdit> {
|
|||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -61,9 +61,13 @@ class _CargoEditorState extends State<CargoEditor> {
|
|||||||
leading: new IconButton(
|
leading: new IconButton(
|
||||||
icon: new Icon(CupertinoIcons.back),
|
icon: new Icon(CupertinoIcons.back),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
if (isDataChanged()) {
|
||||||
|
showConfirmDialog(context, "back.button_confirm", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
@@ -144,4 +148,14 @@ class _CargoEditorState extends State<CargoEditor> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDataChanged() {
|
||||||
|
if (_isNew) {
|
||||||
|
return _descController.text != "" || _rateController.text != "";
|
||||||
|
} else {
|
||||||
|
CargoType _cargo = CargoType(
|
||||||
|
name: _descController.text, rate: double.parse(_rateController.text));
|
||||||
|
return widget.cargo.isChangedForEdit(_cargo);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class CustomEditor extends StatefulWidget {
|
|||||||
class _CustomEditorState extends State<CustomEditor> {
|
class _CustomEditorState extends State<CustomEditor> {
|
||||||
TextEditingController _productController = new TextEditingController();
|
TextEditingController _productController = new TextEditingController();
|
||||||
TextEditingController _feeController = new TextEditingController();
|
TextEditingController _feeController = new TextEditingController();
|
||||||
|
TextEditingController _shipmentRateController = new TextEditingController();
|
||||||
|
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
CustomDuty _custom = new CustomDuty();
|
CustomDuty _custom = new CustomDuty();
|
||||||
@@ -34,6 +35,9 @@ class _CustomEditorState extends State<CustomEditor> {
|
|||||||
_custom = widget.custom;
|
_custom = widget.custom;
|
||||||
_productController.text = _custom.productType;
|
_productController.text = _custom.productType;
|
||||||
_feeController.text = _custom.fee.toStringAsFixed(2);
|
_feeController.text = _custom.fee.toStringAsFixed(2);
|
||||||
|
_shipmentRateController.text = _custom.shipmentRate == null
|
||||||
|
? ""
|
||||||
|
: _custom.shipmentRate.toStringAsFixed(2);
|
||||||
} else {
|
} else {
|
||||||
_isNew = true;
|
_isNew = true;
|
||||||
}
|
}
|
||||||
@@ -54,6 +58,11 @@ class _CustomEditorState extends State<CustomEditor> {
|
|||||||
labelTextKey: 'rate.custom.fee',
|
labelTextKey: 'rate.custom.fee',
|
||||||
iconData: Icons.attach_money,
|
iconData: Icons.attach_money,
|
||||||
controller: _feeController);
|
controller: _feeController);
|
||||||
|
|
||||||
|
final shipmentRateBox = InputText(
|
||||||
|
labelTextKey: 'rate.custom.shipment_rate',
|
||||||
|
iconData: Icons.attach_money,
|
||||||
|
controller: _shipmentRateController);
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
@@ -64,9 +73,13 @@ class _CustomEditorState extends State<CustomEditor> {
|
|||||||
CupertinoIcons.back,
|
CupertinoIcons.back,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
if (isDataChanged()) {
|
||||||
|
showConfirmDialog(context, "back.button_confirm", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
@@ -88,6 +101,7 @@ class _CustomEditorState extends State<CustomEditor> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
productBox,
|
productBox,
|
||||||
feeBox,
|
feeBox,
|
||||||
|
shipmentRateBox,
|
||||||
SizedBox(height: 30),
|
SizedBox(height: 30),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -111,7 +125,8 @@ class _CustomEditorState extends State<CustomEditor> {
|
|||||||
Provider.of<ShipmentRateModel>(context, listen: false);
|
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||||
CustomDuty _customduty = CustomDuty(
|
CustomDuty _customduty = CustomDuty(
|
||||||
productType: _productController.text,
|
productType: _productController.text,
|
||||||
fee: double.parse(_feeController.text));
|
fee: double.parse(_feeController.text),
|
||||||
|
shipmentRate: double.parse(_shipmentRateController.text));
|
||||||
print('_customduty => $_customduty');
|
print('_customduty => $_customduty');
|
||||||
if (_isNew) {
|
if (_isNew) {
|
||||||
await shipmentRateModel.addCustomDuty(_customduty);
|
await shipmentRateModel.addCustomDuty(_customduty);
|
||||||
@@ -151,4 +166,19 @@ class _CustomEditorState extends State<CustomEditor> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDataChanged() {
|
||||||
|
if (_isNew) {
|
||||||
|
return _productController.text != "" ||
|
||||||
|
_feeController.text != "" ||
|
||||||
|
_shipmentRateController.text != "";
|
||||||
|
} else {
|
||||||
|
CustomDuty _customduty = CustomDuty(
|
||||||
|
productType: _productController.text,
|
||||||
|
fee: double.parse(_feeController.text),
|
||||||
|
// shipmentRate: double.parse(_shipmentRateController.text)
|
||||||
|
);
|
||||||
|
return widget.custom.isChangedForEdit(_customduty);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,9 +63,13 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
|||||||
leading: new IconButton(
|
leading: new IconButton(
|
||||||
icon: new Icon(CupertinoIcons.back),
|
icon: new Icon(CupertinoIcons.back),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
if (isDataChanged()) {
|
||||||
|
showConfirmDialog(context, "back.button_confirm", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
@@ -149,4 +153,15 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDataChanged() {
|
||||||
|
if (_isNew) {
|
||||||
|
return _weightController.text != "" || _discountController.text != "";
|
||||||
|
} else {
|
||||||
|
DiscountByWeight _discount = DiscountByWeight(
|
||||||
|
weight: double.parse(_weightController.text),
|
||||||
|
discount: double.parse(_discountController.text));
|
||||||
|
return widget.discountByWeight.isChangedForEdit(_discount);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,13 +29,14 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
|||||||
TextEditingController _minWeight = new TextEditingController();
|
TextEditingController _minWeight = new TextEditingController();
|
||||||
TextEditingController _deliveryFee = new TextEditingController();
|
TextEditingController _deliveryFee = new TextEditingController();
|
||||||
TextEditingController _volumetricRatio = new TextEditingController();
|
TextEditingController _volumetricRatio = new TextEditingController();
|
||||||
|
Rate rate;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
var shipmentRateModel =
|
var shipmentRateModel =
|
||||||
Provider.of<ShipmentRateModel>(context, listen: false);
|
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||||
Rate rate = shipmentRateModel.rate;
|
rate = shipmentRateModel.rate;
|
||||||
|
|
||||||
_minWeight.text = rate.freeDeliveryWeight?.toStringAsFixed(2) ?? "";
|
_minWeight.text = rate.freeDeliveryWeight?.toStringAsFixed(2) ?? "";
|
||||||
_deliveryFee.text = rate.deliveryFee?.toStringAsFixed(2) ?? "";
|
_deliveryFee.text = rate.deliveryFee?.toStringAsFixed(2) ?? "";
|
||||||
@@ -74,9 +75,13 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
|||||||
CupertinoIcons.back,
|
CupertinoIcons.back,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
if (isDataChanged()) {
|
||||||
|
showConfirmDialog(context, "back.button_confirm", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
@@ -130,6 +135,14 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDataChanged() {
|
||||||
|
Rate _rate = new Rate(
|
||||||
|
deliveryFee: double.parse(_deliveryFee.text),
|
||||||
|
freeDeliveryWeight: double.parse(_minWeight.text),
|
||||||
|
volumetricRatio: double.parse(_volumetricRatio.text));
|
||||||
|
return rate.isChangedForEdit(_rate);
|
||||||
|
}
|
||||||
|
|
||||||
List<MyDataRow> getCargoRows(List<CargoType> cargos) {
|
List<MyDataRow> getCargoRows(List<CargoType> cargos) {
|
||||||
return cargos.map((r) {
|
return cargos.map((r) {
|
||||||
return MyDataRow(
|
return MyDataRow(
|
||||||
|
|||||||
@@ -150,9 +150,13 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
|||||||
icon:
|
icon:
|
||||||
new Icon(CupertinoIcons.back, color: primaryColor, size: 30),
|
new Icon(CupertinoIcons.back, color: primaryColor, size: 30),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
if (isDataChanged()) {
|
||||||
|
showConfirmDialog(context, "back.button_confirm", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
shadowColor: Colors.transparent,
|
shadowColor: Colors.transparent,
|
||||||
@@ -253,4 +257,22 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDataChanged() {
|
||||||
|
if (_isNew) {
|
||||||
|
return _trackingIDCtl.text != "" ||
|
||||||
|
_remarkCtl.text != "" ||
|
||||||
|
user != null ||
|
||||||
|
_multiImgController.getAddedFile.isNotEmpty;
|
||||||
|
} else {
|
||||||
|
var _package = Package(
|
||||||
|
trackingID: _trackingIDCtl.text,
|
||||||
|
remark: _remarkCtl.text,
|
||||||
|
fcsID: user.fcsID,
|
||||||
|
photoUrls: widget.package.photoUrls);
|
||||||
|
return widget.package.isChangedForEdit(_package) ||
|
||||||
|
_multiImgController.getAddedFile.isNotEmpty ||
|
||||||
|
_multiImgController.getDeletedUrl.isNotEmpty;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,9 +166,13 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
|||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
if (isDataChanged()) {
|
||||||
|
showConfirmDialog(context, "back.button_confirm", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
shadowColor: Colors.transparent,
|
shadowColor: Colors.transparent,
|
||||||
@@ -316,4 +320,8 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
|||||||
MainModel mainModel = Provider.of<MainModel>(context, listen: false);
|
MainModel mainModel = Provider.of<MainModel>(context, listen: false);
|
||||||
launch("${mainModel.setting.courierWebsite}");
|
launch("${mainModel.setting.courierWebsite}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDataChanged() {
|
||||||
|
return _shipment.boxes.isNotEmpty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,9 +174,7 @@ class _StaffEditorState extends State<StaffEditor> {
|
|||||||
icon: new Icon(CupertinoIcons.back,
|
icon: new Icon(CupertinoIcons.back,
|
||||||
color: primaryColor, size: 30),
|
color: primaryColor, size: 30),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
|
||||||
});
|
|
||||||
}),
|
}),
|
||||||
shadowColor: Colors.transparent,
|
shadowColor: Colors.transparent,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
|
|||||||
@@ -77,9 +77,7 @@ class _TermEditState extends State<TermEdit> {
|
|||||||
size: 30,
|
size: 30,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showConfirmDialog(context, "back.button_confirm", () {
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
shadowColor: Colors.transparent,
|
shadowColor: Colors.transparent,
|
||||||
|
|||||||
Reference in New Issue
Block a user