Files
psp_panel/src/app/shared/directives/jalali-date.directive.ts
T
ahasani 35be7e0298 feat(inventories): implement inventory movement list and transfer functionality
- Added InventoryMovementListComponent to display stock movements with filtering options.
- Created InventoriesTransferFormComponent for transferring stock between inventories.
- Implemented product cardex view to show detailed inventory movements for specific products.
- Enhanced product listing with loading states and improved UI components.
- Introduced Jalali date formatting directive for better date representation.
- Added utility functions for Jalali date conversions and comparisons.
- Created reusable details info card component for displaying inventory details.
- Updated movement reference types and tags for better categorization of inventory movements.
2025-12-14 10:16:14 +03:30

23 lines
669 B
TypeScript

import { formatJalali } from '@/utils';
import { Directive, ElementRef, Input, OnChanges, Renderer2, SimpleChanges } from '@angular/core';
@Directive({
selector: '[jalaliDate]',
})
export class JalaliDateDirective implements OnChanges {
@Input('jalaliDate') dateValue!: string | number | Date;
@Input() jalaliFormat: string = 'YYYY/MM/DD';
constructor(
private el: ElementRef,
private renderer: Renderer2,
) {}
ngOnChanges(changes: SimpleChanges): void {
if (this.dateValue) {
const formatted = formatJalali(this.dateValue, this.jalaliFormat);
this.renderer.setProperty(this.el.nativeElement, 'innerText', formatted);
}
}
}