fix invoice display
This commit is contained in:
@@ -120,8 +120,10 @@ class _InvoiceListState extends State<InvoiceList> {
|
|||||||
itemCount: invoiceModel.invoices.length,
|
itemCount: invoiceModel.invoices.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
return InvoiceListRow(
|
return InvoiceListRow(
|
||||||
key: ValueKey(invoiceModel.invoices[index].id),
|
key: ValueKey(invoiceModel.invoices[index].id),
|
||||||
invoice: invoiceModel.invoices[index]);
|
invoice: invoiceModel.invoices[index],
|
||||||
|
forCustomer: widget.forCustomer,
|
||||||
|
);
|
||||||
}),
|
}),
|
||||||
onRefresh: () => invoiceModel.refresh(),
|
onRefresh: () => invoiceModel.refresh(),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import '../widgets/pdf_screen.dart';
|
|||||||
class InvoiceListRow extends StatelessWidget {
|
class InvoiceListRow extends StatelessWidget {
|
||||||
final dateFormatter = new DateFormat('dd MMM yyyy');
|
final dateFormatter = new DateFormat('dd MMM yyyy');
|
||||||
final Invoice invoice;
|
final Invoice invoice;
|
||||||
InvoiceListRow({Key key, this.invoice}) : super(key: key);
|
final bool forCustomer;
|
||||||
|
InvoiceListRow({Key key, this.invoice, this.forCustomer}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -91,7 +92,10 @@ class InvoiceListRow extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).push(CupertinoPageRoute(
|
Navigator.of(context).push(CupertinoPageRoute(
|
||||||
builder: (context) => PaymentPage(invoice: invoice)));
|
builder: (context) => PaymentPage(
|
||||||
|
invoice: invoice,
|
||||||
|
forCustomer: forCustomer,
|
||||||
|
)));
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,26 +6,23 @@ import 'package:fcs/domain/entities/payment.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/model/invoice_model.dart';
|
import 'package:fcs/pages/invoice/model/invoice_model.dart';
|
||||||
import 'package:fcs/pages/invoice/payment/payment_page_edit.dart';
|
|
||||||
import 'package:fcs/pages/main/util.dart';
|
import 'package:fcs/pages/main/util.dart';
|
||||||
import 'package:fcs/pages/widgets/image_file_picker.dart';
|
|
||||||
import 'package:fcs/pages/widgets/img_picker.dart';
|
import 'package:fcs/pages/widgets/img_picker.dart';
|
||||||
import 'package:fcs/pages/widgets/input_text.dart';
|
import 'package:fcs/pages/widgets/input_text.dart';
|
||||||
import 'package:fcs/pages/widgets/local_button.dart';
|
import 'package:fcs/pages/widgets/local_button.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/local_title.dart';
|
||||||
import 'package:fcs/pages/widgets/progress.dart';
|
import 'package:fcs/pages/widgets/progress.dart';
|
||||||
import 'package:fcs/pages/widgets/show_img.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class PaymentPage extends StatefulWidget {
|
class PaymentPage extends StatefulWidget {
|
||||||
final Invoice invoice;
|
final Invoice invoice;
|
||||||
PaymentPage({this.invoice});
|
final bool forCustomer;
|
||||||
|
PaymentPage({this.invoice, this.forCustomer});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_PaymentPageState createState() => _PaymentPageState();
|
_PaymentPageState createState() => _PaymentPageState();
|
||||||
@@ -164,32 +161,35 @@ class _PaymentPageState extends State<PaymentPage> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [Text('\$ ${p.amount}'), Text('${p.status}')],
|
children: [Text('\$ ${p.amount}'), Text('${p.status}')],
|
||||||
))),
|
))),
|
||||||
Expanded(
|
widget.forCustomer
|
||||||
flex: 1,
|
? Container()
|
||||||
child: Row(
|
: Expanded(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
flex: 1,
|
||||||
children: p.status == payment_pending_status
|
child: Row(
|
||||||
? [
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
InkWell(
|
children: p.status == payment_pending_status
|
||||||
onTap: () => _confirm(p),
|
? [
|
||||||
child: Padding(
|
InkWell(
|
||||||
padding: const EdgeInsets.all(8.0),
|
onTap: () => _confirm(p),
|
||||||
child: Icon(
|
child: Padding(
|
||||||
Icons.check,
|
padding: const EdgeInsets.all(8.0),
|
||||||
color: primaryColor,
|
child: Icon(
|
||||||
|
Icons.check,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
InkWell(
|
||||||
),
|
onTap: () => _cancel(p),
|
||||||
InkWell(
|
child: Padding(
|
||||||
onTap: () => _cancel(p),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Padding(
|
child: Icon(Icons.close,
|
||||||
padding: const EdgeInsets.all(8.0),
|
color: primaryColor),
|
||||||
child: Icon(Icons.close, color: primaryColor),
|
),
|
||||||
),
|
),
|
||||||
),
|
]
|
||||||
]
|
: [],
|
||||||
: [],
|
)),
|
||||||
)),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -213,11 +213,13 @@ class _PaymentPageState extends State<PaymentPage> {
|
|||||||
child: Text('Amount',
|
child: Text('Amount',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(color: Colors.grey))),
|
style: TextStyle(color: Colors.grey))),
|
||||||
Expanded(
|
widget.forCustomer
|
||||||
flex: 1,
|
? Container()
|
||||||
child: Text('Actions',
|
: Expanded(
|
||||||
textAlign: TextAlign.center,
|
flex: 1,
|
||||||
style: TextStyle(color: Colors.grey))),
|
child: Text('Actions',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(color: Colors.grey))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
@@ -248,10 +250,12 @@ class _PaymentPageState extends State<PaymentPage> {
|
|||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold, fontSize: 16.0)))),
|
fontWeight: FontWeight.bold, fontSize: 16.0)))),
|
||||||
Expanded(
|
widget.forCustomer
|
||||||
flex: 1,
|
? Container()
|
||||||
child: Container(),
|
: Expanded(
|
||||||
),
|
flex: 1,
|
||||||
|
child: Container(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -311,9 +311,7 @@ class _ShipmentInfoState extends State<ShipmentInfo> {
|
|||||||
children: getBoxList(context, _shipment.boxes),
|
children: getBoxList(context, _shipment.boxes),
|
||||||
),
|
),
|
||||||
!_isCustomer ? fcsShipmentNumberBox : Container(),
|
!_isCustomer ? fcsShipmentNumberBox : Container(),
|
||||||
...(_shipment.isAssigned ||
|
...(!_shipment.isPending
|
||||||
_shipment.isConfirmed ||
|
|
||||||
_shipment.isPending
|
|
||||||
? [
|
? [
|
||||||
handlingFeeBox,
|
handlingFeeBox,
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user