Merge branch 'master' of phyothandar/fcs into master

This commit is contained in:
2020-06-29 14:21:41 +00:00
committed by Gogs
11 changed files with 701 additions and 273 deletions

View File

@@ -586,6 +586,7 @@
"payment.attachment":"Payment Attachment", "payment.attachment":"Payment Attachment",
"pdf_view.title":"Payment File", "pdf_view.title":"Payment File",
"remaining_balance":"Remaining Balance : ", "remaining_balance":"Remaining Balance : ",
"total.amount": "Amount :",
"payment.method.btn":"Payment Methods", "payment.method.btn":"Payment Methods",
"payment.method.title":"Payment Methods", "payment.method.title":"Payment Methods",

View File

@@ -603,6 +603,7 @@
"payment.attachment":"ပေးချေပြီးဖိုင်များ", "payment.attachment":"ပေးချေပြီးဖိုင်များ",
"pdf_view.title":"ပေးဆောင်ခြင်းဖိုင်", "pdf_view.title":"ပေးဆောင်ခြင်းဖိုင်",
"remaining_balance":"ပေးချေရန်ကျန်ရှိငွေ : ", "remaining_balance":"ပေးချေရန်ကျန်ရှိငွေ : ",
"total.amount": "ပမာဏ :",
"payment.method.btn":"ငွေပေးချေစနစ်", "payment.method.btn":"ငွေပေးချေစနစ်",
"payment.method.title":"ငွေပေးချေစနစ်", "payment.method.title":"ငွေပေးချေစနစ်",

View File

@@ -86,22 +86,21 @@ class MainModel extends ChangeNotifier {
List<PaymentMethod> methods = [ List<PaymentMethod> methods = [
PaymentMethod( PaymentMethod(
name: 'AYA Bank', name: 'AYA Bank',
accountName: 'AYA Co,Ltd', accountName: 'FCS',
account: '100 23404320548398', account: '100 23404320548398',
phone: '+959123456789', phone: '+959123456789',
mail: 'aya@gmail.com'), mail: 'aya@gmail.com'),
PaymentMethod( PaymentMethod(
name: 'KBZ Bank', name: 'KBZ Bank',
accountName: 'KBZ Co,Ltd', accountName: 'FCS',
account: '100 23404320548398', account: '100 23404320548398',
phone: '+959123456789', phone: '+959123456789',
mail: 'kbz@gmail.com'), mail: 'kbz@gmail.com'),
PaymentMethod( PaymentMethod(
name: 'PayPal', name: 'PayPal',
accountName: 'PayPal Co,Ltd', accountName: 'FCS',
account: '100 23404320548398', link: 'https://www.paypal.com/donate/buttons',
phone: '+959123456789', ),
mail: 'paypal@gmail.com'),
]; ];
return methods; return methods;
} }

View File

