feat: enhance input component to support price type and add new payment method components

- Updated InputComponent to handle 'price' type with appropriate formatting and validation.
- Introduced new API routes for purchase receipt payments.
- Created constants for purchase receipts and invoices.
- Developed SupplierInvoicePayFormComponent for processing invoice payments.
- Implemented SupplierLedgerComponent to display supplier transactions.
- Added services and stores for managing supplier invoices and payments.
- Created components for selecting payment methods and displaying payment type tags.
- Enhanced UI with new templates for invoices and payment forms.
- Added utility functions for handling payment method types and statuses.
This commit is contained in:
2025-12-27 20:35:02 +03:30
parent c6efda319c
commit 879e29f54f
70 changed files with 1094 additions and 334 deletions
@@ -1,20 +1,41 @@
import { Maybe } from '@/core';
import { PriceMaskDirective } from '@/shared/directives';
import { UikitFieldComponent } from '@/uikit/uikit-field.component';
import { CommonModule } from '@angular/common';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms';
import { InputGroupModule } from 'primeng/inputgroup';
import { InputGroupAddon } from 'primeng/inputgroupaddon';
import { InputNumberModule } from 'primeng/inputnumber';
import { InputTextModule } from 'primeng/inputtext';
import { ToggleSwitch } from 'primeng/toggleswitch';
@Component({
selector: 'app-input',
standalone: true,
imports: [CommonModule, ReactiveFormsModule, InputTextModule, UikitFieldComponent, ToggleSwitch],
imports: [
CommonModule,
ReactiveFormsModule,
InputTextModule,
InputGroupModule,
UikitFieldComponent,
ToggleSwitch,
PriceMaskDirective,
InputGroupAddon,
InputNumberModule,
],
templateUrl: './input.component.html',
})
export class InputComponent {
@Input() type: 'simple' | 'postalCode' | 'mobile' | 'phone' | 'email' | 'checkbox' | 'switch' =
'simple';
@Input() type:
| 'simple'
| 'postalCode'
| 'mobile'
| 'phone'
| 'email'
| 'checkbox'
| 'switch'
| 'price' = 'simple';
@Input() control!: FormControl<Maybe<any>>;
@Input() name!: string;
@Input() label: string = '';
@@ -24,11 +45,12 @@ export class InputComponent {
@Input() size?: 'small' | 'large';
@Input() autocomplete?: string = 'off';
@Input() showErrors = false;
@Output() valueChange = new EventEmitter<string>();
@Input() hint?: string;
@Output() valueChange = new EventEmitter<string | number>();
onInput(ev: Event) {
const v = (ev.target as HTMLInputElement).value;
this.valueChange.emit(v);
this.valueChange.emit(this.type === 'price' ? parseFloat(v) : v);
}
get placeholder(): string | null {
@@ -42,6 +64,8 @@ export class InputComponent {
return 'شماره تلفن';
case 'email':
return 'آدرس ایمیل خود را وارد کنید';
case 'price':
return 'مبلغ';
default:
return '';
}
@@ -52,6 +76,7 @@ export class InputComponent {
case 'mobile':
case 'phone':
case 'postalCode':
case 'price':
return 'numeric';
default:
return 'text';
@@ -75,6 +100,7 @@ export class InputComponent {
switch (this.type) {
case 'mobile':
case 'phone':
case 'price':
return 'ltrInput';
case 'email':
case 'postalCode':