refactor: update labels and translations in various components
Production CI / validate-and-build (push) Failing after 1m2s

- Changed 'تغییر گذرواژه' to 'تغییر رمز عبور' in layout.component.ts
- Updated HTML structure in list.component.html and saleInvoices components for consistency and improved styling.
- Modified sale-invoice-card.component.html to enhance the display of invoice details.
- Adjusted sale-invoice-card.component.ts to handle customer types more effectively.
- Enhanced the handling of invoice statuses in saleInvoices components.
- Improved layout and styling in shop components for better user experience.
- Refactored key-value component for better readability and maintainability.
- Updated upload file component to streamline file selection process.
- Added new styles in customize.scss and psp.scss for consistent UI.
- Adjusted environment configuration for better API endpoint management.
This commit is contained in:
2026-06-09 13:31:48 +03:30
parent 5fa07c7ee8
commit 88f45eee38
41 changed files with 240 additions and 238 deletions
@@ -1,5 +1,5 @@
<shared-dialog
header="تغییر گذرواژه"
header="تغییر رمز عبور"
[(visible)]="visible"
[modal]="true"
[style]="{ width: '500px' }"
@@ -1,5 +1,5 @@
<app-page-data-list
pageTitle="لیست صورت‌حساب‌ها"
pageTitle="صورت‌حساب‌ها"
[columns]="columns"
emptyPlaceholderTitle="تا به حال صورت‌حسابی توسط این پایانه ایجاد نشده است."
[items]="items()"
@@ -1,11 +1,10 @@
<app-card-data cardTitle="تغییر گذرواژه" [editable]="false">
<form [formGroup]="form" (submit)="submit()" class="max-w-lg mx-auto">
<app-card-data cardTitle="تغییر رمز عبور" [editable]="false">
<form [formGroup]="form" (submit)="submit()" class="mx-auto max-w-lg">
<shared-password-input
[passwordControl]="form.controls.password"
[confirmPasswordControl]="form.controls.confirmPassword"
/>
<button type="submit" pButton [disabled]="form.invalid || loading()" class="w-full max-w-xs mx-auto">
تغییر گذرواژه
[confirmPasswordControl]="form.controls.confirmPassword" />
<button type="submit" pButton [disabled]="form.invalid || loading()" class="mx-auto w-full max-w-xs">
تغییر رمز عبور
</button>
</form>
</app-card-data>
@@ -25,7 +25,7 @@ export class ConsumerResetPasswordCardComponent {
password: fieldControl.password(),
confirmPassword: fieldControl.confirmPassword(),
},
{ validators: [MustMatch('password', 'confirmPassword')] },
{ validators: [MustMatch('password', 'confirmPassword')] }
);
submit() {
@@ -40,7 +40,7 @@ export class ConsumerResetPasswordCardComponent {
.pipe(finalize(() => this.loading.set(false)))
.subscribe(() => {
this.form.reset();
this.toastService.success({ text: 'گذرواژه با موفقیت به‌روز شد.' });
this.toastService.success({ text: 'رمز عبور با موفقیت به‌روز شد.' });
});
}
}
@@ -1,5 +1,5 @@
<app-page-data-list
[pageTitle]="'لیست صورت‌حساب‌ها'"
[pageTitle]="'صورت‌حساب‌ها'"
[columns]="columns"
emptyPlaceholderTitle="صورت‌حساب‌ی یافت نشد"
[items]="items()"
@@ -1,5 +1,5 @@
<shared-dialog
header="تغییر گذرواژه"
header="تغییر رمز عبور"
[(visible)]="visible"
[modal]="true"
[style]="{ width: '500px' }"
@@ -1,11 +1,10 @@
<app-card-data cardTitle="تغییر گذرواژه" [editable]="false">
<form [formGroup]="form" (submit)="submit()" class="max-w-lg mx-auto">
<app-card-data cardTitle="تغییر رمز عبور" [editable]="false">
<form [formGroup]="form" (submit)="submit()" class="mx-auto max-w-lg">
<shared-password-input
[passwordControl]="form.controls.password"
[confirmPasswordControl]="form.controls.confirmPassword"
/>
<button type="submit" pButton [disabled]="form.invalid || loading()" class="w-full max-w-xs mx-auto">
تغییر گذرواژه
[confirmPasswordControl]="form.controls.confirmPassword" />
<button type="submit" pButton [disabled]="form.invalid || loading()" class="mx-auto w-full max-w-xs">
تغییر رمز عبور
</button>
</form>
</app-card-data>
@@ -25,7 +25,7 @@ export class PartnerResetPasswordCardComponent {
password: fieldControl.password(),
confirmPassword: fieldControl.confirmPassword(),
},
{ validators: [MustMatch('password', 'confirmPassword')] },
{ validators: [MustMatch('password', 'confirmPassword')] }
);
submit() {
@@ -40,7 +40,7 @@ export class PartnerResetPasswordCardComponent {
.pipe(finalize(() => this.loading.set(false)))
.subscribe(() => {
this.form.reset();
this.toastService.success({ text: 'گذرواژه با موفقیت به‌روز شد.' });
this.toastService.success({ text: 'رمز عبور با موفقیت به‌روز شد.' });
});
}
}
@@ -27,7 +27,7 @@ export class PosChangePasswordComponent extends AbstractDialog {
.pipe(finalize(() => this.submitLoading.set(false)))
.subscribe(() => {
this.toastService.success({
text: 'تغییر گذرواژه با موفقیت انجام شد.',
text: 'تغییر رمز عبور با موفقیت انجام شد.',
});
this.submitLoading.set(false);
this.close();
@@ -81,7 +81,7 @@ export class PosPagesLayoutComponent {
disabled: true,
},
{
label: 'تغییر گذرواژه',
label: 'تغییر رمز عبور',
icon: 'pi pi-key',
command: this.showChangePasswordDialog,
},
@@ -16,7 +16,7 @@
}
} @else {
@for (good of items(); track good.id) {
<div class="bg-surface-card flex items-center gap-2 rounded-lg px-3 py-1 shadow-xs">
<div class="bg-surface-card flex items-center gap-2 rounded-lg px-3 py-1">
<div class="flex grow items-center gap-2">
<img
[src]="good.image_url || goodPlaceholder"
@@ -1,5 +1,5 @@
<div class="bg-surface-card">
<app-inner-pages-header pageTitle="لیست صورت‌حساب‌های صادر شده" [backRoute]="backRoute">
<app-inner-pages-header pageTitle="صورت‌حساب‌های صادر شده" [backRoute]="backRoute">
<ng-template #actions>
<div class="flex gap-1">
<p-button
@@ -16,11 +16,9 @@
<div class="flex flex-wrap gap-2 px-4 pb-2">
@for (filter of activeFilters(); track filter.key) {
@if (filter.key !== 'page') {
<p-chip
removable
[label]="filter.label + ': ' + filter.value"
class="border-surface-border border"
(onRemove)="removeFilter(filter.key)" />
<p-chip removable class="border-surface-border border" (onRemove)="removeFilter(filter.key)">
<span class="text-sm"> {{ filter.label }}: {{ filter.value }} </span>
</p-chip>
}
}
</div>
@@ -1,18 +1,18 @@
<p-card class="border-surface-border relative overflow-visible border p-0!">
<div class="flex w-full items-center justify-between gap-4">
<span> {{ saleInvoice.invoice_number }} - {{ saleInvoice.code }} </span>
<span class="text-lg font-bold"> {{ saleInvoice.invoice_number }}</span>
<catalog-tax-provider-status-tag [status]="saleInvoice.status.value" [translate]="saleInvoice.status.translate" />
</div>
<hr />
<div class="grid grid-cols-1 gap-4">
<app-key-value alignment="end" label="نوع صورت‌حساب">
{{ preparedInvoiceType() }}
</app-key-value>
<div class="grid grid-cols-1 gap-3">
<app-key-value alignment="end" label="تاریخ" [value]="saleInvoice.created_at" type="date" />
<app-key-value alignment="end" label="مبلغ کل" [value]="saleInvoice.total_amount" type="price" />
<app-key-value alignment="end" label="نوع صورت‌حساب‌">
<catalog-invoice-type-tag [status]="saleInvoice.type.value" />
</app-key-value>
<app-key-value alignment="end" label="تاریخ صورت‌حساب‌" [value]="saleInvoice.created_at" type="date" />
<app-key-value alignment="end" label="مشتری">
{{ preparedInvoiceType() }}
</app-key-value>
</div>
<hr />
<div class="flex items-center justify-center gap-4">
@@ -50,20 +50,20 @@ export class SaleInvoiceCardComponent {
);
preparedInvoiceType = computed(() => {
if (!this.saleInvoice) return '';
const { customer } = this.saleInvoice;
const { customer, unknown_customer } = this.saleInvoice;
if (customer) {
const { legal, individual } = customer;
let text = 'نوع اول - ';
if (legal) {
text += `حقوقی (${legal.company_name})`;
if (unknown_customer?.name || unknown_customer?.national_code) {
return `${unknown_customer.name || unknown_customer?.national_code || 'رهگذر'} (نوع دوم)`;
} else if (customer) {
const { legal, individual, type } = customer;
switch (type) {
case 'INDIVIDUAL':
return `${individual ? individual.first_name + ' ' + individual.last_name : '-----'} (نوع اول)`;
case 'LEGAL':
return `${legal?.name || '-----'} (نوع اول)`;
}
if (individual) {
text += `حقیقی (${individual.first_name} ${individual.last_name})`;
}
return text;
}
return 'نوع دوم (بدون اطلاعات خریدار)';
return 'رهگذر (نوع دوم)';
});
sendInvoice() {
@@ -103,7 +103,7 @@ export class SaleInvoiceCardComponent {
.retrySendToTsp(this.saleInvoice.id)
.pipe(finalize(() => this.resendingLoading.set(false)))
.subscribe((res) => {
if (res.status === 'FAILURE') {
if (res.status === 'SEND_FAILURE') {
this.toastService.error({
text: res.message || 'خطا در ارسال مجدد صورت‌حساب‌ رخ داده است.',
});
+8 -15
View File
@@ -2,6 +2,7 @@ import { Maybe } from '@/core';
import ISummary from '@/core/models/summary';
import { InvoiceTypes, TspProviderResponseStatus } from '@/shared/catalog';
import { IEnumTranslate } from '@/shared/models/enum_translate.type';
import { IIndividualCustomer, ILegalCustomer } from '../../shop/models';
export interface IPosSaleInvoicesSummaryRawResponse {
id: string;
@@ -10,6 +11,7 @@ export interface IPosSaleInvoicesSummaryRawResponse {
invoice_date: string;
created_at: string;
total_amount: string;
unknown_customer: Partial<UnknownCoustomer>;
customer: Maybe<Customer>;
status: IEnumTranslate<TspProviderResponseStatus>;
type: IEnumTranslate<InvoiceTypes>;
@@ -30,6 +32,10 @@ export interface IPosSaleInvoicesRawResponse extends IPosSaleInvoicesSummaryRawR
export interface IPosSaleInvoicesResponse extends IPosSaleInvoicesRawResponse {}
interface UnknownCoustomer {
name?: string;
national_code?: string;
}
interface ConsumerAccount {
role: string;
account: Account;
@@ -55,19 +61,6 @@ interface Payments {
interface Customer {
type: string;
individual: Individual;
legal: Legal;
}
interface Individual {
first_name: string;
last_name: string;
national_code: string;
mobile_number: string;
}
interface Legal {
company_name: string;
economic_code: string;
registration_number: string;
individual: IIndividualCustomer;
legal: ILegalCustomer;
}
@@ -4,7 +4,9 @@
[backRoute]="backRoute()"
[sendToTspLoading]="sendToTspLoading()"
[inquiryLoading]="inquiryLoading()"
[resendToTspLoading]="resendToTspLoading()"
(onSendToTsp)="sendToTsp()"
(onResendToTsp)="resendToTsp()"
(onInquiry)="inquiry()"
(onCorrection)="correction($event)"
(onReturnFromSale)="returnFromSale($event)"
@@ -78,7 +78,12 @@ export class PosSaleInvoiceComponent {
this.resendToTspLoading.set(false);
})
)
.subscribe();
.subscribe((res) => {
this.toastService.success({
text: res.message || 'ارسال مجدد صورت‌حساب با موفقیت انجام شد.',
});
this.store.updateStatus(res.status);
});
}
correction(data: IPosCorrectionRequest) {
this.correctionLoading.set(true);
@@ -1,21 +1,20 @@
<div class="border border-surface-border rounded-xl p-2 shadow-sm">
<div class="flex gap-3 items-center">
<div class="border-surface-border rounded-xl border p-2">
<div class="flex items-center gap-3">
<img
[src]="inOrderGood.good.image_url || placeholderImage"
loading="lazy"
decoding="async"
class="w-24 h-24 rounded-md bg-surface-100 object-cover shrink-0 border border-surface-border"
/>
<div class="flex flex-col grow justify-between overflow-hidden">
<div class="flex items-stretch grow gap-4">
<div class="flex flex-col justify-between gap-2 grow overflow-hidden py-1">
<div class="shrink-0 flex flex-col w-full overflow-hidden">
<div class="flex w-full overflow-hidden gap-1 items-center">
<span class="font-bold text-lg text-ellipsis text-nowrap overflow-hidden">
class="bg-surface-100 border-surface-border h-24 w-24 shrink-0 rounded-md border object-cover" />
<div class="flex grow flex-col justify-between overflow-hidden">
<div class="flex grow items-stretch gap-4">
<div class="flex grow flex-col justify-between gap-2 overflow-hidden py-1">
<div class="flex w-full shrink-0 flex-col overflow-hidden">
<div class="flex w-full items-center gap-1 overflow-hidden">
<span class="overflow-hidden text-lg font-bold text-nowrap text-ellipsis">
{{ inOrderGood.good.name }}
</span>
</div>
<span class="text-sm text-ellipsis text-nowrap overflow-hidden">
<span class="overflow-hidden text-sm text-nowrap text-ellipsis">
{{ inOrderGood.quantity }} {{ inOrderGood.good.measure_unit.name }}
</span>
</div>
@@ -23,7 +22,7 @@
<span [appPriceMask]="inOrderGood.total_amount"></span>
} @else {
<div class="flex flex-col">
<span class="line-through text-muted-color text-xs" [appPriceMask]="inOrderGood.base_total_amount"></span>
<span class="text-muted-color text-xs line-through" [appPriceMask]="inOrderGood.base_total_amount"></span>
<span [appPriceMask]="inOrderGood.base_total_amount - inOrderGood.discount_amount"></span>
</div>
}
@@ -36,8 +35,7 @@
size="small"
severity="secondary"
class="ms-auto"
(click)="editOrderItem()"
></button>
(click)="editOrderItem()"></button>
<button
pButton
type="button"
@@ -45,8 +43,7 @@
size="small"
severity="danger"
class="ms-auto"
(click)="removeGoodFromOrder()"
></button>
(click)="removeGoodFromOrder()"></button>
</div>
</div>
</div>
@@ -58,6 +55,5 @@
[(visible)]="visible"
[good]="inOrderGood.good"
[initialValues]="inOrderGood"
[orderItemId]="inOrderGood.id"
/>
[orderItemId]="inOrderGood.id" />
}
@@ -1,31 +1,32 @@
<div class="overflow-x-auto">
<div class="w-full overflow-visible flex gap-3 px-4">
<div class="flex w-full gap-3 overflow-visible px-4">
@if (loading()) {
@for (i of [1, 2, 3, 4, 5]; track i) {
<p-skeleton width="6rem" height="2.5rem" />
<div class="h-10 w-24 shrink-0">
<p-skeleton width="100%" height="100%" />
</div>
}
} @else {
@for (category of categories(); track category.id) {
<div
[class]="
'h-10 rounded-lg px-3 flex items-center gap-3 border border-surface-border cursor-pointer bg-surface-100 hover:bg-surface-200 transition-all shrink-0' +
'border-surface-border bg-surface-100 hover:bg-surface-200 flex h-10 shrink-0 cursor-pointer items-center gap-3 rounded-lg border px-3 transition-all' +
(selectedCategory() === category.id ? ' bg-surface-card' : '')
"
(click)="changeSelectedCategory(category)"
>
<span class="text-sm text-muted-color font-bold"> {{ category.name }}</span>
(click)="changeSelectedCategory(category)">
<span class="text-muted-color text-sm font-bold"> {{ category.name }}</span>
<div
[class]="
'flex items-center justify-center py-0.5 px-2 rounded-sm bg-surface-300 text-xs text-muted-color' +
'bg-surface-300 text-muted-color flex items-center justify-center rounded-sm px-2 py-0.5 text-xs' +
(selectedCategory() === category.id ? ' bg-amber-400! text-white' : '')
"
>
">
<span>
{{ category.goods_count }}
</span>
</div>
</div>
}
<div class="invisible w-1 shrink-0 opacity-0"></div>
}
</div>
</div>
@@ -7,7 +7,7 @@
}
} @else {
@for (good of visibleGoods(); track good.id) {
<div class="bg-surface-card flex items-center gap-2 rounded-lg px-3 py-1 shadow-xs">
<div class="bg-surface-card flex items-center gap-2 rounded-lg px-3 py-1">
<div class="flex grow items-center gap-2">
<img
[src]="good.image_url || goodPlaceholder"
@@ -18,7 +18,7 @@
<button
type="button"
pButton
class="border-surface-border bg-surface-0 sticky! inset-x-0 right-0 bottom-0 z-1200 w-full rounded-b-none! border-t px-4 py-3 shadow-[0_-4px_16px_rgba(0,0,0,0.08)] md:hidden!"
class="border-surface-border bg-surface-0 sticky! inset-x-0 right-0 bottom-0 z-120 w-full rounded-b-none! border-t px-4 py-3 md:hidden!"
(click)="openInvoiceBottomSheet()">
<!-- [style.paddingBottom]="'calc(0.75rem + {{env(safe-area-inset-bottom)}})'" -->
<div class="mx-auto flex w-full max-w-3xl items-center justify-between">
@@ -17,7 +17,7 @@ import { PosLandingStore } from '../store/main.store';
@Component({
selector: 'pos-shop',
templateUrl: './root.component.html',
host: { class: 'grow overflow-hidden' },
host: { class: 'grow' },
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [
@@ -1,5 +1,5 @@
<div
class="text-surface-700 relative flex flex-col gap-4 overflow-hidden rounded-lg border px-4 py-4 pe-2"
class="text-surface-700 relative flex h-full flex-col gap-4 overflow-hidden rounded-lg border py-4 ps-3 pe-2"
[style.backgroundColor]="preparedInfo().bgColor"
[style.borderColor]="preparedInfo().borderColor"
(click)="showDetails()">
@@ -1,57 +1,59 @@
<div class="flex flex-col gap-6 p-4">
<season-picker (onChange)="onDateChanged($event)" />
<div class="grid grid-cols-2 gap-4">
@if (loading()) {
@for (_ of [0, 1, 2, 3, 4, 5]; track $index) {
<div class="h-32 w-full">
<p-skeleton width="100%" height="100%"></p-skeleton>
</div>
}
} @else {
<pos-statistics-invoice-type-card
type="all"
[loading]="loading()"
[totalAmount]="item()?.all?.total_amount"
[totalTaxAmount]="item()?.all?.total_tax"
[count]="item()?.all?.count"
(onClick)="toInvoicesPage('all')" />
<pos-statistics-invoice-type-card
type="success"
[loading]="loading()"
[totalAmount]="item()?.success?.total_amount"
[totalTaxAmount]="item()?.success?.total_tax"
[count]="item()?.success?.count"
(onClick)="toInvoicesPage('success')" />
<pos-statistics-invoice-type-card
type="failure"
[loading]="loading()"
[totalAmount]="item()?.failure?.total_amount"
[totalTaxAmount]="item()?.failure?.total_tax"
[count]="item()?.failure?.count"
(onClick)="toInvoicesPage('failure')" />
<pos-statistics-invoice-type-card
type="not_send"
[loading]="loading()"
[totalAmount]="item()?.not_send?.total_amount"
[totalTaxAmount]="item()?.not_send?.total_tax"
[count]="item()?.not_send?.count"
(onClick)="toInvoicesPage('not_send')" />
<pos-statistics-invoice-type-card
type="pending"
[loading]="loading()"
[totalAmount]="item()?.pending?.total_amount"
[totalTaxAmount]="item()?.pending?.total_tax"
[count]="item()?.pending?.count"
(onClick)="toInvoicesPage('pending')" />
<pos-statistics-invoice-type-card
type="not_original"
[loading]="loading()"
[totalAmount]="item()?.not_original?.total_amount"
[totalTaxAmount]="item()?.not_original?.total_tax"
[count]="item()?.not_original?.count" />
}
</div>
<div class="fixed inset-x-0 bottom-0 p-4">
<div class="flex min-h-[calc(100svh-5.5rem)] flex-col p-4 pt-0!">
<div class="bg-surface-ground sticky top-[5.5rem] z-10 w-full pt-4!">
<button pButton [routerLink]="shopRoute" size="large" class="w-full">ایجاد صورت‌حساب جدید</button>
</div>
<season-picker class="mt-6 mb-4 block w-full" (onChange)="onDateChanged($event)" />
<div class="flex-1">
<div class="grid grid-cols-2 items-stretch gap-2">
@if (loading()) {
@for (_ of [0, 1, 2, 3, 4, 5]; track $index) {
<div class="h-32 w-full">
<p-skeleton width="100%" height="100%"></p-skeleton>
</div>
}
} @else {
<pos-statistics-invoice-type-card
type="all"
[loading]="loading()"
[totalAmount]="item()?.all?.total_amount"
[totalTaxAmount]="item()?.all?.total_tax"
[count]="item()?.all?.count"
(onClick)="toInvoicesPage('all')" />
<pos-statistics-invoice-type-card
type="success"
[loading]="loading()"
[totalAmount]="item()?.success?.total_amount"
[totalTaxAmount]="item()?.success?.total_tax"
[count]="item()?.success?.count"
(onClick)="toInvoicesPage('success')" />
<pos-statistics-invoice-type-card
type="failure"
[loading]="loading()"
[totalAmount]="item()?.failure?.total_amount"
[totalTaxAmount]="item()?.failure?.total_tax"
[count]="item()?.failure?.count"
(onClick)="toInvoicesPage('failure')" />
<pos-statistics-invoice-type-card
type="not_send"
[loading]="loading()"
[totalAmount]="item()?.not_send?.total_amount"
[totalTaxAmount]="item()?.not_send?.total_tax"
[count]="item()?.not_send?.count"
(onClick)="toInvoicesPage('not_send')" />
<pos-statistics-invoice-type-card
type="pending"
[loading]="loading()"
[totalAmount]="item()?.pending?.total_amount"
[totalTaxAmount]="item()?.pending?.total_tax"
[count]="item()?.pending?.count"
(onClick)="toInvoicesPage('pending')" />
<pos-statistics-invoice-type-card
type="not_original"
[loading]="loading()"
[totalAmount]="item()?.not_original?.total_amount"
[totalTaxAmount]="item()?.not_original?.total_tax"
[count]="item()?.not_original?.count" />
}
</div>
</div>
</div>