diff --git a/lib/data/models/subscription_model.dart b/lib/data/models/subscription_model.dart index f41e32870..dac5af94d 100644 --- a/lib/data/models/subscription_model.dart +++ b/lib/data/models/subscription_model.dart @@ -65,7 +65,7 @@ abstract class SubscriptionEntity extends Object createdUserId: '', assignedUserId: '', archivedAt: 0, - allowCancellation: false, + allowCancellation: true, allowPlanChanges: false, allowQueryOverrides: false, autoBill: '', diff --git a/lib/ui/app/presenters/entity_presenter.dart b/lib/ui/app/presenters/entity_presenter.dart index cf1e61b13..c941777c0 100644 --- a/lib/ui/app/presenters/entity_presenter.dart +++ b/lib/ui/app/presenters/entity_presenter.dart @@ -23,7 +23,7 @@ class EntityPresenter { var name = entity.listDisplayName; // TODO replace with this: https://github.com/flutter/flutter/issues/45336 - if (name.isEmpty) { + if ((name ?? '').isEmpty) { name = localization.pending; } else if (name.length > 10) { return name; diff --git a/lib/ui/subscription/edit/subscription_edit.dart b/lib/ui/subscription/edit/subscription_edit.dart index 0ba45ab55..d760de09a 100644 --- a/lib/ui/subscription/edit/subscription_edit.dart +++ b/lib/ui/subscription/edit/subscription_edit.dart @@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:invoiceninja_flutter/ui/app/edit_scaffold.dart'; import 'package:invoiceninja_flutter/ui/app/form_card.dart'; +import 'package:invoiceninja_flutter/ui/app/forms/bool_dropdown_button.dart'; import 'package:invoiceninja_flutter/ui/app/scrollable_listview.dart'; import 'package:invoiceninja_flutter/ui/subscription/edit/subscription_edit_vm.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; @@ -109,6 +110,11 @@ class _SubscriptionEditState extends State { labelText: 'Subscriptions', ), ), + BoolDropdownButton( + label: localization.allowCancellation, + value: subscription.allowCancellation, + onChanged: (value) => viewModel.onChanged(subscription + .rebuild((b) => b..allowCancellation = value))), ], ), ], diff --git a/lib/utils/i18n.dart b/lib/utils/i18n.dart index 50ea01aa6..d97f48b11 100644 --- a/lib/utils/i18n.dart +++ b/lib/utils/i18n.dart @@ -15,6 +15,20 @@ mixin LocalizationsProvider on LocaleCodeAware { static final Map> _localizedValues = { 'en': { // STARTER: lang key - do not remove comment + 'recurring_products': 'Recurring Products', + 'promo_code': 'Promo Code', + 'promo_discount': 'Promo Discount', + 'allow_cancellation': 'Allow Cancellation', + 'per_seat_enabled': 'Per Seat Enabled', + 'max_seats_limit': 'Max Seats Limit', + 'trial_enabled': 'Trial Enabled', + 'trial_duration': 'Trial Duration', + 'allow_query_overrides': 'Allow Query Overrides', + 'allow_plan_changes': 'Allow Plan Changes', + 'plan_map': 'Plan Map', + 'refund_period': 'Refund Period', + 'webhook_configuration': 'Webhook Configuration', + 'purchase_page': 'Purchase Page', 'security': 'Security', 'email_bounced': 'Email Bounced', 'email_spam_complaint': 'Spam Complaint', @@ -56238,6 +56252,62 @@ mixin LocalizationsProvider on LocaleCodeAware { _localizedValues[localeCode]['modified'] ?? _localizedValues['en']['modified']; + String get recurringProducts => + _localizedValues[localeCode]['recurring_products'] ?? + _localizedValues['en']['recurring_products']; + + String get promoCode => + _localizedValues[localeCode]['promo_code'] ?? + _localizedValues['en']['promo_code']; + + String get promoDiscount => + _localizedValues[localeCode]['promo_discount'] ?? + _localizedValues['en']['promo_discount']; + + String get allowCancellation => + _localizedValues[localeCode]['allow_cancellation'] ?? + _localizedValues['en']['allow_cancellation']; + + String get perSeatEnabled => + _localizedValues[localeCode]['per_seat_enabled'] ?? + _localizedValues['en']['per_seat_enabled']; + + String get maxSeatsLimit => + _localizedValues[localeCode]['max_seats_limit'] ?? + _localizedValues['en']['max_seats_limit']; + + String get trialEnabled => + _localizedValues[localeCode]['trial_enabled'] ?? + _localizedValues['en']['trial_enabled']; + + String get trialDuration => + _localizedValues[localeCode]['trial_duration'] ?? + _localizedValues['en']['trial_duration']; + + String get allowQueryOverrides => + _localizedValues[localeCode]['allow_query_overrides'] ?? + _localizedValues['en']['allow_query_overrides']; + + String get allowPlanChanges => + _localizedValues[localeCode]['allow_plan_changes'] ?? + _localizedValues['en']['allow_plan_changes']; + + String get planMap => + _localizedValues[localeCode]['plan_map'] ?? + _localizedValues['en']['plan_map']; + + String get refundPeriod => + _localizedValues[localeCode]['refund_period'] ?? + _localizedValues['en']['refund_period']; + + String get webhookConfiguration => + _localizedValues[localeCode]['webhook_configuration'] ?? + _localizedValues['en']['webhook_configuration']; + + String get purchasePage => + _localizedValues[localeCode]['purchase_page'] ?? + _localizedValues['en']['purchase_page']; + String lookup(String key) { final lookupKey = toSnakeCase(key);