49 lines
1.6 KiB
TypeScript
49 lines
1.6 KiB
TypeScript
import { BreadcrumbService } from '@/core/services';
|
|
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
|
import { Component, computed, effect, inject, signal } from '@angular/core';
|
|
import { ActivatedRoute } from '@angular/router';
|
|
import { Divider } from 'primeng/divider';
|
|
import { ConsumerComplexListComponent } from '../components/complexes/list.component';
|
|
import { ConsumerBusinessActivityFormComponent } from '../components/form.component';
|
|
import { BusinessActivityStore } from '../store/businessActivity.store';
|
|
|
|
@Component({
|
|
selector: 'business-businessActivity',
|
|
templateUrl: './single.component.html',
|
|
imports: [
|
|
AppCardComponent,
|
|
KeyValueComponent,
|
|
ConsumerBusinessActivityFormComponent,
|
|
ConsumerComplexListComponent,
|
|
Divider,
|
|
],
|
|
})
|
|
export class ConsumerBusinessActivityComponent {
|
|
private readonly store = inject(BusinessActivityStore);
|
|
private readonly route = inject(ActivatedRoute);
|
|
private readonly breadcrumbService = inject(BreadcrumbService);
|
|
|
|
readonly businessId = signal<string>(this.route.snapshot.paramMap.get('businessActivityId')!);
|
|
editMode = signal<boolean>(false);
|
|
|
|
readonly loading = computed(() => this.store.loading());
|
|
readonly business = computed(() => this.store.entity());
|
|
readonly businessBreadcrumb = computed(() => this.store.breadcrumbItems());
|
|
|
|
constructor() {
|
|
effect(() => {
|
|
if (this.business()?.id) {
|
|
this.setBreadcrumb();
|
|
}
|
|
});
|
|
}
|
|
|
|
getData() {
|
|
this.store.getData(this.businessId());
|
|
}
|
|
|
|
setBreadcrumb() {
|
|
this.breadcrumbService.setItems(this.businessBreadcrumb());
|
|
}
|
|
}
|