update rate

This commit is contained in:
Thinzar Win
2020-06-29 16:15:25 +06:30
parent 02450c003e
commit 8e65a533db
25 changed files with 746 additions and 136 deletions

View File

@@ -570,8 +570,9 @@
"customer.list.title":"CUSTOMERS",
"customer.form.title":"CUSTOMER",
"customer.invite":"Invite",
"contact": "CONTACTS",
"contact": "CONTACT US",
"fcs.btn": "FCS Profile",
"fcs.profile": "FCS PROFILE",
@@ -593,6 +594,8 @@
"discount.btn":"Discounts",
"discount.title":"Discounts",
"discount.new":"Discount"
"discount.new":"DISCOUNT",
"custom.form.title":"CUSTOM"
}

View File

@@ -574,6 +574,7 @@
"customers.btn": "ဝယ်ယူသူများ",
"customers.title": "ဝယ်ယူသူများ",
"customer.invite":"Invite",
"invoices.btn": "ငွေတောင်းခံလွှာများ",
"invoices.title": "ငွေတောင်းခံလွှာများ",
@@ -610,5 +611,7 @@
"discount.btn":"Discounts",
"discount.title":"Discounts",
"discount.new":"Discount"
"discount.new":"Discount",
"custom.form.title":"အကောက်ခွန်"
}

View File

