This commit is contained in:
Sai Naw Wun
2020-10-15 19:41:41 +06:30
32 changed files with 1461 additions and 634 deletions

View File

@@ -273,11 +273,16 @@
"box.mix.number":"Carton number", "box.mix.number":"Carton number",
"box.mix.desc":"Description", "box.mix.desc":"Description",
"box.info.title":"Carton", "box.info.title":"Carton",
"box.popupmenu.active":"Active Cartons",
"box.popupmenu.delivered":"Delivered Cartons",
"box.cargo.total":"Total Weight",
"Boxes End ================================================================":"", "Boxes End ================================================================":"",
"Delivery Start ================================================================":"", "Delivery Start ================================================================":"",
"delivery.title":"Deliveries", "delivery.title":"Deliveries",
"delivery":"Deliveries", "delivery":"Deliveries",
"delivery.popupmenu.active":"Active Cartons",
"delivery.popupmenu.delivered":"Delivered Cartons",
"Delivery End ================================================================":"", "Delivery End ================================================================":"",
"FCS Shipment Start ================================================================":"", "FCS Shipment Start ================================================================":"",
@@ -306,7 +311,7 @@
"Shipment Start ================================================================":"", "Shipment Start ================================================================":"",
"shipment": "Shipments", "shipment": "Shipments",
"shipment.title": "Shipments", "shipment.title": "Shipments",
"shipment.new": "Request shipment", "shipment.new": "New shipment",
"shipment.new.title": "New Shipment", "shipment.new.title": "New Shipment",
"shipment.edit.title": "Edit Shipment", "shipment.edit.title": "Edit Shipment",
"shipment.type": "Pickup/drop-off", "shipment.type": "Pickup/drop-off",
@@ -328,21 +333,33 @@
"shipment.box.width":"Width", "shipment.box.width":"Width",
"shipment.box.height":"Height", "shipment.box.height":"Height",
"shipment.box.add":"Add carton", "shipment.box.add":"Add carton",
"shipment.cargo.total":"Total Weight",
"shipment.popupmenu.active":"Active Shipments",
"shipment.popupmenu.delivered":"Delivered Shipments",
"shipment.create":"Create shipment",
"shipment.update":"Update shipment",
"Shipment End ================================================================":"", "Shipment End ================================================================":"",
"Rate Start ================================================================":"", "Rate Start ================================================================":"",
"rate":"Rates", "rate":"Rates",
"rate.title":"Rates", "rate.title":"Rates",
"rate.edit.title":"Edit rates", "rate.edit.title":"Edit rates",
"rate.cal.title":"Estimate Shipping Cost", "rate.cal.title":"Calculate Shipping Cost",
"rate.min_weight":"Min weight for free delivery within yangon", "rate.min_weight":"Min weight for free delivery within yangon",
"rate.delivery_fee":"Delivery fees", "rate.delivery_fee":"Delivery fees",
"rate.total_estimated_amount":"Total estimated amount",
"rate.volumetric_ratio":"Volumetric ratio", "rate.volumetric_ratio":"Volumetric ratio",
"rate.custom.form.title":"CUSTOM", "rate.custom.form.title":"CUSTOM",
"rate.cutom.product_type":"Product type", "rate.cutom.product_type":"Product type",
"rate.custom.fee":"Fee", "rate.custom.fee":"Fee",
"rate.discount.weight":"Weight", "rate.discount.weight":"Weight",
"rate.discount.rate":"Discount rate", "rate.discount.rate":"Discount rate",
"rate.custom_duty.title":"Custom Duties",
"rate.custom_duty":"Custom Duty",
"rate.cargo.type":"Cargo Types",
"rate.discount_by_weight":"Discounts by weight",
"rate.discount_by_weight.edit.delete.confirm":"Delete this discount by weight?",
"rate.custom.edit.delete.confirm":"Delete this custom duty?",
"Rate End ================================================================":"", "Rate End ================================================================":"",
"Cargo Start ================================================================":"", "Cargo Start ================================================================":"",
@@ -351,13 +368,14 @@
"cargo.weight":"Weight", "cargo.weight":"Weight",
"cargo.rate":"Rate", "cargo.rate":"Rate",
"cargo.amount":"Amount", "cargo.amount":"Amount",
"cargo.edit.delete.confirm":"Delete this cargo type?",
"Cargo End ================================================================":"", "Cargo End ================================================================":"",
"Invoices Start ================================================================":"", "Invoices Start ================================================================":"",
"invoices.btn": "Invoices", "invoices.btn": "Invoices",
"invoices.title": "INVOICES", "invoices.title": "Invoices",
"invoices.add":"New invoice", "invoices.add":"New invoice",
"invoice.form.title":"INVOICE", "invoice.form.title":"Invoice",
"invoice.payment":"Payment receipt", "invoice.payment":"Payment receipt",
"invoice.add_box":"Add carton", "invoice.add_box":"Add carton",
"invoice.add_package":"Add package", "invoice.add_package":"Add package",
@@ -393,6 +411,8 @@
"invoice.pdf": "Invoice PDF", "invoice.pdf": "Invoice PDF",
"invoice.total_custom_fee":"Total custom fee", "invoice.total_custom_fee":"Total custom fee",
"invoice.shipment_weight":"Shipment weight", "invoice.shipment_weight":"Shipment weight",
"invoice.popupmenu.pending":"Pending",
"invoice.popupmenu.paid":"Paid",
"Invoices End ================================================================":"", "Invoices End ================================================================":"",
"Discount Start ================================================================":"", "Discount Start ================================================================":"",
@@ -404,6 +424,7 @@
"discount.name":"Customer name", "discount.name":"Customer name",
"discount.amount":"Amount", "discount.amount":"Amount",
"discount.status":"Status", "discount.status":"Status",
"discount.edit.delete.confirm":"Delete this discount?",
"Discount End ================================================================":"", "Discount End ================================================================":"",
"delivery_addresses Start ================================================================":"", "delivery_addresses Start ================================================================":"",

View File

