complex good module

This commit is contained in:
2026-03-16 20:59:28 +03:30
parent 739aef67a3
commit f2766e2d7d
17 changed files with 375 additions and 0 deletions
+1
View File
@@ -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';
+4
View File
@@ -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());
}