+
@@ -16,21 +16,20 @@
outlined
severity="danger"
size="small"
- (click)="clearOrderList()"
- >
+ (click)="clearOrderList()">
پاک کردن سفارشها
+
- هیچ سفارشی ثبت نشده است.
+ هیچ سفارشی ثبت نشده است.
} @else {
-
+
@for (inOrderGood of inOrderGoods(); track inOrderGood.id) {
- @if (inOrderGood.good.pricing_model === "GOLD") {
+ @if (inOrderGood.good.pricing_model === 'GOLD') {
} @else {
@@ -40,9 +39,9 @@
}
-
-
-
+
+
+
@@ -56,11 +55,8 @@
icon="pi pi-check"
class="w-full"
size="large"
- (click)="submitAndPay()"
- >
+ (click)="submitAndPay()">
-
-
diff --git a/src/app/domains/pos/modules/shop/components/order/order-section.component.ts b/src/app/domains/pos/modules/shop/components/order/order-section.component.ts
index e8b0be0..e6a0c06 100644
--- a/src/app/domains/pos/modules/shop/components/order/order-section.component.ts
+++ b/src/app/domains/pos/modules/shop/components/order/order-section.component.ts
@@ -1,17 +1,23 @@
// import { CustomersSelectComponent } from '@/modules/customers/components/select/select.component';
// import { ICustomerResponse } from '@/modules/customers/models';
import { KeyValueComponent } from '@/shared/components';
-import { ChangeDetectionStrategy, Component, computed, EventEmitter, inject, Output, signal } from '@angular/core';
+import {
+ ChangeDetectionStrategy,
+ Component,
+ computed,
+ EventEmitter,
+ inject,
+ Output,
+ signal,
+} from '@angular/core';
import { FormsModule } from '@angular/forms';
import { ButtonDirective } from 'primeng/button';
import { Card } from 'primeng/card';
import images from 'src/assets/images';
-import { IPosOrderResponse } from '../../models';
import { PosLandingStore } from '../../store/main.store';
import { PosOrderCustomerDialogComponent } from '../customers/customer-dialog.component';
import { GoldPayloadOrderCardComponent } from '../payloads/gold/order-card.component';
import { StandardPayloadOrderCardComponent } from '../payloads/standard/order-card.component';
-import { PosPaymentFormDialogComponent } from '../payment/form-dialog.component';
import { POSOrderPriceInfoCardComponent } from './price-info-card.component';
@Component({
@@ -26,20 +32,17 @@ import { POSOrderPriceInfoCardComponent } from './price-info-card.component';
StandardPayloadOrderCardComponent,
PosOrderCustomerDialogComponent,
KeyValueComponent,
- PosPaymentFormDialogComponent,
Card,
],
})
export class PosOrderSectionComponent {
private readonly store = inject(PosLandingStore);
@Output() onAddMoreGoods = new EventEmitter();
- @Output() onSuccess = new EventEmitter();
+ @Output() onSubmit = new EventEmitter();
placeholderImage = images.placeholders.default;
isVisibleCustomerForm = signal(false);
- isVisiblePaymentForm = signal(false);
- isVisiblePreInvoiceForm = signal(false);
inOrderGoods = computed(() => this.store.inOrderGoods());
customer = computed(() => this.store.customer());
@@ -77,8 +80,7 @@ export class PosOrderSectionComponent {
}
submitAndPay() {
- this.isVisiblePaymentForm.set(false);
- queueMicrotask(() => this.isVisiblePaymentForm.set(true));
+ this.onSubmit.emit();
}
addMoreGoods() {
@@ -86,7 +88,4 @@ export class PosOrderSectionComponent {
}
submitCustomer() {}
- submitPayment(invoice: IPosOrderResponse) {
- this.onSuccess.emit(invoice);
- }
}
diff --git a/src/app/domains/pos/modules/shop/components/payloads/gold/form.component.ts b/src/app/domains/pos/modules/shop/components/payloads/gold/form.component.ts
index 7218c73..6b4ff67 100644
--- a/src/app/domains/pos/modules/shop/components/payloads/gold/form.component.ts
+++ b/src/app/domains/pos/modules/shop/components/payloads/gold/form.component.ts
@@ -44,6 +44,7 @@ export class PosGoldPayloadFormComponent extends AbstractForm<
};
@Input({ required: true }) vatPercentage!: number;
+ @Input() isRapidInvoice!: boolean;
@Output() onSubmitForm = new EventEmitter();
@Output() onChangeTotalAmount = new EventEmitter();
@@ -71,7 +72,9 @@ export class PosGoldPayloadFormComponent extends AbstractForm<
goldDefaultUnitPrice = signal(0);
- preparedCTAText = computed(() => (this.editMode ? 'اعمال ویرایش' : 'افزودن به لیست خرید'));
+ preparedCTAText = computed(() =>
+ this.editMode ? 'اعمال ویرایش' : this.isRapidInvoice ? 'ثبت و پرداخت' : 'افزودن به لیست خرید'
+ );
private readonly initialForm = () => {
const defaultPrice = this.posGoldConfig.get();
diff --git a/src/app/domains/pos/modules/shop/components/payloads/index.ts b/src/app/domains/pos/modules/shop/components/payloads/index.ts
index 00b894c..61f07b5 100644
--- a/src/app/domains/pos/modules/shop/components/payloads/index.ts
+++ b/src/app/domains/pos/modules/shop/components/payloads/index.ts
@@ -1 +1 @@
-export * from '../payload-form.component';
+export * from './payload-form.component';
diff --git a/src/app/domains/pos/modules/shop/components/payload-form.component.html b/src/app/domains/pos/modules/shop/components/payloads/payload-form.component.html
similarity index 76%
rename from src/app/domains/pos/modules/shop/components/payload-form.component.html
rename to src/app/domains/pos/modules/shop/components/payloads/payload-form.component.html
index 5de521d..0b35a50 100644
--- a/src/app/domains/pos/modules/shop/components/payload-form.component.html
+++ b/src/app/domains/pos/modules/shop/components/payloads/payload-form.component.html
@@ -4,24 +4,23 @@
[modal]="true"
[style]="{ 'max-height': '90svh', height: 'auto' }"
[closable]="true"
- (onHide)="close()"
->
+ (onHide)="close()">
@if (good) {
@if (isGoldMode()) {
+ [isRapidInvoice]="isRapidInvoice()"
+ (onSubmit)="submit($event)" />
} @else if (isStandardMode()) {
+ [isRapidInvoice]="isRapidInvoice()"
+ (onSubmit)="submit($event)" />
}
}
diff --git a/src/app/domains/pos/modules/shop/components/payload-form.component.ts b/src/app/domains/pos/modules/shop/components/payloads/payload-form.component.ts
similarity index 73%
rename from src/app/domains/pos/modules/shop/components/payload-form.component.ts
rename to src/app/domains/pos/modules/shop/components/payloads/payload-form.component.ts
index bcba1d1..6a242e8 100644
--- a/src/app/domains/pos/modules/shop/components/payload-form.component.ts
+++ b/src/app/domains/pos/modules/shop/components/payloads/payload-form.component.ts
@@ -2,10 +2,11 @@ import { IGoodResponse } from '@/domains/pos/models/good.io';
import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog';
import { SharedLightBottomsheetComponent } from '@/shared/components/dialog/light-bottomsheet.component';
import { Component, computed, EventEmitter, inject, Input, Output, signal } from '@angular/core';
-import { IGoldPayload, IPosOrderItem, IStandardPayload, TPosOrderGoodPayload } from '../models';
-import { PosLandingStore } from '../store/main.store';
-import { PosGoldPayloadFormComponent } from './payloads/gold/form.component';
-import { PosStandardPayloadFormComponent } from './payloads/standard/form.component';
+import { PosConfigRapidInvoiceService } from '../../../configs/components/rapidInvoice/services/main.service';
+import { IGoldPayload, IPosOrderItem, IStandardPayload } from '../../models';
+import { PosLandingStore } from '../../store/main.store';
+import { PosGoldPayloadFormComponent } from './gold/form.component';
+import { PosStandardPayloadFormComponent } from './standard/form.component';
@Component({
selector: 'pos-payload-form-dialog',
@@ -20,9 +21,10 @@ export class PayloadFormDialogComponent extends AbstractDialog {
@Input({ required: true }) good!: IGoodResponse;
@Input() initialValues?: IPosOrderItem;
@Input() orderItemId?: string;
- @Output() onSubmit = new EventEmitter();
+ @Output() onCreateRapidOrder = new EventEmitter();
private readonly store = inject(PosLandingStore);
+ private readonly rapidInvoiceConfig = inject(PosConfigRapidInvoiceService);
totalAmount = signal(0);
preparedTitle = computed(() => this.good?.name);
@@ -32,6 +34,8 @@ export class PayloadFormDialogComponent extends AbstractDialog {
isGoldMode = computed(() => this.good.pricing_model === 'GOLD');
isStandardMode = computed(() => this.good.pricing_model === 'STANDARD');
+ isRapidInvoice = computed(() => this.rapidInvoiceConfig.get());
+
goldPayload = computed(() =>
this.isGoldMode() && this.editMode()
? (this.initialValues as IPosOrderItem)
@@ -52,6 +56,9 @@ export class PayloadFormDialogComponent extends AbstractDialog {
this.store.editInOrderGoods({ id: this.orderItemId!, good: this.good, ...payload });
} else {
this.store.addToInOrderGoods(this.good.id, payload);
+ if (this.isRapidInvoice()) {
+ this.onCreateRapidOrder.emit();
+ }
}
this.close();
}
diff --git a/src/app/domains/pos/modules/shop/components/payloads/standard/form.component.html b/src/app/domains/pos/modules/shop/components/payloads/standard/form.component.html
index 5e1ac58..e2ea680 100644
--- a/src/app/domains/pos/modules/shop/components/payloads/standard/form.component.html
+++ b/src/app/domains/pos/modules/shop/components/payloads/standard/form.component.html
@@ -1,13 +1,12 @@
diff --git a/src/app/domains/pos/modules/shop/components/goods.component.ts b/src/app/domains/pos/modules/shop/components/views/goods.component.ts
similarity index 85%
rename from src/app/domains/pos/modules/shop/components/goods.component.ts
rename to src/app/domains/pos/modules/shop/components/views/goods.component.ts
index a5686a0..160e2e3 100644
--- a/src/app/domains/pos/modules/shop/components/goods.component.ts
+++ b/src/app/domains/pos/modules/shop/components/views/goods.component.ts
@@ -1,15 +1,24 @@
import { Maybe } from '@/core';
import { IGoodResponse } from '@/domains/pos/models/good.io';
import { SearchInputComponent } from '@/shared/components/search/search-input.component';
-import { ChangeDetectionStrategy, Component, computed, inject, Input, signal } from '@angular/core';
+import {
+ ChangeDetectionStrategy,
+ Component,
+ computed,
+ EventEmitter,
+ inject,
+ Input,
+ Output,
+ signal,
+} from '@angular/core';
import { FormsModule } from '@angular/forms';
import { Divider } from 'primeng/divider';
import { SelectButton } from 'primeng/selectbutton';
-import { PosLandingStore, TViewType } from '../store/main.store';
+import { PosLandingStore, TViewType } from '../../store/main.store';
+import { PayloadFormDialogComponent } from '../payloads';
import { PosGoodCategoriesComponent } from './categories.component';
import { PosGoodsGridViewComponent } from './grid-view.component';
import { PosGoodsListViewComponent } from './list-view.component';
-import { PayloadFormDialogComponent } from './payloads';
@Component({
selector: 'pos-goods',
@@ -28,6 +37,7 @@ import { PayloadFormDialogComponent } from './payloads';
})
export class PosGoodsComponent {
@Input() activeCategory = signal
>(null);
+ @Output() onCreateRapidOrder = new EventEmitter();
private readonly store = inject(PosLandingStore);
@@ -77,4 +87,8 @@ export class PosGoodsComponent {
this.showPayloadForm.set(false);
this.selectedGoodToAdd.set(null);
}
+
+ createRapidOrder() {
+ this.onCreateRapidOrder.emit();
+ }
}
diff --git a/src/app/domains/pos/modules/shop/components/grid-view.component.html b/src/app/domains/pos/modules/shop/components/views/grid-view.component.html
similarity index 100%
rename from src/app/domains/pos/modules/shop/components/grid-view.component.html
rename to src/app/domains/pos/modules/shop/components/views/grid-view.component.html
diff --git a/src/app/domains/pos/modules/shop/components/grid-view.component.ts b/src/app/domains/pos/modules/shop/components/views/grid-view.component.ts
similarity index 96%
rename from src/app/domains/pos/modules/shop/components/grid-view.component.ts
rename to src/app/domains/pos/modules/shop/components/views/grid-view.component.ts
index 568bc9e..ecde740 100644
--- a/src/app/domains/pos/modules/shop/components/grid-view.component.ts
+++ b/src/app/domains/pos/modules/shop/components/views/grid-view.component.ts
@@ -12,7 +12,7 @@ import {
import { ButtonDirective } from 'primeng/button';
import { Skeleton } from 'primeng/skeleton';
import images from 'src/assets/images';
-import { PosLandingStore } from '../store/main.store';
+import { PosLandingStore } from '../../store/main.store';
import { FavoriteCTAComponent } from './favorite-CTA.component';
@Component({
diff --git a/src/app/domains/pos/modules/shop/components/list-view.component.html b/src/app/domains/pos/modules/shop/components/views/list-view.component.html
similarity index 100%
rename from src/app/domains/pos/modules/shop/components/list-view.component.html
rename to src/app/domains/pos/modules/shop/components/views/list-view.component.html
diff --git a/src/app/domains/pos/modules/shop/components/list-view.component.ts b/src/app/domains/pos/modules/shop/components/views/list-view.component.ts
similarity index 96%
rename from src/app/domains/pos/modules/shop/components/list-view.component.ts
rename to src/app/domains/pos/modules/shop/components/views/list-view.component.ts
index 33d45b8..5eb016a 100644
--- a/src/app/domains/pos/modules/shop/components/list-view.component.ts
+++ b/src/app/domains/pos/modules/shop/components/views/list-view.component.ts
@@ -12,7 +12,7 @@ import {
import { ButtonDirective } from 'primeng/button';
import { Skeleton } from 'primeng/skeleton';
import images from 'src/assets/images';
-import { PosLandingStore } from '../store/main.store';
+import { PosLandingStore } from '../../store/main.store';
import { FavoriteCTAComponent } from './favorite-CTA.component';
@Component({
diff --git a/src/app/domains/pos/modules/shop/views/root.component.html b/src/app/domains/pos/modules/shop/views/root.component.html
index 1555aeb..cdc5606 100644
--- a/src/app/domains/pos/modules/shop/views/root.component.html
+++ b/src/app/domains/pos/modules/shop/views/root.component.html
@@ -1,13 +1,13 @@
@if (loading()) {
} @else if (pos()) {
-
-
-
-
+
+
+
@if (!isMobile()) {
-
+
}
@@ -18,9 +18,8 @@