feat: add new form field components for company details and consumer management
- Implemented CompanyNameComponent, DescriptionComponent, DeviceIdComponent, EconomicCodeComponent, EmailComponent, FirstNameComponent, FiscalCodeComponent, GuildIdComponent, LastNameComponent, LegalNameComponent, LicenseStartsAtComponent, MobileComponent, MobileNumberComponent, ModelComponent, NameComponent, NationalCodeComponent, NationalIdComponent, PartnerTokenComponent, PosTypeComponent, PostalCodeComponent, ProviderIdComponent, QuantityComponent, RegistrationCodeComponent, RegistrationNumberComponent, SerialNumberComponent, SetOffComponent, SkuComponent, TerminalComponent, UnitPriceComponent, UsernameComponent. - Added field control configurations for new fields in the form. - Updated routing and branding configurations for TIS tenant. - Created consumer type models for handling individual and legal consumer data.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
[formControl]="control"
|
||||
[showClear]="showClear"
|
||||
[filter]="true"
|
||||
[name]="name || type"
|
||||
appendTo="body"
|
||||
/>
|
||||
</uikit-field>
|
||||
|
||||
@@ -15,6 +15,7 @@ import { EnumsService } from './services';
|
||||
})
|
||||
export class EnumSelectComponent extends AbstractSelectComponent<string, IApiEnumResponse[]> {
|
||||
@Input({ required: true }) type!: TEnumApi;
|
||||
@Input() name?: string;
|
||||
@Input() customLabel?: string;
|
||||
|
||||
private readonly service = inject(EnumsService);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
[formControl]="control"
|
||||
[showClear]="showClear"
|
||||
[filter]="true"
|
||||
[name]="name"
|
||||
appendTo="body"
|
||||
/>
|
||||
</uikit-field>
|
||||
|
||||
@@ -17,6 +17,7 @@ export class CatalogGuildSelectComponent extends AbstractSelectComponent<
|
||||
IListingResponse<ISummary>
|
||||
> {
|
||||
@Input() override showClear: boolean = false;
|
||||
@Input({ required: true }) name!: string;
|
||||
@Input() label: string = '';
|
||||
private readonly service = inject(CatalogsService);
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
<p-dialog
|
||||
<shared-dialog
|
||||
[header]="dialogHeader"
|
||||
[(visible)]="visible"
|
||||
[modal]="true"
|
||||
@@ -14,4 +14,4 @@
|
||||
|
||||
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="loading()" (onCancel)="close()" />
|
||||
</form>
|
||||
</p-dialog>
|
||||
</shared-dialog>
|
||||
|
||||
+3
-3
@@ -3,8 +3,8 @@ import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog';
|
||||
import { FormFooterActionsComponent } from '@/shared/components/formFooterActions/form-footer-actions.component';
|
||||
import { Component, EventEmitter, Output, input } from '@angular/core';
|
||||
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||
import { Dialog } from 'primeng/dialog';
|
||||
import { SharedPasswordInputComponent } from '../passwordInput/password-input.component';
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
|
||||
export interface IChangePasswordSubmitPayload {
|
||||
password: string;
|
||||
@@ -14,7 +14,7 @@ export interface IChangePasswordSubmitPayload {
|
||||
@Component({
|
||||
selector: 'shared-change-password-form-dialog',
|
||||
templateUrl: './change-password-form-dialog.component.html',
|
||||
imports: [ReactiveFormsModule, Dialog, FormFooterActionsComponent, SharedPasswordInputComponent],
|
||||
imports: [ReactiveFormsModule, SharedDialogComponent, FormFooterActionsComponent, SharedPasswordInputComponent],
|
||||
})
|
||||
export class ChangePasswordFormDialogComponent extends AbstractDialog {
|
||||
title = input<string>('');
|
||||
@@ -35,7 +35,7 @@ export class ChangePasswordFormDialogComponent extends AbstractDialog {
|
||||
);
|
||||
|
||||
get dialogHeader() {
|
||||
return this.title() ? `تغییر گذرواژهی ${this.title()}` : 'تغییر گذرواژه';
|
||||
return this.title() ? `تغییر گذرواژه ${this.title()}` : 'تغییر گذرواژه';
|
||||
}
|
||||
|
||||
submit() {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { Dialog } from 'primeng/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'shared-dialog',
|
||||
template: `
|
||||
<p-dialog
|
||||
[header]="header"
|
||||
[(visible)]="visible"
|
||||
[modal]="modal"
|
||||
[style]="style"
|
||||
[closable]="closable"
|
||||
[draggable]="draggable"
|
||||
[breakpoints]="breakpoints"
|
||||
(onHide)="onHide.emit($event)"
|
||||
>
|
||||
<ng-content />
|
||||
</p-dialog>
|
||||
`,
|
||||
imports: [Dialog],
|
||||
})
|
||||
export class SharedDialogComponent {
|
||||
@Input() header = '';
|
||||
@Input() visible = false;
|
||||
@Output() visibleChange = new EventEmitter<boolean>();
|
||||
|
||||
@Input() modal = true;
|
||||
@Input() closable = true;
|
||||
@Input() draggable = false;
|
||||
@Input() style: Record<string, string> | undefined;
|
||||
@Input() breakpoints: Record<string, string> | undefined;
|
||||
|
||||
@Output() onHide = new EventEmitter<any>();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-address',
|
||||
template: `<app-input label="آدرس" [control]="control" [name]="name" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class AddressComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'address';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-branch-code',
|
||||
template: `<app-input label="کد شعبه" [control]="control" [name]="name" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class BranchCodeComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'branch_code';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-cash',
|
||||
template: `<app-input label="نقدی" [control]="control" [name]="name" type="price" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class CashComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'cash';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-code',
|
||||
template: `<app-input label="کد" [control]="control" [name]="name" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class CodeComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'code';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-company-name',
|
||||
template: `<app-input label="نام مجموعه" [control]="control" [name]="name" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class CompanyNameComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'company_name';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-description',
|
||||
template: `<app-input label="توضیحات" [control]="control" [name]="name" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class DescriptionComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'description';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { CatalogDeviceSelectComponent } from '@/shared/catalog/devices';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'field-device-id',
|
||||
template: `<catalog-device-select [control]="control" />`,
|
||||
imports: [ReactiveFormsModule, CatalogDeviceSelectComponent],
|
||||
})
|
||||
export class DeviceIdComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'device_id';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-economic-code',
|
||||
template: `<app-input label="کد اقتصادی" [control]="control" [name]="name" type="number" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class EconomicCodeComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'economic_code';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-email',
|
||||
template: `<app-input label="آدرس ایمیل" [control]="control" [name]="name" type="email" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class EmailComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'email';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-first-name',
|
||||
template: `<app-input label="نام" [control]="control" [name]="name" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class FirstNameComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'first_name';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-fiscal-code',
|
||||
template: `<app-input label="کد مالیاتی" [control]="control" [name]="name" type="number" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class FiscalCodeComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'fiscal_code';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { CatalogGuildSelectComponent } from '@/shared/catalog/guild/components/select.component';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'field-guild-id',
|
||||
template: `<catalog-guild-select label="صنف" [control]="control" [name]="name" />`,
|
||||
imports: [ReactiveFormsModule, CatalogGuildSelectComponent],
|
||||
})
|
||||
export class GuildIdComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'guild_id';
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
export * from './address.component';
|
||||
export * from './branch_code.component';
|
||||
export * from './cash.component';
|
||||
export * from './code.component';
|
||||
export * from './company_name.component';
|
||||
export * from './description.component';
|
||||
export * from './device_id.component';
|
||||
export * from './economic_code.component';
|
||||
export * from './email.component';
|
||||
export * from './first_name.component';
|
||||
export * from './fiscal_code.component';
|
||||
export * from './guild_id.component';
|
||||
export * from './last_name.component';
|
||||
export * from './legal_name.component';
|
||||
export * from './license_starts_at.component';
|
||||
export * from './mobile.component';
|
||||
export * from './mobile_number.component';
|
||||
export * from './model.component';
|
||||
export * from './name.component';
|
||||
export * from './national_code.component';
|
||||
export * from './national_id.component';
|
||||
export * from './partner_token.component';
|
||||
export * from './pos_type.component';
|
||||
export * from './postal_code.component';
|
||||
export * from './provider_id.component';
|
||||
export * from './quantity.component';
|
||||
export * from './registration_code.component';
|
||||
export * from './registration_number.component';
|
||||
export * from './serial_number.component';
|
||||
export * from './set_off.component';
|
||||
export * from './sku.component';
|
||||
export * from './terminal.component';
|
||||
export * from './unit_price.component';
|
||||
export * from './username.component';
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-last-name',
|
||||
template: `<app-input label="نام خانوادگی" [control]="control" [name]="name" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class LastNameComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'last_name';
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-legal-name',
|
||||
template: `<app-input [label]="label" [control]="control" [name]="name" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class LegalNameComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'name';
|
||||
@Input() label = 'نام شرکت';
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { UikitFlatpickrJalaliComponent } from '@/uikit';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'field-license-starts-at',
|
||||
template: `<uikit-datepicker
|
||||
label="تاریخ شروع لایسنس"
|
||||
[control]="control"
|
||||
[name]="name"
|
||||
hint="مدت زمان لایسنسها ۱ ساله هستند."
|
||||
/>`,
|
||||
imports: [ReactiveFormsModule, UikitFlatpickrJalaliComponent],
|
||||
})
|
||||
export class LicenseStartsAtComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'license_starts_at';
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-mobile',
|
||||
template: `<app-input
|
||||
label="شماره تلفن همراه"
|
||||
[control]="control"
|
||||
[name]="name"
|
||||
type="mobile"
|
||||
/>`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class MobileComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'mobile';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-mobile-number',
|
||||
template: `<app-input label="موبایل" [control]="control" [name]="name" type="mobile" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class MobileNumberComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'mobile_number';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-model',
|
||||
template: `<app-input label="مدل دستگاه" [control]="control" [name]="name" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class ModelComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'model';
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-name',
|
||||
template: `<app-input [label]="label" [control]="control" [name]="name" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class NameComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'name';
|
||||
@Input() label = 'عنوان';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-national-code',
|
||||
template: `<app-input label="کد ملی" [control]="control" [name]="name" type="nationalId" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class NationalCodeComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'national_code';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-national-id',
|
||||
template: `<app-input label="کد ملی" [control]="control" [name]="name" type="nationalId" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class NationalIdComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'national_id';
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-partner-token',
|
||||
template: `<app-input
|
||||
label="توکن پارتنر"
|
||||
[control]="control"
|
||||
[name]="name"
|
||||
[isLtrInput]="true"
|
||||
/>`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class PartnerTokenComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'partner_token';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { EnumSelectComponent } from '@/shared/apiEnum/select.component';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'field-pos-type',
|
||||
template: `<app-enum-select [control]="control" type="posType" [name]="name" />`,
|
||||
imports: [ReactiveFormsModule, EnumSelectComponent],
|
||||
})
|
||||
export class PosTypeComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'pos_type';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-postal-code',
|
||||
template: `<app-input label="کد پستی" [control]="control" [name]="name" type="postalCode" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class PostalCodeComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'postal_code';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { CatalogProviderSelectComponent } from '@/shared/catalog';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'field-provider-id',
|
||||
template: `<catalog-provider-select [control]="control" />`,
|
||||
imports: [ReactiveFormsModule, CatalogProviderSelectComponent],
|
||||
})
|
||||
export class ProviderIdComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'provider_id';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-quantity',
|
||||
template: `<app-input label="مقدار" [control]="control" [name]="name" type="number" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class QuantityComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'quantity';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-registration-code',
|
||||
template: `<app-input label="شناسه ملی" [control]="control" [name]="name" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class RegistrationCodeComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'registration_code';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-registration-number',
|
||||
template: `<app-input label="شماره ثبت" [control]="control" [name]="name" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class RegistrationNumberComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'registration_number';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-serial-number',
|
||||
template: `<app-input label="سریال دستگاه" [control]="control" [name]="name" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class SerialNumberComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'serial_number';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-set-off',
|
||||
template: `<app-input label="تهاتر" [control]="control" [name]="name" type="price" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class SetOffComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'set_off';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-sku',
|
||||
template: `<app-input label="شناسه عمومی" [control]="control" [name]="name" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class SkuComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'sku';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-terminal',
|
||||
template: `<app-input label="پرداخت با پایانه" [control]="control" [name]="name" type="price" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class TerminalComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'terminal';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-unit-price',
|
||||
template: `<app-input label="قیمت پایه" [control]="control" [name]="name" type="price" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class UnitPriceComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'unit_price';
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { InputComponent } from '../input/input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'field-username',
|
||||
template: `<app-input [label]="label" [control]="control" [name]="name" [isLtrInput]="true" />`,
|
||||
imports: [ReactiveFormsModule, InputComponent],
|
||||
})
|
||||
export class UsernameComponent {
|
||||
@Input({ required: true }) control = new FormControl<string>('');
|
||||
@Input() name = 'username';
|
||||
@Input() label = 'نام کاربری';
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
export * from './breadcrumb.component';
|
||||
export * from './card-data.component';
|
||||
export * from './changePasswordFormDialog/change-password-form-dialog.component';
|
||||
export * from './dialog/dialog.component';
|
||||
export * from './fields';
|
||||
export * from './inlineConfirmation/inline-confirmation.component';
|
||||
export * from './inlineEdit/inline-edit.component';
|
||||
export * from './input/input.component';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<p-password
|
||||
id="password1"
|
||||
name="password"
|
||||
formControlName="password"
|
||||
[formControl]="passwordControl"
|
||||
autocomplete="password"
|
||||
[toggleMask]="true"
|
||||
[fluid]="fluid"
|
||||
@@ -19,7 +19,7 @@
|
||||
<p-password
|
||||
id="confirmPassword"
|
||||
name="confirmPassword"
|
||||
formControlName="confirmPassword"
|
||||
[formControl]="confirmPasswordControl"
|
||||
autocomplete="new-password"
|
||||
[toggleMask]="true"
|
||||
[fluid]="fluid"
|
||||
|
||||
@@ -14,5 +14,5 @@ export class SharedPasswordInputComponent {
|
||||
@Input() hint: string =
|
||||
'رمز باید حداقل ۸ کاراکتر بوده و شامل حداقل یک حرف بزرگ، یک حرف کوچک، یک عدد و یک کاراکتر ویژه باشد.';
|
||||
@Input() fluid: boolean = true;
|
||||
@Input() size: 'small' | 'large' = 'small';
|
||||
@Input() size: 'small' | 'large' = 'large';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
import { fiscalCodeValidator, mobileValidator, postalCodeValidator } from '@/core/validators';
|
||||
import { nationalIdValidator } from '@/core/validators/national-id.validator';
|
||||
import { ValidatorFn, Validators } from '@angular/forms';
|
||||
|
||||
const required = () => [Validators.required] as ValidatorFn[];
|
||||
type ControlConfig = [string, ValidatorFn[]];
|
||||
|
||||
export const fieldControl = {
|
||||
name: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
code: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
description: (value = '', isRequired = false): ControlConfig => [value, isRequired ? required() : []],
|
||||
company_name: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
first_name: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
firstName: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
last_name: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
lastName: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
legal_name: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
registration_code: (value = '', isRequired = true): ControlConfig => [
|
||||
value,
|
||||
isRequired ? required() : [],
|
||||
],
|
||||
registration_number: (value = '', isRequired = true): ControlConfig => [
|
||||
value,
|
||||
isRequired ? required() : [],
|
||||
],
|
||||
mobile_number: (value = '', isRequired = true): ControlConfig => [
|
||||
value,
|
||||
isRequired ? [Validators.required, mobileValidator()] : [mobileValidator()],
|
||||
],
|
||||
mobile: (value = '', isRequired = true): ControlConfig => [
|
||||
value,
|
||||
isRequired ? [Validators.required, mobileValidator()] : [mobileValidator()],
|
||||
],
|
||||
email: (value = '', isRequired = false): ControlConfig => [
|
||||
value,
|
||||
isRequired ? [Validators.required, Validators.email] : [Validators.email],
|
||||
],
|
||||
national_code: (value = '', isRequired = true): ControlConfig => [
|
||||
value,
|
||||
isRequired ? [Validators.required, nationalIdValidator()] : [nationalIdValidator()],
|
||||
],
|
||||
national_id: (value = '', isRequired = true): ControlConfig => [
|
||||
value,
|
||||
isRequired ? [Validators.required, nationalIdValidator()] : [nationalIdValidator()],
|
||||
],
|
||||
postal_code: (value = '', isRequired = true): ControlConfig => [
|
||||
value,
|
||||
isRequired ? [Validators.required, postalCodeValidator()] : [postalCodeValidator()],
|
||||
],
|
||||
username: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
economic_code: (value = '', isRequired = true): ControlConfig => [
|
||||
value,
|
||||
isRequired ? required() : [],
|
||||
],
|
||||
fiscal_code: (value = '', isRequired = true): ControlConfig => [
|
||||
value,
|
||||
isRequired ? [Validators.required, fiscalCodeValidator()] : [fiscalCodeValidator()],
|
||||
],
|
||||
partner_token: (value = '', isRequired = true): ControlConfig => [
|
||||
value,
|
||||
isRequired ? required() : [],
|
||||
],
|
||||
guild_id: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
license_starts_at: (value = '', isRequired = true): ControlConfig => [
|
||||
value,
|
||||
isRequired ? required() : [],
|
||||
],
|
||||
branch_code: (value = '', isRequired = false): ControlConfig => [
|
||||
value,
|
||||
isRequired ? required() : [],
|
||||
],
|
||||
address: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
pos_type: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
type: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
role: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
unit_type: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
pricing_model: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
gender: (value = '', isRequired = false): ControlConfig => [value, isRequired ? required() : []],
|
||||
legal: (value = '', isRequired = false): ControlConfig => [value, isRequired ? required() : []],
|
||||
individual: (value = '', isRequired = false): ControlConfig => [
|
||||
value,
|
||||
isRequired ? required() : [],
|
||||
],
|
||||
partner_id: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
brand_id: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
category_id: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
starts_at: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
expires_at: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
activated_expires_at: (value = '', isRequired = true): ControlConfig => [
|
||||
value,
|
||||
isRequired ? required() : [],
|
||||
],
|
||||
invoiceDate: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
quantity: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
unit_price: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
cash: (value = '', isRequired = false): ControlConfig => [value, isRequired ? required() : []],
|
||||
set_off: (value = '', isRequired = false): ControlConfig => [value, isRequired ? required() : []],
|
||||
setOff: (value = '', isRequired = false): ControlConfig => [value, isRequired ? required() : []],
|
||||
terminal: (value = '', isRequired = false): ControlConfig => [value, isRequired ? required() : []],
|
||||
sku: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
model: (value = '', isRequired = true): ControlConfig => [value, isRequired ? required() : []],
|
||||
serial_number: (value = '', isRequired = false): ControlConfig => [
|
||||
value,
|
||||
isRequired ? required() : [],
|
||||
],
|
||||
device_id: (value = '', isRequired = false): ControlConfig => [
|
||||
value,
|
||||
isRequired ? required() : [],
|
||||
],
|
||||
provider_id: (value = '', isRequired = false): ControlConfig => [
|
||||
value,
|
||||
isRequired ? required() : [],
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
export * from './fields';
|
||||
@@ -0,0 +1,40 @@
|
||||
import { Maybe } from '@/core';
|
||||
|
||||
export interface IConsumerRawResponse {
|
||||
id: string;
|
||||
status: string;
|
||||
created_at: string;
|
||||
name: string;
|
||||
type: 'INDIVIDUAL' | 'LEGAL';
|
||||
partner: {
|
||||
id: string;
|
||||
name: string;
|
||||
code: string;
|
||||
};
|
||||
individual?: Maybe<IConsumerIndividual>;
|
||||
legal?: Maybe<IConsumerLegal>;
|
||||
}
|
||||
export interface IConsumerResponse extends IConsumerRawResponse {}
|
||||
|
||||
export interface IConsumerRequest {
|
||||
type?: 'INDIVIDUAL' | 'LEGAL';
|
||||
username?: string;
|
||||
password?: string;
|
||||
status?: string;
|
||||
customer?: {
|
||||
individual?: IConsumerIndividual;
|
||||
legal?: IConsumerLegal;
|
||||
};
|
||||
}
|
||||
|
||||
interface IConsumerIndividual {
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
mobile_number: string;
|
||||
national_code?: string;
|
||||
}
|
||||
|
||||
interface IConsumerLegal {
|
||||
name: string;
|
||||
registration_code?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user