update sale invoices models and some ui fix
This commit is contained in:
+13
-15
@@ -1,5 +1,5 @@
|
||||
<p-card class="border border-surface-border p-0! relative overflow-visible">
|
||||
<div class="flex items-center gap-4 justify-between w-full">
|
||||
<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>
|
||||
<catalog-tax-provider-status-tag [status]="saleInvoice.status.value" [translate]="saleInvoice.status.translate" />
|
||||
</div>
|
||||
@@ -9,48 +9,46 @@
|
||||
{{ preparedInvoiceType() }}
|
||||
</app-key-value>
|
||||
<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="dateTime" />
|
||||
<app-key-value alignment="end" label="تاریخ ایجاد" [value]="saleInvoice.created_at" type="dateTime" />
|
||||
</div>
|
||||
<hr />
|
||||
<div class="flex items-center justify-center gap-4">
|
||||
@if (["success", "failure"].includes(saleInvoice.status.value.toLowerCase())) {
|
||||
@if (['success', 'failure'].includes(saleInvoice.status.value.toLowerCase())) {
|
||||
<p-button
|
||||
label="ابطال"
|
||||
type="button"
|
||||
severity="danger"
|
||||
(click)="revokeInvoice()"
|
||||
[loading]="revokingInvoiceLoading()"
|
||||
[disabled]="onAction()"
|
||||
></p-button>
|
||||
[disabled]="onAction()"></p-button>
|
||||
}
|
||||
@if (saleInvoice.status.value.toLowerCase() === "not_send") {
|
||||
@if (saleInvoice.status.value.toLowerCase() === 'not_send') {
|
||||
<p-button
|
||||
label="ارسال فاکتور"
|
||||
type="button"
|
||||
(click)="sendInvoice()"
|
||||
[loading]="sendingLoading()"
|
||||
[disabled]="onAction()"
|
||||
></p-button>
|
||||
[disabled]="onAction()"></p-button>
|
||||
}
|
||||
@if (saleInvoice.status.value.toLowerCase() === "queued") {
|
||||
@if (saleInvoice.status.value.toLowerCase() === 'queued') {
|
||||
<p-button
|
||||
label="استعلام وضعیت ارسال"
|
||||
type="button"
|
||||
severity="info"
|
||||
(click)="getStatus()"
|
||||
[loading]="gettingStatusLoading()"
|
||||
[disabled]="onAction()"
|
||||
></p-button>
|
||||
[disabled]="onAction()"></p-button>
|
||||
}
|
||||
@if (saleInvoice.status.value.toLowerCase() === "failure") {
|
||||
@if (saleInvoice.status.value.toLowerCase() === 'failure') {
|
||||
<p-button
|
||||
label="ارسال مجدد"
|
||||
type="button"
|
||||
(click)="resendInvoice()"
|
||||
[loading]="resendingLoading()"
|
||||
[disabled]="onAction()"
|
||||
></p-button>
|
||||
[disabled]="onAction()"></p-button>
|
||||
}
|
||||
<a [routerLink]="singlePageRoute()" pButton type="button" (click)="viewDetails()" outlined>مشاهده جزییات</a>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { ToastService } from '@/core/services/toast.service';
|
||||
import { CatalogInvoiceTypeTagComponent } from '@/shared/catalog';
|
||||
import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog/taxProviderStatus';
|
||||
import { KeyValueComponent } from '@/shared/components';
|
||||
import { Component, computed, EventEmitter, inject, Input, Output, signal } from '@angular/core';
|
||||
@@ -20,6 +21,7 @@ import { PosSaleInvoicesService } from '../services/main.service';
|
||||
RouterLink,
|
||||
ButtonDirective,
|
||||
CatalogTaxProviderStatusTagComponent,
|
||||
CatalogInvoiceTypeTagComponent,
|
||||
],
|
||||
})
|
||||
export class SaleInvoiceCardComponent {
|
||||
@@ -39,11 +41,11 @@ export class SaleInvoiceCardComponent {
|
||||
this.sendingLoading() ||
|
||||
this.gettingStatusLoading() ||
|
||||
this.resendingLoading() ||
|
||||
this.revokingInvoiceLoading(),
|
||||
this.revokingInvoiceLoading()
|
||||
);
|
||||
|
||||
singlePageRoute = computed(() =>
|
||||
posSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(this.saleInvoice?.id),
|
||||
posSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(this.saleInvoice?.id)
|
||||
);
|
||||
preparedInvoiceType = computed(() => {
|
||||
if (!this.saleInvoice) return '';
|
||||
@@ -76,7 +78,7 @@ export class SaleInvoiceCardComponent {
|
||||
} else {
|
||||
this.toastService.success({ text: 'ارسال فاکتور با موفقیت انجام شد.' });
|
||||
}
|
||||
this.toastService.success({ text: 'ارسال فاکتور با موفقیت انجام شد.' });
|
||||
// this.toastService.success({ text: 'ارسال فاکتور با موفقیت انجام شد.' });
|
||||
this.refreshRequested.emit();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user