feat(cardex): implement cardex module with filters, templates, and service integration

This commit is contained in:
2025-12-23 20:35:20 +03:30
parent e937c994d7
commit 1373cc046d
23 changed files with 473 additions and 134 deletions
@@ -12,10 +12,11 @@ import { getMovementReferenceTypeColor, getMovementReferenceTypeText } from './u
export class CatalogMovementReferenceTagComponent {
@Input() type!: MovementReferenceType;
@Input() movementType?: MovementType;
@Input() counterName?: string;
constructor() {}
get text() {
return getMovementReferenceTypeText(this.type, this.movementType);
return getMovementReferenceTypeText(this.type, this.movementType, this.counterName);
}
get color() {
return getMovementReferenceTypeColor(this.type);
@@ -5,6 +5,7 @@ import { MovementReferenceType } from './types';
export const getMovementReferenceTypeText = (
movementType: MovementReferenceType,
type?: MovementType,
counterName?: string,
): string => {
switch (movementType) {
case MovementReferenceType.PURCHASE:
@@ -15,9 +16,9 @@ export const getMovementReferenceTypeText = (
return 'تعدیل';
case MovementReferenceType.INVENTORY_TRANSFER:
if (type === MovementType.IN) {
return 'دریافت از انبار دیگر';
return `دریافت از انبار ${counterName ?? 'دیگر'}`;
} else {
return 'ارسال به انبار دیگر';
return `ارسال به انبار ${counterName ?? 'دیگر'}`;
}
default:
return 'انتقال بین انبارها';
@@ -1,5 +1,5 @@
import { Maybe } from '@/core';
import { Component, Input, model, signal } from '@angular/core';
import { Component, EventEmitter, Input, model, Output, signal } from '@angular/core';
import { FormControl } from '@angular/forms';
export interface ISelectItem {
@@ -18,6 +18,7 @@ export abstract class AbstractSelectComponent<T = ISelectItem> {
@Input() showErrors: boolean = true;
@Input() isFullDataOptionValue: boolean = false;
@Input() optionValue = 'id';
@Output() onChange = new EventEmitter<Maybe<T>>();
loading = signal(false);
items = signal<Maybe<T[]>>(null);
@@ -50,4 +51,13 @@ export abstract class AbstractSelectComponent<T = ISelectItem> {
}
return this.optionValue;
}
change(value: Maybe<T>) {
if (typeof value !== 'object') {
// @ts-ignore
this.onChange.emit(this.items()?.find((item) => item[this.optionValue] === value));
} else {
this.onChange.emit(value);
}
}
}