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:
@@ -68,17 +68,19 @@ export class ConsumerSaleInvoiceSharedComponent {
|
||||
|
||||
printInvoice = () => {
|
||||
if (this.invoice) {
|
||||
const printResult = this.nativeBridge.print({
|
||||
title: `فروشگاه ${this.posName()}`,
|
||||
items: [
|
||||
{
|
||||
label: 'شماره فاکتور',
|
||||
value: this.invoice?.code,
|
||||
},
|
||||
{ label: 'تاریخ', value: formatJalali(this.invoice.invoice_date, 'YYYY/MM/DD') },
|
||||
{ label: 'مبلغ کل', value: this.invoice.total_amount },
|
||||
],
|
||||
});
|
||||
const printResult = this.nativeBridge.print([
|
||||
{
|
||||
title: `فروشگاه ${this.posName()}`,
|
||||
items: [
|
||||
{
|
||||
label: 'شماره فاکتور',
|
||||
value: this.invoice?.code,
|
||||
},
|
||||
{ label: 'تاریخ', value: formatJalali(this.invoice.invoice_date, 'YYYY/MM/DD') },
|
||||
{ label: 'مبلغ کل', value: this.invoice.total_amount },
|
||||
],
|
||||
},
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
IChangePasswordSubmitPayload,
|
||||
} from '@/shared/components';
|
||||
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { accountListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { finalize } from 'rxjs';
|
||||
@@ -23,27 +24,7 @@ export class ConsumerAccountsComponent extends AbstractList<IAccountResponse> {
|
||||
passwordSubmitLoading = signal(false);
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{
|
||||
field: 'username',
|
||||
header: 'نام کاربری',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'account.username' },
|
||||
},
|
||||
{
|
||||
field: 'pos',
|
||||
header: 'پایانه',
|
||||
customDataModel(item) {
|
||||
return `${item.pos.name} - ${item.pos.complex.name} - ${item.pos.complex.business_activity.name}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
this.columns = accountListConfig.columns;
|
||||
}
|
||||
|
||||
override getDataRequest() {
|
||||
|
||||
+2
-10
@@ -4,6 +4,7 @@ import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { complexListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { consumerComplexesNamedRoutes } from '../../constants/routes/complexes';
|
||||
@@ -19,16 +20,7 @@ import { ConsumerComplexFormComponent } from './form.component';
|
||||
export class ConsumerComplexListComponent extends AbstractList<IComplexResponse> {
|
||||
@Input({ required: true }) businessId!: string;
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'branch_code', header: 'کد شعبه' },
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
@Input() header: IColumn[] = complexListConfig.columns;
|
||||
|
||||
private readonly service = inject(ConsumerComplexesService);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
+4
-16
@@ -4,6 +4,7 @@ import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { goodListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { IConsumerBusinessActivityGoodResponse } from '../../models/goods_io';
|
||||
import { BusinessActivityGoodsService } from '../../services/goods.service';
|
||||
@@ -18,22 +19,9 @@ export class ConsumerBusinessActivityGoodsListComponent extends AbstractList<ICo
|
||||
@Input({ required: true }) businessId!: string;
|
||||
@Input({ required: true }) guildId!: string;
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'sku', header: 'شناسه عمومی' },
|
||||
{
|
||||
field: 'category',
|
||||
header: 'دستهبندی',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'category.name' },
|
||||
},
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
@Input() header: IColumn[] = goodListConfig.columns;
|
||||
|
||||
listConfig = goodListConfig;
|
||||
service = inject(BusinessActivityGoodsService);
|
||||
|
||||
override setColumns(): void {
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { businessActivityListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { consumerBusinessActivityNamedRoutes } from '../constants';
|
||||
@@ -18,33 +19,7 @@ import { ConsumerBusinessActivityFormComponent } from './form.component';
|
||||
})
|
||||
export class ConsumerBusinessActivityListComponent extends AbstractList<IBusinessActivityResponse> {
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'guild', header: 'صنف', type: 'nested', nestedOption: { path: 'guild.name' } },
|
||||
{ field: 'economic_code', header: 'کد اقتصادی' },
|
||||
{
|
||||
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: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
@Input() header: IColumn[] = businessActivityListConfig.columns;
|
||||
|
||||
private readonly service = inject(BusinessActivitiesService);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
@@ -4,6 +4,8 @@ import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
|
||||
import { customerListConfig } from '@/shared/constants/list-configs/customer-list.const';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { ConsumerBusinessActivityFormComponent } from '../components/form-dialog.component';
|
||||
@@ -18,42 +20,7 @@ import { CustomersService } from '../services/main.service';
|
||||
})
|
||||
export class ConsumerCustomerListComponent extends AbstractList<ICustomerResponse> {
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{
|
||||
field: 'type',
|
||||
header: 'نوع مشتری',
|
||||
customDataModel(item) {
|
||||
return item.type === 'LEGAL' ? 'حقوقی' : 'حقیقی';
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
field: 'name',
|
||||
header: 'عنوان',
|
||||
customDataModel(item: ICustomerResponse) {
|
||||
if (item.type === 'LEGAL') {
|
||||
return item.legal!.company_name;
|
||||
}
|
||||
return `${item.individual!.first_name} ${item.individual!.last_name}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'economic_code',
|
||||
header: 'کد اقتصادی',
|
||||
customDataModel(item: ICustomerResponse) {
|
||||
if (item.type === 'LEGAL') {
|
||||
return item.legal!.economic_code;
|
||||
}
|
||||
return item.individual!.economic_code;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
@Input() header: IColumn[] = customerListConfig.columns;
|
||||
|
||||
private readonly service = inject(CustomersService);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
@@ -1 +1 @@
|
||||
<consumer-saleInvoice-shared [loading]="loading()" [invoice]="invoice()" variant="customer" />
|
||||
<shared-sale-invoice-single-view [loading]="loading()" [invoice]="invoice()" variant="customer" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { BreadcrumbService } from '@/core/services';
|
||||
import { ConsumerSaleInvoiceSharedComponent } from '@/domains/consumer/components/invoices/shared-saleInvoice.component';
|
||||
import { SharedSaleInvoiceSingleViewComponent } from '@/shared/components/invoices/sale-invoice-single-view.component';
|
||||
import pageParamsUtils from '@/utils/page-params.utils';
|
||||
import { Component, computed, effect, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
@@ -9,7 +9,7 @@ import { ConsumerCustomerSaleInvoiceStore } from '../../store/saleInvoice.store'
|
||||
@Component({
|
||||
selector: 'consumer-customer-saleInvoice',
|
||||
templateUrl: './single.component.html',
|
||||
imports: [ConsumerSaleInvoiceSharedComponent],
|
||||
imports: [SharedSaleInvoiceSingleViewComponent],
|
||||
})
|
||||
export class ConsumerCustomerSaleInvoiceComponent {
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { CONSUMER_COMPONENTS_CONST } from '@/domains/consumer/constants';
|
||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||
import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { posListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject, Input, TemplateRef, ViewChild } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { CookieService } from 'ngx-cookie-service';
|
||||
@@ -22,7 +22,7 @@ import { ConsumerPosFormComponent } from './form.component';
|
||||
})
|
||||
export class ConsumerPosListComponent extends AbstractList<IPosResponse> {
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = CONSUMER_COMPONENTS_CONST.pos.columns;
|
||||
@Input() header: IColumn[] = posListConfig.columns;
|
||||
|
||||
private readonly service = inject(ConsumerPosesService);
|
||||
private readonly cookieService = inject(CookieService);
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { saleInvoiceListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { consumerSaleInvoicesNamedRoutes } from '../constants/routes';
|
||||
@@ -17,37 +18,7 @@ import { ConsumerSaleInvoicesService } from '../services/main.service';
|
||||
})
|
||||
export class ConsumerSaleInvoiceListComponent extends AbstractList<IConsumerSaleInvoicesResponse> {
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'code', header: 'کد رهگیری' },
|
||||
{
|
||||
field: 'total_amount',
|
||||
header: 'قیمت نهایی',
|
||||
type: 'price',
|
||||
},
|
||||
{
|
||||
field: 'pos',
|
||||
header: 'پایانه',
|
||||
customDataModel(item: IConsumerSaleInvoicesResponse) {
|
||||
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',
|
||||
},
|
||||
];
|
||||
@Input() header: IColumn[] = saleInvoiceListConfig.columns;
|
||||
|
||||
private readonly service = inject(ConsumerSaleInvoicesService);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
@@ -1 +1 @@
|
||||
<consumer-saleInvoice-shared [loading]="loading()" [invoice]="invoice()" />
|
||||
<shared-sale-invoice-single-view [loading]="loading()" [invoice]="invoice()" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { BreadcrumbService } from '@/core/services';
|
||||
import { ConsumerSaleInvoiceSharedComponent } from '@/domains/consumer/components/invoices/shared-saleInvoice.component';
|
||||
import { SharedSaleInvoiceSingleViewComponent } from '@/shared/components/invoices/sale-invoice-single-view.component';
|
||||
import pageParamsUtils from '@/utils/page-params.utils';
|
||||
import { Component, computed, effect, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
@@ -8,7 +8,7 @@ import { ConsumerSaleInvoiceStore } from '../store/main.store';
|
||||
@Component({
|
||||
selector: 'consumer-saleInvoice',
|
||||
templateUrl: './single.component.html',
|
||||
imports: [ConsumerSaleInvoiceSharedComponent],
|
||||
imports: [SharedSaleInvoiceSingleViewComponent],
|
||||
})
|
||||
export class ConsumerSaleInvoiceComponent {
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
IChangePasswordSubmitPayload,
|
||||
} from '@/shared/components';
|
||||
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { partnerAccountListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { finalize } from 'rxjs';
|
||||
@@ -23,27 +24,7 @@ export class PartnerAccountsComponent extends AbstractList<IAccountResponse> {
|
||||
passwordSubmitLoading = signal(false);
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{
|
||||
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',
|
||||
},
|
||||
];
|
||||
this.columns = partnerAccountListConfig.columns;
|
||||
}
|
||||
|
||||
override getDataRequest() {
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { partnerConsumerAccountListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { IConsumerAccountResponse } from '../../models';
|
||||
import { PartnerConsumerAccountsService } from '../../services/accounts.service';
|
||||
@@ -17,37 +18,7 @@ import { ConsumerAccountFormComponent } from './form.component';
|
||||
export class ConsumerAccountListComponent extends AbstractList<IConsumerAccountResponse> {
|
||||
@Input({ required: true }) consumerId!: string;
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
{
|
||||
field: 'account',
|
||||
header: 'نام کاربری',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'account.username' },
|
||||
},
|
||||
{ field: 'role', header: 'نوع حساب', type: 'nested', nestedOption: { path: 'role.translate' } },
|
||||
{
|
||||
field: 'pos',
|
||||
header: 'پایانه',
|
||||
customDataModel(item: IConsumerAccountResponse) {
|
||||
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',
|
||||
},
|
||||
// {
|
||||
// field: 'created_at',
|
||||
// header: 'تاریخ ایجاد',
|
||||
// type: 'date',
|
||||
// },
|
||||
];
|
||||
@Input() header: IColumn[] = partnerConsumerAccountListConfig.columns;
|
||||
private readonly service = inject(PartnerConsumerAccountsService);
|
||||
|
||||
override setColumns(): void {
|
||||
|
||||
+2
-22
@@ -4,6 +4,7 @@ import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { businessActivityListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject, Input, signal } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { partnerConsumerBusinessActivitiesNamedRoutes } from '../../constants/routes/businessActivities';
|
||||
@@ -24,28 +25,7 @@ import { ConsumerBusinessActivitiesFormDialogComponent } from './form-dialog.com
|
||||
export class ConsumerBusinessActivitiesComponent extends AbstractList<IBusinessActivityResponse> {
|
||||
@Input({ required: true }) consumerId!: string;
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'guild', header: 'صنف', type: 'nested', nestedOption: { path: 'guild.name' } },
|
||||
{ field: 'economic_code', header: 'کد اقتصادی' },
|
||||
{
|
||||
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' },
|
||||
},
|
||||
];
|
||||
@Input() header: IColumn[] = businessActivityListConfig.columns;
|
||||
|
||||
private readonly service = inject(PartnerConsumerBusinessActivitiesService);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { complexListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject, Input, signal } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { partnerConsumerComplexesNamedRoutes } from '../../constants/routes/complexes';
|
||||
@@ -25,17 +26,7 @@ export class ConsumerComplexesComponent extends AbstractList<IComplexResponse> {
|
||||
@Input() consumerId!: string;
|
||||
@Input() businessId!: string;
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'branch_code', header: 'کد شعبه' },
|
||||
{ field: 'pos_count', header: 'تعداد پایانهها' },
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
@Input() header: IColumn[] = complexListConfig.columns;
|
||||
|
||||
private readonly service = inject(PartnerComplexesService);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { posListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { partnerConsumerPosesNamedRoutes } from '../../constants/routes/poses';
|
||||
@@ -21,31 +22,7 @@ export class ConsumerPosesComponent extends AbstractList<IPosResponse> {
|
||||
@Input({ required: true }) businessId!: string;
|
||||
@Input({ required: true }) complexId!: string;
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
// { field: 'serial_number', header: 'شماره سریال' },
|
||||
// { field: 'device', header: 'دستگاه', type: 'nested', nestedOption: { path: 'device.name' } },
|
||||
{ field: 'pos_type', header: 'نوع پایانه' },
|
||||
{
|
||||
field: 'account',
|
||||
header: 'کاربر',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'account.username' },
|
||||
},
|
||||
// {
|
||||
// field: 'provider',
|
||||
// header: 'ارایهدهنده',
|
||||
// type: 'nested',
|
||||
// nestedOption: { path: 'provider.name' },
|
||||
// },
|
||||
// { field: 'status', header: 'وضعیت' },
|
||||
// {
|
||||
// field: 'created_at',
|
||||
// header: 'تاریخ ایجاد',
|
||||
// type: 'date',
|
||||
// },
|
||||
];
|
||||
@Input() header: IColumn[] = posListConfig.columns;
|
||||
|
||||
private readonly service = inject(PartnerPosesService);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { consumerListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { CreateConsumerWrapperComponent } from '../components/createConsumerWrapper/create-consumer-wrapper.component';
|
||||
@@ -20,17 +21,7 @@ export class ConsumersComponent extends AbstractList<IPartnerConsumerResponse> {
|
||||
visibleCreateForm = signal(false);
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
{ field: 'name', header: 'نام' },
|
||||
{ field: 'type', header: 'نوع', type: 'nested', nestedOption: { path: 'type.translate' } },
|
||||
{ field: 'business_counts', header: 'تعداد فعالیت اقتصادی فعال' },
|
||||
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
this.columns = consumerListConfig.columns;
|
||||
}
|
||||
|
||||
override getDataRequest() {
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { partnerCustomerListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { partnerCustomersNamedRoutes } from '../constants';
|
||||
@@ -17,19 +18,7 @@ import { CustomersService } from '../services/main.service';
|
||||
})
|
||||
export class PartnerCustomerListComponent extends AbstractList<ICustomerResponse> {
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
|
||||
{
|
||||
field: 'first_name',
|
||||
header: 'عنوان',
|
||||
},
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
@Input() header: IColumn[] = partnerCustomerListConfig.columns;
|
||||
|
||||
private readonly service = inject(CustomersService);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
@@ -16,50 +16,19 @@
|
||||
|
||||
<div class="overflow-y-auto">
|
||||
<ul class="list-none p-4 m-0">
|
||||
<li>
|
||||
<a
|
||||
pRipple
|
||||
routerLink="/sale_invoices"
|
||||
(click)="drawerRef.close($event)"
|
||||
class="flex items-center cursor-pointer p-4 rounded-border text-surface-700 dark:text-surface-100 hover:bg-surface-100 dark:hover:bg-surface-700 duration-150 transition-colors p-ripple"
|
||||
>
|
||||
<i class="pi pi-home me-2"></i>
|
||||
<span class="font-medium">فاکتورها</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
pRipple
|
||||
routerLink="/"
|
||||
(click)="drawerRef.close($event)"
|
||||
class="flex items-center cursor-pointer p-4 rounded-border text-surface-700 dark:text-surface-100 hover:bg-surface-100 dark:hover:bg-surface-700 duration-150 transition-colors p-ripple"
|
||||
>
|
||||
<i class="pi pi-home me-2"></i>
|
||||
<span class="font-medium">فروش کالا</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
pRipple
|
||||
routerLink="/about"
|
||||
(click)="drawerRef.close($event)"
|
||||
class="flex items-center cursor-pointer p-4 rounded-border text-surface-700 dark:text-surface-100 hover:bg-surface-100 dark:hover:bg-surface-700 duration-150 transition-colors p-ripple"
|
||||
>
|
||||
<i class="pi pi-home me-2"></i>
|
||||
<span class="font-medium">دربارهی سیستم</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
pRipple
|
||||
routerLink="/support"
|
||||
(click)="drawerRef.close($event)"
|
||||
class="flex items-center cursor-pointer p-4 rounded-border text-surface-700 dark:text-surface-100 hover:bg-surface-100 dark:hover:bg-surface-700 duration-150 transition-colors p-ripple"
|
||||
>
|
||||
<i class="pi pi-home me-2"></i>
|
||||
<span class="font-medium">ارتباط با پشتیبانی</span>
|
||||
</a>
|
||||
</li>
|
||||
@for (menuItem of menuItems; track $index) {
|
||||
<li>
|
||||
<a
|
||||
pRipple
|
||||
[routerLink]="menuItem.routerLink"
|
||||
(click)="drawerRef.close($event)"
|
||||
class="flex items-center cursor-pointer p-4 rounded-border text-surface-700 dark:text-surface-100 hover:bg-surface-100 dark:hover:bg-surface-700 duration-150 transition-colors p-ripple"
|
||||
>
|
||||
<i class="{{ menuItem.icon }} me-2"></i>
|
||||
<span class="font-medium">{{ menuItem.label }}</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="mt-auto">
|
||||
|
||||
@@ -7,6 +7,11 @@ import { Button } from 'primeng/button';
|
||||
import { Drawer } from 'primeng/drawer';
|
||||
import { Ripple } from 'primeng/ripple';
|
||||
import { filter } from 'rxjs';
|
||||
import config from 'src/config';
|
||||
import { posAboutNamedRoutes } from '../../modules/about/constants';
|
||||
import { posConfigNamedRoutes } from '../../modules/configs/constants';
|
||||
import { posSaleInvoicesNamedRoutes } from '../../modules/saleInvoices/constants';
|
||||
import { posSupportNamedRoutes } from '../../modules/support/constants';
|
||||
import { PosInfoStore } from '../../store';
|
||||
|
||||
@Component({
|
||||
@@ -31,9 +36,36 @@ export class PosMainMenuSidebarComponent extends AbstractDialog {
|
||||
return '';
|
||||
});
|
||||
|
||||
readonly menuItems = [
|
||||
{
|
||||
label: 'فروش',
|
||||
routerLink: config.isPosApplication ? '/' : '/pos',
|
||||
icon: 'pi pi-fw pi-home',
|
||||
},
|
||||
{
|
||||
label: 'فاکتورها',
|
||||
routerLink: posSaleInvoicesNamedRoutes.saleInvoices.meta.pagePath!(),
|
||||
icon: 'pi pi-fw pi-receipt',
|
||||
},
|
||||
{
|
||||
label: 'تنظیمات',
|
||||
routerLink: posConfigNamedRoutes.config.meta.pagePath!(),
|
||||
icon: 'pi pi-fw pi-cog',
|
||||
},
|
||||
{
|
||||
label: 'درباره ما',
|
||||
routerLink: posAboutNamedRoutes.about.meta.pagePath!(),
|
||||
icon: 'pi pi-fw pi-info-circle',
|
||||
},
|
||||
{
|
||||
label: 'پشتیبانی',
|
||||
routerLink: posSupportNamedRoutes.support.meta.pagePath!(),
|
||||
icon: 'pi pi-fw pi-phone',
|
||||
},
|
||||
];
|
||||
|
||||
ngOnInit() {
|
||||
this.isPwaBuild = this.swUpdate.isEnabled;
|
||||
console.log(this.swUpdate);
|
||||
|
||||
if (!this.isPwaBuild) return;
|
||||
|
||||
@@ -42,7 +74,6 @@ export class PosMainMenuSidebarComponent extends AbstractDialog {
|
||||
.then((data: { appData?: { appVersion?: string } }) => {
|
||||
this.appVersion = data?.appData?.appVersion || this.appVersion;
|
||||
this.toastService.info({ text: this.appVersion });
|
||||
console.log('appVersion:', data?.appData);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('err', err);
|
||||
|
||||
@@ -4,7 +4,11 @@ import { UnitType } from '@/utils';
|
||||
export interface IGoodRawResponse {
|
||||
id: string;
|
||||
name: string;
|
||||
sku: string;
|
||||
sku: {
|
||||
id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
};
|
||||
category: ISummary;
|
||||
unit_type: UnitType;
|
||||
pricing_model: string;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<form [formGroup]="form" (submit)="submit()">
|
||||
<app-checkbox [control]="form.controls.business_name" name="business_name" label="نمایش عنوان کسبوکار" />
|
||||
<app-checkbox [control]="form.controls.complex_name" name="complex_name" label="نمایش عنوان شعبه" />
|
||||
<app-checkbox [control]="form.controls.pos_name" name="pos_name" label="نمایش عنوان پایانه فروش" />
|
||||
<app-checkbox [control]="form.controls.invoice_template" name="invoice_template" label="نمایش الگوی صورتحساب" />
|
||||
<app-checkbox [control]="form.controls.fiscal_id" name="fiscal_id" label="نمایش شماره منحصر به فرد مالیاتی" />
|
||||
<app-checkbox [control]="form.controls.economic_code" name="economic_code" label="نمایش شماره اقتصادی" />
|
||||
<app-checkbox [control]="form.controls.customer_name" name="customer_name" label="نمایش عنوان خریدار" />
|
||||
<app-checkbox [control]="form.controls.customer_mobile" name="customer_mobile" label="نمایش شماره موبایل خریدار" />
|
||||
<app-checkbox
|
||||
[control]="form.controls.customer_national_id"
|
||||
name="customer_national_id"
|
||||
label="نمایش کد ملی خریدار"
|
||||
/>
|
||||
<app-checkbox
|
||||
[control]="form.controls.customer_postal_code"
|
||||
name="customer_postal_code"
|
||||
label="نمایش کد پستی خریدار"
|
||||
/>
|
||||
<app-checkbox
|
||||
[control]="form.controls.customer_economic_code"
|
||||
name="customer_economic_code"
|
||||
label="نمایش شناسهملی / اقتصادی خریدار"
|
||||
/>
|
||||
<app-checkbox [control]="form.controls.payment_type" name="payment_type" label="نمایش نوع پرداخت" />
|
||||
<app-checkbox [control]="form.controls.show_payment_info" name="show_payment_info" label="نمایش جزییات پرداخت" />
|
||||
<app-checkbox [control]="form.controls.show_items" name="show_items" label="نمایش کالاهای خریداری شده" />
|
||||
|
||||
<app-form-footer-actions (onSubmit)="submit()" (onCancel)="close()" />
|
||||
</form>
|
||||
@@ -0,0 +1,47 @@
|
||||
import { AbstractForm } from '@/shared/abstractClasses';
|
||||
import { AppCheckboxComponent } from '@/shared/components/checkbox/checkbox.component';
|
||||
import { FormFooterActionsComponent } from '@/shared/components/formFooterActions/form-footer-actions.component';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { IPosConfigPrintRequestPayload, IPosConfigPrintResponse } from './models';
|
||||
import { PosConfigPrintService } from './services/main.service';
|
||||
|
||||
@Component({
|
||||
selector: 'pos-config-print-form',
|
||||
templateUrl: 'form.component.html',
|
||||
imports: [ReactiveFormsModule, AppCheckboxComponent, FormFooterActionsComponent],
|
||||
})
|
||||
export class PosConfigPrintFormComponent extends AbstractForm<
|
||||
IPosConfigPrintRequestPayload,
|
||||
IPosConfigPrintResponse
|
||||
> {
|
||||
private readonly service = inject(PosConfigPrintService);
|
||||
|
||||
initForm = () => {
|
||||
const form = this.fb.group({
|
||||
business_name: [true, []],
|
||||
complex_name: [false],
|
||||
pos_name: [false],
|
||||
invoice_template: [false],
|
||||
fiscal_id: [false],
|
||||
economic_code: [false],
|
||||
customer_name: [false],
|
||||
customer_mobile: [false],
|
||||
customer_national_id: [false],
|
||||
customer_postal_code: [false],
|
||||
customer_economic_code: [false],
|
||||
payment_type: [false],
|
||||
show_payment_info: [false],
|
||||
show_items: [false],
|
||||
});
|
||||
|
||||
return form;
|
||||
};
|
||||
|
||||
form = this.initForm();
|
||||
|
||||
submitForm() {
|
||||
const formValue = this.form.value as IPosConfigPrintRequestPayload;
|
||||
return this.service.submit(formValue);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
export interface IPosConfigPrintResponse extends Partial<IPosConfigPrintRequestPayload> {}
|
||||
|
||||
export interface IPosConfigPrintRequestPayload {
|
||||
business_name: boolean;
|
||||
complex_name: boolean;
|
||||
pos_name: boolean;
|
||||
invoice_template: boolean;
|
||||
fiscal_id: boolean;
|
||||
economic_code: boolean;
|
||||
customer_name: boolean;
|
||||
customer_mobile: boolean;
|
||||
customer_national_id: boolean;
|
||||
customer_postal_code: boolean;
|
||||
customer_economic_code: boolean;
|
||||
payment_type: boolean;
|
||||
show_payment_info: boolean;
|
||||
show_items: boolean;
|
||||
items: {
|
||||
name: boolean;
|
||||
sku: boolean;
|
||||
quantity: boolean;
|
||||
base_amount: boolean;
|
||||
tax: boolean;
|
||||
discount: boolean;
|
||||
karat: boolean;
|
||||
profit: boolean;
|
||||
commission: boolean;
|
||||
wage: boolean;
|
||||
total_amount: boolean;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { LOCAL_STORAGE_KEYS } from 'src/assets/constants';
|
||||
import { IPosConfigPrintRequestPayload, IPosConfigPrintResponse } from '../models';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class PosConfigPrintService {
|
||||
get(): IPosConfigPrintResponse {
|
||||
const data = window.localStorage.getItem(LOCAL_STORAGE_KEYS.POS_CONFIG_PRINT);
|
||||
if (data) {
|
||||
return JSON.parse(data) as IPosConfigPrintResponse;
|
||||
}
|
||||
const defaultData = {
|
||||
business_name: true,
|
||||
complex_name: true,
|
||||
pos_name: true,
|
||||
invoice_template: true,
|
||||
fiscal_id: true,
|
||||
economic_code: true,
|
||||
customer_name: true,
|
||||
customer_mobile: true,
|
||||
customer_national_id: true,
|
||||
customer_postal_code: true,
|
||||
customer_economic_code: true,
|
||||
payment_type: true,
|
||||
show_payment_info: true,
|
||||
show_items: false,
|
||||
items: {
|
||||
name: false,
|
||||
sku: false,
|
||||
quantity: false,
|
||||
base_amount: false,
|
||||
tax: false,
|
||||
discount: false,
|
||||
karat: false,
|
||||
profit: false,
|
||||
commission: false,
|
||||
wage: false,
|
||||
total_amount: false,
|
||||
},
|
||||
};
|
||||
this.submit(defaultData);
|
||||
return defaultData;
|
||||
}
|
||||
|
||||
submit(data: IPosConfigPrintRequestPayload) {
|
||||
window.localStorage.setItem(LOCAL_STORAGE_KEYS.POS_CONFIG_PRINT, JSON.stringify(data));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './routes/index';
|
||||
@@ -0,0 +1,19 @@
|
||||
import { NamedRoutes } from '@/core';
|
||||
import { Routes } from '@angular/router';
|
||||
import config from 'src/config';
|
||||
|
||||
export type TPosConfigRouteNames = 'config';
|
||||
const baseRoute = `${config.isPosApplication ? '' : '/pos'}/config`;
|
||||
|
||||
export const posConfigNamedRoutes: NamedRoutes<TPosConfigRouteNames> = {
|
||||
config: {
|
||||
path: 'config',
|
||||
loadComponent: () => import('../../views/root.component').then((m) => m.PosConfigPageComponent),
|
||||
meta: {
|
||||
title: 'تنظیمات',
|
||||
pagePath: () => baseRoute,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const POS_CONFIG_ROUTES: Routes = [posConfigNamedRoutes.config];
|
||||
@@ -0,0 +1 @@
|
||||
export * from './root.component';
|
||||
@@ -0,0 +1,8 @@
|
||||
<div class="w-full h-full flex items-center justify-center p-4">
|
||||
<app-card-data cardTitle="تنظیمات فاکتور" class="w-full">
|
||||
<p-message variant="text" severity="info" icon="pi pi-info-circle">
|
||||
هریک از موارد زیر را که میخواهید در چاپ فاکتور نمایش داده شوند را انتخاب کنید
|
||||
</p-message>
|
||||
<pos-config-print-form class="block w-full mt-6" (onClose)="returnToMainPage()" (onSubmit)="returnToMainPage()" />
|
||||
</app-card-data>
|
||||
</div>
|
||||
@@ -0,0 +1,17 @@
|
||||
import { AppCardComponent } from '@/shared/components';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Message } from 'primeng/message';
|
||||
import { PosConfigPrintFormComponent } from '../components/print/form.component';
|
||||
|
||||
@Component({
|
||||
selector: 'pos-config-page',
|
||||
templateUrl: './root.component.html',
|
||||
imports: [PosConfigPrintFormComponent, AppCardComponent, Message],
|
||||
})
|
||||
export class PosConfigPageComponent {
|
||||
private readonly router = inject(Router);
|
||||
returnToMainPage() {
|
||||
this.router.navigateByUrl('/');
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="overflow-x-auto">
|
||||
<div class="w-full overflow-visible flex gap-3">
|
||||
<div class="w-full overflow-visible flex gap-3 px-4">
|
||||
@if (loading()) {
|
||||
@for (i of [1, 2, 3, 4, 5]; track i) {
|
||||
<p-skeleton width="6rem" height="2.5rem" />
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<div class="flex flex-col min-h-full">
|
||||
<div class="bg-surface-card z-10 p-4 border-b border-surface-border shadow-[0_-4px_16px_rgba(0,0,0,0.08)] rounded-xl">
|
||||
<div class="flex items-center justify-end mb-4">
|
||||
<div
|
||||
class="bg-surface-card z-10 py-4 border-b border-surface-border shadow-[0_-4px_16px_rgba(0,0,0,0.08)] rounded-b-xl"
|
||||
>
|
||||
<div class="flex items-center justify-end mb-4 px-4">
|
||||
<!-- <div class="flex items-center gap-2 text-muted-color">
|
||||
<i class="pi pi-list"></i>
|
||||
<span class="text-base font-bold">لیست کالاها</span>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
}
|
||||
</span>
|
||||
<span class="text-sm text-muted-color">
|
||||
{{ good.sku }}
|
||||
{{ good.sku.code }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+13
-11
@@ -54,17 +54,19 @@ export class PosOrderSubmittedDialogComponent extends AbstractDialog {
|
||||
}
|
||||
|
||||
printInvoice() {
|
||||
const printResult = this.nativeBridgeService.print({
|
||||
title: `فروشگاه ${this.posName()}`,
|
||||
items: [
|
||||
{
|
||||
label: 'شماره فاکتور',
|
||||
value: this.invoice.code,
|
||||
},
|
||||
{ label: 'تاریخ', value: formatJalali(this.invoice.invoice_date, 'YYYY/MM/DD') },
|
||||
{ label: 'مبلغ کل', value: this.invoice.total_amount },
|
||||
],
|
||||
});
|
||||
const printResult = this.nativeBridgeService.print([
|
||||
{
|
||||
title: `فروشگاه ${this.posName()}`,
|
||||
items: [
|
||||
{
|
||||
label: 'شماره فاکتور',
|
||||
value: this.invoice.code,
|
||||
},
|
||||
{ label: 'تاریخ', value: formatJalali(this.invoice.invoice_date, 'YYYY/MM/DD') },
|
||||
{ label: 'مبلغ کل', value: this.invoice.total_amount },
|
||||
],
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
sendToTsp() {}
|
||||
|
||||
@@ -76,20 +76,31 @@ export class PosGoldPayloadFormComponent extends AbstractForm<
|
||||
this.updateCalculateAmount(value as any);
|
||||
});
|
||||
|
||||
form.controls.payload.controls.profit_amount.valueChanges.pipe(takeUntilDestroyed()).subscribe(() => {
|
||||
// if ((form.controls.discount_amount.value || 0) > (value || 0)) {
|
||||
form.controls.discount_amount.setValue(0, { emitEvent: false });
|
||||
// }
|
||||
});
|
||||
form.controls.payload.controls.profit_percentage.valueChanges.pipe(takeUntilDestroyed()).subscribe(() => {
|
||||
form.controls.discount_amount.setValue(0, { emitEvent: false });
|
||||
});
|
||||
form.controls.payload.controls.profit_amount.valueChanges
|
||||
.pipe(takeUntilDestroyed())
|
||||
.subscribe(() => {
|
||||
// if ((form.controls.discount_amount.value || 0) > (value || 0)) {
|
||||
form.controls.discount_amount.setValue(0, { emitEvent: false });
|
||||
// }
|
||||
});
|
||||
form.controls.payload.controls.profit_percentage.valueChanges
|
||||
.pipe(takeUntilDestroyed())
|
||||
.subscribe(() => {
|
||||
form.controls.discount_amount.setValue(0, { emitEvent: false });
|
||||
});
|
||||
|
||||
return form;
|
||||
};
|
||||
|
||||
form = this.initialForm();
|
||||
|
||||
override ngAfterViewInit(): void {
|
||||
if (this.editMode) {
|
||||
this.form.patchValue(this.initialValues || {}, { emitEvent: false });
|
||||
this.updateCalculateAmount(this.form.value as any);
|
||||
}
|
||||
}
|
||||
|
||||
override submitForm(payload: IPosOrderItem) {
|
||||
this.onSubmit.emit({
|
||||
...payload,
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
<div class="p-4">
|
||||
<consumer-saleInvoice-shared [loading]="loading()" [invoice]="invoice()" [backRoute]="backRoute()" variant="pos" />
|
||||
<shared-sale-invoice-single-view
|
||||
[loading]="loading()"
|
||||
[invoice]="invoice()"
|
||||
[backRoute]="backRoute()"
|
||||
variant="pos"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ConsumerSaleInvoiceSharedComponent } from '@/domains/consumer/components/invoices/shared-saleInvoice.component';
|
||||
import { SharedSaleInvoiceSingleViewComponent } from '@/shared/components/invoices/sale-invoice-single-view.component';
|
||||
import pageParamsUtils from '@/utils/page-params.utils';
|
||||
import { Component, computed, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
@@ -8,7 +8,7 @@ import { PosSaleInvoiceStore } from '../store/main.store';
|
||||
@Component({
|
||||
selector: 'pos-saleInvoice',
|
||||
templateUrl: './single.component.html',
|
||||
imports: [ConsumerSaleInvoiceSharedComponent],
|
||||
imports: [SharedSaleInvoiceSingleViewComponent],
|
||||
})
|
||||
export class PosSaleInvoiceComponent {
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Route } from '@angular/router';
|
||||
import { POS_ABOUT_ROUTES } from './modules/about/constants';
|
||||
import { POS_CONFIG_ROUTES } from './modules/configs/constants';
|
||||
import { POS_SALE_INVOICES_ROUTES } from './modules/saleInvoices/constants';
|
||||
import { POS_SUPPORT_ROUTES } from './modules/support/constants';
|
||||
|
||||
@@ -15,5 +16,6 @@ export const POS_ROUTES = {
|
||||
...POS_SALE_INVOICES_ROUTES,
|
||||
...POS_ABOUT_ROUTES,
|
||||
...POS_SUPPORT_ROUTES,
|
||||
...POS_CONFIG_ROUTES,
|
||||
],
|
||||
} as Route;
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { superAdminConsumerAccountListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { IConsumerAccountResponse } from '../../models';
|
||||
import { AdminConsumerAccountsService } from '../../services/accounts.service';
|
||||
@@ -17,38 +18,7 @@ import { ConsumerAccountFormComponent } from './form.component';
|
||||
export class ConsumerAccountListComponent extends AbstractList<IConsumerAccountResponse> {
|
||||
@Input({ required: true }) consumerId!: string;
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{
|
||||
field: 'username',
|
||||
header: 'نام کاربری',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'account.username' },
|
||||
},
|
||||
{
|
||||
field: 'role',
|
||||
header: 'نوع حساب',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'role.translate' },
|
||||
},
|
||||
{
|
||||
field: 'pos',
|
||||
header: 'پایانه مرتبط',
|
||||
customDataModel: (item) =>
|
||||
`${item.pos.name} (${item.pos.complex.name} - ${item.pos.complex.business_activity.name})`,
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
header: 'وضعیت',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'status.translate' },
|
||||
},
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
@Input() header: IColumn[] = superAdminConsumerAccountListConfig.columns;
|
||||
private readonly service = inject(AdminConsumerAccountsService);
|
||||
|
||||
override setColumns(): void {
|
||||
|
||||
+2
-10
@@ -4,6 +4,7 @@ import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { businessActivityListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { superAdminConsumerBusinessActivitiesNamedRoutes } from '../../constants/routes/businessActivities';
|
||||
@@ -19,16 +20,7 @@ import { ConsumerBusinessActivitiesFormComponent } from './form.component';
|
||||
export class ConsumerBusinessActivitiesComponent extends AbstractList<IBusinessActivityResponse> {
|
||||
@Input({ required: true }) consumerId!: string;
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'guild', header: 'صنف', type: 'nested', nestedOption: { path: 'guild.name' } },
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
@Input() header: IColumn[] = businessActivityListConfig.columns;
|
||||
|
||||
private readonly service = inject(AdminConsumerBusinessActivitiesService);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { complexListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { superAdminConsumerComplexesNamedRoutes } from '../../constants/routes/complexes';
|
||||
@@ -20,15 +21,7 @@ export class ConsumerComplexesComponent extends AbstractList<IComplexResponse> {
|
||||
@Input() consumerId!: string;
|
||||
@Input() businessId!: string;
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
@Input() header: IColumn[] = complexListConfig.columns;
|
||||
|
||||
private readonly service = inject(AdminComplexesService);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { EntityState, EntityStore } from '@/core/state';
|
||||
import { defaultBaseStateData, EntityState, EntityStore } from '@/core/state';
|
||||
import { computed, inject, Injectable } from '@angular/core';
|
||||
import { MenuItem } from 'primeng/api';
|
||||
import { catchError, finalize } from 'rxjs';
|
||||
@@ -20,11 +20,7 @@ export class BusinessActivityStore extends EntityStore<
|
||||
private readonly service = inject(AdminConsumerBusinessActivitiesService);
|
||||
constructor() {
|
||||
super({
|
||||
loading: false,
|
||||
error: null,
|
||||
entity: null,
|
||||
initialized: false,
|
||||
isRefreshing: false,
|
||||
...defaultBaseStateData,
|
||||
breadcrumbItems: [],
|
||||
});
|
||||
}
|
||||
@@ -71,11 +67,7 @@ export class BusinessActivityStore extends EntityStore<
|
||||
|
||||
override reset(): void {
|
||||
this.setState({
|
||||
loading: false,
|
||||
error: null,
|
||||
entity: null,
|
||||
initialized: false,
|
||||
isRefreshing: false,
|
||||
...defaultBaseStateData,
|
||||
breadcrumbItems: [],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { EntityState, EntityStore } from '@/core/state';
|
||||
import { defaultBaseStateData, EntityState, EntityStore } from '@/core/state';
|
||||
import { computed, inject, Injectable } from '@angular/core';
|
||||
import { MenuItem } from 'primeng/api';
|
||||
import { catchError, finalize } from 'rxjs';
|
||||
@@ -17,11 +17,7 @@ export class ComplexStore extends EntityStore<IComplexResponse, ComplexState> {
|
||||
private readonly service = inject(AdminComplexesService);
|
||||
constructor() {
|
||||
super({
|
||||
loading: false,
|
||||
error: null,
|
||||
entity: null,
|
||||
initialized: false,
|
||||
isRefreshing: false,
|
||||
...defaultBaseStateData,
|
||||
breadcrumbItems: [],
|
||||
});
|
||||
}
|
||||
@@ -71,11 +67,7 @@ export class ComplexStore extends EntityStore<IComplexResponse, ComplexState> {
|
||||
|
||||
override reset(): void {
|
||||
this.setState({
|
||||
loading: false,
|
||||
error: null,
|
||||
entity: null,
|
||||
initialized: false,
|
||||
isRefreshing: false,
|
||||
...defaultBaseStateData,
|
||||
breadcrumbItems: [],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { EntityState, EntityStore } from '@/core/state';
|
||||
import { defaultBaseStateData, EntityState, EntityStore } from '@/core/state';
|
||||
import { computed, inject, Injectable } from '@angular/core';
|
||||
import { MenuItem } from 'primeng/api';
|
||||
import { catchError, finalize } from 'rxjs';
|
||||
@@ -17,11 +17,7 @@ export class ConsumerStore extends EntityStore<IAdminConsumerResponse, ConsumerS
|
||||
private readonly service = inject(ConsumersService);
|
||||
constructor() {
|
||||
super({
|
||||
loading: false,
|
||||
error: null,
|
||||
entity: null,
|
||||
initialized: false,
|
||||
isRefreshing: false,
|
||||
...defaultBaseStateData,
|
||||
breadcrumbItems: [],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { EntityState, EntityStore } from '@/core/state';
|
||||
import { defaultBaseStateData, EntityState, EntityStore } from '@/core/state';
|
||||
import { computed, inject, Injectable } from '@angular/core';
|
||||
import { MenuItem } from 'primeng/api';
|
||||
import { catchError, finalize } from 'rxjs';
|
||||
@@ -17,11 +17,7 @@ export class PosStore extends EntityStore<IPosResponse, PosState> {
|
||||
private readonly service = inject(AdminPosesService);
|
||||
constructor() {
|
||||
super({
|
||||
loading: false,
|
||||
error: null,
|
||||
entity: null,
|
||||
initialized: false,
|
||||
isRefreshing: false,
|
||||
...defaultBaseStateData,
|
||||
breadcrumbItems: [],
|
||||
});
|
||||
}
|
||||
@@ -74,11 +70,7 @@ export class PosStore extends EntityStore<IPosResponse, PosState> {
|
||||
|
||||
override reset(): void {
|
||||
this.setState({
|
||||
loading: false,
|
||||
error: null,
|
||||
entity: null,
|
||||
initialized: false,
|
||||
isRefreshing: false,
|
||||
...defaultBaseStateData,
|
||||
breadcrumbItems: [],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { consumerListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { ConsumerUserFormComponent } from '../components/form.component';
|
||||
@@ -18,41 +19,8 @@ export class ConsumersComponent extends AbstractList<IAdminConsumerResponse> {
|
||||
private readonly router = inject(Router);
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'نام' },
|
||||
{ field: 'business_counts', header: 'تعداد فعالیت اقتصادی' },
|
||||
{
|
||||
field: 'partner',
|
||||
header: 'ایجاد شده توسط',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'partner.name' },
|
||||
},
|
||||
|
||||
{
|
||||
field: 'status',
|
||||
header: 'وضعیت',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'status.translate' },
|
||||
},
|
||||
// {
|
||||
// field: 'license_expires_at',
|
||||
// header: 'تاریخ انقضا لایسنس',
|
||||
// customDataModel(item) {
|
||||
// if (item.license_info) {
|
||||
// return formatJalali(item.license_info.expires_at);
|
||||
// }
|
||||
// return 'بدون لایسنس';
|
||||
// },
|
||||
// },
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
this.columns = consumerListConfig.columns;
|
||||
}
|
||||
|
||||
override getDataRequest() {
|
||||
return this.service.getAll();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { deviceBrandListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { DeviceBrandFormComponent } from '../components/form.component';
|
||||
import { IDeviceBrandResponse } from '../models';
|
||||
@@ -15,15 +16,7 @@ export class DeviceBrandsComponent extends AbstractList<IDeviceBrandResponse> {
|
||||
private readonly service = inject(DeviceBrandsService);
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
this.columns = deviceBrandListConfig.columns;
|
||||
}
|
||||
|
||||
override getDataRequest() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { deviceListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { UserComplexFormComponent } from '../components/form.component';
|
||||
import { IDeviceResponse } from '../models';
|
||||
@@ -15,21 +16,7 @@ export class DevicesComponent extends AbstractList<IDeviceResponse> {
|
||||
private readonly service = inject(SuperAdminDeviceService);
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{
|
||||
field: 'brand',
|
||||
header: 'برند دستگاه',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'brand.name' },
|
||||
},
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
this.columns = deviceListConfig.columns;
|
||||
}
|
||||
|
||||
override getDataRequest() {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
[fullHeight]="fullHeight"
|
||||
[showAdd]="true"
|
||||
[showEdit]="true"
|
||||
[showAll]="showAllBtn"
|
||||
[allItemsPageRoute]="allItemsPageRoute()"
|
||||
(onEdit)="onEditClick($event)"
|
||||
(onAdd)="openAddForm()"
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { categoryListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, computed, inject, Input } from '@angular/core';
|
||||
import { guildGoodCategoriesNamedRoutes } from '../../constants/routes/goodCategories';
|
||||
import { IGoodCategoriesResponse } from '../../models';
|
||||
@@ -18,16 +19,10 @@ import { GuildGoodCategoryFormComponent } from './form.component';
|
||||
export class GuildGoodCategoriesListComponent extends AbstractList<IGoodCategoriesResponse> {
|
||||
@Input() guildId!: string;
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'goods_count', header: 'تعداد کالاها' },
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
@Input() showAllBtn?: boolean;
|
||||
@Input() header: IColumn[] = categoryListConfig.columns;
|
||||
|
||||
listConfig = categoryListConfig;
|
||||
service = inject(GuildGoodCategoriesService);
|
||||
|
||||
allItemsPageRoute = computed(() =>
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
pageTitle="مدیریت کالاها"
|
||||
[addNewCtaLabel]="'افزودن کالا'"
|
||||
[columns]="columns"
|
||||
[showAdd]="true"
|
||||
emptyPlaceholderTitle="کالایی یافت نشد"
|
||||
emptyPlaceholderDescription="برای افزودن کالای، روی دکمهٔ بالا کلیک کنید."
|
||||
[items]="items()"
|
||||
[loading]="loading()"
|
||||
[showAdd]="true"
|
||||
[showEdit]="true"
|
||||
[showAll]="showAllBtn"
|
||||
[allItemsPageRoute]="showAllPageRoute()"
|
||||
[fullHeight]="fullHeight"
|
||||
(onEdit)="onEditClick($event)"
|
||||
(onAdd)="openAddForm()"
|
||||
|
||||
@@ -4,7 +4,9 @@ import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { goodListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, computed, inject, Input } from '@angular/core';
|
||||
import { guildGoodsNamedRoutes } from '../../constants/routes/goods';
|
||||
import { IGuildGoodsResponse } from '../../models';
|
||||
import { GuildGoodsService } from '../../services/goods.service';
|
||||
import { GuildGoodFormComponent } from './form.component';
|
||||
@@ -17,19 +19,14 @@ import { GuildGoodFormComponent } from './form.component';
|
||||
export class GuildGoodsListComponent extends AbstractList<IGuildGoodsResponse> {
|
||||
@Input() guildId!: string;
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'image_url', header: 'تصویر', type: 'thumbnail' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'sku', header: 'شناسه کالا', type: 'nested', nestedOption: { path: 'sku.name' } },
|
||||
{
|
||||
field: 'category',
|
||||
header: 'دستهبندی',
|
||||
type: 'nested',
|
||||
nestedOption: { path: 'category.name' },
|
||||
},
|
||||
];
|
||||
@Input() showAllBtn?: boolean;
|
||||
@Input() header: IColumn[] = goodListConfig.columns;
|
||||
|
||||
listConfig = goodListConfig;
|
||||
service = inject(GuildGoodsService);
|
||||
|
||||
showAllPageRoute = computed(() => guildGoodsNamedRoutes.goods.meta.pagePath!(this.guildId));
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = this.header;
|
||||
}
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<app-page-data-list
|
||||
[pageTitle]="'مدیریت شناسه کالاها'"
|
||||
[addNewCtaLabel]="'افزودن شناسه'"
|
||||
[columns]="columns"
|
||||
emptyPlaceholderTitle="شناسهای یافت نشد"
|
||||
emptyPlaceholderDescription="برای افزودن شناسه، روی دکمهٔ بالا کلیک کنید."
|
||||
[items]="items()"
|
||||
[loading]="loading()"
|
||||
[fullHeight]="fullHeight"
|
||||
[showAdd]="true"
|
||||
[showEdit]="true"
|
||||
[allItemsPageRoute]="allItemsPageRoute()"
|
||||
(onEdit)="onEditClick($event)"
|
||||
(onAdd)="openAddForm()"
|
||||
(onRefresh)="refresh()"
|
||||
/>
|
||||
|
||||
<stock-keeping-unit-form
|
||||
[(visible)]="visibleForm"
|
||||
[initialValues]="selectedItemForEdit() || undefined"
|
||||
[guildId]="guildId"
|
||||
[editMode]="editMode()"
|
||||
(onSubmit)="refresh()"
|
||||
/>
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||
import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { skuListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, computed, inject, Input } from '@angular/core';
|
||||
import { stockKeepingUnitsNamedRoutes } from '../../constants/routes/stockKeepingUnits';
|
||||
import { IStockKeepingUnitResponse } from '../../models';
|
||||
import { StockKeepingUnitsService } from '../../services/stockKeepingUnits.service';
|
||||
import { StockKeepingUnitFormComponent } from './form.component';
|
||||
|
||||
@Component({
|
||||
selector: 'admin-guild-stock-keeping-units-list',
|
||||
templateUrl: './list.component.html',
|
||||
imports: [PageDataListComponent, StockKeepingUnitFormComponent],
|
||||
})
|
||||
export class GuildStockKeepingUnitsListComponent extends AbstractList<IStockKeepingUnitResponse> {
|
||||
@Input() guildId!: string;
|
||||
@Input() fullHeight?: boolean;
|
||||
@Input() header: IColumn[] = skuListConfig.columns;
|
||||
|
||||
listConfig = skuListConfig;
|
||||
service = inject(StockKeepingUnitsService);
|
||||
|
||||
allItemsPageRoute = computed(() =>
|
||||
stockKeepingUnitsNamedRoutes.stockKeepingUnits.meta.pagePath!(this.guildId),
|
||||
);
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = this.header;
|
||||
}
|
||||
|
||||
override getDataRequest() {
|
||||
return this.service.getAll(this.guildId);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ export const guildGoodsNamedRoutes: NamedRoutes<TGuildGoodsRouteNames> = {
|
||||
// @ts-ignore
|
||||
meta: {
|
||||
title: 'کالاها',
|
||||
pagePath: (guildId: string) => `/super_admin/guilds/${guildId}/goods`,
|
||||
},
|
||||
},
|
||||
// goodCategory: {
|
||||
|
||||
@@ -8,7 +8,7 @@ export const stockKeepingUnitsNamedRoutes: NamedRoutes<TStockKeepingUnitsRouteNa
|
||||
path: 'stock-keeping-units',
|
||||
loadComponent: () =>
|
||||
import('../../views/stockKeepingUnits/list.component').then(
|
||||
(m) => m.StockKeepingUnitsComponent,
|
||||
(m) => m.GuildStockKeepingUnitsComponent,
|
||||
),
|
||||
meta: {
|
||||
title: 'شناسه کالاها',
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import { EntityState, EntityStore } from '@/core/state';
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { defaultBaseStateData, EntityState, EntityStore } from '@/core/state';
|
||||
import { computed, inject, Injectable } from '@angular/core';
|
||||
import { MenuItem } from 'primeng/api';
|
||||
import { catchError, finalize } from 'rxjs';
|
||||
import { guildsNamedRoutes } from '../constants';
|
||||
import { IGuildResponse } from '../models';
|
||||
import { GuildsService } from '../services/main.service';
|
||||
|
||||
interface GuildState extends EntityState<IGuildResponse> {}
|
||||
interface GuildState extends EntityState<IGuildResponse> {
|
||||
breadcrumbItems: MenuItem[];
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -13,11 +17,25 @@ export class GuildStore extends EntityStore<IGuildResponse, GuildState> {
|
||||
private readonly service = inject(GuildsService);
|
||||
constructor() {
|
||||
super({
|
||||
loading: false,
|
||||
error: null,
|
||||
entity: null,
|
||||
initialized: false,
|
||||
isRefreshing: false,
|
||||
...defaultBaseStateData,
|
||||
breadcrumbItems: [],
|
||||
});
|
||||
}
|
||||
|
||||
breadcrumbItems = computed(() => this._state().breadcrumbItems);
|
||||
|
||||
private setBreadcrumb(guildId: string) {
|
||||
this.patchState({
|
||||
breadcrumbItems: [
|
||||
{
|
||||
...guildsNamedRoutes.guilds.meta,
|
||||
routerLink: guildsNamedRoutes.guilds.meta.pagePath!(),
|
||||
},
|
||||
{
|
||||
title: this.entity()?.name,
|
||||
routerLink: guildsNamedRoutes.guild.meta.pagePath!(guildId),
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -36,16 +54,14 @@ export class GuildStore extends EntityStore<IGuildResponse, GuildState> {
|
||||
)
|
||||
.subscribe((entity) => {
|
||||
this.patchState({ entity });
|
||||
this.setBreadcrumb(guildId);
|
||||
});
|
||||
}
|
||||
|
||||
override reset(): void {
|
||||
this.setState({
|
||||
loading: false,
|
||||
error: null,
|
||||
entity: null,
|
||||
initialized: false,
|
||||
isRefreshing: false,
|
||||
...defaultBaseStateData,
|
||||
breadcrumbItems: [],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { BreadcrumbService } from '@/core/services';
|
||||
import pageParamsUtils from '@/utils/page-params.utils';
|
||||
import { Component, computed, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { GuildGoodCategoriesListComponent } from '../../components/categories/list.component';
|
||||
import { guildGoodCategoriesNamedRoutes } from '../../constants/routes/goodCategories';
|
||||
import { GuildStore } from '../../store/guild.store';
|
||||
|
||||
@Component({
|
||||
selector: 'admin-guild-good-categories',
|
||||
@@ -10,6 +14,22 @@ import { GuildGoodCategoriesListComponent } from '../../components/categories/li
|
||||
})
|
||||
export class GuildGoodCategoriesComponent {
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly breadcrumbService = inject(BreadcrumbService);
|
||||
private readonly store = inject(GuildStore);
|
||||
|
||||
readonly guildId = signal<string>(this.route.snapshot.paramMap.get('guildId')!);
|
||||
pageParams = computed(() => pageParamsUtils(this.route));
|
||||
readonly guildId = signal<string>(this.pageParams()['guildId']!);
|
||||
|
||||
ngOnInit() {
|
||||
this.setBreadcrumb();
|
||||
}
|
||||
|
||||
setBreadcrumb() {
|
||||
this.breadcrumbService.setItems([
|
||||
...this.store.breadcrumbItems(),
|
||||
{
|
||||
title: guildGoodCategoriesNamedRoutes.goodCategories.meta.title,
|
||||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,35 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { BreadcrumbService } from '@/core/services';
|
||||
import pageParamsUtils from '@/utils/page-params.utils';
|
||||
import { Component, computed, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { GuildGoodsListComponent } from '../../components/goods/list.component';
|
||||
import { guildGoodsNamedRoutes } from '../../constants/routes/goods';
|
||||
import { GuildStore } from '../../store/guild.store';
|
||||
|
||||
@Component({
|
||||
selector: 'admin-guild_goods',
|
||||
selector: 'admin-guild-goods',
|
||||
templateUrl: './list.component.html',
|
||||
imports: [GuildGoodsListComponent],
|
||||
})
|
||||
export class GuildGoodsComponent {
|
||||
route = inject(ActivatedRoute);
|
||||
guildId = signal<string>(this.route.snapshot.paramMap.get('guildId')!);
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly breadcrumbService = inject(BreadcrumbService);
|
||||
private readonly store = inject(GuildStore);
|
||||
|
||||
pageParams = computed(() => pageParamsUtils(this.route));
|
||||
readonly guildId = signal<string>(this.pageParams()['guildId']!);
|
||||
|
||||
ngOnInit() {
|
||||
this.setBreadcrumb();
|
||||
}
|
||||
|
||||
setBreadcrumb() {
|
||||
this.breadcrumbService.setItems([
|
||||
...this.store.breadcrumbItems(),
|
||||
{
|
||||
title: guildGoodsNamedRoutes.goods.meta.title,
|
||||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ export class GuildsComponent extends AbstractList<IGuildResponse> {
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'code', header: 'کد' },
|
||||
{ field: 'businessActivitiesCount', header: 'تعداد فعالیتهای اقتصادی مرتبط' },
|
||||
|
||||
@@ -9,10 +9,13 @@
|
||||
</app-card-data>
|
||||
|
||||
<div class="max-h-125 flex">
|
||||
<admin-guild-good-categories-list [guildId]="guildId()" class="w-full" />
|
||||
<admin-guild-good-categories-list [guildId]="guildId()" [showAllBtn]="true" class="w-full" />
|
||||
</div>
|
||||
<div class="max-h-125 flex">
|
||||
<admin-guild-goods-list [guildId]="guildId()" class="w-full" />
|
||||
<admin-guild-goods-list [guildId]="guildId()" [showAllBtn]="true" class="w-full" />
|
||||
</div>
|
||||
<div class="max-h-125 flex">
|
||||
<admin-guild-stock-keeping-units-list [guildId]="guildId()" class="w-full" />
|
||||
</div>
|
||||
|
||||
<admin-guild-form
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { BreadcrumbService } from '@/core/services';
|
||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||
import { Component, computed, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { GuildGoodCategoriesListComponent } from '../components/categories/list.component';
|
||||
import { GuildFormComponent } from '../components/form.component';
|
||||
import { GuildGoodsListComponent } from '../components/goods/list.component';
|
||||
import { GuildStockKeepingUnitsListComponent } from '../components/stockKeepingUnits/list.component';
|
||||
import { GuildStore } from '../store/guild.store';
|
||||
|
||||
@Component({
|
||||
@@ -14,11 +16,13 @@ import { GuildStore } from '../store/guild.store';
|
||||
KeyValueComponent,
|
||||
GuildGoodCategoriesListComponent,
|
||||
GuildGoodsListComponent,
|
||||
GuildStockKeepingUnitsListComponent,
|
||||
GuildFormComponent,
|
||||
],
|
||||
})
|
||||
export class GuildComponent {
|
||||
private readonly store = inject(GuildStore);
|
||||
private readonly breadcrumbService = inject(BreadcrumbService);
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
|
||||
readonly guildId = signal<string>(this.route.snapshot.paramMap.get('guildId')!);
|
||||
@@ -30,4 +34,12 @@ export class GuildComponent {
|
||||
getData() {
|
||||
this.store.getData(this.guildId());
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.setBreadcrumb();
|
||||
}
|
||||
|
||||
setBreadcrumb() {
|
||||
this.breadcrumbService.setItems([...this.store.breadcrumbItems()]);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-22
@@ -1,22 +1 @@
|
||||
<app-page-data-list
|
||||
[pageTitle]="'مدیریت شناسه کالاها'"
|
||||
[addNewCtaLabel]="'افزودن شناسه کالا'"
|
||||
[columns]="columns"
|
||||
emptyPlaceholderTitle="شناسه کالایی یافت نشد"
|
||||
emptyPlaceholderDescription="برای افزودن شناسه کالا، روی دکمهٔ بالا کلیک کنید."
|
||||
[items]="items()"
|
||||
[loading]="loading()"
|
||||
[showDetails]="false"
|
||||
[showAdd]="true"
|
||||
(onAdd)="openAddForm()"
|
||||
(onRefresh)="refresh()"
|
||||
>
|
||||
</app-page-data-list>
|
||||
<stock-keeping-unit-form
|
||||
[guildId]="guildId()"
|
||||
[(visible)]="visibleForm"
|
||||
[initialValues]="selectedItemForEdit()!"
|
||||
[editMode]="false"
|
||||
[stockKeepingUnitId]="selectedItemForEdit()?.id"
|
||||
(onSubmit)="refresh()"
|
||||
/>
|
||||
<admin-guild-stock-keeping-units-list [guildId]="guildId()" class="w-full" />
|
||||
|
||||
+20
-18
@@ -1,33 +1,35 @@
|
||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { BreadcrumbService } from '@/core/services';
|
||||
import pageParamsUtils from '@/utils/page-params.utils';
|
||||
import { Component, computed, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { StockKeepingUnitFormComponent } from '../../components/stockKeepingUnits/form.component';
|
||||
import { IStockKeepingUnitResponse } from '../../models';
|
||||
import { StockKeepingUnitsService } from '../../services/stockKeepingUnits.service';
|
||||
import { GuildStockKeepingUnitsListComponent } from '../../components/stockKeepingUnits/list.component';
|
||||
import { stockKeepingUnitsNamedRoutes } from '../../constants/routes/stockKeepingUnits';
|
||||
import { GuildStore } from '../../store/guild.store';
|
||||
|
||||
@Component({
|
||||
selector: 'superAdmin-stockKeepingUnits',
|
||||
selector: 'admin-guild-stock-keeping-units',
|
||||
templateUrl: './list.component.html',
|
||||
imports: [PageDataListComponent, StockKeepingUnitFormComponent],
|
||||
imports: [GuildStockKeepingUnitsListComponent],
|
||||
})
|
||||
export class StockKeepingUnitsComponent extends AbstractList<IStockKeepingUnitResponse> {
|
||||
export class GuildStockKeepingUnitsComponent {
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly breadcrumbService = inject(BreadcrumbService);
|
||||
private readonly store = inject(GuildStore);
|
||||
|
||||
pageParams = computed(() => pageParamsUtils(this.route));
|
||||
readonly guildId = signal<string>(this.pageParams()['guildId']!);
|
||||
|
||||
private readonly service = inject(StockKeepingUnitsService);
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
{ field: 'code', header: 'کد' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'VAT', header: 'مالیات ارزش افزوده' },
|
||||
];
|
||||
ngOnInit() {
|
||||
this.setBreadcrumb();
|
||||
}
|
||||
|
||||
override getDataRequest() {
|
||||
return this.service.getAll(this.guildId());
|
||||
setBreadcrumb() {
|
||||
this.breadcrumbService.setItems([
|
||||
...this.store.breadcrumbItems(),
|
||||
{
|
||||
title: stockKeepingUnitsNamedRoutes.stockKeepingUnits.meta.title,
|
||||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { licenseListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { ILicenseRawResponse, ILicenseResponse } from '../models';
|
||||
import { ILicenseResponse } from '../models';
|
||||
import { LicensesService } from '../services/main.service';
|
||||
|
||||
@Component({
|
||||
@@ -14,24 +15,7 @@ export class LicensesComponent extends AbstractList<ILicenseResponse> {
|
||||
private readonly service = inject(LicensesService);
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
{
|
||||
field: 'consumer',
|
||||
header: 'مشتری',
|
||||
customDataModel(item) {
|
||||
return `${item.consumer.first_name} ${item.consumer.last_name}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'partner',
|
||||
header: 'ارایه شده توسط',
|
||||
customDataModel(item: ILicenseRawResponse) {
|
||||
return item.license.charged_license_transaction.partner.name || 'برند نرمافزار';
|
||||
},
|
||||
},
|
||||
{ field: 'expires_at', header: 'تاریخ انقضا', type: 'date' },
|
||||
{ field: 'created_at', header: 'تاریخ ایجاد', type: 'date' },
|
||||
];
|
||||
this.columns = licenseListConfig.columns;
|
||||
}
|
||||
|
||||
override getDataRequest() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { partnerListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject, TemplateRef, ViewChild } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Avatar } from 'primeng/avatar';
|
||||
@@ -24,30 +25,15 @@ export class PartnersComponent extends AbstractList<IPartnerResponse> {
|
||||
@ViewChild('licensesRenewStatus', { static: true }) licensesRenewStatus!: TemplateRef<any>;
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
{ field: 'name', header: 'عنوان', customDataModel: this.name },
|
||||
{ field: 'code', header: 'کد' },
|
||||
{ field: 'licenses', header: 'تعداد لایسنسها', customDataModel: this.licensesStatus },
|
||||
{
|
||||
field: 'account_quota',
|
||||
header: 'تعداد کاربرهای خریداری شده',
|
||||
customDataModel: this.accountQuotaStatus,
|
||||
},
|
||||
{
|
||||
field: 'license_renew',
|
||||
header: 'تعداد لایسنس تمدیدی',
|
||||
customDataModel: this.licensesRenewStatus,
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
header: 'وضعیت',
|
||||
type: 'nested',
|
||||
variant: 'tag',
|
||||
nestedOption: {
|
||||
path: 'status.translate',
|
||||
},
|
||||
},
|
||||
];
|
||||
this.columns = partnerListConfig.columns.map((col) => {
|
||||
if (col.field === 'name') return { ...col, customDataModel: this.name };
|
||||
if (col.field === 'licenses') return { ...col, customDataModel: this.licensesStatus };
|
||||
if (col.field === 'account_quota')
|
||||
return { ...col, customDataModel: this.accountQuotaStatus };
|
||||
if (col.field === 'license_renew')
|
||||
return { ...col, customDataModel: this.licensesRenewStatus };
|
||||
return col;
|
||||
});
|
||||
}
|
||||
|
||||
override getDataRequest() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { providerListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { ProviderFormComponent } from '../components/form.component';
|
||||
import { IProviderResponse } from '../models';
|
||||
@@ -15,15 +16,7 @@ export class ProvidersComponent extends AbstractList<IProviderResponse> {
|
||||
private readonly service = inject(ProvidersService);
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
// { field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'نام' },
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
this.columns = providerListConfig.columns;
|
||||
}
|
||||
|
||||
override getDataRequest() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { userListConfig } from '@/shared/constants/list-configs';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { UserAccountFormComponent } from '../components/form.component';
|
||||
@@ -18,16 +19,7 @@ export class UsersComponent extends AbstractList<IUserResponse> {
|
||||
private readonly router = inject(Router);
|
||||
|
||||
override setColumns(): void {
|
||||
this.columns = [
|
||||
{ field: 'fullname', header: 'نام' },
|
||||
{ field: 'mobile_number', header: 'شماره موبایل' },
|
||||
{ field: 'national_code', header: 'کد ملی' },
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
type: 'date',
|
||||
},
|
||||
];
|
||||
this.columns = userListConfig.columns;
|
||||
}
|
||||
|
||||
override getDataRequest() {
|
||||
|
||||
Reference in New Issue
Block a user