update rate
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import 'package:fcs/model/pickup_model.dart';
|
||||
import 'package:fcs/model/shipment_rate_model.dart';
|
||||
import 'package:fcs/pages_fcs/cargo_editor.dart';
|
||||
import 'package:fcs/vo/custom.dart';
|
||||
import 'package:fcs/vo/discount.dart';
|
||||
import 'package:fcs/vo/pickup.dart';
|
||||
import 'package:fcs/vo/rate.dart';
|
||||
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||
import 'package:fcs/widget/local_text.dart';
|
||||
import 'package:fcs/widget/my_data_table.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -14,6 +14,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:fcs/widget/progress.dart';
|
||||
|
||||
import '../theme/theme.dart';
|
||||
import 'custom_editor.dart';
|
||||
import 'discount_by_weight_editor.dart';
|
||||
import 'util.dart';
|
||||
|
||||
class ShipmentRatesEdit extends StatefulWidget {
|
||||
@@ -150,6 +152,133 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
)
|
||||
],
|
||||
),
|
||||
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.customs),
|
||||
),
|
||||
),
|
||||
),
|
||||
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,
|
||||
BottomUpPageRoute(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.discountsByWeight),
|
||||
),
|
||||
),
|
||||
),
|
||||
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,
|
||||
BottomUpPageRoute(DiscountByWeightEditor()),
|
||||
);
|
||||
},
|
||||
label: Text(
|
||||
'Add Discount',
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -192,6 +321,64 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
}).toList();
|
||||
}
|
||||
|
||||
List<MyDataRow> getCustomsRows(List<Custom> customs) {
|
||||
return customs.map((c) {
|
||||
return MyDataRow(
|
||||
onSelectChanged: (selected) {
|
||||
Navigator.push(
|
||||
context,
|
||||
BottomUpPageRoute(CustomEditor(custom: c)),
|
||||
);
|
||||
},
|
||||
cells: [
|
||||
MyDataCell(
|
||||
new Text(
|
||||
c.productType,
|
||||
style: textStyle,
|
||||
),
|
||||
),
|
||||
MyDataCell(
|
||||
new Text(
|
||||
c.fee.toString(),
|
||||
style: textStyle,
|
||||
),
|
||||
),
|
||||
MyDataCell(IconButton(icon: Icon(Icons.delete), onPressed: null)),
|
||||
],
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
List<MyDataRow> getDiscounts(List<Discount> discounts) {
|
||||
return discounts.map((d) {
|
||||
return MyDataRow(
|
||||
onSelectChanged: (selected) {
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// BottomUpPageRoute(CargoEditor(rate: r)),
|
||||
// );
|
||||
},
|
||||
cells: [
|
||||
MyDataCell(
|
||||
new Text(
|
||||
"${d.weight} lb",
|
||||
style: textStyle,
|
||||
),
|
||||
),
|
||||
MyDataCell(
|
||||
Center(
|
||||
child: new Text(
|
||||
d.discountRate.toString(),
|
||||
style: textStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
MyDataCell(IconButton(icon: Icon(Icons.delete), onPressed: null)),
|
||||
],
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
_row(String desc, String price, String unit) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 25, top: 5, bottom: 5),
|
||||
|
||||
Reference in New Issue
Block a user