disable cancel invoice in customer

This commit is contained in:
Sai Naw Wun
2020-10-28 06:58:45 +06:30
parent fca5b2e8bf
commit 703a633108
3 changed files with 39 additions and 10 deletions

View File

@@ -66,6 +66,7 @@ class _InvoiceInfoState extends State<InvoiceInfo> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
bool isCanceled = _invoice.status == invoice_cancel_status; bool isCanceled = _invoice.status == invoice_cancel_status;
bool isPaid = _invoice.status == invoice_paid_status;
var rateModel = Provider.of<ShipmentRateModel>(context); var rateModel = Provider.of<ShipmentRateModel>(context);
var rate = rateModel.rate; var rate = rateModel.rate;
@@ -182,7 +183,9 @@ class _InvoiceInfoState extends State<InvoiceInfo> {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
isCanceled || widget.forCustomer ? Container() : cancelBtn, isCanceled || isPaid || widget.forCustomer
? Container()
: cancelBtn,
], ],
), ),
), ),

View File

@@ -141,6 +141,28 @@ class InvoiceListRow extends StatelessWidget {
builder: (context) => builder: (context) =>
InvoiceInfo(invoice: invoice, forCustomer: forCustomer))); InvoiceInfo(invoice: invoice, forCustomer: forCustomer)));
}, },
),
CupertinoActionSheetAction(
child: Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
'Payments',
style: TextStyle(fontSize: 16, color: Colors.black),
),
),
],
),
onPressed: () async {
//to go invoice info page
Navigator.pop(context);
Navigator.of(context).push(CupertinoPageRoute(
builder: (context) => PaymentPage(
invoice: invoice,
forCustomer: forCustomer,
)));
},
) )
], ],
); );

View File

@@ -37,11 +37,13 @@ class _PaymentPageState extends State<PaymentPage> {
bool isNew; bool isNew;
File _file; File _file;
bool _hasBalance;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_invoice = widget.invoice; _invoice = widget.invoice;
_hasBalance = widget.invoice.balance > 0;
_loadInvoice(); _loadInvoice();
} }
@@ -100,16 +102,18 @@ class _PaymentPageState extends State<PaymentPage> {
body: ListView( body: ListView(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
children: <Widget>[ children: <Widget>[
amountBox, _hasBalance ? amountBox : Container(),
SizedBox(height: 10), SizedBox(height: 10),
Align( _hasBalance
child: Padding( ? Align(
padding: const EdgeInsets.all(8.0), child: Padding(
child: receiptFileBox, padding: const EdgeInsets.all(8.0),
), child: receiptFileBox,
alignment: Alignment.centerLeft, ),
), alignment: Alignment.centerLeft,
payBtnBox, )
: Container(),
_hasBalance ? payBtnBox : Container(),
SizedBox(height: 15), SizedBox(height: 15),
LocalTitle(textKey: "pm.receipt"), LocalTitle(textKey: "pm.receipt"),
Column( Column(