fix invoice display

This commit is contained in:
Sai Naw Wun
2020-10-28 06:23:04 +06:30
parent 9f58e7f748
commit bd63e1e161
4 changed files with 54 additions and 46 deletions

View File

@@ -121,7 +121,9 @@ class _InvoiceListState extends State<InvoiceList> {
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(),
), ),

View File

@@ -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,
)));
}, },
)), )),
) )

View File

@@ -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,7 +161,9 @@ 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
? Container()
: Expanded(
flex: 1, flex: 1,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@@ -184,7 +183,8 @@ class _PaymentPageState extends State<PaymentPage> {
onTap: () => _cancel(p), onTap: () => _cancel(p),
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Icon(Icons.close, color: primaryColor), child: Icon(Icons.close,
color: primaryColor),
), ),
), ),
] ]
@@ -213,7 +213,9 @@ 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
? Container()
: Expanded(
flex: 1, flex: 1,
child: Text('Actions', child: Text('Actions',
textAlign: TextAlign.center, textAlign: TextAlign.center,
@@ -248,7 +250,9 @@ 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
? Container()
: Expanded(
flex: 1, flex: 1,
child: Container(), child: Container(),
), ),

View File

@@ -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,
] ]