add rate service
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:fcs/domain/entities/custom.dart';
|
||||
import 'package:fcs/domain/entities/cargo_type.dart';
|
||||
import 'package:fcs/domain/entities/custom_duty.dart';
|
||||
import 'package:fcs/domain/entities/discount.dart';
|
||||
import 'package:fcs/domain/entities/discount_rate.dart';
|
||||
import 'package:fcs/domain/entities/discount_by_weight.dart';
|
||||
import 'package:fcs/domain/entities/rate.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/app_translations.dart';
|
||||
@@ -118,7 +119,8 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
fontSize: 15,
|
||||
color: Colors.grey[600]))),
|
||||
],
|
||||
rows: getCargoRows(shipmentRateModel.rates),
|
||||
rows: getCargoRows(
|
||||
shipmentRateModel.rate.cargoTypes),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -182,7 +184,8 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
fontSize: 15,
|
||||
color: Colors.grey[600]))),
|
||||
],
|
||||
rows: getCustomsRows(shipmentRateModel.customs),
|
||||
rows: getCustomsRows(
|
||||
shipmentRateModel.rate.customDuties),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -247,7 +250,7 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
color: Colors.grey[600]))),
|
||||
],
|
||||
rows: getDiscounts(
|
||||
shipmentRateModel.discountsByWeight),
|
||||
shipmentRateModel.rate.discountByWeights),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -296,25 +299,25 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
);
|
||||
}
|
||||
|
||||
List<MyDataRow> getCargoRows(List<Rate> rates) {
|
||||
return rates.map((r) {
|
||||
List<MyDataRow> getCargoRows(List<CargoType> cargos) {
|
||||
return cargos.map((r) {
|
||||
return MyDataRow(
|
||||
onSelectChanged: (selected) {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(builder: (context) => CargoEditor(rate: r)),
|
||||
CupertinoPageRoute(builder: (context) => CargoEditor(cargo: r)),
|
||||
);
|
||||
},
|
||||
cells: [
|
||||
MyDataCell(
|
||||
new Text(
|
||||
r.description,
|
||||
r.name,
|
||||
style: textStyle,
|
||||
),
|
||||
),
|
||||
MyDataCell(
|
||||
new Text(
|
||||
r.price.toString(),
|
||||
r.rate.toString(),
|
||||
style: textStyle,
|
||||
),
|
||||
),
|
||||
@@ -324,7 +327,7 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
}).toList();
|
||||
}
|
||||
|
||||
List<MyDataRow> getCustomsRows(List<Custom> customs) {
|
||||
List<MyDataRow> getCustomsRows(List<CustomDuty> customs) {
|
||||
return customs.map((c) {
|
||||
return MyDataRow(
|
||||
onSelectChanged: (selected) {
|
||||
@@ -352,7 +355,7 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
}).toList();
|
||||
}
|
||||
|
||||
List<MyDataRow> getDiscounts(List<DiscountRate> discounts) {
|
||||
List<MyDataRow> getDiscounts(List<DiscountByWeight> discounts) {
|
||||
return discounts.map((d) {
|
||||
return MyDataRow(
|
||||
onSelectChanged: (selected) {
|
||||
@@ -371,7 +374,7 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
MyDataCell(
|
||||
Center(
|
||||
child: new Text(
|
||||
d.discountRate.toString(),
|
||||
d.discount.toString(),
|
||||
style: textStyle,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user