@@ -273,11 +273,16 @@
"box.mix.number":"သေတ္တာ နံပါတ်", "box.mix.number":"သေတ္တာ နံပါတ်",
"box.mix.desc":"ဖော်ပြချက်", "box.mix.desc":"ဖော်ပြချက်",
"box.info.title":"သေတ္တာ", "box.info.title":"သေတ္တာ",
"box.popupmenu.active":"လာမည့် သေတ္တာများ",
"box.popupmenu.delivered":"ပို့ပြီးသော သေတ္တာများ",
"box.cargo.total":"စုစုပေါင်း အလေးချိန်",
"Boxes End ================================================================":"", "Boxes End ================================================================":"",
"Delivery Start ================================================================":"", "Delivery Start ================================================================":"",
"delivery.title":"ပေးပို့ရန်များ", "delivery.title":"ပေးပို့ရန်များ",
"delivery":"ပေးပို့ရန်များ", "delivery":"ပေးပို့ရန်များ",
"delivery.popupmenu.active":"လာမည့် သေတ္တာများ",
"delivery.popupmenu.delivered":"ပို့ပြီးသော သေတ္တာများ",
"Delivery End ================================================================":"", "Delivery End ================================================================":"",
"FCS Shipment Start ================================================================":"", "FCS Shipment Start ================================================================":"",
@@ -295,12 +300,12 @@
"FCSshipment.final_destination":"ဆိုက်ရောက်နေရာ", "FCSshipment.final_destination":"ဆိုက်ရောက်နေရာ",
"FCSshipment.status":"အခြေအနေ", "FCSshipment.status":"အခြေအနေ",
"FCSshipment.remark":"မှတ်ချက်", "FCSshipment.remark":"မှတ်ချက်",
"FCSshipment.commercial_invoice":"Download Commercial Invoice", "FCSshipment.commercial_invoice":"ငွေတောင်းခံလွှာကိုဒေါင်းမည်",
"FCSshipment.packing_list":"Download Packing List", "FCSshipment.packing_list":"ထုပ်ပိုးစာရင်းကိုဒေါင်းမည်",
"FCSshipment.dms":"Download DMS", "FCSshipment.dms":"DMS ကိုဒေါင်းမည်",
"FCSshipment.cargo_manifest":"Download Cargo Manifest", "FCSshipment.cargo_manifest":"ကုန်ပစ္စည်းကိုဒေါင်းမည်",
"FCSshipment.create":"FCS တင်ပို့ခြင်းပြုလုပ်ရန်", "FCSshipment.create":"FCS တင်ပို့ခြင်းပြုလုပ်မည်",
"FCSshipment.update":"FCS တင်ပို့ခြင်းပြုပြင်ရန်", "FCSshipment.update":"FCS တင်ပို့ခြင်းပြုပြင်မည်",
"FCS Shipment End ================================================================":"", "FCS Shipment End ================================================================":"",
"Shipment Start ================================================================":"", "Shipment Start ================================================================":"",
@@ -309,25 +314,30 @@
"shipment.new": "ပို့ဆောင်ခြင်း အသစ်", "shipment.new": "ပို့ဆောင်ခြင်း အသစ်",
"shipment.new.title": "ပို့ဆောင်ခြင်း အသစ်", "shipment.new.title": "ပို့ဆောင်ခြင်း အသစ်",
"shipment.edit.title": "ပို့ဆောင်ခြင်း ပြင်ဆင်ခြင်း", "shipment.edit.title": "ပို့ဆောင်ခြင်း ပြင်ဆင်ခြင်း",
"shipment.type": "Pickup/Drop-off", "shipment.type": "Pickup/Drop-off ရွေးရန်",
"shipment.date": "Pickup date", "shipment.date": "Pickup နေ့စွဲ",
"shipment.date.time": "Pickup date/Time", "shipment.date.time": "Pickup နေ့စွဲ/အချိန်",
"shipment.time": "Pickup time", "shipment.time": "Pickup အချိန်",
"shipment.location_time": "Pickup location / Time", "shipment.location_time": "Pickup location / Time",
"shipment.location": "Pickup location", "shipment.location": "Pickup လိပ်စာ",
"shipment.information": "Pickup informations", "shipment.information": "Pickup informations",
"shipment.recipient_information": "Recipient informations", "shipment.recipient_information": "Recipient informations",
"shipment.from":"From", "shipment.from":"အချိန်(မှ)",
"shipment.to":"To", "shipment.to":"အချိန်(သို့)",
"shipment.box.delivery":"Delivery address", "shipment.box.delivery":"ပို့ဆောင်ရမည့်လိပ်စာ",
"shipment.handling.fee":"Handling fee/Courier fee", "shipment.handling.fee":"Handling fee/Courier fee",
"shipment.box.cargo.type":"Cargo types", "shipment.box.cargo.type":"ကုန်ပစ္စည်းအမျိုးအစားများ",
"shipment.box.dimemsion":"Dimension", "shipment.box.dimemsion":"အရွယ်အစား",
"shipment.box.shipment.weight":"Shipment weight", "shipment.box.shipment.weight":"တင်ပို့အလေးချိန်",
"shipment.box.length":"Length", "shipment.box.length":"အလျား",
"shipment.box.width":"Width", "shipment.box.width":"အနံ",
"shipment.box.height":"Height", "shipment.box.height":"အမြင့်",
"shipment.box.add":"Add carton", "shipment.box.add":"သေတ္တာထည့်မည်",
"shipment.cargo.total":"စုစုပေါင်း အလေးချိန်",
"shipment.popupmenu.active":"လာမည့် အထုပ်များ",
"shipment.popupmenu.delivered":"ပို့ပြီးသော အထုပ်များ",
"shipment.create":"ပို့ဆောင်ခြင်း ပြုလုပ်မည်",
"shipment.update":"ပို့ဆောင်ခြင်းပြုပြင်မည်",
"Shipment End ================================================================":"", "Shipment End ================================================================":"",
"Rate Start ================================================================":"", "Rate Start ================================================================":"",
@@ -336,13 +346,20 @@
"rate.edit.title":"စျေးနှုန်းများပြုပြင်ရန်", "rate.edit.title":"စျေးနှုန်းများပြုပြင်ရန်",
"rate.cal.title":"စျေးနှုန်းများတွက်ချက်ရန်", "rate.cal.title":"စျေးနှုန်းများတွက်ချက်ရန်",
"rate.min_weight":"Min Weight for Free delivery within Yangon", "rate.min_weight":"Min Weight for Free delivery within Yangon",
"rate.delivery_fee":"Delivery fees", "rate.delivery_fee":"ပို့ဆောင်ခ",
"rate.total_estimated_amount":"စုစုပေါင်းခန့်မှန်းပမာဏ",
"rate.volumetric_ratio":"Volumetric Ratio", "rate.volumetric_ratio":"Volumetric Ratio",
"rate.custom.form.title":"အကောက်ခွန်", "rate.custom.form.title":"အကောက်ခွန်",
"rate.cutom.product_type":"ကုန်ပစ္စည်းအမျိုးအစား", "rate.cutom.product_type":"ကုန်ပစ္စည်းအမျိုးအစား",
"rate.custom.fee":"အခကြေးငွေ", "rate.custom.fee":"အခကြေးငွေ",
"rate.discount.weight":"အလေးချိန်", "rate.discount.weight":"အလေးချိန်",
"rate.discount.rate":"လျှော့စျေးနှုန်း", "rate.discount.rate":"လျှော့စျေးနှုန်း",
"rate.custom_duty.title":"အကောက်ခွန်များ",
"rate.custom_duty":"အကောက်ခွန်",
"rate.cargo.type":"ကုန်ပစ္စည်းအမျိုးအစား",
"rate.discount_by_weight":"အထူးလျှော့စျေး",
"rate.discount_by_weight.edit.delete.confirm":"Delete this discount by weight?",
"rate.custom.edit.delete.confirm":"Delete this custom duty?",
"Rate End ================================================================":"", "Rate End ================================================================":"",
"Cargo Start ================================================================":"", "Cargo Start ================================================================":"",
@@ -393,6 +410,8 @@
"invoice.pdf": "Invoice PDF", "invoice.pdf": "Invoice PDF",
"invoice.total_custom_fee":"အခွန်စုစုပေါင်း", "invoice.total_custom_fee":"အခွန်စုစုပေါင်း",
"invoice.shipment_weight":"Shipment weight", "invoice.shipment_weight":"Shipment weight",
"invoice.popupmenu.pending":"Pending",
"invoice.popupmenu.paid":"Paid",
"Invoices End ================================================================":"", "Invoices End ================================================================":"",
"Discount Start ================================================================":"", "Discount Start ================================================================":"",
@@ -404,6 +423,7 @@
"discount.name":"ဝယ်ယူသူအမည်", "discount.name":"ဝယ်ယူသူအမည်",
"discount.amount":"ပမာဏ", "discount.amount":"ပမာဏ",
"discount.status":"အခြေအနေ", "discount.status":"အခြေအနေ",
"discount.edit.delete.confirm":"Delete this discount?",
"Discount End ================================================================":"", "Discount End ================================================================":"",
"delivery_addresses Start ================================================================":"", "delivery_addresses Start ================================================================":"",

View File

@@ -69,7 +69,6 @@ class RateServiceImp implements RateService {
@override @override
Future<void> updateRate(Rate rate) { Future<void> updateRate(Rate rate) {
// TODO: implement updateRate return rateDataProvider.updateRates(rate);
throw UnimplementedError();
} }
} }

View File

@@ -464,10 +464,9 @@ class _BoxEditorState extends State<BoxEditor> {
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: new Text( child: LocalText(context, "box.cargo.total",
"Total Weight", color: Colors.black87, fontWeight: FontWeight.bold),
style: TextStyle(fontWeight: FontWeight.bold), ),
)),
Padding( Padding(
padding: const EdgeInsets.only(right: 40.0), padding: const EdgeInsets.only(right: 40.0),
child: Align( child: Align(

View File

@@ -2,6 +2,8 @@ import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/box/model/box_model.dart'; import 'package:fcs/pages/box/model/box_model.dart';
import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
import 'package:fcs/pages/widgets/local_popup_menu_button.dart';
import 'package:fcs/pages/widgets/local_popupmenu.dart';
import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@@ -18,6 +20,7 @@ class BoxList extends StatefulWidget {
class _BoxListState extends State<BoxList> { class _BoxListState extends State<BoxList> {
bool _isLoading = false; bool _isLoading = false;
bool _showDelivered = false;
@override @override
void initState() { void initState() {
@@ -31,6 +34,16 @@ class _BoxListState extends State<BoxList> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var boxModel = Provider.of<BoxModel>(context);
final popupMenu = LocalPopupMenuButton(
popmenus: [
LocalPopupMenu(id: 1, textKey: "box.popupmenu.active", selected: true),
LocalPopupMenu(id: 2, textKey: "box.popupmenu.delivered")
],
popupMenuCallback: (p) => this.setState(() {
_showDelivered = p.id == 2;
}),
);
return LocalProgress( return LocalProgress(
inAsyncCall: _isLoading, inAsyncCall: _isLoading,
child: DefaultTabController( child: DefaultTabController(
@@ -54,87 +67,37 @@ class _BoxListState extends State<BoxList> {
iconSize: 30, onPressed: () {}, iconSize: 30, onPressed: () {},
// onPressed: () => showPlacesSearch(context), // onPressed: () => showPlacesSearch(context),
), ),
popupMenu
], ],
bottom: TabBar(
unselectedLabelColor: Colors.grey,
tabs: [
Tab(
text: "Upcoming",
),
Tab(text: "Delivered"),
],
),
), ),
floatingActionButton: FloatingActionButton.extended( floatingActionButton: FloatingActionButton.extended(
onPressed: () { onPressed: () {
_newPickup(); _newBox();
}, },
icon: Icon(Icons.add), icon: Icon(Icons.add),
label: Text(AppTranslations.of(context).text("boxes.new")), label: LocalText(context, "boxes.new", color: Colors.white),
backgroundColor: primaryColor, backgroundColor: primaryColor,
), ),
body: TabBarView( body: new ListView.separated(
children: [ separatorBuilder: (context, index) => Divider(
_upComing(), color: Colors.black,
_completed(), ),
], scrollDirection: Axis.vertical,
)), padding: EdgeInsets.only(top: 15),
shrinkWrap: true,
itemCount: boxModel.boxes.length,
itemBuilder: (BuildContext context, int index) {
return BoxListRow(box: boxModel.boxes[index]);
}),
),
), ),
); );
} }
_newPickup() { _newBox() {
Navigator.push( Navigator.push(
context, context,
CupertinoPageRoute(builder: (context) => BoxEditor()), CupertinoPageRoute(builder: (context) => BoxEditor()),
); );
} }
Widget _upComing() {
var boxModel = Provider.of<BoxModel>(context);
return Column(
children: <Widget>[
Expanded(
child: new ListView.separated(
separatorBuilder: (context, index) => Divider(
color: Colors.black,
),
scrollDirection: Axis.vertical,
padding: EdgeInsets.only(top: 15),
shrinkWrap: true,
itemCount: boxModel.upcoming.length,
itemBuilder: (BuildContext context, int index) {
return BoxListRow(
box: boxModel.upcoming[index],
isReadOnly: false,
);
}),
),
],
);
}
Widget _completed() {
var boxModel = Provider.of<BoxModel>(context);
return Column(
children: <Widget>[
Expanded(
child: new ListView.separated(
separatorBuilder: (context, index) => Divider(
color: Colors.black,
),
scrollDirection: Axis.vertical,
padding: EdgeInsets.only(top: 15),
shrinkWrap: true,
itemCount: boxModel.completed.length,
itemBuilder: (BuildContext context, int index) {
return BoxListRow(
box: boxModel.completed[index],
isReadOnly: false,
);
}),
),
],
);
}
} }

