From 8fbfac38de043411bc20ad5924da117edad9d180 Mon Sep 17 00:00:00 2001 From: PhyoThandar Date: Mon, 29 Jun 2020 16:03:41 +0630 Subject: [PATCH 1/2] modify --- assets/local/localization_en.json | 1 + assets/local/localization_mu.json | 1 + lib/model/main_model.dart | 11 +- lib/pages/invoice/invoice_editor.dart | 391 ++++++++++++++++++----- lib/pages/invoice/invoice_list_row.dart | 100 +++--- lib/pages/invoice/payment_page.dart | 65 ++-- lib/pages/payment_editor.dart | 12 +- lib/pages/payment_method_page.dart | 106 ++---- lib/pages_fcs/package_editor.dart | 173 ++++++++-- lib/pages_fcs/shipping_address_list.dart | 106 ++++++ lib/vo/payment_method.dart | 8 +- 11 files changed, 701 insertions(+), 273 deletions(-) create mode 100644 lib/pages_fcs/shipping_address_list.dart diff --git a/assets/local/localization_en.json b/assets/local/localization_en.json index f2ce227..20e8fbb 100644 --- a/assets/local/localization_en.json +++ b/assets/local/localization_en.json @@ -586,6 +586,7 @@ "payment.attachment":"Payment Attachment", "pdf_view.title":"Payment File", "remaining_balance":"Remaining Balance : ", + "total.amount": "Amount :", "payment.method.btn":"Payment Methods", "payment.method.title":"Payment Methods", diff --git a/assets/local/localization_mu.json b/assets/local/localization_mu.json index 0d24c08..83993ac 100644 --- a/assets/local/localization_mu.json +++ b/assets/local/localization_mu.json @@ -603,6 +603,7 @@ "payment.attachment":"ပေးချေပြီးဖိုင်များ", "pdf_view.title":"ပေးဆောင်ခြင်းဖိုင်", "remaining_balance":"ပေးချေရန်ကျန်ရှိငွေ : ", + "total.amount": "ပမာဏ :", "payment.method.btn":"ငွေပေးချေစနစ်", "payment.method.title":"ငွေပေးချေစနစ်", diff --git a/lib/model/main_model.dart b/lib/model/main_model.dart index 4d5d3e9..730b399 100644 --- a/lib/model/main_model.dart +++ b/lib/model/main_model.dart @@ -86,22 +86,21 @@ class MainModel extends ChangeNotifier { List methods = [ PaymentMethod( name: 'AYA Bank', - accountName: 'AYA Co,Ltd', + accountName: 'FCS', account: '100 23404320548398', phone: '+959123456789', mail: 'aya@gmail.com'), PaymentMethod( name: 'KBZ Bank', - accountName: 'KBZ Co,Ltd', + accountName: 'FCS', account: '100 23404320548398', phone: '+959123456789', mail: 'kbz@gmail.com'), PaymentMethod( name: 'PayPal', - accountName: 'PayPal Co,Ltd', - account: '100 23404320548398', - phone: '+959123456789', - mail: 'paypal@gmail.com'), + accountName: 'FCS', + link: 'https://www.paypal.com/donate/buttons', + ), ]; return methods; } diff --git a/lib/pages/invoice/invoice_editor.dart b/lib/pages/invoice/invoice_editor.dart index 603710d..a4c54e8 100644 --- a/lib/pages/invoice/invoice_editor.dart +++ b/lib/pages/invoice/invoice_editor.dart @@ -40,13 +40,26 @@ class _InvoiceEditorState extends State { TextEditingController _discountController = new TextEditingController(); TextEditingController _amountController = new TextEditingController(); TextEditingController _statusController = new TextEditingController(); + TextEditingController _handlingFeeController = new TextEditingController(); + TextEditingController _customFeeController = new TextEditingController(); MultiImgController multiImgController = MultiImgController(); + TextEditingController _descriptionController = new TextEditingController(); + TextEditingController _balanceController = new TextEditingController(); Invoice _invoice; bool _isLoading = false; List _boxes = []; bool isSwitched = false; String deliveryfee = '\$0'; + List _cargoTypes = [ + Cargo(type: 'General Cargo', weight: 33, price: 6), + Cargo(type: 'Medicine', weight: 33, price: 7), + Cargo(type: 'Dangerous Cargo', weight: 33, price: 8) + ]; + + List _receipts = [ + "assets/photos/amazon_ins.png", + ]; @override void initState() { @@ -57,10 +70,24 @@ class _InvoiceEditorState extends State { _dateController.text = dateFormatter.format(_invoice.invoiceDate); _nameController.text = _invoice.customerName; _phoneController.text = _invoice.customerPhoneNumber; - _amountController.text = _invoice.getAmount.toString(); + // _amountController.text = _invoice.getAmount.toString(); + _amountController.text = _invoice.amount.toString(); _statusController.text = _invoice.status.toString(); + _handlingFeeController.text = '0'; + _customFeeController.text = '0'; + multiImgController.setImageUrls = _receipts; + _descriptionController.text = 'For Electronics goods'; + _balanceController.text = + (_invoice.amount - _invoice.receipts[0].amount).toString(); // _boxes = _invoice.packages; - } else {} + } else { + _dateController.text = dateFormatter.format(DateTime.now()); + _amountController.text = '0'; + _handlingFeeController.text = '0'; + _customFeeController.text = '0'; + _descriptionController.text = ''; + _balanceController.text = '0'; + } _boxes = [ Box( @@ -140,8 +167,22 @@ class _InvoiceEditorState extends State { child: Padding( padding: const EdgeInsets.all(10.0), child: ListView(children: [ - fcsInput('Invoice Date', Icons.date_range, - controller: _dateController), + TextFormField( + controller: _dateController, + readOnly: true, + decoration: InputDecoration( + fillColor: Colors.white, + labelText: 'Invoice Date', + labelStyle: + TextStyle(fontSize: 16,), + filled: true, + enabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, + icon: Icon( + Icons.date_range, + color: primaryColor, + ), + )), widget.invoice == null ? Container() : Container( @@ -152,8 +193,8 @@ class _InvoiceEditorState extends State { decoration: InputDecoration( fillColor: Colors.white, labelText: 'Invoice Number', - labelStyle: - TextStyle(fontSize: 16, color: Colors.grey), + labelStyle: TextStyle( + fontSize: 16,), filled: true, enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, @@ -173,7 +214,7 @@ class _InvoiceEditorState extends State { fillColor: Colors.white, labelText: 'Customer Name', labelStyle: - TextStyle(fontSize: 16, color: Colors.grey), + TextStyle(fontSize: 16,), filled: true, focusedBorder: UnderlineInputBorder( borderSide: BorderSide( @@ -202,7 +243,7 @@ class _InvoiceEditorState extends State { fillColor: Colors.white, labelText: 'Customer Name', labelStyle: TextStyle( - fontSize: 16, color: primaryColor), + fontSize: 16,), filled: true, enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, @@ -236,28 +277,6 @@ class _InvoiceEditorState extends State { // controller: _amountController), // ), - widget.invoice == null - ? Container() - : Container( - padding: EdgeInsets.only(top: 0), - child: TextFormField( - controller: _amountController, - readOnly: true, - decoration: InputDecoration( - fillColor: Colors.white, - labelText: 'Amount', - labelStyle: TextStyle( - fontSize: 16, color: primaryColor), - filled: true, - enabledBorder: InputBorder.none, - focusedBorder: InputBorder.none, - icon: Icon( - FontAwesomeIcons.moneyBill, - color: primaryColor, - ), - )), - ), - widget.invoice == null ? Container() : Container( @@ -269,7 +288,7 @@ class _InvoiceEditorState extends State { fillColor: Colors.white, labelText: 'Status', labelStyle: TextStyle( - fontSize: 16, color: primaryColor), + fontSize: 16, ), filled: true, enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, @@ -280,13 +299,120 @@ class _InvoiceEditorState extends State { )), ), + Container( + padding: EdgeInsets.only(top: 0), + child: TextFormField( + controller: _amountController, + readOnly: true, + decoration: InputDecoration( + fillColor: Colors.white, + labelText: 'Amount', + labelStyle: + TextStyle(fontSize: 16,), + filled: true, + enabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, + icon: Icon( + FontAwesomeIcons.moneyBill, + color: primaryColor, + ), + )), + ), + + Container( + padding: EdgeInsets.only(top: 5), + child: TextFormField( + controller: _balanceController, + readOnly: true, + decoration: InputDecoration( + fillColor: Colors.white, + labelText: 'Balance', + labelStyle: + TextStyle(fontSize: 16, ), + filled: true, + enabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, + icon: Icon( + FontAwesomeIcons.moneyBill, + color: primaryColor, + ), + )), + ), + + Container( + padding: EdgeInsets.only(top: 5), + child: TextFormField( + controller: _handlingFeeController, + readOnly: true, + decoration: InputDecoration( + fillColor: Colors.white, + labelText: 'Handling Fee', + labelStyle: + TextStyle(fontSize: 16,), + filled: true, + enabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, + icon: Icon( + FontAwesomeIcons.moneyBill, + color: primaryColor, + ), + )), + ), + + Container( + padding: EdgeInsets.only(top: 5), + child: TextFormField( + controller: _customFeeController, + readOnly: false, + decoration: InputDecoration( + fillColor: Colors.white, + labelText: 'Customs Fee', + labelStyle: + TextStyle(fontSize: 16,), + filled: true, + icon: Icon( + FontAwesomeIcons.moneyBill, + color: primaryColor, + ), + focusedBorder: UnderlineInputBorder( + borderSide: + BorderSide(color: Colors.grey, width: 1.0)), + )), + ), + + Container( + padding: EdgeInsets.only(top: 5), + child: TextFormField( + controller: _descriptionController, + readOnly: false, + decoration: InputDecoration( + fillColor: Colors.white, + labelText: 'Customs Fee Description', + labelStyle: + TextStyle(fontSize: 16,), + filled: true, + icon: Icon( + Icons.comment, + color: primaryColor, + ), + focusedBorder: UnderlineInputBorder( + borderSide: + BorderSide(color: Colors.grey, width: 1.0)), + )), + ), + Container( padding: EdgeInsets.only(top: 20, left: 18), child: Row( children: [ Expanded( - child: Text('Discounts', - style: TextStyle(fontSize: 16))), + child: Text( + 'Discounts', + style: TextStyle( + fontSize: 16, + color: primaryColor, + fontWeight: FontWeight.bold), + )), Container( width: 150.0, child: DropdownButtonFormField( @@ -306,8 +432,13 @@ class _InvoiceEditorState extends State { child: Row( children: [ Expanded( - child: Text('Payment Method', - style: TextStyle(fontSize: 16))), + child: Text( + 'Payment Method', + style: TextStyle( + fontSize: 16, + color: primaryColor, + fontWeight: FontWeight.bold), + )), Container( width: 150.0, child: DropdownButtonFormField( @@ -330,7 +461,10 @@ class _InvoiceEditorState extends State { padding: const EdgeInsets.only(left: 18.0), child: Text( 'Delivery fee:', - style: TextStyle(fontSize: 16), + style: TextStyle( + fontSize: 16, + color: primaryColor, + fontWeight: FontWeight.bold), ), )), Switch( @@ -349,38 +483,70 @@ class _InvoiceEditorState extends State { activeTrackColor: primaryColor.withOpacity(0.8), activeColor: primaryColor, ), - Text('(Delivery fee : $deliveryfee)',style: TextStyle(color: primaryColor,fontWeight: FontWeight.bold),), + Text( + '(Delivery fee : $deliveryfee)', + style: TextStyle( + color: primaryColor, fontWeight: FontWeight.bold), + ), ], ), ), SizedBox( height: 10, ), + ExpansionTile( - title: Text('Payment Attachment'), + title: Text( + 'Payment Attachment', + style: TextStyle( + color: primaryColor, fontWeight: FontWeight.bold), + ), children: [ - Container( - padding: EdgeInsets.only(left: 20), - child: Row(children: [ - LocalText( - context, - "invoice.payment", - color: Colors.grey, - fontSize: 14, - ), - MultiImageFile( - enabled: true, - controller: multiImgController, - title: "Receipt File", + widget.invoice != null + ? Padding( + padding: EdgeInsets.only(left: 20), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only(top: 10), + child: Text( + '${dateFormatter.format(_invoice.receipts[0].date)} ', + style: TextStyle( + color: Colors.black, fontSize: 16), + ), + ), + Container( + padding: EdgeInsets.only(left: 10), + child: MultiImageFile( + enabled: false, + controller: multiImgController, + title: "Receipt", + )), + Container( + padding: EdgeInsets.only(top: 10, left: 10), + child: Text( + '\$${_invoice.receipts[0].amount} ', + style: TextStyle( + color: Colors.black, fontSize: 16), + ), + ), + ], + ), ) - ])), + : Container(), SizedBox( height: 25, ), ], ), ExpansionTile( - title: Text('Box Information'), + title: Text( + 'Box Information', + style: TextStyle( + color: primaryColor, fontWeight: FontWeight.bold), + ), children: [ Container( child: SingleChildScrollView( @@ -446,9 +612,52 @@ class _InvoiceEditorState extends State { //Cargo Table ExpansionTile( - title: Text('Cargo Table'), - children: getCargoTableByBox(context), - ), + title: Text( + 'Cargo Table', + style: TextStyle( + color: primaryColor, fontWeight: FontWeight.bold), + ), + children: [ + Container( + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: MyDataTable( + headingRowHeight: 40, + columnSpacing: 20, + columns: [ + MyDataColumn( + label: LocalText( + context, + "cargo.type", + color: Colors.grey, + ), + ), + MyDataColumn( + label: LocalText( + context, + "cargo.weight", + color: Colors.grey, + ), + ), + MyDataColumn( + label: LocalText( + context, + "cargo.rate", + color: Colors.grey, + ), + ), + MyDataColumn( + label: LocalText( + context, + "cargo.amount", + color: Colors.grey, + ), + ), + ], + rows: getCargoDataRow(context)), + ), + ), + ]), ]), )), widget.invoice == null @@ -511,23 +720,22 @@ class _InvoiceEditorState extends State { } getCargoTableByBox(BuildContext context) { - return _boxes.map((b) { - return Padding( - padding: const EdgeInsets.all(5.0), - child: Container( - decoration: BoxDecoration( - border: Border.all( - color: Colors.grey[100], - width: 1, - ), + return Padding( + padding: const EdgeInsets.all(5.0), + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey[100], + width: 1, ), - child: Row( - children: [ - Expanded( - child: Container( - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: MyDataTable( + ), + child: Row( + children: [ + Expanded( + child: Container( + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: MyDataTable( headingRowHeight: 40, columnSpacing: 20, columns: [ @@ -560,20 +768,29 @@ class _InvoiceEditorState extends State { ), ), ], - rows: getCargoDataRow(context, b), - ), - ), + rows: getCargoDataRow(context)), ), - ) - ], - ), + ), + ) + ], ), - ); - }).toList(); + ), + ); } List getBoxRow(BuildContext context) { return _boxes.map((p) { + p.cargoTypes.map((cargo) { + print('cargo => $cargo'); + _cargoTypes.asMap().map((index, _cargo) { + if (_cargo.type == cargo.type) { + setState(() { + _cargoTypes[index].weight += cargo.weight; + }); + print('${_cargoTypes[index].type} =>${_cargoTypes[index]}'); + } + }); + }); return MyDataRow( onSelectChanged: (bool selected) {}, cells: [ @@ -600,24 +817,22 @@ class _InvoiceEditorState extends State { }).toList(); } - List getCargoDataRow(BuildContext context, Box box) { - var rate = 5; - return box.cargoTypes.map((p) { - rate++; - var amt = p.weight * rate; + List getCargoDataRow(BuildContext context) { + return _cargoTypes.map((cargo) { + var amt = cargo.weight * cargo.price; return MyDataRow( onSelectChanged: (bool selected) {}, cells: [ MyDataCell(new Text( - p.type, + cargo.type, style: textStyle, )), MyDataCell(new Text( - p.weight.toString(), + cargo.weight.toString(), style: textStyle, )), MyDataCell(new Text( - '\$${rate}', + '\$${cargo.price}', style: textStyle, )), MyDataCell(new Text( diff --git a/lib/pages/invoice/invoice_list_row.dart b/lib/pages/invoice/invoice_list_row.dart index f0972d4..7de114a 100644 --- a/lib/pages/invoice/invoice_list_row.dart +++ b/lib/pages/invoice/invoice_list_row.dart @@ -30,7 +30,6 @@ class _InvoiceListRowState extends State { var dateFormatter = new DateFormat('dd MMM yyyy'); final double dotSize = 15.0; Invoice _invoice = new Invoice(); - // String pdfPath = 'assets/Invoice-A092(A)-32.pdf'; String pdfPath = ''; @override @@ -41,11 +40,12 @@ class _InvoiceListRowState extends State { _invoice = widget.invoice; } - // fromAsset('assets/demo.pdf', 'demo.pdf').then((f) { - // setState(() { - // pdfPath = f.path; - // }); - // }); + fromAsset('assets/Invoice-A092(A)-32.pdf', 'Invoice-A092(A)-32.pdf') + .then((f) { + setState(() { + pdfPath = f.path; + }); + }); } Future fromAsset(String asset, String filename) async { @@ -73,21 +73,21 @@ class _InvoiceListRowState extends State { var owner = Provider.of(context).isOwner(); return Container( padding: EdgeInsets.only(left: 15, right: 15), - child: InkWell( - onTap: () { - owner - ? Navigator.of(context) - .push(BottomUpPageRoute(InvoiceEditor(invoice: _invoice))) - : Navigator.pop(context); - // Navigator.of(context).push(BottomUpPageRoute(PaymentPDFScreen( - // path: pdfPath, - // ))); - }, - child: Row( - children: [ - Expanded( - child: new Padding( - padding: const EdgeInsets.symmetric(vertical: 10.0), + child: Row( + children: [ + Expanded( + child: new Padding( + padding: const EdgeInsets.symmetric(vertical: 10.0), + child: InkWell( + onTap: () { + owner + ? Navigator.of(context).push( + BottomUpPageRoute(InvoiceEditor(invoice: _invoice))) + : Navigator.of(context) + .push(BottomUpPageRoute(PaymentPDFScreen( + path: pdfPath, + ))); + }, child: new Row( children: [ Container( @@ -127,39 +127,39 @@ class _InvoiceListRowState extends State { ), ), ), - Padding( - padding: const EdgeInsets.all(0), - child: getStatus(_invoice.status), - ), - Padding( - padding: const EdgeInsets.only(left: 10.0), - child: InkWell( - child: Icon( - Icons.payment, - color: primaryColor, - ), - onTap: () { - Navigator.of(context) - .push(BottomUpPageRoute(PaymentPage(invoice: _invoice))); - }, + ), + Padding( + padding: const EdgeInsets.all(0), + child: getStatus(_invoice.status), + ), + Padding( + padding: const EdgeInsets.only(left: 10.0), + child: InkWell( + child: Icon( + Icons.payment, + color: primaryColor, ), + onTap: () { + Navigator.of(context) + .push(BottomUpPageRoute(PaymentPage(invoice: _invoice))); + }, ), - Padding( - padding: const EdgeInsets.only(left: 8.0), - child: InkWell( - child: Icon( - Icons.more_vert, - color: primaryColor, - ), - onTap: () { - var act = actionSheet(context); - showCupertinoModalPopup( - context: context, builder: (BuildContext context) => act); - }, + ), + Padding( + padding: const EdgeInsets.only(left: 8.0), + child: InkWell( + child: Icon( + Icons.more_vert, + color: primaryColor, ), + onTap: () { + var act = actionSheet(context); + showCupertinoModalPopup( + context: context, builder: (BuildContext context) => act); + }, ), - ], - ), + ), + ], ), ); } diff --git a/lib/pages/invoice/payment_page.dart b/lib/pages/invoice/payment_page.dart index 5aaff11..105e37a 100644 --- a/lib/pages/invoice/payment_page.dart +++ b/lib/pages/invoice/payment_page.dart @@ -15,8 +15,6 @@ import 'package:flutter_icons/flutter_icons.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; -import 'package:timeline_list/timeline.dart'; -import 'package:timeline_list/timeline_model.dart'; class PaymentPage extends StatefulWidget { final Invoice invoice; @@ -40,9 +38,7 @@ class _PaymentPageState extends State { Invoice _invoice = new Invoice(); bool _isLoading = false; List _receipts = [ - "assets/photos/1.jpg", - "assets/photos/2.jpg", - "assets/photos/3.jpg" + "assets/photos/amazon_ins.png", ]; bool isNew; @@ -50,6 +46,7 @@ class _PaymentPageState extends State { void initState() { if (widget.invoice != null) { _invoice = widget.invoice; + multiImgController.setImageUrls = _receipts; } super.initState(); } @@ -63,8 +60,6 @@ class _PaymentPageState extends State { @override Widget build(BuildContext context) { - var owner = Provider.of(context).isOwner(); - // var images = isNew ? [] : _images; return LocalProgress( inAsyncCall: _isLoading, @@ -81,6 +76,23 @@ class _PaymentPageState extends State { body: Card( child: Column( children: [ + Padding( + padding: const EdgeInsets.all(15.0), + child: Container( + child: Row( + children: [ + LocalText(context, 'total.amount', + color: Colors.black, fontSize: 16), + Text( + ' \$ ${_invoice.amount}', + style: TextStyle( + color: primaryColor, + fontSize: 16, + fontWeight: FontWeight.bold), + ) + ], + )), + ), Padding( padding: const EdgeInsets.all(15.0), child: Container( @@ -89,7 +101,7 @@ class _PaymentPageState extends State { LocalText(context, 'remaining_balance', color: Colors.black, fontSize: 16), Text( - '${_invoice.amount}', + ' \$ ${_invoice.amount - _invoice.receipts[0].amount}', style: TextStyle( color: primaryColor, fontSize: 16, @@ -105,21 +117,30 @@ class _PaymentPageState extends State { title: LocalText(context, 'payment.attachment', color: Colors.black, fontSize: 16), children: [ - Container( - padding: EdgeInsets.only(left: 20), - child: Row(children: [ - LocalText( - context, - "invoice.payment", - color: Colors.grey, - fontSize: 14, + Padding( + padding: EdgeInsets.only(left: 20), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only(top: 8), + child: Text( + '${dateFormatter.format(_invoice.receipts[0].date)} ', + style: TextStyle( + color: Colors.black, fontSize: 16), + ), ), - MultiImageFile( - enabled: true, - controller: multiImgController, - title: "Receipt File", - ) - ])), + Container( + padding: EdgeInsets.only(left: 10), + child: MultiImageFile( + enabled: true, + controller: multiImgController, + title: "Receipt File", + )), + ], + ), + ), SizedBox( height: 25, ), diff --git a/lib/pages/payment_editor.dart b/lib/pages/payment_editor.dart index 11b17f5..43d947a 100644 --- a/lib/pages/payment_editor.dart +++ b/lib/pages/payment_editor.dart @@ -27,6 +27,7 @@ class _PaymentMethodEditorState extends State { TextEditingController _accountNumberController = new TextEditingController(); TextEditingController _mailController = new TextEditingController(); TextEditingController _phoneController = new TextEditingController(); + TextEditingController _linkController = new TextEditingController(); bool isNew = false; @@ -40,6 +41,7 @@ class _PaymentMethodEditorState extends State { _accountNumberController.text = _paymentMethod.account; _mailController.text = _paymentMethod.mail; _phoneController.text = _paymentMethod.phone; + _linkController.text = _paymentMethod.link; } else { isNew = true; _nameController.text = ''; @@ -73,10 +75,12 @@ class _PaymentMethodEditorState extends State { controller: _accountNameController), fcsInput('Account Number', FontAwesomeIcons.moneyBill, controller: _accountNumberController), - fcsInput('E-mail', Icons.mail, - controller: _mailController), - fcsInput('Phone', Icons.phone, - controller: _phoneController) + // fcsInput('E-mail', Icons.mail, + // controller: _mailController), + // fcsInput('Phone', Icons.phone, + // controller: _phoneController), + fcsInput('Phone', Icons.link, + controller: _linkController) ], ), ), diff --git a/lib/pages/payment_method_page.dart b/lib/pages/payment_method_page.dart index 6809e0a..876e1b6 100644 --- a/lib/pages/payment_method_page.dart +++ b/lib/pages/payment_method_page.dart @@ -63,13 +63,6 @@ class _PaymentMethodPageState extends State { child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - // Text( - // 'Account Name: ', - // style: TextStyle( - // color: Colors.black, - // fontWeight: FontWeight.normal, - // fontSize: 15), - // ), Text( method.accountName, style: TextStyle( @@ -80,72 +73,37 @@ class _PaymentMethodPageState extends State { ], ), ), - Padding( - padding: const EdgeInsets.only(left: 8.0, top: 8.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Text( - // 'Account Number: ', - // style: TextStyle( - // color: Colors.black, - // fontWeight: FontWeight.normal, - // fontSize: 15), - // ), - Text( - method.account, - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.normal, - fontSize: 15), - ), - ], - ), - ), - Padding( - padding: const EdgeInsets.only(left: 8.0, top: 8.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Text( - // 'Email: ', - // style: TextStyle( - // color: Colors.black, - // fontWeight: FontWeight.normal, - // fontSize: 15), - // ), - Text( - method.mail, - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.normal, - fontSize: 15), - ), - ], - ), - ), - Padding( - padding: const EdgeInsets.only(left: 8.0, top: 8.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Text( - // 'Phone: ', - // style: TextStyle( - // color: Colors.black, - // fontWeight: FontWeight.normal, - // fontSize: 15), - // ), - Text( - method.phone, - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.normal, - fontSize: 15), - ), - ], - ), - ), + method.account != null + ? Padding( + padding: const EdgeInsets.only(left: 8.0, top: 8.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + method.account, + style: TextStyle( + color: Colors.black, + fontWeight: FontWeight.normal, + fontSize: 15), + ), + ], + ), + ) + : Padding( + padding: const EdgeInsets.only(left: 8.0, top: 8.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + method.link, + style: TextStyle( + color: Colors.black, + fontWeight: FontWeight.normal, + fontSize: 15), + ), + ], + ), + ) ], ), ), @@ -160,7 +118,7 @@ class _PaymentMethodPageState extends State { ); }, icon: Icon(Icons.add), - label: Text(AppTranslations.of(context).text("discount.new")), + label: Text(AppTranslations.of(context).text("payment.method.new")), backgroundColor: primaryColor, ), ), diff --git a/lib/pages_fcs/package_editor.dart b/lib/pages_fcs/package_editor.dart index 02e85ad..423d6ce 100644 --- a/lib/pages_fcs/package_editor.dart +++ b/lib/pages_fcs/package_editor.dart @@ -1,7 +1,9 @@ import 'package:fcs/model/main_model.dart'; import 'package:fcs/model/shipment_model.dart'; import 'package:fcs/pages/barcode_screen_page.dart'; +import 'package:fcs/pages/shipping_address_editor.dart'; import 'package:fcs/pages/util.dart'; +import 'package:fcs/pages_fcs/shipping_address_row.dart'; import 'package:fcs/vo/package.dart'; import 'package:fcs/vo/shipping_address.dart'; import 'package:fcs/widget/bottom_up_page_route.dart'; @@ -17,6 +19,7 @@ import 'package:timeline_list/timeline.dart'; import 'package:timeline_list/timeline_model.dart'; import '../theme/theme.dart'; +import 'shipping_address_list.dart'; class PackageEditor extends StatefulWidget { final Package package; @@ -43,6 +46,13 @@ class _PackageEditorState extends State { "assets/photos/3.jpg" ]; bool isNew; + ShippingAddress shippingAddress = ShippingAddress( + fullName: 'U Nyi Nyi', + addressLine1: '154-19 64th Ave.', + addressLine2: 'Flushing', + city: 'NY', + state: 'NY', + phoneNumber: '+1 (292)215-2247'); @override void initState() { @@ -352,6 +362,7 @@ class _PackageEditorState extends State { ), ], ), + getShippingAddressList(context), isNew ? Container() : ExpansionTile( @@ -373,7 +384,6 @@ class _PackageEditorState extends State { ), ], ), - getShippingAddressList(context), ], ), ), @@ -432,45 +442,152 @@ class _PackageEditorState extends State { color: primaryColor), ), children: [ + // Column( + // children: getAddressList(context, shipmentModel.shippingAddresses), + // ), Container( - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: MyDataTable( - headingRowHeight: 40, - columnSpacing: 50, - columns: [ - MyDataColumn( - label: Text( - "Full Name", - style: TextStyle( - fontSize: 15, - color: Colors.grey[600], + padding: EdgeInsets.only(left: 10, right: 10), + child: Column( + children: [ + Row( + children: [ + Expanded( + child: new Padding( + padding: const EdgeInsets.symmetric(vertical: 10.0), + child: Row( + children: [ + new Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(left: 8.0), + child: new Text( + shippingAddress.fullName == null + ? '' + : shippingAddress.fullName, + style: new TextStyle( + fontSize: 15.0, + color: Colors.black, + fontWeight: FontWeight.bold), + ), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0), + child: new Text( + shippingAddress.addressLine1 == null + ? '' + : shippingAddress.addressLine1, + style: new TextStyle( + fontSize: 14.0, color: Colors.grey), + ), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0), + child: new Text( + shippingAddress.addressLine2 == null + ? '' + : shippingAddress.addressLine2, + style: new TextStyle( + fontSize: 14.0, color: Colors.grey), + ), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0), + child: new Text( + shippingAddress.city == null + ? '' + : shippingAddress.city, + style: new TextStyle( + fontSize: 14.0, color: Colors.grey), + ), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0), + child: new Text( + shippingAddress.state == null + ? '' + : shippingAddress.state, + style: new TextStyle( + fontSize: 14.0, color: Colors.grey), + ), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0), + child: new Text( + shippingAddress.phoneNumber == null + ? '' + : "Phone:${shippingAddress.phoneNumber}", + style: new TextStyle( + fontSize: 14.0, color: Colors.grey), + ), + ), + ], + ), + ], + ), + ), ), - )), - MyDataColumn( - label: Text( - "Phone Number", - style: TextStyle( - fontSize: 15, - color: Colors.grey[600], - ), - )), - ], - rows: getAddressRows(shipmentModel.shippingAddresses), - ), + ], + ), + ], ), ), + 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, + onPressed: () async { + var address = await Navigator.push( + context, + BottomUpPageRoute(ShippingAddressList()), + ); + print('address => ${address}'); + setState(() { + if (address != null) { + this.shippingAddress = address; + } + }); + }, + icon: Icon(Icons.add), + label: Text( + 'Add Shipping\nAddress', + style: TextStyle(fontSize: 12), + ), + backgroundColor: primaryColor, + ), + ), + ), + ) ], ), ); } + List getAddressList( + BuildContext context, List addresses) { + return addresses.asMap().entries.map((s) { + return InkWell( + onTap: () { + Navigator.push( + context, + BottomUpPageRoute(ShippingAddressEditor(shippingAddress: s.value)), + ); + }, + child: ShippingAddressRow(shippingAddress: s.value, index: s.key), + ); + }).toList(); + } + List getAddressRows(List addresses) { return addresses.map((s) { return MyDataRow( - onSelectChanged: (selected) { - - }, + onSelectChanged: (selected) {}, cells: [ MyDataCell( new Text( diff --git a/lib/pages_fcs/shipping_address_list.dart b/lib/pages_fcs/shipping_address_list.dart new file mode 100644 index 0000000..4207516 --- /dev/null +++ b/lib/pages_fcs/shipping_address_list.dart @@ -0,0 +1,106 @@ +import 'package:fcs/model/shipment_model.dart'; + +import 'package:fcs/pages/search_page.dart'; +import 'package:fcs/pages_fcs/shipping_address_row.dart'; +import 'package:fcs/vo/shipping_address.dart'; +import 'package:fcs/widget/bottom_up_page_route.dart'; +import 'package:fcs/widget/localization/app_translations.dart'; +import 'package:fcs/widget/progress.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../theme/theme.dart'; + +class ShippingAddressList extends StatefulWidget { + @override + _ShippingAddressListState createState() => _ShippingAddressListState(); +} + +class _ShippingAddressListState extends State { + bool _isLoading = false; + + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + var shipmentModel = Provider.of(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("shipping_address")), + actions: [ + IconButton( + icon: Icon( + Icons.search, + color: Colors.white, + ), + iconSize: 30, + onPressed: () => showPlacesSearch(context), + ), + ], + ), + body: Column( + children: [ + Expanded( + child: Column( + children: + getAddressList(context, shipmentModel.shippingAddresses), + ), + ), + 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, + onPressed: () { + Navigator.push( + context, + BottomUpPageRoute(ShippingAddressList()), + ); + }, + icon: Icon(Icons.add), + label: Text( + 'Add Shipping\nAddress', + style: TextStyle(fontSize: 12), + ), + backgroundColor: primaryColor, + ), + ), + ), + ), + ], + )), + ); + } + + List getAddressList( + BuildContext context, List addresses) { + return addresses.asMap().entries.map((s) { + return InkWell( + onTap: () { + Navigator.pop(context, s.value); + }, + child: ShippingAddressRow(shippingAddress: s.value, index: s.key), + ); + }).toList(); + } +} diff --git a/lib/vo/payment_method.dart b/lib/vo/payment_method.dart index 07252d4..35c4222 100644 --- a/lib/vo/payment_method.dart +++ b/lib/vo/payment_method.dart @@ -4,7 +4,13 @@ class PaymentMethod { String account; String phone; String mail; + String link; PaymentMethod( - {this.name, this.accountName, this.account, this.phone, this.mail}); + {this.name, + this.accountName, + this.account, + this.phone, + this.mail, + this.link}); } From 8e65a533db8641c7262cccd288d85a7552667251 Mon Sep 17 00:00:00 2001 From: Thinzar Win Date: Mon, 29 Jun 2020 16:15:25 +0630 Subject: [PATCH 2/2] update rate --- assets/local/localization_en.json | 7 +- assets/local/localization_mu.json | 5 +- lib/model/customer_model.dart | 5 +- lib/model/shipment_rate_model.dart | 14 +- lib/model_fcs/box_model.dart | 8 + lib/pages/buying_online.dart | 6 +- lib/pages/custom_editor.dart | 80 ++++++++++ lib/pages/customer_editor.dart | 23 ++- lib/pages/customer_list.dart | 15 ++ lib/pages/discount_by_weight_editor.dart | 81 ++++++++++ lib/pages/home_page.dart | 70 +++++---- lib/pages/home_page_welcome.dart | 69 ++++---- lib/pages/invitation_page.dart | 67 ++++++++ lib/pages/notification_list.dart | 11 +- lib/pages/pickup_box_editor.dart | 25 +-- lib/pages/pickup_editor.dart | 45 ++++-- lib/pages/shipment_rates.dart | 105 +++++++++++-- lib/pages/shipment_rates_calculate.dart | 1 + lib/pages/shipment_rates_edit.dart | 191 ++++++++++++++++++++++- lib/pages/staff_list.dart | 4 +- lib/pages/util.dart | 8 +- lib/pages_fcs/box_editor.dart | 24 +-- lib/vo/box.dart | 2 + lib/vo/custom.dart | 6 + lib/vo/discount.dart | 10 +- 25 files changed, 746 insertions(+), 136 deletions(-) create mode 100644 lib/pages/custom_editor.dart create mode 100644 lib/pages/discount_by_weight_editor.dart create mode 100644 lib/pages/invitation_page.dart create mode 100644 lib/vo/custom.dart diff --git a/assets/local/localization_en.json b/assets/local/localization_en.json index f2ce227..644963b 100644 --- a/assets/local/localization_en.json +++ b/assets/local/localization_en.json @@ -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" } \ No newline at end of file diff --git a/assets/local/localization_mu.json b/assets/local/localization_mu.json index 0d24c08..6908879 100644 --- a/assets/local/localization_mu.json +++ b/assets/local/localization_mu.json @@ -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":"အကောက်ခွန်" } \ No newline at end of file diff --git a/lib/model/customer_model.dart b/lib/model/customer_model.dart index 5e98367..45dc95f 100644 --- a/lib/model/customer_model.dart +++ b/lib/model/customer_model.dart @@ -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 { diff --git a/lib/model/shipment_rate_model.dart b/lib/model/shipment_rate_model.dart index 42bc577..9f80fb9 100644 --- a/lib/model/shipment_rate_model.dart +++ b/lib/model/shipment_rate_model.dart @@ -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 customs = [ + Custom(productType: 'Phone', fee: 40), + Custom(productType: 'Max Book', fee: 40) + ]; + + List discountsByWeight = [ + Discount(weight: 10, discountRate: 3), + Discount(weight: 20, discountRate: 5) + ]; + + int freeDeliveryWeight = 10; void initUser(user) { super.initUser(user); diff --git a/lib/model_fcs/box_model.dart b/lib/model_fcs/box_model.dart index bb39ce3..67f8783 100644 --- a/lib/model_fcs/box_model.dart +++ b/lib/model_fcs/box_model.dart @@ -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', diff --git a/lib/pages/buying_online.dart b/lib/pages/buying_online.dart index a822004..8583efd 100644 --- a/lib/pages/buying_online.dart +++ b/lib/pages/buying_online.dart @@ -167,16 +167,16 @@ class _BuyingOnlinePagetate extends State 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( diff --git a/lib/pages/custom_editor.dart b/lib/pages/custom_editor.dart new file mode 100644 index 0000000..086deec --- /dev/null +++ b/lib/pages/custom_editor.dart @@ -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 { + 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: [ + Expanded( + child: ListView( + children: [ + 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) + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/customer_editor.dart b/lib/pages/customer_editor.dart index ae94389..c67ab45 100644 --- a/lib/pages/customer_editor.dart +++ b/lib/pages/customer_editor.dart @@ -25,6 +25,7 @@ class _CustomerEditorState extends State { TextEditingController _name = new TextEditingController(); TextEditingController _phone = new TextEditingController(); TextEditingController _phoneInput = new TextEditingController(); + TextEditingController _status = new TextEditingController(); final _formKey = GlobalKey(); bool _isLoading = false; @@ -41,6 +42,7 @@ class _CustomerEditorState extends State { 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 { ], ); + 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 { : 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 { if (widget.customer == null) return; var employeeModel = Provider.of(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()); diff --git a/lib/pages/customer_list.dart b/lib/pages/customer_list.dart index dadd357..c2b20f6 100644 --- a/lib/pages/customer_list.dart +++ b/lib/pages/customer_list.dart @@ -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 { 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 { ), ), ), + Padding( + padding: const EdgeInsets.only(right: 10), + child: getStatus(user.status), + ), ], ), ), diff --git a/lib/pages/discount_by_weight_editor.dart b/lib/pages/discount_by_weight_editor.dart new file mode 100644 index 0000000..245c9c5 --- /dev/null +++ b/lib/pages/discount_by_weight_editor.dart @@ -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 { + 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: [ + Expanded( + child: ListView( + children: [ + 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) + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index 5ded79a..d92fcb4 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -211,7 +211,7 @@ class _HomePageState extends State { 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 { children: [ // _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 { } 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: [ - IconButton( - icon: Icon(iconData, color: Colors.white70), - color: Colors.white70, - onPressed: null), - // RaisedButton(onPressed: ()=>{},child: Row( - // children: [ - // 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: [ + IconButton( + icon: Icon(iconData, color: Colors.white70), + color: Colors.white70, + onPressed: null), + // RaisedButton(onPressed: ()=>{},child: Row( + // children: [ + // IconButton( + // icon: Icon(iconData, ), + // onPressed: null), + // Text(text), + // ], + // ),color: Colors.transparent, + // focusColor: Colors.transparent,), + Text( + text, + style: subMenuStyle, + ) + ], ), ); } diff --git a/lib/pages/home_page_welcome.dart b/lib/pages/home_page_welcome.dart index 4a927c4..4c36359 100644 --- a/lib/pages/home_page_welcome.dart +++ b/lib/pages/home_page_welcome.dart @@ -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 { children: [ // _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 { } 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: [ - IconButton( - icon: Icon(iconData, color: Colors.white70), - color: Colors.white70, - onPressed: null), - // RaisedButton(onPressed: ()=>{},child: Row( - // children: [ - // 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: [ + IconButton( + icon: Icon(iconData, color: Colors.white70), + color: Colors.white70, + onPressed: null), + // RaisedButton(onPressed: ()=>{},child: Row( + // children: [ + // IconButton( + // icon: Icon(iconData, ), + // onPressed: null), + // Text(text), + // ], + // ),color: Colors.transparent, + // focusColor: Colors.transparent,), + Text( + text, + style: subMenuStyle, + ) + ], ), ); } diff --git a/lib/pages/invitation_page.dart b/lib/pages/invitation_page.dart new file mode 100644 index 0000000..9d2ba4a --- /dev/null +++ b/lib/pages/invitation_page.dart @@ -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 { + 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: [ + Expanded( + child: ListView( + children: [ + fcsInput("Name", Icons.person, controller: _nameController), + fcsInput("Phone Number", Icons.phone, + controller: _phoneController), + SizedBox(height: 30), + ], + ), + ), + fcsButton(context, "Invite", callack: () {}), + SizedBox(height: 10) + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/notification_list.dart b/lib/pages/notification_list.dart index 9aefaa8..6317876 100644 --- a/lib/pages/notification_list.dart +++ b/lib/pages/notification_list.dart @@ -85,9 +85,7 @@ class _NotificationListState extends State { children: [ 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 { children: [ 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),), ], ), ) diff --git a/lib/pages/pickup_box_editor.dart b/lib/pages/pickup_box_editor.dart index 7eecc75..cc7ce1b 100644 --- a/lib/pages/pickup_box_editor.dart +++ b/lib/pages/pickup_box_editor.dart @@ -42,6 +42,7 @@ class _PickupBoxEditorState extends State { if (widget.box != null) { _box = widget.box; _shippingAddress = _box.shippingAddress; + isNew = false; } else { List packages = [ @@ -61,14 +62,14 @@ class _PickupBoxEditorState extends State { 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 { 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 { 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( diff --git a/lib/pages/pickup_editor.dart b/lib/pages/pickup_editor.dart index 0fb7989..a2d8798 100644 --- a/lib/pages/pickup_editor.dart +++ b/lib/pages/pickup_editor.dart @@ -263,6 +263,25 @@ class _PickUpEditorState extends State { ), ), ), + 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 { 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 { 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), ), diff --git a/lib/pages/shipment_rates.dart b/lib/pages/shipment_rates.dart index b93ad3f..19d1c75 100644 --- a/lib/pages/shipment_rates.dart +++ b/lib/pages/shipment_rates.dart @@ -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 { child: ListView( // crossAxisAlignment: CrossAxisAlignment.center, children: [ + 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 { ); } + List getCargoWidget(List rates) { + return rates.map((cargo) { + return Container( + child: _row( + cargo.description, "\$ " + cargo.price.toString(), 'per pound'), + ); + }).toList(); + } + + List getCustonWidget(List customs) { + return customs.map((c) { + return Container( + child: _row(c.productType, "\$ " + c.fee.toString(), ''), + ); + }).toList(); + } + + List getDiscountWidget(List 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), diff --git a/lib/pages/shipment_rates_calculate.dart b/lib/pages/shipment_rates_calculate.dart index 7d456d0..b16bcee 100644 --- a/lib/pages/shipment_rates_calculate.dart +++ b/lib/pages/shipment_rates_calculate.dart @@ -101,6 +101,7 @@ class _ShipmentRatesCalState extends State { _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( diff --git a/lib/pages/shipment_rates_edit.dart b/lib/pages/shipment_rates_edit.dart index 793f87f..263f03a 100644 --- a/lib/pages/shipment_rates_edit.dart +++ b/lib/pages/shipment_rates_edit.dart @@ -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 { ) ], ), + ExpansionTile( + title: Text( + 'Custom Duties', + style: TextStyle( + color: primaryColor, fontWeight: FontWeight.bold), + ), + children: [ + 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: [ + 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 { }).toList(); } + List getCustomsRows(List 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 getDiscounts(List 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), diff --git a/lib/pages/staff_list.dart b/lib/pages/staff_list.dart index cafd0fb..7659c95 100644 --- a/lib/pages/staff_list.dart +++ b/lib/pages/staff_list.dart @@ -94,9 +94,7 @@ class _StaffListState extends State { children: [ new Text( user.name, - style: new TextStyle( - fontSize: 15.0, - color: primaryColor), + style: new TextStyle(fontSize: 15.0), ), Padding( padding: diff --git a/lib/pages/util.dart b/lib/pages/util.dart index 28f4847..3cb6a6a 100644 --- a/lib/pages/util.dart +++ b/lib/pages/util.dart @@ -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( diff --git a/lib/pages_fcs/box_editor.dart b/lib/pages_fcs/box_editor.dart index 35edd94..4721047 100644 --- a/lib/pages_fcs/box_editor.dart +++ b/lib/pages_fcs/box_editor.dart @@ -82,14 +82,14 @@ class _BoxEditorState extends State { 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 { 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 { 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( diff --git a/lib/vo/box.dart b/lib/vo/box.dart index d619fc7..8855a12 100644 --- a/lib/vo/box.dart +++ b/lib/vo/box.dart @@ -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, diff --git a/lib/vo/custom.dart b/lib/vo/custom.dart new file mode 100644 index 0000000..ed3273e --- /dev/null +++ b/lib/vo/custom.dart @@ -0,0 +1,6 @@ +class Custom{ + String id; + String productType; + int fee; + Custom({this.productType,this.fee}); +} \ No newline at end of file diff --git a/lib/vo/discount.dart b/lib/vo/discount.dart index e8d0de1..a22a0d6 100644 --- a/lib/vo/discount.dart +++ b/lib/vo/discount.dart @@ -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}); }