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:
@@ -1,14 +1,10 @@
|
||||
<app-page-data-list
|
||||
pageTitle="مدیریت مشتریان"
|
||||
[addNewCtaLabel]="'افزودن مشتری جدید'"
|
||||
[columns]="columns"
|
||||
[showAdd]="true"
|
||||
emptyPlaceholderTitle="مشتریای یافت نشد"
|
||||
emptyPlaceholderDescription="برای افزودن مشتری جدید، روی دکمهٔ بالا کلیک کنید."
|
||||
[items]="items()"
|
||||
[loading]="loading()"
|
||||
[showDetails]="true"
|
||||
[showAdd]="true"
|
||||
[showEdit]="true"
|
||||
(onAdd)="openAddForm()"
|
||||
(onDetails)="toSinglePage($event)"
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { formatJalali } from '@/utils';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { ConsumerUserFormComponent } from '../components/form.component';
|
||||
import { superAdminConsumersNamedRoutes } from '../constants';
|
||||
import { IConsumerResponse } from '../models';
|
||||
import { IAdminConsumerResponse } from '../models';
|
||||
import { ConsumersService } from '../services/main.service';
|
||||
|
||||
@Component({
|
||||
@@ -14,26 +13,32 @@ import { ConsumersService } from '../services/main.service';
|
||||
templateUrl: './list.component.html',
|
||||
imports: [PageDataListComponent, ConsumerUserFormComponent],
|
||||
})
|
||||
export class ConsumersComponent extends AbstractList<IConsumerResponse> {
|
||||
export class ConsumersComponent extends AbstractList<IAdminConsumerResponse> {
|
||||
private readonly service = inject(ConsumersService);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'fullname', header: 'نام' },
|
||||
{ field: 'mobile_number', header: 'شماره موبایل' },
|
||||
{ field: 'status', header: 'وضعیت' },
|
||||
{ field: 'name', header: 'نام' },
|
||||
{ field: 'business_counts', header: 'تعداد فعالیتهای اقتصادی' },
|
||||
{
|
||||
field: 'license_expires_at',
|
||||
header: 'تاریخ انقضای لایسنس',
|
||||
customDataModel(item) {
|
||||
if (item.license_info) {
|
||||
return formatJalali(item.license_info.expires_at);
|
||||
}
|
||||
return 'بدون لایسنس';
|
||||
},
|
||||
field: 'partner',
|
||||
header: 'ایجاد شده توسط',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'partner.name' },
|
||||
},
|
||||
{ field: 'status', header: 'وضعیت' },
|
||||
// {
|
||||
// field: 'license_expires_at',
|
||||
// header: 'تاریخ انقضای لایسنس',
|
||||
// customDataModel(item) {
|
||||
// if (item.license_info) {
|
||||
// return formatJalali(item.license_info.expires_at);
|
||||
// }
|
||||
// return 'بدون لایسنس';
|
||||
// },
|
||||
// },
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
@@ -46,7 +51,7 @@ export class ConsumersComponent extends AbstractList<IConsumerResponse> {
|
||||
return this.service.getAll();
|
||||
}
|
||||
|
||||
toSinglePage(consumer: IConsumerResponse) {
|
||||
toSinglePage(consumer: IAdminConsumerResponse) {
|
||||
this.router.navigateByUrl(superAdminConsumersNamedRoutes.consumer.meta.pagePath!(consumer.id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,28 +3,9 @@
|
||||
<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" />
|
||||
@if (licenseStatus() === "EXPIRED") {
|
||||
<app-key-value label="وضعیت لایسنس">
|
||||
<p-button size="small" outlined severity="warn" (onClick)="openLicenseForm()">
|
||||
منقضی شده در <span [jalaliDate]="license()!.expires_at"></span>
|
||||
</p-button>
|
||||
</app-key-value>
|
||||
<app-key-value label="ارایه شده توسط" [value]="license()?.partner?.name || 'برند نرمافزار'" />
|
||||
} @else if (licenseStatus() === "ACTIVE") {
|
||||
<app-key-value label="وضعیت لایسنس">
|
||||
<p-button size="small" outlined severity="success" (onClick)="openLicenseForm()">
|
||||
تا تاریخ <span [jalaliDate]="license()!.expires_at"></span>
|
||||
</p-button>
|
||||
</app-key-value>
|
||||
<!-- <app-key-value label="ارایه شده توسط" [value]="license()?.partner?.name || 'برند نرمافزار'" /> -->
|
||||
} @else {
|
||||
<app-key-value label="وضعیت لایسنس">
|
||||
<p-button size="small" outlined severity="danger" (onClick)="openLicenseForm()"> ارایه نشده </p-button>
|
||||
</app-key-value>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</app-card-data>
|
||||
@@ -39,13 +20,4 @@
|
||||
[initialValues]="consumer() || undefined"
|
||||
(onSubmit)="getData()"
|
||||
/>
|
||||
|
||||
<superAdmin-consumer-license-form
|
||||
[(visible)]="visibleLicenseForm"
|
||||
[editMode]="!!license()?.id"
|
||||
[consumerId]="consumerId()"
|
||||
[licenseId]="license()?.id"
|
||||
[initialValues]="license() || undefined"
|
||||
(onSubmit)="getData()"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
import { BreadcrumbService } from '@/core/services';
|
||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||
import { JalaliDateDirective } from '@/shared/directives';
|
||||
import { getLicenseStatus } from '@/utils';
|
||||
import { Component, computed, effect, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Button } from 'primeng/button';
|
||||
import { ConsumerAccountListComponent } from '../components/accounts/list.component';
|
||||
import { ConsumerBusinessActivitiesComponent } from '../components/businessActivities/list.component';
|
||||
import { ConsumerUserFormComponent } from '../components/form.component';
|
||||
import { ConsumerLicenseFormComponent } from '../components/licenses/form.component';
|
||||
import { ConsumerStore } from '../store/consumer.store';
|
||||
|
||||
@Component({
|
||||
@@ -20,9 +16,6 @@ import { ConsumerStore } from '../store/consumer.store';
|
||||
ConsumerUserFormComponent,
|
||||
ConsumerAccountListComponent,
|
||||
ConsumerBusinessActivitiesComponent,
|
||||
Button,
|
||||
JalaliDateDirective,
|
||||
ConsumerLicenseFormComponent,
|
||||
],
|
||||
})
|
||||
export class ConsumerComponent {
|
||||
@@ -37,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