From cd973aa1a082a7577e10e676681154dac49d7353 Mon Sep 17 00:00:00 2001 From: ahasani194 Date: Tue, 12 May 2026 20:22:09 +0330 Subject: [PATCH] feat: enhance gold payload form with dynamic visibility and improved discount calculations --- .../payloads/gold/form.component.html | 128 +++++++++--------- .../payloads/gold/form.component.ts | 12 +- src/assets/styles.scss | 15 ++ src/main.ts | 5 + 4 files changed, 93 insertions(+), 67 deletions(-) diff --git a/src/app/domains/pos/modules/landing/components/payloads/gold/form.component.html b/src/app/domains/pos/modules/landing/components/payloads/gold/form.component.html index e8f12d0..48729b3 100644 --- a/src/app/domains/pos/modules/landing/components/payloads/gold/form.component.html +++ b/src/app/domains/pos/modules/landing/components/payloads/gold/form.component.html @@ -1,67 +1,69 @@ -
-
- - - +@if (formVisible()) { +
+ + + + - - - - - - - - - - + + + -
-
- - + + + + + + +
+
+ + +
-
+} diff --git a/src/app/domains/pos/modules/landing/components/payloads/gold/form.component.ts b/src/app/domains/pos/modules/landing/components/payloads/gold/form.component.ts index daf518d..b328e9d 100644 --- a/src/app/domains/pos/modules/landing/components/payloads/gold/form.component.ts +++ b/src/app/domains/pos/modules/landing/components/payloads/gold/form.component.ts @@ -52,6 +52,7 @@ export class PosGoldPayloadFormComponent extends AbstractForm< baseAmountForDiscountCalculation = signal(0); taxAmount = signal(0); totalAmount = signal(0); + formVisible = signal(false); preparedCTAText = computed(() => (this.editMode ? 'اعمال ویرایش' : 'افزودن به لیست خرید')); @@ -95,10 +96,13 @@ export class PosGoldPayloadFormComponent extends AbstractForm< form = this.initialForm(); override ngAfterViewInit(): void { - if (this.editMode) { - this.form.patchValue(this.initialValues || {}, { emitEvent: false }); - this.updateCalculateAmount(this.form.value as any); - } + setTimeout(() => { + this.formVisible.set(true); + if (this.editMode) { + this.form.patchValue(this.initialValues || {}, { emitEvent: false }); + this.updateCalculateAmount(this.form.value as any); + } + }, 200); } override submitForm(payload: IPosOrderItem) { diff --git a/src/assets/styles.scss b/src/assets/styles.scss index 1f789a5..41ea47c 100644 --- a/src/assets/styles.scss +++ b/src/assets/styles.scss @@ -14,3 +14,18 @@ form, flex-direction: column; gap: 1rem; } + +body.tenant-tis .p-drawer { + will-change: transform; + transform: translateZ(0); + backface-visibility: hidden; +} + +body.tenant-tis .p-drawer-mask { + will-change: opacity; +} + +body.tenant-tis .p-drawer .p-drawer-content { + -webkit-overflow-scrolling: touch; + overscroll-behavior: contain; +} diff --git a/src/main.ts b/src/main.ts index 3cccf51..0d97ce0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,6 +4,7 @@ import faLocales from 'flatpickr-wrap/dist/l10n/fa.js'; import { brandingConfig } from './app/branding/branding.config'; import { AppComponent } from './app.component'; import { appConfig } from './app.config'; +import config from './config'; flatpickr.localize(faLocales.fa!); @@ -32,4 +33,8 @@ if (themeMeta) { themeMeta.setAttribute('content', brandingConfig.themeColor); } +if (config.isPosApplication) { + document.body.classList.add('tenant-tis'); +} + bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err));