View File

@@ -6,9 +6,8 @@ import 'package:intl/intl.dart';
import 'box_info.dart'; import 'box_info.dart';
class BoxListRow extends StatefulWidget { class BoxListRow extends StatefulWidget {
final bool isReadOnly;
final Box box; final Box box;
const BoxListRow({this.box, this.isReadOnly}); const BoxListRow({this.box});
@override @override
_BoxListRowState createState() => _BoxListRowState(); _BoxListRowState createState() => _BoxListRowState();

View File

@@ -99,11 +99,12 @@ class _CargoTypeEditorState extends State<CargoTypeEditor> {
)), )),
body: Container( body: Container(
padding: EdgeInsets.all(18), padding: EdgeInsets.all(18),
child: ListView( child: Column(
children: <Widget>[ children: <Widget>[
cargoTypeBox, cargoTypeBox,
rateBox, rateBox,
SizedBox(height: 40), SizedBox(height: 40),
Spacer(),
saveBtn, saveBtn,
SizedBox(height: 20), SizedBox(height: 20),
], ],

View File

@@ -1,6 +1,9 @@
import 'package:fcs/helpers/theme.dart'; import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/box/model/box_model.dart'; import 'package:fcs/pages/box/model/box_model.dart';
import 'package:fcs/pages/widgets/local_popup_menu_button.dart';
import 'package:fcs/pages/widgets/local_popupmenu.dart';
import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -15,6 +18,7 @@ class DeliverList extends StatefulWidget {
class _DeliverListState extends State<DeliverList> { class _DeliverListState extends State<DeliverList> {
bool _isLoading = false; bool _isLoading = false;
bool _showDelivered = false;
@override @override
void initState() { void initState() {
@@ -28,6 +32,16 @@ class _DeliverListState extends State<DeliverList> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var boxModel = Provider.of<BoxModel>(context);
final popupMenu = LocalPopupMenuButton(
popmenus: [
LocalPopupMenu(id: 1, textKey: "delivery.popupmenu.active", selected: true),
LocalPopupMenu(id: 2, textKey: "delivery.popupmenu.delivered")
],
popupMenuCallback: (p) => this.setState(() {
_showDelivered = p.id == 2;
}),
);
return LocalProgress( return LocalProgress(
inAsyncCall: _isLoading, inAsyncCall: _isLoading,
child: DefaultTabController( child: DefaultTabController(
@@ -40,7 +54,8 @@ class _DeliverListState extends State<DeliverList> {
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
), ),
backgroundColor: primaryColor, backgroundColor: primaryColor,
title: Text(AppTranslations.of(context).text("delivery")), title: LocalText(context, "delivery",
color: Colors.white, fontSize: 20),
actions: <Widget>[ actions: <Widget>[
IconButton( IconButton(
icon: Icon( icon: Icon(
@@ -50,80 +65,22 @@ class _DeliverListState extends State<DeliverList> {
iconSize: 30, iconSize: 30,
// onPressed: () => showPlacesSearch(context), // onPressed: () => showPlacesSearch(context),
), ),
], popupMenu
bottom: TabBar(
unselectedLabelColor: Colors.grey,
tabs: [
Tab(
text: "Upcoming",
),
Tab(text: "Delivered"),
], ],
), ),
), body: new ListView.separated(
// floatingActionButton: FloatingActionButton.extended(
// onPressed: () {
// _newPickup();
// },
// icon: Icon(Icons.add),
// label: Text(AppTranslations.of(context).text("boxes.new")),
// backgroundColor: primaryColor,
// ),
body: TabBarView(
children: [
_upComing(),
_completed(),
],
)),
),
);
}
Widget _upComing() {
var boxModel = Provider.of<BoxModel>(context);
return Column(
children: <Widget>[
Expanded(
child: new ListView.separated(
separatorBuilder: (context, index) => Divider( separatorBuilder: (context, index) => Divider(
color: Colors.black, color: Colors.black,
), ),
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
padding: EdgeInsets.only(top: 15), padding: EdgeInsets.only(top: 15),
shrinkWrap: true, shrinkWrap: true,
itemCount: boxModel.upcoming.length, itemCount: boxModel.boxes.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return DeliveryListRow( return DeliveryListRow(box: boxModel.boxes[index]);
box: boxModel.upcoming[index],
isReadOnly: false,
);
}), }),
), ),
],
);
}
Widget _completed() {
var boxModel = Provider.of<BoxModel>(context);
return Column(
children: <Widget>[
Expanded(
child: new ListView.separated(
separatorBuilder: (context, index) => Divider(
color: Colors.black,
), ),
scrollDirection: Axis.vertical,
padding: EdgeInsets.only(top: 15),
shrinkWrap: true,
itemCount: boxModel.completed.length,
itemBuilder: (BuildContext context, int index) {
return DeliveryListRow(
box: boxModel.completed[index],
isReadOnly: false,
);
}),
),
],
); );
} }
} }

View File

@@ -1,15 +1,13 @@
import 'package:fcs/domain/entities/box.dart'; import 'package:fcs/domain/entities/box.dart';
import 'package:fcs/pages/box/box_editor.dart'; import 'package:fcs/pages/box/box_editor.dart';
import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/main/util.dart';
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
class DeliveryListRow extends StatefulWidget { class DeliveryListRow extends StatefulWidget {
final bool isReadOnly;
final Box box; final Box box;
const DeliveryListRow({this.box, this.isReadOnly}); const DeliveryListRow({this.box});
@override @override
_DeliveryListRowState createState() => _DeliveryListRowState(); _DeliveryListRowState createState() => _DeliveryListRowState();
@@ -32,17 +30,10 @@ class _DeliveryListRowState extends State<DeliveryListRow> {
padding: EdgeInsets.only(left: 15, right: 15), padding: EdgeInsets.only(left: 15, right: 15),
child: InkWell( child: InkWell(
onTap: () { onTap: () {
if (widget.isReadOnly) {
// Navigator.push(
// context,
// CupertinoPageRoute(builder: (context) => PackageInfo(package: _box)),
// );
} else {
Navigator.push( Navigator.push(
context, context,
CupertinoPageRoute(builder: (context) => BoxEditor(box: _box)), CupertinoPageRoute(builder: (context) => BoxEditor(box: _box)),
); );
}
}, },
child: Row( child: Row(
children: <Widget>[ children: <Widget>[

View File

@@ -1,7 +1,11 @@
import 'package:fcs/domain/entities/discount.dart'; import 'package:fcs/domain/entities/discount.dart';
import 'package:fcs/domain/entities/user.dart';
import 'package:fcs/helpers/theme.dart'; import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/discount/model/discount_model.dart';
import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/main/util.dart';
import 'package:fcs/pages/rates/model/shipment_rate_model.dart';
import 'package:fcs/pages/user_search/user_serach.dart';
import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/display_text.dart';
import 'package:fcs/pages/widgets/input_text.dart'; import 'package:fcs/pages/widgets/input_text.dart';
import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pages/widgets/progress.dart';
@@ -9,6 +13,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_icons/flutter_icons.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
class DiscountEditor extends StatefulWidget { class DiscountEditor extends StatefulWidget {
final Discount discount; final Discount discount;
@@ -24,9 +29,10 @@ class _DiscountEditorState extends State<DiscountEditor> {
TextEditingController _codeController = new TextEditingController(); TextEditingController _codeController = new TextEditingController();
TextEditingController _amountController = new TextEditingController(); TextEditingController _amountController = new TextEditingController();
TextEditingController _statusController = new TextEditingController(); TextEditingController _statusController = new TextEditingController();
TextEditingController _customerController = new TextEditingController();
bool isNew = false; bool _isNew = false;
String customerName = '';
String customerId = '';
@override @override
void initState() { void initState() {
@@ -36,10 +42,10 @@ class _DiscountEditorState extends State<DiscountEditor> {
_codeController.text = _discount.code; _codeController.text = _discount.code;
_amountController.text = _discount.amount.toString(); _amountController.text = _discount.amount.toString();
_statusController.text = _discount.status; _statusController.text = _discount.status;
_customerController.text = 'Ko Nyi'; customerName = widget.discount.customerName;
customerId = widget.discount.customerId;
} else { } else {
isNew = true; _isNew = true;
_customerController.text = '';
} }
} }
@@ -49,20 +55,37 @@ class _DiscountEditorState extends State<DiscountEditor> {
labelTextKey: 'discount.code', labelTextKey: 'discount.code',
iconData: FontAwesomeIcons.algolia, iconData: FontAwesomeIcons.algolia,
controller: _codeController); controller: _codeController);
final nameBox = InputText(
labelTextKey: 'discount.name',
iconData: Feather.user,
controller: _customerController);
final amountBox = InputText( final amountBox = InputText(
labelTextKey: 'discount.amount', labelTextKey: 'discount.amount',
iconData: FontAwesomeIcons.moneyBill, iconData: FontAwesomeIcons.moneyBill,
controller: _amountController); controller: _amountController);
final statusBox = DisplayText( final statusBox = DisplayText(
text: _statusController.text, text: _statusController.text,
labelTextKey: getLocalString(context, "discount.status"), labelTextKey: "discount.status",
iconData: Icons.av_timer, iconData: Icons.av_timer,
); );
final customerBox = Row(
children: <Widget>[
Expanded(
child: DisplayText(
text: customerName != null ? customerName : "",
labelTextKey: "discount.name",
iconData: Feather.user,
)),
IconButton(
icon: Icon(Icons.search, color: primaryColor),
onPressed: () => searchUser(context, callbackUserSelect: (u) {
setState(() {
customerId = u.id;
customerName = u.name;
});
})),
],
);
return LocalProgress( return LocalProgress(
inAsyncCall: _isLoading, inAsyncCall: _isLoading,
child: Scaffold( child: Scaffold(
@@ -77,18 +100,25 @@ class _DiscountEditorState extends State<DiscountEditor> {
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
), ),
backgroundColor: primaryColor, backgroundColor: primaryColor,
actions: <Widget>[], actions: [
IconButton(
icon: Icon(Icons.delete),
onPressed: _delete,
)
],
), ),
body: Padding( body: Padding(
padding: const EdgeInsets.only(left: 20.0), padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: ListView( child: ListView(
children: <Widget>[ children: <Widget>[
codeBox, codeBox,
nameBox,
amountBox, amountBox,
SizedBox(height: 7),
customerBox,
SizedBox(height: 7),
widget.discount == null widget.discount == null
? Container() ? Container()
: Container( : Container(
@@ -98,35 +128,8 @@ class _DiscountEditorState extends State<DiscountEditor> {
], ],
), ),
), ),
widget.discount == null fcsButton(context, getLocalString(context, "btn.save"),
? Align( callack: _save),
alignment: Alignment.bottomCenter,
child: Center(
child: Container(
width: 250,
child: FlatButton(
child: Text('Add Discount'),
color: primaryColor,
textColor: Colors.white,
onPressed: () {
Navigator.pop(context);
},
),
)))
: Align(
alignment: Alignment.bottomCenter,
child: Center(
child: Container(
width: 250,
child: FlatButton(
child: Text('Save box'),
color: primaryColor,
textColor: Colors.white,
onPressed: () {
Navigator.pop(context);
},
),
))),
SizedBox( SizedBox(
height: 30, height: 30,
) )
@@ -135,4 +138,54 @@ class _DiscountEditorState extends State<DiscountEditor> {
)), )),
); );
} }
_save() async {
setState(() {
_isLoading = true;
});
try {
DiscountModel discountModel =
Provider.of<DiscountModel>(context, listen: false);
Discount _discount = Discount(
code: _codeController.text,
customerName: customerName,
customerId: customerId,
amount: double.parse(_amountController.text));
if (_isNew) {
await discountModel.addDiscount(_discount);
} else {
_discount.id = widget.discount.id;
await discountModel.updateDiscount(_discount);
}
Navigator.pop(context);
} catch (e) {
showMsgDialog(context, "Error", e.toString());
} finally {
setState(() {
_isLoading = false;
});
}
}
_delete() {
showConfirmDialog(
context, "discount.edit.delete.confirm", _deleteCargoType);
}
_deleteCargoType() async {
setState(() {
_isLoading = true;
});
try {
var discountModel = Provider.of<DiscountModel>(context, listen: false);
await discountModel.deleteDiscount(widget.discount);
Navigator.pop(context);
} catch (e) {
showMsgDialog(context, "Error", e.toString());
} finally {
setState(() {
_isLoading = false;
});
}
}
} }

View File

@@ -2,6 +2,7 @@ import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/discount/model/discount_model.dart'; import 'package:fcs/pages/discount/model/discount_model.dart';
import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/main/util.dart';
import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -19,6 +20,16 @@ class DiscountList extends StatefulWidget {
class _DiscountListState extends State<DiscountList> { class _DiscountListState extends State<DiscountList> {
bool _isLoading = false; bool _isLoading = false;
bool _selected = false;
@override
void initState() {
super.initState();
if (widget.selected != null) {
_selected = widget.selected;
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var discountModel = Provider.of<DiscountModel>(context); var discountModel = Provider.of<DiscountModel>(context);
@@ -52,7 +63,7 @@ class _DiscountListState extends State<DiscountList> {
var discount = discountModel.discounts[index]; var discount = discountModel.discounts[index];
return InkWell( return InkWell(
onTap: () { onTap: () {
widget.selected _selected
? Navigator.pop(context, discount) ? Navigator.pop(context, discount)
: Navigator.push( : Navigator.push(
context, context,
@@ -128,7 +139,11 @@ class _DiscountListState extends State<DiscountList> {
); );
}, },
icon: Icon(Icons.add), icon: Icon(Icons.add),
label: Text(AppTranslations.of(context).text("discount.new")), label: LocalText(
context,
'discount.new',
color: Colors.white,
),
backgroundColor: primaryColor, backgroundColor: primaryColor,
), ),
), ),

View File

@@ -100,7 +100,6 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
color: primaryColor, color: primaryColor,
fontSize: 18, fontSize: 18,
), ),
actions: _isNew ? [] : [menuPopWidget(context)],
), ),
body: Padding( body: Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
@@ -175,59 +174,6 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
); );
} }
Widget menuPopWidget(BuildContext context) {
return PopupMenuButton<PopupMenu>(
elevation: 3.2,
icon: Icon(Icons.more_vert, color: primaryColor),
tooltip: 'This is tooltip',
onSelected: (choice) {
if (choice.id == 1) {
Navigator.pop(context);
} else if (choice.id == 2) {
Navigator.pop(context);
} else if (choice.id == 3) {
Navigator.pop(context);
} else if (choice.id == 4) {
Navigator.pop(context);
}
},
itemBuilder: (BuildContext context) {
List<PopupMenu> menuPopup = <PopupMenu>[
PopupMenu(
id: 3,
status: "FCSshipment.commercial_invoice",
),
PopupMenu(id: 2, status: "FCSshipment.packing_list"),
PopupMenu(
id: 5,
status: "FCSshipment.dms",
),
PopupMenu(
id: 4,
status: "FCSshipment.cargo_manifest",
),
];
return menuPopup.map((PopupMenu choice) {
return PopupMenuItem<PopupMenu>(
value: choice,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 15),
child: LocalText(
context,
choice.status,
color: primaryColor,
)),
],
),
);
}).toList();
});
}
FcsShipment _getPayload() { FcsShipment _getPayload() {
FcsShipment fcsShipment = FcsShipment(); FcsShipment fcsShipment = FcsShipment();
fcsShipment.id = _shipment.id; fcsShipment.id = _shipment.id;

View File

@@ -0,0 +1,206 @@
import 'package:fcs/domain/entities/fcs_shipment.dart';
import 'package:fcs/helpers/theme.dart';
import 'package:fcs/pages/widgets/display_text.dart';
import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/popupmenu.dart';
import 'package:fcs/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart';
import 'fcs_shipment_editor.dart';
class FcsShipmentInfo extends StatefulWidget {
final FcsShipment fcsShipment;
FcsShipmentInfo({this.fcsShipment});
@override
_FcsShipmentInfoState createState() => _FcsShipmentInfoState();
}
class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
var dateFormatter = new DateFormat('dd MMM yyyy');
FcsShipment _fcsShipment;
bool _isLoading = false;
TextEditingController _shipmentNumberController = new TextEditingController();
TextEditingController _cutoffDateController = new TextEditingController();
TextEditingController _arrivalDateController = new TextEditingController();
TextEditingController _departureDateControler = new TextEditingController();
TextEditingController _shipmentTypeControler = new TextEditingController();
TextEditingController _consigneeController = new TextEditingController();
TextEditingController _portController = new TextEditingController();
TextEditingController _destinationController = new TextEditingController();
TextEditingController _statusController = new TextEditingController();
@override
void initState() {
super.initState();
_fcsShipment = widget.fcsShipment;
_shipmentNumberController.text = _fcsShipment.shipmentNumber;
_cutoffDateController.text = dateFormatter.format(_fcsShipment.cutoffDate);
_arrivalDateController.text =
dateFormatter.format(_fcsShipment.arrivalDate);
_departureDateControler.text =
dateFormatter.format(_fcsShipment.departureDate);
_shipmentTypeControler.text = _fcsShipment.shipType;
_consigneeController.text = _fcsShipment.consignee;
_portController.text = _fcsShipment.port;
_destinationController.text = _fcsShipment.destination;
_statusController.text = _fcsShipment.status;
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
final shipmentNumberBox = DisplayText(
text: _shipmentNumberController.text,
labelTextKey: "FCSshipment.number",
iconData: Ionicons.ios_airplane,
);
final cutoffDateDBox = DisplayText(
text: _cutoffDateController.text,
labelTextKey: "FCSshipment.cutoff_date",
iconData: Icons.date_range,
);
final etaBox = DisplayText(
text: _arrivalDateController.text,
labelTextKey: "FCSshipment.ETA",
iconData: Icons.date_range,
);
final departureDateBox = DisplayText(
text: _departureDateControler.text,
labelTextKey: "FCSshipment.departure_date",
iconData: Icons.date_range,
);
final shipTypeBox = DisplayText(
text: _shipmentTypeControler.text,
labelTextKey: "FCSshipment.shipment_type",
iconData: Ionicons.ios_airplane,
);
final consigneeBox = DisplayText(
text: _consigneeController.text,
labelTextKey: "FCSshipment.consignee",
iconData: Icons.work,
);
final portBox = DisplayText(
text: _portController.text,
labelTextKey: "FCSshipment.port_of_loading",
iconData: FontAwesomeIcons.ship,
);
final destinationBox = DisplayText(
text: _destinationController.text,
labelTextKey: "FCSshipment.final_destination",
iconData: MaterialCommunityIcons.location_enter,
);
final statusBox = DisplayText(
text: _statusController.text,
labelTextKey: "FCSshipment.status",
iconData: Icons.av_timer,
);
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
appBar: AppBar(
centerTitle: true,
leading: new IconButton(
icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30),
onPressed: () => Navigator.of(context).pop(),
),
shadowColor: Colors.transparent,
backgroundColor: Colors.white,
title: LocalText(
context,
"FCSshipment.form.title",
fontSize: 20,
color: primaryColor,
),
actions: [
IconButton(
icon: Icon(Icons.edit, color: primaryColor),
onPressed: _edit,
),
menuPopWidget(context)
],
),
body: Card(
child: Column(
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: ListView(children: <Widget>[
shipmentNumberBox,
cutoffDateDBox,
etaBox,
departureDateBox,
shipTypeBox,
consigneeBox,
portBox,
destinationBox,
statusBox,
SizedBox(
height: 20,
)
]),
)),
],
),
),
),
);
}
_edit() async {
await Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => FcsShipmentEditor(shipment: _fcsShipment)),
);
}
Widget menuPopWidget(BuildContext context) {
return PopupMenuButton<PopupMenu>(
elevation: 3.2,
icon: Icon(Icons.more_vert, color: primaryColor),
tooltip: 'This is tooltip',
onSelected: (choice) {
print(choice.id);
if (choice.id == 1) {
} else if (choice.id == 2) {
} else if (choice.id == 3) {
} else if (choice.id == 4) {}
},
itemBuilder: (BuildContext context) {
return menuPopup.map((PopupMenu choice) {
return PopupMenuItem<PopupMenu>(
value: choice,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 15),
child: LocalText(
context,
choice.status,
color: primaryColor,
)),
],
),
);
}).toList();
});
}
}

