feat(purchases): implement purchase receipt functionality with form and receipt template
- Added `ProductPurchaseComponent` to handle product purchases. - Created `PurchaseReceiptTemplateComponent` for displaying purchase receipt details. - Developed `PurchaseFormComponent` for managing purchase form inputs and submission. - Introduced `ProductChargeRowFormComponent` and `ProductChargeRowFormFieldsComponent` for handling product charge rows in the form. - Implemented `PurchaseReceiptProductRowComponent` for displaying individual product rows in the receipt. - Established API routes for purchase operations in `apiRoutes`. - Integrated suppliers and inventories selection components. - Added utility functions for converting prices to Persian alphabet. - Created a utility for generating full names from name parts. - Enhanced form validation and submission handling in the purchase form. - Updated styles and templates for improved UI/UX.
This commit is contained in:
@@ -1,13 +1,25 @@
|
||||
<div class="flex flex-col gap-1">
|
||||
<uikit-label [name]="name" [invalid]="!!invalid || showErrors">
|
||||
{{ label }}
|
||||
</uikit-label>
|
||||
<ng-container [ngTemplateOutlet]="fieldTemplate" />
|
||||
|
||||
<ng-template #fieldTemplate>
|
||||
@if (showLabel) {
|
||||
<div class="flex flex-col gap-1">
|
||||
<uikit-label [name]="name" [invalid]="!!invalid || hasError">
|
||||
{{ label }}
|
||||
</uikit-label>
|
||||
<ng-container [ngTemplateOutlet]="contentTemplate" />
|
||||
</div>
|
||||
} @else {
|
||||
<ng-container [ngTemplateOutlet]="contentTemplate" />
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #contentTemplate>
|
||||
<ng-content></ng-content>
|
||||
@if (showErrors) {
|
||||
@if (showErrors && hasError) {
|
||||
<ng-container>
|
||||
<p-message severity="error" size="small" variant="simple" class="formHint">
|
||||
{{ errors[0] }}
|
||||
</p-message>
|
||||
</ng-container>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
@@ -14,7 +14,7 @@ type PSize = 'small' | 'normal' | 'large';
|
||||
templateUrl: './uikit-field.component.html',
|
||||
})
|
||||
export class UikitFieldComponent {
|
||||
@Input() label!: string;
|
||||
@Input() label: string = '';
|
||||
@Input() name!: string;
|
||||
@Input() pSize: PSize = 'normal';
|
||||
@Input() className?: string;
|
||||
@@ -22,9 +22,12 @@ export class UikitFieldComponent {
|
||||
// accept a FormControl or AbstractControl to display errors for
|
||||
@Input() control?: AbstractControl | null;
|
||||
|
||||
@Input() showErrors: boolean = true;
|
||||
@Input() showLabel: boolean = true;
|
||||
|
||||
private errorsService = inject(FormErrorsService);
|
||||
|
||||
get showErrors(): boolean {
|
||||
get hasError(): boolean {
|
||||
if (!this.control) return !!this.invalid;
|
||||
return !!(this.control.invalid && (this.control.touched || this.control.dirty));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user