feat(consumers): implement consumer and POS stores with breadcrumb management
- Added ConsumerStore and PosStore to manage state and data fetching for consumers and POS entities. - Implemented breadcrumb functionality in both stores to enhance navigation. - Created views for consumer accounts, business activities, complexes, and poses with respective components. - Developed single view components for detailed display and editing of consumer and POS data. - Introduced charge account management components in the super admin module, including forms and lists for charge transactions. - Established API routes and services for handling charge account transactions.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
export * from './list.component';
|
||||
@@ -0,0 +1 @@
|
||||
<partner-consumer-complexes-list [consumerId]="consumerId()" [businessId]="businessId()" />
|
||||
@@ -0,0 +1,43 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { BreadcrumbService } from '@/core/services';
|
||||
import pageParamsUtils from '@/utils/page-params.utils';
|
||||
import { Component, computed, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ConsumerComplexesComponent } from '../../components/complexes/list.component';
|
||||
import { partnerConsumerComplexesNamedRoutes } from '../../constants/routes/complexes';
|
||||
import { BusinessActivityStore } from '../../store/businessActivity.store';
|
||||
import { ConsumerStore } from '../../store/consumer.store';
|
||||
|
||||
@Component({
|
||||
selector: 'partner-user-complexes',
|
||||
templateUrl: './list.component.html',
|
||||
imports: [ConsumerComplexesComponent],
|
||||
})
|
||||
export class PartnerUserComplexesComponent {
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly breadcrumbService = inject(BreadcrumbService);
|
||||
private readonly consumerStore = inject(ConsumerStore);
|
||||
private readonly businessStore = inject(BusinessActivityStore);
|
||||
|
||||
pageParams = computed(() => pageParamsUtils(this.route));
|
||||
consumerId = signal<string>(this.pageParams()['consumerId']);
|
||||
businessId = signal<string>(this.pageParams()['businessActivityId']);
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.setBreadcrumb();
|
||||
}
|
||||
|
||||
setBreadcrumb() {
|
||||
this.breadcrumbService.setItems([
|
||||
...this.consumerStore.breadcrumbItems(),
|
||||
...this.businessStore.breadcrumbItems(),
|
||||
{
|
||||
title: partnerConsumerComplexesNamedRoutes.complexes.meta.title,
|
||||
routerLink: partnerConsumerComplexesNamedRoutes.complexes.meta.pagePath!(
|
||||
this.consumerId(),
|
||||
this.businessId(),
|
||||
),
|
||||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<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]="complex()?.name" />
|
||||
<app-key-value label="آدرس" [value]="complex()?.address" />
|
||||
</div>
|
||||
</div>
|
||||
</app-card-data>
|
||||
|
||||
<partner-consumer-poses-list [consumerId]="consumerId()" [businessId]="businessId()" [complexId]="complexId()" />
|
||||
|
||||
<partner-consumer-complex-form
|
||||
[(visible)]="editMode"
|
||||
[editMode]="true"
|
||||
[consumerId]="consumerId()"
|
||||
[businessActivityId]="businessId()"
|
||||
[complexId]="complexId()"
|
||||
[initialValues]="complex() || undefined"
|
||||
(onSubmit)="getData()"
|
||||
/>
|
||||
</div>
|
||||
@@ -0,0 +1,59 @@
|
||||
import { BreadcrumbService } from '@/core/services';
|
||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||
import pageParamsUtils from '@/utils/page-params.utils';
|
||||
import { Component, computed, effect, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ConsumerComplexFormComponent } from '../../components/complexes/form.component';
|
||||
import { ConsumerPosesComponent } from '../../components/poses/list.component';
|
||||
import { BusinessActivityStore } from '../../store/businessActivity.store';
|
||||
import { ComplexStore } from '../../store/complex.store';
|
||||
import { ConsumerStore } from '../../store/consumer.store';
|
||||
|
||||
@Component({
|
||||
selector: 'partner-user-complex',
|
||||
templateUrl: './single.component.html',
|
||||
imports: [
|
||||
AppCardComponent,
|
||||
KeyValueComponent,
|
||||
ConsumerComplexFormComponent,
|
||||
ConsumerPosesComponent,
|
||||
],
|
||||
})
|
||||
export class PartnerUserComplexComponent {
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly breadcrumbService = inject(BreadcrumbService);
|
||||
private readonly store = inject(ComplexStore);
|
||||
private readonly consumerStore = inject(ConsumerStore);
|
||||
private readonly businessStore = inject(BusinessActivityStore);
|
||||
|
||||
pageParams = computed(() => pageParamsUtils(this.route));
|
||||
|
||||
readonly consumerId = signal<string>(this.pageParams()['consumerId']!);
|
||||
readonly businessId = signal<string>(this.pageParams()['businessActivityId']!);
|
||||
readonly complexId = signal<string>(this.pageParams()['complexId']!);
|
||||
|
||||
editMode = signal<boolean>(false);
|
||||
|
||||
readonly loading = computed(() => this.store.loading());
|
||||
readonly complex = computed(() => this.store.entity());
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
if (this.complex()?.id) {
|
||||
this.setBreadcrumb();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getData() {
|
||||
this.store.getData(this.consumerId(), this.businessId(), this.complexId());
|
||||
}
|
||||
|
||||
setBreadcrumb() {
|
||||
this.breadcrumbService.setItems([
|
||||
...this.consumerStore.breadcrumbItems(),
|
||||
...this.businessStore.breadcrumbItems(),
|
||||
...this.store.breadcrumbItems(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user