initial release

This commit is contained in:
2024-02-29 10:23:41 -06:00
commit 5146c8e919
210 changed files with 11040 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
import { Injectable } from '@angular/core';
import { KeyValue, KeyValueStyle } from '../models/main.model';
import { HttpClient } from '@angular/common/http';
import { InitEditableRow } from 'primeng/table';
import { lastValueFrom } from 'rxjs';
import { environment } from '../../environments/environment';
@Injectable({
providedIn: 'root',
})
export class SelectOptionsService {
private apiBaseUrl = environment.apiBaseUrl;
constructor(private http: HttpClient) {}
async init() {
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.locations = allSelectOptions.locations;
}
public typesOfBusiness: Array<KeyValueStyle>;
public prices: Array<KeyValue>;
public listingCategories: Array<KeyValue>;
public categories: Array<KeyValueStyle>;
public locations: Array<any>;
getLocation(value:string):string{
return this.locations.find(l=>l.value===value)?.name
}
getBusiness(value:string):string{
return this.typesOfBusiness.find(t=>t.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
}
getIcon(value:string):string{
return this.categories.find(c=>c.value===value)?.icon
}
getTextColor(value:string):string{
return this.categories.find(c=>c.value===value)?.textColorClass
}
getBgColor(value:string):string{
return this.categories.find(c=>c.value===value)?.bgColorClass
}
getIconAndTextColor(value:string):string{
const category = this.categories.find(c=>c.value===value)
return `${category?.icon} ${category?.textColorClass}`
}
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:string):string{
return this.typesOfBusiness.find(c=>c.value===value)?.bgColorClass
}
getIconAndTextColorType(value:string):string{
const category = this.typesOfBusiness.find(c=>c.value===value)
return `${category?.icon} ${category?.textColorClass}`
}
}