Merge branch 'master' of phyothandar/fcs into master
This commit is contained in:
@@ -358,7 +358,7 @@
|
||||
"invoice.handling_fee":"Handling Fee",
|
||||
"invoice.custom_fee":"Custom Fee",
|
||||
"invoice.custom_fee_desc":"Custom Fee Description",
|
||||
"invoice.discount":"Discounts",
|
||||
"invoice.discount":"Discount Code",
|
||||
"invoice.payment_method":"Payment Method",
|
||||
"invoice.delivery_fee":"Delivery Fee : ",
|
||||
"invoice.payment_attachment":"Payment Attachment",
|
||||
@@ -368,6 +368,14 @@
|
||||
"invoice.btn_save":"Save Invoice",
|
||||
"invoice.btn_payment_receipt":"Attachment Payment Receipt",
|
||||
"invoice.description": "Description",
|
||||
"invoice.box.cargo_type": "Cargo Types",
|
||||
"invoice.cargo_type":"Cargo Types",
|
||||
"invoice.box.number":"Box number",
|
||||
"invoice.box.length":"Length",
|
||||
"invoice.box.width":"Width",
|
||||
"invoice.boc.height":"Height",
|
||||
"invoice.discount_value": "Discount",
|
||||
"invoice.net_amount":"Net Amount",
|
||||
"Invoices End ================================================================":"",
|
||||
|
||||
"Discount Start ================================================================":"",
|
||||
|
||||
@@ -358,7 +358,7 @@
|
||||
"invoice.handling_fee":"ထိန်းသိမ်းခ",
|
||||
"invoice.custom_fee":"ကုန်သွယ်ခွန်",
|
||||
"invoice.custom_fee_desc":"ကုန်သွယ်ခွန်အကြောင်းအရာ",
|
||||
"invoice.discount":"လျှော့စျေး : ",
|
||||
"invoice.discount":"လျှော့စျေးကုဒ်",
|
||||
"invoice.payment_method":"ငွေပေးချေစနစ်",
|
||||
"invoice.delivery_fee":"ပို့ဆောင်ခ",
|
||||
"invoice.payment_attachment":"ပေးချေပြီးဖိုင်များ",
|
||||
@@ -367,7 +367,15 @@
|
||||
"invoice.btn_create":"ငွေတောင်းခံလွှာ ပြုလုပ်ရန်",
|
||||
"invoice.btn_save":"ငွေတောင်းခံလွှာ သိမ်းရန်",
|
||||
"invoice.btn_payment_receipt":"ငွေလက်ခံဖြတ်ပိုင်း ထည့်ရန်",
|
||||
"invoice.description": "အကြောင်းအရာ",
|
||||
"invoice.box.cargo_type": "ကုန်ပစ္စည်းအမျိုးအစားများ",
|
||||
"invoice.description": "ငွေတောင်းခံလွှာအကြောင်းအရာ",
|
||||
"invoice.cargo_type":"Cargo Types",
|
||||
"invoice.box.number":"Box နံပါတ်",
|
||||
"invoice.box.length":"အလျား",
|
||||
"invoice.box.width":"အနံ",
|
||||
"invoice.box.height":"အမြင့်",
|
||||
"invoice.discount_value": "လျှော့စျေး",
|
||||
"invoice.net_amount":"Net Amount",
|
||||
"Invoices End ================================================================":"",
|
||||
|
||||
"Discount Start ================================================================":"",
|
||||
|
||||
@@ -10,10 +10,13 @@ import 'package:fcs/pages/discount/model/discount_model.dart';
|
||||
import 'package:fcs/pages/main/model/language_model.dart';
|
||||
import 'package:fcs/pages/main/model/main_model.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/payment_methods/model/payment_method_model.dart';
|
||||
import 'package:fcs/pages/user_search/user_serach.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||
import 'package:fcs/pages/widgets/discount_dropdown.dart';
|
||||
import 'package:fcs/pages/widgets/display_text.dart';
|
||||
import 'package:fcs/pages/widgets/input_text.dart';
|
||||
import 'package:fcs/pages/widgets/local_dropdown.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/multi_img_controller.dart';
|
||||
import 'package:fcs/pages/widgets/multi_img_file.dart';
|
||||
@@ -38,29 +41,6 @@ class InvoiceEditor extends StatefulWidget {
|
||||
class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
User user;
|
||||
|
||||
List<PaymentMethod> get paymentMethods {
|
||||
List<PaymentMethod> methods = [
|
||||
PaymentMethod(
|
||||
name: 'AYA Bank',
|
||||
accountName: 'FCS',
|
||||
account: '100 23404320548398',
|
||||
phone: '+959123456789',
|
||||
),
|
||||
PaymentMethod(
|
||||
name: 'KBZ Bank',
|
||||
accountName: 'FCS',
|
||||
account: '100 23404320548398',
|
||||
phone: '+959123456789',
|
||||
),
|
||||
PaymentMethod(
|
||||
name: 'PayPal',
|
||||
accountName: 'FCS',
|
||||
link: 'https://www.paypal.com/donate/buttons',
|
||||
),
|
||||
];
|
||||
return methods;
|
||||
}
|
||||
|
||||
var dateFormatter = new DateFormat('dd MMM yyyy');
|
||||
TextEditingController _invoiceNumberController = new TextEditingController();
|
||||
TextEditingController _dateController = new TextEditingController();
|
||||
@@ -83,6 +63,10 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
int customFee = 10;
|
||||
double total = 0;
|
||||
Discount _discount;
|
||||
bool isNew = false;
|
||||
Discount selectedDiscount;
|
||||
int selectedDiscountAmt;
|
||||
PaymentMethod paymentMethod;
|
||||
|
||||
List<Box> selectedBoxes = [];
|
||||
|
||||
@@ -122,6 +106,9 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
_customFeeController.text = '0';
|
||||
_descriptionController.text = '';
|
||||
_balanceController.text = '0';
|
||||
setState(() {
|
||||
isNew = true;
|
||||
});
|
||||
}
|
||||
|
||||
_boxes = [
|
||||
@@ -181,7 +168,19 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
Widget build(BuildContext context) {
|
||||
var mainModel = Provider.of<MainModel>(context);
|
||||
var discountModel = Provider.of<DiscountModel>(context);
|
||||
var languageModel = Provider.of<LanguageModel>(context);
|
||||
var paymentMethodModel = Provider.of<PaymentMethodModel>(context);
|
||||
|
||||
final discountBox = Container(
|
||||
child: DiscountDropdown<Discount>(
|
||||
callback: (v) {
|
||||
setState(() {
|
||||
selectedDiscount = v;
|
||||
});
|
||||
},
|
||||
iconData: Entypo.price_ribbon,
|
||||
selectedValue: selectedDiscount,
|
||||
values: discountModel.discounts,
|
||||
));
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
@@ -214,13 +213,12 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
labelTextKey: 'invoice.number',
|
||||
iconData: FontAwesomeIcons.fileInvoice,
|
||||
text: _invoiceNumberController.text),
|
||||
|
||||
widget.invoice == null
|
||||
? Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: DisplayText(
|
||||
text: user != null ? user.name : "Myo Min",
|
||||
text: user != null ? user.name : "",
|
||||
labelTextKey: "invoice.customer_name",
|
||||
iconData: Feather.user,
|
||||
)),
|
||||
@@ -238,21 +236,37 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
text: _nameController.text,
|
||||
iconData: Feather.user,
|
||||
labelTextKey: 'invoice.customer_name'),
|
||||
|
||||
InputText(
|
||||
controller: _handlingFeeController,
|
||||
iconData: FontAwesomeIcons.moneyBill,
|
||||
labelTextKey: 'invoice.handling_fee'),
|
||||
SizedBox(height: 15),
|
||||
discountBox,
|
||||
widget.invoice == null
|
||||
? Container()
|
||||
: DisplayText(
|
||||
text: _statusController.text,
|
||||
iconData: Icons.av_timer,
|
||||
labelTextKey: 'invoice.status'),
|
||||
|
||||
SizedBox(height: 15),
|
||||
|
||||
LocalText(context, 'invoice.box_info',
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16.0),
|
||||
SizedBox(height: 30),
|
||||
Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(MaterialCommunityIcons.package,
|
||||
color: primaryColor),
|
||||
SizedBox(width: 10),
|
||||
LocalText(
|
||||
context,
|
||||
"invoice.box_info",
|
||||
color: Colors.grey,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.only(top: 15),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: MyDataTable(
|
||||
@@ -265,17 +279,17 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"box.number",
|
||||
"invoice.box.number",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
MyDataColumn(
|
||||
label: Text(
|
||||
getLocalString(context, "box.length") +
|
||||
getLocalString(context, "invoice.box.length") +
|
||||
' x ' +
|
||||
getLocalString(context, "box.width") +
|
||||
getLocalString(context, "invoice.box.width") +
|
||||
' x ' +
|
||||
getLocalString(context, "box.height"),
|
||||
getLocalString(context, "invoice.box.height"),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -283,37 +297,44 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 25),
|
||||
|
||||
Divider(thickness: 1),
|
||||
|
||||
SizedBox(height: 15),
|
||||
|
||||
SizedBox(height: 40),
|
||||
Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(MaterialCommunityIcons.briefcase_check,
|
||||
color: primaryColor),
|
||||
SizedBox(width: 10),
|
||||
LocalText(
|
||||
context,
|
||||
"invoice.cargo_type",
|
||||
color: Colors.grey,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
child: Column(children: getCargoTableByBox(context)),
|
||||
),
|
||||
|
||||
Divider(thickness: 1),
|
||||
|
||||
// InputText(
|
||||
// controller: _handlingFeeController,
|
||||
// iconData: FontAwesomeIcons.moneyBill,
|
||||
// labelTextKey: 'invoice.handling_fee'),
|
||||
|
||||
SizedBox(height: 20),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 5, left: 18),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: LocalText(context, 'invoice.payment_method',
|
||||
fontSize: 16,
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold)),
|
||||
child: LocalText(context, 'invoice.payment_method',
|
||||
fontSize: 16,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
Container(
|
||||
width: 150.0,
|
||||
child: DropdownButtonFormField(
|
||||
items: paymentMethods
|
||||
icon: Icon(Icons.edit),
|
||||
value: paymentMethod,
|
||||
items: paymentMethodModel.paymentMethods
|
||||
.map((e) => DropdownMenuItem(
|
||||
child: Text(e.name), value: e.name))
|
||||
.toList(),
|
||||
@@ -323,97 +344,31 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
],
|
||||
),
|
||||
),
|
||||
// Container(
|
||||
// padding: EdgeInsets.only(top: 5),
|
||||
// child: Row(
|
||||
// children: <Widget>[
|
||||
// Expanded(
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.only(left: 18.0),
|
||||
// child: LocalText(context, 'invoice.delivery_fee',
|
||||
// fontSize: 16,
|
||||
// color: primaryColor,
|
||||
// fontWeight: FontWeight.bold),
|
||||
// )),
|
||||
// Switch(
|
||||
// value: isSwitched,
|
||||
// onChanged: (value) {
|
||||
// setState(() {
|
||||
// isSwitched = value;
|
||||
// if (value) {
|
||||
// deliveryfee = 5;
|
||||
// } else {
|
||||
// deliveryfee = 0;
|
||||
// }
|
||||
// print(isSwitched);
|
||||
// });
|
||||
// },
|
||||
// activeTrackColor: primaryColor.withOpacity(0.8),
|
||||
// activeColor: primaryColor,
|
||||
// ),
|
||||
// Text(
|
||||
// '(' +
|
||||
// getLocalString(context, 'invoice.delivery_fee') +
|
||||
// ' $deliveryfee)',
|
||||
// style: TextStyle(
|
||||
// color: primaryColor,
|
||||
// fontWeight: FontWeight.bold,
|
||||
// fontSize: 12),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 10,
|
||||
// ),
|
||||
|
||||
// ExpansionTile(
|
||||
// title: LocalText(context, 'invoice.payment_attachment',
|
||||
// color: primaryColor,
|
||||
// fontWeight: FontWeight.bold,
|
||||
// fontSize: 16.0),
|
||||
// children: <Widget>[
|
||||
// widget.invoice != null
|
||||
// ? Padding(
|
||||
// padding: EdgeInsets.only(left: 20),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: <Widget>[
|
||||
// Container(
|
||||
// padding: EdgeInsets.only(top: 10),
|
||||
// child: Text(
|
||||
// '${dateFormatter.format(_invoice.receipts[0].date)} ',
|
||||
// style: TextStyle(
|
||||
// color: Colors.black, fontSize: 16),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: 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,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
SizedBox(height: 30),
|
||||
!isNew
|
||||
? Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.receipt, color: primaryColor),
|
||||
SizedBox(width: 10),
|
||||
LocalText(
|
||||
context,
|
||||
"invoice.payment_attachment",
|
||||
color: Colors.grey,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Icon(Icons.add, color: primaryColor),
|
||||
],
|
||||
)
|
||||
: Container()
|
||||
]),
|
||||
)),
|
||||
widget.invoice == null
|
||||
@@ -428,7 +383,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
getLocalString(context, 'invoice.btn_save'))
|
||||
],
|
||||
)),
|
||||
widget.invoice == null
|
||||
isNew
|
||||
? Container()
|
||||
: fcsButton(context,
|
||||
getLocalString(context, 'invoice.btn_payment_receipt'))
|
||||
@@ -441,13 +396,15 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
|
||||
getCargoTableByBox(BuildContext context) {
|
||||
var discountModel = Provider.of<DiscountModel>(context);
|
||||
|
||||
total = 0;
|
||||
List<Widget> dataRow = _cargoTypes.map((cargo) {
|
||||
var amount = cargo.weight * cargo.price;
|
||||
total += amount;
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(bottom: BorderSide(color: Colors.grey))),
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0, right: 5.0, top: 10.0, bottom: 10.0),
|
||||
left: 5.0, right: 5.0, top: 15.0, bottom: 15.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(flex: 2, child: Text('${cargo.type}')),
|
||||
@@ -469,16 +426,19 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
dataRow.insert(
|
||||
0,
|
||||
Container(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0, right: 5.0, top: 15.0, bottom: 15.0),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(bottom: BorderSide(color: Colors.grey))),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(getLocalString(context, 'invoice.description'),
|
||||
child: Text(getLocalString(context, 'invoice.box.cargo_type'),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: primaryColor))),
|
||||
color: Colors.grey))),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
@@ -489,17 +449,18 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: primaryColor))),
|
||||
color: Colors.grey))),
|
||||
Expanded(
|
||||
child: Text(getLocalString(context, 'invoice.amount'),
|
||||
textAlign: TextAlign.end,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: primaryColor)))
|
||||
color: Colors.grey)))
|
||||
],
|
||||
),
|
||||
));
|
||||
|
||||
dataRow.insert(
|
||||
dataRow.length,
|
||||
Container(
|
||||
@@ -508,24 +469,38 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(getLocalString(context, 'invoice.discount'))),
|
||||
flex: 2,
|
||||
child: Center(
|
||||
child: LocalText(
|
||||
context,
|
||||
'invoice.total',
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: 80.0,
|
||||
child: DropdownButtonFormField(
|
||||
items: discountModel.discounts
|
||||
.map((e) => DropdownMenuItem(
|
||||
child: Text(e.code, style: TextStyle(fontSize: 13)),
|
||||
value: e.code))
|
||||
.toList(),
|
||||
onChanged: (selected) {
|
||||
var d = discountModel.discounts
|
||||
.firstWhere((d) => d.code == selected);
|
||||
setState(() {
|
||||
_discount = d;
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
'\$ $total',
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
textAlign: TextAlign.end,
|
||||
))
|
||||
],
|
||||
),
|
||||
));
|
||||
|
||||
dataRow.insert(
|
||||
dataRow.length,
|
||||
Container(
|
||||
padding: const EdgeInsets.only(left: 5.0, right: 5.0, top: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Center(
|
||||
child: LocalText(
|
||||
context,
|
||||
'invoice.discount_value',
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -545,23 +520,18 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
dataRow.length,
|
||||
Container(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0, right: 5.0, top: 10.0, bottom: 10.0),
|
||||
left: 5.0, right: 5.0, top: 20.0, bottom: 0.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(getLocalString(context, 'invoice.custom_fee'))),
|
||||
// Expanded(
|
||||
// child: Text(
|
||||
// '',
|
||||
// )),
|
||||
// Container(
|
||||
// width: 100,
|
||||
// child: InputText(
|
||||
// controller: _customFeeController,
|
||||
// iconData: null,
|
||||
// labelTextKey: 'invoice.custom_fee'),
|
||||
// ),
|
||||
child: Center(
|
||||
child: LocalText(
|
||||
context,
|
||||
'invoice.custom_fee',
|
||||
color: Colors.black,
|
||||
),
|
||||
)),
|
||||
Expanded(
|
||||
child: Text('\$ ${customFee}',
|
||||
textAlign: TextAlign.end,
|
||||
@@ -582,8 +552,15 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(getLocalString(context, 'invoice.delivery_fee'))),
|
||||
flex: 1,
|
||||
child: Container(
|
||||
alignment: Alignment.centerRight,
|
||||
child: LocalText(
|
||||
context,
|
||||
'invoice.delivery_fee',
|
||||
color: Colors.black,
|
||||
),
|
||||
)),
|
||||
Switch(
|
||||
value: isSwitched,
|
||||
onChanged: (value) {
|
||||
@@ -610,6 +587,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
],
|
||||
),
|
||||
));
|
||||
|
||||
dataRow.insert(
|
||||
dataRow.length,
|
||||
Container(
|
||||
@@ -623,6 +601,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
)),
|
||||
],
|
||||
)));
|
||||
|
||||
dataRow.insert(
|
||||
dataRow.length,
|
||||
Container(
|
||||
@@ -630,21 +609,25 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
left: 5.0, right: 5.0, top: 10.0, bottom: 10.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(flex: 1, child: Text('')),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: LocalText(
|
||||
context,
|
||||
'invoice.total',
|
||||
color: Colors.black,
|
||||
child: Center(
|
||||
child: LocalText(
|
||||
context,
|
||||
'invoice.net_amount',
|
||||
color: Colors.black,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'\$ $total',
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
textAlign: TextAlign.end,
|
||||
))
|
||||
child: Text('\$ ${getTotalBalance(total)}',
|
||||
textAlign: TextAlign.end,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: primaryColor)))
|
||||
],
|
||||
),
|
||||
));
|
||||
@@ -656,13 +639,16 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
left: 5.0, right: 5.0, top: 10.0, bottom: 10.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(flex: 1, child: Text('')),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: LocalText(
|
||||
context,
|
||||
'invoice.balance',
|
||||
color: Colors.black,
|
||||
child: Center(
|
||||
child: LocalText(
|
||||
context,
|
||||
'invoice.balance',
|
||||
color: Colors.black,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@@ -690,13 +676,11 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
List<MyDataRow> 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]}');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -72,30 +72,26 @@ class _PaymentPageState extends State<PaymentPage> {
|
||||
backgroundColor: primaryColor,
|
||||
title: Text(AppTranslations.of(context).text("pm_.title")),
|
||||
),
|
||||
body: Card(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Container(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
LocalText(context, 'pm.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(
|
||||
child: Row(
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
LocalText(context, 'pm.total.amount',
|
||||
color: Colors.black, fontSize: 16),
|
||||
Text(
|
||||
' \$ ${_invoice.amount}',
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold),
|
||||
)
|
||||
],
|
||||
)),
|
||||
Container(
|
||||
padding: const EdgeInsets.only(top: 15.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
LocalText(context, 'pm.remaining_balance',
|
||||
color: Colors.black, fontSize: 16),
|
||||
@@ -108,85 +104,68 @@ class _PaymentPageState extends State<PaymentPage> {
|
||||
)
|
||||
],
|
||||
)),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: [
|
||||
ExpansionTile(
|
||||
title: LocalText(context, 'pm.attachment',
|
||||
color: Colors.black, fontSize: 16),
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 20),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 8),
|
||||
child: Text(
|
||||
'${dateFormatter.format(_invoice.receipts[0].date)} ',
|
||||
style: TextStyle(
|
||||
color: Colors.black, fontSize: 16),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: MultiImageFile(
|
||||
enabled: true,
|
||||
controller: multiImgController,
|
||||
title: "Receipt File",
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 25,
|
||||
),
|
||||
],
|
||||
SizedBox(height: 10),
|
||||
Divider(),
|
||||
SizedBox(height: 10),
|
||||
LocalText(context, 'pm.attachment',
|
||||
color: primaryColor, fontSize: 16, fontWeight: FontWeight.bold),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 20, top: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 8),
|
||||
child: Text(
|
||||
'${dateFormatter.format(_invoice.receipts[0].date)} ',
|
||||
style: TextStyle(color: Colors.black, fontSize: 16),
|
||||
),
|
||||
ExpansionTile(
|
||||
title: LocalText(context, 'pm.receipt',
|
||||
color: Colors.black, fontSize: 16),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: MyDataTable(
|
||||
headingRowHeight: 40,
|
||||
columnSpacing: 20,
|
||||
columns: [
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"pm.date",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"pm.amount",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
],
|
||||
rows: getPackageRow(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 25),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: MultiImageFile(
|
||||
enabled: true,
|
||||
controller: multiImgController,
|
||||
title: "Receipt File",
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
saveBox,
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 25),
|
||||
Divider(),
|
||||
SizedBox(height: 10),
|
||||
LocalText(context, 'pm.receipt',
|
||||
color: primaryColor, fontSize: 16, fontWeight: FontWeight.bold),
|
||||
Container(
|
||||
child: MyDataTable(
|
||||
headingRowHeight: 40,
|
||||
columnSpacing: 20,
|
||||
columns: [
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"pm.date",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"pm.amount",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
],
|
||||
rows: getPackageRow(context),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 25),
|
||||
// saveBox,
|
||||
// SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
69
lib/pages/widgets/discount_dropdown.dart
Normal file
69
lib/pages/widgets/discount_dropdown.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
import 'package:fcs/domain/entities/discount.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'local_text.dart';
|
||||
|
||||
class DiscountDropdown<T> extends StatelessWidget {
|
||||
final Function(T) callback;
|
||||
final IconData iconData;
|
||||
final T selectedValue;
|
||||
final List<T> values;
|
||||
|
||||
const DiscountDropdown(
|
||||
{Key key, this.callback, this.iconData, this.selectedValue, this.values})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 5.0, right: 0),
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 0, right: 10),
|
||||
child: Icon(iconData, color: primaryColor),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 18.0),
|
||||
child: LocalText(
|
||||
context,
|
||||
"invoice.discount",
|
||||
color: Colors.black54,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
DropdownButton<T>(
|
||||
isDense: true,
|
||||
value: selectedValue,
|
||||
style: TextStyle(color: Colors.black, fontSize: 14),
|
||||
underline: Container(
|
||||
height: 1,
|
||||
color: primaryColor,
|
||||
),
|
||||
onChanged: (T newValue) {
|
||||
callback(newValue);
|
||||
},
|
||||
isExpanded: true,
|
||||
items: values.map<DropdownMenuItem<T>>((T value) {
|
||||
return DropdownMenuItem<T>(
|
||||
value: value,
|
||||
child: Text(value == null ? "" : (value as Discount).code,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(color: primaryColor)),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user