Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'abstract-field',
|
||||
template: '',
|
||||
imports: [ReactiveFormsModule],
|
||||
})
|
||||
export abstract class AbstractFieldComponent<T = string> {
|
||||
@Input({ required: true }) control!: FormControl<T>;
|
||||
@Input({ required: true }) name!: string;
|
||||
@Input({ required: true }) label!: string;
|
||||
}
|
||||
@@ -10,6 +10,7 @@ export * from './email.component';
|
||||
export * from './first_name.component';
|
||||
export * from './fiscal_id.component';
|
||||
export * from './guild_id.component';
|
||||
export * from './invoice_templates.component';
|
||||
export * from './last_name.component';
|
||||
export * from './legal_name.component';
|
||||
export * from './license_starts_at.component';
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { EnumSelectComponent } from '@/shared/apiEnum/select.component';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'field-invoice-templates',
|
||||
template: `<app-enum-select
|
||||
type="invoice_template_type"
|
||||
[customLabel]="label"
|
||||
[control]="control"
|
||||
[name]="name"
|
||||
/>`,
|
||||
imports: [ReactiveFormsModule, EnumSelectComponent],
|
||||
})
|
||||
export class FieldInvoiceTemplatesComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'invoice-template';
|
||||
@Input() label = 'قالب فاکتور';
|
||||
}
|
||||
Reference in New Issue
Block a user