update shipment rate
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:fcs/model_fcs/package_model.dart';
|
||||
import 'package:fcs/pages/invoice/package_addition.dart';
|
||||
import 'package:fcs/pages/util.dart';
|
||||
import 'package:fcs/vo/box.dart';
|
||||
import 'package:fcs/vo/cargo.dart';
|
||||
import 'package:fcs/vo/package.dart';
|
||||
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||
import 'package:fcs/widget/local_text.dart';
|
||||
@@ -45,6 +46,8 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
];
|
||||
bool isNew;
|
||||
|
||||
bool isMixBox = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -63,8 +66,22 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
PackageModel.packages[2]
|
||||
];
|
||||
|
||||
List<Cargo> _cargoTypes = [
|
||||
Cargo(type: 'General Cargo', weight: 25),
|
||||
Cargo(type: 'Medicine', weight: 20),
|
||||
Cargo(type: 'Dangerous Cargo', weight: 30)
|
||||
];
|
||||
|
||||
isNew = true;
|
||||
_box = Box(rate: 0, weight: 0, packages: packages);
|
||||
_box = Box(
|
||||
rate: 0,
|
||||
weight: 75,
|
||||
width: 0,
|
||||
height: 0,
|
||||
length: 0,
|
||||
packages: packages,
|
||||
cargoTypes: _cargoTypes,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,6 +183,33 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
onChanged: (map) => {},
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, right: 20),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Checkbox(
|
||||
value: isMixBox,
|
||||
activeColor: primaryColor,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
isMixBox = value;
|
||||
});
|
||||
}),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
"Mix Box",
|
||||
style: TextStyle(fontSize: 15.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
@@ -208,21 +252,21 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
color: primaryColor, fontWeight: FontWeight.bold),
|
||||
),
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: DropdownButtonFormField(
|
||||
value: _box.packageType,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Cargo Type',
|
||||
icon: Icon(Entypo.box, color: primaryColor)),
|
||||
items: ["General", "Medicine", "Dangerous"]
|
||||
.map((e) =>
|
||||
DropdownMenuItem(child: Text(e), value: e))
|
||||
.toList(),
|
||||
onChanged: (map) => {},
|
||||
),
|
||||
),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
// child: DropdownButtonFormField(
|
||||
// value: _box.packageType,
|
||||
// decoration: InputDecoration(
|
||||
// fillColor: Colors.white,
|
||||
// labelText: 'Cargo Type',
|
||||
// icon: Icon(Entypo.box, color: primaryColor)),
|
||||
// items: ["General", "Medicine", "Dangerous"]
|
||||
// .map((e) =>
|
||||
// DropdownMenuItem(child: Text(e), value: e))
|
||||
// .toList(),
|
||||
// onChanged: (map) => {},
|
||||
// ),
|
||||
// ),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
@@ -236,66 +280,60 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
color: primaryColor),
|
||||
)),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: _box.rate.toString(),
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Rate',
|
||||
filled: true,
|
||||
icon: Icon(FontAwesomeIcons.tag,
|
||||
color: primaryColor),
|
||||
)),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: _box.amount.toString(),
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Total Amount',
|
||||
filled: true,
|
||||
icon: Icon(FontAwesomeIcons.moneyBill,
|
||||
color: primaryColor),
|
||||
)),
|
||||
),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
// child: TextFormField(
|
||||
// initialValue: _box.rate.toString(),
|
||||
// textAlign: TextAlign.end,
|
||||
// decoration: InputDecoration(
|
||||
// fillColor: Colors.white,
|
||||
// labelText: 'Rate',
|
||||
// filled: true,
|
||||
// icon: Icon(FontAwesomeIcons.tag,
|
||||
// color: primaryColor),
|
||||
// )),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
// child: TextFormField(
|
||||
// initialValue: _box.amount.toString(),
|
||||
// textAlign: TextAlign.end,
|
||||
// decoration: InputDecoration(
|
||||
// fillColor: Colors.white,
|
||||
// labelText: 'Total Amount',
|
||||
// filled: true,
|
||||
// icon: Icon(FontAwesomeIcons.moneyBill,
|
||||
// color: primaryColor),
|
||||
// )),
|
||||
// ),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: MyDataTable(
|
||||
headingRowHeight: 40,
|
||||
columnSpacing: 20,
|
||||
columnSpacing: 120,
|
||||
columns: [
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"box.package.id",
|
||||
"cargo.type",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"box.package.desc",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"box.package.market",
|
||||
"cargo.weight",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
],
|
||||
rows: getPackageRow(context),
|
||||
rows: getCargoRows(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
mainModel.isOwner()
|
||||
? Container(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
@@ -303,12 +341,11 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
alignment: Alignment.bottomRight,
|
||||
child: FloatingActionButton.extended(
|
||||
icon: Icon(Icons.add),
|
||||
label: Text(AppTranslations.of(context)
|
||||
.text("box.add_package")),
|
||||
label: Text("Add Cargo"),
|
||||
backgroundColor: primaryColor,
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(
|
||||
BottomUpPageRoute(PackageAddition()));
|
||||
// Navigator.of(context).push(
|
||||
// BottomUpPageRoute(PackageAddition()));
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -317,6 +354,55 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
SizedBox(height: 25),
|
||||
],
|
||||
),
|
||||
ExpansionTile(
|
||||
title: Text(
|
||||
'Box Dimension',
|
||||
style: TextStyle(
|
||||
color: primaryColor, fontWeight: FontWeight.bold),
|
||||
),
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: _box.width.toString(),
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Width',
|
||||
filled: true,
|
||||
icon: Icon(FontAwesomeIcons.arrowCircleRight,
|
||||
color: primaryColor),
|
||||
)),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: _box.height.toString(),
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Height',
|
||||
filled: true,
|
||||
icon: Icon(FontAwesomeIcons.arrowAltCircleUp,
|
||||
color: primaryColor),
|
||||
)),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: _box.length.toString(),
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Length',
|
||||
filled: true,
|
||||
icon: Icon(FontAwesomeIcons.arrowCircleUp,
|
||||
color: primaryColor),
|
||||
)),
|
||||
),
|
||||
SizedBox(height: 25),
|
||||
],
|
||||
),
|
||||
isNew
|
||||
? Container()
|
||||
: ExpansionTile(
|
||||
@@ -382,23 +468,21 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
);
|
||||
}
|
||||
|
||||
List<MyDataRow> getPackageRow(BuildContext context) {
|
||||
if (_box == null || _box.packages == null) {
|
||||
List<MyDataRow> getCargoRows(BuildContext context) {
|
||||
if (_box == null || _box.cargoTypes == null) {
|
||||
return [];
|
||||
}
|
||||
return _box.packages.map((p) {
|
||||
return _box.cargoTypes.map((c) {
|
||||
return MyDataRow(
|
||||
onSelectChanged: (bool selected) {},
|
||||
cells: [
|
||||
MyDataCell(new Text(
|
||||
p.id == null ? "" : p.id,
|
||||
c.type == null ? "" : c.type,
|
||||
style: textStyle,
|
||||
)),
|
||||
MyDataCell(
|
||||
new Text(p.cargoDesc, style: textStyle),
|
||||
),
|
||||
MyDataCell(
|
||||
new Text("${p.market}", style: textStyle),
|
||||
new Text(c.weight == null ? "0" : c.weight.toString(),
|
||||
style: textStyle),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user