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:
@@ -15,9 +15,11 @@
|
||||
(onEdit)="onEditClick($event)"
|
||||
(onRefresh)="refresh()"
|
||||
/>
|
||||
<partner-create-consumer-wrapper [(visible)]="visibleCreateForm" (onSubmit)="refresh()" />
|
||||
|
||||
<partner-consumer-form
|
||||
[(visible)]="visibleForm"
|
||||
[editMode]="editMode()"
|
||||
[editMode]="true"
|
||||
[consumerId]="selectedItemForEdit()?.id"
|
||||
[initialValues]="selectedItemForEdit() || undefined"
|
||||
(onSubmit)="refresh()"
|
||||
|
||||
@@ -1,39 +1,34 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { ConsumerUserFormComponent } from '../components/form.component';
|
||||
import { CreateConsumerWrapperComponent } from '../components/createConsumerWrapper/create-consumer-wrapper.component';
|
||||
import { ConsumerUserFormDialogComponent } from '../components/form-dialog.component';
|
||||
import { partnerConsumersNamedRoutes } from '../constants';
|
||||
import { IConsumerResponse } from '../models';
|
||||
import { IPartnerConsumerResponse } from '../models';
|
||||
import { ConsumersService } from '../services/main.service';
|
||||
|
||||
@Component({
|
||||
selector: 'partner-consumers',
|
||||
templateUrl: './list.component.html',
|
||||
imports: [PageDataListComponent, ConsumerUserFormComponent],
|
||||
imports: [
|
||||
PageDataListComponent,
|
||||
ConsumerUserFormDialogComponent,
|
||||
CreateConsumerWrapperComponent,
|
||||
],
|
||||
})
|
||||
export class ConsumersComponent extends AbstractList<IConsumerResponse> {
|
||||
export class ConsumersComponent extends AbstractList<IPartnerConsumerResponse> {
|
||||
private readonly service = inject(ConsumersService);
|
||||
private readonly router = inject(Router);
|
||||
visibleCreateForm = signal(false);
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'fullname', header: 'نام' },
|
||||
{ field: 'mobile_number', header: 'شماره موبایل' },
|
||||
{ field: 'national_code', header: 'کد ملی' },
|
||||
// { field: 'status', header: 'وضعیت' },
|
||||
// {
|
||||
// field: 'license_expires_at',
|
||||
// header: 'تاریخ انقضای لایسنس',
|
||||
// customDataModel(item) {
|
||||
// if (item.license_info) {
|
||||
// return formatJalali(item.license_info.expires_at);
|
||||
// }
|
||||
// return 'بدون لایسنس';
|
||||
// },
|
||||
// },
|
||||
{ field: 'name', header: 'نام' },
|
||||
{ field: 'business_counts', header: 'تعداد فعالیتهای اقتصادی فعال' },
|
||||
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
@@ -46,7 +41,11 @@ export class ConsumersComponent extends AbstractList<IConsumerResponse> {
|
||||
return this.service.getAll();
|
||||
}
|
||||
|
||||
toSinglePage(consumer: IConsumerResponse) {
|
||||
override openAddForm() {
|
||||
this.visibleCreateForm.set(true);
|
||||
}
|
||||
|
||||
toSinglePage(consumer: IPartnerConsumerResponse) {
|
||||
this.router.navigateByUrl(partnerConsumersNamedRoutes.consumer.meta.pagePath!(consumer.id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<ng-template #moreActions> </ng-template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<app-key-value label="نام مشتری" [value]="consumer()?.fullname" />
|
||||
<app-key-value label="شماره موبایل" [value]="consumer()?.mobile_number" />
|
||||
<app-key-value label="نام مشتری" [value]="consumer()?.name" />
|
||||
<app-key-value label="نوع مشتری" [value]="consumer()?.type" />
|
||||
<app-key-value label="وضعیت" [value]="consumer()?.status" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { BreadcrumbService } from '@/core/services';
|
||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||
import { getLicenseStatus } from '@/utils';
|
||||
import { Component, computed, effect, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ConsumerAccountListComponent } from '../components/accounts/list.component';
|
||||
import { ConsumerBusinessActivitiesComponent } from '../components/businessActivities/list.component';
|
||||
import { ConsumerUserFormComponent } from '../components/form.component';
|
||||
import { ConsumerUserFormDialogComponent } from '../components/form-dialog.component';
|
||||
import { ConsumerStore } from '../store/consumer.store';
|
||||
|
||||
@Component({
|
||||
@@ -14,7 +13,7 @@ import { ConsumerStore } from '../store/consumer.store';
|
||||
imports: [
|
||||
AppCardComponent,
|
||||
KeyValueComponent,
|
||||
ConsumerUserFormComponent,
|
||||
ConsumerUserFormDialogComponent,
|
||||
ConsumerAccountListComponent,
|
||||
ConsumerBusinessActivitiesComponent,
|
||||
],
|
||||
@@ -31,10 +30,6 @@ export class ConsumerComponent {
|
||||
|
||||
readonly loading = computed(() => this.store.loading());
|
||||
readonly consumer = computed(() => this.store.entity());
|
||||
readonly license = computed(() => this.store.entity()?.license_info);
|
||||
readonly licenseStatus = computed(() =>
|
||||
getLicenseStatus(this.store.entity()?.license_info?.expires_at),
|
||||
);
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
|
||||
Reference in New Issue
Block a user