update invoice
This commit is contained in:
@@ -35,8 +35,6 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'box_addition.dart';
|
||||
|
||||
class InvoiceEditor extends StatefulWidget {
|
||||
final Invoice invoice;
|
||||
final User customer;
|
||||
@@ -68,8 +66,8 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
List<Box> _boxes = [];
|
||||
bool isSwitched = false;
|
||||
int deliveryfee = 0;
|
||||
double customFee = 10;
|
||||
int handlingFee = 0;
|
||||
double customFee = 10.0;
|
||||
double handlingFee = 10.0; // it will get from shipment
|
||||
double total = 0;
|
||||
Discount _discount;
|
||||
bool isNew = false;
|
||||
@@ -124,7 +122,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
_balanceController.text = '0';
|
||||
}
|
||||
|
||||
if (widget.customer != null) {
|
||||
if (widget.customer != null && widget.invoice == null) {
|
||||
user = widget.customer;
|
||||
setState(() {
|
||||
isNew = true;
|
||||
@@ -193,29 +191,17 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
final nameBox = DisplayText(
|
||||
iconData: Feather.user,
|
||||
labelTextKey: 'invoice.customer_name',
|
||||
text: user != null ? user.name : '');
|
||||
text: user != null ? user.name : 'Ko Nyi');
|
||||
|
||||
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(() {
|
||||
this.user = u;
|
||||
});
|
||||
})),
|
||||
],
|
||||
final fcsIDBox = DisplayText(
|
||||
text: user != null ? user.fcsID : "FCS-KRUTUG",
|
||||
labelTextKey: "box.fcs.id",
|
||||
icon: FcsIDIcon(),
|
||||
);
|
||||
|
||||
return LocalProgress(
|
||||
@@ -249,7 +235,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
text: _invoiceNumberController.text),
|
||||
fcsIDBox,
|
||||
nameBox,
|
||||
isNew ? statusBox : Container(),
|
||||
isNew ? Container() : statusBox,
|
||||
SizedBox(height: 20),
|
||||
LocalTitle(textKey: "invoice.box_info"),
|
||||
Center(child: Column(children: getCartonRows(context))),
|
||||
@@ -261,7 +247,8 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
onPressed: () async {
|
||||
CustomDuty custom = await Navigator.of(context).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => CustomList()));
|
||||
builder: (context) =>
|
||||
CustomList(selected: true)));
|
||||
setState(() {
|
||||
if (custom != null) customs.add(custom);
|
||||
});
|
||||
@@ -300,11 +287,13 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
LocalTitle(
|
||||
textKey: "invoice.payment_attachment",
|
||||
trailing: IconButton(
|
||||
icon: Icon(Icons.add_circle, color: primaryColor),
|
||||
onPressed: () async {})),
|
||||
isNew
|
||||
? Container()
|
||||
: LocalTitle(
|
||||
textKey: "invoice.payment_attachment",
|
||||
trailing: IconButton(
|
||||
icon: Icon(Icons.add_circle, color: primaryColor),
|
||||
onPressed: () async {})),
|
||||
widget.invoice == null
|
||||
? fcsButton(
|
||||
context, getLocalString(context, 'invoice.btn_create'))
|
||||
@@ -341,13 +330,21 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 33,
|
||||
width: 35,
|
||||
child: Checkbox(
|
||||
value: true, onChanged: (v) {}, activeColor: primaryColor),
|
||||
),
|
||||
Expanded(flex: 1, child: Text(box.packageNumber)),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(box.packageNumber),
|
||||
Text(box.shipmentNumber),
|
||||
],
|
||||
)),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
box.length == null
|
||||
? ""
|
||||
@@ -387,7 +384,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
),
|
||||
)),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
flex: 2,
|
||||
child: Center(
|
||||
child: Text('L x W x H',
|
||||
style: TextStyle(color: Colors.grey)))),
|
||||
@@ -674,11 +671,9 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
),
|
||||
),
|
||||
),
|
||||
new IconButton(
|
||||
icon: Icon(Icons.edit, color: primaryColor),
|
||||
onPressed: () async {}),
|
||||
SizedBox(width: 50),
|
||||
Expanded(
|
||||
child: Text('\$ $handlingFee',
|
||||
child: Text('\$ ${handlingFee.toString()}',
|
||||
textAlign: TextAlign.end,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
|
||||
Reference in New Issue
Block a user