@@ -14,9 +14,10 @@ class CustomerModel extends BaseModel {
User(
name: 'Ko Nyi',
phoneNumber: '+95 9 717273634',
status: 'Invited'
),
User(name: 'Ko Phyu', phoneNumber: '+1 (939) 382-3844'),
User(name: 'Ko Ye', phoneNumber: '+95 9 983734783', status: "Delivered"),
User(name: 'Ko Phyu', phoneNumber: '+1 (939) 382-3844',status: 'Signin'),
User(name: 'Ko Ye', phoneNumber: '+95 9 983734783', status: 'Invited'),
];
void initUser(user) async {

View File

@@ -1,6 +1,8 @@
import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:fcs/vo/custom.dart';
import 'package:fcs/vo/discount.dart';
import 'package:fcs/vo/rate.dart';
import 'package:logging/logging.dart';
@@ -22,7 +24,17 @@ class ShipmentRateModel extends BaseModel {
price: 8),
];
int freeDeliveryWeight=10;
List<Custom> customs = [
Custom(productType: 'Phone', fee: 40),
Custom(productType: 'Max Book', fee: 40)
];
List<Discount> discountsByWeight = [
Discount(weight: 10, discountRate: 3),
Discount(weight: 20, discountRate: 5)
];
int freeDeliveryWeight = 10;
void initUser(user) {
super.initUser(user);

View File

@@ -40,6 +40,7 @@ class BoxModel extends BaseModel {
width: 10,
height: 10,
length: 10,
shipmentWeight: 6,
packages: packages,
statusHistory: statusHistory,
shippingAddress: ShippingAddress(
@@ -68,6 +69,7 @@ class BoxModel extends BaseModel {
width: 10,
height: 20,
length: 30,
shipmentWeight: 36,
statusHistory: statusHistory,
packages: packages,
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
@@ -97,6 +99,7 @@ class BoxModel extends BaseModel {
width: 10,
height: 10,
length: 10,
shipmentWeight: 6,
statusHistory: statusHistory,
packages: packages,
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
@@ -126,6 +129,7 @@ class BoxModel extends BaseModel {
width: 10,
height: 10,
length: 10,
shipmentWeight: 6,
statusHistory: statusHistory,
packages: packages,
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',
@@ -155,6 +159,7 @@ class BoxModel extends BaseModel {
width: 10,
height: 10,
length: 10,
shipmentWeight: 6,
statusHistory: statusHistory,
packages: packages,
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',
@@ -184,6 +189,7 @@ class BoxModel extends BaseModel {
width: 10,
height: 10,
length: 10,
shipmentWeight: 6,
statusHistory: statusHistory,
packages: packages,
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',
@@ -213,6 +219,7 @@ class BoxModel extends BaseModel {
width: 10,
height: 10,
length: 10,
shipmentWeight: 6,
statusHistory: statusHistory,
packages: packages,
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',
@@ -242,6 +249,7 @@ class BoxModel extends BaseModel {
width: 10,
height: 10,
length: 10,
shipmentWeight: 6,
statusHistory: statusHistory,
packages: packages,
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',

View File

@@ -167,16 +167,16 @@ class _BuyingOnlinePagetate extends State<BuyingOnlinePage>
controller: _tabController,
tabs: [
new Tab(
text: 'FULL NAME',
text: 'With FULL NAME',
),
new Tab(
text: 'FIRST NAME&\nLAST NAME',
text: 'With FIRST NAME&\nLAST NAME',
),
],
),
),
new Container(
padding: EdgeInsets.only(top:10),
padding: EdgeInsets.only(top: 10),
height: 500,
width: 500,
child: new TabBarView(

View File

@@ -0,0 +1,80 @@
import 'package:fcs/pages/util.dart';
import 'package:fcs/vo/custom.dart';
import 'package:fcs/widget/localization/app_translations.dart';
import 'package:flutter/material.dart';
import 'package:fcs/widget/progress.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../theme/theme.dart';
class CustomEditor extends StatefulWidget {
final Custom custom;
CustomEditor({this.custom});
@override
_CustomEditorState createState() => _CustomEditorState();
}
class _CustomEditorState extends State<CustomEditor> {
TextEditingController _productController = new TextEditingController();
TextEditingController _feeController = new TextEditingController();
bool _isLoading = false;
Custom _custom = new Custom();
@override
void initState() {
super.initState();
if (widget.custom != null) {
_custom = widget.custom;
_productController.text = _custom.productType;
_feeController.text = _custom.fee.toString();
}
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
appBar: AppBar(
centerTitle: true,
leading: new IconButton(
icon: new Icon(
Icons.close,
),
onPressed: () => Navigator.of(context).pop(),
),
backgroundColor: primaryColor,
title: Text(AppTranslations.of(context).text("custom.form.title")),
),
body: Container(
padding: EdgeInsets.all(18),
child: Column(
children: <Widget>[
Expanded(
child: ListView(
children: <Widget>[
fcsInput("Procut Type", FontAwesomeIcons.weightHanging,
controller: _productController),
fcsInput("Fee", Icons.attach_money,
controller: _feeController),
SizedBox(height: 30),
],
),
),
widget.custom == null
? fcsButton(context, "Create", callack: () {})
: fcsButton(context, "Save", callack: () {}),
SizedBox(height: 10)
],
),
),
),
);
}
}

View File

@@ -25,6 +25,7 @@ class _CustomerEditorState extends State<CustomerEditor> {
TextEditingController _name = new TextEditingController();
TextEditingController _phone = new TextEditingController();
TextEditingController _phoneInput = new TextEditingController();
TextEditingController _status = new TextEditingController();
final _formKey = GlobalKey<FormState>();
bool _isLoading = false;
@@ -41,6 +42,7 @@ class _CustomerEditorState extends State<CustomerEditor> {
if (widget.customer != null) {
_name.text = widget.customer.name;
_phone.text = widget.customer.phone;
_status.text = widget.customer.status;
// privileges.forEach((p) => widget.employee.privilegeIds.contains(p.id)
// ? p.isChecked = true
// : p.isChecked = false);
@@ -174,6 +176,21 @@ class _CustomerEditorState extends State<CustomerEditor> {
],
);
final statusbox = TextFormField(
controller: _status,
autofocus: false,
readOnly: true,
cursorColor: primaryColor,
decoration: new InputDecoration(
border: InputBorder.none,
focusedBorder: InputBorder.none,
icon: Icon(
Icons.av_timer,
color: primaryColor,
),
),
);
final updateButton = Container(
padding: EdgeInsets.only(top: 40),
child: Container(
@@ -265,7 +282,8 @@ class _CustomerEditorState extends State<CustomerEditor> {
: phoneNumberBox,
widget.customer == null
? this.isSend ? namebox : Container()
: namebox,
: namebox,
statusbox,
// widget.customer == null ? addButton : updateButton,
SizedBox(
height: 20,
@@ -305,7 +323,8 @@ class _CustomerEditorState extends State<CustomerEditor> {
if (widget.customer == null) return;
var employeeModel = Provider.of<EmployeeModel>(context);
try {
await employeeModel.updatePrivileges(widget.customer.docID, privilegesIDs());
await employeeModel.updatePrivileges(
widget.customer.docID, privilegesIDs());
Navigator.pop(context);
} catch (e) {
showMsgDialog(context, "Error", e.toString());

View File

@@ -1,6 +1,7 @@
import 'package:fcs/model/customer_model.dart';
import 'package:fcs/pages/search_page.dart';
import 'package:fcs/widget/bottom_up_page_route.dart';
import 'package:fcs/widget/localization/app_translations.dart';
import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:intl/intl.dart';
@@ -13,6 +14,8 @@ import '../theme/theme.dart';
import '../vo/user.dart';
import '../widget/local_text.dart';
import 'customer_editor.dart';
import 'invitation_page.dart';
import 'util.dart';
class CustomerList extends StatefulWidget {
@override
@@ -55,6 +58,14 @@ class _CustomerListState extends State<CustomerList> {
fontSize: 20,
),
),
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
Navigator.of(context).push(BottomUpPageRoute(InvitationPage()));
},
icon: Icon(Icons.add),
label: Text(AppTranslations.of(context).text("customer.invite")),
backgroundColor: primaryColor,
),
body: new ListView.separated(
separatorBuilder: (context, index) => Divider(
color: Colors.black,
@@ -116,6 +127,10 @@ class _CustomerListState extends State<CustomerList> {
),
),
),
Padding(
padding: const EdgeInsets.only(right: 10),
child: getStatus(user.status),
),
],
),
),

View File

@@ -0,0 +1,81 @@
import 'package:fcs/pages/util.dart';
import 'package:fcs/vo/custom.dart';
import 'package:fcs/vo/discount.dart';
import 'package:fcs/widget/localization/app_translations.dart';
import 'package:flutter/material.dart';
import 'package:fcs/widget/progress.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../theme/theme.dart';
class DiscountByWeightEditor extends StatefulWidget {
final Discount discount;
DiscountByWeightEditor({this.discount});
@override
_DiscountByWeightEditorState createState() => _DiscountByWeightEditorState();
}
class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
TextEditingController _weightController = new TextEditingController();
TextEditingController _rateController = new TextEditingController();
bool _isLoading = false;
Discount _discount = new Discount();
@override
void initState() {
super.initState();
if (widget.discount != null) {
_discount = widget.discount;
_weightController.text = _discount.weight.toString();
_rateController.text = _discount.discountRate.toString();
}
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
appBar: AppBar(
centerTitle: true,
leading: new IconButton(
icon: new Icon(
Icons.close,
),
onPressed: () => Navigator.of(context).pop(),
),
backgroundColor: primaryColor,
title: Text(AppTranslations.of(context).text("discount.new")),
),
body: Container(
padding: EdgeInsets.all(18),
child: Column(
children: <Widget>[
Expanded(
child: ListView(
children: <Widget>[
fcsInput("Weight", FontAwesomeIcons.weightHanging,
controller: _weightController),
fcsInput("Discount Rate", Icons.attach_money,
controller: _rateController),
SizedBox(height: 30),
],
),
),
widget.discount == null
? fcsButton(context, "Create", callack: () {})
: fcsButton(context, "Save", callack: () {}),
SizedBox(height: 10)
],
),
),
),
);
}
}

View File

@@ -211,7 +211,7 @@ class _HomePageState extends State<HomePage> {
customer || owner ? widgets.add(invoicesBtn) : "";
customer || owner ? widgets.add(paymentMethodBtn) : "";
customer || owner ? widgets.add(discountBtn) : "";
widgets.add(termBtn);
// widgets.add(termBtn);
return OfflineRedirect(
child: FlavorBanner(
@@ -338,8 +338,22 @@ class _HomePageState extends State<HomePage> {
children: <Widget>[
// _buildSmallButton(
// "Policies", FontAwesomeIcons.fileContract),
_buildSmallButton(
"Contact Us", SimpleLineIcons.support),
InkWell(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => Contact()));
},
child: _buildSmallButton(
"Contact Us", SimpleLineIcons.support),
),
InkWell(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => Term()));
},
child: _buildSmallButton(
"Terms of services", Icons.info_outline),
),
],
)
],
@@ -470,34 +484,28 @@ class _HomePageState extends State<HomePage> {
}
Widget _buildSmallButton(String text, IconData iconData) {
return InkWell(
onTap: () => {
Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => Contact())),
},
child: Padding(
padding: const EdgeInsets.all(18.0),
child: Row(
children: <Widget>[
IconButton(
icon: Icon(iconData, color: Colors.white70),
color: Colors.white70,
onPressed: null),
// RaisedButton(onPressed: ()=>{},child: Row(
// children: <Widget>[
// IconButton(
// icon: Icon(iconData, ),
// onPressed: null),
// Text(text),
// ],
// ),color: Colors.transparent,
// focusColor: Colors.transparent,),
Text(
text,
style: subMenuStyle,
)
],
),
return Padding(
padding: const EdgeInsets.all(18.0),
child: Row(
children: <Widget>[
IconButton(
icon: Icon(iconData, color: Colors.white70),
color: Colors.white70,
onPressed: null),
// RaisedButton(onPressed: ()=>{},child: Row(
// children: <Widget>[
// IconButton(
// icon: Icon(iconData, ),
// onPressed: null),
// Text(text),
// ],
// ),color: Colors.transparent,
// focusColor: Colors.transparent,),
Text(
text,
style: subMenuStyle,
)
],
),
);
}

View File

@@ -21,6 +21,7 @@ import '../theme/theme.dart';
import 'profile_page.dart';
import 'signin_page.dart';
import 'term.dart';
final msgLog = Logger('backgroundMessageHandler');
@@ -201,8 +202,22 @@ class _HomePageWelcomeState extends State<HomePageWelcome> {
children: <Widget>[
// _buildSmallButton(
// "Policies", FontAwesomeIcons.fileContract),
_buildSmallButton(
"Contact Us", SimpleLineIcons.support),
InkWell(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => Contact()));
},
child: _buildSmallButton(
"Contact Us", SimpleLineIcons.support),
),
InkWell(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => Term()));
},
child: _buildSmallButton(
"Terms of services", Icons.info_outline),
),
],
)
],
@@ -223,34 +238,28 @@ class _HomePageWelcomeState extends State<HomePageWelcome> {
}
Widget _buildSmallButton(String text, IconData iconData) {
return InkWell(
onTap: () => {
Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => Contact())),
},
child: Padding(
padding: const EdgeInsets.all(18.0),
child: Row(
children: <Widget>[
IconButton(
icon: Icon(iconData, color: Colors.white70),
color: Colors.white70,
onPressed: null),
// RaisedButton(onPressed: ()=>{},child: Row(
// children: <Widget>[
// IconButton(
// icon: Icon(iconData, ),
// onPressed: null),
// Text(text),
// ],
// ),color: Colors.transparent,
// focusColor: Colors.transparent,),
Text(
text,
style: subMenuStyle,
)
],
),
return Padding(
padding: const EdgeInsets.all(18.0),
child: Row(
children: <Widget>[
IconButton(
icon: Icon(iconData, color: Colors.white70),
color: Colors.white70,
onPressed: null),
// RaisedButton(onPressed: ()=>{},child: Row(
// children: <Widget>[
// IconButton(
// icon: Icon(iconData, ),
// onPressed: null),
// Text(text),
// ],
// ),color: Colors.transparent,
// focusColor: Colors.transparent,),
Text(
text,
style: subMenuStyle,
)
],
),
);
}

