import { Component } from '@angular/core';
import { TranslationService } from '@core/services/translation.service';
import { ReferenceFieldAPI } from '@core/typings/api/reference-fields.typing';
import { BaseApplication } from '@core/typings/application.typing';
import { ProcessingTypes } from '@core/typings/payment.typing';
import { ReferenceFieldsUI } from '@core/typings/ui/reference-fields.typing';
import { ClientSettingsService } from '@features/client-settings/client-settings.service';
import { Form, FormAudience, FormData } from '@features/configure-forms/form.typing';
import { ReferenceFieldsService } from '@features/reference-fields/services/reference-fields.service';
import { formulaFormDef } from './formula-form-definition';
const refField: ReferenceFieldAPI.ReferenceFieldDisplayModel = {
aggregateTableReferenceFieldId: null,
aggregateType: null,
categoryId: 0,
createDate: '',
createdBy: '',
customDataTableGuid: '',
description: '',
formAudience: FormAudience.APPLICANT,
formCount: 0,
isEncrypted: false,
isMasked: false,
isSingleResponse: false,
isStandardProductField: false,
isTableField: false,
key: 'refField1',
name: 'refField1',
parentReferenceFieldId: null,
referenceFieldId: 0,
referenceFieldTableId: null,
standardComponentIsPublished: false,
subsetCollectionType: null,
supportsMultiple: false,
tableAllowsImport: false,
type: ReferenceFieldsUI.ReferenceFieldTypes.Number,
updateDate: '',
updatedBy: '',
usedOnReports: false
};
@Component({
template: `
`
})
export class FormFormulaTestsComponent {
form: Form = formulaFormDef;
formId = 1;
sampleFormData: FormData = {};
sampleExternalFields: Partial = {
amountRequested: null,
currencyRequestedAmountEquivalent: null
};
constructor (
clientSettingsService: ClientSettingsService,
translationService: TranslationService,
referenceFieldsService: ReferenceFieldsService
) {
translationService['getFormTranslationsByLanguage'] = async () => ({
richTextMap: {},
standardMap: {}
});
clientSettingsService['set']('clientSettings', {
allowBudgetOverages: true,
allowExpeditedPayments: true,
allowExternalApis: true,
apEnabled: true,
canConfigureWebservices: true,
clientId: 1,
country: 'US',
defaultTimezone: 'EST',
hasInternational: true,
hasSSO: true,
isRootClient: false,
isTestClient: true,
paymentDesignations: true,
reserveFunds: true,
specialHandling: true,
allowExternalEmails: true,
clientProcessingType: ProcessingTypes.Client
});
referenceFieldsService['set']('allReferenceFields', [refField]);
}
}