init to partner panel
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
@if (loading()) {
|
||||
<shared-page-loading />
|
||||
} @else {
|
||||
<router-outlet></router-outlet>
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { PageLoadingComponent } from '@/shared/components/page-loading.component';
|
||||
import { Component, computed, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute, RouterOutlet } from '@angular/router';
|
||||
import { PartnerCustomerStore } from '../store/customer.store';
|
||||
|
||||
@Component({
|
||||
selector: 'partner-customer-layout',
|
||||
templateUrl: './layout.component.html',
|
||||
imports: [PageLoadingComponent, RouterOutlet],
|
||||
})
|
||||
export class PartnerCustomerLayoutComponent {
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly store = inject(PartnerCustomerStore);
|
||||
|
||||
readonly customerId = signal<string>(this.route.snapshot.paramMap.get('customerId')!);
|
||||
|
||||
readonly loading = computed(() => this.store.loading());
|
||||
|
||||
getData() {
|
||||
this.store.getData(this.customerId());
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getData();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<app-page-data-list
|
||||
[pageTitle]="'لیست مشتریان'"
|
||||
[columns]="columns"
|
||||
emptyPlaceholderTitle="مشتریای یافت نشد"
|
||||
[items]="items()"
|
||||
[loading]="loading()"
|
||||
[showEdit]="true"
|
||||
[showDetails]="true"
|
||||
(onEdit)="onEditClick($event)"
|
||||
(onDetails)="toSinglePage($event)"
|
||||
/>
|
||||
@@ -0,0 +1,48 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||
import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { partnerCustomersNamedRoutes } from '../constants';
|
||||
import { ICustomerResponse } from '../models';
|
||||
import { CustomersService } from '../services/main.service';
|
||||
|
||||
@Component({
|
||||
selector: 'partner-customer-list',
|
||||
templateUrl: './list.component.html',
|
||||
imports: [PageDataListComponent],
|
||||
})
|
||||
export class PartnerCustomerListComponent extends AbstractList<ICustomerResponse> {
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
|
||||
{
|
||||
field: 'first_name',
|
||||
header: 'عنوان',
|
||||
},
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
|
||||
private readonly service = inject(CustomersService);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = this.header;
|
||||
}
|
||||
|
||||
override getDataRequest() {
|
||||
return this.service.getAll();
|
||||
}
|
||||
|
||||
toSinglePage(item: ICustomerResponse) {
|
||||
this.router.navigateByUrl(partnerCustomersNamedRoutes.customer.meta.pagePath!(item.id));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user