View File

@@ -1,4 +1,3 @@
import 'package:fcs/helpers/paginator.dart';
import 'package:fcs/helpers/theme.dart'; import 'package:fcs/helpers/theme.dart';
import 'package:fcs/pages/fcs_shipment/model/fcs_shipment_model.dart'; import 'package:fcs/pages/fcs_shipment/model/fcs_shipment_model.dart';
import 'package:fcs/pages/widgets/local_popup_menu_button.dart'; import 'package:fcs/pages/widgets/local_popup_menu_button.dart';

View File

@@ -1,13 +1,11 @@
import 'package:fcs/domain/entities/fcs_shipment.dart'; import 'package:fcs/domain/entities/fcs_shipment.dart';
import 'package:fcs/helpers/theme.dart'; import 'package:fcs/helpers/theme.dart';
import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/main/util.dart';
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_icons/flutter_icons.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'fcs_shipment_info.dart';
import 'fcs_shipment_editor.dart';
class FcsShipmentListRow extends StatelessWidget { class FcsShipmentListRow extends StatelessWidget {
final FcsShipment shipment; final FcsShipment shipment;
@@ -21,7 +19,7 @@ class FcsShipmentListRow extends StatelessWidget {
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Navigator.of(context).push(CupertinoPageRoute( Navigator.of(context).push(CupertinoPageRoute(
builder: (context) => FcsShipmentEditor(shipment: shipment))); builder: (context) => FcsShipmentInfo(fcsShipment: shipment)));
}, },
child: Row( child: Row(
children: <Widget>[ children: <Widget>[

View File

@@ -8,6 +8,8 @@ import 'package:fcs/pages/package_search/package_serach.dart';
import 'package:fcs/pages/shipment/shipment_list.dart'; import 'package:fcs/pages/shipment/shipment_list.dart';
import 'package:fcs/pages/user_search/user_serach.dart'; import 'package:fcs/pages/user_search/user_serach.dart';
import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
import 'package:fcs/pages/widgets/local_popup_menu_button.dart';
import 'package:fcs/pages/widgets/local_popupmenu.dart';
import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@@ -40,6 +42,17 @@ class _InvoiceListState extends State<InvoiceList> {
var owner = true; var owner = true;
var invoiceModel = Provider.of<InvoiceModel>(context); var invoiceModel = Provider.of<InvoiceModel>(context);
final popupMenu = LocalPopupMenuButton(
popmenus: [
LocalPopupMenu(
id: 1, textKey: "invoice.popupmenu.pending", selected: true),
LocalPopupMenu(id: 2, textKey: "invoice.popupmenu.paid")
],
popupMenuCallback: (p) => this.setState(() {
// _showDelivered = p.id == 2;
}),
);
return LocalProgress( return LocalProgress(
inAsyncCall: _isLoading, inAsyncCall: _isLoading,
child: DefaultTabController( child: DefaultTabController(
@@ -58,6 +71,7 @@ class _InvoiceListState extends State<InvoiceList> {
IconButton( IconButton(
icon: Icon(Icons.search, color: Colors.white), icon: Icon(Icons.search, color: Colors.white),
onPressed: () {}), onPressed: () {}),
popupMenu
], ],
), ),
floatingActionButton: owner floatingActionButton: owner

View File

@@ -25,10 +25,9 @@ class _PaymentPDFScreenState extends State<PaymentPDFScreen>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
print(' widget.path => ${widget.path}');
print(' pages => ${pages}');
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
centerTitle: true,
backgroundColor: primaryColor, backgroundColor: primaryColor,
title: LocalText(context, 'invoice.pdf', title: LocalText(context, 'invoice.pdf',
color: Colors.white, fontSize: 20), color: Colors.white, fontSize: 20),

View File

@@ -6,6 +6,9 @@ import 'package:fcs/pages/widgets/input_text.dart';
import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'model/shipment_rate_model.dart';
class CargoEditor extends StatefulWidget { class CargoEditor extends StatefulWidget {
final CargoType cargo; final CargoType cargo;
@@ -21,6 +24,8 @@ class _CargoEditorState extends State<CargoEditor> {
bool _isLoading = false; bool _isLoading = false;
CargoType _cargo; CargoType _cargo;
bool _isNew = false;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@@ -28,6 +33,8 @@ class _CargoEditorState extends State<CargoEditor> {
_cargo = widget.cargo; _cargo = widget.cargo;
_descController.text = _cargo.name; _descController.text = _cargo.name;
_rateController.text = _cargo.rate.toString(); _rateController.text = _cargo.rate.toString();
} else {
_isNew = true;
} }
} }
@@ -57,6 +64,12 @@ class _CargoEditorState extends State<CargoEditor> {
), ),
backgroundColor: primaryColor, backgroundColor: primaryColor,
title: Text(AppTranslations.of(context).text("cargo.form.title")), title: Text(AppTranslations.of(context).text("cargo.form.title")),
actions: [
IconButton(
icon: Icon(Icons.delete),
onPressed: _delete,
)
],
), ),
body: Container( body: Container(
padding: EdgeInsets.all(18), padding: EdgeInsets.all(18),
@@ -71,9 +84,8 @@ class _CargoEditorState extends State<CargoEditor> {
], ],
), ),
), ),
widget.cargo == null fcsButton(context, getLocalString(context, "btn.save"),
? fcsButton(context, "Create", callack: () {}) callack: _save),
: fcsButton(context, "Save", callack: () {}),
SizedBox(height: 10) 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;
});
}
}
} }

