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
Widget build(BuildContext context) {
bool isCanceled = _invoice.status == invoice_cancel_status;
bool isPaid = _invoice.status == invoice_paid_status;
var rateModel = Provider.of<ShipmentRateModel>(context);
var rate = rateModel.rate;
@@ -182,7 +183,9 @@ class _InvoiceInfoState extends State<InvoiceInfo> {
SizedBox(
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) =>
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;
File _file;
bool _hasBalance;
@override
void initState() {
super.initState();
_invoice = widget.invoice;
_hasBalance = widget.invoice.balance > 0;
_loadInvoice();
}
@@ -100,16 +102,18 @@ class _PaymentPageState extends State<PaymentPage> {
body: ListView(
padding: const EdgeInsets.all(10.0),
children: <Widget>[
amountBox,
_hasBalance ? amountBox : Container(),
SizedBox(height: 10),
Align(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: receiptFileBox,
),
alignment: Alignment.centerLeft,
),
payBtnBox,
_hasBalance
? Align(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: receiptFileBox,
),
alignment: Alignment.centerLeft,
)
: Container(),
_hasBalance ? payBtnBox : Container(),
SizedBox(height: 15),
LocalTitle(textKey: "pm.receipt"),
Column(