update many things
This commit is contained in:
@@ -5,10 +5,11 @@
|
||||
<p-button
|
||||
icon="pi pi-filter"
|
||||
type="button"
|
||||
size="small"
|
||||
[outlined]="!activeFilters().length"
|
||||
(click)="toggleFilterVisible()"
|
||||
></p-button>
|
||||
<button pButton icon="pi pi-refresh" type="button" outlined (click)="refresh()"></button>
|
||||
<button pButton icon="pi pi-refresh" type="button" size="small" outlined (click)="refresh()"></button>
|
||||
</div>
|
||||
</ng-template>
|
||||
</app-inner-pages-header>
|
||||
|
||||
+26
-2
@@ -14,19 +14,43 @@
|
||||
</div>
|
||||
<hr />
|
||||
<div class="flex items-center justify-center gap-4">
|
||||
@if (["success", "failure"].includes(saleInvoice.status.value.toLowerCase())) {
|
||||
<p-button
|
||||
label="ابطال"
|
||||
type="button"
|
||||
severity="danger"
|
||||
(click)="revokeInvoice()"
|
||||
[loading]="revokingInvoiceLoading()"
|
||||
[disabled]="onAction()"
|
||||
></p-button>
|
||||
}
|
||||
@if (saleInvoice.status.value.toLowerCase() === "not_send") {
|
||||
<p-button label="ارسال فاکتور" type="button" (click)="sendInvoice()" [loading]="sendingLoading()"></p-button>
|
||||
<p-button
|
||||
label="ارسال فاکتور"
|
||||
type="button"
|
||||
(click)="sendInvoice()"
|
||||
[loading]="sendingLoading()"
|
||||
[disabled]="onAction()"
|
||||
></p-button>
|
||||
}
|
||||
@if (saleInvoice.status.value.toLowerCase() === "queued") {
|
||||
<p-button
|
||||
label="استعلام وضعیت ارسال"
|
||||
type="button"
|
||||
severity="info"
|
||||
(click)="getStatus()"
|
||||
[loading]="gettingStatusLoading()"
|
||||
[disabled]="onAction()"
|
||||
></p-button>
|
||||
}
|
||||
@if (saleInvoice.status.value.toLowerCase() === "failure") {
|
||||
<p-button label="ارسال فاکتور" type="button" (click)="resendInvoice()" [loading]="resendingLoading()"></p-button>
|
||||
<p-button
|
||||
label="ارسال مجدد"
|
||||
type="button"
|
||||
(click)="resendInvoice()"
|
||||
[loading]="resendingLoading()"
|
||||
[disabled]="onAction()"
|
||||
></p-button>
|
||||
}
|
||||
<a [routerLink]="singlePageRoute()" pButton type="button" (click)="viewDetails()" outlined>مشاهده جزییات</a>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,6 @@ import { Component, computed, EventEmitter, inject, Input, Output, signal } from
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { Button, ButtonDirective } from 'primeng/button';
|
||||
import { Card } from 'primeng/card';
|
||||
import { Tag } from 'primeng/tag';
|
||||
import { finalize } from 'rxjs';
|
||||
import { posSaleInvoicesNamedRoutes } from '../constants';
|
||||
import { IPosSaleInvoicesSummaryResponse } from '../models';
|
||||
@@ -17,7 +16,6 @@ import { PosSaleInvoicesService } from '../services/main.service';
|
||||
imports: [
|
||||
Button,
|
||||
KeyValueComponent,
|
||||
Tag,
|
||||
Card,
|
||||
RouterLink,
|
||||
ButtonDirective,
|
||||
@@ -34,6 +32,15 @@ export class SaleInvoiceCardComponent {
|
||||
sendingLoading = signal(false);
|
||||
gettingStatusLoading = signal(false);
|
||||
resendingLoading = signal(false);
|
||||
revokingInvoiceLoading = signal(false);
|
||||
|
||||
onAction = computed(
|
||||
() =>
|
||||
this.sendingLoading() ||
|
||||
this.gettingStatusLoading() ||
|
||||
this.resendingLoading() ||
|
||||
this.revokingInvoiceLoading(),
|
||||
);
|
||||
|
||||
singlePageRoute = computed(() =>
|
||||
posSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(this.saleInvoice?.id),
|
||||
@@ -74,9 +81,6 @@ export class SaleInvoiceCardComponent {
|
||||
.getInquiry(this.saleInvoice.id)
|
||||
.pipe(finalize(() => this.gettingStatusLoading.set(false)))
|
||||
.subscribe((res) => {
|
||||
this.toastService.info({
|
||||
text: `وضعیت: ${res.status || 'نامشخص'}`,
|
||||
});
|
||||
this.refreshRequested.emit();
|
||||
});
|
||||
}
|
||||
@@ -91,5 +95,16 @@ export class SaleInvoiceCardComponent {
|
||||
this.refreshRequested.emit();
|
||||
});
|
||||
}
|
||||
|
||||
revokeInvoice() {
|
||||
this.revokingInvoiceLoading.set(true);
|
||||
this.service
|
||||
.revoke(this.saleInvoice.id)
|
||||
.pipe(finalize(() => this.revokingInvoiceLoading.set(false)))
|
||||
.subscribe(() => {
|
||||
this.toastService.success({ text: 'ابطال فاکتور با موفقیت انجام شد.' });
|
||||
this.refreshRequested.emit();
|
||||
});
|
||||
}
|
||||
viewDetails() {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user