diff --git a/ngsw-config.json b/ngsw-config.json index efd9e8b..664b1c2 100644 --- a/ngsw-config.json +++ b/ngsw-config.json @@ -1,9 +1,9 @@ { "$schema": "./node_modules/@angular/service-worker/config/schema.json", "appData": { - "appVersion": "0.0.4", - "buildDate": "2026-05-11T16:11:59.783Z", - "buildNumber": 4 + "appVersion": "0.0.9", + "buildDate": "2026-05-13T06:42:17.700Z", + "buildNumber": 9 }, "assetGroups": [ { diff --git a/src/app/domains/pos/modules/landing/components/payload-form.component.html b/src/app/domains/pos/modules/landing/components/payload-form.component.html index 29cf5f3..c20e840 100644 --- a/src/app/domains/pos/modules/landing/components/payload-form.component.html +++ b/src/app/domains/pos/modules/landing/components/payload-form.component.html @@ -1,8 +1,8 @@ - @@ -18,4 +18,4 @@ /> } } - + diff --git a/src/app/domains/pos/modules/landing/components/payload-form.component.ts b/src/app/domains/pos/modules/landing/components/payload-form.component.ts index 50991fe..5d20022 100644 --- a/src/app/domains/pos/modules/landing/components/payload-form.component.ts +++ b/src/app/domains/pos/modules/landing/components/payload-form.component.ts @@ -1,6 +1,6 @@ import { IGoodResponse } from '@/domains/pos/models/good.io'; import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog'; -import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component'; +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'; @@ -10,7 +10,7 @@ import { PosStandardPayloadFormComponent } from './payloads/standard/form.compon @Component({ selector: 'pos-payload-form-dialog', templateUrl: './payload-form.component.html', - imports: [PosGoldPayloadFormComponent, SharedDialogComponent, PosStandardPayloadFormComponent], + imports: [PosGoldPayloadFormComponent, SharedLightBottomsheetComponent, PosStandardPayloadFormComponent], }) export class PayloadFormDialogComponent extends AbstractDialog { @Input({ required: true }) good!: IGoodResponse; 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 48729b3..e8f12d0 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,69 +1,67 @@ -@if (formVisible()) { -
-
- - - - - - - - +
+
+ + + - - - - + [maxAmount]="unitWithQuantity()" + name="wages" + label="اجرت" + /> + + + -
-
- + + - -
+ +
+ +
+
+ +
-} +
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 b328e9d..22d6275 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,7 +52,6 @@ export class PosGoldPayloadFormComponent extends AbstractForm< baseAmountForDiscountCalculation = signal(0); taxAmount = signal(0); totalAmount = signal(0); - formVisible = signal(false); preparedCTAText = computed(() => (this.editMode ? 'اعمال ویرایش' : 'افزودن به لیست خرید')); @@ -95,16 +94,6 @@ export class PosGoldPayloadFormComponent extends AbstractForm< form = this.initialForm(); - override ngAfterViewInit(): void { - 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) { this.onSubmit.emit({ ...payload, diff --git a/src/app/domains/pos/modules/landing/views/root.component.html b/src/app/domains/pos/modules/landing/views/root.component.html index 9e90668..5a56ad8 100644 --- a/src/app/domains/pos/modules/landing/views/root.component.html +++ b/src/app/domains/pos/modules/landing/views/root.component.html @@ -19,7 +19,7 @@ type="button" pButton class="sticky! bottom-0 inset-x-0 w-full right-0 z-1200 border-t border-surface-border bg-surface-0 px-4 py-3 shadow-[0_-4px_16px_rgba(0,0,0,0.08)] md:hidden! rounded-b-none!" - [style.paddingBottom]="'calc(0.75rem + env(safe-area-inset-bottom))'" + [style.paddingBottom]="'calc(0.75rem + {{env(safe-area-inset-bottom)}})'" (click)="openInvoiceBottomSheet()" >
diff --git a/src/app/shared/abstractClasses/abstract-form.ts b/src/app/shared/abstractClasses/abstract-form.ts index 31fcaf0..88feecf 100644 --- a/src/app/shared/abstractClasses/abstract-form.ts +++ b/src/app/shared/abstractClasses/abstract-form.ts @@ -36,7 +36,7 @@ export abstract class AbstractForm< return payload; } - ngAfterViewInit() { + ngOnInit() { this.form.reset(this.initialValues ?? this.defaultValues); // Object.entries(this.form.controls).forEach(([key, control]) => { // console.log(key, control); diff --git a/src/app/shared/components/dialog/light-bottomsheet.component.html b/src/app/shared/components/dialog/light-bottomsheet.component.html new file mode 100644 index 0000000..a2e6fe7 --- /dev/null +++ b/src/app/shared/components/dialog/light-bottomsheet.component.html @@ -0,0 +1,25 @@ +
+ + diff --git a/src/app/shared/components/dialog/light-bottomsheet.component.ts b/src/app/shared/components/dialog/light-bottomsheet.component.ts new file mode 100644 index 0000000..715767d --- /dev/null +++ b/src/app/shared/components/dialog/light-bottomsheet.component.ts @@ -0,0 +1,120 @@ +import { NgStyle } from '@angular/common'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; + +@Component({ + selector: 'shared-light-bottomsheet', + templateUrl: './light-bottomsheet.component.html', + imports: [NgStyle], + styles: [ + ` + :host { + position: fixed; + inset: 0; + z-index: 11020; + } + + .light-bottomsheet-mask { + position: absolute; + inset: 0; + background: rgba(15, 23, 42, 0.22); + will-change: opacity; + animation: sheetFadeIn var(--sheet-transition, 130ms cubic-bezier(0.2, 0, 0, 1)); + } + + .light-bottomsheet-panel { + position: absolute; + right: 0; + bottom: 0; + left: 0; + max-height: 80svh; + background: var(--surface-card, #fff); + border-radius: 12px 12px 0 0; + box-shadow: none; + transform: translate3d(0, 0, 0); + will-change: transform; + backface-visibility: hidden; + animation: sheetSlideUp var(--sheet-transition, 130ms cubic-bezier(0.2, 0, 0, 1)); + overflow: hidden; + } + + .light-bottomsheet-content { + max-height: 80svh; + overflow: auto; + padding-bottom: calc(0.75rem + env(safe-area-inset-bottom)); + -webkit-overflow-scrolling: touch; + overscroll-behavior: contain; + } + + .light-bottomsheet-header { + display: flex; + align-items: center; + justify-content: space-between; + gap: 0.75rem; + padding: 0.75rem 1rem; + } + + .light-bottomsheet-title { + margin: 0; + font-size: 0.95rem; + font-weight: 600; + } + + .light-bottomsheet-close { + border: 0; + background: transparent; + padding: 0.25rem; + line-height: 1; + font-size: 1.25rem; + } + + @keyframes sheetSlideUp { + from { + transform: translate3d(0, 100%, 0); + } + to { + transform: translate3d(0, 0, 0); + } + } + + @keyframes sheetFadeIn { + from { + opacity: 0; + } + to { + opacity: 1; + } + } + `, + ], + host: { + '[style.display]': 'visible ? "block" : "none"', + '[style.--sheet-transition]': 'transitionOptions', + }, +}) +export class SharedLightBottomsheetComponent { + @Input() header = ''; + @Input() visible = false; + @Output() visibleChange = new EventEmitter(); + + @Input() modal = true; + @Input() closable = true; + @Input() style: Record | undefined; + @Input() mobileDrawerHeight = '80svh'; + @Input() transitionOptions = '130ms cubic-bezier(0.2, 0, 0, 1)'; + + @Output() onHide = new EventEmitter(); + + onVisibilityChange(nextValue: boolean) { + this.visible = nextValue; + this.visibleChange.emit(nextValue); + if (!nextValue) { + this.onHide.emit(); + } + } + + onMaskClick() { + if (this.modal && this.closable) { + this.onVisibilityChange(false); + } + } +}