complex good module
This commit is contained in:
@@ -2,6 +2,7 @@ const baseUrl = '/api/v1/catalog';
|
||||
|
||||
export const CATALOG_API_ROUTES = {
|
||||
guilds: () => `${baseUrl}/guilds`,
|
||||
guildGoodCategories: (guildId: string) => `${baseUrl}/guilds/${guildId}/good_categories`,
|
||||
providers: () => `${baseUrl}/providers`,
|
||||
devices: () => `${baseUrl}/devices`,
|
||||
deviceBrands: () => `${baseUrl}/device_brands`,
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<uikit-field [label]="label" [control]="control" [showLabel]="showLabel" [showErrors]="showErrors">
|
||||
<p-select
|
||||
[loading]="loading()"
|
||||
[options]="items()"
|
||||
optionLabel="name"
|
||||
[optionValue]="selectOptionValue"
|
||||
placeholder="انتخاب دستهبندی"
|
||||
[formControl]="control"
|
||||
[showClear]="showClear"
|
||||
[filter]="true"
|
||||
appendTo="body"
|
||||
/>
|
||||
</uikit-field>
|
||||
@@ -0,0 +1,31 @@
|
||||
import { IListingResponse } from '@/core/models/service.model';
|
||||
import ISummary from '@/core/models/summary';
|
||||
import { AbstractSelectComponent } from '@/shared/abstractClasses';
|
||||
import { UikitFieldComponent } from '@/uikit';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { Select } from 'primeng/select';
|
||||
import { CatalogsService } from '../../service';
|
||||
|
||||
@Component({
|
||||
selector: 'catalog-guild-goodCategories-select',
|
||||
templateUrl: './select.component.html',
|
||||
imports: [UikitFieldComponent, Select, ReactiveFormsModule],
|
||||
})
|
||||
export class CatalogGuildGoodCategoriesSelectComponent extends AbstractSelectComponent<
|
||||
ISummary,
|
||||
IListingResponse<ISummary>
|
||||
> {
|
||||
@Input({ required: true }) guildId!: string;
|
||||
@Input() override showClear: boolean = false;
|
||||
@Input() label: string = '';
|
||||
private readonly service = inject(CatalogsService);
|
||||
|
||||
ngOnInit() {
|
||||
this.getData();
|
||||
}
|
||||
|
||||
getDataService() {
|
||||
return this.service.getGuildGoodCategories(this.guildId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './components/select.component';
|
||||
@@ -15,6 +15,10 @@ export class CatalogsService {
|
||||
return this.http.get<IListingResponse<ISummary>>(this.apiRoutes.guilds());
|
||||
}
|
||||
|
||||
getGuildGoodCategories(guildId: string): Observable<IListingResponse<ISummary>> {
|
||||
return this.http.get<IListingResponse<ISummary>>(this.apiRoutes.guildGoodCategories(guildId));
|
||||
}
|
||||
|
||||
getProviders(): Observable<IListingResponse<ISummary>> {
|
||||
return this.http.get<IListingResponse<ISummary>>(this.apiRoutes.providers());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user