update rate
This commit is contained in:
@@ -6,6 +6,9 @@ import 'package:fcs/pages/widgets/input_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'model/shipment_rate_model.dart';
|
||||
|
||||
class CargoEditor extends StatefulWidget {
|
||||
final CargoType cargo;
|
||||
@@ -21,6 +24,8 @@ class _CargoEditorState extends State<CargoEditor> {
|
||||
|
||||
bool _isLoading = false;
|
||||
CargoType _cargo;
|
||||
bool _isNew = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -28,6 +33,8 @@ class _CargoEditorState extends State<CargoEditor> {
|
||||
_cargo = widget.cargo;
|
||||
_descController.text = _cargo.name;
|
||||
_rateController.text = _cargo.rate.toString();
|
||||
} else {
|
||||
_isNew = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +64,12 @@ class _CargoEditorState extends State<CargoEditor> {
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: Text(AppTranslations.of(context).text("cargo.form.title")),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete),
|
||||
onPressed: _delete,
|
||||
)
|
||||
],
|
||||
),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(18),
|
||||
@@ -71,9 +84,8 @@ class _CargoEditorState extends State<CargoEditor> {
|
||||
],
|
||||
),
|
||||
),
|
||||
widget.cargo == null
|
||||
? fcsButton(context, "Create", callack: () {})
|
||||
: fcsButton(context, "Save", callack: () {}),
|
||||
fcsButton(context, getLocalString(context, "btn.save"),
|
||||
callack: _save),
|
||||
SizedBox(height: 10)
|
||||
],
|
||||
),
|
||||
@@ -81,4 +93,52 @@ class _CargoEditorState extends State<CargoEditor> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_save() async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
try {
|
||||
var shipmentRateModel =
|
||||
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||
CargoType _cargo = CargoType(
|
||||
name: _descController.text, rate: double.parse(_rateController.text));
|
||||
if (_isNew) {
|
||||
await shipmentRateModel.addCargoType(_cargo);
|
||||
} else {
|
||||
_cargo.id = widget.cargo.id;
|
||||
await shipmentRateModel.updateCargoType(_cargo);
|
||||
}
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_delete() {
|
||||
showConfirmDialog(
|
||||
context, "cargo_type.edit.delete.confirm", _deleteCargoType);
|
||||
}
|
||||
|
||||
_deleteCargoType() async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
try {
|
||||
var shipmentRateModel =
|
||||
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||
await shipmentRateModel.deleteCargoType(widget.cargo.id);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
124
lib/pages/rates/cargo_type_list.dart
Normal file
124
lib/pages/rates/cargo_type_list.dart
Normal file
@@ -0,0 +1,124 @@
|
||||
import 'package:fcs/domain/entities/cargo_type.dart';
|
||||
import 'package:fcs/domain/entities/custom_duty.dart';
|
||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/box/cargo_type_editor.dart';
|
||||
import 'package:fcs/pages/delivery_address/delivery_address_editor.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/rates/custom_editor.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'cargo_editor.dart';
|
||||
import 'custom_row.dart';
|
||||
import 'model/shipment_rate_model.dart';
|
||||
|
||||
class CargoTypeList extends StatefulWidget {
|
||||
const CargoTypeList({Key key}) : super(key: key);
|
||||
@override
|
||||
_CargoTypeListState createState() => _CargoTypeListState();
|
||||
}
|
||||
|
||||
class _CargoTypeListState extends State<CargoTypeList> {
|
||||
bool _isLoading = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var shipmentRateModel = Provider.of<ShipmentRateModel>(context);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(CupertinoIcons.back),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: LocalText(
|
||||
context,
|
||||
"cargo.form.title",
|
||||
fontSize: 20,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(builder: (context) => CargoEditor()));
|
||||
},
|
||||
icon: Icon(Icons.add, color: Colors.white),
|
||||
backgroundColor: primaryColor,
|
||||
label:
|
||||
LocalText(context, 'cargo.form.title', color: Colors.white)),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: ListView.separated(
|
||||
separatorBuilder: (c, i) => Divider(
|
||||
color: primaryColor,
|
||||
),
|
||||
itemCount: shipmentRateModel.rate.cargoTypes.length,
|
||||
itemBuilder: (context, index) {
|
||||
CargoType cargo = shipmentRateModel.rate.cargoTypes[index];
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(CupertinoPageRoute(
|
||||
builder: (context) => CargoEditor(
|
||||
cargo: cargo,
|
||||
)));
|
||||
},
|
||||
child: Container(
|
||||
child: _row(cargo.name, "\$ " + cargo.rate.toString(),
|
||||
'per pound'),
|
||||
),
|
||||
);
|
||||
}),
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
_row(String desc, String price, String unit) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 25, top: 5, bottom: 5),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text('$desc ', style: TextStyle(fontSize: 15)),
|
||||
Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 3.0),
|
||||
child: Text(
|
||||
'$price',
|
||||
style: TextStyle(color: primaryColor, fontSize: 14),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'$unit',
|
||||
style: TextStyle(color: Colors.grey, fontSize: 14),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 50,
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,9 @@ import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'model/shipment_rate_model.dart';
|
||||
|
||||
class CustomEditor extends StatefulWidget {
|
||||
final CustomDuty custom;
|
||||
@@ -22,6 +25,7 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
|
||||
bool _isLoading = false;
|
||||
CustomDuty _custom = new CustomDuty();
|
||||
bool _isNew = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -30,6 +34,8 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
_custom = widget.custom;
|
||||
_productController.text = _custom.productType;
|
||||
_feeController.text = _custom.fee.toString();
|
||||
} else {
|
||||
_isNew = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +68,12 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
backgroundColor: primaryColor,
|
||||
title:
|
||||
Text(AppTranslations.of(context).text("rate.custom.form.title")),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete),
|
||||
onPressed: _delete,
|
||||
)
|
||||
],
|
||||
),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(18),
|
||||
@@ -76,9 +88,8 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
],
|
||||
),
|
||||
),
|
||||
widget.custom == null
|
||||
? fcsButton(context, "Create", callack: () {})
|
||||
: fcsButton(context, "Save", callack: () {}),
|
||||
fcsButton(context, getLocalString(context, "btn.save"),
|
||||
callack: _save),
|
||||
SizedBox(height: 10)
|
||||
],
|
||||
),
|
||||
@@ -86,4 +97,53 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_save() async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
try {
|
||||
var shipmentRateModel =
|
||||
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||
CustomDuty _customduty = CustomDuty(
|
||||
productType: _productController.text,
|
||||
fee: double.parse(_feeController.text));
|
||||
if (_isNew) {
|
||||
await shipmentRateModel.addCustomDuty(_customduty);
|
||||
} else {
|
||||
_customduty.id = widget.custom.id;
|
||||
await shipmentRateModel.updateCustomDuty(_customduty);
|
||||
}
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_delete() {
|
||||
showConfirmDialog(
|
||||
context, "cargo.edit.delete.confirm", _deleteCustomDuty);
|
||||
}
|
||||
|
||||
_deleteCustomDuty() async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
try {
|
||||
var shipmentRateModel =
|
||||
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||
await shipmentRateModel.deleteCustomDuty(widget.custom.id);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,11 +49,20 @@ class _CustomListState extends State<CustomList> {
|
||||
backgroundColor: primaryColor,
|
||||
title: LocalText(
|
||||
context,
|
||||
"Customs",
|
||||
"rate.custom_duty.title",
|
||||
fontSize: 20,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(builder: (context) => CustomEditor()));
|
||||
},
|
||||
icon: Icon(Icons.add, color: Colors.white),
|
||||
backgroundColor: primaryColor,
|
||||
label:
|
||||
LocalText(context, 'rate.custom_duty', color: Colors.white)),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: ListView.separated(
|
||||
@@ -62,26 +71,46 @@ class _CustomListState extends State<CustomList> {
|
||||
),
|
||||
itemCount: shipmentRateModel.rate.customDuties.length,
|
||||
itemBuilder: (context, index) {
|
||||
return _row(
|
||||
context, shipmentRateModel.rate.customDuties[index]);
|
||||
CustomDuty custom =
|
||||
shipmentRateModel.rate.customDuties[index];
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(CupertinoPageRoute(
|
||||
builder: (context) => CustomEditor(custom: custom)));
|
||||
},
|
||||
child: Container(
|
||||
child: _row(
|
||||
custom.productType, "\$ " + custom.fee.toString()),
|
||||
),
|
||||
);
|
||||
}),
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
_row(BuildContext context, CustomDuty custom) {
|
||||
return InkWell(
|
||||
onTap: () => Navigator.pop<CustomDuty>(context, custom),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CustomRow(
|
||||
key: ValueKey(custom.id),
|
||||
custom: custom,
|
||||
_row(String desc, String price) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 25, top: 5, bottom: 5),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text('$desc ', style: TextStyle(fontSize: 15)),
|
||||
Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 3.0),
|
||||
child: Text(
|
||||
'$price',
|
||||
style: TextStyle(color: primaryColor, fontSize: 14),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
SizedBox(
|
||||
width: 50,
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
120
lib/pages/rates/discount_by weight_list.dart
Normal file
120
lib/pages/rates/discount_by weight_list.dart
Normal file
@@ -0,0 +1,120 @@
|
||||
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/vo/delivery_address.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/delivery_address/delivery_address_editor.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/rates/custom_editor.dart';
|
||||
import 'package:fcs/pages/rates/discount_by_weight_editor.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'custom_row.dart';
|
||||
import 'model/shipment_rate_model.dart';
|
||||
|
||||
class DiscountByWeightList extends StatefulWidget {
|
||||
const DiscountByWeightList({Key key}) : super(key: key);
|
||||
@override
|
||||
_DiscountByWeightListState createState() => _DiscountByWeightListState();
|
||||
}
|
||||
|
||||
class _DiscountByWeightListState extends State<DiscountByWeightList> {
|
||||
bool _isLoading = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var shipmentRateModel = Provider.of<ShipmentRateModel>(context);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(CupertinoIcons.back),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: LocalText(
|
||||
context,
|
||||
"rate.discount_by_weight",
|
||||
fontSize: 20,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(builder: (context) => DiscountByWeightEditor()));
|
||||
},
|
||||
icon: Icon(Icons.add, color: Colors.white),
|
||||
backgroundColor: primaryColor,
|
||||
label: LocalText(context, 'discount.new',
|
||||
color: Colors.white)),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: ListView.separated(
|
||||
separatorBuilder: (c, i) => Divider(
|
||||
color: primaryColor,
|
||||
),
|
||||
itemCount: shipmentRateModel.rate.discountByWeights.length,
|
||||
itemBuilder: (context, index) {
|
||||
DiscountByWeight discountByWeight =
|
||||
shipmentRateModel.rate.discountByWeights[index];
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(CupertinoPageRoute(
|
||||
builder: (context) => DiscountByWeightEditor(
|
||||
discount: discountByWeight)));
|
||||
},
|
||||
child: Container(
|
||||
child: _row("${discountByWeight.weight.toString()} lb",
|
||||
"\$ " + discountByWeight.discount.toString()),
|
||||
),
|
||||
);
|
||||
}),
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
_row(String desc, String price) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 25, top: 5, bottom: 5),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text('$desc ', style: TextStyle(fontSize: 15)),
|
||||
Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 3.0),
|
||||
child: Text(
|
||||
'$price',
|
||||
style: TextStyle(color: primaryColor, fontSize: 14),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 50,
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,18 @@
|
||||
import 'package:fcs/domain/entities/discount.dart';
|
||||
import 'package:fcs/domain/entities/discount_by_weight.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/app_translations.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/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class DiscountByWeightEditor extends StatefulWidget {
|
||||
final Discount discount;
|
||||
final DiscountByWeight discount;
|
||||
DiscountByWeightEditor({this.discount});
|
||||
|
||||
@override
|
||||
@@ -18,10 +21,11 @@ class DiscountByWeightEditor extends StatefulWidget {
|
||||
|
||||
class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
TextEditingController _weightController = new TextEditingController();
|
||||
TextEditingController _rateController = new TextEditingController();
|
||||
TextEditingController _discountController = new TextEditingController();
|
||||
|
||||
bool _isLoading = false;
|
||||
Discount _discount = new Discount();
|
||||
DiscountByWeight _discount = new DiscountByWeight();
|
||||
bool _isNew = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -29,7 +33,9 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
if (widget.discount != null) {
|
||||
_discount = widget.discount;
|
||||
_weightController.text = _discount.weight.toString();
|
||||
_rateController.text = _discount.discountRate.toString();
|
||||
_discountController.text = _discount.discount.toString();
|
||||
} else {
|
||||
_isNew = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +53,7 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
final discountRateBox = InputText(
|
||||
labelTextKey: 'rate.discount.rate',
|
||||
iconData: Icons.attach_money,
|
||||
controller: _rateController);
|
||||
controller: _discountController);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
@@ -60,6 +66,12 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: Text(AppTranslations.of(context).text("discount.new")),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete),
|
||||
onPressed: _delete,
|
||||
)
|
||||
],
|
||||
),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(18),
|
||||
@@ -74,9 +86,8 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
],
|
||||
),
|
||||
),
|
||||
widget.discount == null
|
||||
? fcsButton(context, "Create", callack: () {})
|
||||
: fcsButton(context, "Save", callack: () {}),
|
||||
fcsButton(context, getLocalString(context, "btn.save"),
|
||||
callack: _save),
|
||||
SizedBox(height: 10)
|
||||
],
|
||||
),
|
||||
@@ -84,4 +95,53 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_save() async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
try {
|
||||
var shipmentRateModel =
|
||||
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||
DiscountByWeight _discount = DiscountByWeight(
|
||||
weight: double.parse(_weightController.text),
|
||||
discount: double.parse(_discountController.text));
|
||||
if (_isNew) {
|
||||
await shipmentRateModel.addDiscountByWeight(_discount);
|
||||
} else {
|
||||
_discount.id = widget.discount.id;
|
||||
await shipmentRateModel.updateDiscountByWeight(_discount);
|
||||
}
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_delete() {
|
||||
showConfirmDialog(context, "rate.discount_by_weight.edit.delete.confirm",
|
||||
_deleteDiscountByWeight);
|
||||
}
|
||||
|
||||
_deleteDiscountByWeight() async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
try {
|
||||
var shipmentRateModel =
|
||||
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||
await shipmentRateModel.deleteDiscountByWeight(widget.discount.id);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:fcs/data/services/services.dart';
|
||||
import 'package:fcs/domain/entities/cargo_type.dart';
|
||||
import 'package:fcs/domain/entities/custom_duty.dart';
|
||||
import 'package:fcs/domain/entities/discount_by_weight.dart';
|
||||
import 'package:fcs/domain/entities/rate.dart';
|
||||
import 'package:fcs/pages/main/model/base_model.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
@@ -24,4 +27,53 @@ class ShipmentRateModel extends BaseModel {
|
||||
logout() async {
|
||||
if (listener != null) await listener.cancel();
|
||||
}
|
||||
|
||||
// Rate
|
||||
|
||||
Future<void> updateRate(Rate rate) {
|
||||
return Services.instance.rateService.updateRate(rate);
|
||||
}
|
||||
|
||||
//Cargo Type
|
||||
|
||||
Future<void> addCargoType(CargoType cargoType) {
|
||||
return Services.instance.rateService.createCargoType(cargoType);
|
||||
}
|
||||
|
||||
Future<void> updateCargoType(CargoType cargoType) {
|
||||
return Services.instance.rateService.updateCargoType(cargoType);
|
||||
}
|
||||
|
||||
Future<void> deleteCargoType(String id) {
|
||||
return Services.instance.rateService.deleteCargoType(id);
|
||||
}
|
||||
|
||||
//CustomDuty
|
||||
|
||||
Future<void> addCustomDuty(CustomDuty customDuty) {
|
||||
return Services.instance.rateService.createCustomDuty(customDuty);
|
||||
}
|
||||
|
||||
Future<void> updateCustomDuty(CustomDuty customDuty) {
|
||||
return Services.instance.rateService.updateCustomDuty(customDuty);
|
||||
}
|
||||
|
||||
Future<void> deleteCustomDuty(String id) {
|
||||
return Services.instance.rateService.deleteCargoType(id);
|
||||
}
|
||||
|
||||
//Discount by weight
|
||||
Future<void> addDiscountByWeight(DiscountByWeight discountByWeight) {
|
||||
return Services.instance.rateService
|
||||
.createDiscountByWeight(discountByWeight);
|
||||
}
|
||||
|
||||
Future<void> updateDiscountByWeight(DiscountByWeight discountByWeight) {
|
||||
return Services.instance.rateService
|
||||
.updateDiscountByWeight(discountByWeight);
|
||||
}
|
||||
|
||||
Future<void> deleteDiscountByWeight(String id) {
|
||||
return Services.instance.rateService.deleteDiscountByWeight(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import 'package:fcs/domain/entities/rate.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/rates/cargo_type_list.dart';
|
||||
import 'package:fcs/pages/rates/custom_list.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';
|
||||
@@ -14,6 +16,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../main/util.dart';
|
||||
import 'discount_by weight_list.dart';
|
||||
import 'shipment_rates_calculate.dart';
|
||||
import 'shipment_rates_edit.dart';
|
||||
|
||||
@@ -82,13 +85,24 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
||||
color: Colors.grey,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 25, top: 10),
|
||||
child: Text(
|
||||
"Cargo Types",
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15),
|
||||
padding: EdgeInsets.only(left: 25, top: 10, right: 25),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"Cargo Types",
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15),
|
||||
),
|
||||
Spacer(),
|
||||
IconButton(
|
||||
icon: Icon(Icons.edit, color: primaryColor),
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(CupertinoPageRoute(
|
||||
builder: (context) => CargoTypeList()));
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
@@ -98,13 +112,24 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
||||
color: Colors.grey,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 25, top: 10),
|
||||
child: Text(
|
||||
"Discounts by weight",
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15),
|
||||
padding: EdgeInsets.only(left: 25, top: 10, right: 25),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"Discounts by weight",
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15),
|
||||
),
|
||||
Spacer(),
|
||||
IconButton(
|
||||
icon: Icon(Icons.edit, color: primaryColor),
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(CupertinoPageRoute(
|
||||
builder: (context) => DiscountByWeightList()));
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
@@ -124,13 +149,24 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
||||
color: Colors.grey,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 25, top: 10),
|
||||
child: Text(
|
||||
"Custom Duties",
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15),
|
||||
padding: EdgeInsets.only(left: 25, top: 10, right: 25),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"Custom Duties",
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15),
|
||||
),
|
||||
Spacer(),
|
||||
IconButton(
|
||||
icon: Icon(Icons.edit, color: primaryColor),
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(CupertinoPageRoute(
|
||||
builder: (context) => CustomList()));
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
|
||||
@@ -34,6 +34,8 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
TextEditingController _deliveryFee = new TextEditingController();
|
||||
TextEditingController _volumetricRatio = new TextEditingController();
|
||||
|
||||
bool _isNew = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -89,208 +91,207 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
feeBox,
|
||||
ratioBox,
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
// 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,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
fcsButton(context, "Save", callack: () {
|
||||
Navigator.pop(context);
|
||||
}),
|
||||
fcsButton(context, getLocalString(context, "btn.save"),
|
||||
callack: _save),
|
||||
SizedBox(height: 10)
|
||||
],
|
||||
),
|
||||
@@ -299,6 +300,29 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
);
|
||||
}
|
||||
|
||||
_save() async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
try {
|
||||
var shipmentRateModel =
|
||||
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||
Rate _rate = Rate(
|
||||
deliveryFee: double.parse(_deliveryFee.text),
|
||||
freeDeliveryWeight: double.parse(_minWeight.text),
|
||||
volumetricRatio: double.parse(_volumetricRatio.text));
|
||||
|
||||
await shipmentRateModel.updateRate(_rate);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
List<MyDataRow> getCargoRows(List<CargoType> cargos) {
|
||||
return cargos.map((r) {
|
||||
return MyDataRow(
|
||||
|
||||
Reference in New Issue
Block a user