Subscriptions

This commit is contained in:
Hillel Coren 2021-03-30 14:20:34 +03:00
parent 6f02d003cf
commit a730f79b31
4 changed files with 78 additions and 2 deletions

View File

@ -65,7 +65,7 @@ abstract class SubscriptionEntity extends Object
createdUserId: '', createdUserId: '',
assignedUserId: '', assignedUserId: '',
archivedAt: 0, archivedAt: 0,
allowCancellation: false, allowCancellation: true,
allowPlanChanges: false, allowPlanChanges: false,
allowQueryOverrides: false, allowQueryOverrides: false,
autoBill: '', autoBill: '',

View File

@ -23,7 +23,7 @@ class EntityPresenter {
var name = entity.listDisplayName; var name = entity.listDisplayName;
// TODO replace with this: https://github.com/flutter/flutter/issues/45336 // TODO replace with this: https://github.com/flutter/flutter/issues/45336
if (name.isEmpty) { if ((name ?? '').isEmpty) {
name = localization.pending; name = localization.pending;
} else if (name.length > 10) { } else if (name.length > 10) {
return name; return name;

View File

@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:invoiceninja_flutter/ui/app/edit_scaffold.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/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/app/scrollable_listview.dart';
import 'package:invoiceninja_flutter/ui/subscription/edit/subscription_edit_vm.dart'; import 'package:invoiceninja_flutter/ui/subscription/edit/subscription_edit_vm.dart';
import 'package:invoiceninja_flutter/utils/localization.dart'; import 'package:invoiceninja_flutter/utils/localization.dart';
@ -109,6 +110,11 @@ class _SubscriptionEditState extends State<SubscriptionEdit> {
labelText: 'Subscriptions', labelText: 'Subscriptions',
), ),
), ),
BoolDropdownButton(
label: localization.allowCancellation,
value: subscription.allowCancellation,
onChanged: (value) => viewModel.onChanged(subscription
.rebuild((b) => b..allowCancellation = value))),
], ],
), ),
], ],

View File

@ -15,6 +15,20 @@ 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
'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', 'security': 'Security',
'email_bounced': 'Email Bounced', 'email_bounced': 'Email Bounced',
'email_spam_complaint': 'Spam Complaint', 'email_spam_complaint': 'Spam Complaint',
@ -56238,6 +56252,62 @@ mixin LocalizationsProvider on LocaleCodeAware {
_localizedValues[localeCode]['modified'] ?? _localizedValues[localeCode]['modified'] ??
_localizedValues['en']['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) { String lookup(String key) {
final lookupKey = toSnakeCase(key); final lookupKey = toSnakeCase(key);