account changes
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { InitEditableRow } from 'primeng/table';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { environment } from '../../environments/environment';
|
||||
import { KeyValue, KeyValueStyle } from '../../../../bizmatch-server/src/models/main.model';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -13,67 +12,58 @@ export class SelectOptionsService {
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
async init() {
|
||||
const allSelectOptions = await lastValueFrom(
|
||||
this.http.get<any>(`${this.apiBaseUrl}/bizmatch/select-options`)
|
||||
);
|
||||
const allSelectOptions = await lastValueFrom(this.http.get<any>(`${this.apiBaseUrl}/bizmatch/select-options`));
|
||||
this.typesOfBusiness = allSelectOptions.typesOfBusiness;
|
||||
this.prices = allSelectOptions.prices;
|
||||
this.listingCategories = allSelectOptions.listingCategories;
|
||||
this.categories = allSelectOptions.categories;
|
||||
this.customerTypes = allSelectOptions.customerTypes;
|
||||
this.states = allSelectOptions.locations;
|
||||
this.typesOfCommercialProperty = allSelectOptions.typesOfCommercialProperty
|
||||
this.gender = allSelectOptions.gender;
|
||||
this.typesOfCommercialProperty = allSelectOptions.typesOfCommercialProperty;
|
||||
}
|
||||
public typesOfBusiness: Array<KeyValueStyle>;
|
||||
|
||||
|
||||
public typesOfCommercialProperty: Array<KeyValueStyle>;
|
||||
|
||||
|
||||
public prices: Array<KeyValue>;
|
||||
|
||||
public listingCategories: Array<KeyValue>;
|
||||
|
||||
public categories: Array<KeyValueStyle>;
|
||||
public customerTypes: Array<KeyValue>;
|
||||
|
||||
public gender: Array<KeyValue>;
|
||||
|
||||
public states: Array<any>;
|
||||
|
||||
getState(value:string):string{
|
||||
return this.states.find(l=>l.value===value)?.name
|
||||
getState(value: string): string {
|
||||
return this.states.find(l => l.value === value)?.name;
|
||||
}
|
||||
getBusiness(value:number):string{
|
||||
return this.typesOfBusiness.find(t=>t.value===String(value))?.name
|
||||
getBusiness(value: number): string {
|
||||
return this.typesOfBusiness.find(t => t.value === String(value))?.name;
|
||||
}
|
||||
getCommercialProperty(value:number):string{
|
||||
return this.typesOfCommercialProperty.find(t=>t.value===String(value))?.name
|
||||
getCommercialProperty(value: number): string {
|
||||
return this.typesOfCommercialProperty.find(t => t.value === String(value))?.name;
|
||||
}
|
||||
getListingsCategory(value:string):string{
|
||||
return this.listingCategories.find(l=>l.value===value)?.name
|
||||
getListingsCategory(value: string): string {
|
||||
return this.listingCategories.find(l => l.value === value)?.name;
|
||||
}
|
||||
getCategory(value:string):string{
|
||||
return this.categories.find(c=>c.value===value)?.name
|
||||
getCustomerType(value: string): string {
|
||||
return this.customerTypes.find(c => c.value === value)?.name;
|
||||
}
|
||||
getIcon(value:string):string{
|
||||
return this.categories.find(c=>c.value===value)?.icon
|
||||
getGender(value: string): string {
|
||||
return this.gender.find(c => c.value === value)?.name;
|
||||
}
|
||||
getTextColor(value:string):string{
|
||||
return this.categories.find(c=>c.value===value)?.textColorClass
|
||||
getIconType(value: string): string {
|
||||
return this.typesOfBusiness.find(c => c.value === value)?.icon;
|
||||
}
|
||||
getBgColor(value:string):string{
|
||||
return this.categories.find(c=>c.value===value)?.bgColorClass
|
||||
getTextColorType(value: string): string {
|
||||
return this.typesOfBusiness.find(c => c.value === value)?.textColorClass;
|
||||
}
|
||||
getIconAndTextColor(value:string):string{
|
||||
const category = this.categories.find(c=>c.value===value)
|
||||
return `${category?.icon} ${category?.textColorClass}`
|
||||
getBgColorType(value: number): string {
|
||||
return this.typesOfBusiness.find(c => c.value === String(value))?.bgColorClass;
|
||||
}
|
||||
getIconType(value:string):string{
|
||||
return this.typesOfBusiness.find(c=>c.value===value)?.icon
|
||||
}
|
||||
getTextColorType(value:string):string{
|
||||
return this.typesOfBusiness.find(c=>c.value===value)?.textColorClass
|
||||
}
|
||||
getBgColorType(value:number):string{
|
||||
return this.typesOfBusiness.find(c=>c.value===String(value))?.bgColorClass
|
||||
}
|
||||
getIconAndTextColorType(value:number):string{
|
||||
const category = this.typesOfBusiness.find(c=>c.value===String(value))
|
||||
return `${category?.icon} ${category?.textColorClass}`
|
||||
getIconAndTextColorType(value: number): string {
|
||||
const category = this.typesOfBusiness.find(c => c.value === String(value));
|
||||
return `${category?.icon} ${category?.textColorClass}`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user