@@ -40,13 +40,26 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
TextEditingController _discountController = new TextEditingController(); TextEditingController _discountController = new TextEditingController();
TextEditingController _amountController = new TextEditingController(); TextEditingController _amountController = new TextEditingController();
TextEditingController _statusController = new TextEditingController(); TextEditingController _statusController = new TextEditingController();
TextEditingController _handlingFeeController = new TextEditingController();
TextEditingController _customFeeController = new TextEditingController();
MultiImgController multiImgController = MultiImgController(); MultiImgController multiImgController = MultiImgController();
TextEditingController _descriptionController = new TextEditingController();
TextEditingController _balanceController = new TextEditingController();
Invoice _invoice; Invoice _invoice;
bool _isLoading = false; bool _isLoading = false;
List<Box> _boxes = []; List<Box> _boxes = [];
bool isSwitched = false; bool isSwitched = false;
String deliveryfee = '\$0'; String deliveryfee = '\$0';
List<Cargo> _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<String> _receipts = [
"assets/photos/amazon_ins.png",
];
@override @override
void initState() { void initState() {
@@ -57,10 +70,24 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
_dateController.text = dateFormatter.format(_invoice.invoiceDate); _dateController.text = dateFormatter.format(_invoice.invoiceDate);
_nameController.text = _invoice.customerName; _nameController.text = _invoice.customerName;
_phoneController.text = _invoice.customerPhoneNumber; _phoneController.text = _invoice.customerPhoneNumber;
_amountController.text = _invoice.getAmount.toString(); // _amountController.text = _invoice.getAmount.toString();
_amountController.text = _invoice.amount.toString();
_statusController.text = _invoice.status.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; // _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 = [ _boxes = [
Box( Box(
@@ -140,8 +167,22 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
child: Padding( child: Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
child: ListView(children: <Widget>[ child: ListView(children: <Widget>[
fcsInput('Invoice Date', Icons.date_range, TextFormField(
controller: _dateController), 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 widget.invoice == null
? Container() ? Container()
: Container( : Container(
@@ -152,8 +193,8 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
decoration: InputDecoration( decoration: InputDecoration(
fillColor: Colors.white, fillColor: Colors.white,
labelText: 'Invoice Number', labelText: 'Invoice Number',
labelStyle: labelStyle: TextStyle(
TextStyle(fontSize: 16, color: Colors.grey), fontSize: 16,),
filled: true, filled: true,
enabledBorder: InputBorder.none, enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none, focusedBorder: InputBorder.none,
@@ -173,7 +214,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
fillColor: Colors.white, fillColor: Colors.white,
labelText: 'Customer Name', labelText: 'Customer Name',
labelStyle: labelStyle:
TextStyle(fontSize: 16, color: Colors.grey), TextStyle(fontSize: 16,),
filled: true, filled: true,
focusedBorder: UnderlineInputBorder( focusedBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
@@ -202,7 +243,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
fillColor: Colors.white, fillColor: Colors.white,
labelText: 'Customer Name', labelText: 'Customer Name',
labelStyle: TextStyle( labelStyle: TextStyle(
fontSize: 16, color: primaryColor), fontSize: 16,),
filled: true, filled: true,
enabledBorder: InputBorder.none, enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none, focusedBorder: InputBorder.none,
@@ -236,28 +277,6 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
// controller: _amountController), // 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 widget.invoice == null
? Container() ? Container()
: Container( : Container(
@@ -269,7 +288,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
fillColor: Colors.white, fillColor: Colors.white,
labelText: 'Status', labelText: 'Status',
labelStyle: TextStyle( labelStyle: TextStyle(
fontSize: 16, color: primaryColor), fontSize: 16, ),
filled: true, filled: true,
enabledBorder: InputBorder.none, enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none, focusedBorder: InputBorder.none,
@@ -280,13 +299,120 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
)), )),
), ),
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( Container(
padding: EdgeInsets.only(top: 20, left: 18), padding: EdgeInsets.only(top: 20, left: 18),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: Text('Discounts', child: Text(
style: TextStyle(fontSize: 16))), 'Discounts',
style: TextStyle(
fontSize: 16,
color: primaryColor,
fontWeight: FontWeight.bold),
)),
Container( Container(
width: 150.0, width: 150.0,
child: DropdownButtonFormField( child: DropdownButtonFormField(
@@ -306,8 +432,13 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: Text('Payment Method', child: Text(
style: TextStyle(fontSize: 16))), 'Payment Method',
style: TextStyle(
fontSize: 16,
color: primaryColor,
fontWeight: FontWeight.bold),
)),
Container( Container(
width: 150.0, width: 150.0,
child: DropdownButtonFormField( child: DropdownButtonFormField(
@@ -330,7 +461,10 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
padding: const EdgeInsets.only(left: 18.0), padding: const EdgeInsets.only(left: 18.0),
child: Text( child: Text(
'Delivery fee:', 'Delivery fee:',
style: TextStyle(fontSize: 16), style: TextStyle(
fontSize: 16,
color: primaryColor,
fontWeight: FontWeight.bold),
), ),
)), )),
Switch( Switch(
@@ -349,38 +483,70 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
activeTrackColor: primaryColor.withOpacity(0.8), activeTrackColor: primaryColor.withOpacity(0.8),
activeColor: primaryColor, 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( SizedBox(
height: 10, height: 10,
), ),
ExpansionTile( ExpansionTile(
title: Text('Payment Attachment'), title: Text(
'Payment Attachment',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: <Widget>[
widget.invoice != null
? Padding(
padding: EdgeInsets.only(left: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Container( Container(
padding: EdgeInsets.only(left: 20), padding: EdgeInsets.only(top: 10),
child: Row(children: <Widget>[ child: Text(
LocalText( '${dateFormatter.format(_invoice.receipts[0].date)} ',
context, style: TextStyle(
"invoice.payment", color: Colors.black, fontSize: 16),
color: Colors.grey,
fontSize: 14,
), ),
MultiImageFile( ),
enabled: true, Container(
padding: EdgeInsets.only(left: 10),
child: MultiImageFile(
enabled: false,
controller: multiImgController, controller: multiImgController,
title: "Receipt File", 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( SizedBox(
height: 25, height: 25,
), ),
], ],
), ),
ExpansionTile( ExpansionTile(
title: Text('Box Information'), title: Text(
'Box Information',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: <Widget>[ children: <Widget>[
Container( Container(
child: SingleChildScrollView( child: SingleChildScrollView(
@@ -446,9 +612,52 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
//Cargo Table //Cargo Table
ExpansionTile( ExpansionTile(
title: Text('Cargo Table'), title: Text(
children: getCargoTableByBox(context), 'Cargo Table',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
), ),
children: <Widget>[
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 widget.invoice == null
@@ -511,7 +720,6 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
} }
getCargoTableByBox(BuildContext context) { getCargoTableByBox(BuildContext context) {
return _boxes.map((b) {
return Padding( return Padding(
padding: const EdgeInsets.all(5.0), padding: const EdgeInsets.all(5.0),
child: Container( child: Container(
@@ -560,8 +768,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
), ),
), ),
], ],
rows: getCargoDataRow(context, b), rows: getCargoDataRow(context)),
),
), ),
), ),
) )
@@ -569,11 +776,21 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
), ),
), ),
); );
}).toList();
} }
List<MyDataRow> getBoxRow(BuildContext context) { List<MyDataRow> getBoxRow(BuildContext context) {
return _boxes.map((p) { 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( return MyDataRow(
onSelectChanged: (bool selected) {}, onSelectChanged: (bool selected) {},
cells: [ cells: [
@@ -600,24 +817,22 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
}).toList(); }).toList();
} }
List<MyDataRow> getCargoDataRow(BuildContext context, Box box) { List<MyDataRow> getCargoDataRow(BuildContext context) {
var rate = 5; return _cargoTypes.map((cargo) {
return box.cargoTypes.map((p) { var amt = cargo.weight * cargo.price;
rate++;
var amt = p.weight * rate;
return MyDataRow( return MyDataRow(
onSelectChanged: (bool selected) {}, onSelectChanged: (bool selected) {},
cells: [ cells: [
MyDataCell(new Text( MyDataCell(new Text(
p.type, cargo.type,
style: textStyle, style: textStyle,
)), )),
MyDataCell(new Text( MyDataCell(new Text(
p.weight.toString(), cargo.weight.toString(),
style: textStyle, style: textStyle,
)), )),
MyDataCell(new Text( MyDataCell(new Text(
'\$${rate}', '\$${cargo.price}',
style: textStyle, style: textStyle,
)), )),
MyDataCell(new Text( MyDataCell(new Text(

View File

@@ -30,7 +30,6 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
var dateFormatter = new DateFormat('dd MMM yyyy'); var dateFormatter = new DateFormat('dd MMM yyyy');
final double dotSize = 15.0; final double dotSize = 15.0;
Invoice _invoice = new Invoice(); Invoice _invoice = new Invoice();
// String pdfPath = 'assets/Invoice-A092(A)-32.pdf';
String pdfPath = ''; String pdfPath = '';
@override @override
@@ -41,11 +40,12 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
_invoice = widget.invoice; _invoice = widget.invoice;
} }
// fromAsset('assets/demo.pdf', 'demo.pdf').then((f) { fromAsset('assets/Invoice-A092(A)-32.pdf', 'Invoice-A092(A)-32.pdf')
// setState(() { .then((f) {
// pdfPath = f.path; setState(() {
// }); pdfPath = f.path;
// }); });
});
} }
Future<File> fromAsset(String asset, String filename) async { Future<File> fromAsset(String asset, String filename) async {
@@ -73,21 +73,21 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
var owner = Provider.of<MainModel>(context).isOwner(); var owner = Provider.of<MainModel>(context).isOwner();
return Container( return Container(
padding: EdgeInsets.only(left: 15, right: 15), 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( child: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: new Padding( child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0), 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( child: new Row(
children: <Widget>[ children: <Widget>[
Container( Container(
@@ -127,6 +127,7 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
), ),
), ),
), ),
),
Padding( Padding(
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
child: getStatus(_invoice.status), child: getStatus(_invoice.status),
@@ -160,7 +161,6 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
), ),
], ],
), ),
),
); );
} }

View File

@@ -15,8 +15,6 @@ 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:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:timeline_list/timeline.dart';
import 'package:timeline_list/timeline_model.dart';
class PaymentPage extends StatefulWidget { class PaymentPage extends StatefulWidget {
final Invoice invoice; final Invoice invoice;
@@ -40,9 +38,7 @@ class _PaymentPageState extends State<PaymentPage> {
Invoice _invoice = new Invoice(); Invoice _invoice = new Invoice();
bool _isLoading = false; bool _isLoading = false;
List<String> _receipts = [ List<String> _receipts = [
"assets/photos/1.jpg", "assets/photos/amazon_ins.png",
"assets/photos/2.jpg",
"assets/photos/3.jpg"
]; ];
bool isNew; bool isNew;
@@ -50,6 +46,7 @@ class _PaymentPageState extends State<PaymentPage> {
void initState() { void initState() {
if (widget.invoice != null) { if (widget.invoice != null) {
_invoice = widget.invoice; _invoice = widget.invoice;
multiImgController.setImageUrls = _receipts;
} }
super.initState(); super.initState();
} }
@@ -63,8 +60,6 @@ class _PaymentPageState extends State<PaymentPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var owner = Provider.of<MainModel>(context).isOwner();
// var images = isNew ? [] : _images; // var images = isNew ? [] : _images;
return LocalProgress( return LocalProgress(
inAsyncCall: _isLoading, inAsyncCall: _isLoading,
@@ -81,6 +76,23 @@ class _PaymentPageState extends State<PaymentPage> {
body: Card( body: Card(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Padding(
padding: const EdgeInsets.all(15.0),
child: Container(
child: Row(
children: <Widget>[
LocalText(context, 'total.amount',
color: Colors.black, fontSize: 16),
Text(
' \$ ${_invoice.amount}',
style: TextStyle(
color: primaryColor,
fontSize: 16,
fontWeight: FontWeight.bold),
)
],
)),
),
Padding( Padding(
padding: const EdgeInsets.all(15.0), padding: const EdgeInsets.all(15.0),
child: Container( child: Container(
@@ -89,7 +101,7 @@ class _PaymentPageState extends State<PaymentPage> {
LocalText(context, 'remaining_balance', LocalText(context, 'remaining_balance',
color: Colors.black, fontSize: 16), color: Colors.black, fontSize: 16),
Text( Text(
'${_invoice.amount}', ' \$ ${_invoice.amount - _invoice.receipts[0].amount}',
style: TextStyle( style: TextStyle(
color: primaryColor, color: primaryColor,
fontSize: 16, fontSize: 16,
@@ -105,21 +117,30 @@ class _PaymentPageState extends State<PaymentPage> {
title: LocalText(context, 'payment.attachment', title: LocalText(context, 'payment.attachment',
color: Colors.black, fontSize: 16), color: Colors.black, fontSize: 16),
children: <Widget>[ children: <Widget>[
Container( Padding(
padding: EdgeInsets.only(left: 20), padding: EdgeInsets.only(left: 20),
child: Row(children: <Widget>[ child: Row(
LocalText( mainAxisAlignment: MainAxisAlignment.start,
context, crossAxisAlignment: CrossAxisAlignment.start,
"invoice.payment", children: <Widget>[
color: Colors.grey, Container(
fontSize: 14, padding: EdgeInsets.only(top: 8),
child: Text(
'${dateFormatter.format(_invoice.receipts[0].date)} ',
style: TextStyle(
color: Colors.black, fontSize: 16),
), ),
MultiImageFile( ),
Container(
padding: EdgeInsets.only(left: 10),
child: MultiImageFile(
enabled: true, enabled: true,
controller: multiImgController, controller: multiImgController,
title: "Receipt File", title: "Receipt File",
) )),
])), ],
),
),
SizedBox( SizedBox(
height: 25, height: 25,
), ),

View File

@@ -27,6 +27,7 @@ class _PaymentMethodEditorState extends State<PaymentMethodEditor> {
TextEditingController _accountNumberController = new TextEditingController(); TextEditingController _accountNumberController = new TextEditingController();
TextEditingController _mailController = new TextEditingController(); TextEditingController _mailController = new TextEditingController();
TextEditingController _phoneController = new TextEditingController(); TextEditingController _phoneController = new TextEditingController();
TextEditingController _linkController = new TextEditingController();
bool isNew = false; bool isNew = false;
@@ -40,6 +41,7 @@ class _PaymentMethodEditorState extends State<PaymentMethodEditor> {
_accountNumberController.text = _paymentMethod.account; _accountNumberController.text = _paymentMethod.account;
_mailController.text = _paymentMethod.mail; _mailController.text = _paymentMethod.mail;
_phoneController.text = _paymentMethod.phone; _phoneController.text = _paymentMethod.phone;
_linkController.text = _paymentMethod.link;
} else { } else {
isNew = true; isNew = true;
_nameController.text = ''; _nameController.text = '';
@@ -73,10 +75,12 @@ class _PaymentMethodEditorState extends State<PaymentMethodEditor> {
controller: _accountNameController), controller: _accountNameController),
fcsInput('Account Number', FontAwesomeIcons.moneyBill, fcsInput('Account Number', FontAwesomeIcons.moneyBill,
controller: _accountNumberController), controller: _accountNumberController),
fcsInput('E-mail', Icons.mail, // fcsInput('E-mail', Icons.mail,
controller: _mailController), // controller: _mailController),
fcsInput('Phone', Icons.phone, // fcsInput('Phone', Icons.phone,
controller: _phoneController) // controller: _phoneController),
fcsInput('Phone', Icons.link,
controller: _linkController)
], ],
), ),
), ),

View File

@@ -63,13 +63,6 @@ class _PaymentMethodPageState extends State<PaymentMethodPage> {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
// Text(
// 'Account Name: ',
// style: TextStyle(
// color: Colors.black,
// fontWeight: FontWeight.normal,
// fontSize: 15),
// ),
Text( Text(
method.accountName, method.accountName,
style: TextStyle( style: TextStyle(
@@ -80,18 +73,12 @@ class _PaymentMethodPageState extends State<PaymentMethodPage> {
], ],
), ),
), ),
Padding( method.account != null
? Padding(
padding: const EdgeInsets.only(left: 8.0, top: 8.0), padding: const EdgeInsets.only(left: 8.0, top: 8.0),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
// Text(
// 'Account Number: ',
// style: TextStyle(
// color: Colors.black,
// fontWeight: FontWeight.normal,
// fontSize: 15),
// ),
Text( Text(
method.account, method.account,
style: TextStyle( style: TextStyle(
@@ -101,21 +88,14 @@ class _PaymentMethodPageState extends State<PaymentMethodPage> {
), ),
], ],
), ),
), )
Padding( : Padding(
padding: const EdgeInsets.only(left: 8.0, top: 8.0), padding: const EdgeInsets.only(left: 8.0, top: 8.0),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
// Text(
// 'Email: ',
// style: TextStyle(
// color: Colors.black,
// fontWeight: FontWeight.normal,
// fontSize: 15),
// ),
Text( Text(
method.mail, method.link,
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
@@ -123,29 +103,7 @@ class _PaymentMethodPageState extends State<PaymentMethodPage> {
), ),
], ],
), ),
), )
Padding(
padding: const EdgeInsets.only(left: 8.0, top: 8.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
// 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),
),
],
),
),
], ],
), ),
), ),
@@ -160,7 +118,7 @@ class _PaymentMethodPageState extends State<PaymentMethodPage> {
); );
}, },
icon: Icon(Icons.add), icon: Icon(Icons.add),
label: Text(AppTranslations.of(context).text("discount.new")), label: Text(AppTranslations.of(context).text("payment.method.new")),
backgroundColor: primaryColor, backgroundColor: primaryColor,
), ),
), ),

View File

@@ -1,7 +1,9 @@
import 'package:fcs/model/main_model.dart'; import 'package:fcs/model/main_model.dart';
import 'package:fcs/model/shipment_model.dart'; import 'package:fcs/model/shipment_model.dart';
import 'package:fcs/pages/barcode_screen_page.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/util.dart';
import 'package:fcs/pages_fcs/shipping_address_row.dart';
import 'package:fcs/vo/package.dart'; import 'package:fcs/vo/package.dart';
import 'package:fcs/vo/shipping_address.dart'; import 'package:fcs/vo/shipping_address.dart';
import 'package:fcs/widget/bottom_up_page_route.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 'package:timeline_list/timeline_model.dart';
import '../theme/theme.dart'; import '../theme/theme.dart';
import 'shipping_address_list.dart';
class PackageEditor extends StatefulWidget { class PackageEditor extends StatefulWidget {
final Package package; final Package package;
@@ -43,6 +46,13 @@ class _PackageEditorState extends State<PackageEditor> {
"assets/photos/3.jpg" "assets/photos/3.jpg"
]; ];
bool isNew; 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 @override
void initState() { void initState() {
@@ -352,6 +362,7 @@ class _PackageEditorState extends State<PackageEditor> {
), ),
], ],
), ),
getShippingAddressList(context),
isNew isNew
? Container() ? Container()
: ExpansionTile( : ExpansionTile(
@@ -373,7 +384,6 @@ class _PackageEditorState extends State<PackageEditor> {
), ),
], ],
), ),
getShippingAddressList(context),
], ],
), ),
), ),
@@ -432,45 +442,152 @@ class _PackageEditorState extends State<PackageEditor> {
color: primaryColor), color: primaryColor),
), ),
children: <Widget>[ children: <Widget>[
// Column(
// children: getAddressList(context, shipmentModel.shippingAddresses),
// ),
Container( Container(
child: SingleChildScrollView( padding: EdgeInsets.only(left: 10, right: 10),
scrollDirection: Axis.horizontal, child: Column(
child: MyDataTable( children: <Widget>[
headingRowHeight: 40, Row(
columnSpacing: 50, children: <Widget>[
columns: [ Expanded(
MyDataColumn( child: new Padding(
label: Text( padding: const EdgeInsets.symmetric(vertical: 10.0),
"Full Name", child: Row(
style: TextStyle( children: <Widget>[
fontSize: 15, new Column(
color: Colors.grey[600], crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
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<Widget> getAddressList(
BuildContext context, List<ShippingAddress> 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<MyDataRow> getAddressRows(List<ShippingAddress> addresses) { List<MyDataRow> getAddressRows(List<ShippingAddress> addresses) {
return addresses.map((s) { return addresses.map((s) {
return MyDataRow( return MyDataRow(
onSelectChanged: (selected) { onSelectChanged: (selected) {},
},
cells: [ cells: [
MyDataCell( MyDataCell(
new Text( new Text(

View File

@@ -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<ShippingAddressList> {
bool _isLoading = false;
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
var shipmentModel = Provider.of<ShipmentModel>(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: <Widget>[
IconButton(
icon: Icon(
Icons.search,
color: Colors.white,
),
iconSize: 30,
onPressed: () => showPlacesSearch(context),
),
],
),
body: Column(
children: <Widget>[
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<Widget> getAddressList(
BuildContext context, List<ShippingAddress> addresses) {
return addresses.asMap().entries.map((s) {
return InkWell(
onTap: () {
Navigator.pop(context, s.value);
},
child: ShippingAddressRow(shippingAddress: s.value, index: s.key),
);
}).toList();
}
}

View File

@@ -4,7 +4,13 @@ class PaymentMethod {
String account; String account;
String phone; String phone;
String mail; String mail;
String link;
PaymentMethod( PaymentMethod(
{this.name, this.accountName, this.account, this.phone, this.mail}); {this.name,
this.accountName,
this.account,
this.phone,
this.mail,
this.link});
} }