diff --git a/src/app/core/services/native-bridge.service.ts b/src/app/core/services/native-bridge.service.ts index a5bbc37..95bfe5a 100644 --- a/src/app/core/services/native-bridge.service.ts +++ b/src/app/core/services/native-bridge.service.ts @@ -70,19 +70,19 @@ export class NativeBridgeService { pay(request: INativePayRequest): any { if (request.amount <= 10_000) { const errorMessage = 'برای مقادیر زیر ۱۰۰ هزار ریال، پرداخت ممکن نیست.'; - this.toastService.error({ text: errorMessage, life: 3000 }); + this.toastService.warn({ text: errorMessage, life: 3000 }); return { success: false, error: errorMessage, }; } - this.toastService.info({ text: 'در حال پردازش پرداخت...', life: 3000 }); + this.toastService.info({ text: 'در حال پردازش پرداخت...' }); try { // @ts-ignore window.NativeBridge.pay(request.amount, request.id || ''); return { success: true }; } catch (error) { - this.toastService.info({ text: (error as Error).message, life: 30000 }); + this.toastService.info({ text: (error as Error).message }); return { success: false, error: (error as Error).message }; } // const fn = window.NativeBridge.pay(123, 'test'); @@ -99,7 +99,7 @@ export class NativeBridgeService { // // return { success: true, data: parsed ?? raw }; // } catch (error) { - // this.toastService.info({ text: (error as Error).message, life: 30000 }); + // this.toastService.info({ text: (error as Error).message, }); // return { success: false, error: (error as Error).message }; // } } @@ -109,12 +109,16 @@ export class NativeBridgeService { } private invokePrint(payload: INativePrintRequest): INativeBridgeResult { + if (!this.isEnabled() || !this.canPrint()) { + this.toastService.warn({ text: 'متاسفانه ارتباط با چاپگر برقرار نیست.' }); + return { success: false, error: 'متاسفانه ارتباط با چاپگر برقرار نیست.' }; + } try { // @ts-ignore window.NativeBridge.print(JSON.stringify([payload])); return { success: true }; } catch (error) { - this.toastService.info({ text: (error as Error).message, life: 30000 }); + this.toastService.warn({ text: 'متاسفانه ارتباط با چاپگر برقرار نیست.' }); return { success: false, error: (error as Error).message }; } } diff --git a/src/app/domains/consumer/constants/menuItems.const.ts b/src/app/domains/consumer/constants/menuItems.const.ts index 2df966b..f822ed6 100644 --- a/src/app/domains/consumer/constants/menuItems.const.ts +++ b/src/app/domains/consumer/constants/menuItems.const.ts @@ -8,7 +8,7 @@ export const CONSUMER_MENU_ITEMS = [ routerLink: ['/consumer'], }, { - label: 'فعالیت‌های اقتصادی', + label: 'فعالیت اقتصادی', icon: 'pi pi-fw pi-home', routerLink: ['/consumer/business_activities'], }, diff --git a/src/app/domains/consumer/modules/businessActivities/components/list.component.html b/src/app/domains/consumer/modules/businessActivities/components/list.component.html index 301e178..2003a77 100644 --- a/src/app/domains/consumer/modules/businessActivities/components/list.component.html +++ b/src/app/domains/consumer/modules/businessActivities/components/list.component.html @@ -1,5 +1,5 @@ - `/partner/consumers/${consumerId}/business_activities`, + title: 'فعالیت اقتصادی', + pagePath: (consumerId: string) => `/partner/consumers/${consumerId}/business_activities`, }, }, businessActivity: { @@ -45,8 +44,7 @@ export const PARTNER_CONSUMER_BUSINESS_ACTIVITIES_ROUTES: Routes = [ children: [ { path: '', - loadComponent: - partnerConsumerBusinessActivitiesNamedRoutes.businessActivity.loadComponent, + loadComponent: partnerConsumerBusinessActivitiesNamedRoutes.businessActivity.loadComponent, }, ...PARTNER_CONSUMER_COMPLEXES_ROUTES, ], diff --git a/src/app/domains/partner/modules/consumers/views/list.component.html b/src/app/domains/partner/modules/consumers/views/list.component.html index 135ee51..6156ea9 100644 --- a/src/app/domains/partner/modules/consumers/views/list.component.html +++ b/src/app/domains/partner/modules/consumers/views/list.component.html @@ -1,5 +1,5 @@ - - @@ -26,11 +24,34 @@ -@if (loading()) { - -} @else { - - + + } + @if (loading()) { + + } @else { + + - @if (error()) { - @switch (error()?.status) { - @case (412) { - - } - @default { -
- -
- - عدم دسترسی -

متاسفانه امکان دسترسی برای کاربر شما فراهم نیست

- -
-
-
+ @if (error()) { + @switch (error()?.status) { + @case (412) { + + } + @default { +
+ +
+ + عدم دسترسی +

متاسفانه امکان دسترسی برای کاربر شما فراهم نیست

+ +
+
+
+ } } + } @else { + + } - } @else { - - + } - -} + diff --git a/src/app/domains/pos/layouts/layout.component.ts b/src/app/domains/pos/layouts/layout.component.ts index 981a944..d0d55fd 100644 --- a/src/app/domains/pos/layouts/layout.component.ts +++ b/src/app/domains/pos/layouts/layout.component.ts @@ -3,6 +3,7 @@ import { NativeBridgeService } from '@/core/services'; import { ToastService } from '@/core/services/toast.service'; import { LayoutService } from '@/layout/service/layout.service'; import { PageLoadingComponent } from '@/shared/components/page-loading.component'; +import { CommonModule } from '@angular/common'; import { AfterViewInit, Component, @@ -34,6 +35,7 @@ import { PosMainMenuSidebarComponent } from './mainMenuSidebar/main-menu-sidebar Button, PosMainMenuSidebarComponent, Menu, + CommonModule, ], }) export class PosLayoutComponent implements AfterViewInit { @@ -84,6 +86,10 @@ export class PosLayoutComponent implements AfterViewInit { placeholderLogo = images.placeholders.logo; now = new Date(); + private touchStartY = 0; + private pulling = false; + pullDistance = signal(0); + readonly pullThreshold = 80; getData() { this.posProfileStore.getData().subscribe({ @@ -101,24 +107,6 @@ export class PosLayoutComponent implements AfterViewInit { this.getData(); } - doPay() { - // this.nativeBridgeService.pay({ - // amount: 10_000, - // id: '1', - // }); - this.nativeBridgeService.print({ - title: 'salam', - items: [ - { - label: 'مجموع قیمت', - value: '10_000', - }, - ], - }); - // @ts-ignore - // window.NativeBridge.pay(12312, 'test'); - } - ngOnInit() { this.layoutService.changeIsFullPage(true); this.getData(); @@ -137,7 +125,33 @@ export class PosLayoutComponent implements AfterViewInit { this.layoutService.setTopbarEndSlot(null); } - refresh() { - window.location.reload(); + onTouchStart(event: TouchEvent) { + if (window.scrollY > 0 || event.touches.length !== 1) return; + this.touchStartY = event.touches[0].clientY; + this.pulling = true; + } + + onTouchMove(event: TouchEvent) { + if (!this.pulling) return; + const delta = event.touches[0].clientY - this.touchStartY; + if (delta <= 0) { + this.pullDistance.set(0); + return; + } + + const damped = Math.min(delta * 0.5, 140); + this.pullDistance.set(damped); + event.preventDefault(); + } + + onTouchEnd() { + if (!this.pulling) return; + const shouldRefresh = this.pullDistance() >= this.pullThreshold; + this.pulling = false; + this.pullDistance.set(0); + if (shouldRefresh) { + this.layoutService.changeIsFullPage(true); + this.getData(); + } } } diff --git a/src/app/domains/pos/modules/landing/components/categories.component.html b/src/app/domains/pos/modules/landing/components/categories.component.html index 7a51075..650f017 100644 --- a/src/app/domains/pos/modules/landing/components/categories.component.html +++ b/src/app/domains/pos/modules/landing/components/categories.component.html @@ -1,29 +1,31 @@ -
- @if (loading()) { - @for (i of [1, 2, 3, 4, 5]; track i) { - - } - } @else { - @for (category of categories(); track category.id) { -
- {{ category.name }} +
+
+ @if (loading()) { + @for (i of [1, 2, 3, 4, 5]; track i) { + + } + } @else { + @for (category of categories(); track category.id) {
- - {{ category.goods_count }} - + {{ category.name }} +
+ + {{ category.goods_count }} + +
-
+ } } - } +
diff --git a/src/app/domains/pos/modules/landing/components/order/order-section.component.html b/src/app/domains/pos/modules/landing/components/order/order-section.component.html index ac229d2..424c024 100644 --- a/src/app/domains/pos/modules/landing/components/order/order-section.component.html +++ b/src/app/domains/pos/modules/landing/components/order/order-section.component.html @@ -63,4 +63,4 @@ - + diff --git a/src/app/domains/pos/modules/landing/components/order/order-section.component.ts b/src/app/domains/pos/modules/landing/components/order/order-section.component.ts index 19a70b4..30f3abb 100644 --- a/src/app/domains/pos/modules/landing/components/order/order-section.component.ts +++ b/src/app/domains/pos/modules/landing/components/order/order-section.component.ts @@ -6,6 +6,7 @@ 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'; @@ -31,7 +32,7 @@ import { POSOrderPriceInfoCardComponent } from './price-info-card.component'; export class PosOrderSectionComponent { private readonly store = inject(PosLandingStore); @Output() onAddMoreGoods = new EventEmitter(); - @Output() onSuccess = new EventEmitter(); + @Output() onSuccess = new EventEmitter(); placeholderImage = images.placeholders.default; @@ -84,9 +85,7 @@ export class PosOrderSectionComponent { } submitCustomer() {} - submitPayment() { - console.log('submitPayment'); - - this.onSuccess.emit(); + submitPayment(invoice: IPosOrderResponse) { + this.onSuccess.emit(invoice); } } 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 new file mode 100644 index 0000000..aba9eda --- /dev/null +++ b/src/app/domains/pos/modules/landing/components/order/order-submitted-dialog.component.html @@ -0,0 +1,18 @@ + +
+ +

فاکتور شما با موفقیت ایجاد شد.

+
+
+ + + +
+
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 new file mode 100644 index 0000000..bbd227a --- /dev/null +++ b/src/app/domains/pos/modules/landing/components/order/order-submitted-dialog.component.ts @@ -0,0 +1,56 @@ +import { NativeBridgeService } from '@/core/services'; +import { ToastService } from '@/core/services/toast.service'; +import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog'; +import { SharedDialogComponent } from '@/shared/components'; +import { Component, inject, Input, signal } from '@angular/core'; +import { ButtonDirective } from 'primeng/button'; +import { finalize } from 'rxjs'; +import { PosSaleInvoicesService } from '../../../saleInvoices/services/main.service'; +import { IPosOrderResponse } from '../../models'; + +@Component({ + selector: 'pos-order-submitted-dialog', + templateUrl: 'order-submitted-dialog.component.html', + imports: [SharedDialogComponent, ButtonDirective], +}) +export class PosOrderSubmittedDialogComponent extends AbstractDialog { + @Input({ required: true }) invoice!: IPosOrderResponse; + private readonly nativeBridgeService = inject(NativeBridgeService); + private readonly service = inject(PosSaleInvoicesService); + private readonly toastService = inject(ToastService); + + sendingLoading = signal(false); + sended = signal(false); + + openOrderDetails() { + this.close(); + } + + sendInvoice() { + this.sendingLoading.set(true); + this.service + .sendToTsp(this.invoice.id) + .pipe(finalize(() => this.sendingLoading.set(false))) + .subscribe(() => { + this.toastService.success({ text: 'ارسال فاکتور با موفقیت انجام شد.' }); + this.sended.set(true); + }); + } + + printInvoice() { + const printResult = this.nativeBridgeService.print({ + title: 'رسید پرداخت', + items: [ + { label: 'مبلغ کل', value: String(this.invoice.code) }, + // { label: 'نقدی', value: String(this.invoice.payment.cash || 0) }, + // { label: 'تهاتر', value: String(this.invoice.payment.set_off || 0) }, + // { + // label: 'پایانه', + // value: String((this.invoice.payment.terminals || []).reduce((acc, item) => acc + item, 0)), + // }, + ], + }); + } + + sendToTsp() {} +} 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 87a1650..07c5457 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 @@ -6,12 +6,12 @@ import { InputComponent, KeyValueComponent } from '@/shared/components'; import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component'; import { FormFooterActionsComponent } from '@/shared/components/formFooterActions/form-footer-actions.component'; import { UikitFieldComponent } from '@/uikit'; -import { Component, OnDestroy, OnInit, computed, inject, signal } from '@angular/core'; +import { Component, computed, inject, signal } from '@angular/core'; import { FormControl, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms'; import { ButtonDirective } from 'primeng/button'; import { Select } from 'primeng/select'; import { catchError, throwError } from 'rxjs'; -import { IPayment, TOrderPaymentTypes } from '../../models'; +import { IPayment, IPosOrderResponse, TOrderPaymentTypes } from '../../models'; import { PosPaymentBridgeAbstract } from '../../services/payment-bridge.abstract'; import { PosPaymentBridgeService } from '../../services/payment-bridge.service'; import { PosLandingStore } from '../../store/main.store'; @@ -32,10 +32,7 @@ import { PosLandingStore } from '../../store/main.store'; ], providers: [{ provide: PosPaymentBridgeAbstract, useExisting: PosPaymentBridgeService }], }) -export class PosPaymentFormDialogComponent - extends AbstractFormDialog - implements OnInit, OnDestroy -{ +export class PosPaymentFormDialogComponent extends AbstractFormDialog { private readonly store = inject(PosLandingStore); private readonly paymentBridge = inject(PosPaymentBridgeAbstract); private readonly nativeBridgeService = inject(NativeBridgeService); @@ -72,8 +69,8 @@ export class PosPaymentFormDialogComponent private initForm = () => { const form = this.fb.group({ - set_off: [this.initialValues?.set_off || 0], - cash: [this.initialValues?.cash || 0], + set_off: [0], + cash: [0], terminals: this.fb.array([this.fb.control(0)]), }); @@ -237,10 +234,7 @@ export class PosPaymentFormDialogComponent ) .subscribe((res) => { this.close(); - this.onSubmit.emit(); - this.toastServices.success({ - text: 'فاکتور شما با موفقیت ایجاد شد', - }); + this.onSubmit.emit(res); }); } } @@ -289,7 +283,7 @@ export class PosPaymentFormDialogComponent // } } - override onSuccess(response: IPayment): void {} + override onSuccess(response: IPosOrderResponse): void {} private extractAmountFromPaymentResult(payload: unknown): number | null { if (!payload || typeof payload !== 'object') return null; diff --git a/src/app/domains/pos/modules/landing/models/io.d.ts b/src/app/domains/pos/modules/landing/models/io.d.ts index 469e5d7..80342f0 100644 --- a/src/app/domains/pos/modules/landing/models/io.d.ts +++ b/src/app/domains/pos/modules/landing/models/io.d.ts @@ -15,7 +15,7 @@ export interface IPosOrderRequest { } export interface IPosOrderRawResponse { - id?: string; - code?: string; + id: string; + code: string; } export interface IPosOrderResponse extends IPosOrderRawResponse {} 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 50d1115..07cb691 100644 --- a/src/app/domains/pos/modules/landing/views/root.component.html +++ b/src/app/domains/pos/modules/landing/views/root.component.html @@ -1,47 +1,48 @@ @if (loading()) { } @else if (pos()) { -
-
-
+
+
+
- - - @if (inOrderGoods().length > 0) { - - } - - - -
+ + @if (inOrderGoods().length > 0) { + + } + + + + + @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 d35d543..0c35a54 100644 --- a/src/app/domains/pos/modules/landing/views/root.component.ts +++ b/src/app/domains/pos/modules/landing/views/root.component.ts @@ -1,4 +1,5 @@ // import { CatalogRoleTagComponent } from '@/shared/catalog/roles'; +import { Maybe } from '@/core'; import { PosInfoStore } from '@/domains/pos/store/pos.store'; import { SharedDialogComponent } from '@/shared/components'; import { PageLoadingComponent } from '@/shared/components/page-loading.component'; @@ -7,6 +8,8 @@ import { Component, computed, inject, signal } from '@angular/core'; import { ButtonDirective } from 'primeng/button'; import { PosGoodsComponent } from '../components/goods.component'; import { PosOrderSectionComponent } from '../components/order/order-section.component'; +import { PosOrderSubmittedDialogComponent } from '../components/order/order-submitted-dialog.component'; +import { IPosOrderResponse } from '../models'; import { PosLandingStore } from '../store/main.store'; @Component({ @@ -21,12 +24,16 @@ import { PosLandingStore } from '../store/main.store'; PriceMaskDirective, SharedDialogComponent, ButtonDirective, + PosOrderSubmittedDialogComponent, ], }) export class PosLandingComponent { private readonly infoStore = inject(PosInfoStore); private readonly landingStore = inject(PosLandingStore); + isVisibleSuccessDialog = signal(false); + responseInvoice = signal>(null); + readonly loading = computed(() => this.infoStore.loading()); readonly pos = computed(() => this.infoStore.entity()); readonly error = computed(() => this.infoStore.error()); @@ -45,4 +52,14 @@ export class PosLandingComponent { closeInvoiceBottomSheet() { this.showInvoiceBottomSheet.set(false); } + + onSuccessSubmit(invoice: IPosOrderResponse) { + this.closeInvoiceBottomSheet(); + this.responseInvoice.set(invoice); + this.isVisibleSuccessDialog.set(true); + } + + closeSuccessDialog() { + this.isVisibleSuccessDialog.set(false); + } } diff --git a/src/app/domains/pos/modules/saleInvoices/components/sale-invoice-card.component.ts b/src/app/domains/pos/modules/saleInvoices/components/sale-invoice-card.component.ts index a4d1db4..10d490d 100644 --- a/src/app/domains/pos/modules/saleInvoices/components/sale-invoice-card.component.ts +++ b/src/app/domains/pos/modules/saleInvoices/components/sale-invoice-card.component.ts @@ -52,7 +52,6 @@ export class SaleInvoiceCardComponent { if (customer) { const { legal, individual } = customer; let text = 'نوع اول - '; - console.log(customer); if (legal) { text += `حقوقی (${legal.company_name})`; } @@ -67,7 +66,7 @@ export class SaleInvoiceCardComponent { sendInvoice() { this.sendingLoading.set(true); this.service - .sendFiscal(this.saleInvoice.id) + .sendToTsp(this.saleInvoice.id) .pipe(finalize(() => this.sendingLoading.set(false))) .subscribe(() => { this.toastService.success({ text: 'ارسال فاکتور با موفقیت انجام شد.' }); @@ -88,7 +87,7 @@ export class SaleInvoiceCardComponent { resendInvoice() { this.resendingLoading.set(true); this.service - .retryFiscal(this.saleInvoice.id) + .retrySendToTsp(this.saleInvoice.id) .pipe(finalize(() => this.resendingLoading.set(false))) .subscribe(() => { this.toastService.success({ text: 'ارسال مجدد فاکتور با موفقیت انجام شد.' }); diff --git a/src/app/domains/pos/modules/saleInvoices/constants/apiRoutes/index.ts b/src/app/domains/pos/modules/saleInvoices/constants/apiRoutes/index.ts index 7ea93f8..3920200 100644 --- a/src/app/domains/pos/modules/saleInvoices/constants/apiRoutes/index.ts +++ b/src/app/domains/pos/modules/saleInvoices/constants/apiRoutes/index.ts @@ -3,12 +3,12 @@ const baseUrl = () => `/api/v1/pos/sales_invoices`; export const POS_SALE_INVOICES_API_ROUTES = { list: () => baseUrl(), single: (invoiceId: string) => `${baseUrl()}/${invoiceId}`, - fiscal: { + tsp: { send: (invoiceId: string) => `${baseUrl()}/${invoiceId}/send`, - retry: (invoiceId: string) => `${baseUrl()}/${invoiceId}/fiscal/retry`, - status: (invoiceId: string) => `${baseUrl()}/${invoiceId}/fiscal/status`, getInquiry: (invoiceId: string) => `${baseUrl()}/${invoiceId}/inquiry`, revoke: (invoiceId: string) => `${baseUrl()}/${invoiceId}/revoke`, + retry: (invoiceId: string) => `${baseUrl()}/${invoiceId}/fiscal/retry`, + status: (invoiceId: string) => `${baseUrl()}/${invoiceId}/fiscal/status`, attempts: (invoiceId: string) => `${baseUrl()}/${invoiceId}/fiscal/attempts`, }, }; diff --git a/src/app/domains/pos/modules/saleInvoices/services/main.service.ts b/src/app/domains/pos/modules/saleInvoices/services/main.service.ts index f5722ed..c94e8c4 100644 --- a/src/app/domains/pos/modules/saleInvoices/services/main.service.ts +++ b/src/app/domains/pos/modules/saleInvoices/services/main.service.ts @@ -32,43 +32,41 @@ export class PosSaleInvoicesService { return this.http.get(this.apiRoutes.single(invoiceId)); } - sendFiscal(invoiceId: string): Observable { + sendToTsp(invoiceId: string): Observable { return this.http.post( - this.apiRoutes.fiscal.send(invoiceId), + this.apiRoutes.tsp.send(invoiceId), {}, ); } - retryFiscal(invoiceId: string): Observable { + retrySendToTsp(invoiceId: string): Observable { return this.http.post( - this.apiRoutes.fiscal.retry(invoiceId), + this.apiRoutes.tsp.retry(invoiceId), {}, ); } getFiscalStatus(invoiceId: string): Observable { - return this.http.get( - this.apiRoutes.fiscal.status(invoiceId), - ); + return this.http.get(this.apiRoutes.tsp.status(invoiceId)); } getInquiry(invoiceId: string): Observable { return this.http.get( - this.apiRoutes.fiscal.getInquiry(invoiceId), + this.apiRoutes.tsp.getInquiry(invoiceId), {}, ); } revoke(invoiceId: string): Observable { return this.http.post( - this.apiRoutes.fiscal.revoke(invoiceId), + this.apiRoutes.tsp.revoke(invoiceId), {}, ); } getFiscalAttempts(invoiceId: string): Observable { return this.http.get( - this.apiRoutes.fiscal.attempts(invoiceId), + this.apiRoutes.tsp.attempts(invoiceId), ); } } diff --git a/src/app/domains/superAdmin/modules/consumers/components/businessActivities/list.component.html b/src/app/domains/superAdmin/modules/consumers/components/businessActivities/list.component.html index 1ea2bd4..bddd8a6 100644 --- a/src/app/domains/superAdmin/modules/consumers/components/businessActivities/list.component.html +++ b/src/app/domains/superAdmin/modules/consumers/components/businessActivities/list.component.html @@ -1,5 +1,5 @@ `/super_admin/consumers/${consumerId}/business_activities`, }, diff --git a/src/app/domains/superAdmin/modules/consumers/views/list.component.ts b/src/app/domains/superAdmin/modules/consumers/views/list.component.ts index d3f66f5..ef4c81d 100644 --- a/src/app/domains/superAdmin/modules/consumers/views/list.component.ts +++ b/src/app/domains/superAdmin/modules/consumers/views/list.component.ts @@ -21,7 +21,7 @@ export class ConsumersComponent extends AbstractList { this.columns = [ // { field: 'id', header: 'شناسه', type: 'id' }, { field: 'name', header: 'نام' }, - { field: 'business_counts', header: 'تعداد فعالیت‌های اقتصادی' }, + { field: 'business_counts', header: 'تعداد فعالیت اقتصادی' }, { field: 'partner', header: 'ایجاد شده توسط', diff --git a/src/app/domains/superAdmin/modules/guilds/components/categories/list.component.html b/src/app/domains/superAdmin/modules/guilds/components/categories/list.component.html index 07fd084..83e9a18 100644 --- a/src/app/domains/superAdmin/modules/guilds/components/categories/list.component.html +++ b/src/app/domains/superAdmin/modules/guilds/components/categories/list.component.html @@ -1,15 +1,15 @@ + guildGoodCategoriesNamedRoutes.goodCategories.meta.pagePath!(this.guildId), + ); + override setColumns(): void { this.columns = this.header; } diff --git a/src/app/domains/superAdmin/modules/guilds/constants/routes/goodCategories.ts b/src/app/domains/superAdmin/modules/guilds/constants/routes/goodCategories.ts index c05b2f4..a6b8c32 100644 --- a/src/app/domains/superAdmin/modules/guilds/constants/routes/goodCategories.ts +++ b/src/app/domains/superAdmin/modules/guilds/constants/routes/goodCategories.ts @@ -5,12 +5,13 @@ export type TGuildGoodCategoriesRouteNames = 'goodCategories'; export const guildGoodCategoriesNamedRoutes: NamedRoutes = { goodCategories: { - path: 'good_categories', + path: 'good-categories', loadComponent: () => import('../../views/categories/list.component').then((m) => m.GuildGoodCategoriesComponent), // @ts-ignore meta: { title: 'دسته‌بندی‌های کالا', + pagePath: (guildId: string) => `/super_admin/guilds/${guildId}/good-categories`, }, }, // goodCategory: { diff --git a/src/app/domains/superAdmin/modules/partners/components/form.component.ts b/src/app/domains/superAdmin/modules/partners/components/form.component.ts index 75d4037..30118d1 100644 --- a/src/app/domains/superAdmin/modules/partners/components/form.component.ts +++ b/src/app/domains/superAdmin/modules/partners/components/form.component.ts @@ -39,26 +39,28 @@ export class GuildFormComponent extends AbstractFormDialog>); if (this.editMode && !this.partnerId) { throw 'missing some arguments'; } - this.initForm(); } override submitForm(payload: IPartnerRequest) { - const formData = buildFormData(this.form, { logo: this.logo() }, ['confirmPassword']); + const skipFields = this.editMode + ? ['confirmPassword', 'username', 'password'] + : ['confirmPassword']; + const formData = buildFormData(this.form, { logo: this.logo() }, skipFields); if (this.editMode) { return this.service.update(this.partnerId!, formData); diff --git a/src/app/domains/superAdmin/modules/partners/models/io.d.ts b/src/app/domains/superAdmin/modules/partners/models/io.d.ts index bc59bd0..de27eef 100644 --- a/src/app/domains/superAdmin/modules/partners/models/io.d.ts +++ b/src/app/domains/superAdmin/modules/partners/models/io.d.ts @@ -1,8 +1,10 @@ +import { IEnumTranslate } from '@/shared/models/enum_translate.type'; + export interface IPartnerRawResponse { id: string; name: string; code: string; - status: string; + status: IEnumTranslate; created_at: string; logo_url: string; licenses_status: { diff --git a/src/app/domains/superAdmin/modules/partners/views/list.component.ts b/src/app/domains/superAdmin/modules/partners/views/list.component.ts index 56590c2..2c827e9 100644 --- a/src/app/domains/superAdmin/modules/partners/views/list.component.ts +++ b/src/app/domains/superAdmin/modules/partners/views/list.component.ts @@ -38,7 +38,15 @@ export class PartnersComponent extends AbstractList { header: 'تعداد لایسنس تمدیدی', customDataModel: this.licensesRenewStatus, }, - { field: 'status', header: 'وضعیت' }, + { + field: 'status', + header: 'وضعیت', + type: 'nested', + variant: 'tag', + nestedOption: { + path: 'status.translate', + }, + }, ]; } diff --git a/src/app/domains/superAdmin/modules/users/constants/routes/accounts.ts b/src/app/domains/superAdmin/modules/users/constants/routes/accounts.ts index f806792..d1ba91f 100644 --- a/src/app/domains/superAdmin/modules/users/constants/routes/accounts.ts +++ b/src/app/domains/superAdmin/modules/users/constants/routes/accounts.ts @@ -10,7 +10,7 @@ export const superAdminUserAccountsNamedRoutes: NamedRoutes import('../../views/accounts/list.component').then((m) => m.UserAccountsComponent), // @ts-ignore meta: { - title: 'فعالیت‌های اقتصادی', + title: 'فعالیت اقتصادی', pagePath: (userId: string) => `/super_admin/users/${userId}/accounts`, }, }, diff --git a/src/app/modules/pos/components/products/categories.component.html b/src/app/modules/pos/components/products/categories.component.html index 6e6b901..91647a4 100644 --- a/src/app/modules/pos/components/products/categories.component.html +++ b/src/app/modules/pos/components/products/categories.component.html @@ -7,7 +7,7 @@ @for (category of categories(); track category.id) {
this.preparedMaxLength) { value = value.slice(0, this.preparedMaxLength); } @@ -277,7 +275,6 @@ export class InputComponent { this.control.setValue(isIdentifierField ? value : value === '' ? '' : numericValue); const viewValue = isPriceFormat && value !== '' ? numericValue.toLocaleString('en-US') : value; - console.log('viewValue', viewValue); target.value = viewValue; if ( diff --git a/src/app/shared/components/pageDataList/page-data-list-grid-view.component.html b/src/app/shared/components/pageDataList/page-data-list-grid-view.component.html index c011f33..e06cc1b 100644 --- a/src/app/shared/components/pageDataList/page-data-list-grid-view.component.html +++ b/src/app/shared/components/pageDataList/page-data-list-grid-view.component.html @@ -1,4 +1,4 @@ -
+
@for (item of items; track `gridView_${$index}`) { -
+
@for (col of columns; track `gridView_${col.field.toString()}_${$index}`) { @if (col.type !== "index") { @if (col.type === "thumbnail") {
@if (item && col?.field && item[col!.field!]) { @@ -46,16 +46,33 @@ }
@if (showEdit || showDelete || showDetails) { -
-
+
+
@if (showEdit) { - + + } @if (showDelete) { - + + } @if (showDetails) { - + + }
} diff --git a/src/app/shared/components/pageDataList/page-data-list-table-view.component.html b/src/app/shared/components/pageDataList/page-data-list-table-view.component.html index 621391c..db480eb 100644 --- a/src/app/shared/components/pageDataList/page-data-list-table-view.component.html +++ b/src/app/shared/components/pageDataList/page-data-list-table-view.component.html @@ -1,4 +1,4 @@ -
+
@if (col.type === "thumbnail") {
@if (item[col.field]) { diff --git a/src/app/shared/components/pageDataList/page-data-list.component.html b/src/app/shared/components/pageDataList/page-data-list.component.html index 642f541..873a9a3 100644 --- a/src/app/shared/components/pageDataList/page-data-list.component.html +++ b/src/app/shared/components/pageDataList/page-data-list.component.html @@ -40,6 +40,9 @@ @if (showRefresh) { } + @if (showAll && allItemsPageRoute) { + نمایش همه + } @if (showAdd) { } + @if (showAll && allItemsPageRoute) { + + } @if (showAdd) { - - + }
} diff --git a/src/app/shared/components/pageDataList/page-data-list.component.ts b/src/app/shared/components/pageDataList/page-data-list.component.ts index e736434..bb071f4 100644 --- a/src/app/shared/components/pageDataList/page-data-list.component.ts +++ b/src/app/shared/components/pageDataList/page-data-list.component.ts @@ -14,6 +14,7 @@ import { signal, TemplateRef, } from '@angular/core'; +import { RouterLink } from '@angular/router'; import { ButtonModule } from 'primeng/button'; import { DrawerModule } from 'primeng/drawer'; import { PaginatorModule } from 'primeng/paginator'; @@ -85,6 +86,7 @@ export interface IColumn { AppPageDataListTableView, AppPageDataListGridView, UikitEmptyStateComponent, + RouterLink, ], }) export class PageDataListComponent { @@ -117,6 +119,8 @@ export class PageDataListComponent { @Input() expandColumns?: Maybe = null; @Input() dataKey?: string = 'items'; @Input() showIndex?: boolean = true; + @Input() showAll?: boolean = false; + @Input() allItemsPageRoute?: string; @ContentChild('filter', { static: true }) filter!: TemplateRef | null; @ContentChild('caption', { static: true }) caption!: TemplateRef | null; diff --git a/src/app/shared/components/uploadFile/upload-file.component.ts b/src/app/shared/components/uploadFile/upload-file.component.ts index a2d38c4..93325cc 100644 --- a/src/app/shared/components/uploadFile/upload-file.component.ts +++ b/src/app/shared/components/uploadFile/upload-file.component.ts @@ -42,7 +42,6 @@ export class SharedUploadFileComponent implements OnChanges, OnDestroy { ngAfterViewInit() { this.revokeObjectUrl(); - console.log('first'); if (this.initial_file_url && !this.objectUrl) { this.filePreview = this.initial_file_url; diff --git a/src/assets/customize.scss b/src/assets/customize.scss index 2a321be..05cda42 100644 --- a/src/assets/customize.scss +++ b/src/assets/customize.scss @@ -5,3 +5,7 @@ .listKeyValue { @apply grid md:grid-cols-3 sm:grid-cols-2 sm:gap-4 gap-3 items-center; } + +.cardShadow { + box-shadow: var(--p-card-shadow) !important; +}