diff --git a/.gitignore b/.gitignore
index baef06d..dcd6729 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,3 +43,4 @@ testem.log
Thumbs.db
.env.*
+.env
diff --git a/src/app/domains/pos/modules/shop/components/payloads/payload-form.component.html b/src/app/domains/pos/modules/shop/components/payloads/payload-form.component.html
index 0b35a50..308d0a3 100644
--- a/src/app/domains/pos/modules/shop/components/payloads/payload-form.component.html
+++ b/src/app/domains/pos/modules/shop/components/payloads/payload-form.component.html
@@ -7,14 +7,14 @@
(onHide)="close()">
@if (good) {
@if (isGoldMode()) {
-
} @else if (isStandardMode()) {
- {
unit_price: number;
diff --git a/src/app/domains/pos/modules/shop/components/payloads/form-dialog-amount-card-template.component.html b/src/app/shared/components/calculatedAmountCard/calculated-amount-card.component.html
similarity index 100%
rename from src/app/domains/pos/modules/shop/components/payloads/form-dialog-amount-card-template.component.html
rename to src/app/shared/components/calculatedAmountCard/calculated-amount-card.component.html
diff --git a/src/app/domains/pos/modules/shop/components/payloads/form-dialog-amount-card-template.component.ts b/src/app/shared/components/calculatedAmountCard/calculated-amount-card.component.ts
similarity index 70%
rename from src/app/domains/pos/modules/shop/components/payloads/form-dialog-amount-card-template.component.ts
rename to src/app/shared/components/calculatedAmountCard/calculated-amount-card.component.ts
index 142fc62..4411a2c 100644
--- a/src/app/domains/pos/modules/shop/components/payloads/form-dialog-amount-card-template.component.ts
+++ b/src/app/shared/components/calculatedAmountCard/calculated-amount-card.component.ts
@@ -3,11 +3,11 @@ import { Component, Input } from '@angular/core';
import { Card } from 'primeng/card';
@Component({
- selector: 'pos-form-dialog-amount-card-template',
- templateUrl: './form-dialog-amount-card-template.component.html',
+ selector: 'shared-calculated-amount-card',
+ templateUrl: './calculated-amount-card.component.html',
imports: [Card, PriceMaskDirective],
})
-export class PosFormDialogAmountCardTemplateComponent {
+export class CalculatedAmountCardComponent {
@Input({ required: true }) baseTotalAmount!: number;
@Input({ required: true }) totalAmount!: number;
@Input({ required: true }) discountAmount!: number;
diff --git a/src/app/shared/components/dialog/index.ts b/src/app/shared/components/dialog/index.ts
new file mode 100644
index 0000000..10ffd99
--- /dev/null
+++ b/src/app/shared/components/dialog/index.ts
@@ -0,0 +1,2 @@
+export * from './dialog.component';
+export * from './light-bottomsheet.component';
diff --git a/src/app/shared/components/index.ts b/src/app/shared/components/index.ts
index 3812deb..7d49b9d 100644
--- a/src/app/shared/components/index.ts
+++ b/src/app/shared/components/index.ts
@@ -1,12 +1,15 @@
// export * from './abstract-select.component';
+export * from './amountPercentageInput/amount-percentage-input.component';
export * from './breadcrumb.component';
+export * from './calculatedAmountCard/calculated-amount-card.component';
export * from './card-data.component';
export * from './changePasswordFormDialog/change-password-form-dialog.component';
-export * from './dialog/dialog.component';
+export * from './dialog';
export * from './fields';
export * from './inlineConfirmation/inline-confirmation.component';
export * from './inlineEdit/inline-edit.component';
export * from './input/input.component';
export * from './key-value.component/key-value.component';
export * from './passwordInput/password-input.component';
+export * from './posPayment';
export * from './table-action-row.component';
diff --git a/src/app/domains/pos/modules/shop/components/payloads/gold/form.component.html b/src/app/shared/components/posPayment/gold-form.component.html
similarity index 98%
rename from src/app/domains/pos/modules/shop/components/payloads/gold/form.component.html
rename to src/app/shared/components/posPayment/gold-form.component.html
index 6c014e2..14f0f87 100644
--- a/src/app/domains/pos/modules/shop/components/payloads/gold/form.component.html
+++ b/src/app/shared/components/posPayment/gold-form.component.html
@@ -52,7 +52,7 @@
-
,
IPosOrderItem
> {
+ @Input({ required: true }) vatPercentage!: number;
+ @Input() isRapidInvoice: boolean = false;
+ @Input() ctaText: string = '';
+
+ @Output() onSubmitForm = new EventEmitter();
+ @Output() onChangeTotalAmount = new EventEmitter();
+
override defaultValues: Partial> = {
// unit_price: 200_000_000,
// quantity: 2,
@@ -43,12 +52,6 @@ export class PosGoldPayloadFormComponent extends AbstractForm<
} as any,
};
- @Input({ required: true }) vatPercentage!: number;
- @Input() isRapidInvoice!: boolean;
-
- @Output() onSubmitForm = new EventEmitter();
- @Output() onChangeTotalAmount = new EventEmitter();
-
private readonly posGoldConfig = inject(PosConfigGoldPriceService);
readonly discountTypeItems = [
@@ -74,7 +77,11 @@ export class PosGoldPayloadFormComponent extends AbstractForm<
goldDefaultUnitPrice = signal(0);
preparedCTAText = computed(() =>
- this.editMode ? 'اعمال ویرایش' : this.isRapidInvoice ? 'ثبت و پرداخت' : 'افزودن به لیست خرید'
+ this.ctaText || this.editMode
+ ? 'اعمال ویرایش'
+ : this.isRapidInvoice
+ ? 'ثبت و پرداخت'
+ : 'افزودن به لیست خرید'
);
private readonly initialForm = () => {
@@ -169,13 +176,6 @@ export class PosGoldPayloadFormComponent extends AbstractForm<
this.onChangeTotalAmount.emit(totalAmount);
}
- toAmountFormat(amount: number) {
- if (!amount) {
- return '';
- }
- return `(${formatWithCurrency(amount)})`;
- }
-
changeDiscountCalculation($event: SelectButtonChangeEvent) {
this.discountType.set($event.value);
diff --git a/src/app/shared/components/posPayment/index.ts b/src/app/shared/components/posPayment/index.ts
new file mode 100644
index 0000000..61d2bc0
--- /dev/null
+++ b/src/app/shared/components/posPayment/index.ts
@@ -0,0 +1,2 @@
+export * from './gold-form.component';
+export * from './standard-form.component';
diff --git a/src/app/domains/pos/modules/shop/components/payloads/standard/form.component.html b/src/app/shared/components/posPayment/standard-form.component.html
similarity index 95%
rename from src/app/domains/pos/modules/shop/components/payloads/standard/form.component.html
rename to src/app/shared/components/posPayment/standard-form.component.html
index e2ea680..0a27f8d 100644
--- a/src/app/domains/pos/modules/shop/components/payloads/standard/form.component.html
+++ b/src/app/shared/components/posPayment/standard-form.component.html
@@ -19,7 +19,7 @@
-
,
IPosOrderItem
> {
@Input({ required: true }) measureUnit!: ISummary;
@Input({ required: true }) vatPercentage!: number;
- @Input() isRapidInvoice!: boolean;
+ @Input() isRapidInvoice: boolean = false;
+ @Input() ctaText: string = '';
@Output() onChangeTotalAmount = new EventEmitter();
private readonly initialForm = () => {
@@ -66,16 +69,13 @@ export class PosStandardPayloadFormComponent extends AbstractForm<
taxAmount = signal(0);
preparedCTAText = computed(() =>
- this.editMode ? 'اعمال ویرایش' : this.isRapidInvoice ? 'ثبت و پرداخت' : 'افزودن به لیست خرید'
+ this.ctaText || this.editMode
+ ? 'اعمال ویرایش'
+ : this.isRapidInvoice
+ ? 'ثبت و پرداخت'
+ : 'افزودن به لیست خرید'
);
- toPriceFormat(amount: number) {
- if (!amount) {
- return '';
- }
- return `(${formatWithCurrency(amount)})`;
- }
-
updateCalculateAmount(value: Partial>) {
const baseTotalAmount = (value.unit_price ?? 0) * (value.quantity ?? 0);
const discountAmount = Number(value.discount_amount ?? '0');
diff --git a/src/app/shared/models/index.ts b/src/app/shared/models/index.ts
new file mode 100644
index 0000000..83aeb94
--- /dev/null
+++ b/src/app/shared/models/index.ts
@@ -0,0 +1,3 @@
+export * from './consumer.type';
+export * from './enum_translate.type';
+export * from './posPayments.type';
diff --git a/src/app/domains/pos/modules/shop/models/payload.ts b/src/app/shared/models/posPayments.type.ts
similarity index 100%
rename from src/app/domains/pos/modules/shop/models/payload.ts
rename to src/app/shared/models/posPayments.type.ts
diff --git a/src/environments/environment.tis.ts b/src/environments/environment.tis.ts
index 73cd0a5..914a195 100644
--- a/src/environments/environment.tis.ts
+++ b/src/environments/environment.tis.ts
@@ -1,9 +1,9 @@
// TIS tenant environment configuration
export const environment = {
production: true,
- apiBaseUrl: 'https://psp-api.shift-am.ir',
+ // apiBaseUrl: 'https://psp-api.shift-am.ir',
// apiBaseUrl: 'http://192.168.128.73:5002',
- // apiBaseUrl: 'http://localhost:5002',
+ apiBaseUrl: 'http://localhost:5002',
host: 'localhost',
port: 5000,
enableLogging: false,