Merge branch 'master' of phyothandar/fcs into master
This commit is contained in:
@@ -378,11 +378,15 @@
|
|||||||
"invoice.box.cargo_type": "Cargo types",
|
"invoice.box.cargo_type": "Cargo types",
|
||||||
"invoice.cargo_type":"Cargo types",
|
"invoice.cargo_type":"Cargo types",
|
||||||
"invoice.box.number":"Carton number",
|
"invoice.box.number":"Carton number",
|
||||||
"invoice.box.length":"Length",
|
"invoice.box.length":"L",
|
||||||
"invoice.box.width":"Width",
|
"invoice.box.width":"W",
|
||||||
"invoice.boc.height":"Height",
|
"invoice.boc.height":"H",
|
||||||
"invoice.discount_value": "Discount",
|
"invoice.discount_value": "Discount",
|
||||||
"invoice.net_amount":"Net Amount",
|
"invoice.net_amount":"Net Amount",
|
||||||
|
"invoice.customer_info":"Customer information",
|
||||||
|
"invoice.pdf": "Invoice PDF",
|
||||||
|
"invoice.total_custom_fee":"Total custom fee",
|
||||||
|
"invoice.shipment_weight":"Shipment weight",
|
||||||
"Invoices End ================================================================":"",
|
"Invoices End ================================================================":"",
|
||||||
|
|
||||||
"Discount Start ================================================================":"",
|
"Discount Start ================================================================":"",
|
||||||
|
|||||||
@@ -378,11 +378,15 @@
|
|||||||
"invoice.description": "ငွေတောင်းခံလွှာအကြောင်းအရာ",
|
"invoice.description": "ငွေတောင်းခံလွှာအကြောင်းအရာ",
|
||||||
"invoice.cargo_type":"Cargo Types",
|
"invoice.cargo_type":"Cargo Types",
|
||||||
"invoice.box.number":"Box နံပါတ်",
|
"invoice.box.number":"Box နံပါတ်",
|
||||||
"invoice.box.length":"အလျား",
|
"invoice.box.length":"L",
|
||||||
"invoice.box.width":"အနံ",
|
"invoice.box.width":"W",
|
||||||
"invoice.box.height":"အမြင့်",
|
"invoice.box.height":"H",
|
||||||
"invoice.discount_value": "လျှော့စျေး",
|
"invoice.discount_value": "လျှော့စျေး",
|
||||||
"invoice.net_amount":"Net Amount",
|
"invoice.net_amount":"Net Amount",
|
||||||
|
"invoice.customer_info":"Customer information",
|
||||||
|
"invoice.pdf": "Invoice PDF",
|
||||||
|
"invoice.total_custom_fee":"အခွန်စုစုပေါင်း",
|
||||||
|
"invoice.shipment_weight":"Shipment weight",
|
||||||
"Invoices End ================================================================":"",
|
"Invoices End ================================================================":"",
|
||||||
|
|
||||||
"Discount Start ================================================================":"",
|
"Discount Start ================================================================":"",
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import 'package:provider/provider.dart';
|
|||||||
import 'discount_editor.dart';
|
import 'discount_editor.dart';
|
||||||
|
|
||||||
class DiscountList extends StatefulWidget {
|
class DiscountList extends StatefulWidget {
|
||||||
|
final bool selected;
|
||||||
|
|
||||||
|
const DiscountList({Key key, this.selected}) : super(key: key);
|
||||||
@override
|
@override
|
||||||
_DiscountListState createState() => _DiscountListState();
|
_DiscountListState createState() => _DiscountListState();
|
||||||
}
|
}
|
||||||
@@ -50,7 +53,9 @@ class _DiscountListState extends State<DiscountList> {
|
|||||||
var discount = discountModel.discounts[index];
|
var discount = discountModel.discounts[index];
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
widget.selected
|
||||||
|
? Navigator.pop(context, discount)
|
||||||
|
: Navigator.push(
|
||||||
context,
|
context,
|
||||||
CupertinoPageRoute(
|
CupertinoPageRoute(
|
||||||
builder: (context) => DiscountEditor(
|
builder: (context) => DiscountEditor(
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ import 'package:fcs/domain/entities/package.dart';
|
|||||||
import 'package:fcs/domain/entities/user.dart';
|
import 'package:fcs/domain/entities/user.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/localization/app_translations.dart';
|
import 'package:fcs/localization/app_translations.dart';
|
||||||
|
import 'package:fcs/pages/invoice/invoice_shipment_list.dart';
|
||||||
import 'package:fcs/pages/invoice/model/invoice_model.dart';
|
import 'package:fcs/pages/invoice/model/invoice_model.dart';
|
||||||
import 'package:fcs/pages/package_search/package_serach.dart';
|
import 'package:fcs/pages/package_search/package_serach.dart';
|
||||||
|
import 'package:fcs/pages/shipment/shipment_list.dart';
|
||||||
import 'package:fcs/pages/user_search/user_serach.dart';
|
import 'package:fcs/pages/user_search/user_serach.dart';
|
||||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||||
import 'package:fcs/pages/widgets/local_text.dart';
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
@@ -93,48 +95,6 @@ class _InvoiceListState extends State<InvoiceList> {
|
|||||||
|
|
||||||
_newInvoice() {
|
_newInvoice() {
|
||||||
Navigator.of(context)
|
Navigator.of(context)
|
||||||
.push(CupertinoPageRoute(builder: (context) => InvoiceEditor()));
|
.push(CupertinoPageRoute(builder: (context) => InvoiceShipmentList()));
|
||||||
}
|
|
||||||
|
|
||||||
Widget _pending() {
|
|
||||||
var invoiceModel = Provider.of<InvoiceModel>(context);
|
|
||||||
return Column(
|
|
||||||
children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: new ListView.separated(
|
|
||||||
separatorBuilder: (context, index) => Divider(
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
scrollDirection: Axis.vertical,
|
|
||||||
padding: EdgeInsets.only(top: 15),
|
|
||||||
shrinkWrap: true,
|
|
||||||
itemCount: invoiceModel.pending.length,
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
return InvoiceListRow(invoice: invoiceModel.pending[index]);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _paided() {
|
|
||||||
var invoiceModel = Provider.of<InvoiceModel>(context);
|
|
||||||
return Column(
|
|
||||||
children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: new ListView.separated(
|
|
||||||
separatorBuilder: (context, index) => Divider(
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
scrollDirection: Axis.vertical,
|
|
||||||
padding: EdgeInsets.only(top: 15),
|
|
||||||
shrinkWrap: true,
|
|
||||||
itemCount: invoiceModel.paided.length,
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
return InvoiceListRow(invoice: invoiceModel.paided[index]);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
148
lib/pages/invoice/invoice_customer_list.dart
Normal file
148
lib/pages/invoice/invoice_customer_list.dart
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
import 'package:fcs/domain/entities/user.dart';
|
||||||
|
import 'package:fcs/helpers/theme.dart';
|
||||||
|
import 'package:fcs/pages/customer/customer_editor.dart';
|
||||||
|
import 'package:fcs/pages/customer/model/customer_model.dart';
|
||||||
|
import 'package:fcs/pages/invoice/invoice_editor.dart';
|
||||||
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
|
import 'package:fcs/pages/widgets/progress.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class InvoiceCustomerList extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_InvoiceCustomerListState createState() => _InvoiceCustomerListState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _InvoiceCustomerListState extends State<InvoiceCustomerList> {
|
||||||
|
var dateFormatter = new DateFormat('dd MMM yyyy - hh:mm:ss a');
|
||||||
|
final double dotSize = 15.0;
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
var customerModel = Provider.of<CustomerModel>(context);
|
||||||
|
|
||||||
|
return LocalProgress(
|
||||||
|
inAsyncCall: _isLoading,
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
|
leading: new IconButton(
|
||||||
|
icon: new Icon(CupertinoIcons.back),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
title: LocalText(
|
||||||
|
context,
|
||||||
|
"customer.list.title",
|
||||||
|
fontSize: 20,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: ListView.separated(
|
||||||
|
separatorBuilder: (context, index) => Divider(
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: customerModel.customers.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
User customer = customerModel.customers[index];
|
||||||
|
return _item(customer);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _item(User customer) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).push(CupertinoPageRoute(
|
||||||
|
builder: (context) => InvoiceEditor(customer: customer)));
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 12.0, right: 12),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: new Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 2.0),
|
||||||
|
child: new Row(
|
||||||
|
children: <Widget>[
|
||||||
|
InkWell(
|
||||||
|
onTap: () => _select(customer),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(5.0),
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 10.0, right: 10, top: 6, bottom: 6),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: primaryColor,
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(35.0))),
|
||||||
|
child: Text(
|
||||||
|
customer.initial,
|
||||||
|
style: TextStyle(fontSize: 30, color: Colors.white),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
new Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: new Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 2.0),
|
||||||
|
child: new Text(
|
||||||
|
customer.name,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 20.0, color: primaryColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 2.0),
|
||||||
|
child: new Text(
|
||||||
|
customer.getLastMessage,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 15.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 5),
|
||||||
|
child: Text(customer.getLastMessageTime),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_select(User customer) {
|
||||||
|
Navigator.of(context).push(CupertinoPageRoute(
|
||||||
|
builder: (context) => CustomerEditor(customer: customer)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,20 +1,24 @@
|
|||||||
import 'package:fcs/domain/entities/box.dart';
|
import 'package:fcs/domain/entities/box.dart';
|
||||||
import 'package:fcs/domain/entities/cargo.dart';
|
import 'package:fcs/domain/entities/cargo.dart';
|
||||||
|
import 'package:fcs/domain/entities/custom.dart';
|
||||||
import 'package:fcs/domain/entities/discount.dart';
|
import 'package:fcs/domain/entities/discount.dart';
|
||||||
import 'package:fcs/domain/entities/invoice.dart';
|
import 'package:fcs/domain/entities/invoice.dart';
|
||||||
import 'package:fcs/domain/entities/payment_method.dart';
|
import 'package:fcs/domain/entities/payment_method.dart';
|
||||||
import 'package:fcs/domain/entities/user.dart';
|
import 'package:fcs/domain/entities/user.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/localization/app_translations.dart';
|
import 'package:fcs/localization/app_translations.dart';
|
||||||
|
import 'package:fcs/pages/discount/discount_list.dart';
|
||||||
import 'package:fcs/pages/discount/model/discount_model.dart';
|
import 'package:fcs/pages/discount/model/discount_model.dart';
|
||||||
import 'package:fcs/pages/main/model/language_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/model/main_model.dart';
|
||||||
import 'package:fcs/pages/main/util.dart';
|
import 'package:fcs/pages/main/util.dart';
|
||||||
import 'package:fcs/pages/payment_methods/model/payment_method_model.dart';
|
import 'package:fcs/pages/payment_methods/model/payment_method_model.dart';
|
||||||
|
import 'package:fcs/pages/rates/custom_list.dart';
|
||||||
import 'package:fcs/pages/user_search/user_serach.dart';
|
import 'package:fcs/pages/user_search/user_serach.dart';
|
||||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||||
import 'package:fcs/pages/widgets/discount_dropdown.dart';
|
import 'package:fcs/pages/widgets/discount_dropdown.dart';
|
||||||
import 'package:fcs/pages/widgets/display_text.dart';
|
import 'package:fcs/pages/widgets/display_text.dart';
|
||||||
|
import 'package:fcs/pages/widgets/fcs_id_icon.dart';
|
||||||
import 'package:fcs/pages/widgets/input_text.dart';
|
import 'package:fcs/pages/widgets/input_text.dart';
|
||||||
import 'package:fcs/pages/widgets/local_dropdown.dart';
|
import 'package:fcs/pages/widgets/local_dropdown.dart';
|
||||||
import 'package:fcs/pages/widgets/local_text.dart';
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
@@ -34,7 +38,8 @@ import 'box_addition.dart';
|
|||||||
|
|
||||||
class InvoiceEditor extends StatefulWidget {
|
class InvoiceEditor extends StatefulWidget {
|
||||||
final Invoice invoice;
|
final Invoice invoice;
|
||||||
InvoiceEditor({this.invoice});
|
final User customer;
|
||||||
|
InvoiceEditor({this.invoice, this.customer});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_InvoiceEditorState createState() => _InvoiceEditorState();
|
_InvoiceEditorState createState() => _InvoiceEditorState();
|
||||||
@@ -63,14 +68,17 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
bool isSwitched = false;
|
bool isSwitched = false;
|
||||||
int deliveryfee = 0;
|
int deliveryfee = 0;
|
||||||
int customFee = 10;
|
int customFee = 10;
|
||||||
|
int handlingFee = 0;
|
||||||
double total = 0;
|
double total = 0;
|
||||||
Discount _discount;
|
Discount _discount;
|
||||||
bool isNew = false;
|
bool isNew = false;
|
||||||
Discount selectedDiscount;
|
Discount selectedDiscount;
|
||||||
int selectedDiscountAmt;
|
int selectedDiscountAmt;
|
||||||
PaymentMethod paymentMethod;
|
PaymentMethod paymentMethod;
|
||||||
|
double volumetricRatio = 0;
|
||||||
|
|
||||||
List<Box> selectedBoxes = [];
|
List<Box> selectedBoxes = [];
|
||||||
|
List<Custom> customs = [];
|
||||||
|
|
||||||
List<Cargo> _cargoTypes = [
|
List<Cargo> _cargoTypes = [
|
||||||
Cargo(type: 'General Cargo', weight: 33, price: 6),
|
Cargo(type: 'General Cargo', weight: 33, price: 6),
|
||||||
@@ -85,6 +93,10 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
volumetricRatio =
|
||||||
|
Provider.of<MainModel>(context, listen: false).setting.volumetricRatio;
|
||||||
|
|
||||||
if (widget.invoice != null) {
|
if (widget.invoice != null) {
|
||||||
_invoice = widget.invoice;
|
_invoice = widget.invoice;
|
||||||
_invoiceNumberController.text = _invoice.invoiceNumber;
|
_invoiceNumberController.text = _invoice.invoiceNumber;
|
||||||
@@ -108,6 +120,10 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
_customFeeController.text = '0';
|
_customFeeController.text = '0';
|
||||||
_descriptionController.text = '';
|
_descriptionController.text = '';
|
||||||
_balanceController.text = '0';
|
_balanceController.text = '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (widget.customer != null) {
|
||||||
|
user = widget.customer;
|
||||||
setState(() {
|
setState(() {
|
||||||
isNew = true;
|
isNew = true;
|
||||||
});
|
});
|
||||||
@@ -172,17 +188,33 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
var discountModel = Provider.of<DiscountModel>(context);
|
var discountModel = Provider.of<DiscountModel>(context);
|
||||||
var paymentMethodModel = Provider.of<PaymentMethodModel>(context);
|
var paymentMethodModel = Provider.of<PaymentMethodModel>(context);
|
||||||
|
|
||||||
final discountBox = Container(
|
final nameBox = DisplayText(
|
||||||
child: DiscountDropdown<Discount>(
|
iconData: Feather.user,
|
||||||
callback: (v) {
|
labelTextKey: 'invoice.customer_name',
|
||||||
|
text: user != null ? user.name : '');
|
||||||
|
|
||||||
|
final statusBox = DisplayText(
|
||||||
|
text: _statusController.text,
|
||||||
|
iconData: Icons.av_timer,
|
||||||
|
labelTextKey: 'invoice.status');
|
||||||
|
|
||||||
|
final fcsIDBox = Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: DisplayText(
|
||||||
|
text: user != null ? user.fcsID : "",
|
||||||
|
labelTextKey: "box.fcs.id",
|
||||||
|
icon: FcsIDIcon(),
|
||||||
|
)),
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.search, color: primaryColor),
|
||||||
|
onPressed: () => searchUser(context, callbackUserSelect: (u) {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedDiscount = v;
|
this.user = u;
|
||||||
});
|
});
|
||||||
},
|
})),
|
||||||
iconData: Entypo.price_ribbon,
|
],
|
||||||
selectedValue: selectedDiscount,
|
);
|
||||||
values: discountModel.discounts,
|
|
||||||
));
|
|
||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
@@ -202,7 +234,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
LocalTitle(textKey: "package.create.name"),
|
LocalTitle(textKey: "invoice.customer_info"),
|
||||||
DisplayText(
|
DisplayText(
|
||||||
labelTextKey: 'invoice.date',
|
labelTextKey: 'invoice.date',
|
||||||
iconData: Icons.date_range,
|
iconData: Icons.date_range,
|
||||||
@@ -213,73 +245,27 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
labelTextKey: 'invoice.number',
|
labelTextKey: 'invoice.number',
|
||||||
iconData: FontAwesomeIcons.fileInvoice,
|
iconData: FontAwesomeIcons.fileInvoice,
|
||||||
text: _invoiceNumberController.text),
|
text: _invoiceNumberController.text),
|
||||||
widget.invoice == null
|
fcsIDBox,
|
||||||
? Row(
|
nameBox,
|
||||||
children: <Widget>[
|
isNew ? statusBox : Container(),
|
||||||
Expanded(
|
SizedBox(height: 20),
|
||||||
child: DisplayText(
|
LocalTitle(textKey: "invoice.box_info"),
|
||||||
text: user != null ? user.name : "",
|
Center(child: Column(children: getCartonRows(context))),
|
||||||
labelTextKey: "invoice.customer_name",
|
SizedBox(height: 20),
|
||||||
iconData: Feather.user,
|
LocalTitle(
|
||||||
)),
|
textKey: "invoice.custom_fee",
|
||||||
IconButton(
|
trailing: IconButton(
|
||||||
icon: Icon(Icons.search, color: primaryColor),
|
icon: Icon(Icons.add_circle, color: primaryColor),
|
||||||
onPressed: () =>
|
onPressed: () async {
|
||||||
searchUser(context, callbackUserSelect: (u) {
|
Custom custom = await Navigator.of(context).push(
|
||||||
|
CupertinoPageRoute(
|
||||||
|
builder: (context) => CustomList()));
|
||||||
setState(() {
|
setState(() {
|
||||||
this.user = u;
|
if (custom != null) customs.add(custom);
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
],
|
Column(children: getCustomFeeRows(context)),
|
||||||
)
|
SizedBox(height: 20),
|
||||||
: DisplayText(
|
|
||||||
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: 30),
|
|
||||||
LocalTitle(textKey: "invoice.box_info"),
|
|
||||||
SingleChildScrollView(
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
child: MyDataTable(
|
|
||||||
headingRowHeight: 40,
|
|
||||||
// columnSpacing: 20,
|
|
||||||
columns: [
|
|
||||||
MyDataColumn(
|
|
||||||
label: Text(''),
|
|
||||||
),
|
|
||||||
MyDataColumn(
|
|
||||||
label: LocalText(
|
|
||||||
context,
|
|
||||||
"invoice.box.number",
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
MyDataColumn(
|
|
||||||
label: Text(
|
|
||||||
getLocalString(context, "invoice.box.length") +
|
|
||||||
' x ' +
|
|
||||||
getLocalString(context, "invoice.box.width") +
|
|
||||||
' x ' +
|
|
||||||
getLocalString(context, "invoice.box.height"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
rows: getBoxRow(context),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 40),
|
|
||||||
LocalTitle(textKey: "invoice.cargo_type"),
|
LocalTitle(textKey: "invoice.cargo_type"),
|
||||||
Column(children: getCargoTableByBox(context)),
|
Column(children: getCargoTableByBox(context)),
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
@@ -296,7 +282,10 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
Container(
|
Container(
|
||||||
width: 150.0,
|
width: 150.0,
|
||||||
child: DropdownButtonFormField(
|
child: DropdownButtonFormField(
|
||||||
icon: Icon(Icons.edit),
|
icon: Icon(
|
||||||
|
Icons.edit,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
value: paymentMethod,
|
value: paymentMethod,
|
||||||
items: paymentMethodModel.paymentMethods
|
items: paymentMethodModel.paymentMethods
|
||||||
.map((e) => DropdownMenuItem(
|
.map((e) => DropdownMenuItem(
|
||||||
@@ -308,31 +297,12 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 30),
|
SizedBox(height: 20),
|
||||||
!isNew
|
LocalTitle(
|
||||||
? Row(
|
textKey: "invoice.payment_attachment",
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
trailing: IconButton(
|
||||||
children: [
|
icon: Icon(Icons.add_circle, color: primaryColor),
|
||||||
Container(
|
onPressed: () async {})),
|
||||||
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
|
widget.invoice == null
|
||||||
? fcsButton(
|
? fcsButton(
|
||||||
context, getLocalString(context, 'invoice.btn_create'))
|
context, getLocalString(context, 'invoice.btn_create'))
|
||||||
@@ -356,6 +326,168 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCartonRows(BuildContext context) {
|
||||||
|
List<Widget> dataRow = [];
|
||||||
|
|
||||||
|
dataRow = _boxes.map((box) {
|
||||||
|
return Container(
|
||||||
|
height: 50,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(bottom: BorderSide(color: Colors.grey))),
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(left: 5.0, right: 5.0, top: 5.0, bottom: 5.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 33,
|
||||||
|
child: Checkbox(
|
||||||
|
value: true, onChanged: (v) {}, activeColor: primaryColor),
|
||||||
|
),
|
||||||
|
Expanded(flex: 1, child: Text(box.packageNumber)),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Text(
|
||||||
|
box.length == null
|
||||||
|
? ""
|
||||||
|
: box.length.toString() +
|
||||||
|
' x ' +
|
||||||
|
box.length.toString() +
|
||||||
|
' x ' +
|
||||||
|
box.height.toString(),
|
||||||
|
textAlign: TextAlign.center)),
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
box.getShipmentWeight(volumetricRatio).toString()))),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
dataRow.insert(
|
||||||
|
0,
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(bottom: BorderSide(color: Colors.grey))),
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 5.0, right: 5.0, top: 5.0, bottom: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(width: 33),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Center(
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
"invoice.box.number",
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Center(
|
||||||
|
child: Text('L x W x H',
|
||||||
|
style: TextStyle(color: Colors.grey)))),
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Center(
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
"invoice.shipment_weight",
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
return dataRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCustomFeeRows(BuildContext context) {
|
||||||
|
customFee = 0;
|
||||||
|
List<Widget> dataRow = [];
|
||||||
|
|
||||||
|
dataRow = customs.map((custom) {
|
||||||
|
customFee += custom.fee;
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(bottom: BorderSide(color: Colors.grey))),
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(left: 5.0, right: 5.0, top: 5.0, bottom: 5.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(flex: 2, child: Text('${custom.productType}')),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Text('\$ ${custom.fee}', textAlign: TextAlign.center)),
|
||||||
|
Expanded(
|
||||||
|
child: IconButton(
|
||||||
|
icon: Icon(Icons.remove_circle, color: primaryColor),
|
||||||
|
onPressed: () {
|
||||||
|
customs.remove(custom);
|
||||||
|
}))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
dataRow.insert(
|
||||||
|
0,
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(bottom: BorderSide(color: Colors.grey))),
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 5.0, right: 5.0, top: 15.0, bottom: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Text('Product', style: TextStyle(color: Colors.grey))),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Text('Fee',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(color: Colors.grey))),
|
||||||
|
Expanded(flex: 1, child: Container())
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
dataRow.insert(
|
||||||
|
dataRow.length,
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 5.0, right: 5.0, top: 15.0, bottom: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Center(
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
'invoice.total_custom_fee',
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Center(
|
||||||
|
child: Text('\$ $customFee',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold)))),
|
||||||
|
Expanded(
|
||||||
|
child: Container(),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
return dataRow;
|
||||||
|
}
|
||||||
|
|
||||||
getCargoTableByBox(BuildContext context) {
|
getCargoTableByBox(BuildContext context) {
|
||||||
var discountModel = Provider.of<DiscountModel>(context);
|
var discountModel = Provider.of<DiscountModel>(context);
|
||||||
total = 0;
|
total = 0;
|
||||||
@@ -431,8 +563,9 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 1,
|
||||||
child: Center(
|
child: Container(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
child: LocalText(
|
child: LocalText(
|
||||||
context,
|
context,
|
||||||
'invoice.total',
|
'invoice.total',
|
||||||
@@ -440,6 +573,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
SizedBox(width: 40),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
'\$ $total',
|
'\$ $total',
|
||||||
@@ -453,12 +587,13 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
dataRow.insert(
|
dataRow.insert(
|
||||||
dataRow.length,
|
dataRow.length,
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.only(left: 5.0, right: 5.0, top: 10),
|
padding: const EdgeInsets.only(left: 5.0, right: 5.0, top: 0),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 1,
|
||||||
child: Center(
|
child: Container(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
child: LocalText(
|
child: LocalText(
|
||||||
context,
|
context,
|
||||||
'invoice.discount_value',
|
'invoice.discount_value',
|
||||||
@@ -466,9 +601,20 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
new IconButton(
|
||||||
|
icon: Icon(Icons.search, color: primaryColor),
|
||||||
|
onPressed: () async {
|
||||||
|
Discount discount = await Navigator.of(context).push(
|
||||||
|
CupertinoPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
DiscountList(selected: true)));
|
||||||
|
setState(() {
|
||||||
|
if (discount != null) _discount = discount;
|
||||||
|
});
|
||||||
|
}),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
'\$ ${_discount != null ? _discount.amount.toInt() : 0}',
|
'\$ ( ${_discount != null ? _discount.amount.toInt() : 0} )',
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
@@ -482,18 +628,21 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
dataRow.length,
|
dataRow.length,
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 5.0, right: 5.0, top: 20.0, bottom: 0.0),
|
left: 5.0, right: 5.0, top: 10.0, bottom: 0.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 1,
|
||||||
child: Center(
|
child: Container(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
child: LocalText(
|
child: LocalText(
|
||||||
context,
|
context,
|
||||||
'invoice.custom_fee',
|
'invoice.custom_fee',
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 40),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text('\$ ${customFee}',
|
child: Text('\$ ${customFee}',
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
@@ -506,6 +655,37 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
dataRow.insert(
|
||||||
|
dataRow.length,
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(left: 5.0, right: 5.0, top: 20.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Container(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
'invoice.handling_fee',
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
new IconButton(
|
||||||
|
icon: Icon(Icons.edit, color: primaryColor),
|
||||||
|
onPressed: () async {}),
|
||||||
|
Expanded(
|
||||||
|
child: Text('\$ $handlingFee',
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
)))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
dataRow.insert(
|
dataRow.insert(
|
||||||
dataRow.length,
|
dataRow.length,
|
||||||
Container(
|
Container(
|
||||||
@@ -630,8 +810,9 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
getTotalBalance(total) {
|
getTotalBalance(total) {
|
||||||
double balance = 0;
|
double balance = 0;
|
||||||
double custom = customFee != 0 ? customFee.toDouble() : 0;
|
double custom = customFee != 0 ? customFee.toDouble() : 0;
|
||||||
|
double discount = _discount != null ? _discount.amount.toDouble() : 0;
|
||||||
double deliveryFee = deliveryfee != 0 ? deliveryfee.toDouble() : 0;
|
double deliveryFee = deliveryfee != 0 ? deliveryfee.toDouble() : 0;
|
||||||
balance = (total + custom + deliveryFee) - 100.0;
|
balance = (total + custom + deliveryFee) - discount;
|
||||||
return balance;
|
return balance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
809
lib/pages/invoice/invoice_info.dart
Normal file
809
lib/pages/invoice/invoice_info.dart
Normal file
@@ -0,0 +1,809 @@
|
|||||||
|
import 'package:fcs/domain/entities/box.dart';
|
||||||
|
import 'package:fcs/domain/entities/cargo.dart';
|
||||||
|
import 'package:fcs/domain/entities/custom.dart';
|
||||||
|
import 'package:fcs/domain/entities/discount.dart';
|
||||||
|
import 'package:fcs/domain/entities/invoice.dart';
|
||||||
|
import 'package:fcs/domain/entities/payment_method.dart';
|
||||||
|
import 'package:fcs/domain/entities/user.dart';
|
||||||
|
import 'package:fcs/helpers/theme.dart';
|
||||||
|
import 'package:fcs/localization/app_translations.dart';
|
||||||
|
import 'package:fcs/pages/discount/discount_list.dart';
|
||||||
|
import 'package:fcs/pages/discount/model/discount_model.dart';
|
||||||
|
import 'package:fcs/pages/invoice/invoice_editor.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/rates/custom_list.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/fcs_id_icon.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/local_title.dart';
|
||||||
|
import 'package:fcs/pages/widgets/multi_img_controller.dart';
|
||||||
|
import 'package:fcs/pages/widgets/multi_img_file.dart';
|
||||||
|
import 'package:fcs/pages/widgets/my_data_table.dart';
|
||||||
|
import 'package:fcs/pages/widgets/progress.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_icons/flutter_icons.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import 'box_addition.dart';
|
||||||
|
|
||||||
|
class InvoiceInfoPage extends StatefulWidget {
|
||||||
|
final Invoice invoice;
|
||||||
|
InvoiceInfoPage({this.invoice});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_InvoiceInfoPageState createState() => _InvoiceInfoPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _InvoiceInfoPageState extends State<InvoiceInfoPage> {
|
||||||
|
User user;
|
||||||
|
|
||||||
|
var dateFormatter = new DateFormat('dd MMM yyyy');
|
||||||
|
TextEditingController _invoiceNumberController = new TextEditingController();
|
||||||
|
TextEditingController _dateController = new TextEditingController();
|
||||||
|
TextEditingController _nameController = new TextEditingController();
|
||||||
|
TextEditingController _phoneController = new TextEditingController();
|
||||||
|
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<Box> _boxes = [];
|
||||||
|
bool isSwitched = false;
|
||||||
|
int deliveryfee = 0;
|
||||||
|
int customFee = 0;
|
||||||
|
double total = 0;
|
||||||
|
Discount _discount;
|
||||||
|
bool isNew = false;
|
||||||
|
Discount selectedDiscount;
|
||||||
|
int selectedDiscountAmt;
|
||||||
|
PaymentMethod paymentMethod;
|
||||||
|
double volumetricRatio = 0;
|
||||||
|
|
||||||
|
List<Box> selectedBoxes = [];
|
||||||
|
List<Custom> customs = [];
|
||||||
|
|
||||||
|
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/buying_online_with_first_last_name.png",
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
volumetricRatio =
|
||||||
|
Provider.of<MainModel>(context, listen: false).setting.volumetricRatio;
|
||||||
|
|
||||||
|
if (widget.invoice != null) {
|
||||||
|
_invoice = widget.invoice;
|
||||||
|
_invoiceNumberController.text = _invoice.invoiceNumber;
|
||||||
|
_dateController.text = dateFormatter.format(_invoice.invoiceDate);
|
||||||
|
_nameController.text = _invoice.customerName;
|
||||||
|
_phoneController.text = _invoice.customerPhoneNumber;
|
||||||
|
// _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 {
|
||||||
|
_dateController.text = dateFormatter.format(DateTime.now());
|
||||||
|
_amountController.text = '0';
|
||||||
|
_handlingFeeController.text = '0';
|
||||||
|
_customFeeController.text = '0';
|
||||||
|
_descriptionController.text = '';
|
||||||
|
_balanceController.text = '0';
|
||||||
|
setState(() {
|
||||||
|
isNew = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_boxes = [
|
||||||
|
Box(
|
||||||
|
shipmentNumber: "A202",
|
||||||
|
receiverNumber: "3",
|
||||||
|
receiverName: "Ko Myo Min",
|
||||||
|
boxNumber: "1",
|
||||||
|
rate: 7,
|
||||||
|
packageType: "General",
|
||||||
|
weight: 75,
|
||||||
|
status: "Packed",
|
||||||
|
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
|
||||||
|
cargoDesc: "Clothes",
|
||||||
|
arrivedDate: DateTime(2020, 6, 1),
|
||||||
|
width: 10,
|
||||||
|
height: 10,
|
||||||
|
length: 10,
|
||||||
|
// packages: packages,
|
||||||
|
// statusHistory: statusHistory,
|
||||||
|
cargoTypes: [
|
||||||
|
Cargo(type: 'General Cargo', weight: 25),
|
||||||
|
Cargo(type: 'Medicine', weight: 20),
|
||||||
|
Cargo(type: 'Dangerous Cargo', weight: 30)
|
||||||
|
]),
|
||||||
|
Box(
|
||||||
|
shipmentNumber: "A202",
|
||||||
|
receiverNumber: "3",
|
||||||
|
receiverName: "Ko Myo Min",
|
||||||
|
boxNumber: "2",
|
||||||
|
rate: 7,
|
||||||
|
packageType: "General",
|
||||||
|
weight: 75,
|
||||||
|
status: "Packed",
|
||||||
|
cargoDesc: "Clothes",
|
||||||
|
arrivedDate: DateTime(2020, 6, 1),
|
||||||
|
width: 10,
|
||||||
|
height: 10,
|
||||||
|
length: 10,
|
||||||
|
// statusHistory: statusHistory,
|
||||||
|
// packages: packages,
|
||||||
|
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
|
||||||
|
cargoTypes: [
|
||||||
|
Cargo(type: 'General Cargo', weight: 25),
|
||||||
|
Cargo(type: 'Medicine', weight: 20),
|
||||||
|
Cargo(type: 'Dangerous Cargo', weight: 30)
|
||||||
|
])
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
var mainModel = Provider.of<MainModel>(context);
|
||||||
|
var discountModel = Provider.of<DiscountModel>(context);
|
||||||
|
var paymentMethodModel = Provider.of<PaymentMethodModel>(context);
|
||||||
|
|
||||||
|
final nameBox = DisplayText(
|
||||||
|
iconData: Feather.user,
|
||||||
|
labelTextKey: 'invoice.customer_name',
|
||||||
|
text: user != null ? user.name : '');
|
||||||
|
|
||||||
|
final fcsIDBox = Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: DisplayText(
|
||||||
|
text: user != null ? user.fcsID : "",
|
||||||
|
labelTextKey: "box.fcs.id",
|
||||||
|
icon: FcsIDIcon(),
|
||||||
|
)),
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.search, color: primaryColor),
|
||||||
|
onPressed: () => searchUser(context, callbackUserSelect: (u) {
|
||||||
|
setState(() {
|
||||||
|
this.user = u;
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
final statusBox = DisplayText(
|
||||||
|
text: _statusController.text,
|
||||||
|
iconData: Icons.av_timer,
|
||||||
|
labelTextKey: 'invoice.status');
|
||||||
|
|
||||||
|
return LocalProgress(
|
||||||
|
inAsyncCall: _isLoading,
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
|
leading: new IconButton(
|
||||||
|
icon: new Icon(CupertinoIcons.back, color: primaryColor),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
shadowColor: Colors.transparent,
|
||||||
|
title: LocalText(context, 'invoice.form.title',
|
||||||
|
color: primaryColor, fontSize: 20),
|
||||||
|
actions: [
|
||||||
|
new IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.delete,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
onPressed: () {}),
|
||||||
|
new IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.edit,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).push(CupertinoPageRoute(
|
||||||
|
builder: (context) => InvoiceEditor(invoice: _invoice)));
|
||||||
|
})
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
LocalTitle(textKey: "invoice.customer_info"),
|
||||||
|
DisplayText(
|
||||||
|
labelTextKey: 'invoice.date',
|
||||||
|
iconData: Icons.date_range,
|
||||||
|
text: _dateController.text),
|
||||||
|
widget.invoice == null
|
||||||
|
? Container()
|
||||||
|
: DisplayText(
|
||||||
|
labelTextKey: 'invoice.number',
|
||||||
|
iconData: FontAwesomeIcons.fileInvoice,
|
||||||
|
text: _invoiceNumberController.text),
|
||||||
|
fcsIDBox,
|
||||||
|
nameBox,
|
||||||
|
statusBox,
|
||||||
|
LocalTitle(textKey: "invoice.box_info"),
|
||||||
|
Center(child: Column(children: getCartonRows(context))),
|
||||||
|
SizedBox(height: 20),
|
||||||
|
LocalTitle(textKey: "invoice.custom_fee"),
|
||||||
|
Column(children: getCustomFeeRows(context)),
|
||||||
|
SizedBox(height: 20),
|
||||||
|
LocalTitle(textKey: "invoice.cargo_type"),
|
||||||
|
Column(children: getCargoTableByBox(context)),
|
||||||
|
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: Colors.grey,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'${paymentMethod != null ? paymentMethod.accountName : "KBZ Bank"}',
|
||||||
|
style: TextStyle(fontSize: 16)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 30),
|
||||||
|
!isNew
|
||||||
|
? LocalTitle(textKey: "invoice.payment_attachment")
|
||||||
|
: Container(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getCartonRows(BuildContext context) {
|
||||||
|
List<Widget> dataRow = [];
|
||||||
|
|
||||||
|
dataRow = _boxes.map((box) {
|
||||||
|
return Container(
|
||||||
|
height: 50,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(bottom: BorderSide(color: Colors.grey))),
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(left: 5.0, right: 5.0, top: 5.0, bottom: 5.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(flex: 2, child: Text(box.packageNumber)),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Text(
|
||||||
|
box.length == null
|
||||||
|
? ""
|
||||||
|
: box.length.toString() +
|
||||||
|
' x ' +
|
||||||
|
box.length.toString() +
|
||||||
|
' x ' +
|
||||||
|
box.height.toString(),
|
||||||
|
textAlign: TextAlign.center)),
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
box.getShipmentWeight(volumetricRatio).toString()))),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
dataRow.insert(
|
||||||
|
0,
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(bottom: BorderSide(color: Colors.grey))),
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 5.0, right: 5.0, top: 5.0, bottom: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
"invoice.box.number",
|
||||||
|
color: Colors.grey,
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child:
|
||||||
|
Text('L x W x H', style: TextStyle(color: Colors.grey))),
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
"invoice.shipment_weight",
|
||||||
|
color: Colors.grey,
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
return dataRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCustomFeeRows(BuildContext context) {
|
||||||
|
customFee = 0;
|
||||||
|
List<Widget> dataRow = [];
|
||||||
|
|
||||||
|
dataRow = customs.map((custom) {
|
||||||
|
customFee += custom.fee;
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(bottom: BorderSide(color: Colors.grey))),
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(left: 5.0, right: 5.0, top: 5.0, bottom: 5.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(flex: 2, child: Text('${custom.productType}')),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Text('\$ ${custom.fee}', textAlign: TextAlign.center)),
|
||||||
|
Expanded(child: SizedBox(height: 40))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
dataRow.insert(
|
||||||
|
0,
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(bottom: BorderSide(color: Colors.grey))),
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 5.0, right: 5.0, top: 15.0, bottom: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Text('Product', style: TextStyle(color: Colors.grey))),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Text('Fee',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(color: Colors.grey))),
|
||||||
|
Expanded(flex: 1, child: Container())
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
dataRow.insert(
|
||||||
|
dataRow.length,
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 5.0, right: 5.0, top: 15.0, bottom: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Center(
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
'invoice.total_custom_fee',
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Center(
|
||||||
|
child: Text('\$ $customFee',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold)))),
|
||||||
|
Expanded(
|
||||||
|
child: Container(),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
return dataRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCargoTableByBox(BuildContext 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: 15.0, bottom: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(flex: 2, child: Text('${cargo.type}')),
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Text('${cargo.weight} x ${cargo.price}',
|
||||||
|
textAlign: TextAlign.center)),
|
||||||
|
Expanded(
|
||||||
|
child: Text('\$ $amount',
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
)))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
dataRow.insert(
|
||||||
|
0,
|
||||||
|
Container(
|
||||||
|
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.box.cargo_type'),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.grey))),
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Text(
|
||||||
|
getLocalString(context, 'cargo.weight') +
|
||||||
|
' x ' +
|
||||||
|
getLocalString(context, 'cargo.rate'),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.grey))),
|
||||||
|
Expanded(
|
||||||
|
child: Text(getLocalString(context, 'invoice.amount'),
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.grey)))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
dataRow.insert(
|
||||||
|
dataRow.length,
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 5.0, right: 5.0, top: 10.0, bottom: 10.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Center(
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
'invoice.total',
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
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),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Center(
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
'invoice.discount_value',
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
'\$ ${_discount != null ? _discount.amount.toInt() : 0}',
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
)))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
dataRow.insert(
|
||||||
|
dataRow.length,
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 5.0, right: 5.0, top: 10.0, bottom: 0.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Center(
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
'invoice.custom_fee',
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
child: Text('\$ $customFee',
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
dataRow.insert(
|
||||||
|
dataRow.length,
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 5.0, right: 5.0, top: 20.0, bottom: 0.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Center(
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
'invoice.handling_fee',
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
child: Text('\$ $customFee',
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
dataRow.insert(
|
||||||
|
dataRow.length,
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 5.0, right: 5.0, top: 10.0, bottom: 10.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Center(
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
'invoice.delivery_fee',
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Text('\$ $deliveryfee',
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
)))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
dataRow.insert(
|
||||||
|
dataRow.length,
|
||||||
|
Container(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(child: Text('')),
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Divider(
|
||||||
|
thickness: 3,
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
)));
|
||||||
|
|
||||||
|
dataRow.insert(
|
||||||
|
dataRow.length,
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 5.0, right: 5.0, top: 10.0, bottom: 10.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Center(
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
'invoice.net_amount',
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Text('\$ ${getTotalBalance(total)}',
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: primaryColor)))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
dataRow.insert(
|
||||||
|
dataRow.length,
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 5.0, right: 5.0, top: 10.0, bottom: 10.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Center(
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
'invoice.balance',
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Text('\$ ${getTotalBalance(total)}',
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: primaryColor)))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
return dataRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
getTotalBalance(total) {
|
||||||
|
double balance = 0;
|
||||||
|
double custom = customFee != 0 ? customFee.toDouble() : 0;
|
||||||
|
double deliveryFee = deliveryfee != 0 ? deliveryfee.toDouble() : 0;
|
||||||
|
double discount = _discount != null ? _discount.amount.toDouble() : 0;
|
||||||
|
balance = (total + custom + deliveryFee) - discount;
|
||||||
|
return balance;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MyDataRow> getBoxRow(BuildContext context) {
|
||||||
|
return _boxes.map((p) {
|
||||||
|
p.cargoTypes.map((cargo) {
|
||||||
|
_cargoTypes.asMap().map((index, _cargo) {
|
||||||
|
if (_cargo.type == cargo.type) {
|
||||||
|
setState(() {
|
||||||
|
_cargoTypes[index].weight += cargo.weight;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return MyDataRow(
|
||||||
|
onSelectChanged: (bool selected) {},
|
||||||
|
cells: [
|
||||||
|
MyDataCell(Checkbox(
|
||||||
|
value: true,
|
||||||
|
onChanged: (value) {
|
||||||
|
selectedBoxes.add(p);
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
MyDataCell(new Text(
|
||||||
|
p.boxNumber == null
|
||||||
|
? ""
|
||||||
|
: '${p.shipmentNumber}-${p.receiverNumber} #${p.boxNumber}',
|
||||||
|
style: textStyle,
|
||||||
|
)),
|
||||||
|
MyDataCell(new Text(
|
||||||
|
p.length == null
|
||||||
|
? ""
|
||||||
|
: p.length.toString() +
|
||||||
|
' x ' +
|
||||||
|
p.length.toString() +
|
||||||
|
' x ' +
|
||||||
|
p.height.toString(),
|
||||||
|
style: textStyle,
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MyDataRow> getCargoDataRow(BuildContext context) {
|
||||||
|
return _cargoTypes.asMap().entries.map((c) {
|
||||||
|
var cargo = c.value;
|
||||||
|
var amt = cargo.weight * cargo.price;
|
||||||
|
return MyDataRow(
|
||||||
|
onSelectChanged: (bool selected) {},
|
||||||
|
cells: [
|
||||||
|
MyDataCell(new Text(
|
||||||
|
cargo.type,
|
||||||
|
style: textStyle,
|
||||||
|
)),
|
||||||
|
MyDataCell(new Text(
|
||||||
|
cargo.weight.toString() + ' x ' + cargo.price.toString(),
|
||||||
|
style: textStyle,
|
||||||
|
)),
|
||||||
|
MyDataCell(new Text(
|
||||||
|
"\$$amt",
|
||||||
|
style: textStyle,
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList()
|
||||||
|
// .insert(_cargoTypes.length,MyDataRow(cells: [
|
||||||
|
// MyDataCell(new Text('')),
|
||||||
|
// MyDataCell(new Text('Total')),
|
||||||
|
// MyDataCell(new Text(
|
||||||
|
// "\$5000",
|
||||||
|
// style: textStyle,
|
||||||
|
// )),
|
||||||
|
// ])
|
||||||
|
// )
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ import 'dart:io';
|
|||||||
|
|
||||||
import 'package:fcs/domain/entities/invoice.dart';
|
import 'package:fcs/domain/entities/invoice.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
|
import 'package:fcs/pages/invoice/invoice_info.dart';
|
||||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -79,8 +80,9 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
owner
|
owner
|
||||||
? Navigator.of(context).push(CupertinoPageRoute(
|
? Navigator.of(context).push(CupertinoPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) => PaymentPDFScreen(
|
||||||
InvoiceEditor(invoice: _invoice)))
|
path: pdfPath,
|
||||||
|
)))
|
||||||
: Navigator.of(context).push(CupertinoPageRoute(
|
: Navigator.of(context).push(CupertinoPageRoute(
|
||||||
builder: (context) => PaymentPDFScreen(
|
builder: (context) => PaymentPDFScreen(
|
||||||
path: pdfPath,
|
path: pdfPath,
|
||||||
@@ -180,18 +182,19 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
|
|||||||
CupertinoActionSheetAction(
|
CupertinoActionSheetAction(
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Icon(Icons.file_download),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
'Download',
|
'See detail',
|
||||||
style: TextStyle(fontSize: 16, color: Colors.black),
|
style: TextStyle(fontSize: 16, color: Colors.black),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
//to go invoice info page
|
||||||
|
Navigator.of(context).push(CupertinoPageRoute(
|
||||||
|
builder: (context) => InvoiceInfoPage(invoice: _invoice)));
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
76
lib/pages/invoice/invoice_shipment_list.dart
Normal file
76
lib/pages/invoice/invoice_shipment_list.dart
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
import 'package:fcs/helpers/theme.dart';
|
||||||
|
import 'package:fcs/localization/app_translations.dart';
|
||||||
|
import 'package:fcs/pages/shipment/model/shipment_model.dart';
|
||||||
|
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||||
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
|
import 'package:fcs/pages/widgets/progress.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'invoice_shipment_list_row.dart';
|
||||||
|
|
||||||
|
class InvoiceShipmentList extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_InvoiceShipmentListState createState() => _InvoiceShipmentListState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _InvoiceShipmentListState extends State<InvoiceShipmentList> {
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
var pickupModel = Provider.of<ShipmentModel>(context);
|
||||||
|
return LocalProgress(
|
||||||
|
inAsyncCall: _isLoading,
|
||||||
|
child: DefaultTabController(
|
||||||
|
length: 3,
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
|
leading: new IconButton(
|
||||||
|
icon: new Icon(CupertinoIcons.back),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
title: LocalText(context, "shipment",
|
||||||
|
fontSize: 18, color: Colors.white),
|
||||||
|
actions: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.search,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
iconSize: 30,
|
||||||
|
// onPressed: () => showPlacesSearch(context),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: new ListView.separated(
|
||||||
|
separatorBuilder: (context, index) => Divider(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
padding: EdgeInsets.only(top: 15),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: pickupModel.pickups.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return InvoiceShipmentListRow(
|
||||||
|
pickUp: pickupModel.pickups[index]);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
116
lib/pages/invoice/invoice_shipment_list_row.dart
Normal file
116
lib/pages/invoice/invoice_shipment_list_row.dart
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
import 'package:fcs/domain/entities/pickup.dart';
|
||||||
|
import 'package:fcs/helpers/theme.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_icons/flutter_icons.dart';
|
||||||
|
|
||||||
|
import '../main/util.dart';
|
||||||
|
import 'invoice_customer_list.dart';
|
||||||
|
|
||||||
|
class InvoiceShipmentListRow extends StatefulWidget {
|
||||||
|
final Shipment pickUp;
|
||||||
|
const InvoiceShipmentListRow({this.pickUp});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_InvoiceShipmentListRowState createState() => _InvoiceShipmentListRowState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _InvoiceShipmentListRowState extends State<InvoiceShipmentListRow> {
|
||||||
|
final double dotSize = 15.0;
|
||||||
|
Shipment _pickUp = new Shipment();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
if (widget.pickUp != null) {
|
||||||
|
_pickUp = widget.pickUp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
print('_pickup $_pickUp');
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.only(left: 15, right: 15),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).push(
|
||||||
|
CupertinoPageRoute(builder: (context) => InvoiceCustomerList()));
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: new Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||||
|
child: new Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.all(5.0),
|
||||||
|
child: Icon(
|
||||||
|
SimpleLineIcons.direction,
|
||||||
|
color: primaryColor,
|
||||||
|
)),
|
||||||
|
new Expanded(
|
||||||
|
child: new Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: new Text(
|
||||||
|
_pickUp.id == null ? '' : _pickUp.id,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 15.0, color: Colors.black),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
||||||
|
child: new Text(
|
||||||
|
_pickUp.id == null
|
||||||
|
? ''
|
||||||
|
: "Last ${_pickUp.last} days",
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 15.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(0),
|
||||||
|
child: getStatus(_pickUp.status),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
new Text(
|
||||||
|
_pickUp.weight == null
|
||||||
|
? ''
|
||||||
|
: _pickUp.weight.toString() + 'lb - ',
|
||||||
|
style:
|
||||||
|
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
new Text(
|
||||||
|
_pickUp.numberOfPackage == null
|
||||||
|
? ""
|
||||||
|
: _pickUp.numberOfPackage.toString() + ' packages',
|
||||||
|
style:
|
||||||
|
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,9 @@ import 'package:fcs/domain/entities/invoice.dart';
|
|||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/localization/app_translations.dart';
|
import 'package:fcs/localization/app_translations.dart';
|
||||||
import 'package:fcs/pages/main/util.dart';
|
import 'package:fcs/pages/main/util.dart';
|
||||||
|
import 'package:fcs/pages/widgets/input_text.dart';
|
||||||
import 'package:fcs/pages/widgets/local_text.dart';
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
|
import 'package:fcs/pages/widgets/local_title.dart';
|
||||||
import 'package:fcs/pages/widgets/multi_img_controller.dart';
|
import 'package:fcs/pages/widgets/multi_img_controller.dart';
|
||||||
import 'package:fcs/pages/widgets/multi_img_file.dart';
|
import 'package:fcs/pages/widgets/multi_img_file.dart';
|
||||||
import 'package:fcs/pages/widgets/my_data_table.dart';
|
import 'package:fcs/pages/widgets/my_data_table.dart';
|
||||||
@@ -24,28 +26,18 @@ class PaymentPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PaymentPageState extends State<PaymentPage> {
|
class _PaymentPageState extends State<PaymentPage> {
|
||||||
TextEditingController _addressEditingController = new TextEditingController();
|
TextEditingController _amountController = new TextEditingController();
|
||||||
TextEditingController _fromTimeEditingController =
|
|
||||||
new TextEditingController();
|
|
||||||
TextEditingController _toTimeEditingController = new TextEditingController();
|
|
||||||
TextEditingController _noOfPackageEditingController =
|
|
||||||
new TextEditingController();
|
|
||||||
TextEditingController _weightEditingController = new TextEditingController();
|
|
||||||
MultiImgController multiImgController = MultiImgController();
|
|
||||||
var dateFormatter = new DateFormat('dd MMM yyyy');
|
var dateFormatter = new DateFormat('dd MMM yyyy');
|
||||||
|
|
||||||
Invoice _invoice = new Invoice();
|
Invoice _invoice = new Invoice();
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
List<String> _receipts = [
|
|
||||||
"assets/buying_online_with_first_last_name.png",
|
|
||||||
];
|
|
||||||
bool isNew;
|
bool isNew;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
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();
|
||||||
}
|
}
|
||||||
@@ -59,7 +51,16 @@ class _PaymentPageState extends State<PaymentPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final saveBox = fcsButton(context, getLocalString(context, 'btn.save'));
|
final amountBox = InputText(
|
||||||
|
labelTextKey: 'pm.amount',
|
||||||
|
controller: _amountController,
|
||||||
|
iconData: FontAwesomeIcons.moneyBill);
|
||||||
|
|
||||||
|
final receiptFileBox = Row(children: [
|
||||||
|
LocalText(context, 'pm.attachment', fontSize: 16, color: Colors.grey),
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.attachment, color: primaryColor), onPressed: () {})
|
||||||
|
]);
|
||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
@@ -72,117 +73,118 @@ class _PaymentPageState extends State<PaymentPage> {
|
|||||||
),
|
),
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
title: Text(AppTranslations.of(context).text("pm_.title")),
|
title: Text(AppTranslations.of(context).text("pm_.title")),
|
||||||
|
actions: [
|
||||||
|
IconButton(icon: Icon(Icons.cloud_upload), onPressed: () {})
|
||||||
|
],
|
||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
padding: const EdgeInsets.all(15.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
amountBox,
|
||||||
child: Row(
|
SizedBox(height: 10),
|
||||||
children: <Widget>[
|
receiptFileBox,
|
||||||
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),
|
|
||||||
Text(
|
|
||||||
' \$ ${_invoice.amount - _invoice.receipts[0].amount}',
|
|
||||||
style: TextStyle(
|
|
||||||
color: primaryColor,
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
SizedBox(height: 10),
|
SizedBox(height: 10),
|
||||||
Divider(),
|
Divider(),
|
||||||
SizedBox(height: 10),
|
SizedBox(height: 10),
|
||||||
LocalText(context, 'pm.attachment',
|
LocalTitle(textKey: "pm.receipt"),
|
||||||
color: primaryColor, fontSize: 16, fontWeight: FontWeight.bold),
|
Column(
|
||||||
Padding(
|
children: getCustomFeeRows(context),
|
||||||
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),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.only(left: 10),
|
|
||||||
child: MultiImageFile(
|
|
||||||
enabled: true,
|
|
||||||
controller: multiImgController,
|
|
||||||
title: "Receipt File",
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 25),
|
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),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<MyDataRow> getPackageRow(BuildContext context) {
|
getCustomFeeRows(BuildContext context) {
|
||||||
return _invoice.receipts.map((r) {
|
List<Widget> dataRow = [];
|
||||||
return MyDataRow(
|
|
||||||
onSelectChanged: (bool selected) {},
|
dataRow = _invoice.receipts.asMap().entries.map((receipt) {
|
||||||
cells: [
|
var r = receipt.value;
|
||||||
MyDataCell(
|
var k = receipt.key + 1;
|
||||||
new Text(dateFormatter.format(r.date), style: textStyle),
|
return Container(
|
||||||
),
|
height: 50,
|
||||||
MyDataCell(NumberCell(r.amount))
|
decoration: BoxDecoration(
|
||||||
|
border: Border(bottom: BorderSide(color: Colors.grey))),
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(left: 5.0, right: 5.0, top: 5.0, bottom: 5.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(flex: 2, child: Text(dateFormatter.format(r.date))),
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Center(child: Text('receipt' + k.toString() + '.png'))),
|
||||||
|
Expanded(flex: 1, child: Center(child: Text('pending'))),
|
||||||
|
Expanded(flex: 1, child: Center(child: Text('\$ ${r.amount}'))),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
|
dataRow.insert(
|
||||||
|
0,
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(bottom: BorderSide(color: Colors.grey))),
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 5.0, right: 5.0, top: 10.0, bottom: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Text('Product', style: TextStyle(color: Colors.grey))),
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Text('File',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(color: Colors.grey))),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Text('Status',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(color: Colors.grey))),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Text('Fee',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(color: Colors.grey))),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
dataRow.insert(
|
||||||
|
dataRow.length,
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 5.0, right: 5.0, top: 15.0, bottom: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Center(
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
'pm.remaining_balance',
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Container(),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Center(
|
||||||
|
child: Text('\$ 300',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold, fontSize: 16.0)))),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
return dataRow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_pdfview/flutter_pdfview.dart';
|
import 'package:flutter_pdfview/flutter_pdfview.dart';
|
||||||
@@ -29,13 +30,18 @@ class _PaymentPDFScreenState extends State<PaymentPDFScreen>
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
title: Text("Invoice File"),
|
title: LocalText(context, 'invoice.pdf',
|
||||||
|
color: Colors.white, fontSize: 20),
|
||||||
leading: new IconButton(
|
leading: new IconButton(
|
||||||
icon: new Icon(CupertinoIcons.back),
|
icon: new Icon(CupertinoIcons.back),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}),
|
}),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.file_download),
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Icons.share),
|
icon: Icon(Icons.share),
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
|
|||||||
86
lib/pages/rates/custom_list.dart
Normal file
86
lib/pages/rates/custom_list.dart
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
import 'package:fcs/domain/entities/custom.dart';
|
||||||
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
|
import 'package:fcs/helpers/theme.dart';
|
||||||
|
import 'package:fcs/pages/delivery_address/delivery_address_editor.dart';
|
||||||
|
import 'package:fcs/pages/main/util.dart';
|
||||||
|
import 'package:fcs/pages/rates/custom_editor.dart';
|
||||||
|
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||||
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
|
import 'package:fcs/pages/widgets/progress.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import 'custom_row.dart';
|
||||||
|
import 'model/shipment_rate_model.dart';
|
||||||
|
|
||||||
|
class CustomList extends StatefulWidget {
|
||||||
|
const CustomList({Key key}) : super(key: key);
|
||||||
|
@override
|
||||||
|
_CustomListState createState() => _CustomListState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CustomListState extends State<CustomList> {
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
var shipmentRateModel = Provider.of<ShipmentRateModel>(context);
|
||||||
|
|
||||||
|
return LocalProgress(
|
||||||
|
inAsyncCall: _isLoading,
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
|
leading: new IconButton(
|
||||||
|
icon: new Icon(CupertinoIcons.back),
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
),
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
title: LocalText(
|
||||||
|
context,
|
||||||
|
"Customs",
|
||||||
|
fontSize: 20,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: ListView.separated(
|
||||||
|
separatorBuilder: (c, i) => Divider(
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
itemCount: shipmentRateModel.customs.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return _row(context, shipmentRateModel.customs[index]);
|
||||||
|
}),
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_row(BuildContext context, Custom custom) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () => Navigator.pop<Custom>(context, custom),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: CustomRow(
|
||||||
|
key: ValueKey(custom.id),
|
||||||
|
custom: custom,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
66
lib/pages/rates/custom_row.dart
Normal file
66
lib/pages/rates/custom_row.dart
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import 'package:fcs/domain/entities/custom.dart';
|
||||||
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
|
import 'package:fcs/helpers/theme.dart';
|
||||||
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_icons/flutter_icons.dart';
|
||||||
|
|
||||||
|
typedef SelectionCallback(Custom custom);
|
||||||
|
|
||||||
|
class CustomRow extends StatelessWidget {
|
||||||
|
final Custom custom;
|
||||||
|
final SelectionCallback selectionCallback;
|
||||||
|
const CustomRow(
|
||||||
|
{Key key, this.custom, this.selectionCallback})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: selectionCallback == null
|
||||||
|
? null
|
||||||
|
: () => this.selectionCallback(custom),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
line(context, custom.productType,
|
||||||
|
iconData: MaterialCommunityIcons.account,
|
||||||
|
color: primaryColor,
|
||||||
|
fontSize: 16),
|
||||||
|
line(context, custom.fee.toString(),
|
||||||
|
iconData: Icons.phone, color: primaryColor, fontSize: 16),
|
||||||
|
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget line(BuildContext context, String text,
|
||||||
|
{IconData iconData, Color color, double fontSize}) {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
iconData == null
|
||||||
|
? SizedBox(width: 40)
|
||||||
|
: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0, right: 8),
|
||||||
|
child: Icon(iconData, color: Colors.black38),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: TextLocalStyle(
|
||||||
|
context,
|
||||||
|
text ?? "",
|
||||||
|
fontSize: fontSize ?? 14,
|
||||||
|
color: color,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user