Merge pull request 'Feature/onboarding workflow sc' (#5) from feature/onboarding-workflow-sc into main
Reviewed-on: sc/syscom-master-admin-ui#5 Reviewed-by: Kunal <kp.workspace17@gmail.com>
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
import { buildApiUrl } from '../../config/api-url.util';
|
||||
|
||||
export const CITY_ENDPOINTS = {
|
||||
dataTable: buildApiUrl('masterAdmin', '/v1/cities/datatable'),
|
||||
create: buildApiUrl('masterAdmin', '/v1/cities'),
|
||||
getById: (id: string) =>
|
||||
buildApiUrl('masterAdmin', `/v1/cities/${encodeURIComponent(id)}`),
|
||||
update: (id: string) =>
|
||||
buildApiUrl('masterAdmin', `/v1/cities/${encodeURIComponent(id)}`),
|
||||
autocomplete: buildApiUrl('masterAdmin', '/v1/cities/autocomplete')
|
||||
} as const;
|
||||
@@ -1,43 +0,0 @@
|
||||
import { buildApiUrl } from '../../config/api-url.util';
|
||||
|
||||
|
||||
export const COUNTRY_ENDPOINTS = {
|
||||
dataTable: buildApiUrl(
|
||||
'masterAdmin',
|
||||
'/v1/countries/datatable'
|
||||
),
|
||||
|
||||
create: buildApiUrl(
|
||||
'masterAdmin',
|
||||
'/v1/countries'
|
||||
),
|
||||
|
||||
getById: (id: string) =>
|
||||
buildApiUrl(
|
||||
'masterAdmin',
|
||||
`/v1/countries/${encodeURIComponent(id)}`
|
||||
),
|
||||
|
||||
autocomplete: buildApiUrl(
|
||||
'masterAdmin',
|
||||
'/v1/countries/autocomplete'
|
||||
),
|
||||
|
||||
update: (id: string) =>
|
||||
buildApiUrl(
|
||||
'masterAdmin',
|
||||
`/v1/countries/${encodeURIComponent(id)}`
|
||||
),
|
||||
|
||||
delete: (id: string) =>
|
||||
buildApiUrl(
|
||||
'masterAdmin',
|
||||
`/v1/countries/${encodeURIComponent(id)}`
|
||||
),
|
||||
|
||||
changeStatus: (id: string) =>
|
||||
buildApiUrl(
|
||||
'masterAdmin',
|
||||
`/v1/countries/${encodeURIComponent(id)}/status`
|
||||
),
|
||||
} as const;
|
||||
@@ -1,44 +0,0 @@
|
||||
import { buildApiUrl } from '../../config/api-url.util';
|
||||
|
||||
|
||||
export const CURRENCY_ENDPOINTS = {
|
||||
dataTable: buildApiUrl(
|
||||
'masterAdmin',
|
||||
'/v1/currencies/datatable'
|
||||
),
|
||||
|
||||
create: buildApiUrl(
|
||||
'masterAdmin',
|
||||
'/v1/currencies'
|
||||
),
|
||||
|
||||
getById: (id: string) =>
|
||||
buildApiUrl(
|
||||
'masterAdmin',
|
||||
`/v1/currencies/${encodeURIComponent(id)}`
|
||||
),
|
||||
|
||||
update: (id: string) =>
|
||||
buildApiUrl(
|
||||
'masterAdmin',
|
||||
`/v1/currencies/${encodeURIComponent(id)}`
|
||||
),
|
||||
|
||||
delete: (id: string) =>
|
||||
buildApiUrl(
|
||||
'masterAdmin',
|
||||
`/v1/currencies/${encodeURIComponent(id)}`
|
||||
),
|
||||
|
||||
changeStatus: (id: string) =>
|
||||
buildApiUrl(
|
||||
'masterAdmin',
|
||||
`/v1/currencies/${encodeURIComponent(id)}/status`
|
||||
),
|
||||
|
||||
autocomplete:
|
||||
buildApiUrl(
|
||||
'masterAdmin',
|
||||
'/v1/currencies/autocomplete'
|
||||
),
|
||||
} as const;
|
||||
@@ -1,11 +0,0 @@
|
||||
import { buildApiUrl } from '../../config/api-url.util';
|
||||
|
||||
export const LANGUAGE_ENDPOINTS = {
|
||||
dataTable: buildApiUrl('masterAdmin', '/v1/languages/datatable'),
|
||||
create: buildApiUrl('masterAdmin', '/v1/languages'),
|
||||
getById: (id: string) =>
|
||||
buildApiUrl('masterAdmin', `/v1/languages/${encodeURIComponent(id)}`),
|
||||
update: (id: string) =>
|
||||
buildApiUrl('masterAdmin', `/v1/languages/${encodeURIComponent(id)}`),
|
||||
autocomplete: buildApiUrl('masterAdmin', '/v1/languages/autocomplete')
|
||||
} as const;
|
||||
@@ -1,32 +0,0 @@
|
||||
import { buildApiUrl } from '../../config/api-url.util';
|
||||
|
||||
|
||||
export const TENANT_CURRENCIES_ENDPOINTS = {
|
||||
dataTable: buildApiUrl(
|
||||
'masterAdmin',
|
||||
'/v1/tenant-currencies/datatable'
|
||||
),
|
||||
|
||||
create: buildApiUrl(
|
||||
'masterAdmin',
|
||||
'/v1/tenant-currencies'
|
||||
),
|
||||
|
||||
getById: (id: string) =>
|
||||
buildApiUrl(
|
||||
'masterAdmin',
|
||||
`/v1/tenant-currencies/${encodeURIComponent(id)}`
|
||||
),
|
||||
|
||||
autocomplete: buildApiUrl(
|
||||
'masterAdmin',
|
||||
'/v1/tenant-currencies/autocomplete'
|
||||
),
|
||||
|
||||
update: (id: string) =>
|
||||
buildApiUrl(
|
||||
'masterAdmin',
|
||||
`/v1/tenant-currencies/${encodeURIComponent(id)}`
|
||||
)
|
||||
|
||||
} as const;
|
||||
@@ -1,32 +0,0 @@
|
||||
import { buildApiUrl } from '../../config/api-url.util';
|
||||
|
||||
|
||||
export const TENANT_ENDPOINTS = {
|
||||
dataTable: buildApiUrl(
|
||||
'masterAdmin',
|
||||
'/v1/tenants/datatable'
|
||||
),
|
||||
|
||||
create: buildApiUrl(
|
||||
'masterAdmin',
|
||||
'/v1/tenants'
|
||||
),
|
||||
|
||||
getById: (id: string) =>
|
||||
buildApiUrl(
|
||||
'masterAdmin',
|
||||
`/v1/tenants/${encodeURIComponent(id)}`
|
||||
),
|
||||
|
||||
autocomplete: buildApiUrl(
|
||||
'masterAdmin',
|
||||
'/v1/tenants/autocomplete'
|
||||
),
|
||||
|
||||
update: (id: string) =>
|
||||
buildApiUrl(
|
||||
'masterAdmin',
|
||||
`/v1/tenants/${encodeURIComponent(id)}`
|
||||
)
|
||||
|
||||
} as const;
|
||||
@@ -1,11 +0,0 @@
|
||||
import { buildApiUrl } from '../../config/api-url.util';
|
||||
|
||||
export const TIMEZONE_ENDPOINTS = {
|
||||
dataTable: buildApiUrl('masterAdmin', '/v1/timezones/datatable'),
|
||||
create: buildApiUrl('masterAdmin', '/v1/timezones'),
|
||||
getById: (id: string) =>
|
||||
buildApiUrl('masterAdmin', `/v1/timezones/${encodeURIComponent(id)}`),
|
||||
update: (id: string) =>
|
||||
buildApiUrl('masterAdmin', `/v1/timezones/${encodeURIComponent(id)}`),
|
||||
autocomplete: buildApiUrl('masterAdmin', '/v1/timezones/autocomplete')
|
||||
} as const;
|
||||
@@ -1,10 +0,0 @@
|
||||
import { buildApiUrl } from '../../config/api-url.util';
|
||||
|
||||
|
||||
export const USER_ENDPOINTS = {
|
||||
dataTable: buildApiUrl('identity', '/v1/users/datatable'),
|
||||
create: buildApiUrl('identity', '/v1/users'),
|
||||
getById: (id: string) => buildApiUrl('identity', `/v1/users/${encodeURIComponent(id)}`),
|
||||
update: (id: string) => buildApiUrl('identity', `/v1/users/${encodeURIComponent(id)}`),
|
||||
autocomplete: buildApiUrl('identity', '/v1/users/autocomplete')
|
||||
} as const;
|
||||
@@ -1,42 +0,0 @@
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { CITY_ENDPOINTS } from '../../end-points/city/city.endpoints';
|
||||
import {
|
||||
CityDto,
|
||||
CreateCityRequest,
|
||||
UpdateCityRequest
|
||||
} from '../../models/city/city.model';
|
||||
import {
|
||||
DataTableQuery,
|
||||
DataTableResult
|
||||
} from '../../../shared/components/data-table/data-table.types';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class CityService {
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
getCityDataTable(
|
||||
query: DataTableQuery,
|
||||
stateId: string
|
||||
): Observable<DataTableResult<CityDto>> {
|
||||
return this.http.post<DataTableResult<CityDto>>(
|
||||
CITY_ENDPOINTS.dataTable,
|
||||
query,
|
||||
{ params: new HttpParams().set('stateId', stateId) }
|
||||
);
|
||||
}
|
||||
|
||||
createCity(request: CreateCityRequest): Observable<CityDto> {
|
||||
return this.http.post<CityDto>(CITY_ENDPOINTS.create, request);
|
||||
}
|
||||
|
||||
updateCity(id: string, request: UpdateCityRequest): Observable<CityDto> {
|
||||
return this.http.put<CityDto>(CITY_ENDPOINTS.update(id), request);
|
||||
}
|
||||
|
||||
getCityById(id: string): Observable<CityDto> {
|
||||
return this.http.get<CityDto>(CITY_ENDPOINTS.getById(id));
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
import { HttpClient, HttpParams } from "@angular/common/http";
|
||||
import { Injectable, inject } from "@angular/core";
|
||||
import { COUNTRY_ENDPOINTS } from "../../../core/end-points/country/country.endpoints";
|
||||
import { Observable } from "rxjs";
|
||||
import { DataTableQuery, DataTableResult } from "../../../shared/components/data-table/data-table.types";
|
||||
import {
|
||||
CountryDto,
|
||||
CountryLookupDto,
|
||||
CreateCountryRequest,
|
||||
UpdateCountryRequest
|
||||
} from "../../models/country/country.model";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class CountryService {
|
||||
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
getCountryDataTable(query: DataTableQuery): Observable<DataTableResult<CountryDto>> {
|
||||
return this.http.post<DataTableResult<CountryDto>>(`${COUNTRY_ENDPOINTS.dataTable}`, query);
|
||||
}
|
||||
|
||||
createCountry(request: CreateCountryRequest): Observable<CountryDto> {
|
||||
return this.http.post<CountryDto>(COUNTRY_ENDPOINTS.create, request);
|
||||
}
|
||||
|
||||
updateCountry(id: string, request: UpdateCountryRequest): Observable<CountryDto> {
|
||||
return this.http.put<CountryDto>(COUNTRY_ENDPOINTS.update(id), request);
|
||||
}
|
||||
|
||||
getCountryById(id: string): Observable<CountryDto> {
|
||||
return this.http.get<CountryDto>(COUNTRY_ENDPOINTS.getById(id));
|
||||
}
|
||||
|
||||
autocomplete(term = '', limit = 50): Observable<CountryLookupDto[]> {
|
||||
return this.http.get<CountryLookupDto[]>(COUNTRY_ENDPOINTS.autocomplete, {
|
||||
params: new HttpParams()
|
||||
.set('term', term)
|
||||
.set('limit', limit)
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { CURRENCY_ENDPOINTS } from '../../../core/end-points/currency/currency.endpoints';
|
||||
import { DataTableQuery, DataTableResult } from '../../../shared/components/data-table/data-table.types';
|
||||
import {
|
||||
CreateCurrencyRequest,
|
||||
CurrencyDto,
|
||||
CurrencyLookupDto,
|
||||
UpdateCurrencyRequest
|
||||
} from '../../models/currency/currency.model';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class CurrencyService {
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
getCurrencyDataTable(query: DataTableQuery): Observable<DataTableResult<CurrencyDto>> {
|
||||
return this.http.post<DataTableResult<CurrencyDto>>(CURRENCY_ENDPOINTS.dataTable, query);
|
||||
}
|
||||
|
||||
createCurrency(request: CreateCurrencyRequest): Observable<CurrencyDto> {
|
||||
return this.http.post<CurrencyDto>(CURRENCY_ENDPOINTS.create, request);
|
||||
}
|
||||
|
||||
updateCurrency(id: string, request: UpdateCurrencyRequest): Observable<CurrencyDto> {
|
||||
return this.http.put<CurrencyDto>(CURRENCY_ENDPOINTS.update(id), request);
|
||||
}
|
||||
|
||||
getCurrencyById(id: string): Observable<CurrencyDto> {
|
||||
return this.http.get<CurrencyDto>(CURRENCY_ENDPOINTS.getById(id));
|
||||
}
|
||||
|
||||
autocomplete(term: string | null, limit = 10): Observable<readonly CurrencyLookupDto[]> {
|
||||
let params = new HttpParams().set('limit', limit);
|
||||
const normalizedTerm = term?.trim();
|
||||
|
||||
if (normalizedTerm) {
|
||||
params = params.set('term', normalizedTerm);
|
||||
}
|
||||
|
||||
return this.http.get<readonly CurrencyLookupDto[]>(CURRENCY_ENDPOINTS.autocomplete, { params });
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { LANGUAGE_ENDPOINTS } from '../../end-points/language/language.endpoints';
|
||||
import {
|
||||
CreateLanguageRequest,
|
||||
LanguageDto,
|
||||
LanguageLookupDto,
|
||||
UpdateLanguageRequest
|
||||
} from '../../models/language/language.model';
|
||||
import {
|
||||
DataTableQuery,
|
||||
DataTableResult
|
||||
} from '../../../shared/components/data-table/data-table.types';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class LanguageService {
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
getDataTable(query: DataTableQuery): Observable<DataTableResult<LanguageDto>> {
|
||||
return this.http.post<DataTableResult<LanguageDto>>(LANGUAGE_ENDPOINTS.dataTable, query);
|
||||
}
|
||||
|
||||
getById(id: string): Observable<LanguageDto> {
|
||||
return this.http.get<LanguageDto>(LANGUAGE_ENDPOINTS.getById(id));
|
||||
}
|
||||
|
||||
create(request: CreateLanguageRequest): Observable<LanguageDto> {
|
||||
return this.http.post<LanguageDto>(LANGUAGE_ENDPOINTS.create, request);
|
||||
}
|
||||
|
||||
update(id: string, request: UpdateLanguageRequest): Observable<LanguageDto> {
|
||||
return this.http.put<LanguageDto>(LANGUAGE_ENDPOINTS.update(id), request);
|
||||
}
|
||||
|
||||
autocomplete(
|
||||
term: string | null,
|
||||
limit = 10
|
||||
): Observable<readonly LanguageLookupDto[]> {
|
||||
let params = new HttpParams().set('limit', limit);
|
||||
if (term !== null) {
|
||||
params = params.set('term', term);
|
||||
}
|
||||
|
||||
return this.http.get<readonly LanguageLookupDto[]>(LANGUAGE_ENDPOINTS.autocomplete, { params });
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
import { HttpClient, HttpParams } from "@angular/common/http";
|
||||
import { Injectable, inject } from "@angular/core";
|
||||
import { STATE_ENDPOINTS } from "../../end-points/state/state.endpoints"
|
||||
import { Observable } from "rxjs";
|
||||
import { DataTableQuery, DataTableResult } from "../../../shared/components/data-table/data-table.types";
|
||||
import {
|
||||
CreateStateRequest,
|
||||
StateDto,
|
||||
StateLookupDto,
|
||||
UpdateStateRequest
|
||||
} from "../../models/state/state.model";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class StateService {
|
||||
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
getStateDataTable(query: DataTableQuery, countryId: string): Observable<DataTableResult<StateDto>> {
|
||||
return this.http.post<DataTableResult<StateDto>>(`${STATE_ENDPOINTS.dataTable}`, query, {
|
||||
params: new HttpParams().set('countryId', countryId)
|
||||
});
|
||||
}
|
||||
|
||||
createState(request: CreateStateRequest): Observable<StateDto> {
|
||||
return this.http.post<StateDto>(STATE_ENDPOINTS.create, request);
|
||||
}
|
||||
|
||||
updateState(id: string, request: UpdateStateRequest): Observable<StateDto> {
|
||||
return this.http.put<StateDto>(STATE_ENDPOINTS.update(id), request);
|
||||
}
|
||||
|
||||
getStateById(id: string): Observable<StateDto> {
|
||||
return this.http.get<StateDto>(STATE_ENDPOINTS.getById(id));
|
||||
}
|
||||
|
||||
autocomplete(countryId: string, term = '', limit = 50): Observable<StateLookupDto[]> {
|
||||
return this.http.get<StateLookupDto[]>(STATE_ENDPOINTS.autocomplete, {
|
||||
params: new HttpParams()
|
||||
.set('countryId', countryId)
|
||||
.set('term', term)
|
||||
.set('limit', limit)
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { TENANT_CURRENCIES_ENDPOINTS } from '../../end-points/tenant/tenant-currencies.endpoints';
|
||||
import { DataTableQuery, DataTableResult } from '../../../shared/components/data-table/data-table.types';
|
||||
import {
|
||||
CreateTenantCurrencyRequest,
|
||||
TenantCurrencyDto,
|
||||
TenantCurrencyDto as TenantCurrencyDtoAlias,
|
||||
TenantCurrencyLookupDto,
|
||||
UpdateTenantCurrencyRequest
|
||||
} from '../../models/tenant/tenant-currencies.model';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TenantCurrenciesService {
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
getTenantDataTable(query: DataTableQuery): Observable<DataTableResult<TenantCurrencyDto>> {
|
||||
return this.http.post<DataTableResult<TenantCurrencyDto>>(TENANT_CURRENCIES_ENDPOINTS.dataTable, query);
|
||||
}
|
||||
|
||||
createTenant(request: CreateTenantCurrencyRequest): Observable<TenantCurrencyDto> {
|
||||
return this.http.post<TenantCurrencyDto>(TENANT_CURRENCIES_ENDPOINTS.create, request);
|
||||
}
|
||||
|
||||
updateTenant(id: string, request: UpdateTenantCurrencyRequest): Observable<TenantCurrencyDto> {
|
||||
return this.http.put<TenantCurrencyDto>(TENANT_CURRENCIES_ENDPOINTS.update(id), request);
|
||||
}
|
||||
|
||||
getTenantById(id: string): Observable<TenantCurrencyDto> {
|
||||
return this.http.get<TenantCurrencyDto>(TENANT_CURRENCIES_ENDPOINTS.getById(id));
|
||||
}
|
||||
|
||||
autocomplete(term?: string, limit = 10): Observable<readonly TenantCurrencyLookupDto[]> {
|
||||
let params = new HttpParams().set('limit', limit);
|
||||
const normalizedTerm = term?.trim();
|
||||
|
||||
if (normalizedTerm) {
|
||||
params = params.set('term', normalizedTerm);
|
||||
}
|
||||
|
||||
return this.http.get<readonly TenantCurrencyLookupDto[]>(TENANT_CURRENCIES_ENDPOINTS.autocomplete, { params });
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { TENANT_ENDPOINTS } from '../../end-points/tenant/tenant.endpoints';
|
||||
import { DataTableQuery, DataTableResult } from '../../../shared/components/data-table/data-table.types';
|
||||
import {
|
||||
CreateTenantRequest,
|
||||
TenantDto,
|
||||
TenantLookupDto,
|
||||
UpdateTenantRequest
|
||||
} from '../../models/tenant/tenant.model';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TenantService {
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
getTenantDataTable(query: DataTableQuery): Observable<DataTableResult<TenantDto>> {
|
||||
return this.http.post<DataTableResult<TenantDto>>(TENANT_ENDPOINTS.dataTable, query);
|
||||
}
|
||||
|
||||
createTenant(request: CreateTenantRequest): Observable<TenantDto> {
|
||||
return this.http.post<TenantDto>(TENANT_ENDPOINTS.create, request);
|
||||
}
|
||||
|
||||
updateTenant(id: string, request: UpdateTenantRequest): Observable<TenantDto> {
|
||||
return this.http.put<TenantDto>(TENANT_ENDPOINTS.update(id), request);
|
||||
}
|
||||
|
||||
getTenantById(id: string): Observable<TenantDto> {
|
||||
return this.http.get<TenantDto>(TENANT_ENDPOINTS.getById(id));
|
||||
}
|
||||
|
||||
autocomplete(term?: string, limit = 10): Observable<readonly TenantLookupDto[]> {
|
||||
let params = new HttpParams().set('limit', limit);
|
||||
const normalizedTerm = term?.trim();
|
||||
|
||||
if (normalizedTerm) {
|
||||
params = params.set('term', normalizedTerm);
|
||||
}
|
||||
|
||||
return this.http.get<readonly TenantLookupDto[]>(TENANT_ENDPOINTS.autocomplete, { params });
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { TIMEZONE_ENDPOINTS } from '../../end-points/timezone/timezone.endpoints';
|
||||
import {
|
||||
CreateTimezoneRequest,
|
||||
TimezoneDto,
|
||||
TimezoneLookupDto,
|
||||
UpdateTimezoneRequest
|
||||
} from '../../models/timezone/timezone.model';
|
||||
import {
|
||||
DataTableQuery,
|
||||
DataTableResult
|
||||
} from '../../../shared/components/data-table/data-table.types';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class TimezoneService {
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
getDataTable(query: DataTableQuery): Observable<DataTableResult<TimezoneDto>> {
|
||||
return this.http.post<DataTableResult<TimezoneDto>>(TIMEZONE_ENDPOINTS.dataTable, query);
|
||||
}
|
||||
|
||||
getById(id: string): Observable<TimezoneDto> {
|
||||
return this.http.get<TimezoneDto>(TIMEZONE_ENDPOINTS.getById(id));
|
||||
}
|
||||
|
||||
create(request: CreateTimezoneRequest): Observable<TimezoneDto> {
|
||||
return this.http.post<TimezoneDto>(TIMEZONE_ENDPOINTS.create, request);
|
||||
}
|
||||
|
||||
update(id: string, request: UpdateTimezoneRequest): Observable<TimezoneDto> {
|
||||
return this.http.put<TimezoneDto>(TIMEZONE_ENDPOINTS.update(id), request);
|
||||
}
|
||||
|
||||
autocomplete(term: string | null, limit = 10): Observable<readonly TimezoneLookupDto[]> {
|
||||
const normalizedTerm = term?.trim() || null;
|
||||
let params = new HttpParams().set('limit', limit);
|
||||
if (normalizedTerm !== null) {
|
||||
params = params.set('term', normalizedTerm);
|
||||
}
|
||||
return this.http.get<readonly TimezoneLookupDto[]>(TIMEZONE_ENDPOINTS.autocomplete, { params });
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { CreateUserRequest, UpdateUserRequest, UserDto, UserLookupDto } from '../../models/user/user.model';
|
||||
import { USER_ENDPOINTS } from '../../end-points/user/user.endpoints';
|
||||
import { DataTableQuery, DataTableResult } from '../../../shared/components/data-table/data-table.types';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class UserService {
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
createUser(request: CreateUserRequest): Observable<UserDto> {
|
||||
return this.http.post<UserDto>(USER_ENDPOINTS.create, request);
|
||||
}
|
||||
|
||||
getById(id: string): Observable<UserDto> {
|
||||
return this.http.get<UserDto>(USER_ENDPOINTS.getById(id));
|
||||
}
|
||||
|
||||
getDataTable(query: DataTableQuery): Observable<DataTableResult<UserDto>> {
|
||||
return this.http.post<DataTableResult<UserDto>>(USER_ENDPOINTS.dataTable, query);
|
||||
}
|
||||
|
||||
update(id: string, request: UpdateUserRequest): Observable<UserDto> {
|
||||
return this.http.put<UserDto>(USER_ENDPOINTS.update(id), request);
|
||||
}
|
||||
|
||||
autocomplete(term: string | null, limit = 10): Observable<readonly UserLookupDto[]> {
|
||||
const normalizedTerm = term?.trim() || null;
|
||||
let params = new HttpParams().set('limit', limit);
|
||||
if (normalizedTerm !== null) {
|
||||
params = params.set('term', normalizedTerm);
|
||||
}
|
||||
return this.http.get<readonly UserLookupDto[]>(USER_ENDPOINTS.autocomplete, { params });
|
||||
}
|
||||
|
||||
}
|
||||
+37
-36
@@ -1,23 +1,22 @@
|
||||
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 {
|
||||
CountryLookupDto,
|
||||
CountryService,
|
||||
} from '../../../../global-masters/countries/public-api';
|
||||
} from '../../../global-masters/countries/public-api';
|
||||
import {
|
||||
CurrencyLookupDto,
|
||||
CurrencyService,
|
||||
} from '../../../../global-masters/currencies/public-api';
|
||||
} from '../../../global-masters/currencies/public-api';
|
||||
import {
|
||||
LanguageLookupDto,
|
||||
LanguageService,
|
||||
} from '../../../../global-masters/languages/public-api';
|
||||
} from '../../../global-masters/languages/public-api';
|
||||
import {
|
||||
TimezoneLookupDto,
|
||||
TimezoneService,
|
||||
} from '../../../../global-masters/timezones/public-api';
|
||||
} from '../../../global-masters/timezones/public-api';
|
||||
import { OrganizationOnboardingDraft } from '../models/organization-draft.model';
|
||||
import {
|
||||
CountryLocalizationDefaults,
|
||||
@@ -85,31 +84,31 @@ const PLAN_DEFAULTS: readonly OrganizationPlanDefaults[] = [
|
||||
},
|
||||
];
|
||||
|
||||
const DATE_FORMAT_OPTIONS: readonly FormSelectOption<DateFormatValue>[] = [
|
||||
{ value: 'DD/MM/YYYY', label: 'DD/MM/YYYY' },
|
||||
{ value: 'MM/DD/YYYY', label: 'MM/DD/YYYY' },
|
||||
{ value: 'YYYY-MM-DD', label: 'YYYY-MM-DD' },
|
||||
const DATE_FORMAT_OPTIONS: readonly FormSelect<DateFormatValue>[] = [
|
||||
// { value: 'DD/MM/YYYY', label: 'DD/MM/YYYY' },
|
||||
// { value: 'MM/DD/YYYY', label: 'MM/DD/YYYY' },
|
||||
// { value: 'YYYY-MM-DD', label: 'YYYY-MM-DD' },
|
||||
];
|
||||
|
||||
const TIME_FORMAT_OPTIONS: readonly FormSelectOption<TimeFormatValue>[] = [
|
||||
{ value: 'TwelveHour', label: '12 hour' },
|
||||
{ value: 'TwentyFourHour', label: '24 hour' },
|
||||
const TIME_FORMAT_OPTIONS: readonly FormSelect<TimeFormatValue>[] = [
|
||||
// { value: 'TwelveHour', label: '12 hour' },
|
||||
// { value: 'TwentyFourHour', label: '24 hour' },
|
||||
];
|
||||
|
||||
const NUMBER_FORMAT_OPTIONS: readonly FormSelectOption<NumberFormatValue>[] = [
|
||||
{ value: 'OneTwoThreeCommaFourFiveSixPointSevenEight', label: '123,456.78' },
|
||||
{ value: 'OneTwoThreePointFourFiveSixCommaSevenEight', label: '123.456,78' },
|
||||
const NUMBER_FORMAT_OPTIONS: readonly FormSelect<NumberFormatValue>[] = [
|
||||
// { value: 'OneTwoThreeCommaFourFiveSixPointSevenEight', label: '123,456.78' },
|
||||
// { value: 'OneTwoThreePointFourFiveSixCommaSevenEight', label: '123.456,78' },
|
||||
];
|
||||
|
||||
const FISCAL_YEAR_OPTIONS: readonly FormSelectOption<FiscalYearConventionValue>[] = [
|
||||
{ value: 'CalendarYear', label: 'Calendar Year (Jan-Dec)' },
|
||||
{ value: 'AprilToMarch', label: 'April - March' },
|
||||
{ value: 'JulyToJune', label: 'July - June' },
|
||||
const FISCAL_YEAR_OPTIONS: readonly FormSelect<FiscalYearConventionValue>[] = [
|
||||
// { value: 'CalendarYear', label: 'Calendar Year (Jan-Dec)' },
|
||||
// { value: 'AprilToMarch', label: 'April - March' },
|
||||
// { value: 'JulyToJune', label: 'July - June' },
|
||||
];
|
||||
|
||||
const LICENSE_TYPE_OPTIONS: readonly FormSelectOption<OrganizationLicenseType>[] = [
|
||||
{ value: 'Trial', label: 'Trial' },
|
||||
{ value: 'Paid', label: 'Paid' },
|
||||
const LICENSE_TYPE_OPTIONS: readonly FormSelect<OrganizationLicenseType>[] = [
|
||||
// { value: 'Trial', label: 'Trial' },
|
||||
// { value: 'Paid', label: 'Paid' },
|
||||
];
|
||||
|
||||
const LOCALIZATION_DEFAULTS: readonly CountryLocalizationDefaults[] = [
|
||||
@@ -203,33 +202,35 @@ export class OrganizationOnboardingService {
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
loadLanguageOptions(limit = 50): Observable<readonly FormSelectOption<string>[]> {
|
||||
return this.languageService.autocomplete('', limit).pipe(
|
||||
map(items => items.map(item => ({
|
||||
value: item.id,
|
||||
label: `${item.code} - ${item.name}`,
|
||||
})))
|
||||
);
|
||||
loadLanguageOptions(limit = 50):readonly FormSelect<DateFormatValue>[] {
|
||||
return DATE_FORMAT_OPTIONS;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
|
||||
getTimeFormatOptions(): readonly FormSelectOption<TimeFormatValue>[] {
|
||||
getTimeFormatOptions(): readonly FormSelect<TimeFormatValue>[] {
|
||||
return TIME_FORMAT_OPTIONS;
|
||||
}
|
||||
|
||||
getNumberFormatOptions(): readonly FormSelectOption<NumberFormatValue>[] {
|
||||
getNumberFormatOptions(): readonly FormSelect<NumberFormatValue>[] {
|
||||
return NUMBER_FORMAT_OPTIONS;
|
||||
}
|
||||
|
||||
getFiscalYearOptions(): readonly FormSelectOption<FiscalYearConventionValue>[] {
|
||||
getFiscalYearOptions(): readonly FormSelect<FiscalYearConventionValue>[] {
|
||||
return FISCAL_YEAR_OPTIONS;
|
||||
}
|
||||
|
||||
getLicenseTypeOptions(): readonly FormSelectOption<OrganizationLicenseType>[] {
|
||||
getLicenseTypeOptions(): readonly FormSelect<OrganizationLicenseType>[] {
|
||||
return LICENSE_TYPE_OPTIONS;
|
||||
}
|
||||
|
||||
|
||||
+1
-58
@@ -76,64 +76,7 @@
|
||||
/>
|
||||
</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>
|
||||
</form>
|
||||
+11
-11
@@ -130,17 +130,17 @@ export class OrganizationLocalizationStepComponent implements OnboardingStepForm
|
||||
this.onboardingService.resolveLanguage(value);
|
||||
|
||||
constructor() {
|
||||
this.onboardingService.loadLanguageOptions(100)
|
||||
.pipe(
|
||||
catchError(() => {
|
||||
this.toastr.error('Unable to load language options.');
|
||||
return of<readonly FormSelectOption<string>[]>([]);
|
||||
}),
|
||||
takeUntilDestroyed(this.destroyRef)
|
||||
)
|
||||
.subscribe(options => {
|
||||
this.additionalLanguageOptions.update(current => this.mergeLanguageOptions(current, options));
|
||||
});
|
||||
// this.onboardingService.loadLanguageOptions(100)
|
||||
// .pipe(
|
||||
// catchError(() => {
|
||||
// this.toastr.error('Unable to load language options.');
|
||||
// return of<readonly FormSelectOption<string>[]>([]);
|
||||
// }),
|
||||
// takeUntilDestroyed(this.destroyRef)
|
||||
// )
|
||||
// .subscribe(options => {
|
||||
// this.additionalLanguageOptions.update(current => this.mergeLanguageOptions(current, options));
|
||||
// });
|
||||
|
||||
this.form.controls.defaultLanguageId.valueChanges
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
|
||||
+1
-14
@@ -20,20 +20,7 @@
|
||||
/>
|
||||
</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">
|
||||
<app-form-input
|
||||
|
||||
Reference in New Issue
Block a user