View 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,
),
],
));
}
}

View File

@@ -7,6 +7,9 @@ import 'package:fcs/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.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 { class CustomEditor extends StatefulWidget {
final CustomDuty custom; final CustomDuty custom;
@@ -22,6 +25,7 @@ class _CustomEditorState extends State<CustomEditor> {
bool _isLoading = false; bool _isLoading = false;
CustomDuty _custom = new CustomDuty(); CustomDuty _custom = new CustomDuty();
bool _isNew = false;
@override @override
void initState() { void initState() {
@@ -30,6 +34,8 @@ class _CustomEditorState extends State<CustomEditor> {
_custom = widget.custom; _custom = widget.custom;
_productController.text = _custom.productType; _productController.text = _custom.productType;
_feeController.text = _custom.fee.toString(); _feeController.text = _custom.fee.toString();
} else {
_isNew = true;
} }
} }
@@ -62,6 +68,12 @@ class _CustomEditorState extends State<CustomEditor> {
backgroundColor: primaryColor, backgroundColor: primaryColor,
title: title:
Text(AppTranslations.of(context).text("rate.custom.form.title")), Text(AppTranslations.of(context).text("rate.custom.form.title")),
actions: [
IconButton(
icon: Icon(Icons.delete),
onPressed: _delete,
)
],
), ),
body: Container( body: Container(
padding: EdgeInsets.all(18), padding: EdgeInsets.all(18),
@@ -76,9 +88,8 @@ class _CustomEditorState extends State<CustomEditor> {
], ],
), ),
), ),
widget.custom == null fcsButton(context, getLocalString(context, "btn.save"),
? fcsButton(context, "Create", callack: () {}) callack: _save),
: fcsButton(context, "Save", callack: () {}),
SizedBox(height: 10) 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;
});
}
}
} }

