feat: Refactor sale invoice store to use new response model and improve state management

fix: Update single component to correctly bind invoice data

feat: Enhance partner info model with detailed license status

refactor: Simplify account list component by removing unnecessary details

fix: Correctly reference username in consumer account form

feat: Add POS related fields to consumer account list

chore: Update models to include charge account details for partners

feat: Implement charge account dialog for partner consumers

feat: Create API routes for accounts charge functionality

feat: Add charge account service for handling requests

feat: Introduce license info template component for dashboard

refactor: Update dashboard view to display license information

fix: Improve layout component to handle POS information more effectively

chore: Clean up unused imports and components in various files

feat: Add loading state handling in landing views

feat: Implement charge account form dialog for partner consumers
This commit is contained in:
2026-04-25 15:19:19 +03:30
parent a816c05777
commit 095ae31249
53 changed files with 554 additions and 196 deletions
@@ -4,11 +4,13 @@
<div class="w-svw h-svh bg-surface-ground flex flex-col gap-4 p-4">
<div class="w-full flex items-center gap-4 shrink-0 justify-between">
<div class="flex gap-2 items-center">
<div class="w-10 h-10">
<img [src]="placeholderLogo" alt="Logo" class="w-full h-full object-cover rounded-md bg-surface-card" />
</div>
@if (posInfo()) {
<span class="text-lg font-bold">{{ posInfo()?.name }} - شعبه {{ posInfo()?.complex?.name }}</span>
<div class="w-10 h-10">
<img [src]="placeholderLogo" alt="Logo" class="w-full h-full object-cover rounded-md bg-surface-card" />
</div>
<span class="text-lg font-bold">
{{ posInfo()?.name }} ({{ posInfo()?.complex!.name }} - {{ posInfo()?.businessActivity!.name }})
</span>
}
</div>
<div class="flex gap-2 items-center">
+13 -10
View File
@@ -8,8 +8,7 @@ import { ButtonDirective } from 'primeng/button';
import { Card } from 'primeng/card';
import { Menu } from 'primeng/menu';
import images from 'src/assets/images';
import { PosProfileStore } from '../store';
import { PosStore } from '../store/pos.store';
import { PosInfoStore, PosProfileStore } from '../store';
import { PosChooseCardsComponent } from './choose-pos.component';
@Component({
@@ -28,19 +27,20 @@ import { PosChooseCardsComponent } from './choose-pos.component';
export class PosLayoutComponent {
constructor() {}
private readonly posInfoStore = inject(PosStore);
private readonly posProfileStore = inject(PosProfileStore);
private readonly posInfoStore = inject(PosInfoStore);
private readonly authService = inject(AuthService);
readonly posInfoLoading = computed(() => this.posInfoStore.loading());
readonly posInfo = computed(() => this.posInfoStore.entity());
readonly posInfoError = computed(() => this.posInfoStore.error());
readonly posProfileLoading = computed(() => this.posProfileStore.loading());
readonly posProfile = computed(() => this.posProfileStore.entity());
readonly posProfileError = computed(() => this.posProfileStore.error());
readonly loading = computed(() => this.posInfoLoading() || this.posProfileLoading());
readonly error = computed(() => this.posInfoError() || this.posProfileError());
readonly posInfoLoading = computed(() => this.posInfoStore.loading());
readonly posInfo = computed(() => this.posInfoStore.entity());
readonly posInfoError = computed(() => this.posInfoStore.error());
readonly loading = computed(() => this.posProfileLoading());
readonly error = computed(() => this.posProfileError());
logout = () => {
this.authService.logout();
@@ -64,8 +64,11 @@ export class PosLayoutComponent {
now = new Date();
getData() {
this.posProfileStore.getData().subscribe();
this.posInfoStore.getData().subscribe();
this.posProfileStore.getData().subscribe({
next: () => {
this.posInfoStore.getData().subscribe();
},
});
}
onChoosePos() {
@@ -120,6 +120,7 @@ export class PosGoldPayloadFormComponent extends AbstractForm<
const baseTotalAmount = totalAmountBeforeProfit + profitAmount;
const baseAmountForDiscountCalculation =
this.discountType() === 1 ? profitAmount : baseTotalAmount;
const taxAmount = (profitAmount + commissionAmount + wageAmount - discountAmount) * 0.1;
const totalAmount = baseTotalAmount - discountAmount + taxAmount;
@@ -1,10 +1,13 @@
<div class="flex gap-4 grow overflow-hidden h-full">
@if (posInfo()) {
@if (loading()) {
<shared-page-loading />
} @else if (pos()) {
<div class="flex gap-4 grow overflow-hidden h-full">
<div class="grow h-full overflow-auto">
<pos-goods />
</div>
<div class="shrink-0 h-full">
<pos-order-section />
</div>
}
</div>
</div>
}
@@ -1,5 +1,6 @@
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
import { PosStore } from '@/domains/pos/store/pos.store';
import { PosInfoStore } from '@/domains/pos/store/pos.store';
import { PageLoadingComponent } from '@/shared/components/page-loading.component';
import { Component, computed, inject } from '@angular/core';
import { PosGoodsComponent } from '../components/goods.component';
import { PosOrderSectionComponent } from '../components/order/order-section.component';
@@ -9,10 +10,16 @@ import { PosOrderSectionComponent } from '../components/order/order-section.comp
templateUrl: './root.component.html',
host: { class: 'grow overflow-hidden' },
imports: [PosGoodsComponent, PosOrderSectionComponent],
imports: [PosGoodsComponent, PosOrderSectionComponent, PageLoadingComponent],
})
export class PosLandingComponent {
private readonly posStore = inject(PosStore);
private readonly store = inject(PosInfoStore);
readonly posInfo = computed(() => this.posStore.entity());
readonly loading = computed(() => this.store.loading());
readonly pos = computed(() => this.store.entity());
readonly error = computed(() => this.store.error());
getData() {
this.store.getData().subscribe();
}
}
+1 -1
View File
@@ -14,7 +14,7 @@ interface PosState extends EntityState<IPosInfoResponse> {
@Injectable({
providedIn: 'root',
})
export class PosStore extends EntityStore<IPosInfoResponse, PosState> {
export class PosInfoStore extends EntityStore<IPosInfoResponse, PosState> {
private readonly service = inject(PosService);
constructor(private readonly cookieService: CookieService) {