Use new is_hosted field
This commit is contained in:
parent
98cc32edfb
commit
cd5beec862
|
|
@ -22,6 +22,7 @@ abstract class AccountEntity
|
|||
reportErrors: reportErrors,
|
||||
debugEnabled: false,
|
||||
isDocker: false,
|
||||
isHosted: false,
|
||||
isSchedulerRunning: false,
|
||||
disableAutoUpdate: false,
|
||||
isMigrated: false,
|
||||
|
|
@ -73,6 +74,9 @@ abstract class AccountEntity
|
|||
@BuiltValueField(wireName: 'is_migrated')
|
||||
bool get isMigrated;
|
||||
|
||||
@BuiltValueField(wireName: 'is_hosted')
|
||||
bool get isHosted;
|
||||
|
||||
@BuiltValueField(wireName: 'is_scheduler_running')
|
||||
bool get isSchedulerRunning;
|
||||
|
||||
|
|
@ -107,6 +111,7 @@ abstract class AccountEntity
|
|||
..isSchedulerRunning = false
|
||||
..disableAutoUpdate = false
|
||||
..isMigrated = false
|
||||
..isHosted = false
|
||||
..trialPlan = ''
|
||||
..trialStarted = ''
|
||||
..defaultCompanyId = ''
|
||||
|
|
|
|||
|
|
@ -53,6 +53,9 @@ class _$AccountEntitySerializer implements StructuredSerializer<AccountEntity> {
|
|||
'is_migrated',
|
||||
serializers.serialize(object.isMigrated,
|
||||
specifiedType: const FullType(bool)),
|
||||
'is_hosted',
|
||||
serializers.serialize(object.isHosted,
|
||||
specifiedType: const FullType(bool)),
|
||||
'is_scheduler_running',
|
||||
serializers.serialize(object.isSchedulerRunning,
|
||||
specifiedType: const FullType(bool)),
|
||||
|
|
@ -133,6 +136,10 @@ class _$AccountEntitySerializer implements StructuredSerializer<AccountEntity> {
|
|||
result.isMigrated = serializers.deserialize(value,
|
||||
specifiedType: const FullType(bool)) as bool;
|
||||
break;
|
||||
case 'is_hosted':
|
||||
result.isHosted = serializers.deserialize(value,
|
||||
specifiedType: const FullType(bool)) as bool;
|
||||
break;
|
||||
case 'is_scheduler_running':
|
||||
result.isSchedulerRunning = serializers.deserialize(value,
|
||||
specifiedType: const FullType(bool)) as bool;
|
||||
|
|
@ -186,6 +193,8 @@ class _$AccountEntity extends AccountEntity {
|
|||
@override
|
||||
final bool isMigrated;
|
||||
@override
|
||||
final bool isHosted;
|
||||
@override
|
||||
final bool isSchedulerRunning;
|
||||
@override
|
||||
final bool disableAutoUpdate;
|
||||
|
|
@ -212,6 +221,7 @@ class _$AccountEntity extends AccountEntity {
|
|||
this.debugEnabled,
|
||||
this.isDocker,
|
||||
this.isMigrated,
|
||||
this.isHosted,
|
||||
this.isSchedulerRunning,
|
||||
this.disableAutoUpdate,
|
||||
this.defaultCompanyId,
|
||||
|
|
@ -240,6 +250,8 @@ class _$AccountEntity extends AccountEntity {
|
|||
isDocker, 'AccountEntity', 'isDocker');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
isMigrated, 'AccountEntity', 'isMigrated');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
isHosted, 'AccountEntity', 'isHosted');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
isSchedulerRunning, 'AccountEntity', 'isSchedulerRunning');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
|
|
@ -275,6 +287,7 @@ class _$AccountEntity extends AccountEntity {
|
|||
debugEnabled == other.debugEnabled &&
|
||||
isDocker == other.isDocker &&
|
||||
isMigrated == other.isMigrated &&
|
||||
isHosted == other.isHosted &&
|
||||
isSchedulerRunning == other.isSchedulerRunning &&
|
||||
disableAutoUpdate == other.disableAutoUpdate &&
|
||||
defaultCompanyId == other.defaultCompanyId &&
|
||||
|
|
@ -300,6 +313,7 @@ class _$AccountEntity extends AccountEntity {
|
|||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
0,
|
||||
|
|
@ -311,7 +325,8 @@ class _$AccountEntity extends AccountEntity {
|
|||
.hashCode),
|
||||
defaultUrl
|
||||
.hashCode),
|
||||
reportErrors.hashCode),
|
||||
reportErrors
|
||||
.hashCode),
|
||||
plan.hashCode),
|
||||
planExpires.hashCode),
|
||||
latestVersion.hashCode),
|
||||
|
|
@ -319,6 +334,7 @@ class _$AccountEntity extends AccountEntity {
|
|||
debugEnabled.hashCode),
|
||||
isDocker.hashCode),
|
||||
isMigrated.hashCode),
|
||||
isHosted.hashCode),
|
||||
isSchedulerRunning.hashCode),
|
||||
disableAutoUpdate.hashCode),
|
||||
defaultCompanyId.hashCode),
|
||||
|
|
@ -341,6 +357,7 @@ class _$AccountEntity extends AccountEntity {
|
|||
..add('debugEnabled', debugEnabled)
|
||||
..add('isDocker', isDocker)
|
||||
..add('isMigrated', isMigrated)
|
||||
..add('isHosted', isHosted)
|
||||
..add('isSchedulerRunning', isSchedulerRunning)
|
||||
..add('disableAutoUpdate', disableAutoUpdate)
|
||||
..add('defaultCompanyId', defaultCompanyId)
|
||||
|
|
@ -404,6 +421,10 @@ class AccountEntityBuilder
|
|||
bool get isMigrated => _$this._isMigrated;
|
||||
set isMigrated(bool isMigrated) => _$this._isMigrated = isMigrated;
|
||||
|
||||
bool _isHosted;
|
||||
bool get isHosted => _$this._isHosted;
|
||||
set isHosted(bool isHosted) => _$this._isHosted = isHosted;
|
||||
|
||||
bool _isSchedulerRunning;
|
||||
bool get isSchedulerRunning => _$this._isSchedulerRunning;
|
||||
set isSchedulerRunning(bool isSchedulerRunning) =>
|
||||
|
|
@ -448,6 +469,7 @@ class AccountEntityBuilder
|
|||
_debugEnabled = $v.debugEnabled;
|
||||
_isDocker = $v.isDocker;
|
||||
_isMigrated = $v.isMigrated;
|
||||
_isHosted = $v.isHosted;
|
||||
_isSchedulerRunning = $v.isSchedulerRunning;
|
||||
_disableAutoUpdate = $v.disableAutoUpdate;
|
||||
_defaultCompanyId = $v.defaultCompanyId;
|
||||
|
|
@ -494,6 +516,7 @@ class AccountEntityBuilder
|
|||
debugEnabled: BuiltValueNullFieldError.checkNotNull(debugEnabled, 'AccountEntity', 'debugEnabled'),
|
||||
isDocker: BuiltValueNullFieldError.checkNotNull(isDocker, 'AccountEntity', 'isDocker'),
|
||||
isMigrated: BuiltValueNullFieldError.checkNotNull(isMigrated, 'AccountEntity', 'isMigrated'),
|
||||
isHosted: BuiltValueNullFieldError.checkNotNull(isHosted, 'AccountEntity', 'isHosted'),
|
||||
isSchedulerRunning: BuiltValueNullFieldError.checkNotNull(isSchedulerRunning, 'AccountEntity', 'isSchedulerRunning'),
|
||||
disableAutoUpdate: BuiltValueNullFieldError.checkNotNull(disableAutoUpdate, 'AccountEntity', 'disableAutoUpdate'),
|
||||
defaultCompanyId: BuiltValueNullFieldError.checkNotNull(defaultCompanyId, 'AccountEntity', 'defaultCompanyId'),
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ abstract class CompanyEntity extends Object
|
|||
markdownEmailEnabled: true,
|
||||
useCommaAsDecimalPlace: false,
|
||||
reportIncludeDrafts: false,
|
||||
stopOnUnpaidRecurring: false,
|
||||
groups: BuiltList<GroupEntity>(),
|
||||
taxRates: BuiltList<TaxRateEntity>(),
|
||||
taskStatuses: BuiltList<TaskStatusEntity>(),
|
||||
|
|
@ -363,6 +364,9 @@ abstract class CompanyEntity extends Object
|
|||
@BuiltValueField(wireName: 'calculate_expense_tax_by_amount')
|
||||
bool get calculateExpenseTaxByAmount;
|
||||
|
||||
@BuiltValueField(wireName: 'stop_on_unpaid_recurring ')
|
||||
bool get stopOnUnpaidRecurring;
|
||||
|
||||
String get displayName => settings.name ?? '';
|
||||
|
||||
@override
|
||||
|
|
@ -598,6 +602,7 @@ abstract class CompanyEntity extends Object
|
|||
..useCommaAsDecimalPlace = false
|
||||
..reportIncludeDrafts = false
|
||||
..convertRateToClient = true
|
||||
..stopOnUnpaidRecurring = false
|
||||
..systemLogs.replace(BuiltList<SystemLogEntity>())
|
||||
..subscriptions.replace(BuiltList<SubscriptionEntity>())
|
||||
..recurringExpenses.replace(BuiltList<ExpenseEntity>())
|
||||
|
|
|
|||
|
|
@ -301,6 +301,9 @@ class _$CompanyEntitySerializer implements StructuredSerializer<CompanyEntity> {
|
|||
'calculate_expense_tax_by_amount',
|
||||
serializers.serialize(object.calculateExpenseTaxByAmount,
|
||||
specifiedType: const FullType(bool)),
|
||||
'stop_on_unpaid_recurring ',
|
||||
serializers.serialize(object.stopOnUnpaidRecurring,
|
||||
specifiedType: const FullType(bool)),
|
||||
'created_at',
|
||||
serializers.serialize(object.createdAt,
|
||||
specifiedType: const FullType(int)),
|
||||
|
|
@ -738,6 +741,10 @@ class _$CompanyEntitySerializer implements StructuredSerializer<CompanyEntity> {
|
|||
result.calculateExpenseTaxByAmount = serializers.deserialize(value,
|
||||
specifiedType: const FullType(bool)) as bool;
|
||||
break;
|
||||
case 'stop_on_unpaid_recurring ':
|
||||
result.stopOnUnpaidRecurring = serializers.deserialize(value,
|
||||
specifiedType: const FullType(bool)) as bool;
|
||||
break;
|
||||
case 'isChanged':
|
||||
result.isChanged = serializers.deserialize(value,
|
||||
specifiedType: const FullType(bool)) as bool;
|
||||
|
|
@ -1513,6 +1520,8 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
@override
|
||||
final bool calculateExpenseTaxByAmount;
|
||||
@override
|
||||
final bool stopOnUnpaidRecurring;
|
||||
@override
|
||||
final bool isChanged;
|
||||
@override
|
||||
final int createdAt;
|
||||
|
|
@ -1614,6 +1623,7 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
this.settings,
|
||||
this.enabledModules,
|
||||
this.calculateExpenseTaxByAmount,
|
||||
this.stopOnUnpaidRecurring,
|
||||
this.isChanged,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
|
|
@ -1771,6 +1781,8 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
enabledModules, 'CompanyEntity', 'enabledModules');
|
||||
BuiltValueNullFieldError.checkNotNull(calculateExpenseTaxByAmount,
|
||||
'CompanyEntity', 'calculateExpenseTaxByAmount');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
stopOnUnpaidRecurring, 'CompanyEntity', 'stopOnUnpaidRecurring');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
createdAt, 'CompanyEntity', 'createdAt');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
|
|
@ -1870,6 +1882,7 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
settings == other.settings &&
|
||||
enabledModules == other.enabledModules &&
|
||||
calculateExpenseTaxByAmount == other.calculateExpenseTaxByAmount &&
|
||||
stopOnUnpaidRecurring == other.stopOnUnpaidRecurring &&
|
||||
isChanged == other.isChanged &&
|
||||
createdAt == other.createdAt &&
|
||||
updatedAt == other.updatedAt &&
|
||||
|
|
@ -1902,8 +1915,7 @@ 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($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), convertRateToClient.hashCode), fillProducts.hashCode), enableProductCost.hashCode), enableProductQuantity.hashCode), enableProductDiscount.hashCode), defaultTaskIsDateBased.hashCode), defaultQuantity.hashCode), showProductDetails.hashCode), clientCanRegister.hashCode), isLarge.hashCode), isDisabled.hashCode), enableShopApi.hashCode), companyKey.hashCode), firstDayOfWeek.hashCode), firstMonthOfYear.hashCode), numberOfInvoiceTaxRates.hashCode), numberOfItemTaxRates.hashCode), expenseInclusiveTaxes.hashCode), sessionTimeout.hashCode), passwordTimeout.hashCode), oauthPasswordRequired.hashCode), markdownEnabled.hashCode), markdownEmailEnabled.hashCode), useCommaAsDecimalPlace.hashCode), reportIncludeDrafts.hashCode), groups.hashCode), activities.hashCode), taxRates.hashCode), taskStatuses.hashCode), taskStatusMap.hashCode), companyGateways.hashCode), expenseCategories.hashCode), users.hashCode), clients.hashCode), products.hashCode), invoices.hashCode), recurringInvoices.hashCode), recurringExpenses.hashCode), payments.hashCode), quotes.hashCode), credits.hashCode), tasks.hashCode), projects.hashCode), expenses.hashCode), vendors.hashCode), designs.hashCode), documents.hashCode), tokens.hashCode), webhooks.hashCode), subscriptions.hashCode), paymentTerms.hashCode), systemLogs.hashCode), clientRegistrationFields.hashCode), customFields.hashCode), slackWebhookUrl.hashCode), googleAnalyticsKey.hashCode), markExpensesInvoiceable.hashCode), markExpensesPaid.hashCode),
|
||||
invoiceExpenseDocuments.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($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), convertRateToClient.hashCode), fillProducts.hashCode), enableProductCost.hashCode), enableProductQuantity.hashCode), enableProductDiscount.hashCode), defaultTaskIsDateBased.hashCode), defaultQuantity.hashCode), showProductDetails.hashCode), clientCanRegister.hashCode), isLarge.hashCode), isDisabled.hashCode), enableShopApi.hashCode), companyKey.hashCode), firstDayOfWeek.hashCode), firstMonthOfYear.hashCode), numberOfInvoiceTaxRates.hashCode), numberOfItemTaxRates.hashCode), expenseInclusiveTaxes.hashCode), sessionTimeout.hashCode), passwordTimeout.hashCode), oauthPasswordRequired.hashCode), markdownEnabled.hashCode), markdownEmailEnabled.hashCode), useCommaAsDecimalPlace.hashCode), reportIncludeDrafts.hashCode), groups.hashCode), activities.hashCode), taxRates.hashCode), taskStatuses.hashCode), taskStatusMap.hashCode), companyGateways.hashCode), expenseCategories.hashCode), users.hashCode), clients.hashCode), products.hashCode), invoices.hashCode), recurringInvoices.hashCode), recurringExpenses.hashCode), payments.hashCode), quotes.hashCode), credits.hashCode), tasks.hashCode), projects.hashCode), expenses.hashCode), vendors.hashCode), designs.hashCode), documents.hashCode), tokens.hashCode), webhooks.hashCode), subscriptions.hashCode), paymentTerms.hashCode), systemLogs.hashCode), clientRegistrationFields.hashCode), customFields.hashCode), slackWebhookUrl.hashCode), googleAnalyticsKey.hashCode), markExpensesInvoiceable.hashCode), markExpensesPaid.hashCode), invoiceExpenseDocuments.hashCode),
|
||||
invoiceTaskDocuments.hashCode),
|
||||
invoiceTaskTimelog.hashCode),
|
||||
invoiceTaskDatelog.hashCode),
|
||||
|
|
@ -1913,6 +1925,7 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
settings.hashCode),
|
||||
enabledModules.hashCode),
|
||||
calculateExpenseTaxByAmount.hashCode),
|
||||
stopOnUnpaidRecurring.hashCode),
|
||||
isChanged.hashCode),
|
||||
createdAt.hashCode),
|
||||
updatedAt.hashCode),
|
||||
|
|
@ -2006,6 +2019,7 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
..add('settings', settings)
|
||||
..add('enabledModules', enabledModules)
|
||||
..add('calculateExpenseTaxByAmount', calculateExpenseTaxByAmount)
|
||||
..add('stopOnUnpaidRecurring', stopOnUnpaidRecurring)
|
||||
..add('isChanged', isChanged)
|
||||
..add('createdAt', createdAt)
|
||||
..add('updatedAt', updatedAt)
|
||||
|
|
@ -2431,6 +2445,11 @@ class CompanyEntityBuilder
|
|||
set calculateExpenseTaxByAmount(bool calculateExpenseTaxByAmount) =>
|
||||
_$this._calculateExpenseTaxByAmount = calculateExpenseTaxByAmount;
|
||||
|
||||
bool _stopOnUnpaidRecurring;
|
||||
bool get stopOnUnpaidRecurring => _$this._stopOnUnpaidRecurring;
|
||||
set stopOnUnpaidRecurring(bool stopOnUnpaidRecurring) =>
|
||||
_$this._stopOnUnpaidRecurring = stopOnUnpaidRecurring;
|
||||
|
||||
bool _isChanged;
|
||||
bool get isChanged => _$this._isChanged;
|
||||
set isChanged(bool isChanged) => _$this._isChanged = isChanged;
|
||||
|
|
@ -2555,6 +2574,7 @@ class CompanyEntityBuilder
|
|||
_settings = $v.settings.toBuilder();
|
||||
_enabledModules = $v.enabledModules;
|
||||
_calculateExpenseTaxByAmount = $v.calculateExpenseTaxByAmount;
|
||||
_stopOnUnpaidRecurring = $v.stopOnUnpaidRecurring;
|
||||
_isChanged = $v.isChanged;
|
||||
_createdAt = $v.createdAt;
|
||||
_updatedAt = $v.updatedAt;
|
||||
|
|
@ -2679,6 +2699,7 @@ class CompanyEntityBuilder
|
|||
settings: settings.build(),
|
||||
enabledModules: BuiltValueNullFieldError.checkNotNull(enabledModules, 'CompanyEntity', 'enabledModules'),
|
||||
calculateExpenseTaxByAmount: BuiltValueNullFieldError.checkNotNull(calculateExpenseTaxByAmount, 'CompanyEntity', 'calculateExpenseTaxByAmount'),
|
||||
stopOnUnpaidRecurring: BuiltValueNullFieldError.checkNotNull(stopOnUnpaidRecurring, 'CompanyEntity', 'stopOnUnpaidRecurring'),
|
||||
isChanged: isChanged,
|
||||
createdAt: BuiltValueNullFieldError.checkNotNull(createdAt, 'CompanyEntity', 'createdAt'),
|
||||
updatedAt: BuiltValueNullFieldError.checkNotNull(updatedAt, 'CompanyEntity', 'updatedAt'),
|
||||
|
|
|
|||
|
|
@ -752,25 +752,21 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
|
|||
|
||||
bool get reportErrors => account?.reportErrors ?? false;
|
||||
|
||||
bool get isHosted => authState.isHosted ?? false;
|
||||
bool get isHosted => account == null ? authState.isHosted : account.isHosted;
|
||||
|
||||
bool get isSelfHosted => authState.isSelfHost ?? false;
|
||||
bool get isSelfHosted => !isHosted;
|
||||
|
||||
bool get isDemo => cleanApiUrl(authState.url) == kAppDemoUrl;
|
||||
|
||||
bool get isStaging => cleanApiUrl(authState.url) == kAppStagingUrl;
|
||||
|
||||
bool get isProduction => cleanApiUrl(authState.url) == kAppProductionUrl;
|
||||
|
||||
bool get isWhiteLabeled => account.plan == kPlanWhiteLabel;
|
||||
|
||||
bool get isProPlan => isEnterprisePlan || account.plan == kPlanPro;
|
||||
|
||||
bool get isTrial => isHosted && account.isTrial;
|
||||
|
||||
bool get isEnterprisePlan => !isProduction || account.plan == kPlanEnterprise;
|
||||
|
||||
//bool get isEnterprisePlan => isSelfHosted || account.plan == kPlanEnterprise;
|
||||
bool get isEnterprisePlan => isSelfHosted || account.plan == kPlanEnterprise;
|
||||
|
||||
bool get isPaidAccount => isSelfHosted
|
||||
? isWhiteLabeled
|
||||
|
|
|
|||
|
|
@ -999,7 +999,7 @@ class __PdfPreviewState extends State<_PdfPreview> {
|
|||
if (widget.invoice.isOld) {
|
||||
url += '&entity_id=${widget.invoice.id}';
|
||||
}
|
||||
if (state.isProduction) {
|
||||
if (state.isHosted) {
|
||||
url = url.replaceFirst('//', '//preview.');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class InvoiceEditPDFState extends State<InvoiceEditPDF> {
|
|||
if (viewModel.invoice.isOld) {
|
||||
url += '&entity_id=${viewModel.invoice.id}';
|
||||
}
|
||||
if (viewModel.state.isProduction) {
|
||||
if (viewModel.state.isHosted) {
|
||||
url = url.replaceFirst('//', '//preview.');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue