update many things
This commit is contained in:
+5
-4
@@ -1,8 +1,9 @@
|
||||
<form [formGroup]="form" (submit)="submit()">
|
||||
<app-input [control]="form.controls.first_name" name="first_name" label="نام" />
|
||||
<app-input [control]="form.controls.last_name" name="last_name" label="نام خانوادگی" />
|
||||
<app-input [control]="form.controls.national_id" name="national_id" label="کد ملی" type="nationalId" />
|
||||
<app-input [control]="form.controls.economic_code" name="economic_code" label="کد اقتصادی" maxlength="11" />
|
||||
<field-first-name [control]="form.controls.first_name" />
|
||||
<field-last-name [control]="form.controls.last_name" />
|
||||
<field-mobile-number [control]="form.controls.mobile_number" />
|
||||
<field-national-id [control]="form.controls.national_id" />
|
||||
<field-economic-code [control]="form.controls.economic_code" />
|
||||
|
||||
<app-form-footer-actions submitLabel="ثبت مشتری و ادامه" (onCancel)="close()" (onSubmit)="submit()" />
|
||||
</form>
|
||||
|
||||
+26
-26
@@ -1,11 +1,16 @@
|
||||
import { postalCodeValidator } from '@/core/validators';
|
||||
import { nationalIdValidator } from '@/core/validators/national-id.validator';
|
||||
import { AbstractForm } from '@/shared/abstractClasses';
|
||||
import { InputComponent } from '@/shared/components';
|
||||
import {
|
||||
EconomicCodeComponent,
|
||||
FirstNameComponent,
|
||||
LastNameComponent,
|
||||
MobileNumberComponent,
|
||||
NationalIdComponent,
|
||||
} from '@/shared/components';
|
||||
import { FormFooterActionsComponent } from '@/shared/components/formFooterActions/form-footer-actions.component';
|
||||
import { fieldControl } from '@/shared/constants';
|
||||
import { CustomerType } from '@/shared/localEnum/constants/customerTypes';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { ReactiveFormsModule, Validators } from '@angular/forms';
|
||||
import { Component, computed, inject } from '@angular/core';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { Observable } from 'rxjs';
|
||||
import { IIndividualCustomer } from '../../../models/customer';
|
||||
import { PosLandingStore } from '../../../store/main.store';
|
||||
@@ -13,36 +18,31 @@ import { PosLandingStore } from '../../../store/main.store';
|
||||
@Component({
|
||||
selector: 'pos-customer-individual-form',
|
||||
templateUrl: './form.component.html',
|
||||
imports: [ReactiveFormsModule, InputComponent, FormFooterActionsComponent],
|
||||
imports: [
|
||||
ReactiveFormsModule,
|
||||
FormFooterActionsComponent,
|
||||
FirstNameComponent,
|
||||
LastNameComponent,
|
||||
NationalIdComponent,
|
||||
EconomicCodeComponent,
|
||||
MobileNumberComponent,
|
||||
],
|
||||
})
|
||||
export class CustomerIndividualFormComponent extends AbstractForm<
|
||||
IIndividualCustomer,
|
||||
IIndividualCustomer
|
||||
> {
|
||||
private readonly store = inject(PosLandingStore);
|
||||
costumerInfo = computed(() => this.store.customer().info?.customer_individual);
|
||||
|
||||
override showSuccessMessage = false;
|
||||
form = this.fb.group({
|
||||
first_name: [
|
||||
this.store.customer().info?.customer_individual?.first_name || '',
|
||||
[Validators.required],
|
||||
],
|
||||
last_name: [
|
||||
this.store.customer().info?.customer_individual?.last_name || '',
|
||||
[Validators.required],
|
||||
],
|
||||
national_id: [
|
||||
this.store.customer().info?.customer_individual?.national_id || '',
|
||||
[Validators.required, nationalIdValidator()],
|
||||
],
|
||||
economic_code: [
|
||||
this.store.customer().info?.customer_individual?.economic_code || '',
|
||||
[Validators.required],
|
||||
],
|
||||
postal_code: [
|
||||
this.store.customer().info?.customer_individual?.postal_code || '',
|
||||
[postalCodeValidator()],
|
||||
],
|
||||
first_name: fieldControl.first_name(this.costumerInfo()?.first_name || ''),
|
||||
last_name: fieldControl.last_name(this.costumerInfo()?.last_name || ''),
|
||||
national_id: fieldControl.national_id(this.costumerInfo()?.national_id || ''),
|
||||
postal_code: fieldControl.postal_code(this.costumerInfo()?.postal_code || ''),
|
||||
economic_code: fieldControl.economic_code(this.costumerInfo()?.economic_code || ''),
|
||||
mobile_number: fieldControl.mobile_number(this.costumerInfo()?.mobile_number || ''),
|
||||
});
|
||||
|
||||
override submitForm() {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<form [formGroup]="form" (submit)="submit()">
|
||||
<app-input [control]="form.controls.name" name="name" label="نام مشتری" />
|
||||
<app-input [control]="form.controls.national_id" name="national_id" label="شماره ملی" type="nationalId" />
|
||||
<app-input [control]="form.controls.name" name="name" label="نام" />
|
||||
<app-form-footer-actions submitLabel="ثبت بدون اطلاعات خریدار و ادامه" (onCancel)="close()" />
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user