View File

@@ -49,11 +49,20 @@ class _CustomListState extends State<CustomList> {
backgroundColor: primaryColor, backgroundColor: primaryColor,
title: LocalText( title: LocalText(
context, context,
"Customs", "rate.custom_duty.title",
fontSize: 20, fontSize: 20,
color: Colors.white, 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( body: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: ListView.separated( child: ListView.separated(
@@ -62,26 +71,46 @@ class _CustomListState extends State<CustomList> {
), ),
itemCount: shipmentRateModel.rate.customDuties.length, itemCount: shipmentRateModel.rate.customDuties.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return _row( CustomDuty custom =
context, shipmentRateModel.rate.customDuties[index]); 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) { _row(String desc, String price) {
return InkWell( return Container(
onTap: () => Navigator.pop<CustomDuty>(context, custom), padding: EdgeInsets.only(left: 25, top: 5, bottom: 5),
child: Row( child: Row(
children: [ children: <Widget>[
Expanded( Text('$desc ', style: TextStyle(fontSize: 15)),
child: CustomRow( Spacer(),
key: ValueKey(custom.id), Column(
custom: custom, 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,
),
],
));
} }
} }

View File

@@ -0,0 +1,119 @@
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(
discountByWeight: 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,
),
],
));
}
}

View File

@@ -2,11 +2,13 @@ import 'package:fcs/domain/entities/discount_by_weight.dart';
import 'package:fcs/helpers/theme.dart'; import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/main/util.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/input_text.dart';
import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
class DiscountByWeightEditor extends StatefulWidget { class DiscountByWeightEditor extends StatefulWidget {
final DiscountByWeight discountByWeight; final DiscountByWeight discountByWeight;
@@ -18,9 +20,10 @@ class DiscountByWeightEditor extends StatefulWidget {
class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> { class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
TextEditingController _weightController = new TextEditingController(); TextEditingController _weightController = new TextEditingController();
TextEditingController _rateController = new TextEditingController(); TextEditingController _discountController = new TextEditingController();
bool _isLoading = false; bool _isLoading = false;
bool _isNew = false;
DiscountByWeight _discountByWeight = new DiscountByWeight(); DiscountByWeight _discountByWeight = new DiscountByWeight();
@override @override
@@ -29,7 +32,7 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
if (widget.discountByWeight != null) { if (widget.discountByWeight != null) {
_discountByWeight = widget.discountByWeight; _discountByWeight = widget.discountByWeight;
_weightController.text = _discountByWeight.weight.toString(); _weightController.text = _discountByWeight.weight.toString();
_rateController.text = _discountByWeight.discount.toString(); _discountController.text = _discountByWeight.discount.toString();
} }
} }
@@ -47,7 +50,7 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
final discountRateBox = InputText( final discountRateBox = InputText(
labelTextKey: 'rate.discount.rate', labelTextKey: 'rate.discount.rate',
iconData: Icons.attach_money, iconData: Icons.attach_money,
controller: _rateController); controller: _discountController);
return LocalProgress( return LocalProgress(
inAsyncCall: _isLoading, inAsyncCall: _isLoading,
@@ -60,6 +63,12 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
), ),
backgroundColor: primaryColor, backgroundColor: primaryColor,
title: Text(AppTranslations.of(context).text("discount.new")), title: Text(AppTranslations.of(context).text("discount.new")),
actions: [
IconButton(
icon: Icon(Icons.delete),
onPressed: _delete,
)
],
), ),
body: Container( body: Container(
padding: EdgeInsets.all(18), padding: EdgeInsets.all(18),
@@ -74,9 +83,8 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
], ],
), ),
), ),
widget.discountByWeight == null fcsButton(context, getLocalString(context, "btn.save"),
? fcsButton(context, "Create", callack: () {}) callack: _save),
: fcsButton(context, "Save", callack: () {}),
SizedBox(height: 10) SizedBox(height: 10)
], ],
), ),
@@ -84,4 +92,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.discountByWeight.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.discountByWeight.id);
Navigator.pop(context);
} catch (e) {
showMsgDialog(context, "Error", e.toString());
} finally {
setState(() {
_isLoading = false;
});
}
}
} }

View File

@@ -1,6 +1,9 @@
import 'dart:async'; import 'dart:async';
import 'package:fcs/data/services/services.dart'; 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/domain/entities/rate.dart';
import 'package:fcs/pages/main/model/base_model.dart'; import 'package:fcs/pages/main/model/base_model.dart';
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
@@ -24,4 +27,53 @@ class ShipmentRateModel extends BaseModel {
logout() async { logout() async {
if (listener != null) await listener.cancel(); 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);
}
} }

View File

