ui update, init to consumer statistics and manage pos user types

This commit is contained in:
2026-04-13 13:22:40 +03:30
parent d4dff4ebfd
commit af3123e61e
85 changed files with 1054 additions and 407 deletions
@@ -1,7 +1,7 @@
import { Maybe } from '@/core';
import { IPaginatedResponse } from '@/core/models/service.model';
import { IListingResponse, IPaginatedResponse } from '@/core/models/service.model';
import { Component, signal } from '@angular/core';
import { Observable } from 'rxjs';
import { catchError, finalize, Observable } from 'rxjs';
import { IColumn } from '../components/pageDataList/page-data-list.component';
@Component({
@@ -28,10 +28,21 @@ export abstract class AbstractList<ResponseModel, RequestParams = null> {
getData() {
this.loading.set(true);
this.getDataRequest(this.requestPayload())?.subscribe((res) => {
this.loading.set(false);
this.items.set(res.data);
});
this.items.set([]);
this.getDataRequest(this.requestPayload())
?.pipe(
finalize(() => {
console.log('first');
this.loading.set(false);
}),
catchError((error) => {
throw error;
}),
)
.subscribe((res) => {
this.items.set(res.data ?? []);
});
}
openAddForm() {
@@ -42,7 +53,7 @@ export abstract class AbstractList<ResponseModel, RequestParams = null> {
abstract getDataRequest(
payload: Maybe<RequestParams>,
): Observable<IPaginatedResponse<ResponseModel>> | void;
): Observable<IPaginatedResponse<ResponseModel> | IListingResponse<ResponseModel>> | void;
abstract setColumns(): void;
@@ -17,7 +17,7 @@ export abstract class AbstractSelectComponent<T = ISelectItem, serviceResponse =
@Input() canInsert: boolean = false;
@Input() showLabel: boolean = true;
@Input() showErrors: boolean = true;
@Input() showClear: boolean = true;
@Input() showClear: boolean = false;
@Input() isFullDataOptionValue: boolean = false;
@Input() optionValue = 'id';
@Output() onChange = new EventEmitter<Maybe<T>>();
+1 -1
View File
@@ -14,7 +14,7 @@ import { EnumsService } from './services';
imports: [UikitFieldComponent, Select, ReactiveFormsModule],
})
export class EnumSelectComponent extends AbstractSelectComponent<string, IApiEnumResponse[]> {
@Input() type!: TEnumApi;
@Input({ required: true }) type!: TEnumApi;
@Input() customLabel?: string;
private readonly service = inject(EnumsService);
@@ -16,8 +16,9 @@
<ng-container [ngTemplateOutlet]="caption">
<div class="flex justify-between items-center gap-4">
<h5 class="font-bold">{{ pageTitle }}</h5>
@if (showAdd || filter) {
@if (showAdd || filter || moreActions) {
<div class="flex items-center gap-2">
<ng-container [ngTemplateOutlet]="moreActions" />
@if (filter) {
<p-button
label="فیلتر"
@@ -35,7 +35,7 @@ export interface IColumn<T = any> {
selector: 'app-page-data-list',
templateUrl: './page-data-list.component.html',
host: {
class: 'block w-full',
class: 'block w-full h-full overflow-hidden',
},
imports: [
CommonModule,
@@ -77,6 +77,7 @@ export class PageDataListComponent<I> {
@ContentChild('filter', { static: true }) filter!: TemplateRef<any> | null;
@ContentChild('caption', { static: true }) caption!: TemplateRef<any> | null;
@ContentChild('moreActions', { static: true }) moreActions!: TemplateRef<any> | null;
@Output() onEdit = new EventEmitter<I>();
@Output() onDelete = new EventEmitter<I>();