View File

@@ -0,0 +1,67 @@
import 'package:fcs/pages/util.dart';
import 'package:fcs/widget/localization/app_translations.dart';
import 'package:flutter/material.dart';
import 'package:fcs/widget/progress.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../theme/theme.dart';
class InvitationPage extends StatefulWidget {
@override
_InvitationPageState createState() => _InvitationPageState();
}
class _InvitationPageState extends State<InvitationPage> {
TextEditingController _nameController = new TextEditingController();
TextEditingController _phoneController = new TextEditingController();
bool _isLoading = false;
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
appBar: AppBar(
centerTitle: true,
leading: new IconButton(
icon: new Icon(
Icons.close,
),
onPressed: () => Navigator.of(context).pop(),
),
backgroundColor: primaryColor,
title: Text(AppTranslations.of(context).text("customer.form.title")),
),
body: Container(
padding: EdgeInsets.all(18),
child: Column(
children: <Widget>[
Expanded(
child: ListView(
children: <Widget>[
fcsInput("Name", Icons.person, controller: _nameController),
fcsInput("Phone Number", Icons.phone,
controller: _phoneController),
SizedBox(height: 30),
],
),
),
fcsButton(context, "Invite", callack: () {}),
SizedBox(height: 10)
],
),
),
),
);
}
}