@@ -5,6 +5,8 @@ import 'package:fcs/domain/entities/rate.dart';
import 'package:fcs/helpers/theme.dart'; import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/main/model/main_model.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/rates/model/shipment_rate_model.dart';
import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/local_text.dart';
@@ -14,6 +16,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../main/util.dart'; import '../main/util.dart';
import 'discount_by weight_list.dart';
import 'shipment_rates_calculate.dart'; import 'shipment_rates_calculate.dart';
import 'shipment_rates_edit.dart'; import 'shipment_rates_edit.dart';
@@ -74,7 +77,7 @@ class _ShipmentRatesState extends State<ShipmentRates> {
child: ListView( child: ListView(
// crossAxisAlignment: CrossAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
fcsButton(context, "Calculate shipping cost", callack: () { fcsButton(context, getLocalString(context, "rate.cal.title"), callack: () {
Navigator.of(context).push(CupertinoPageRoute( Navigator.of(context).push(CupertinoPageRoute(
builder: (context) => ShipmentRatesCal())); builder: (context) => ShipmentRatesCal()));
}), }),
@@ -82,13 +85,21 @@ class _ShipmentRatesState extends State<ShipmentRates> {
color: Colors.grey, color: Colors.grey,
), ),
Container( Container(
padding: EdgeInsets.only(left: 25, top: 10), padding: EdgeInsets.only(left: 25, top: 10, right: 25),
child: Text( child: Row(
"Cargo Types", children: [
style: TextStyle( LocalText(context, "rate.cargo.type",
color: primaryColor, color: primaryColor,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 15), fontSize: 15),
Spacer(),
IconButton(
icon: Icon(Icons.edit, color: primaryColor),
onPressed: () {
Navigator.of(context).push(CupertinoPageRoute(
builder: (context) => CargoTypeList()));
})
],
), ),
), ),
Column( Column(
@@ -98,13 +109,21 @@ class _ShipmentRatesState extends State<ShipmentRates> {
color: Colors.grey, color: Colors.grey,
), ),
Container( Container(
padding: EdgeInsets.only(left: 25, top: 10), padding: EdgeInsets.only(left: 25, top: 10, right: 25),
child: Text( child: Row(
"Discounts by weight", children: [
style: TextStyle( LocalText(context, "rate.discount_by_weight",
color: primaryColor, color: primaryColor,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 15), fontSize: 15),
Spacer(),
IconButton(
icon: Icon(Icons.edit, color: primaryColor),
onPressed: () {
Navigator.of(context).push(CupertinoPageRoute(
builder: (context) => DiscountByWeightList()));
})
],
), ),
), ),
Column( Column(
@@ -124,13 +143,21 @@ class _ShipmentRatesState extends State<ShipmentRates> {
color: Colors.grey, color: Colors.grey,
), ),
Container( Container(
padding: EdgeInsets.only(left: 25, top: 10), padding: EdgeInsets.only(left: 25, top: 10, right: 25),
child: Text( child: Row(
"Custom Duties", children: [
style: TextStyle( LocalText(context, "rate.custom_duty",
color: primaryColor, color: primaryColor,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 15), fontSize: 15),
Spacer(),
IconButton(
icon: Icon(Icons.edit, color: primaryColor),
onPressed: () {
Navigator.of(context).push(CupertinoPageRoute(
builder: (context) => CustomList()));
})
],
), ),
), ),
Column( Column(

View File

@@ -1,9 +1,13 @@
import 'package:fcs/helpers/theme.dart'; import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/rates/model/shipment_rate_model.dart'; import 'package:fcs/pages/rates/model/shipment_rate_model.dart';
import 'package:fcs/pages/widgets/display_text.dart';
import 'package:fcs/pages/widgets/length_picker.dart';
import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/local_title.dart';
import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -18,10 +22,26 @@ class ShipmentRatesCal extends StatefulWidget {
class _ShipmentRatesCalState extends State<ShipmentRatesCal> { class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
bool _isLoading = false; bool _isLoading = false;
String cargoType; String cargoType;
TextEditingController _widthController = new TextEditingController();
TextEditingController _heightController = new TextEditingController();
TextEditingController _lengthController = new TextEditingController();
double shipmentWeight = 0;
double volumetricRatio = 0;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
//for shipment weight
volumetricRatio = Provider.of<ShipmentRateModel>(context, listen: false)
.rate
.volumetricRatio;
// _lengthController.addListener(_calShipmentWeight);
// _widthController.addListener(_calShipmentWeight);
// _heightController.addListener(_calShipmentWeight);
_lengthController.text = '10';
_widthController.text = '10';
_heightController.text = '10';
} }
@override @override
@@ -33,6 +53,44 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
var shipmentRateModel = Provider.of<ShipmentRateModel>(context); var shipmentRateModel = Provider.of<ShipmentRateModel>(context);
final lengthBox = LengthPicker(
controller: _lengthController,
lableKey: "box.length",
);
final widthBox = LengthPicker(
controller: _widthController,
lableKey: "box.width",
);
final heightBox = LengthPicker(
controller: _heightController,
lableKey: "box.height",
);
final dimBox = Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: Icon(FontAwesome.arrow_circle_right, color: primaryColor),
),
SizedBox(child: lengthBox, width: 80),
SizedBox(child: widthBox, width: 80),
SizedBox(child: heightBox, width: 80),
],
);
final shipmentWeightBox = DisplayText(
text: shipmentWeight != null ? shipmentWeight.toStringAsFixed(0) : "6",
labelTextKey: "box.shipment_weight",
iconData: MaterialCommunityIcons.weight,
);
final actualWeightBox = DisplayText(
text: shipmentWeight != null ? shipmentWeight.toStringAsFixed(0) : "",
labelTextKey: "box.actual_weight",
iconData: MaterialCommunityIcons.weight,
);
return LocalProgress( return LocalProgress(
inAsyncCall: _isLoading, inAsyncCall: _isLoading,
child: Scaffold( child: Scaffold(
@@ -56,8 +114,8 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: child: LocalText(context, 'rate.cargo.type',
Text('Cargo Type', style: TextStyle(fontSize: 15))), color: Colors.grey, fontSize: 15)),
Container( Container(
width: 150.0, width: 150.0,
child: DropdownButtonFormField( child: DropdownButtonFormField(
@@ -79,46 +137,50 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
], ],
), ),
), ),
_row('Width (inches)', "", "", "10", input: true), // LocalTitle(textKey: "box.dimension"),
_row('Height (inches)', "", "", "10", input: true), dimBox,
_row('Length (inches)', "", "", "10", input: true), shipmentWeightBox,
_row('Actual Weight (pounds)', "", "", "0", input: true), actualWeightBox,
Container(
padding: EdgeInsets.only(left: 25, top: 15, bottom: 5),
child: Row(
children: <Widget>[
Text('Shipment Weight', style: TextStyle(fontSize: 15)),
Spacer(),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(bottom: 3.0),
child: Text(
'6',
style:
TextStyle(color: primaryColor, fontSize: 16),
),
),
Text(
'pounds',
style: TextStyle(color: Colors.grey, fontSize: 16),
),
],
),
],
)),
SizedBox(height: 50), SizedBox(height: 50),
Center( Center(
child: Text( child: Container(
"Delivery fee:\$ 5", alignment: Alignment.center,
style: TextStyle(color: primaryColor, fontSize: 16), width: 150,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
LocalText(context, "rate.delivery_fee",
color: primaryColor, fontSize: 16),
Text(
':\$ 5',
style: TextStyle(
color: primaryColor,
fontSize: 16,
),
)
],
),
)), )),
SizedBox(height: 20), SizedBox(height: 20),
Center( Center(
child: Text( child: Container(
"Total estimated amount:\$ 41", width: 220,
style: TextStyle(color: primaryColor, fontSize: 20), alignment: Alignment.center,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
LocalText(context, "rate.total_estimated_amount",
color: primaryColor, fontSize: 16),
Text(
':\$ 41',
style: TextStyle(
color: primaryColor,
fontSize: 16,
),
)
],
),
)) ))
], ],
), ),

View File

