diff --git a/lib/data/models/company_model.dart b/lib/data/models/company_model.dart index 6b731f1a2..da77664aa 100644 --- a/lib/data/models/company_model.dart +++ b/lib/data/models/company_model.dart @@ -253,6 +253,18 @@ abstract class CompanyEntity extends Object @BuiltValueField(wireName: 'google_analytics_key') 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; @nullable diff --git a/lib/data/models/company_model.g.dart b/lib/data/models/company_model.g.dart index feb2e33a6..cc3149bbb 100644 --- a/lib/data/models/company_model.g.dart +++ b/lib/data/models/company_model.g.dart @@ -236,6 +236,24 @@ class _$CompanyEntitySerializer implements StructuredSerializer { ..add(serializers.serialize(object.plan, 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) { result ..add('enabled_modules') @@ -546,6 +564,18 @@ class _$CompanyEntitySerializer implements StructuredSerializer { result.googleAnalyticsKey = serializers.deserialize(value, specifiedType: const FullType(String)) as String; 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': result.settings.replace(serializers.deserialize(value, specifiedType: const FullType(SettingsEntity)) as SettingsEntity); @@ -2910,6 +2940,12 @@ class _$CompanyEntity extends CompanyEntity { @override final String googleAnalyticsKey; @override + final bool markExpensesInvoiceable; + @override + final bool markExpensesPaid; + @override + final bool invoiceExpenseDocuments; + @override final SettingsEntity settings; @override final int enabledModules; @@ -2988,6 +3024,9 @@ class _$CompanyEntity extends CompanyEntity { this.customFields, this.slackWebhookUrl, this.googleAnalyticsKey, + this.markExpensesInvoiceable, + this.markExpensesPaid, + this.invoiceExpenseDocuments, this.settings, this.enabledModules, this.isChanged, @@ -3241,6 +3280,9 @@ class _$CompanyEntity extends CompanyEntity { customFields == other.customFields && slackWebhookUrl == other.slackWebhookUrl && googleAnalyticsKey == other.googleAnalyticsKey && + markExpensesInvoiceable == other.markExpensesInvoiceable && + markExpensesPaid == other.markExpensesPaid && + invoiceExpenseDocuments == other.invoiceExpenseDocuments && settings == other.settings && enabledModules == other.enabledModules && 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(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), - webhooks.hashCode), - paymentTerms.hashCode), - customFields.hashCode), - slackWebhookUrl.hashCode), - googleAnalyticsKey.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), + webhooks.hashCode), + paymentTerms.hashCode), + customFields.hashCode), + slackWebhookUrl.hashCode), + googleAnalyticsKey.hashCode), + markExpensesInvoiceable.hashCode), + markExpensesPaid.hashCode), + invoiceExpenseDocuments.hashCode), settings.hashCode), enabledModules.hashCode), isChanged.hashCode), @@ -3352,6 +3394,9 @@ class _$CompanyEntity extends CompanyEntity { ..add('customFields', customFields) ..add('slackWebhookUrl', slackWebhookUrl) ..add('googleAnalyticsKey', googleAnalyticsKey) + ..add('markExpensesInvoiceable', markExpensesInvoiceable) + ..add('markExpensesPaid', markExpensesPaid) + ..add('invoiceExpenseDocuments', invoiceExpenseDocuments) ..add('settings', settings) ..add('enabledModules', enabledModules) ..add('isChanged', isChanged) @@ -3640,6 +3685,21 @@ class CompanyEntityBuilder set googleAnalyticsKey(String 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 get settings => _$this._settings ??= new SettingsEntityBuilder(); @@ -3744,6 +3804,9 @@ class CompanyEntityBuilder _customFields = _$v.customFields?.toBuilder(); _slackWebhookUrl = _$v.slackWebhookUrl; _googleAnalyticsKey = _$v.googleAnalyticsKey; + _markExpensesInvoiceable = _$v.markExpensesInvoiceable; + _markExpensesPaid = _$v.markExpensesPaid; + _invoiceExpenseDocuments = _$v.invoiceExpenseDocuments; _settings = _$v.settings?.toBuilder(); _enabledModules = _$v.enabledModules; _isChanged = _$v.isChanged; @@ -3831,6 +3894,9 @@ class CompanyEntityBuilder customFields: customFields.build(), slackWebhookUrl: slackWebhookUrl, googleAnalyticsKey: googleAnalyticsKey, + markExpensesInvoiceable: markExpensesInvoiceable, + markExpensesPaid: markExpensesPaid, + invoiceExpenseDocuments: invoiceExpenseDocuments, settings: settings.build(), enabledModules: enabledModules, isChanged: isChanged, diff --git a/lib/ui/expense/edit/expense_edit_settings.dart b/lib/ui/expense/edit/expense_edit_settings.dart index b326873e8..adb6b245b 100644 --- a/lib/ui/expense/edit/expense_edit_settings.dart +++ b/lib/ui/expense/edit/expense_edit_settings.dart @@ -151,6 +151,7 @@ class ExpenseEditSettingsState extends State { : SwitchListTile( activeColor: Theme.of(context).accentColor, title: Text(localization.markInvoiceable), + subtitle: Text(localization.markInvoiceableHelp), value: expense.shouldBeInvoiced, onChanged: (value) { viewModel.onChanged( @@ -161,6 +162,7 @@ class ExpenseEditSettingsState extends State { activeColor: Theme.of(context).accentColor, title: Text(localization.markPaid), value: showPaymentFields, + subtitle: Text(localization.markPaidHelp), onChanged: (value) { if (value) { if (expense.paymentDate.isEmpty) { @@ -215,6 +217,7 @@ class ExpenseEditSettingsState extends State { SwitchListTile( activeColor: Theme.of(context).accentColor, title: Text(localization.convertCurrency), + subtitle: Text(localization.convertCurrencyHelp), value: showConvertCurrencyFields, onChanged: (value) { setState(() => showConvertCurrencyFields = value); @@ -259,6 +262,7 @@ class ExpenseEditSettingsState extends State { SwitchListTile( activeColor: Theme.of(context).accentColor, title: Text(localization.addDocumentsToInvoice), + subtitle: Text(localization.addDocumentsToInvoiceHelp), value: expense.invoiceDocuments, onChanged: (value) { viewModel.onChanged( diff --git a/lib/ui/settings/expense_settings.dart b/lib/ui/settings/expense_settings.dart index 204c33c7e..5b70b2056 100644 --- a/lib/ui/settings/expense_settings.dart +++ b/lib/ui/settings/expense_settings.dart @@ -50,17 +50,30 @@ class _ExpenseSettingsState extends State { children: [ FormCard( children: [ - /* SwitchListTile( activeColor: Theme.of(context).accentColor, - title: Text(localization.showCost), - value: company.enableExpenseCost ?? false, - subtitle: Text(localization.showCostHelp), + title: Text(localization.markInvoiceable), + value: company.markExpensesInvoiceable ?? false, + subtitle: Text(localization.markInvoiceableHelp), 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)), ), - - */ ], ), ], diff --git a/lib/utils/i18n.dart b/lib/utils/i18n.dart index 4c2555b0a..bfcb0eca5 100644 --- a/lib/utils/i18n.dart +++ b/lib/utils/i18n.dart @@ -15,6 +15,10 @@ mixin LocalizationsProvider on LocaleCodeAware { static final Map> _localizedValues = { 'en': { // 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', 'clone_to_recurring': 'Clone to Recurring', 'crypto': 'Crypto', @@ -4639,9 +4643,21 @@ mixin LocalizationsProvider on LocaleCodeAware { 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 => _localizedValues[localeCode]['expense_settings'] ?? ''; + String get convertCurrencyHelp => + _localizedValues[localeCode]['convert_currency_help'] ?? ''; + String get cloneToRecurring => _localizedValues[localeCode]['clone_to_recurring'] ?? '';