Refactor nested column definitions and improve license info handling
- Updated column definitions in various components to use `nestedOption` instead of `nestedPath` for better clarity and consistency. - Removed commented-out license status checks and related UI elements from the layout component. - Simplified license info interface by removing unnecessary properties. - Enhanced consumer accounts and business activities components to display additional license information. - Adjusted form components to conditionally include fields based on selected device type. - Improved the handling of discount calculations in the gold payload form component. - Added new fields for branch code in complex components and adjusted related views. - Cleaned up unused console logs in form data utility.
This commit is contained in:
@@ -20,17 +20,17 @@ export class ConsumerAccountListComponent extends AbstractList<IConsumerAccountR
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
{
|
||||
field: 'username',
|
||||
field: 'account',
|
||||
header: 'نام کاربری',
|
||||
type: 'nested',
|
||||
nestedPath: 'account.username',
|
||||
nestedOption: { path: 'account.username' },
|
||||
},
|
||||
{ field: 'role', header: 'نوع حساب' },
|
||||
{
|
||||
field: 'status',
|
||||
header: 'وضعیت',
|
||||
type: 'nested',
|
||||
nestedPath: 'account.status',
|
||||
nestedOption: { path: 'account.status' },
|
||||
},
|
||||
{
|
||||
field: 'created_at',
|
||||
|
||||
+18
-1
@@ -22,7 +22,24 @@ export class ConsumerBusinessActivitiesComponent extends AbstractList<IBusinessA
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'guild', header: 'صنف', type: 'nested', nestedPath: 'name' },
|
||||
{ field: 'guild', header: 'صنف', type: 'nested', nestedOption: { path: 'guild.name' } },
|
||||
{
|
||||
field: 'license_info',
|
||||
header: 'محدودیت کاربر',
|
||||
customDataModel(item) {
|
||||
const licenseInfo = (item as IBusinessActivityResponse).license_info;
|
||||
if (!licenseInfo) {
|
||||
return 'بدون مجوز';
|
||||
}
|
||||
return `${licenseInfo.accounts_limit} کاربر`;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'license_info',
|
||||
header: 'انقضای مجوز',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'license_info.expires_at', type: 'date' },
|
||||
},
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
>
|
||||
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
|
||||
<app-input label="عنوان" [control]="form.controls.name" name="name" />
|
||||
<app-input label="سریال دستگاه" [control]="form.controls.serial" name="serial" />
|
||||
<!-- <app-input label="مدل دستگاه" [control]="form.controls.model" name="model" /> -->
|
||||
<app-enum-select [control]="form.controls.pos_type" type="posType" name="pos_type" />
|
||||
@if (form.controls.pos_type.value === "PSP") {
|
||||
<app-input label="سریال دستگاه" [control]="form.controls.serial" name="serial" />
|
||||
<catalog-device-select [control]="form.controls.device_id" />
|
||||
<catalog-provider-select [control]="form.controls.provider_id" />
|
||||
}
|
||||
|
||||
@@ -43,6 +43,13 @@ export class ConsumerPosFormComponent extends AbstractFormDialog<IPosRequest, IP
|
||||
});
|
||||
form.controls.pos_type.valueChanges.subscribe((value) => {
|
||||
if (value === 'PSP') {
|
||||
form.addControl(
|
||||
'serial',
|
||||
this.fb.control<string>(this.initialValues?.serial ?? '', {
|
||||
nonNullable: true,
|
||||
validators: [Validators.required],
|
||||
}),
|
||||
);
|
||||
form.addControl(
|
||||
'device_id',
|
||||
this.fb.control<string>(this.initialValues?.device?.id ?? '', {
|
||||
@@ -58,6 +65,8 @@ export class ConsumerPosFormComponent extends AbstractFormDialog<IPosRequest, IP
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
// @ts-ignore
|
||||
form.removeControl('serial');
|
||||
// @ts-ignore
|
||||
form.removeControl('device_id');
|
||||
// @ts-ignore
|
||||
|
||||
@@ -24,10 +24,15 @@ export class ConsumerPosesComponent extends AbstractList<IPosResponse> {
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'serial', header: 'شماره سریال' },
|
||||
{ field: 'device', header: 'دستگاه', type: 'nested', nestedPath: 'device.name' },
|
||||
{ field: 'serial_number', header: 'شماره سریال' },
|
||||
{ field: 'device', header: 'دستگاه', type: 'nested', nestedOption: { path: 'device.name' } },
|
||||
{ field: 'pos_type', header: 'نوع دستگاه' },
|
||||
{ field: 'provider', header: 'ارایهدهنده', type: 'nested', nestedPath: 'provider.name' },
|
||||
{
|
||||
field: 'provider',
|
||||
header: 'ارایهدهنده',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'provider.name' },
|
||||
},
|
||||
{ field: 'status', header: 'وضعیت' },
|
||||
{
|
||||
field: 'created_at',
|
||||
|
||||
Reference in New Issue
Block a user