diff --git a/src/app/domains/pos/models/pos.io.ts b/src/app/domains/pos/models/pos.io.ts
index ffa07b2..82ca4c2 100644
--- a/src/app/domains/pos/models/pos.io.ts
+++ b/src/app/domains/pos/models/pos.io.ts
@@ -5,16 +5,10 @@ export interface IPosInfoRawResponse {
complex: {
id: string;
name: string;
- tax_id: string;
- };
- businessActivity: {
- id: string;
- name: string;
- };
- guild: {
- id: string;
- name: string;
+ branch_code: string;
};
+ businessActivity: ISummary;
+ guild: ISummary;
}
export interface IPosInfoResponse extends IPosInfoRawResponse {}
diff --git a/src/app/domains/superAdmin/modules/consumers/components/complexes/form.component.html b/src/app/domains/superAdmin/modules/consumers/components/complexes/form.component.html
index 394ad56..248f2ba 100644
--- a/src/app/domains/superAdmin/modules/consumers/components/complexes/form.component.html
+++ b/src/app/domains/superAdmin/modules/consumers/components/complexes/form.component.html
@@ -8,7 +8,7 @@
>
diff --git a/src/app/domains/superAdmin/modules/consumers/components/complexes/form.component.ts b/src/app/domains/superAdmin/modules/consumers/components/complexes/form.component.ts
index fa20e61..f6e8c72 100644
--- a/src/app/domains/superAdmin/modules/consumers/components/complexes/form.component.ts
+++ b/src/app/domains/superAdmin/modules/consumers/components/complexes/form.component.ts
@@ -26,7 +26,7 @@ export class ConsumerComplexFormComponent extends AbstractFormDialog<
initForm = () => {
return this.fb.group({
name: [this.initialValues?.name || '', [Validators.required]],
- tax_id: [this.initialValues?.tax_id || '', [Validators.required]],
+ branch_code: [this.initialValues?.branch_code || ''],
address: [this.initialValues?.address || '', [Validators.required]],
});
};
@@ -34,7 +34,7 @@ export class ConsumerComplexFormComponent extends AbstractFormDialog<
form = this.initForm();
get preparedTitle() {
- return `${this.editMode ? 'ویرایش' : 'ایجاد'} فروشگاه`;
+ return `${this.editMode ? 'ویرایش' : 'ایجاد'} شعبه`;
}
override ngOnChanges(): void {
diff --git a/src/app/domains/superAdmin/modules/consumers/components/complexes/list.component.html b/src/app/domains/superAdmin/modules/consumers/components/complexes/list.component.html
index b1a1dfa..43caa30 100644
--- a/src/app/domains/superAdmin/modules/consumers/components/complexes/list.component.html
+++ b/src/app/domains/superAdmin/modules/consumers/components/complexes/list.component.html
@@ -1,10 +1,10 @@
m.SuperAdminUserComplexesComponent,
),
meta: {
- title: 'فروشگاهها',
+ title: 'شعب',
pagePath: (consumerId: string, businessId: string) => baseUrl(consumerId, businessId),
},
},
@@ -26,7 +26,7 @@ export const superAdminConsumerComplexesNamedRoutes: NamedRoutes m.SuperAdminUserComplexComponent,
),
meta: {
- title: 'فروشگاه',
+ title: 'شعبه',
pagePath: (consumerId: string, businessId: string, complexId: string) =>
`${baseUrl(consumerId, businessId)}/${complexId}`,
},
diff --git a/src/app/domains/superAdmin/modules/consumers/models/complexes_io.d.ts b/src/app/domains/superAdmin/modules/consumers/models/complexes_io.d.ts
index ba9ebe0..8ea2421 100644
--- a/src/app/domains/superAdmin/modules/consumers/models/complexes_io.d.ts
+++ b/src/app/domains/superAdmin/modules/consumers/models/complexes_io.d.ts
@@ -1,7 +1,7 @@
export interface IComplexRawResponse {
name: string;
address: string;
- tax_id: string;
+ branch_code: string;
id: string;
}
export interface IComplexResponse extends IComplexRawResponse {}
@@ -9,5 +9,5 @@ export interface IComplexResponse extends IComplexRawResponse {}
export interface IComplexRequest {
name: string;
address: string;
- tax_id: string;
+ branch_code: string;
}
diff --git a/src/app/domains/superAdmin/modules/consumers/views/complexes/single.component.html b/src/app/domains/superAdmin/modules/consumers/views/complexes/single.component.html
index c3c9790..01192fb 100644
--- a/src/app/domains/superAdmin/modules/consumers/views/complexes/single.component.html
+++ b/src/app/domains/superAdmin/modules/consumers/views/complexes/single.component.html
@@ -1,9 +1,8 @@
-
+
diff --git a/src/app/domains/superAdmin/modules/consumers/views/single.component.html b/src/app/domains/superAdmin/modules/consumers/views/single.component.html
index d9793dc..6f77378 100644
--- a/src/app/domains/superAdmin/modules/consumers/views/single.component.html
+++ b/src/app/domains/superAdmin/modules/consumers/views/single.component.html
@@ -19,7 +19,7 @@
تا تاریخ
-
+
} @else {
ارایه نشده
diff --git a/src/app/domains/superAdmin/modules/partners/components/chargeAccount/charge-account-form-dialog.component.html b/src/app/domains/superAdmin/modules/partners/components/chargeAccount/charge-account-form-dialog.component.html
new file mode 100644
index 0000000..b08ad5d
--- /dev/null
+++ b/src/app/domains/superAdmin/modules/partners/components/chargeAccount/charge-account-form-dialog.component.html
@@ -0,0 +1,19 @@
+
+
+
diff --git a/src/app/domains/superAdmin/modules/partners/components/chargeAccount/charge-account-form-dialog.component.ts b/src/app/domains/superAdmin/modules/partners/components/chargeAccount/charge-account-form-dialog.component.ts
new file mode 100644
index 0000000..0df0b11
--- /dev/null
+++ b/src/app/domains/superAdmin/modules/partners/components/chargeAccount/charge-account-form-dialog.component.ts
@@ -0,0 +1,41 @@
+import { AbstractFormDialog } from '@/shared/abstractClasses';
+import { InputComponent } from '@/shared/components';
+import { FormFooterActionsComponent } from '@/shared/components/formFooterActions/form-footer-actions.component';
+import { UikitFlatpickrJalaliComponent } from '@/uikit';
+import { nowJalali } from '@/utils';
+import { Component, inject, Input } from '@angular/core';
+import { ReactiveFormsModule, Validators } from '@angular/forms';
+import { Dialog } from 'primeng/dialog';
+import { IPartnerChargeAccountRequest } from '../../models/chargeAccount_io';
+import { AdminPartnerChargeAccountService } from '../../services/chargeAccount.service';
+
+@Component({
+ selector: 'partner-charge-account-form-dialog',
+ templateUrl: './charge-account-form-dialog.component.html',
+ imports: [
+ Dialog,
+ ReactiveFormsModule,
+ InputComponent,
+ FormFooterActionsComponent,
+ UikitFlatpickrJalaliComponent,
+ ],
+})
+export class PartnerChargeAccountFormDialogComponent extends AbstractFormDialog<
+ IPartnerChargeAccountRequest,
+ any
+> {
+ @Input({ required: true }) partnerId!: string;
+
+ private readonly service = inject(AdminPartnerChargeAccountService);
+
+ form = this.fb.group({
+ quantity: [0, [Validators.required, Validators.min(1)]],
+ activated_expires_at: ['', [Validators.required]],
+ });
+
+ minDate = nowJalali();
+
+ submitForm(payload: IPartnerChargeAccountRequest) {
+ return this.service.charge(this.partnerId, payload);
+ }
+}
diff --git a/src/app/domains/superAdmin/modules/partners/components/chargeAccount/list.component.html b/src/app/domains/superAdmin/modules/partners/components/chargeAccount/list.component.html
new file mode 100644
index 0000000..c56f20a
--- /dev/null
+++ b/src/app/domains/superAdmin/modules/partners/components/chargeAccount/list.component.html
@@ -0,0 +1,8 @@
+
+
diff --git a/src/app/domains/superAdmin/modules/partners/components/chargeAccount/list.component.ts b/src/app/domains/superAdmin/modules/partners/components/chargeAccount/list.component.ts
new file mode 100644
index 0000000..ec47171
--- /dev/null
+++ b/src/app/domains/superAdmin/modules/partners/components/chargeAccount/list.component.ts
@@ -0,0 +1,45 @@
+import { AbstractList } from '@/shared/abstractClasses/abstract-list';
+import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
+import { Component, inject, Input } from '@angular/core';
+import { IPartnerChargeAccountRawResponse } from '../../models';
+import { AdminPartnerChargeAccountService } from '../../services/chargeAccount.service';
+
+@Component({
+ selector: 'admin-partner-chargeAccount-list',
+ templateUrl: './list.component.html',
+ imports: [PageDataListComponent],
+})
+export class AdminPartnerChargeAccountListComponent extends AbstractList {
+ @Input({ required: true }) partnerId!: string;
+
+ private readonly service = inject(AdminPartnerChargeAccountService);
+
+ override setColumns(): void {
+ this.columns = [
+ { field: 'tracking_code', header: 'کد پیگیری' },
+ { field: 'charged_license_count', header: 'تعداد شارژ کاربر' },
+ { field: 'remained_license_count', header: 'شارژ باقی مانده' },
+ {
+ field: 'activation_count',
+ header: 'مقدار مصرف شده',
+ },
+ {
+ field: 'activation_expires_at',
+ header: 'تاریخ انقضا',
+ type: 'date',
+ dateOption: {
+ expiredMode: true,
+ },
+ },
+ {
+ field: 'created_at',
+ header: 'تاریخ ایجاد',
+ type: 'date',
+ },
+ ];
+ }
+
+ override getDataRequest() {
+ return this.service.getAll(this.partnerId);
+ }
+}
diff --git a/src/app/domains/superAdmin/modules/partners/components/chargeLicenseTransactions/list.component.ts b/src/app/domains/superAdmin/modules/partners/components/chargeLicenseTransactions/list.component.ts
index 082f299..e5977d6 100644
--- a/src/app/domains/superAdmin/modules/partners/components/chargeLicenseTransactions/list.component.ts
+++ b/src/app/domains/superAdmin/modules/partners/components/chargeLicenseTransactions/list.component.ts
@@ -21,7 +21,7 @@ export class AdminPartnerChargeLicenseTransactionListComponent extends AbstractL
{ field: 'charged_license_count', header: 'لایسنسهای خریداری شده' },
{ field: 'remained_license_count', header: 'لایسنسهای باقیمانده' },
{
- field: 'activated_license_count',
+ field: 'activation_count',
header: 'لایسنسهای فروخته شده',
},
{
diff --git a/src/app/domains/superAdmin/modules/partners/components/licenses/list.component.ts b/src/app/domains/superAdmin/modules/partners/components/licenses/list.component.ts
index 2a20d39..2d85202 100644
--- a/src/app/domains/superAdmin/modules/partners/components/licenses/list.component.ts
+++ b/src/app/domains/superAdmin/modules/partners/components/licenses/list.component.ts
@@ -21,8 +21,8 @@ export class AdminPartnerLicensesComponent extends AbstractList
+ `/api/v1/admin/partners/${partnerId}/charge-account-transactions`;
+
+export const PARTNER_CHARGE_ACCOUNT_API_ROUTES = {
+ single: (partnerId: string) => `${baseUrl(partnerId)}`,
+};
diff --git a/src/app/domains/superAdmin/modules/partners/constants/apiRoutes/index.ts b/src/app/domains/superAdmin/modules/partners/constants/apiRoutes/index.ts
index 9afbefd..037b8dc 100644
--- a/src/app/domains/superAdmin/modules/partners/constants/apiRoutes/index.ts
+++ b/src/app/domains/superAdmin/modules/partners/constants/apiRoutes/index.ts
@@ -1,5 +1,6 @@
export * from './accounts';
export * from './activatedLicenses';
+export * from './chargeAccount';
export * from './chargeLicenseTransactions';
const baseUrl = '/api/v1/admin/partners';
@@ -7,5 +8,6 @@ const baseUrl = '/api/v1/admin/partners';
export const PARTNERS_API_ROUTES = {
list: () => `${baseUrl}`,
single: (id: string) => `${baseUrl}/${id}`,
+ accountCharge: (id: string) => `${baseUrl}/${id}/charge-account-transactions`,
licenseCharge: (id: string) => `${baseUrl}/${id}/charge-license`,
};
diff --git a/src/app/domains/superAdmin/modules/partners/models/activatedLicenses_io.d.ts b/src/app/domains/superAdmin/modules/partners/models/activatedLicenses_io.d.ts
index 0a2e23a..c1995d0 100644
--- a/src/app/domains/superAdmin/modules/partners/models/activatedLicenses_io.d.ts
+++ b/src/app/domains/superAdmin/modules/partners/models/activatedLicenses_io.d.ts
@@ -1,11 +1,19 @@
+import ISummary from '@/core/models/summary';
+
export interface IPartnerActivatedLicenseRawResponse {
id: string;
starts_at: string;
expires_at: string;
- consumer: {
- first_name: string;
- last_name: string;
- mobile_number: string;
- };
+ business_activity: BusinessActivity;
}
export interface IPartnerActivatedLicenseResponse extends IPartnerActivatedLicenseRawResponse {}
+
+interface BusinessActivity extends ISummary {
+ consumer: Consumer;
+}
+
+interface Consumer {
+ id: string;
+ first_name: string;
+ last_name: string;
+}
diff --git a/src/app/domains/superAdmin/modules/partners/models/chargeAccount_io.d.ts b/src/app/domains/superAdmin/modules/partners/models/chargeAccount_io.d.ts
new file mode 100644
index 0000000..2982f90
--- /dev/null
+++ b/src/app/domains/superAdmin/modules/partners/models/chargeAccount_io.d.ts
@@ -0,0 +1,16 @@
+export interface IPartnerChargeAccountRawResponse {
+ id: string;
+ created_at: string;
+ tracking_code: string;
+ activation_expires_at: string;
+ charged_license_count: number;
+ activated_license_count: number;
+ remained_license_count: number;
+}
+
+export interface IPartnerChargeAccountResponse extends IPartnerChargeAccountRawResponse {}
+
+export interface IPartnerChargeAccountRequest {
+ quantity: number;
+ activated_expires_at: string;
+}
diff --git a/src/app/domains/superAdmin/modules/partners/models/index.ts b/src/app/domains/superAdmin/modules/partners/models/index.ts
index 2a352fb..5b5f186 100644
--- a/src/app/domains/superAdmin/modules/partners/models/index.ts
+++ b/src/app/domains/superAdmin/modules/partners/models/index.ts
@@ -1,4 +1,5 @@
export * from './accounts_io';
export * from './activatedLicenses_io';
+export * from './chargeAccount_io';
export * from './chargeLicenseTransactions_io';
export * from './io';
diff --git a/src/app/domains/superAdmin/modules/partners/models/io.d.ts b/src/app/domains/superAdmin/modules/partners/models/io.d.ts
index d62470d..e2b47ea 100644
--- a/src/app/domains/superAdmin/modules/partners/models/io.d.ts
+++ b/src/app/domains/superAdmin/modules/partners/models/io.d.ts
@@ -9,6 +9,11 @@ export interface IPartnerRawResponse {
used: number;
expired: number;
};
+ account_quota_status: {
+ total: number;
+ used: number;
+ expired: number;
+ };
}
export interface IPartnerResponse extends IPartnerRawResponse {}
diff --git a/src/app/domains/superAdmin/modules/partners/services/chargeAccount.service.ts b/src/app/domains/superAdmin/modules/partners/services/chargeAccount.service.ts
new file mode 100644
index 0000000..6d41840
--- /dev/null
+++ b/src/app/domains/superAdmin/modules/partners/services/chargeAccount.service.ts
@@ -0,0 +1,30 @@
+import { IPaginatedResponse } from '@/core/models/service.model';
+import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+import { Observable } from 'rxjs';
+import { PARTNER_CHARGE_ACCOUNT_API_ROUTES } from '../constants';
+import {
+ IPartnerChargeAccountRawResponse,
+ IPartnerChargeAccountRequest,
+ IPartnerChargeAccountResponse,
+} from '../models';
+
+@Injectable({ providedIn: 'root' })
+export class AdminPartnerChargeAccountService {
+ constructor(private http: HttpClient) {}
+
+ private apiRoutes = PARTNER_CHARGE_ACCOUNT_API_ROUTES;
+
+ getAll(partnerId: string): Observable> {
+ return this.http.get>(
+ this.apiRoutes.single(partnerId),
+ );
+ }
+
+ charge(
+ partnerId: string,
+ data: IPartnerChargeAccountRequest,
+ ): Observable {
+ return this.http.post(this.apiRoutes.single(partnerId), data);
+ }
+}
diff --git a/src/app/domains/superAdmin/modules/partners/views/single.component.html b/src/app/domains/superAdmin/modules/partners/views/single.component.html
index 97dc7f8..b0b93ea 100644
--- a/src/app/domains/superAdmin/modules/partners/views/single.component.html
+++ b/src/app/domains/superAdmin/modules/partners/views/single.component.html
@@ -1,12 +1,14 @@
+ شارژ کاربر
شارژ لایسنس
+
اطلاعات لایسنسها
@@ -18,6 +20,18 @@
(partner()?.licenses_status?.expired || 0)
"
/>
+
اطلاعات شارژ کاربران
+
+
+
+
@@ -30,6 +44,10 @@
+
+
@@ -48,3 +66,9 @@
[partnerId]="partnerId()"
(onSubmit)="getData()"
/>
+
+
diff --git a/src/app/domains/superAdmin/modules/partners/views/single.component.ts b/src/app/domains/superAdmin/modules/partners/views/single.component.ts
index 6a49f67..cb1fc73 100644
--- a/src/app/domains/superAdmin/modules/partners/views/single.component.ts
+++ b/src/app/domains/superAdmin/modules/partners/views/single.component.ts
@@ -3,8 +3,11 @@ import { AppCardComponent, KeyValueComponent } from '@/shared/components';
import { Component, computed, effect, inject, signal } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Button } from 'primeng/button';
+import { Divider } from 'primeng/divider';
import { ConsumerAccountListComponent } from '../components/accounts/list.component';
import { PartnerChargeLicenseFormDialogComponent } from '../components/charge-license-form-dialog.component';
+import { PartnerChargeAccountFormDialogComponent } from '../components/chargeAccount/charge-account-form-dialog.component';
+import { AdminPartnerChargeAccountListComponent } from '../components/chargeAccount/list.component';
import { AdminPartnerChargeLicenseTransactionListComponent } from '../components/chargeLicenseTransactions/list.component';
import { GuildFormComponent } from '../components/form.component';
import { AdminPartnerLicensesComponent } from '../components/licenses/list.component';
@@ -20,9 +23,12 @@ import { PartnerStore } from '../store/partner.store';
GuildFormComponent,
ConsumerAccountListComponent,
Button,
+ AdminPartnerChargeAccountListComponent,
+ PartnerChargeAccountFormDialogComponent,
PartnerChargeLicenseFormDialogComponent,
AdminPartnerLicensesComponent,
AdminPartnerChargeLicenseTransactionListComponent,
+ Divider,
],
})
export class PartnerComponent {
@@ -36,6 +42,7 @@ export class PartnerComponent {
readonly loading = computed(() => this.store.loading());
readonly partner = computed(() => this.store.entity());
visibleChargeFormDialog = signal(false);
+ visibleChargeAccountFormDialog = signal(false);
constructor() {
effect(() => {
@@ -64,4 +71,8 @@ export class PartnerComponent {
openChargeDialog() {
this.visibleChargeFormDialog.set(true);
}
+
+ openChargeAccountDialog() {
+ this.visibleChargeAccountFormDialog.set(true);
+ }
}
diff --git a/src/app/modules/pos/views/pos.component.html b/src/app/modules/pos/views/pos.component.html
index 472e418..d55d784 100644
--- a/src/app/modules/pos/views/pos.component.html
+++ b/src/app/modules/pos/views/pos.component.html
@@ -4,7 +4,7 @@
- {{ info()?.name }} - فروشگاه {{ info()?.inventory?.name }}
+ {{ info()?.name }} - شعبه {{ info()?.inventory?.name }}