This commit is contained in:
Hillel Coren 2020-10-14 23:18:29 +03:00
parent c7335a8dbb
commit f3fd24152b
5 changed files with 127 additions and 16 deletions

View File

@ -253,6 +253,18 @@ abstract class CompanyEntity extends Object
@BuiltValueField(wireName: 'google_analytics_key') @BuiltValueField(wireName: 'google_analytics_key')
String get googleAnalyticsKey; String get googleAnalyticsKey;
@nullable // TODO remove nullable
@BuiltValueField(wireName: 'mark_expenses_invoiceable')
bool get markExpensesInvoiceable;
@nullable // TODO remove nullable
@BuiltValueField(wireName: 'mark_expenses_paid')
bool get markExpensesPaid;
@nullable // TODO remove nullable
@BuiltValueField(wireName: 'invoice_expense_documents')
bool get invoiceExpenseDocuments;
SettingsEntity get settings; SettingsEntity get settings;
@nullable @nullable

View File

@ -236,6 +236,24 @@ class _$CompanyEntitySerializer implements StructuredSerializer<CompanyEntity> {
..add(serializers.serialize(object.plan, ..add(serializers.serialize(object.plan,
specifiedType: const FullType(String))); specifiedType: const FullType(String)));
} }
if (object.markExpensesInvoiceable != null) {
result
..add('mark_expenses_invoiceable')
..add(serializers.serialize(object.markExpensesInvoiceable,
specifiedType: const FullType(bool)));
}
if (object.markExpensesPaid != null) {
result
..add('mark_expenses_paid')
..add(serializers.serialize(object.markExpensesPaid,
specifiedType: const FullType(bool)));
}
if (object.invoiceExpenseDocuments != null) {
result
..add('invoice_expense_documents')
..add(serializers.serialize(object.invoiceExpenseDocuments,
specifiedType: const FullType(bool)));
}
if (object.enabledModules != null) { if (object.enabledModules != null) {
result result
..add('enabled_modules') ..add('enabled_modules')
@ -546,6 +564,18 @@ class _$CompanyEntitySerializer implements StructuredSerializer<CompanyEntity> {
result.googleAnalyticsKey = serializers.deserialize(value, result.googleAnalyticsKey = serializers.deserialize(value,
specifiedType: const FullType(String)) as String; specifiedType: const FullType(String)) as String;
break; break;
case 'mark_expenses_invoiceable':
result.markExpensesInvoiceable = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
break;
case 'mark_expenses_paid':
result.markExpensesPaid = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
break;
case 'invoice_expense_documents':
result.invoiceExpenseDocuments = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
break;
case 'settings': case 'settings':
result.settings.replace(serializers.deserialize(value, result.settings.replace(serializers.deserialize(value,
specifiedType: const FullType(SettingsEntity)) as SettingsEntity); specifiedType: const FullType(SettingsEntity)) as SettingsEntity);
@ -2910,6 +2940,12 @@ class _$CompanyEntity extends CompanyEntity {
@override @override
final String googleAnalyticsKey; final String googleAnalyticsKey;
@override @override
final bool markExpensesInvoiceable;
@override
final bool markExpensesPaid;
@override
final bool invoiceExpenseDocuments;
@override
final SettingsEntity settings; final SettingsEntity settings;
@override @override
final int enabledModules; final int enabledModules;
@ -2988,6 +3024,9 @@ class _$CompanyEntity extends CompanyEntity {
this.customFields, this.customFields,
this.slackWebhookUrl, this.slackWebhookUrl,
this.googleAnalyticsKey, this.googleAnalyticsKey,
this.markExpensesInvoiceable,
this.markExpensesPaid,
this.invoiceExpenseDocuments,
this.settings, this.settings,
this.enabledModules, this.enabledModules,
this.isChanged, this.isChanged,
@ -3241,6 +3280,9 @@ class _$CompanyEntity extends CompanyEntity {
customFields == other.customFields && customFields == other.customFields &&
slackWebhookUrl == other.slackWebhookUrl && slackWebhookUrl == other.slackWebhookUrl &&
googleAnalyticsKey == other.googleAnalyticsKey && googleAnalyticsKey == other.googleAnalyticsKey &&
markExpensesInvoiceable == other.markExpensesInvoiceable &&
markExpensesPaid == other.markExpensesPaid &&
invoiceExpenseDocuments == other.invoiceExpenseDocuments &&
settings == other.settings && settings == other.settings &&
enabledModules == other.enabledModules && enabledModules == other.enabledModules &&
isChanged == other.isChanged && isChanged == other.isChanged &&
@ -3275,15 +3317,15 @@ class _$CompanyEntity extends CompanyEntity {
$jc( $jc(
$jc( $jc(
$jc( $jc(
$jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, enableCustomSurchargeTaxes1.hashCode), enableCustomSurchargeTaxes2.hashCode), enableCustomSurchargeTaxes3.hashCode), enableCustomSurchargeTaxes4.hashCode), sizeId.hashCode), industryId.hashCode), subdomain.hashCode), portalMode.hashCode), portalDomain.hashCode), updateProducts.hashCode), convertProductExchangeRate.hashCode), fillProducts.hashCode), enableProductCost.hashCode), enableProductQuantity.hashCode), defaultQuantity.hashCode), showProductDetails.hashCode), clientCanRegister.hashCode), isLarge.hashCode), enableShopApi.hashCode), plan.hashCode), companyKey.hashCode), firstDayOfWeek.hashCode), firstMonthOfYear.hashCode), numberOfInvoiceTaxRates.hashCode), numberOfItemTaxRates.hashCode), groups.hashCode), activities.hashCode), taxRates.hashCode), taskStatuses.hashCode), taskStatusMap.hashCode), companyGateways.hashCode), expenseCategories.hashCode), expenseCategoryMap.hashCode), users.hashCode), clients.hashCode), products.hashCode), invoices.hashCode), recurringInvoices.hashCode), payments.hashCode), quotes.hashCode), credits.hashCode), tasks.hashCode), projects.hashCode), expenses.hashCode), $jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, enableCustomSurchargeTaxes1.hashCode), enableCustomSurchargeTaxes2.hashCode), enableCustomSurchargeTaxes3.hashCode), enableCustomSurchargeTaxes4.hashCode), sizeId.hashCode), industryId.hashCode), subdomain.hashCode), portalMode.hashCode), portalDomain.hashCode), updateProducts.hashCode), convertProductExchangeRate.hashCode), fillProducts.hashCode), enableProductCost.hashCode), enableProductQuantity.hashCode), defaultQuantity.hashCode), showProductDetails.hashCode), clientCanRegister.hashCode), isLarge.hashCode), enableShopApi.hashCode), plan.hashCode), companyKey.hashCode), firstDayOfWeek.hashCode), firstMonthOfYear.hashCode), numberOfInvoiceTaxRates.hashCode), numberOfItemTaxRates.hashCode), groups.hashCode), activities.hashCode), taxRates.hashCode), taskStatuses.hashCode), taskStatusMap.hashCode), companyGateways.hashCode), expenseCategories.hashCode), expenseCategoryMap.hashCode), users.hashCode), clients.hashCode), products.hashCode), invoices.hashCode), recurringInvoices.hashCode), payments.hashCode), quotes.hashCode), credits.hashCode), tasks.hashCode), projects.hashCode), expenses.hashCode), vendors.hashCode), designs.hashCode), tokens.hashCode),
vendors.hashCode), webhooks.hashCode),
designs.hashCode), paymentTerms.hashCode),
tokens.hashCode), customFields.hashCode),
webhooks.hashCode), slackWebhookUrl.hashCode),
paymentTerms.hashCode), googleAnalyticsKey.hashCode),
customFields.hashCode), markExpensesInvoiceable.hashCode),
slackWebhookUrl.hashCode), markExpensesPaid.hashCode),
googleAnalyticsKey.hashCode), invoiceExpenseDocuments.hashCode),
settings.hashCode), settings.hashCode),
enabledModules.hashCode), enabledModules.hashCode),
isChanged.hashCode), isChanged.hashCode),
@ -3352,6 +3394,9 @@ class _$CompanyEntity extends CompanyEntity {
..add('customFields', customFields) ..add('customFields', customFields)
..add('slackWebhookUrl', slackWebhookUrl) ..add('slackWebhookUrl', slackWebhookUrl)
..add('googleAnalyticsKey', googleAnalyticsKey) ..add('googleAnalyticsKey', googleAnalyticsKey)
..add('markExpensesInvoiceable', markExpensesInvoiceable)
..add('markExpensesPaid', markExpensesPaid)
..add('invoiceExpenseDocuments', invoiceExpenseDocuments)
..add('settings', settings) ..add('settings', settings)
..add('enabledModules', enabledModules) ..add('enabledModules', enabledModules)
..add('isChanged', isChanged) ..add('isChanged', isChanged)
@ -3640,6 +3685,21 @@ class CompanyEntityBuilder
set googleAnalyticsKey(String googleAnalyticsKey) => set googleAnalyticsKey(String googleAnalyticsKey) =>
_$this._googleAnalyticsKey = googleAnalyticsKey; _$this._googleAnalyticsKey = googleAnalyticsKey;
bool _markExpensesInvoiceable;
bool get markExpensesInvoiceable => _$this._markExpensesInvoiceable;
set markExpensesInvoiceable(bool markExpensesInvoiceable) =>
_$this._markExpensesInvoiceable = markExpensesInvoiceable;
bool _markExpensesPaid;
bool get markExpensesPaid => _$this._markExpensesPaid;
set markExpensesPaid(bool markExpensesPaid) =>
_$this._markExpensesPaid = markExpensesPaid;
bool _invoiceExpenseDocuments;
bool get invoiceExpenseDocuments => _$this._invoiceExpenseDocuments;
set invoiceExpenseDocuments(bool invoiceExpenseDocuments) =>
_$this._invoiceExpenseDocuments = invoiceExpenseDocuments;
SettingsEntityBuilder _settings; SettingsEntityBuilder _settings;
SettingsEntityBuilder get settings => SettingsEntityBuilder get settings =>
_$this._settings ??= new SettingsEntityBuilder(); _$this._settings ??= new SettingsEntityBuilder();
@ -3744,6 +3804,9 @@ class CompanyEntityBuilder
_customFields = _$v.customFields?.toBuilder(); _customFields = _$v.customFields?.toBuilder();
_slackWebhookUrl = _$v.slackWebhookUrl; _slackWebhookUrl = _$v.slackWebhookUrl;
_googleAnalyticsKey = _$v.googleAnalyticsKey; _googleAnalyticsKey = _$v.googleAnalyticsKey;
_markExpensesInvoiceable = _$v.markExpensesInvoiceable;
_markExpensesPaid = _$v.markExpensesPaid;
_invoiceExpenseDocuments = _$v.invoiceExpenseDocuments;
_settings = _$v.settings?.toBuilder(); _settings = _$v.settings?.toBuilder();
_enabledModules = _$v.enabledModules; _enabledModules = _$v.enabledModules;
_isChanged = _$v.isChanged; _isChanged = _$v.isChanged;
@ -3831,6 +3894,9 @@ class CompanyEntityBuilder
customFields: customFields.build(), customFields: customFields.build(),
slackWebhookUrl: slackWebhookUrl, slackWebhookUrl: slackWebhookUrl,
googleAnalyticsKey: googleAnalyticsKey, googleAnalyticsKey: googleAnalyticsKey,
markExpensesInvoiceable: markExpensesInvoiceable,
markExpensesPaid: markExpensesPaid,
invoiceExpenseDocuments: invoiceExpenseDocuments,
settings: settings.build(), settings: settings.build(),
enabledModules: enabledModules, enabledModules: enabledModules,
isChanged: isChanged, isChanged: isChanged,

View File

@ -151,6 +151,7 @@ class ExpenseEditSettingsState extends State<ExpenseEditSettings> {
: SwitchListTile( : SwitchListTile(
activeColor: Theme.of(context).accentColor, activeColor: Theme.of(context).accentColor,
title: Text(localization.markInvoiceable), title: Text(localization.markInvoiceable),
subtitle: Text(localization.markInvoiceableHelp),
value: expense.shouldBeInvoiced, value: expense.shouldBeInvoiced,
onChanged: (value) { onChanged: (value) {
viewModel.onChanged( viewModel.onChanged(
@ -161,6 +162,7 @@ class ExpenseEditSettingsState extends State<ExpenseEditSettings> {
activeColor: Theme.of(context).accentColor, activeColor: Theme.of(context).accentColor,
title: Text(localization.markPaid), title: Text(localization.markPaid),
value: showPaymentFields, value: showPaymentFields,
subtitle: Text(localization.markPaidHelp),
onChanged: (value) { onChanged: (value) {
if (value) { if (value) {
if (expense.paymentDate.isEmpty) { if (expense.paymentDate.isEmpty) {
@ -215,6 +217,7 @@ class ExpenseEditSettingsState extends State<ExpenseEditSettings> {
SwitchListTile( SwitchListTile(
activeColor: Theme.of(context).accentColor, activeColor: Theme.of(context).accentColor,
title: Text(localization.convertCurrency), title: Text(localization.convertCurrency),
subtitle: Text(localization.convertCurrencyHelp),
value: showConvertCurrencyFields, value: showConvertCurrencyFields,
onChanged: (value) { onChanged: (value) {
setState(() => showConvertCurrencyFields = value); setState(() => showConvertCurrencyFields = value);
@ -259,6 +262,7 @@ class ExpenseEditSettingsState extends State<ExpenseEditSettings> {
SwitchListTile( SwitchListTile(
activeColor: Theme.of(context).accentColor, activeColor: Theme.of(context).accentColor,
title: Text(localization.addDocumentsToInvoice), title: Text(localization.addDocumentsToInvoice),
subtitle: Text(localization.addDocumentsToInvoiceHelp),
value: expense.invoiceDocuments, value: expense.invoiceDocuments,
onChanged: (value) { onChanged: (value) {
viewModel.onChanged( viewModel.onChanged(

View File

@ -50,17 +50,30 @@ class _ExpenseSettingsState extends State<ExpenseSettings> {
children: <Widget>[ children: <Widget>[
FormCard( FormCard(
children: <Widget>[ children: <Widget>[
/*
SwitchListTile( SwitchListTile(
activeColor: Theme.of(context).accentColor, activeColor: Theme.of(context).accentColor,
title: Text(localization.showCost), title: Text(localization.markInvoiceable),
value: company.enableExpenseCost ?? false, value: company.markExpensesInvoiceable ?? false,
subtitle: Text(localization.showCostHelp), subtitle: Text(localization.markInvoiceableHelp),
onChanged: (value) => viewModel.onCompanyChanged( onChanged: (value) => viewModel.onCompanyChanged(
company.rebuild((b) => b..enableExpenseCost = value)), company.rebuild((b) => b..markExpensesInvoiceable = value)),
),
SwitchListTile(
activeColor: Theme.of(context).accentColor,
title: Text(localization.markPaid),
value: company.markExpensesPaid ?? false,
subtitle: Text(localization.markPaidHelp),
onChanged: (value) => viewModel.onCompanyChanged(
company.rebuild((b) => b..markExpensesPaid = value)),
),
SwitchListTile(
activeColor: Theme.of(context).accentColor,
title: Text(localization.addDocumentsToInvoice),
value: company.invoiceExpenseDocuments ?? false,
subtitle: Text(localization.addDocumentsToInvoiceHelp),
onChanged: (value) => viewModel.onCompanyChanged(
company.rebuild((b) => b..invoiceExpenseDocuments = value)),
), ),
*/
], ],
), ),
], ],

View File

@ -15,6 +15,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = { static final Map<String, Map<String, String>> _localizedValues = {
'en': { 'en': {
// STARTER: lang key - do not remove comment // STARTER: lang key - do not remove comment
'mark_paid_help': 'Track the expense has been paid',
'mark_invoiceable_help': 'Enable the expense to be invoiced',
'add_documents_to_invoice_help': 'Make the documents visible to clients',
'convert_currency_help': 'Set an exchange rate',
'expense_settings': 'Expense Settings', 'expense_settings': 'Expense Settings',
'clone_to_recurring': 'Clone to Recurring', 'clone_to_recurring': 'Clone to Recurring',
'crypto': 'Crypto', 'crypto': 'Crypto',
@ -4639,9 +4643,21 @@ mixin LocalizationsProvider on LocaleCodeAware {
String get crypto => _localizedValues[localeCode]['crypto'] ?? ''; String get crypto => _localizedValues[localeCode]['crypto'] ?? '';
String get markPaidHelp =>
_localizedValues[localeCode]['mark_paid_help'] ?? '';
String get markInvoiceableHelp =>
_localizedValues[localeCode]['mark_invoiceable_help'] ?? '';
String get addDocumentsToInvoiceHelp =>
_localizedValues[localeCode]['add_documents_to_invoice_help'] ?? '';
String get expenseSettings => String get expenseSettings =>
_localizedValues[localeCode]['expense_settings'] ?? ''; _localizedValues[localeCode]['expense_settings'] ?? '';
String get convertCurrencyHelp =>
_localizedValues[localeCode]['convert_currency_help'] ?? '';
String get cloneToRecurring => String get cloneToRecurring =>
_localizedValues[localeCode]['clone_to_recurring'] ?? ''; _localizedValues[localeCode]['clone_to_recurring'] ?? '';