diff --git a/lib/pages/invoice/invoice_list.dart b/lib/pages/invoice/invoice_list.dart index 567c21d..6222180 100644 --- a/lib/pages/invoice/invoice_list.dart +++ b/lib/pages/invoice/invoice_list.dart @@ -120,8 +120,10 @@ class _InvoiceListState extends State { itemCount: invoiceModel.invoices.length, itemBuilder: (BuildContext context, int index) { return InvoiceListRow( - key: ValueKey(invoiceModel.invoices[index].id), - invoice: invoiceModel.invoices[index]); + key: ValueKey(invoiceModel.invoices[index].id), + invoice: invoiceModel.invoices[index], + forCustomer: widget.forCustomer, + ); }), onRefresh: () => invoiceModel.refresh(), ), diff --git a/lib/pages/invoice/invoice_list_row.dart b/lib/pages/invoice/invoice_list_row.dart index a06d268..69d527b 100644 --- a/lib/pages/invoice/invoice_list_row.dart +++ b/lib/pages/invoice/invoice_list_row.dart @@ -13,7 +13,8 @@ import '../widgets/pdf_screen.dart'; class InvoiceListRow extends StatelessWidget { final dateFormatter = new DateFormat('dd MMM yyyy'); 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 Widget build(BuildContext context) { @@ -91,7 +92,10 @@ class InvoiceListRow extends StatelessWidget { ), onPressed: () { Navigator.of(context).push(CupertinoPageRoute( - builder: (context) => PaymentPage(invoice: invoice))); + builder: (context) => PaymentPage( + invoice: invoice, + forCustomer: forCustomer, + ))); }, )), ) diff --git a/lib/pages/invoice/payment/payment_page.dart b/lib/pages/invoice/payment/payment_page.dart index 4a85022..a98e1ec 100644 --- a/lib/pages/invoice/payment/payment_page.dart +++ b/lib/pages/invoice/payment/payment_page.dart @@ -6,26 +6,23 @@ import 'package:fcs/domain/entities/payment.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/localization/app_translations.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/widgets/image_file_picker.dart'; import 'package:fcs/pages/widgets/img_picker.dart'; import 'package:fcs/pages/widgets/input_text.dart'; import 'package:fcs/pages/widgets/local_button.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/local_title.dart'; import 'package:fcs/pages/widgets/progress.dart'; -import 'package:fcs/pages/widgets/show_img.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:image_picker/image_picker.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; class PaymentPage extends StatefulWidget { final Invoice invoice; - PaymentPage({this.invoice}); + final bool forCustomer; + PaymentPage({this.invoice, this.forCustomer}); @override _PaymentPageState createState() => _PaymentPageState(); @@ -164,32 +161,35 @@ class _PaymentPageState extends State { child: Column( children: [Text('\$ ${p.amount}'), Text('${p.status}')], ))), - Expanded( - flex: 1, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: p.status == payment_pending_status - ? [ - InkWell( - onTap: () => _confirm(p), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Icon( - Icons.check, - color: primaryColor, + widget.forCustomer + ? Container() + : Expanded( + flex: 1, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: p.status == payment_pending_status + ? [ + InkWell( + onTap: () => _confirm(p), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Icon( + Icons.check, + color: primaryColor, + ), + ), ), - ), - ), - InkWell( - onTap: () => _cancel(p), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Icon(Icons.close, color: primaryColor), - ), - ), - ] - : [], - )), + InkWell( + onTap: () => _cancel(p), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Icon(Icons.close, + color: primaryColor), + ), + ), + ] + : [], + )), ], ), ); @@ -213,11 +213,13 @@ class _PaymentPageState extends State { child: Text('Amount', textAlign: TextAlign.center, style: TextStyle(color: Colors.grey))), - Expanded( - flex: 1, - child: Text('Actions', - textAlign: TextAlign.center, - style: TextStyle(color: Colors.grey))), + widget.forCustomer + ? Container() + : Expanded( + flex: 1, + child: Text('Actions', + textAlign: TextAlign.center, + style: TextStyle(color: Colors.grey))), ], ), )); @@ -248,10 +250,12 @@ class _PaymentPageState extends State { textAlign: TextAlign.center, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 16.0)))), - Expanded( - flex: 1, - child: Container(), - ), + widget.forCustomer + ? Container() + : Expanded( + flex: 1, + child: Container(), + ), ], ), )); diff --git a/lib/pages/shipment/shipment_info.dart b/lib/pages/shipment/shipment_info.dart index d9075c3..0b011bc 100644 --- a/lib/pages/shipment/shipment_info.dart +++ b/lib/pages/shipment/shipment_info.dart @@ -311,9 +311,7 @@ class _ShipmentInfoState extends State { children: getBoxList(context, _shipment.boxes), ), !_isCustomer ? fcsShipmentNumberBox : Container(), - ...(_shipment.isAssigned || - _shipment.isConfirmed || - _shipment.isPending + ...(!_shipment.isPending ? [ handlingFeeBox, ]