init
This commit is contained in:
@@ -0,0 +1 @@
|
||||
<admin-guild-good-categories-list [guildId]="guildId()" [fullHeight]="true" />
|
||||
@@ -0,0 +1,14 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { GuildGoodCategoriesListComponent } from '../../components/categories/list.component';
|
||||
|
||||
@Component({
|
||||
selector: 'admin-guild-good-categories',
|
||||
templateUrl: './list.component.html',
|
||||
imports: [GuildGoodCategoriesListComponent],
|
||||
})
|
||||
export class GuildGoodCategoriesComponent {
|
||||
route = inject(ActivatedRoute);
|
||||
guildId = signal<string>(this.route.snapshot.paramMap.get('guildId')!);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<admin-guild-goods-list [guildId]="guildId()" />
|
||||
@@ -0,0 +1,14 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { GuildGoodsListComponent } from '../../components/goods/list.component';
|
||||
|
||||
@Component({
|
||||
selector: 'admin-guild_goods',
|
||||
templateUrl: './list.component.html',
|
||||
imports: [GuildGoodsListComponent],
|
||||
})
|
||||
export class GuildGoodsComponent {
|
||||
route = inject(ActivatedRoute);
|
||||
guildId = signal<string>(this.route.snapshot.paramMap.get('guildId')!);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './list.component';
|
||||
export * from './single.component';
|
||||
@@ -0,0 +1,15 @@
|
||||
<app-page-data-list
|
||||
[pageTitle]="'مدیریت اصناف'"
|
||||
[addNewCtaLabel]="'افزودن صنف جدید'"
|
||||
[columns]="columns"
|
||||
[showAdd]="true"
|
||||
emptyPlaceholderTitle="صنفی یافت نشد"
|
||||
emptyPlaceholderDescription="برای افزودن صنف جدید، روی دکمهٔ بالا کلیک کنید."
|
||||
[items]="items()"
|
||||
[loading]="loading()"
|
||||
[showDetails]="true"
|
||||
[showAdd]="true"
|
||||
(onAdd)="openAddForm()"
|
||||
(onDetails)="toSinglePage($event)"
|
||||
/>
|
||||
<admin-guild-form [(visible)]="visibleForm" (onSubmit)="refresh()" />
|
||||
@@ -0,0 +1,46 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { IPaginatedResponse } from '@/core/models/service.model';
|
||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||
import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { GuildFormComponent } from '../components/form.component';
|
||||
import { guildsNamedRoutes } from '../constants';
|
||||
import { IGuildResponse } from '../models';
|
||||
import { GuildsService } from '../services/main.service';
|
||||
|
||||
@Component({
|
||||
selector: 'admin-guilds',
|
||||
templateUrl: './list.component.html',
|
||||
imports: [PageDataListComponent, GuildFormComponent],
|
||||
})
|
||||
export class GuildsComponent extends AbstractList<IGuildResponse> {
|
||||
private readonly service = inject(GuildsService);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
{ field: 'id', header: 'شناسه' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'code', header: 'کد' },
|
||||
{ field: 'businessActivitiesCount', header: 'تعداد فعالیتهای اقتصادی مرتبط' },
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
] as IColumn[];
|
||||
}
|
||||
|
||||
override getDataRequest(): void | Observable<IPaginatedResponse<IGuildResponse>> {
|
||||
return this.service.getAll();
|
||||
}
|
||||
|
||||
toSinglePage(guild: IGuildResponse) {
|
||||
this.router.navigateByUrl(guildsNamedRoutes.guild.meta.pagePath!(guild.id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات صنف" [editable]="true" [(editMode)]="editMode">
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<app-key-value label="عنوان صنف" [value]="guild()?.name" />
|
||||
<app-key-value label="کد صنف" [value]="guild()?.code" />
|
||||
</div>
|
||||
</div>
|
||||
</app-card-data>
|
||||
|
||||
<admin-guild-good-categories-list [guildId]="guildId()" />
|
||||
<admin-guild-goods-list [guildId]="guildId()" />
|
||||
|
||||
<admin-guild-form
|
||||
[(visible)]="editMode"
|
||||
[editMode]="true"
|
||||
[guildId]="guildId()"
|
||||
[initialValues]="guild() || undefined"
|
||||
(onSubmit)="getData()"
|
||||
/>
|
||||
</div>
|
||||
@@ -0,0 +1,37 @@
|
||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||
import { Component, computed, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { GuildGoodCategoriesListComponent } from '../components/categories/list.component';
|
||||
import { GuildFormComponent } from '../components/form.component';
|
||||
import { GuildGoodsListComponent } from '../components/goods/list.component';
|
||||
import { GuildStore } from '../store/guild.store';
|
||||
|
||||
@Component({
|
||||
selector: 'admin-guild',
|
||||
templateUrl: './single.component.html',
|
||||
imports: [
|
||||
AppCardComponent,
|
||||
KeyValueComponent,
|
||||
GuildGoodCategoriesListComponent,
|
||||
GuildGoodsListComponent,
|
||||
GuildFormComponent,
|
||||
],
|
||||
})
|
||||
export class GuildComponent {
|
||||
private readonly store = inject(GuildStore);
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
|
||||
readonly guildId = signal<string>(this.route.snapshot.paramMap.get('guildId')!);
|
||||
editMode = signal<boolean>(false);
|
||||
|
||||
readonly loading = computed(() => this.store.loading());
|
||||
readonly guild = computed(() => this.store.entity());
|
||||
|
||||
getData() {
|
||||
this.store.getData(this.guildId());
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getData();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user