Standardize bottom buttons
This commit is contained in:
parent
1b29028207
commit
be250ff75d
|
|
@ -170,15 +170,15 @@ abstract class ProjectEntity extends Object
|
|||
}
|
||||
|
||||
if (isActive && client?.isActive == true) {
|
||||
if (userCompany.canCreate(EntityType.invoice)) {
|
||||
actions.add(EntityAction.invoiceProject);
|
||||
}
|
||||
if (userCompany.canCreate(EntityType.task)) {
|
||||
actions.add(EntityAction.newTask);
|
||||
}
|
||||
if (userCompany.canCreate(EntityType.expense)) {
|
||||
actions.add(EntityAction.newExpense);
|
||||
}
|
||||
if (userCompany.canCreate(EntityType.invoice)) {
|
||||
actions.add(EntityAction.invoiceProject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -119,10 +119,9 @@ class _ExpenseViewState extends State<ExpenseView>
|
|||
),
|
||||
BottomButtons(
|
||||
entity: expense,
|
||||
action1: EntityAction.clone,
|
||||
action2: expense.isInvoiced
|
||||
? EntityAction.archive
|
||||
: EntityAction.invoiceExpense,
|
||||
action1: EntityAction.invoiceExpense,
|
||||
action1Enabled: !expense.isInvoiced,
|
||||
action2: EntityAction.clone,
|
||||
)
|
||||
],
|
||||
);
|
||||
|
|
|
|||
|
|
@ -110,22 +110,15 @@ class _InvoiceViewState extends State<InvoiceView>
|
|||
final documents = invoice.documents;
|
||||
|
||||
EntityAction secondAction;
|
||||
if (invoice.isCredit) {
|
||||
secondAction = EntityAction.cloneToCredit;
|
||||
} else if (invoice.isQuote) {
|
||||
if (invoice.hasInvoice) {
|
||||
secondAction = EntityAction.cloneToQuote;
|
||||
} else {
|
||||
secondAction = EntityAction.convertToInvoice;
|
||||
}
|
||||
} else if (invoice.isRecurringInvoice) {
|
||||
|
||||
if (invoice.isRecurringInvoice) {
|
||||
secondAction = invoice.isRunning ? EntityAction.stop : EntityAction.start;
|
||||
} else if (invoice.isCredit) {
|
||||
secondAction = EntityAction.emailCredit;
|
||||
} else if (invoice.isQuote) {
|
||||
secondAction = EntityAction.emailQuote;
|
||||
} else {
|
||||
if (invoice.isPaid) {
|
||||
secondAction = EntityAction.cloneToInvoice;
|
||||
} else {
|
||||
secondAction = EntityAction.newPayment;
|
||||
}
|
||||
secondAction = EntityAction.emailInvoice;
|
||||
}
|
||||
|
||||
return ViewScaffold(
|
||||
|
|
|
|||
|
|
@ -165,9 +165,10 @@ class _PaymentViewState extends State<PaymentView> {
|
|||
),
|
||||
BottomButtons(
|
||||
entity: payment,
|
||||
action1: EntityAction.refund,
|
||||
action1Enabled: payment.refunded < payment.amount,
|
||||
action2: EntityAction.archive,
|
||||
action1: EntityAction.apply,
|
||||
action1Enabled: payment.applied < payment.amount,
|
||||
action2: EntityAction.refund,
|
||||
action2Enabled: payment.refunded < payment.amount,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -121,8 +121,8 @@ class _ProductViewState extends State<ProductView>
|
|||
),
|
||||
BottomButtons(
|
||||
entity: product,
|
||||
action1: EntityAction.clone,
|
||||
action2: EntityAction.newInvoice,
|
||||
action1: EntityAction.newInvoice,
|
||||
action2: EntityAction.clone,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/client/client_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/vendor/vendor_actions.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/buttons/bottom_buttons.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/view_scaffold.dart';
|
||||
import 'package:invoiceninja_flutter/ui/vendor/view/vendor_view_details.dart';
|
||||
import 'package:invoiceninja_flutter/ui/vendor/view/vendor_view_documents.dart';
|
||||
|
|
@ -92,25 +94,34 @@ class _VendorViewState extends State<VendorView>
|
|||
],
|
||||
),
|
||||
body: Builder(builder: (context) {
|
||||
return TabBarView(
|
||||
controller: _controller,
|
||||
children: <Widget>[
|
||||
RefreshIndicator(
|
||||
onRefresh: () => viewModel.onRefreshed(context),
|
||||
child: VendorOverview(
|
||||
viewModel: viewModel,
|
||||
isFilter: widget.isFilter,
|
||||
),
|
||||
return Column(
|
||||
children: [
|
||||
TabBarView(
|
||||
controller: _controller,
|
||||
children: <Widget>[
|
||||
RefreshIndicator(
|
||||
onRefresh: () => viewModel.onRefreshed(context),
|
||||
child: VendorOverview(
|
||||
viewModel: viewModel,
|
||||
isFilter: widget.isFilter,
|
||||
),
|
||||
),
|
||||
RefreshIndicator(
|
||||
onRefresh: () => viewModel.onRefreshed(context),
|
||||
child: VendorViewDetails(vendor: viewModel.vendor),
|
||||
),
|
||||
RefreshIndicator(
|
||||
onRefresh: () => viewModel.onRefreshed(context),
|
||||
child: VendorViewDocuments(
|
||||
viewModel: viewModel,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
RefreshIndicator(
|
||||
onRefresh: () => viewModel.onRefreshed(context),
|
||||
child: VendorViewDetails(vendor: viewModel.vendor),
|
||||
),
|
||||
RefreshIndicator(
|
||||
onRefresh: () => viewModel.onRefreshed(context),
|
||||
child: VendorViewDocuments(
|
||||
viewModel: viewModel,
|
||||
),
|
||||
BottomButtons(
|
||||
entity: vendor,
|
||||
action1: EntityAction.newExpense,
|
||||
action2: EntityAction.archive,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue