diff --git a/ngsw-config.json b/ngsw-config.json index 664b1c2..b5874a2 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.9", - "buildDate": "2026-05-13T06:42:17.700Z", - "buildNumber": 9 + "appVersion": "0.0.10", + "buildDate": "2026-05-13T09:21:01.165Z", + "buildNumber": 10 }, "assetGroups": [ { diff --git a/src/app/domains/consumer/modules/businessActivities/models/salesInvoices_io.d.ts b/src/app/domains/consumer/modules/businessActivities/models/salesInvoices_io.d.ts index b054f03..8b0ad14 100644 --- a/src/app/domains/consumer/modules/businessActivities/models/salesInvoices_io.d.ts +++ b/src/app/domains/consumer/modules/businessActivities/models/salesInvoices_io.d.ts @@ -1,6 +1,5 @@ import ISummary from '@/core/models/summary'; import { TCustomerInfo, TPosOrderGoodPayload } from '@/domains/pos/modules/landing/models'; -import { UnitType } from '@/utils'; export interface ISalesInvoicesRawResponse { id: string; @@ -29,7 +28,7 @@ interface Payment { } interface Item { - unit_type: UnitType; + measure_unit: ISummary; discount: string; quantity: string; total_amount: string; @@ -46,6 +45,6 @@ interface Good { barcode: null; local_sku: null; pricing_model: string; - unit_type: string; + measure_unit: ISummary; category: ISummary; } diff --git a/src/app/domains/pos/layouts/mainMenuSidebar/main-menu-sidebar.component.html b/src/app/domains/pos/layouts/mainMenuSidebar/main-menu-sidebar.component.html index 9ec4abd..565ac8e 100644 --- a/src/app/domains/pos/layouts/mainMenuSidebar/main-menu-sidebar.component.html +++ b/src/app/domains/pos/layouts/mainMenuSidebar/main-menu-sidebar.component.html @@ -31,14 +31,14 @@ } -
-
- @if (isPwaBuild) { + @if (isPwaBuild) { +
+
نسخه برنامه : {{ appVersion }}
- } -
+
+ } diff --git a/src/app/domains/pos/layouts/mainMenuSidebar/main-menu-sidebar.component.ts b/src/app/domains/pos/layouts/mainMenuSidebar/main-menu-sidebar.component.ts index c4e94f1..e7e334e 100644 --- a/src/app/domains/pos/layouts/mainMenuSidebar/main-menu-sidebar.component.ts +++ b/src/app/domains/pos/layouts/mainMenuSidebar/main-menu-sidebar.component.ts @@ -53,7 +53,7 @@ export class PosMainMenuSidebarComponent extends AbstractDialog { icon: 'pi pi-fw pi-cog', }, { - label: 'درباره ما', + label: 'درباره نرم‌افزار', routerLink: posAboutNamedRoutes.about.meta.pagePath!(), icon: 'pi pi-fw pi-info-circle', }, diff --git a/src/app/domains/pos/layouts/pagesLayout/layout.component.ts b/src/app/domains/pos/layouts/pagesLayout/layout.component.ts index b080e45..57d1210 100644 --- a/src/app/domains/pos/layouts/pagesLayout/layout.component.ts +++ b/src/app/domains/pos/layouts/pagesLayout/layout.component.ts @@ -2,15 +2,7 @@ import { AuthService } from '@/core'; import { LayoutService } from '@/layout/service/layout.service'; import { PageLoadingComponent } from '@/shared/components/page-loading.component'; import { CommonModule } from '@angular/common'; -import { - AfterViewInit, - Component, - TemplateRef, - ViewChild, - computed, - inject, - signal, -} from '@angular/core'; +import { Component, TemplateRef, ViewChild, computed, inject, signal } from '@angular/core'; import { RouterLinkWithHref, RouterOutlet } from '@angular/router'; import { MenuItem } from 'primeng/api'; import { Button, ButtonDirective } from 'primeng/button'; @@ -38,7 +30,7 @@ import { PosChooseCardsComponent } from './choose-pos.component'; RouterOutlet, ], }) -export class PosPagesLayoutComponent implements AfterViewInit { +export class PosPagesLayoutComponent { constructor() {} // private readonly nativeBridgeService = inject(NativeBridgeService); @@ -118,9 +110,6 @@ export class PosPagesLayoutComponent implements AfterViewInit { ngOnInit() { this.layoutService.changeIsFullPage(true); - } - - ngAfterViewInit() { this.layoutService.setTopbarStartSlot(this.topbarStart); this.layoutService.setTopbarCenterSlot(this.topbarCenter); this.layoutService.setTopbarEndSlot(this.topbarEnd); diff --git a/src/app/domains/pos/models/good.io.ts b/src/app/domains/pos/models/good.io.ts index bf0a955..5981c49 100644 --- a/src/app/domains/pos/models/good.io.ts +++ b/src/app/domains/pos/models/good.io.ts @@ -1,5 +1,4 @@ import ISummary from '@/core/models/summary'; -import { UnitType } from '@/utils'; export interface IGoodRawResponse { id: string; @@ -10,7 +9,7 @@ export interface IGoodRawResponse { name: string; }; category: ISummary; - unit_type: UnitType; + measure_unit: ISummary; pricing_model: string; description?: string; image_url: string; diff --git a/src/app/domains/pos/modules/about/views/root.component.html b/src/app/domains/pos/modules/about/views/root.component.html index d1ea202..471c00a 100644 --- a/src/app/domains/pos/modules/about/views/root.component.html +++ b/src/app/domains/pos/modules/about/views/root.component.html @@ -1,6 +1,55 @@ -
-
-

درباره سیستم

-

این صفحه به زودی تکمیل می شود.

-
+
+
+
+

+ {{ brandingInfo.appTitle }} +

+ درباره نسخه تیس +

+ این نسخه برای استفاده روزانه روی دستگاه های PSP بهینه شده است تا عملیات ثبت و صدور صورتحساب‌‌های مالیاتی با سرعت + بالاتر، پایداری بیشتر و تجربه کاربری ساده تر انجام شود. +

+
+ +
+ + +
+ تمرکز بر سرعت عملیات +

+ مسیرهای کلیدی مانند انتخاب کالا، ورود مقادیر و ثبت نهایی برای کاهش تاخیر و افزایش سرعت کاربر بهینه شده اند. +

+
+ +
+ سازگار با سناریوهای فروش +

+ طراحی این نسخه بر مبنای سناریوهای واقعی فروشگاه انجام شده تا اپراتور با کمترین کلیک فرآیند را تکمیل کند. +

+
+
+ +
+
+
+ نسخه برنامه: + {{ appVersion() }} +
+ +
+
+ +
+

+ در صورت نیاز به راهنمایی بیشتر، به صفحه‌ی راهنمای استفاده مراجعه کنید یا با پشتیبانی تماس بگیرید. +

+
+
diff --git a/src/app/domains/pos/modules/about/views/root.component.ts b/src/app/domains/pos/modules/about/views/root.component.ts index bfe59c1..4ed7b37 100644 --- a/src/app/domains/pos/modules/about/views/root.component.ts +++ b/src/app/domains/pos/modules/about/views/root.component.ts @@ -1,7 +1,87 @@ -import { Component } from '@angular/core'; +import { brandingConfig } from '@/branding/branding.config'; +import { Component, computed, inject, signal } from '@angular/core'; +import { SwUpdate, VersionReadyEvent } from '@angular/service-worker'; +import { ButtonDirective } from 'primeng/button'; +import { filter } from 'rxjs'; @Component({ selector: 'pos-about-page', templateUrl: './root.component.html', + imports: [ButtonDirective], }) -export class PosAboutPageComponent {} +export class PosAboutPageComponent { + private readonly swUpdate = inject(SwUpdate); + + brandingInfo = brandingConfig; + appVersion = signal('0.0.0'); + isPwaBuild = this.swUpdate.isEnabled; + isCheckingUpdate = signal(false); + hasUpdate = signal(false); + isUpdated = signal(false); + + updateCtaLabel = computed(() => { + if (!this.isPwaBuild) return 'به روزرسانی فقط در نسخه PWA'; + if (this.isUpdated()) return 'به روز است'; + if (this.hasUpdate()) return 'به روزرسانی برنامه'; + if (this.isCheckingUpdate()) return 'در حال بررسی...'; + return 'بررسی به روزرسانی'; + }); + + ngOnInit() { + if (!this.isPwaBuild) return; + + this.loadVersion(); + this.swUpdate.versionUpdates + .pipe(filter((event): event is VersionReadyEvent => event.type === 'VERSION_READY')) + .subscribe((event) => { + const appData = event.latestVersion.appData as { appVersion?: string } | undefined; + this.appVersion.set(appData?.appVersion || this.appVersion()); + this.hasUpdate.set(true); + this.isUpdated.set(false); + }); + } + + async onUpdateCtaClick() { + if (!this.isPwaBuild || this.isCheckingUpdate()) return; + + if (this.hasUpdate()) { + await this.applyUpdate(); + return; + } + + await this.checkForUpdate(); + } + + private async checkForUpdate() { + this.isCheckingUpdate.set(true); + this.isUpdated.set(false); + try { + const hasUpdate = await this.swUpdate.checkForUpdate(); + this.hasUpdate.set(hasUpdate); + this.isUpdated.set(!hasUpdate); + } finally { + this.isCheckingUpdate.set(false); + } + } + + private async applyUpdate() { + this.isCheckingUpdate.set(true); + try { + await this.swUpdate.activateUpdate(); + this.isUpdated.set(true); + this.hasUpdate.set(false); + window.location.reload(); + } finally { + this.isCheckingUpdate.set(false); + } + } + + private loadVersion() { + fetch('/ngsw.json') + .then((res) => res.json()) + .then((data: { appData?: { appVersion?: string } }) => { + this.appVersion.set(data?.appData?.appVersion || this.appVersion()); + }) + .catch(() => {}); + } +} diff --git a/src/app/domains/pos/modules/landing/components/customers/customer-dialog.component.html b/src/app/domains/pos/modules/landing/components/customers/customer-dialog.component.html index 7cbab4c..34866c2 100644 --- a/src/app/domains/pos/modules/landing/components/customers/customer-dialog.component.html +++ b/src/app/domains/pos/modules/landing/components/customers/customer-dialog.component.html @@ -1,4 +1,9 @@ - +
@@ -13,4 +18,4 @@ } @else if (selectedCustomerType() === "LEGAL") { } - + diff --git a/src/app/domains/pos/modules/landing/components/customers/customer-dialog.component.ts b/src/app/domains/pos/modules/landing/components/customers/customer-dialog.component.ts index 0e057ef..055fcbb 100644 --- a/src/app/domains/pos/modules/landing/components/customers/customer-dialog.component.ts +++ b/src/app/domains/pos/modules/landing/components/customers/customer-dialog.component.ts @@ -1,5 +1,5 @@ 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 { CustomerType } from '@/shared/localEnum/constants/customerTypes'; import { Component, EventEmitter, inject, Output, signal } from '@angular/core'; import { FormsModule } from '@angular/forms'; @@ -13,7 +13,7 @@ import { CustomerUnknownFormComponent } from './unknown/form.component'; selector: 'pos-order-customer-dialog', templateUrl: './customer-dialog.component.html', imports: [ - SharedDialogComponent, + SharedLightBottomsheetComponent, CustomerIndividualFormComponent, FormsModule, CustomerLegalFormComponent, diff --git a/src/app/domains/pos/modules/landing/components/order/order-card-template.component.html b/src/app/domains/pos/modules/landing/components/order/order-card-template.component.html index b5437b6..04eda23 100644 --- a/src/app/domains/pos/modules/landing/components/order/order-card-template.component.html +++ b/src/app/domains/pos/modules/landing/components/order/order-card-template.component.html @@ -16,7 +16,7 @@
- {{ inOrderGood.quantity }} {{ enumTranslator(inOrderGood.good.unit_type) }} + {{ inOrderGood.quantity }} {{ inOrderGood.good.measure_unit.name }}
@if (!inOrderGood.discount_amount) { @@ -53,9 +53,11 @@ - +@if (visible()) { + +} diff --git a/src/app/domains/pos/modules/landing/components/order/order-submitted-dialog.component.html b/src/app/domains/pos/modules/landing/components/order/order-submitted-dialog.component.html index 4b392b2..55d715d 100644 --- a/src/app/domains/pos/modules/landing/components/order/order-submitted-dialog.component.html +++ b/src/app/domains/pos/modules/landing/components/order/order-submitted-dialog.component.html @@ -1,8 +1,8 @@ - @@ -15,4 +15,4 @@ - + diff --git a/src/app/domains/pos/modules/landing/components/order/order-submitted-dialog.component.ts b/src/app/domains/pos/modules/landing/components/order/order-submitted-dialog.component.ts index 2737911..22a5719 100644 --- a/src/app/domains/pos/modules/landing/components/order/order-submitted-dialog.component.ts +++ b/src/app/domains/pos/modules/landing/components/order/order-submitted-dialog.component.ts @@ -2,7 +2,7 @@ import { NativeBridgeService } from '@/core/services'; import { ToastService } from '@/core/services/toast.service'; import { PosInfoStore } from '@/domains/pos/store'; import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog'; -import { SharedDialogComponent } from '@/shared/components'; +import { SharedLightBottomsheetComponent } from '@/shared/components/dialog/light-bottomsheet.component'; import { formatJalali } from '@/utils'; import { Component, computed, inject, Input, signal } from '@angular/core'; import { Router } from '@angular/router'; @@ -15,7 +15,7 @@ import { IPosOrderResponse } from '../../models'; @Component({ selector: 'pos-order-submitted-dialog', templateUrl: 'order-submitted-dialog.component.html', - imports: [SharedDialogComponent, ButtonDirective], + imports: [SharedLightBottomsheetComponent, ButtonDirective], }) export class PosOrderSubmittedDialogComponent extends AbstractDialog { @Input({ required: true }) invoice!: IPosOrderResponse; 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 c20e840..3f6da32 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 @@ -12,7 +12,7 @@ } @else if (isStandardMode()) { 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..12f9763 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 @@ -6,7 +6,7 @@ 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 22d6275..5a07da4 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 @@ -31,6 +31,17 @@ export class PosGoldPayloadFormComponent extends AbstractForm< IPosOrderItem, IPosOrderItem > { + override defaultValues: Partial> = { + unit_price: 200_000_000, + quantity: 2, + payload: { + commission: 10_000, + wages: 10_000, + profit: 10_000, + karat: '18' as TGoldKarat, + } as any, + }; + @Output() onSubmitForm = new EventEmitter(); @Output() onChangeTotalAmount = new EventEmitter(); @@ -59,14 +70,14 @@ export class PosGoldPayloadFormComponent extends AbstractForm< const form = this.fb.group({ unit_price: [this.initialValues?.unit_price || 0, [Validators.required]], quantity: [this.initialValues?.quantity || 0, [Validators.required, greaterThanValidator(0)]], - discount_amount: [this.initialValues?.discount || 0], + discount: [this.initialValues?.discount || 0], discount_percentage: [0, [Validators.max(100), Validators.min(0)]], payload: this.fb.group({ - commission_amount: [this.initialValues?.payload?.commission || 0, [Validators.required]], + commission: [this.initialValues?.payload?.commission || 0, [Validators.required]], commission_percentage: [0, [Validators.required, Validators.max(100), Validators.min(0)]], - wages_amount: [this.initialValues?.payload?.wages || 0, [Validators.required]], + wages: [this.initialValues?.payload?.wages || 0, [Validators.required]], wages_percentage: [0, [Validators.required, Validators.max(100), Validators.min(0)]], - profit_amount: [this.initialValues?.payload?.profit || 0, [Validators.required]], + profit: [this.initialValues?.payload?.profit || 0, [Validators.required]], profit_percentage: [0, [Validators.required, Validators.max(100), Validators.min(0)]], karat: [this.initialValues?.payload?.karat || '', [Validators.required]], }), @@ -76,17 +87,15 @@ export class PosGoldPayloadFormComponent extends AbstractForm< this.updateCalculateAmount(value as any); }); - form.controls.payload.controls.profit_amount.valueChanges - .pipe(takeUntilDestroyed()) - .subscribe(() => { - // if ((form.controls.discount_amount.value || 0) > (value || 0)) { - form.controls.discount_amount.setValue(0, { emitEvent: false }); - // } - }); + form.controls.payload.controls.profit.valueChanges.pipe(takeUntilDestroyed()).subscribe(() => { + // if ((form.controls.discount_amount.value || 0) > (value || 0)) { + form.controls.discount.setValue(0, { emitEvent: false }); + // } + }); form.controls.payload.controls.profit_percentage.valueChanges .pipe(takeUntilDestroyed()) .subscribe(() => { - form.controls.discount_amount.setValue(0, { emitEvent: false }); + form.controls.discount.setValue(0, { emitEvent: false }); }); return form; @@ -101,19 +110,19 @@ export class PosGoldPayloadFormComponent extends AbstractForm< base_total_amount: this.baseTotalAmount(), tax_amount: this.taxAmount(), payload: { - commission: this.form.controls.payload.controls.commission_amount.value || 0, + commission: this.form.controls.payload.controls.commission.value || 0, karat: this.form.controls.payload.controls.karat.value as TGoldKarat, - profit: this.form.controls.payload.controls.profit_amount.value || 0, - wages: this.form.controls.payload.controls.wages_amount.value || 0, + profit: this.form.controls.payload.controls.profit.value || 0, + wages: this.form.controls.payload.controls.wages.value || 0, }, }); } updateCalculateAmount(payload: Partial>) { - const commissionAmount = Number(payload.payload?.commission_amount ?? '0'); - const wageAmount = Number(payload.payload?.wages_amount ?? '0'); - const discountAmount = Number(payload.discount_amount ?? '0'); - const profitAmount = Number(payload.payload?.profit_amount ?? '0'); + const commissionAmount = Number(payload.payload?.commission ?? '0'); + const wageAmount = Number(payload.payload?.wages ?? '0'); + const discountAmount = Number(payload.discount ?? '0'); + const profitAmount = Number(payload.payload?.profit ?? '0'); const unitPrice = Number(payload.unit_price ?? '0'); const quantity = Number(payload.quantity ?? '0'); diff --git a/src/app/domains/pos/modules/landing/components/payloads/standard/form.component.html b/src/app/domains/pos/modules/landing/components/payloads/standard/form.component.html index 2e60f0b..79d063b 100644 --- a/src/app/domains/pos/modules/landing/components/payloads/standard/form.component.html +++ b/src/app/domains/pos/modules/landing/components/payloads/standard/form.component.html @@ -3,9 +3,9 @@ diff --git a/src/app/domains/pos/modules/landing/components/payloads/standard/form.component.ts b/src/app/domains/pos/modules/landing/components/payloads/standard/form.component.ts index b243a90..6094183 100644 --- a/src/app/domains/pos/modules/landing/components/payloads/standard/form.component.ts +++ b/src/app/domains/pos/modules/landing/components/payloads/standard/form.component.ts @@ -1,7 +1,8 @@ +import ISummary from '@/core/models/summary'; import { AbstractForm } from '@/shared/abstractClasses'; import { InputComponent } from '@/shared/components'; import { AmountPercentageInputComponent } from '@/shared/components/amountPercentageInput/amount-percentage-input.component'; -import { formatWithCurrency, getGoodUnitTypeProperties, UnitType } from '@/utils'; +import { formatWithCurrency } from '@/utils'; import { Component, computed, EventEmitter, Input, Output, signal } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { ReactiveFormsModule, Validators } from '@angular/forms'; @@ -24,7 +25,7 @@ export class PosStandardPayloadFormComponent extends AbstractForm< IPosOrderItem, IPosOrderItem > { - @Input({ required: true }) unitType!: UnitType; + @Input({ required: true }) measureUnit!: ISummary; @Output() onChangeTotalAmount = new EventEmitter(); private readonly initialForm = () => { @@ -53,8 +54,6 @@ export class PosStandardPayloadFormComponent extends AbstractForm< }); } - preparedFormVisuals = computed(() => getGoodUnitTypeProperties(this.unitType)); - baseTotalAmount = signal(0); totalAmount = signal(0); discountAmount = signal(0); diff --git a/src/app/domains/pos/modules/landing/components/payment/form-dialog.component.html b/src/app/domains/pos/modules/landing/components/payment/form-dialog.component.html index dbc3392..7f9becc 100644 --- a/src/app/domains/pos/modules/landing/components/payment/form-dialog.component.html +++ b/src/app/domains/pos/modules/landing/components/payment/form-dialog.component.html @@ -1,8 +1,8 @@ - @@ -71,4 +71,4 @@ /> - + diff --git a/src/app/domains/pos/modules/landing/components/payment/form-dialog.component.ts b/src/app/domains/pos/modules/landing/components/payment/form-dialog.component.ts index 861ec13..9968874 100644 --- a/src/app/domains/pos/modules/landing/components/payment/form-dialog.component.ts +++ b/src/app/domains/pos/modules/landing/components/payment/form-dialog.component.ts @@ -3,7 +3,7 @@ import { NativeBridgeService } from '@/core/services'; import { ToastService } from '@/core/services/toast.service'; import { AbstractFormDialog } from '@/shared/abstractClasses'; import { InputComponent, KeyValueComponent } from '@/shared/components'; -import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component'; +import { SharedLightBottomsheetComponent } from '@/shared/components/dialog/light-bottomsheet.component'; import { FormFooterActionsComponent } from '@/shared/components/formFooterActions/form-footer-actions.component'; import { UikitFieldComponent } from '@/uikit'; import { Component, computed, inject, signal } from '@angular/core'; @@ -27,7 +27,7 @@ import { PosLandingStore } from '../../store/main.store'; FormFooterActionsComponent, KeyValueComponent, ButtonDirective, - SharedDialogComponent, + SharedLightBottomsheetComponent, Select, UikitFieldComponent, ], diff --git a/src/app/domains/pos/modules/landing/components/pre-invoice-dialog.component.html b/src/app/domains/pos/modules/landing/components/pre-invoice-dialog.component.html index 2292f7f..d0a76a2 100644 --- a/src/app/domains/pos/modules/landing/components/pre-invoice-dialog.component.html +++ b/src/app/domains/pos/modules/landing/components/pre-invoice-dialog.component.html @@ -1,11 +1,11 @@ -
-
+ diff --git a/src/app/domains/pos/modules/landing/components/pre-invoice-dialog.component.ts b/src/app/domains/pos/modules/landing/components/pre-invoice-dialog.component.ts index 830d60f..6e8c772 100644 --- a/src/app/domains/pos/modules/landing/components/pre-invoice-dialog.component.ts +++ b/src/app/domains/pos/modules/landing/components/pre-invoice-dialog.component.ts @@ -1,14 +1,14 @@ import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog'; +import { SharedLightBottomsheetComponent } from '@/shared/components/dialog/light-bottomsheet.component'; import { UikitFlatpickrJalaliComponent } from '@/uikit'; import { Component, inject } from '@angular/core'; import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms'; import { PosLandingStore } from '../store/main.store'; -import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component'; @Component({ selector: 'pos-pre-invoice-dialog', templateUrl: './pre-invoice-dialog.component.html', - imports: [SharedDialogComponent, UikitFlatpickrJalaliComponent, ReactiveFormsModule], + imports: [SharedLightBottomsheetComponent, UikitFlatpickrJalaliComponent, ReactiveFormsModule], }) export class PosPreInvoiceDialogComponent extends AbstractDialog { private readonly store = inject(PosLandingStore); diff --git a/src/app/domains/pos/modules/landing/models/types.ts b/src/app/domains/pos/modules/landing/models/types.ts index b0008ec..c77a4b4 100644 --- a/src/app/domains/pos/modules/landing/models/types.ts +++ b/src/app/domains/pos/modules/landing/models/types.ts @@ -1,5 +1,5 @@ +import ISummary from '@/core/models/summary'; import { IGoodResponse } from '@/domains/pos/models/good.io'; -import { UnitType } from '@/utils'; import { TPosOrderGoodPayload } from './payload'; export interface IPosOrderItem { @@ -7,7 +7,7 @@ export interface IPosOrderItem { quantity: number; total_amount: number; discount_amount: number; - unit_type: UnitType; + measure_unit: ISummary; good_id?: string; service_id?: string; notes?: string; diff --git a/src/app/domains/pos/modules/landing/store/main.store.ts b/src/app/domains/pos/modules/landing/store/main.store.ts index 8447fec..167c100 100644 --- a/src/app/domains/pos/modules/landing/store/main.store.ts +++ b/src/app/domains/pos/modules/landing/store/main.store.ts @@ -221,7 +221,7 @@ export class PosLandingStore { items: this.inOrderGoods().map(({ good, ...rest }) => ({ ...rest, good_id: good.id, - unit_type: good.unit_type, + measure_unit: good.measure_unit, })), invoice_date: new Date().toISOString(), payments: this.payments(), 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 5a56ad8..760dde9 100644 --- a/src/app/domains/pos/modules/landing/views/root.component.html +++ b/src/app/domains/pos/modules/landing/views/root.component.html @@ -34,17 +34,11 @@ } - + @if (showInvoiceBottomSheet()) { } - + @if (responseInvoice()) { diff --git a/src/app/domains/pos/modules/landing/views/root.component.ts b/src/app/domains/pos/modules/landing/views/root.component.ts index 7f6ef46..5f6f248 100644 --- a/src/app/domains/pos/modules/landing/views/root.component.ts +++ b/src/app/domains/pos/modules/landing/views/root.component.ts @@ -2,7 +2,7 @@ import { Maybe } from '@/core'; import { PosInfoStore } from '@/domains/pos/store/pos.store'; import { AbstractIsMobileComponent } from '@/shared/abstractClasses/abstract-is-mobile'; -import { SharedDialogComponent } from '@/shared/components'; +import { SharedLightBottomsheetComponent } from '@/shared/components/dialog/light-bottomsheet.component'; import { PageLoadingComponent } from '@/shared/components/page-loading.component'; import { PriceMaskDirective } from '@/shared/directives'; import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core'; @@ -24,7 +24,7 @@ import { PosLandingStore } from '../store/main.store'; PosOrderSectionComponent, PageLoadingComponent, PriceMaskDirective, - SharedDialogComponent, + SharedLightBottomsheetComponent, ButtonDirective, PosOrderSubmittedDialogComponent, ], diff --git a/src/app/domains/pos/modules/support/views/root.component.html b/src/app/domains/pos/modules/support/views/root.component.html index 095b307..5e47c5f 100644 --- a/src/app/domains/pos/modules/support/views/root.component.html +++ b/src/app/domains/pos/modules/support/views/root.component.html @@ -1,6 +1,47 @@ -
-
-

پشتیبانی

-

این صفحه به زودی تکمیل می شود.

-
+
+
+
+

پشتیبانی تیس

+

+ در صورت بروز مشکل در ثبت سفارش، صدور صورتحساب یا تنظیمات دستگاه، تیم پشتیبانی آماده پاسخگویی است. لطفا هنگام + تماس، نام پایانه و شماره سریال دستگاه را همراه داشته باشید. +

+
+ +
+
+

شماره های تماس مستقیم

+ +
+ +
+

راهنمای سریع قبل از تماس

+
    +
  • اتصال اینترنت دستگاه را بررسی کنید.
  • +
  • یک بار برنامه را ببندید و دوباره اجرا کنید.
  • +
  • در صفحه درباره نرم افزار، نسخه برنامه را اعلام کنید.
  • +
  • در صورت خطا، متن خطا یا تصویر آن را برای پشتیبانی ارسال کنید.
  • +
+
+
+ +
+

+ ساعات پاسخگویی: شنبه تا چهارشنبه 8:30 تا 17:30 و پنجشنبه 8:30 تا 13:00 +

+
+
diff --git a/src/app/layout/default/app.layout.component.ts b/src/app/layout/default/app.layout.component.ts index 6500b20..c43b1df 100644 --- a/src/app/layout/default/app.layout.component.ts +++ b/src/app/layout/default/app.layout.component.ts @@ -38,6 +38,11 @@ export class AppLayout { public renderer: Renderer2, public router: Router, ) { + this.layoutService.headerSlot$.subscribe((tpl) => (this.topBarMoreAction = tpl)); + this.layoutService.topbarStartSlot$.subscribe((tpl) => (this.topBarStartAction = tpl)); + this.layoutService.topbarCenterSlot$.subscribe((tpl) => (this.topBarCenterAction = tpl)); + this.layoutService.topbarEndSlot$.subscribe((tpl) => (this.topBarEndAction = tpl)); + this.overlayMenuOpenSubscription = this.layoutService.overlayOpen$.subscribe(() => { if (!this.menuOutsideClickListener) { this.menuOutsideClickListener = this.renderer.listen('document', 'click', (event) => { @@ -133,11 +138,6 @@ export class AppLayout { }); ngOnInit() { - this.layoutService.headerSlot$.subscribe((tpl) => (this.topBarMoreAction = tpl)); - this.layoutService.topbarStartSlot$.subscribe((tpl) => (this.topBarStartAction = tpl)); - this.layoutService.topbarCenterSlot$.subscribe((tpl) => (this.topBarCenterAction = tpl)); - this.layoutService.topbarEndSlot$.subscribe((tpl) => (this.topBarEndAction = tpl)); - if (window.location.pathname === '/') { if (!this.authService.currentAccount()) { this.router.navigateByUrl('auth'); diff --git a/src/app/shared/abstractClasses/abstract-form.ts b/src/app/shared/abstractClasses/abstract-form.ts index 88feecf..ff7007d 100644 --- a/src/app/shared/abstractClasses/abstract-form.ts +++ b/src/app/shared/abstractClasses/abstract-form.ts @@ -37,14 +37,14 @@ export abstract class AbstractForm< } ngOnInit() { - this.form.reset(this.initialValues ?? this.defaultValues); + this.form.patchValue(this.initialValues ?? this.defaultValues); // Object.entries(this.form.controls).forEach(([key, control]) => { // console.log(key, control); // }); } ngOnChanges() { - this.form.reset(this.initialValues ?? this.defaultValues); + this.form.patchValue(this.initialValues ?? this.defaultValues); } onSuccess(response: Response): void {} diff --git a/src/app/shared/apiEnum/select.component.html b/src/app/shared/apiEnum/select.component.html index 32d5c49..32a3853 100644 --- a/src/app/shared/apiEnum/select.component.html +++ b/src/app/shared/apiEnum/select.component.html @@ -7,6 +7,7 @@ [formControl]="control" [showClear]="showClear" [name]="name || type" + [overlayOptions]="overlayOptions()" appendTo="body" /> diff --git a/src/app/shared/apiEnum/select.component.ts b/src/app/shared/apiEnum/select.component.ts index 8cf1e70..6d7b75f 100644 --- a/src/app/shared/apiEnum/select.component.ts +++ b/src/app/shared/apiEnum/select.component.ts @@ -1,5 +1,6 @@ import { UikitFieldComponent } from '@/uikit'; -import { Component, computed, inject, Input } from '@angular/core'; +import { DOCUMENT } from '@angular/common'; +import { Component, Inject, computed, inject, Input } from '@angular/core'; import { ReactiveFormsModule } from '@angular/forms'; import { Select } from 'primeng/select'; import { Observable } from 'rxjs'; @@ -19,6 +20,9 @@ export class EnumSelectComponent extends AbstractSelectComponent this.customLabel ?? apiEnumTranslates[this.type]); @@ -29,4 +33,20 @@ export class EnumSelectComponent extends AbstractSelectComponent Number.parseInt(drawer.style.zIndex || '0', 10)) + .filter((zIndex) => Number.isFinite(zIndex) && zIndex > 0); + + return zIndexes.length ? Math.max(...zIndexes) + 2 : 1000; + } } diff --git a/src/app/shared/components/amountPercentageInput/amount-percentage-input.component.html b/src/app/shared/components/amountPercentageInput/amount-percentage-input.component.html index 88e88b4..965e006 100644 --- a/src/app/shared/components/amountPercentageInput/amount-percentage-input.component.html +++ b/src/app/shared/components/amountPercentageInput/amount-percentage-input.component.html @@ -24,8 +24,8 @@ [attr.name]="name" [attr.placeholder]="placeholder" [attr.autocomplete]="autocomplete" - [class]="` w-full hasSuffix text-left ${size === 'large' ? 'p-inputtext-lg' : size === 'small' ? 'p-inputtext-sm' : ''}`" - dir="ltr" + [inputStyle]="{ direction: 'ltr' }" + [inputStyleClass]="` w-full hasSuffix text-left ${size === 'large' ? 'p-inputtext-lg' : size === 'small' ? 'p-inputtext-sm' : ''}`" [required]="required" [invalid]="amountControl.invalid && (amountControl.touched || amountControl.dirty)" (onInput)="onPriceInput($event)" @@ -58,9 +58,10 @@ diff --git a/src/app/shared/components/amountPercentageInput/amount-percentage-input.component.ts b/src/app/shared/components/amountPercentageInput/amount-percentage-input.component.ts index 17a536f..fafe311 100644 --- a/src/app/shared/components/amountPercentageInput/amount-percentage-input.component.ts +++ b/src/app/shared/components/amountPercentageInput/amount-percentage-input.component.ts @@ -180,11 +180,16 @@ export class AmountPercentageInputComponent { const amountValue = Number(this.amountControl.value || 0); const percentageValue = Number(this.percentageControl.value || 0); const isPercentageType = percentageValue > 0 && amountValue <= 0; + + console.log(amountValue, percentageValue, isPercentageType); + this.preparedLabel.set(this.prepareLabel(isPercentageType)); this.selectedType.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => { this.preparedLabel.set(this.prepareLabel(value === 'percentage')); }); + + this.selectedType.setValue(isPercentageType ? 'percentage' : 'amount'); } ngOnChanges() { diff --git a/src/app/shared/components/checkbox/checkbox.component.html b/src/app/shared/components/checkbox/checkbox.component.html index 090b144..17e9989 100644 --- a/src/app/shared/components/checkbox/checkbox.component.html +++ b/src/app/shared/components/checkbox/checkbox.component.html @@ -1,6 +1,6 @@
- + {{ label }}
diff --git a/src/app/shared/components/dialog/light-bottomsheet.component.html b/src/app/shared/components/dialog/light-bottomsheet.component.html index a2e6fe7..5fd859a 100644 --- a/src/app/shared/components/dialog/light-bottomsheet.component.html +++ b/src/app/shared/components/dialog/light-bottomsheet.component.html @@ -1,20 +1,21 @@
-