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,9 +20,19 @@ export class ConsumerAccountsComponent extends AbstractList<IAccountResponse> {
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'username', header: 'نام کاربری', type: 'nested', nestedPath: 'account.username' },
|
||||
{
|
||||
field: 'username',
|
||||
header: 'نام کاربری',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'account.username' },
|
||||
},
|
||||
{ field: 'role', header: 'نقش' },
|
||||
{ field: 'status', header: 'وضعیت', type: 'nested', nestedPath: 'account.status' },
|
||||
{
|
||||
field: 'status',
|
||||
header: 'وضعیت',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'account.status' },
|
||||
},
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ export class ConsumerComplexListComponent extends AbstractList<IComplexResponse>
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'branch_code', header: 'کد شعبه' },
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
|
||||
+6
-1
@@ -23,7 +23,12 @@ export class ConsumerComplexGoodsListComponent extends AbstractList<IConsumerCom
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'sku', header: 'شناسهی عمومی' },
|
||||
{ field: 'category', header: 'دستهبندی', type: 'nested', nestedPath: 'category.name' },
|
||||
{
|
||||
field: 'category',
|
||||
header: 'دستهبندی',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'category.name' },
|
||||
},
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
|
||||
@@ -21,7 +21,24 @@ export class ConsumerBusinessActivityListComponent extends AbstractList<IBusines
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'guild', header: 'صنف', type: 'nested', nestedPath: 'guild.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: 'تاریخ ایجاد',
|
||||
|
||||
@@ -5,6 +5,8 @@ export interface IBusinessActivityRawResponse {
|
||||
name: string;
|
||||
economic_code: string;
|
||||
guild: ISummary;
|
||||
created_at: string;
|
||||
license_info: LicenseInfo;
|
||||
}
|
||||
export interface IBusinessActivityResponse extends IBusinessActivityRawResponse {}
|
||||
|
||||
@@ -12,3 +14,10 @@ export interface IBusinessActivityRequest {
|
||||
economic_code: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface LicenseInfo {
|
||||
id: string;
|
||||
starts_at: string;
|
||||
expires_at: string;
|
||||
accounts_limit: number;
|
||||
}
|
||||
|
||||
+1
@@ -3,6 +3,7 @@
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<app-key-value label="عنوان" [value]="complex()?.name" />
|
||||
<app-key-value label="کد شعبه" [value]="complex()?.branch_code" />
|
||||
<app-key-value label="آدرس" [value]="complex()?.address" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ export class ConsumerCustomerSaleInvoiceListComponent extends AbstractList<ICust
|
||||
field: 'account',
|
||||
header: 'ایجاد شده توسط',
|
||||
type: 'nested',
|
||||
nestedPath: 'account.account.username',
|
||||
nestedOption: { path: 'account.account.username' },
|
||||
},
|
||||
{
|
||||
field: 'invoice_date',
|
||||
|
||||
@@ -39,13 +39,13 @@ export class ConsumerPosListComponent extends AbstractList<IPosResponse> {
|
||||
field: 'complex.business_activity',
|
||||
header: 'عنوان کسب و کار',
|
||||
type: 'nested',
|
||||
nestedPath: 'complex.business_activity.name',
|
||||
nestedOption: { path: 'complex.business_activity.name' },
|
||||
},
|
||||
{
|
||||
field: 'complex',
|
||||
header: 'عنوان شعبه',
|
||||
type: 'nested',
|
||||
nestedPath: 'complex.name',
|
||||
nestedOption: { path: 'complex.name' },
|
||||
},
|
||||
{
|
||||
field: 'customAction',
|
||||
|
||||
@@ -35,7 +35,7 @@ export class ConsumerSaleInvoiceListComponent extends AbstractList<IConsumerSale
|
||||
field: 'account',
|
||||
header: 'ایجاد شده توسط',
|
||||
type: 'nested',
|
||||
nestedPath: 'account.account.username',
|
||||
nestedOption: { path: 'account.account.username' },
|
||||
},
|
||||
{
|
||||
field: 'invoice_date',
|
||||
|
||||
Reference in New Issue
Block a user