@@ -34,6 +34,8 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
TextEditingController _deliveryFee = new TextEditingController(); TextEditingController _deliveryFee = new TextEditingController();
TextEditingController _volumetricRatio = new TextEditingController(); TextEditingController _volumetricRatio = new TextEditingController();
bool _isNew = false;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@@ -89,208 +91,207 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
feeBox, feeBox,
ratioBox, ratioBox,
SizedBox(height: 10), SizedBox(height: 10),
ExpansionTile( // ExpansionTile(
title: Text( // title: Text(
'Cargo Types', // 'Cargo Types',
style: TextStyle( // style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold), // color: primaryColor, fontWeight: FontWeight.bold),
), // ),
children: <Widget>[ // children: <Widget>[
Container( // Container(
child: SingleChildScrollView( // child: SingleChildScrollView(
scrollDirection: Axis.horizontal, // scrollDirection: Axis.horizontal,
child: MyDataTable( // child: MyDataTable(
headingRowHeight: 40, // headingRowHeight: 40,
columnSpacing: 50, // columnSpacing: 50,
columns: [ // columns: [
MyDataColumn( // MyDataColumn(
label: Text("Cargo Type", // label: Text("Cargo Type",
style: TextStyle( // style: TextStyle(
fontSize: 15, // fontSize: 15,
color: Colors.grey[600]))), // color: Colors.grey[600]))),
MyDataColumn( // MyDataColumn(
label: Text("Rate", // label: Text("Rate",
style: TextStyle( // style: TextStyle(
fontSize: 15, // fontSize: 15,
color: Colors.grey[600]))), // color: Colors.grey[600]))),
MyDataColumn( // MyDataColumn(
label: Text("Delete", // label: Text("Delete",
style: TextStyle( // style: TextStyle(
fontSize: 15, // fontSize: 15,
color: Colors.grey[600]))), // color: Colors.grey[600]))),
], // ],
rows: getCargoRows( // rows: getCargoRows(
shipmentRateModel.rate.cargoTypes), // shipmentRateModel.rate.cargoTypes),
), // ),
), // ),
), // ),
Container( // Container(
padding: // padding:
EdgeInsets.only(top: 20, bottom: 15, right: 15), // EdgeInsets.only(top: 20, bottom: 15, right: 15),
child: Align( // child: Align(
alignment: Alignment.bottomRight, // alignment: Alignment.bottomRight,
child: Container( // child: Container(
width: 120, // width: 120,
height: 40, // height: 40,
child: FloatingActionButton.extended( // child: FloatingActionButton.extended(
materialTapTargetSize: // materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap, // MaterialTapTargetSize.shrinkWrap,
icon: Icon(Icons.add), // icon: Icon(Icons.add),
onPressed: () { // onPressed: () {
Navigator.push( // Navigator.push(
context, // context,
CupertinoPageRoute( // CupertinoPageRoute(
builder: (context) => CargoEditor()), // builder: (context) => CargoEditor()),
); // );
}, // },
label: Text( // label: Text(
'Add Cargo', // 'Add Cargo',
style: TextStyle(fontSize: 12), // style: TextStyle(fontSize: 12),
), // ),
backgroundColor: primaryColor, // backgroundColor: primaryColor,
), // ),
), // ),
), // ),
) // )
], // ],
), // ),
ExpansionTile( // ExpansionTile(
title: Text( // title: Text(
'Custom Duties', // 'Custom Duties',
style: TextStyle( // style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold), // color: primaryColor, fontWeight: FontWeight.bold),
), // ),
children: <Widget>[ // children: <Widget>[
Container( // Container(
child: SingleChildScrollView( // child: SingleChildScrollView(
scrollDirection: Axis.horizontal, // scrollDirection: Axis.horizontal,
child: MyDataTable( // child: MyDataTable(
headingRowHeight: 40, // headingRowHeight: 40,
columnSpacing: 50, // columnSpacing: 50,
columns: [ // columns: [
MyDataColumn( // MyDataColumn(
label: Text("Produt Type", // label: Text("Produt Type",
style: TextStyle( // style: TextStyle(
fontSize: 15, // fontSize: 15,
color: Colors.grey[600]))), // color: Colors.grey[600]))),
MyDataColumn( // MyDataColumn(
label: Text("Fee", // label: Text("Fee",
style: TextStyle( // style: TextStyle(
fontSize: 15, // fontSize: 15,
color: Colors.grey[600]))), // color: Colors.grey[600]))),
MyDataColumn( // MyDataColumn(
label: Text("Delete", // label: Text("Delete",
style: TextStyle( // style: TextStyle(
fontSize: 15, // fontSize: 15,
color: Colors.grey[600]))), // color: Colors.grey[600]))),
], // ],
rows: getCustomsRows( // rows: getCustomsRows(
shipmentRateModel.rate.customDuties), // shipmentRateModel.rate.customDuties),
), // ),
), // ),
), // ),
Container( // Container(
padding: // padding:
EdgeInsets.only(top: 20, bottom: 15, right: 15), // EdgeInsets.only(top: 20, bottom: 15, right: 15),
child: Align( // child: Align(
alignment: Alignment.bottomRight, // alignment: Alignment.bottomRight,
child: Container( // child: Container(
width: 120, // width: 120,
height: 40, // height: 40,
child: FloatingActionButton.extended( // child: FloatingActionButton.extended(
materialTapTargetSize: // materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap, // MaterialTapTargetSize.shrinkWrap,
icon: Icon(Icons.add), // icon: Icon(Icons.add),
onPressed: () { // onPressed: () {
Navigator.push( // Navigator.push(
context, // context,
CupertinoPageRoute( // CupertinoPageRoute(
builder: (context) => CustomEditor()), // builder: (context) => CustomEditor()),
); // );
}, // },
label: Text( // label: Text(
'Add Custom\nDuty', // 'Add Custom\nDuty',
style: TextStyle(fontSize: 12), // style: TextStyle(fontSize: 12),
), // ),
backgroundColor: primaryColor, // backgroundColor: primaryColor,
), // ),
), // ),
), // ),
) // )
], // ],
), // ),
ExpansionTile( // ExpansionTile(
title: Text( // title: Text(
'Discounts by weight', // 'Discounts by weight',
style: TextStyle( // style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold), // color: primaryColor, fontWeight: FontWeight.bold),
), // ),
children: <Widget>[ // children: <Widget>[
Container( // Container(
child: SingleChildScrollView( // child: SingleChildScrollView(
scrollDirection: Axis.horizontal, // scrollDirection: Axis.horizontal,
child: MyDataTable( // child: MyDataTable(
headingRowHeight: 40, // headingRowHeight: 40,
columnSpacing: 30, // columnSpacing: 30,
columns: [ // columns: [
MyDataColumn( // MyDataColumn(
label: Text("Weight", // label: Text("Weight",
style: TextStyle( // style: TextStyle(
fontSize: 15, // fontSize: 15,
color: Colors.grey[600]))), // color: Colors.grey[600]))),
MyDataColumn( // MyDataColumn(
label: Text("Discount Rate", // label: Text("Discount Rate",
style: TextStyle( // style: TextStyle(
fontSize: 15, // fontSize: 15,
color: Colors.grey[600]))), // color: Colors.grey[600]))),
MyDataColumn( // MyDataColumn(
label: Text("Delete", // label: Text("Delete",
style: TextStyle( // style: TextStyle(
fontSize: 15, // fontSize: 15,
color: Colors.grey[600]))), // color: Colors.grey[600]))),
], // ],
rows: getDiscounts( // rows: getDiscounts(
shipmentRateModel.rate.discountByWeights), // shipmentRateModel.rate.discountByWeights),
), // ),
), // ),
), // ),
Container( // Container(
padding: // padding:
EdgeInsets.only(top: 20, bottom: 15, right: 15), // EdgeInsets.only(top: 20, bottom: 15, right: 15),
child: Align( // child: Align(
alignment: Alignment.bottomRight, // alignment: Alignment.bottomRight,
child: Container( // child: Container(
width: 130, // width: 130,
height: 40, // height: 40,
child: FloatingActionButton.extended( // child: FloatingActionButton.extended(
materialTapTargetSize: // materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap, // MaterialTapTargetSize.shrinkWrap,
icon: Icon(Icons.add), // icon: Icon(Icons.add),
onPressed: () { // onPressed: () {
Navigator.push( // Navigator.push(
context, // context,
CupertinoPageRoute( // CupertinoPageRoute(
builder: (context) => // builder: (context) =>
DiscountByWeightEditor()), // DiscountByWeightEditor()),
); // );
}, // },
label: Text( // label: Text(
'Add Discount', // 'Add Discount',
style: TextStyle(fontSize: 12), // style: TextStyle(fontSize: 12),
), // ),
backgroundColor: primaryColor, // backgroundColor: primaryColor,
), // ),
), // ),
), // ),
) // )
], // ],
), // ),
], ],
), ),
), ),
fcsButton(context, "Save", callack: () { fcsButton(context, getLocalString(context, "btn.save"),
Navigator.pop(context); callack: _save),
}),
SizedBox(height: 10) SizedBox(height: 10)
], ],
), ),
@@ -299,6 +300,28 @@ 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) { List<MyDataRow> getCargoRows(List<CargoType> cargos) {
return cargos.map((r) { return cargos.map((r) {
return MyDataRow( return MyDataRow(

View File

@@ -252,14 +252,17 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
cells: [ cells: [
MyDataCell(Align( MyDataCell(Align(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: Text("Total", child: LocalText(
style: TextStyle( context,
"shipment.cargo.total",
color: Colors.black87,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
)), ),
)), )),
MyDataCell( MyDataCell(
Padding( Padding(
padding: const EdgeInsets.only(right: 45.0), padding: const EdgeInsets.only(right: 48.0),
child: Align( child: Align(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: Text(total.toString(), child: Text(total.toString(),

View File

@@ -181,6 +181,13 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
selectedValue: _selectedPickupType, selectedValue: _selectedPickupType,
values: pickupModel.pickupTypes, values: pickupModel.pickupTypes,
); );
final createBtn = LocalButton(
textKey: "shipment.create",
);
final updateBtn = LocalButton(
textKey: "shipment.update",
);
return LocalProgress( return LocalProgress(
inAsyncCall: _isLoading, inAsyncCall: _isLoading,
@@ -245,9 +252,7 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
Column( Column(
children: getBoxList(context, boxModel.boxes), children: getBoxList(context, boxModel.boxes),
), ),
LocalButton( _isNew ? createBtn : updateBtn,
textKey: "shipment.new",
),
], ],
), ),
), ),

View File

@@ -2,6 +2,8 @@ import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/shipment/model/shipment_model.dart'; import 'package:fcs/pages/shipment/model/shipment_model.dart';
import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
import 'package:fcs/pages/widgets/local_popup_menu_button.dart';
import 'package:fcs/pages/widgets/local_popupmenu.dart';
import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@@ -19,6 +21,7 @@ class ShipmentList extends StatefulWidget {
class _ShipmentListState extends State<ShipmentList> { class _ShipmentListState extends State<ShipmentList> {
bool _isLoading = false; bool _isLoading = false;
bool _showDelivered = false;
@override @override
void initState() { void initState() {
@@ -33,6 +36,16 @@ class _ShipmentListState extends State<ShipmentList> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var pickupModel = Provider.of<ShipmentModel>(context); var pickupModel = Provider.of<ShipmentModel>(context);
final popupMenu = LocalPopupMenuButton(
popmenus: [
LocalPopupMenu(
id: 1, textKey: "shipment.popupmenu.active", selected: true),
LocalPopupMenu(id: 2, textKey: "shipment.popupmenu.delivered")
],
popupMenuCallback: (p) => this.setState(() {
_showDelivered = p.id == 2;
}),
);
return LocalProgress( return LocalProgress(
inAsyncCall: _isLoading, inAsyncCall: _isLoading,
child: DefaultTabController( child: DefaultTabController(
@@ -56,6 +69,7 @@ class _ShipmentListState extends State<ShipmentList> {
iconSize: 30, iconSize: 30,
// onPressed: () => showPlacesSearch(context), // onPressed: () => showPlacesSearch(context),
), ),
popupMenu
], ],
), ),
floatingActionButton: FloatingActionButton.extended( floatingActionButton: FloatingActionButton.extended(

View File

@@ -62,6 +62,7 @@ class _LengthPickerState extends State<LengthPicker> {
builder: (BuildContext context) { builder: (BuildContext context) {
return LengthPickerDialog( return LengthPickerDialog(
controller: widget.controller, controller: widget.controller,
labelKey: widget.lableKey,
); );
}, },
); );
@@ -70,8 +71,10 @@ class _LengthPickerState extends State<LengthPicker> {
class LengthPickerDialog extends StatefulWidget { class LengthPickerDialog extends StatefulWidget {
final TextEditingController controller; final TextEditingController controller;
final String labelKey;
const LengthPickerDialog({Key key, this.controller}) : super(key: key); const LengthPickerDialog({Key key, this.controller, this.labelKey})
: super(key: key);
@override @override
_LengthPickerDialogState createState() => _LengthPickerDialogState(); _LengthPickerDialogState createState() => _LengthPickerDialogState();
@@ -98,7 +101,7 @@ class _LengthPickerDialogState extends State<LengthPickerDialog> {
title: Center( title: Center(
child: LocalText( child: LocalText(
context, context,
"shipment.box.height", widget.labelKey,
color: primaryColor, color: primaryColor,
fontSize: 16, fontSize: 16,
)), )),

View File

@@ -5,8 +5,17 @@ class PopupMenu {
} }
List<PopupMenu> menuPopup = <PopupMenu>[ List<PopupMenu> menuPopup = <PopupMenu>[
PopupMenu(id: 1, status: "Download Commercial Invoice"), PopupMenu(
PopupMenu(id: 2, status: "Download Packing List"), id: 1,
PopupMenu(id: 3, status: "Download DMS"), status: "FCSshipment.commercial_invoice",
PopupMenu(id: 5, status: "Download Cargo Manifest"), ),
PopupMenu(id: 2, status: "FCSshipment.packing_list"),
PopupMenu(
id: 3,
status: "FCSshipment.dms",
),
PopupMenu(
id: 4,
status: "FCSshipment.cargo_manifest",
),
]; ];