View File

@@ -85,9 +85,7 @@ class _NotificationListState extends State<NotificationList> {
children: <Widget>[
new Text(
msg.receiverName,
style: new TextStyle(
fontSize: 15.0,
color: primaryColor),
style: new TextStyle(fontSize: 15.0),
),
],
),
@@ -103,11 +101,14 @@ class _NotificationListState extends State<NotificationList> {
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(timeFormatter.format(msg.date)),
child: Text(
timeFormatter.format(msg.date),
style: TextStyle(color: Colors.grey),
),
),
msg.fromToday()
? Container()
: Text(dateFormatter.format(msg.date)),
: Text(dateFormatter.format(msg.date),style: TextStyle(color: Colors.grey),),
],
),
)

View File

@@ -42,6 +42,7 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
if (widget.box != null) {
_box = widget.box;
_shippingAddress = _box.shippingAddress;
isNew = false;
} else {
List<Package> packages = [
@@ -61,14 +62,14 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
isNew = true;
_box = Box(
rate: 0,
weight: 75,
width: 0,
height: 0,
length: 0,
packages: packages,
cargoTypes: _cargoTypes,
);
rate: 0,
weight: 75,
width: 0,
height: 0,
length: 0,
packages: packages,
cargoTypes: _cargoTypes,
shipmentWeight: 0);
}
}
@@ -111,7 +112,7 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
textAlign: TextAlign.end,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Total Weight',
labelText: 'Actual Weight',
filled: true,
icon: Icon(FontAwesomeIcons.weightHanging,
color: primaryColor),
@@ -169,6 +170,12 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
color: primaryColor, fontWeight: FontWeight.bold),
),
children: [
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: fcsInputReadOnly(
"Shipment Weight", FontAwesomeIcons.weightHanging,
value: _box.shipmentWeight.toString()),
),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(

View File

@@ -263,6 +263,25 @@ class _PickUpEditorState extends State<PickUpEditor> {
),
),
),
widget.pickUp == null
? Container()
: Padding(
padding: const EdgeInsets.only(left: 15.0),
child: fcsInputReadOnly(
"Handling Fee", FontAwesomeIcons.moneyBill,
controller: _handlingFeeController),
// child: widget.pickUp == null
// ? fcsInput(
// "Handling Fee", FontAwesomeIcons.moneyBill,
// controller: _handlingFeeController)
// : widget.pickUp.status == 'Pending'
// ? fcsInput(
// "Handling Fee", FontAwesomeIcons.moneyBill,
// controller: _handlingFeeController)
// : fcsInputReadOnly(
// "Handling Fee", FontAwesomeIcons.moneyBill,
// controller: _handlingFeeController),
),
ExpansionTile(
title: Text(
'Pickup Location / Time',
@@ -323,20 +342,6 @@ class _PickUpEditorState extends State<PickUpEditor> {
FontAwesomeIcons.weightHanging,
controller: _weightEditingController),
),
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: widget.pickUp == null
? fcsInput(
"Handling Fee", FontAwesomeIcons.moneyBill,
controller: _handlingFeeController)
: widget.pickUp.status == 'Pending'
? fcsInput(
"Handling Fee", FontAwesomeIcons.moneyBill,
controller: _handlingFeeController)
: fcsInputReadOnly(
"Handling Fee", FontAwesomeIcons.moneyBill,
controller: _handlingFeeController),
),
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: fcsInput("Remark", MaterialCommunityIcons.note),
@@ -671,7 +676,17 @@ class _PickUpEditorState extends State<PickUpEditor> {
child: new Text(
_box.value.weight == null
? ''
: "Total Weight:${_box.value.weight.toString()}lb",
: "Actual Weight:${_box.value.weight.toString()}lb",
style:
new TextStyle(fontSize: 14.0, color: Colors.grey),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
_box.value.shipmentWeight == null
? ''
: "Shipment Weight:${_box.value.shipmentWeight.toString()}lb",
style:
new TextStyle(fontSize: 14.0, color: Colors.grey),
),

View File

@@ -1,9 +1,10 @@
import 'package:fcs/model/pickup_model.dart';
import 'package:fcs/model/shipment_rate_model.dart';
import 'package:fcs/pages/shipment_rates_calculate.dart';
import 'package:fcs/pages/shipment_rates_edit.dart';
import 'package:fcs/pages/term.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:provider/provider.dart';
import 'package:fcs/widget/localization/app_translations.dart';
@@ -90,26 +91,72 @@ class _ShipmentRatesState extends State<ShipmentRates> {
child: ListView(
// crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 25, top: 10),
child: Text(
"Cargo Types",
style: TextStyle(
color: primaryColor,
fontWeight: FontWeight.bold,
fontSize: 15),
),
),
Container(
height: 135,
child: ListView.builder(
itemCount: shipmentRateModel.rates.length,
itemBuilder: (context, index) {
return _row(
shipmentRateModel.rates[index].description,
"\$ " +
shipmentRateModel.rates[index].price.toString(),
'per pound');
}),
child: Column(
children: getCargoWidget(shipmentRateModel.rates),
),
),
Divider(
color: Colors.grey,
),
Container(
padding: EdgeInsets.only(left: 25, top: 10),
child: Text(
"Custom Duties",
style: TextStyle(
color: primaryColor,
fontWeight: FontWeight.bold,
fontSize: 15),
),
),
Container(
height: 100,
child: Column(
children: getCustonWidget(shipmentRateModel.customs),
),
),
Divider(
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),
),
),
Container(
height: 100,
child: Column(
children:
getDiscountWidget(shipmentRateModel.discountsByWeight),
),
),
Divider(
color: Colors.grey,
),
_row("Free delivery within Yangon \nfor shipments over", "10",
"pounds"),
_row("Delivery fees", "\$ 5", "below 10 pounds"),
_row("Volumetric Ratio", "\$ 166.36", "per pound"),
fcsButton(context, "Terms & Conditions", callack: () {
Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => Term()));
}),
_row("Volumetric Ratio", "166.36", "in3 per pound"),
// fcsButton(context, "Terms & Conditions", callack: () {
// Navigator.of(context)
// .push(MaterialPageRoute(builder: (_) => Term()));
// }),
fcsButton(context, "Estimate shipping cost", callack: () {
Navigator.of(context)
.push(BottomUpPageRoute(ShipmentRatesCal()));
@@ -126,6 +173,32 @@ class _ShipmentRatesState extends State<ShipmentRates> {
);
}
List<Widget> getCargoWidget(List<Rate> rates) {
return rates.map((cargo) {
return Container(
child: _row(
cargo.description, "\$ " + cargo.price.toString(), 'per pound'),
);
}).toList();
}
List<Widget> getCustonWidget(List<Custom> customs) {
return customs.map((c) {
return Container(
child: _row(c.productType, "\$ " + c.fee.toString(), ''),
);
}).toList();
}
List<Widget> getDiscountWidget(List<Discount> discounts) {
return discounts.map((d) {
return Container(
child: _row(
"${d.weight.toString()} lb", "\$ " + d.discountRate.toString(), ''),
);
}).toList();
}
_row(String desc, String price, String unit) {
return Container(
padding: EdgeInsets.only(left: 25, top: 5, bottom: 5),

View File

@@ -101,6 +101,7 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
_row('Width (inches)', "", "", "10", input: true),
_row('Height', "", "", "10", input: true),
_row('Length', "", "", "10", input: true),
_row('Actual Weight', "", "", "0", input: true),
Container(
padding: EdgeInsets.only(left: 25, top: 15, bottom: 5),
child: Row(

View File

@@ -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),

View File

@@ -94,9 +94,7 @@ class _StaffListState extends State<StaffList> {
children: <Widget>[
new Text(
user.name,
style: new TextStyle(
fontSize: 15.0,
color: primaryColor),
style: new TextStyle(fontSize: 15.0),
),
Padding(
padding:

View File

@@ -274,12 +274,11 @@ Widget getStatus(String status) {
style: TextStyle(
color: Colors.green, fontSize: 18),
)
: status == "Used"
: status == "Used"
? Text(
status,
style: TextStyle(
color: Colors.red,
fontSize: 18),
color: Colors.red, fontSize: 18),
)
: status == "Paid"
? Row(
@@ -471,6 +470,7 @@ Widget fcsInputReadOnly(String label, IconData iconData,
cursorColor: primaryColor,
maxLines: null,
minLines: 1,
readOnly: true,
decoration: InputDecoration(
fillColor: Colors.white,
border: InputBorder.none,
@@ -479,7 +479,7 @@ Widget fcsInputReadOnly(String label, IconData iconData,
filled: true,
icon: Icon(
iconData,
color: Colors.grey,
color:primaryColor,
),
));
// return Row(

View File

@@ -82,14 +82,14 @@ class _BoxEditorState extends State<BoxEditor> {
isNew = true;
_box = Box(
rate: 0,
weight: 75,
width: 0,
height: 0,
length: 0,
packages: packages,
cargoTypes: _cargoTypes,
);
rate: 0,
weight: 75,
width: 0,
height: 0,
length: 0,
packages: packages,
cargoTypes: _cargoTypes,
shipmentWeight: 0);
}
}
@@ -283,7 +283,7 @@ class _BoxEditorState extends State<BoxEditor> {
textAlign: TextAlign.end,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Total Weight',
labelText: 'Actual Weight',
filled: true,
icon: Icon(FontAwesomeIcons.weightHanging,
color: primaryColor),
@@ -369,6 +369,12 @@ class _BoxEditorState extends State<BoxEditor> {
color: primaryColor, fontWeight: FontWeight.bold),
),
children: [
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: fcsInputReadOnly(
"Shipment Weight", FontAwesomeIcons.weightHanging,
value: _box.shipmentWeight.toString()),
),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(

View File

@@ -24,6 +24,7 @@ class Box {
int width;
int height;
int length;
int shipmentWeight;
int rate;
int weight;
@@ -60,6 +61,7 @@ class Box {
this.width,
this.height,
this.length,
this.shipmentWeight,
this.rate,
this.weight,
this.packageType,

6
lib/vo/custom.dart Normal file
View File

@@ -0,0 +1,6 @@
class Custom{
String id;
String productType;
int fee;
Custom({this.productType,this.fee});
}

View File

@@ -3,6 +3,14 @@ class Discount {
String customer;
String status;
double amount;
int weight;
int discountRate;
Discount({this.code, this.customer, this.amount, this.status});
Discount(
{this.code,
this.customer,
this.amount,
this.status,
this.weight,
this.discountRate});
}