feat: add stock keeping units list component and related services

feat: implement checkbox component with label and hint support

feat: create sale invoice full response model for invoice details

feat: add single view component for displaying sale invoice details

feat: define various list configurations for account, business activity, and consumer management

feat: establish list configurations for managing devices, goods, and licenses

feat: create list configurations for managing partners and their accounts

feat: implement user management list configuration
This commit is contained in:
2026-05-12 19:58:53 +03:30
parent fecdf4a06b
commit 561aca32d3
104 changed files with 1611 additions and 678 deletions
@@ -36,7 +36,7 @@ export abstract class AbstractForm<
return payload;
}
ngOnInit() {
ngAfterViewInit() {
this.form.reset(this.initialValues ?? this.defaultValues);
// Object.entries(this.form.controls).forEach(([key, control]) => {
// console.log(key, control);
+13 -2
View File
@@ -1,6 +1,6 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { Observable, shareReplay } from 'rxjs';
import { ENUMS_API_ROUTES } from './constants/apiRoutes';
import { TEnumApi } from './models';
import { IApiEnumResponse } from './models/io';
@@ -10,8 +10,19 @@ export class EnumsService {
constructor(private http: HttpClient) {}
private apiRoutes = ENUMS_API_ROUTES;
private readonly cache = new Map<TEnumApi, Observable<IApiEnumResponse[]>>();
getAll(type: TEnumApi): Observable<IApiEnumResponse[]> {
return this.http.get<IApiEnumResponse[]>(this.apiRoutes[type]);
const cached = this.cache.get(type);
if (cached) {
return cached;
}
const request$ = this.http
.get<IApiEnumResponse[]>(this.apiRoutes[type])
.pipe(shareReplay({ bufferSize: 1, refCount: true }));
this.cache.set(type, request$);
return request$;
}
}
@@ -4,6 +4,7 @@ import { UikitFieldComponent, UikitLabelComponent } from '@/uikit';
import { formatWithCurrency } from '@/utils';
import { CommonModule } from '@angular/common';
import {
ChangeDetectionStrategy,
Component,
ContentChild,
DestroyRef,
@@ -31,6 +32,7 @@ interface IAmountPercentageInputSelect {
@Component({
selector: 'app-amount-percentage-input',
templateUrl: './amount-percentage-input.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [
UikitFieldComponent,
InputGroup,
@@ -175,10 +177,10 @@ export class AmountPercentageInputComponent {
}
ngOnInit() {
const isPercentageType = this.selectedType.value === 'percentage';
this.modifyControlsData(
isPercentageType ? this.percentageControl.value : this.amountControl.value,
);
const amountValue = Number(this.amountControl.value || 0);
const percentageValue = Number(this.percentageControl.value || 0);
const isPercentageType = percentageValue > 0 && amountValue <= 0;
this.preparedLabel.set(this.prepareLabel(isPercentageType));
this.selectedType.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => {
this.preparedLabel.set(this.prepareLabel(value === 'percentage'));
@@ -186,9 +188,9 @@ export class AmountPercentageInputComponent {
}
ngOnChanges() {
const isPercentageType = this.selectedType.value === 'percentage';
this.modifyControlsData(
isPercentageType ? this.percentageControl.value : this.amountControl.value,
);
const amountValue = Number(this.amountControl.value || 0);
const percentageValue = Number(this.percentageControl.value || 0);
const isPercentageType = percentageValue > 0 && amountValue <= 0;
this.preparedLabel.set(this.prepareLabel(isPercentageType));
}
}
@@ -0,0 +1,10 @@
<div class="flex flex-col gap-2">
<div class="flex items-center gap-3">
<p-checkBox [formControl]="control" [name]="name" [id]="name" binary class="shrink-0"> </p-checkBox>
<uikit-label [name]="name"> {{ label }} </uikit-label>
</div>
@if (hint) {
<small [attr.id]="name + '-help'" class="text-muted-color">{{ hint }}</small>
}
</div>
@@ -0,0 +1,20 @@
import { Maybe } from '@/core';
import { UikitLabelComponent } from '@/uikit';
import { Component, Input } from '@angular/core';
import { FormControl } from '@angular/forms';
import { Checkbox } from 'primeng/checkbox';
@Component({
selector: 'app-checkbox',
templateUrl: 'checkbox.component.html',
imports: [Checkbox, UikitLabelComponent],
})
export class AppCheckboxComponent {
@Input({ required: true }) control!: FormControl<Maybe<any>>;
@Input({ required: true }) name!: string;
@Input({ required: true }) label!: string;
@Input() disabled = false;
@Input() size?: 'small' | 'large';
@Input() showErrors = true;
@Input() hint?: string;
}
@@ -0,0 +1,73 @@
import ISummary from '@/core/models/summary';
import { TspProviderResponseStatus } from '@/shared/catalog';
import { IEnumTranslate } from '@/shared/models/enum_translate.type';
export interface ISaleInvoiceFullRawResponse {
id: string;
code: string;
total_amount: string;
invoice_date: string;
consumer_account: ConsumerAccount;
pos: Pos;
payments: Payment[];
items: Item[];
created_at: string;
notes?: string;
customer?: Customer;
unknown_customer?: UnknownCustomer;
status: IEnumTranslate<TspProviderResponseStatus>;
}
export interface ISaleInvoiceFullResponse extends ISaleInvoiceFullRawResponse {}
interface Item {
id: string;
good: ISummary;
}
interface Payment {
amount: string;
payment_method: string;
}
interface Customer {
id: string;
type: string;
legal?: CustomerLegal;
individual?: CustomerIndividual;
}
interface CustomerIndividual {
first_name: string;
last_name: string;
national_id: string;
postal_code: string;
economic_code: string;
}
interface CustomerLegal {
company_name: string;
registration_number: string;
postal_code: string;
economic_code: string;
}
interface Pos extends ISummary {
complex: Complex;
}
interface Complex extends ISummary {
business_activity: ISummary;
}
interface ConsumerAccount {
role: string;
account: {
username: string;
};
}
interface UnknownCustomer {
name?: string;
national_code?: string;
}
@@ -0,0 +1,106 @@
@if (loading) {
<shared-page-loading />
} @else if (!invoice) {
<uikit-empty-state> </uikit-empty-state>
} @else {
<div class="flex flex-col gap-6">
<app-card-data cardTitle="اطلاعات فاکتور" [editable]="false" [backRoute]="backRoute">
<ng-template #moreActions>
<button
pButton
type="button"
label="چاپ"
icon="pi pi-print"
outlined
size="small"
(click)="printInvoice()"
></button>
</ng-template>
<div class="flex flex-col gap-4">
<div class="listKeyValue">
<app-key-value label="کد رهگیری" [value]="invoice.code" />
<app-key-value label="تاریخ فاکتور" [value]="invoice.invoice_date" type="dateTime" />
<app-key-value label="تاریخ ایجاد فاکتور" [value]="invoice.created_at" type="dateTime" />
<app-key-value label="وضعیت صدور به سامانه‌ی مودیان">
<catalog-tax-provider-status-tag [status]="invoice.status.value" [translate]="invoice.status.translate" />
</app-key-value>
<div class="col-span-full">
<app-key-value label="توضیحات" [value]="invoice.notes" />
</div>
</div>
<p-divider align="center"> اطلاعات پرداخت </p-divider>
<div class="grid md:grid-cols-3 sm:grid-cols-2 sm:gap-4 gap-3 items-center">
<app-key-value label="مجموع قابل پرداخت" [value]="invoice.total_amount" type="price" />
@for (payment of invoice.payments; track $index) {
<app-key-value
[label]="`${payment.payment_method === 'SET_OF' ? 'تهاتر' : payment.payment_method === 'TERMINAL' ? 'پایانه' : 'نقدی'}`"
[value]="payment.amount"
type="price"
/>
}
</div>
<p-divider align="center"> اطلاعات صادر کننده </p-divider>
<div class="listKeyValue">
<app-key-value label="کسب و کار" [value]="invoice.pos!.complex.business_activity.name" />
<app-key-value label="مجموعه" [value]="invoice.pos!.complex.name" />
<app-key-value label="پایانه فروش" [value]="invoice.pos!.name" />
<app-key-value label="ایجاد کننده" [value]="invoice.consumer_account.account.username" />
</div>
@if (variant !== "customer") {
<p-divider align="center"> اطلاعات مشتری </p-divider>
@if (invoice.customer) {
<div class="listKeyValue">
@if (invoice.customer.type === "INDIVIDUAL") {
<app-key-value label="نوع مشتری" value="حقیقی" />
<app-key-value label="نام" [value]="invoice.customer.individual?.first_name" />
<app-key-value label="نام خانوادگی" [value]="invoice.customer.individual?.last_name" />
<app-key-value label="کد اقتصادی" [value]="invoice.customer.individual?.economic_code" />
<app-key-value label="کد ملی" [value]="invoice.customer.individual?.national_id" />
<app-key-value label="کد پستی" [value]="invoice.customer.individual?.postal_code" />
} @else {
<app-key-value label="نوع مشتری" value="حقوقی" />
<app-key-value label="نام شرکت" [value]="invoice.customer.legal?.company_name" />
<app-key-value label="کد اقتصادی" [value]="invoice.customer.legal?.economic_code" />
<app-key-value label="کد ثبتی" [value]="invoice.customer.legal?.registration_number" />
<app-key-value label="کد پستی" [value]="invoice.customer.legal?.postal_code" />
}
</div>
} @else if (invoice.unknown_customer) {
<div class="listKeyValue">
<app-key-value label="نوع مشتری" value="نوع دوم" />
<app-key-value label="عنوان" [value]="invoice.unknown_customer.name" />
<app-key-value label="کد ثبتی" [value]="invoice.unknown_customer.national_code" />
</div>
} @else {
<p class="text-center text-text-color pt-3 pb-5">اطلاعات مشتری ثبت نشده است.</p>
}
}
</div>
</app-card-data>
<app-card-data cardTitle="کالاهای خریداری شده" [editable]="false">
<app-page-data-list
[columns]="columns"
[expandColumns]="expandableColumns"
[expandable]="true"
expandableItemKey="payload"
[items]="invoice.items"
[loading]="loading"
pageTitle=""
[showRefresh]="false"
>
<ng-template #totalAmount let-item>
@if (!item.discount_amount) {
<span [appPriceMask]="item.total_amount"></span>
} @else {
<!-- <div class="flex flex-col items-end">
<span class="line-through text-muted-color text-xs" [appPriceMask]="item.total_amount"></span>
<span [appPriceMask]="item.total_amount - item.discount_amount"></span>
</div> -->
}
</ng-template>
</app-page-data-list>
</app-card-data>
</div>
}
@@ -0,0 +1,202 @@
import { Maybe } from '@/core';
import { NativeBridgeService } from '@/core/services';
import { PosInfoStore } from '@/domains/pos/store';
import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog';
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
import { ISaleInvoiceFullResponse } from '@/shared/components/invoices/sale-invoice-full-response.model';
import { PageLoadingComponent } from '@/shared/components/page-loading.component';
import {
IColumn,
PageDataListComponent,
} from '@/shared/components/pageDataList/page-data-list.component';
import { PriceMaskDirective } from '@/shared/directives';
import { UikitEmptyStateComponent } from '@/uikit';
import {
Component,
computed,
EventEmitter,
inject,
Input,
Output,
TemplateRef,
ViewChild,
} from '@angular/core';
import { UrlTree } from '@angular/router';
import { ButtonDirective } from 'primeng/button';
import { Divider } from 'primeng/divider';
import { TableModule } from 'primeng/table';
export type TSaleInvoiceSingleViewVariant = 'full' | 'customer' | 'pos';
@Component({
selector: 'shared-sale-invoice-single-view',
templateUrl: './sale-invoice-single-view.component.html',
imports: [
AppCardComponent,
KeyValueComponent,
Divider,
ButtonDirective,
PageDataListComponent,
TableModule,
PageLoadingComponent,
UikitEmptyStateComponent,
PriceMaskDirective,
CatalogTaxProviderStatusTagComponent,
],
})
export class SharedSaleInvoiceSingleViewComponent {
private readonly nativeBridge = inject(NativeBridgeService);
private readonly posInfoStore = inject(PosInfoStore);
@Input({ required: true }) loading!: boolean;
@Input() invoice!: Maybe<ISaleInvoiceFullResponse>;
@Input() variant: TSaleInvoiceSingleViewVariant = 'full';
@Input() backRoute?: UrlTree | string | any[];
@Output() onRefresh = new EventEmitter<void>();
@ViewChild('totalAmount', { static: false }) totalAmount!: TemplateRef<any>;
readonly posName = computed(() => {
if (this.posInfoStore.entity()) {
const { name, businessActivity, complex } = this.posInfoStore.entity()!;
return `${name} (${businessActivity.name} - ${complex.name})`;
}
return '';
});
printInvoice = () => {
if (this.invoice) {
this.nativeBridge.print([
{
title: 'اطلاعات صورت‌حساب',
items: [
{
label: 'شماره منحصر به فرد مالیاتی',
value: 'this.invoice',
},
{
label: 'شماره صورت‌حساب',
value: this.invoice.code,
},
{
label: 'موضوع صورت‌حساب',
value: 'this.invoice',
},
{
label: 'نوع صورت‌حساب',
value: 'this.invoice',
},
{
label: 'تاریخ و ساعت',
value: this.invoice.invoice_date,
},
{
label: 'وضعیت صورت‌حساب مالیاتی',
value: this.invoice.status.translate,
},
],
},
{
title: `اطلاعات فروشنده`,
items: [
{
label: 'عنوان فروشگاه',
value: this.invoice.pos.complex.business_activity.name,
},
{
label: 'عنوان شعبه',
value: this.invoice.pos.complex.name,
},
{
label: 'عنوان پایانه‌ فروش',
value: this.invoice.pos.name,
},
{
label: 'شماره اقتصادی',
value: 'this.invoice.pos.complex.business_activity.economic_code',
},
],
},
{
title: `اطلاعات خریدار`,
items: [
{
label: 'نام خریدار',
value:
(this.invoice.customer
? this.invoice.customer.type === 'LEGAL'
? this.invoice.customer.legal?.company_name
: `${this.invoice.customer.individual?.first_name} ${this.invoice.customer.individual?.last_name}`
: this.invoice.unknown_customer?.name) || '-',
},
{
label: 'شماره اقتصادی',
value: this.invoice.customer
? this.invoice.customer.type === 'LEGAL'
? this.invoice.customer.legal?.economic_code
: this.invoice.customer.individual?.economic_code || '-'
: '-',
},
],
},
]);
}
};
columns: IColumn[] = [
{
field: 'name',
header: 'عنوان',
type: 'nested',
nestedOption: {
path: 'good.name',
},
},
{
field: 'sku_code',
header: 'شناسه کالا',
},
{
field: 'unit_price',
header: 'قیمت واحد',
type: 'price',
},
{
field: 'quantity',
header: 'مقدار',
customDataModel(item) {
return `${item.quantity} ${item.measure_unit_text}`;
},
},
{
field: 'total_amount',
header: 'قیمت نهایی',
type: 'price',
},
];
expandableColumns: IColumn[] = [
{
field: 'commission',
header: 'کارمزد',
type: 'price',
},
{
field: 'wages',
header: 'اجرت',
type: 'price',
},
{
field: 'profit',
header: 'سود',
type: 'price',
},
];
expandedRows: { [key: string]: boolean } = {};
refresh() {
this.onRefresh.emit();
}
}
@@ -168,7 +168,7 @@
<ng-template #emptymessage>
<tr class="">
<td [colSpan]="(columns.length + 1).toString()" class="w-full">
<td [colSpan]="(columns.length + (showIndex ? 1 : 0) + (actionsCount() > 0 ? 1 : 0)).toString()" class="w-full">
<ng-container [ngTemplateOutlet]="emptyMessageCard"></ng-container>
</td>
</tr>
@@ -1,4 +1,4 @@
<div class="h-full bg-surface-overlay rounded-(--p-card-border-radius) overflow-hidden">
<div class="h-full bg-surface-overlay rounded-lg shadow border border-surface-border p-0! overflow-hidden">
<ng-template #captionTemplate let-isMobileView="isMobileView">
@if (pageTitle || showAdd || filter || showRefresh || moreActions) {
<ng-container [ngTemplateOutlet]="caption">
@@ -0,0 +1,28 @@
import { IListConfig } from './list-config.model';
export const accountListConfig: IListConfig = {
pageTitle: 'مدیریت حساب‌های کاربری',
addNewCtaLabel: 'افزودن حساب',
emptyPlaceholderTitle: 'حسابی یافت نشد',
emptyPlaceholderDescription: 'برای افزودن حساب کاربری، روی دکمهٔ بالا کلیک کنید.',
columns: [
{
field: 'username',
header: 'نام کاربری',
type: 'nested',
nestedOption: { path: 'account.username' },
},
{
field: 'pos',
header: 'پایانه',
customDataModel(item: any) {
return `${item.pos.name} - ${item.pos.complex.name} - ${item.pos.complex.business_activity.name}`;
},
},
{
field: 'created_at',
header: 'تاریخ ایجاد',
type: 'date',
},
],
};
@@ -0,0 +1,35 @@
import { IListConfig } from './list-config.model';
export const businessActivityListConfig: IListConfig = {
pageTitle: 'مدیریت کسب و کار',
addNewCtaLabel: 'افزودن کسب و کار',
emptyPlaceholderTitle: 'کسب و کاری یافت نشد',
emptyPlaceholderDescription: 'برای افزودن کسب و کار، روی دکمهٔ بالا کلیک کنید.',
columns: [
{ field: 'name', header: 'عنوان' },
{ field: 'guild', header: 'صنف', type: 'nested', nestedOption: { path: 'guild.name' } },
{ field: 'economic_code', header: 'کد اقتصادی' },
{
field: 'license_info',
header: 'محدودیت کاربر',
customDataModel(item: any) {
const licenseInfo = item.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: 'تاریخ ایجاد',
type: 'date',
},
],
};
@@ -0,0 +1,12 @@
import { IListConfig } from './list-config.model';
export const categoryListConfig: IListConfig = {
pageTitle: 'مدیریت دسته‌بندی‌های کالا',
addNewCtaLabel: 'افزودن دسته‌بندی',
emptyPlaceholderTitle: 'دسته‌بندی‌ یافت نشد',
emptyPlaceholderDescription: 'برای افزودن دسته‌بندی، روی دکمهٔ بالا کلیک کنید.',
columns: [
{ field: 'image_url', header: 'تصویر', type: 'thumbnail' },
{ field: 'name', header: 'عنوان' },
],
};
@@ -0,0 +1,17 @@
import { IListConfig } from './list-config.model';
export const complexListConfig: IListConfig = {
pageTitle: 'مدیریت شعب',
addNewCtaLabel: 'افزودن شعبه',
emptyPlaceholderTitle: 'شعبه‌ای یافت نشد',
emptyPlaceholderDescription: 'برای افزودن شعبه، روی دکمهٔ بالا کلیک کنید.',
columns: [
{ field: 'name', header: 'عنوان' },
{ field: 'branch_code', header: 'کد شعبه' },
{
field: 'created_at',
header: 'تاریخ ایجاد',
type: 'date',
},
],
};
@@ -0,0 +1,35 @@
import { IListConfig } from './list-config.model';
export const consumerListConfig: IListConfig = {
pageTitle: 'مدیریت مشتری‌ها',
addNewCtaLabel: 'افزودن مشتری',
emptyPlaceholderTitle: 'مشتری‌ای یافت نشد',
emptyPlaceholderDescription: 'برای افزودن مشتری، روی دکمهٔ بالا کلیک کنید.',
columns: [
{ field: 'name', header: 'عنوان' },
{
field: 'business_counts',
header: 'تعداد کسب‌و‌کارها',
customDataModel(item: any) {
return item.business_counts || 0;
},
},
{
field: 'partner',
header: 'ارایه‌دهنده',
type: 'nested',
nestedOption: { path: 'partner.name' },
},
{
field: 'status',
header: 'وضعیت',
type: 'nested',
nestedOption: { path: 'status.translate' },
},
{
field: 'created_at',
header: 'تاریخ ایجاد',
type: 'date',
},
],
};
@@ -0,0 +1,42 @@
import { IListConfig } from './list-config.model';
export const customerListConfig: IListConfig = {
pageTitle: 'مدیریت مشتری‌ها',
addNewCtaLabel: 'افزودن مشتری',
emptyPlaceholderTitle: 'مشتری‌ای یافت نشد',
emptyPlaceholderDescription: 'برای افزودن مشتری، روی دکمهٔ بالا کلیک کنید.',
columns: [
{
field: 'type',
header: 'نوع مشتری',
customDataModel(item: any) {
return item.type === 'LEGAL' ? 'حقوقی' : 'حقیقی';
},
},
{
field: 'name',
header: 'عنوان',
customDataModel(item: any) {
if (item.type === 'LEGAL') {
return item.legal?.company_name;
}
return `${item.individual?.first_name} ${item.individual?.last_name}`;
},
},
{
field: 'economic_code',
header: 'کد اقتصادی',
customDataModel(item: any) {
if (item.type === 'LEGAL') {
return item.legal?.economic_code;
}
return item.individual?.economic_code;
},
},
{
field: 'created_at',
header: 'تاریخ ایجاد',
type: 'date',
},
],
};
@@ -0,0 +1,16 @@
import { IListConfig } from './list-config.model';
export const deviceBrandListConfig: IListConfig = {
pageTitle: 'مدیریت برندهای دستگاه',
addNewCtaLabel: 'افزودن برند',
emptyPlaceholderTitle: 'برندی یافت نشد',
emptyPlaceholderDescription: 'برای افزودن برند دستگاه، روی دکمهٔ بالا کلیک کنید.',
columns: [
{ field: 'name', header: 'عنوان' },
{
field: 'created_at',
header: 'تاریخ ایجاد',
type: 'date',
},
],
};
@@ -0,0 +1,17 @@
import { IListConfig } from './list-config.model';
export const deviceListConfig: IListConfig = {
pageTitle: 'مدیریت دستگاه‌ها',
addNewCtaLabel: 'افزودن دستگاه',
emptyPlaceholderTitle: 'دستگاه‌ای یافت نشد',
emptyPlaceholderDescription: 'برای افزودن دستگاه، روی دکمهٔ بالا کلیک کنید.',
columns: [
{ field: 'name', header: 'عنوان' },
{ field: 'brand', header: 'برند', type: 'nested', nestedOption: { path: 'brand.name' } },
{
field: 'created_at',
header: 'تاریخ ایجاد',
type: 'date',
},
],
};
@@ -0,0 +1,25 @@
import { IListConfig } from './list-config.model';
export const goodListConfig: IListConfig = {
pageTitle: 'مدیریت کالاها',
addNewCtaLabel: 'افزودن کالا',
emptyPlaceholderTitle: 'کالایی یافت نشد',
emptyPlaceholderDescription: 'برای افزودن کالای، روی دکمهٔ بالا کلیک کنید.',
columns: [
{ field: 'image_url', header: 'تصویر', type: 'thumbnail' },
{ field: 'name', header: 'عنوان' },
{ field: 'sku', header: 'شناسه کالا', type: 'nested', nestedOption: { path: 'sku.code' } },
{
field: 'measure_unit',
header: 'واحد اندازه‌گیری',
type: 'nested',
nestedOption: { path: 'measure_unit.name' },
},
{
field: 'category',
header: 'دسته‌بندی',
type: 'nested',
nestedOption: { path: 'category.name' },
},
],
};
@@ -0,0 +1,20 @@
export * from './account-list.const';
export * from './business-activity-list.const';
export * from './category-list.const';
export * from './complex-list.const';
export * from './consumer-list.const';
export * from './device-brand-list.const';
export * from './device-list.const';
export * from './good-list.const';
export * from './license-list.const';
export * from './list-config.model';
export * from './partner-account-list.const';
export * from './partner-consumer-account-list.const';
export * from './partner-customer-list.const';
export * from './partner-list.const';
export * from './pos-list.const';
export * from './provider-list.const';
export * from './sale-invoice-list.const';
export * from './sku-list.const';
export * from './superAdmin-consumer-account-list.const';
export * from './user-list.const';
@@ -0,0 +1,26 @@
import { IListConfig } from './list-config.model';
export const licenseListConfig: IListConfig = {
pageTitle: 'مدیریت لایسنس‌ها',
addNewCtaLabel: 'افزودن لایسنس',
emptyPlaceholderTitle: 'لایسنسی یافت نشد',
emptyPlaceholderDescription: 'برای افزودن لایسنس، روی دکمهٔ بالا کلیک کنید.',
columns: [
{
field: 'consumer',
header: 'مشتری',
customDataModel(item: any) {
return `${item.consumer.first_name} ${item.consumer.last_name}`;
},
},
{
field: 'partner',
header: 'ارایه شده توسط',
customDataModel(item: any) {
return item.license?.charged_license_transaction?.partner?.name || 'برند نرم‌افزار';
},
},
{ field: 'expires_at', header: 'تاریخ انقضا', type: 'date' },
{ field: 'created_at', header: 'تاریخ ایجاد', type: 'date' },
],
};
@@ -0,0 +1,9 @@
import { IColumn } from '@/shared/components/pageDataList/page-data-list.component';
export interface IListConfig {
pageTitle: string;
addNewCtaLabel: string;
emptyPlaceholderTitle: string;
emptyPlaceholderDescription: string;
columns: IColumn[];
}
@@ -0,0 +1,28 @@
import { IListConfig } from './list-config.model';
export const partnerAccountListConfig: IListConfig = {
pageTitle: 'مدیریت حساب‌های کاربری',
addNewCtaLabel: 'افزودن حساب',
emptyPlaceholderTitle: 'حسابی یافت نشد',
emptyPlaceholderDescription: 'برای افزودن حساب کاربری، روی دکمهٔ بالا کلیک کنید.',
columns: [
{
field: 'username',
header: 'نام کاربری',
type: 'nested',
nestedOption: { path: 'account.username' },
},
{ field: 'role', header: 'نقش' },
{
field: 'status',
header: 'وضعیت',
type: 'nested',
nestedOption: { path: 'account.status' },
},
{
field: 'created_at',
header: 'تاریخ ایجاد',
type: 'date',
},
],
};
@@ -0,0 +1,34 @@
import { IListConfig } from './list-config.model';
export const partnerConsumerAccountListConfig: IListConfig = {
pageTitle: 'مدیریت حساب‌های مشتری',
addNewCtaLabel: 'افزودن حساب',
emptyPlaceholderTitle: 'حسابی یافت نشد',
emptyPlaceholderDescription: 'برای افزودن حساب، روی دکمهٔ بالا کلیک کنید.',
columns: [
{
field: 'account',
header: 'نام کاربری',
type: 'nested',
nestedOption: { path: 'account.username' },
},
{ field: 'role', header: 'نوع حساب', type: 'nested', nestedOption: { path: 'role.translate' } },
{
field: 'pos',
header: 'پایانه‌',
customDataModel(item: any) {
if (item.pos) {
return `${item.pos.name} (${item.pos.complex.name} - ${item.pos.complex.business_activity.name})`;
}
return '-';
},
},
{
field: 'status',
header: 'وضعیت',
type: 'nested',
nestedOption: { path: 'account.status.translate' },
variant: 'tag',
},
],
};
@@ -0,0 +1,16 @@
import { IListConfig } from './list-config.model';
export const partnerCustomerListConfig: IListConfig = {
pageTitle: 'مدیریت مشتریان',
addNewCtaLabel: 'افزودن مشتری',
emptyPlaceholderTitle: 'مشتری‌ای یافت نشد',
emptyPlaceholderDescription: 'برای افزودن مشتری، روی دکمهٔ بالا کلیک کنید.',
columns: [
{ field: 'first_name', header: 'نام' },
{
field: 'created_at',
header: 'تاریخ ایجاد',
type: 'date',
},
],
};
@@ -0,0 +1,42 @@
import { IListConfig } from './list-config.model';
export const partnerListConfig: IListConfig = {
pageTitle: 'مدیریت ارایه‌دهندگان',
addNewCtaLabel: 'افزودن ارایه‌دهنده',
emptyPlaceholderTitle: 'ارایه‌دهندگان‌ای یافت نشد',
emptyPlaceholderDescription: 'برای افزودن ارایه‌دهنده، روی دکمهٔ بالا کلیک کنید.',
columns: [
{ field: 'name', header: 'عنوان' },
{ field: 'code', header: 'کد' },
{
field: 'licenses',
header: 'تعداد لایسنس‌ها',
customDataModel(item: any) {
return item.licenses || 0;
},
},
{
field: 'account_quota',
header: 'تعداد کاربرهای خریداری شده',
customDataModel(item: any) {
return item.account_quota || 0;
},
},
{
field: 'license_renew',
header: 'تعداد لایسنس تمدیدی',
customDataModel(item: any) {
return item.license_renew || 0;
},
},
{
field: 'status',
header: 'وضعیت',
type: 'nested',
variant: 'tag',
nestedOption: {
path: 'status.translate',
},
},
],
};
@@ -0,0 +1,31 @@
import { IListConfig } from './list-config.model';
export const posListConfig: IListConfig = {
pageTitle: 'مدیریت پایانه‌های فروش',
addNewCtaLabel: 'افزودن پایانه',
emptyPlaceholderTitle: 'پایانه‌ای یافت نشد',
emptyPlaceholderDescription: 'برای افزودن پایانه، روی دکمهٔ بالا کلیک کنید.',
columns: [
{ field: 'name', header: 'عنوان' },
{ field: 'serial_number', header: 'شماره سریال' },
{ field: 'pos_type', header: 'نوع دستگاه' },
{ field: 'device', header: 'دستگاه', type: 'nested', nestedOption: { path: 'device.name' } },
{
field: 'provider',
header: 'ارایه‌دهنده',
type: 'nested',
nestedOption: { path: 'provider.name' },
},
{
field: 'account',
header: 'کاربر',
type: 'nested',
nestedOption: { path: 'account.username' },
},
{
field: 'created_at',
header: 'تاریخ ایجاد',
type: 'date',
},
],
};
@@ -0,0 +1,16 @@
import { IListConfig } from './list-config.model';
export const providerListConfig: IListConfig = {
pageTitle: 'مدیریت تامین‌کنندگان',
addNewCtaLabel: 'افزودن تامین‌کننده',
emptyPlaceholderTitle: 'تامین‌کننده‌ای یافت نشد',
emptyPlaceholderDescription: 'برای افزودن تامین‌کننده، روی دکمهٔ بالا کلیک کنید.',
columns: [
{ field: 'name', header: 'عنوان' },
{
field: 'created_at',
header: 'تاریخ ایجاد',
type: 'date',
},
],
};
@@ -0,0 +1,39 @@
import { IListConfig } from './list-config.model';
export const saleInvoiceListConfig: IListConfig = {
pageTitle: 'مدیریت فاکتورهای فروش',
addNewCtaLabel: 'افزودن فاکتور',
emptyPlaceholderTitle: 'فاکتوری یافت نشد',
emptyPlaceholderDescription: 'برای افزودن فاکتور، روی دکمهٔ بالا کلیک کنید.',
columns: [
{ field: 'code', header: 'کد رهگیری' },
{
field: 'total_amount',
header: 'قیمت نهایی',
type: 'price',
},
{
field: 'pos',
header: 'پایانه',
customDataModel(item: any) {
return `${item.pos.name} (${item.pos.complex.name} - ${item.pos.complex.business_activity.name})`;
},
},
{
field: 'consumer_account',
header: 'ایجاد شده توسط',
type: 'nested',
nestedOption: { path: 'consumer_account.account.username' },
},
{
field: 'invoice_date',
header: 'تاریخ فاکتور',
type: 'date',
},
{
field: 'created_at',
header: 'تاریخ ایجاد',
type: 'date',
},
],
};
@@ -0,0 +1,13 @@
import { IListConfig } from './list-config.model';
export const skuListConfig: IListConfig = {
pageTitle: 'مدیریت شناسه کالاها',
addNewCtaLabel: 'افزودن شناسه کالا',
emptyPlaceholderTitle: 'شناسه کالایی یافت نشد',
emptyPlaceholderDescription: 'برای افزودن شناسه کالا، روی دکمهٔ بالا کلیک کنید.',
columns: [
{ field: 'code', header: 'کد' },
{ field: 'name', header: 'عنوان' },
{ field: 'VAT', header: 'مالیات ارزش افزوده' },
],
};
@@ -0,0 +1,35 @@
import { IListConfig } from './list-config.model';
export const superAdminConsumerAccountListConfig: IListConfig = {
pageTitle: 'مدیریت حساب‌های مشتری',
addNewCtaLabel: 'افزودن حساب',
emptyPlaceholderTitle: 'حسابی یافت نشد',
emptyPlaceholderDescription: 'برای افزودن حساب، روی دکمهٔ بالا کلیک کنید.',
columns: [
{
field: 'account',
header: 'نام کاربری',
type: 'nested',
nestedOption: { path: 'account.username' },
},
{ field: 'role', header: 'نوع حساب', type: 'nested', nestedOption: { path: 'role.translate' } },
{
field: 'pos',
header: 'پایانه',
customDataModel(item: any) {
return `${item.pos.name} (${item.pos.complex.name} - ${item.pos.complex.business_activity.name})`;
},
},
{
field: 'status',
header: 'وضعیت',
type: 'nested',
nestedOption: { path: 'account.status.translate' },
},
{
field: 'created_at',
header: 'تاریخ ایجاد',
type: 'date',
},
],
};
@@ -0,0 +1,18 @@
import { IListConfig } from './list-config.model';
export const userListConfig: IListConfig = {
pageTitle: 'مدیریت کاربران',
addNewCtaLabel: 'افزودن کاربر',
emptyPlaceholderTitle: 'کاربری یافت نشد',
emptyPlaceholderDescription: 'برای افزودن کاربر، روی دکمهٔ بالا کلیک کنید.',
columns: [
{ field: 'fullname', header: 'نام' },
{ field: 'mobile_number', header: 'شماره موبایل' },
{ field: 'national_code', header: 'کد ملی' },
{
field: 'created_at',
header: 'تاریخ ایجاد',
type: 'date',
},
],
};