Support setting edit payment form send email at client/group level
This commit is contained in:
parent
95c9b17fa5
commit
1870dce5ec
|
|
@ -7,6 +7,7 @@ import 'package:built_value/serializer.dart';
|
|||
import 'package:invoiceninja_flutter/constants.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_selectors.dart';
|
||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||
import 'package:invoiceninja_flutter/utils/strings.dart';
|
||||
|
||||
|
|
@ -75,6 +76,8 @@ abstract class PaymentEntity extends Object
|
|||
with BaseEntity, SelectableEntity, BelongsToClient
|
||||
implements Built<PaymentEntity, PaymentEntityBuilder> {
|
||||
factory PaymentEntity({String id, AppState state, ClientEntity client}) {
|
||||
final settings = getClientSettings(state, client);
|
||||
|
||||
return _$PaymentEntity._(
|
||||
id: id ?? BaseEntity.nextId,
|
||||
isChanged: false,
|
||||
|
|
@ -109,7 +112,7 @@ abstract class PaymentEntity extends Object
|
|||
vendorId: '',
|
||||
projectId: '',
|
||||
number: '',
|
||||
sendEmail: state?.company?.settings?.clientManualPaymentNotification,
|
||||
sendEmail: settings.clientManualPaymentNotification ?? false,
|
||||
companyGatewayId: '',
|
||||
clientContactId: '',
|
||||
currencyId: '',
|
||||
|
|
|
|||
|
|
@ -84,6 +84,10 @@ abstract class SettingsEntity
|
|||
defaultTaxName3: clientSettings?.defaultTaxName3 ??
|
||||
groupSettings?.defaultTaxName3 ??
|
||||
companySettings?.defaultTaxName3,
|
||||
clientManualPaymentNotification:
|
||||
clientSettings?.clientManualPaymentNotification ??
|
||||
groupSettings?.clientManualPaymentNotification ??
|
||||
companySettings?.clientManualPaymentNotification,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -428,8 +428,8 @@ void handleClientAction(
|
|||
case EntityAction.newPayment:
|
||||
createEntity(
|
||||
context: context,
|
||||
entity:
|
||||
PaymentEntity(state: state).rebuild((b) => b.clientId = client.id),
|
||||
entity: PaymentEntity(state: state, client: client)
|
||||
.rebuild((b) => b.clientId = client.id),
|
||||
);
|
||||
break;
|
||||
case EntityAction.newProject:
|
||||
|
|
|
|||
|
|
@ -586,9 +586,10 @@ Future handleCreditAction(
|
|||
case EntityAction.applyCredit:
|
||||
createEntity(
|
||||
context: context,
|
||||
entity: PaymentEntity(state: state).rebuild((b) => b
|
||||
entity: PaymentEntity(
|
||||
state: state, client: state.clientState.get(credit.clientId))
|
||||
.rebuild((b) => b
|
||||
..typeId = kPaymentTypeCredit
|
||||
..clientId = credit.clientId
|
||||
..credits.addAll(credits
|
||||
.map((credit) => PaymentableEntity.fromCredit(credit))
|
||||
.toList())),
|
||||
|
|
|
|||
|
|
@ -660,8 +660,9 @@ void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices,
|
|||
case EntityAction.newPayment:
|
||||
createEntity(
|
||||
context: context,
|
||||
entity: PaymentEntity(state: state).rebuild((b) => b
|
||||
..clientId = invoice.clientId
|
||||
entity: PaymentEntity(
|
||||
state: state, client: state.clientState.get(invoice.clientId))
|
||||
.rebuild((b) => b
|
||||
..invoices.addAll(invoices
|
||||
.where((invoice) => !(invoice as InvoiceEntity).isPaid)
|
||||
.map((invoice) => PaymentableEntity.fromInvoice(invoice))
|
||||
|
|
|
|||
|
|
@ -626,7 +626,6 @@ class _CompanyDetailsState extends State<CompanyDetails>
|
|||
FormCard(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
if (!state.settingsUIState.isFiltered)
|
||||
BoolDropdownButton(
|
||||
value: settings.clientManualPaymentNotification,
|
||||
onChanged: (value) => viewModel.onSettingsChanged(
|
||||
|
|
|
|||
Loading…
Reference in New Issue