Merge remote-tracking branch 'company/main'

This commit is contained in:
Gagan7900
2026-07-24 13:23:13 +05:30
4 changed files with 50 additions and 119 deletions
@@ -1,23 +1,22 @@
import { Injectable, inject } from '@angular/core'; import { Injectable, inject } from '@angular/core';
import { FormSelectOption } from '../../../../../shared/components/form/models/form-select.models'; import { FormSelect } from '../../../../shared/components/form/form-select/form-select';
import { Observable, catchError, map, of, throwError } from 'rxjs'; import { Observable, catchError, map, of, throwError } from 'rxjs';
import { import {
CountryLookupDto, CountryLookupDto,
CountryService, CountryService,
} from '../../../../global-masters/countries/public-api'; } from '../../../global-masters/countries/public-api';
import { import {
CurrencyLookupDto, CurrencyLookupDto,
CurrencyService, CurrencyService,
} from '../../../../global-masters/currencies/public-api'; } from '../../../global-masters/currencies/public-api';
import { import {
LanguageLookupDto, LanguageLookupDto,
LanguageService, LanguageService,
} from '../../../../global-masters/languages/public-api'; } from '../../../global-masters/languages/public-api';
import { import {
TimezoneLookupDto, TimezoneLookupDto,
TimezoneService, TimezoneService,
} from '../../../../global-masters/timezones/public-api'; } from '../../../global-masters/timezones/public-api';
import { OrganizationOnboardingDraft } from '../models/organization-draft.model'; import { OrganizationOnboardingDraft } from '../models/organization-draft.model';
import { import {
CountryLocalizationDefaults, CountryLocalizationDefaults,
@@ -85,31 +84,31 @@ const PLAN_DEFAULTS: readonly OrganizationPlanDefaults[] = [
}, },
]; ];
const DATE_FORMAT_OPTIONS: readonly FormSelectOption<DateFormatValue>[] = [ const DATE_FORMAT_OPTIONS: readonly FormSelect<DateFormatValue>[] = [
{ value: 'DD/MM/YYYY', label: 'DD/MM/YYYY' }, // { value: 'DD/MM/YYYY', label: 'DD/MM/YYYY' },
{ value: 'MM/DD/YYYY', label: 'MM/DD/YYYY' }, // { value: 'MM/DD/YYYY', label: 'MM/DD/YYYY' },
{ value: 'YYYY-MM-DD', label: 'YYYY-MM-DD' }, // { value: 'YYYY-MM-DD', label: 'YYYY-MM-DD' },
]; ];
const TIME_FORMAT_OPTIONS: readonly FormSelectOption<TimeFormatValue>[] = [ const TIME_FORMAT_OPTIONS: readonly FormSelect<TimeFormatValue>[] = [
{ value: 'TwelveHour', label: '12 hour' }, // { value: 'TwelveHour', label: '12 hour' },
{ value: 'TwentyFourHour', label: '24 hour' }, // { value: 'TwentyFourHour', label: '24 hour' },
]; ];
const NUMBER_FORMAT_OPTIONS: readonly FormSelectOption<NumberFormatValue>[] = [ const NUMBER_FORMAT_OPTIONS: readonly FormSelect<NumberFormatValue>[] = [
{ value: 'OneTwoThreeCommaFourFiveSixPointSevenEight', label: '123,456.78' }, // { value: 'OneTwoThreeCommaFourFiveSixPointSevenEight', label: '123,456.78' },
{ value: 'OneTwoThreePointFourFiveSixCommaSevenEight', label: '123.456,78' }, // { value: 'OneTwoThreePointFourFiveSixCommaSevenEight', label: '123.456,78' },
]; ];
const FISCAL_YEAR_OPTIONS: readonly FormSelectOption<FiscalYearConventionValue>[] = [ const FISCAL_YEAR_OPTIONS: readonly FormSelect<FiscalYearConventionValue>[] = [
{ value: 'CalendarYear', label: 'Calendar Year (Jan-Dec)' }, // { value: 'CalendarYear', label: 'Calendar Year (Jan-Dec)' },
{ value: 'AprilToMarch', label: 'April - March' }, // { value: 'AprilToMarch', label: 'April - March' },
{ value: 'JulyToJune', label: 'July - June' }, // { value: 'JulyToJune', label: 'July - June' },
]; ];
const LICENSE_TYPE_OPTIONS: readonly FormSelectOption<OrganizationLicenseType>[] = [ const LICENSE_TYPE_OPTIONS: readonly FormSelect<OrganizationLicenseType>[] = [
{ value: 'Trial', label: 'Trial' }, // { value: 'Trial', label: 'Trial' },
{ value: 'Paid', label: 'Paid' }, // { value: 'Paid', label: 'Paid' },
]; ];
const LOCALIZATION_DEFAULTS: readonly CountryLocalizationDefaults[] = [ const LOCALIZATION_DEFAULTS: readonly CountryLocalizationDefaults[] = [
@@ -203,33 +202,35 @@ export class OrganizationOnboardingService {
})) }))
); );
} }
loadLanguageOptions(limit = 50):readonly FormSelect<DateFormatValue>[] {
loadLanguageOptions(limit = 50): Observable<readonly FormSelectOption<string>[]> { return DATE_FORMAT_OPTIONS;
return this.languageService.autocomplete('', limit).pipe(
map(items => items.map(item => ({
value: item.id,
label: `${item.code} - ${item.name}`,
})))
);
} }
// loadLanguageOptions(limit = 50): Observable<readonly FormSelect<string>[]> {
// // return this.languageService.autocomplete('', limit).pipe(
// // map(items => items.map(item => ({
// // value: item.id,
// // label: `${item.code} - ${item.name}`,
// // })))
// // );
// }
getDateFormatOptions(): readonly FormSelectOption<DateFormatValue>[] { getDateFormatOptions(): readonly FormSelect<DateFormatValue>[] {
return DATE_FORMAT_OPTIONS; return DATE_FORMAT_OPTIONS;
} }
getTimeFormatOptions(): readonly FormSelectOption<TimeFormatValue>[] { getTimeFormatOptions(): readonly FormSelect<TimeFormatValue>[] {
return TIME_FORMAT_OPTIONS; return TIME_FORMAT_OPTIONS;
} }
getNumberFormatOptions(): readonly FormSelectOption<NumberFormatValue>[] { getNumberFormatOptions(): readonly FormSelect<NumberFormatValue>[] {
return NUMBER_FORMAT_OPTIONS; return NUMBER_FORMAT_OPTIONS;
} }
getFiscalYearOptions(): readonly FormSelectOption<FiscalYearConventionValue>[] { getFiscalYearOptions(): readonly FormSelect<FiscalYearConventionValue>[] {
return FISCAL_YEAR_OPTIONS; return FISCAL_YEAR_OPTIONS;
} }
getLicenseTypeOptions(): readonly FormSelectOption<OrganizationLicenseType>[] { getLicenseTypeOptions(): readonly FormSelect<OrganizationLicenseType>[] {
return LICENSE_TYPE_OPTIONS; return LICENSE_TYPE_OPTIONS;
} }
@@ -76,64 +76,7 @@
/> />
</div> </div>
<div class="col-span-12 md:col-span-6 xl:col-span-4">
<app-form-select
formControlName="dateFormat"
inputId="organization-date-format"
variant="floating"
label="Date Format"
[options]="dateFormatOptions"
[required]="true"
[clearable]="false"
[searchable]="false"
[submitAttempted]="submitAttempted()"
[validationMessages]="{ required: 'Date Format is required.' }"
/>
</div>
<div class="col-span-12 md:col-span-6 xl:col-span-4">
<app-form-select
formControlName="timeFormat"
inputId="organization-time-format"
variant="floating"
label="Time Format"
[options]="timeFormatOptions"
[required]="true"
[clearable]="false"
[searchable]="false"
[submitAttempted]="submitAttempted()"
[validationMessages]="{ required: 'Time Format is required.' }"
/>
</div>
<div class="col-span-12 md:col-span-6 xl:col-span-4">
<app-form-select
formControlName="numberFormat"
inputId="organization-number-format"
variant="floating"
label="Number Format"
[options]="numberFormatOptions"
[required]="true"
[clearable]="false"
[searchable]="false"
[submitAttempted]="submitAttempted()"
[validationMessages]="{ required: 'Number Format is required.' }"
/>
</div>
<div class="col-span-12 md:col-span-6 xl:col-span-4">
<app-form-select
formControlName="fiscalYearConvention"
inputId="organization-fiscal-year-convention"
variant="floating"
label="Fiscal Year Convention"
[options]="fiscalYearOptions"
[required]="true"
[clearable]="false"
[searchable]="false"
[submitAttempted]="submitAttempted()"
[validationMessages]="{ required: 'Fiscal Year Convention is required.' }"
/>
</div>
</div> </div>
</form> </form>
@@ -130,17 +130,17 @@ export class OrganizationLocalizationStepComponent implements OnboardingStepForm
this.onboardingService.resolveLanguage(value); this.onboardingService.resolveLanguage(value);
constructor() { constructor() {
this.onboardingService.loadLanguageOptions(100) // this.onboardingService.loadLanguageOptions(100)
.pipe( // .pipe(
catchError(() => { // catchError(() => {
this.toastr.error('Unable to load language options.'); // this.toastr.error('Unable to load language options.');
return of<readonly FormSelectOption<string>[]>([]); // return of<readonly FormSelectOption<string>[]>([]);
}), // }),
takeUntilDestroyed(this.destroyRef) // takeUntilDestroyed(this.destroyRef)
) // )
.subscribe(options => { // .subscribe(options => {
this.additionalLanguageOptions.update(current => this.mergeLanguageOptions(current, options)); // this.additionalLanguageOptions.update(current => this.mergeLanguageOptions(current, options));
}); // });
this.form.controls.defaultLanguageId.valueChanges this.form.controls.defaultLanguageId.valueChanges
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(takeUntilDestroyed(this.destroyRef))
@@ -20,20 +20,7 @@
/> />
</div> </div>
<div class="col-span-12 md:col-span-6 xl:col-span-4">
<app-form-select
formControlName="licenseType"
inputId="organization-license-type"
variant="floating"
label="License Type"
[options]="licenseTypeOptions"
[required]="true"
[clearable]="false"
[searchable]="false"
[submitAttempted]="submitAttempted()"
[validationMessages]="{ required: 'License Type is required.' }"
/>
</div>
<div class="col-span-12 md:col-span-6 xl:col-span-4"> <div class="col-span-12 md:col-span-6 xl:col-span-4">
<app-form-input <app-form-input