Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e4cc08224 | |||
| e5f53c2265 |
@@ -1,6 +1,8 @@
|
|||||||
import { TspProviderResponseStatus } from '@/shared/catalog';
|
import { TspProviderResponseStatus } from '@/shared/catalog';
|
||||||
|
import { IPosSaleInvoicesSummaryResponse } from './io';
|
||||||
|
|
||||||
export interface IPosSaleInvoiceFiscalActionResponse {
|
export interface IPosSaleInvoiceFiscalActionResponse {
|
||||||
|
invoice: IPosSaleInvoicesSummaryResponse;
|
||||||
message?: string;
|
message?: string;
|
||||||
status: TspProviderResponseStatus;
|
status: TspProviderResponseStatus;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
[sendToTspLoading]="sendToTspLoading()"
|
[sendToTspLoading]="sendToTspLoading()"
|
||||||
[inquiryLoading]="inquiryLoading()"
|
[inquiryLoading]="inquiryLoading()"
|
||||||
[resendToTspLoading]="resendToTspLoading()"
|
[resendToTspLoading]="resendToTspLoading()"
|
||||||
|
[correctionLoading]="correctionLoading()"
|
||||||
|
[returnFromSaleLoading]="backFromSaleLoading()"
|
||||||
(onSendToTsp)="sendToTsp()"
|
(onSendToTsp)="sendToTsp()"
|
||||||
(onResendToTsp)="resendToTsp()"
|
(onResendToTsp)="resendToTsp()"
|
||||||
(onInquiry)="inquiry()"
|
(onInquiry)="inquiry()"
|
||||||
|
|||||||
@@ -94,7 +94,12 @@ export class PosSaleInvoiceComponent {
|
|||||||
this.correctionLoading.set(false);
|
this.correctionLoading.set(false);
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.subscribe();
|
.subscribe((res) => {
|
||||||
|
this.toastService.success({
|
||||||
|
text: `اصلاحیهی صورتحساب با شمارهی ${res.invoice?.invoice_number} با موفقیت ایجاد شد.`,
|
||||||
|
});
|
||||||
|
this.store.updateStatus(res.status);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
returnFromSale(data: IPosReturnFromSaleRequest) {
|
returnFromSale(data: IPosReturnFromSaleRequest) {
|
||||||
this.backFromSaleLoading.set(true);
|
this.backFromSaleLoading.set(true);
|
||||||
@@ -105,7 +110,12 @@ export class PosSaleInvoiceComponent {
|
|||||||
this.backFromSaleLoading.set(false);
|
this.backFromSaleLoading.set(false);
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.subscribe();
|
.subscribe((res) => {
|
||||||
|
this.toastService.success({
|
||||||
|
text: `برگشت از فروش با شمارهی ${res.invoice?.invoice_number} با موفقیت ایجاد شد.`,
|
||||||
|
});
|
||||||
|
this.store.updateStatus(res.status);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
revoke() {
|
revoke() {
|
||||||
this.revokeLoading.set(true);
|
this.revokeLoading.set(true);
|
||||||
@@ -116,7 +126,12 @@ export class PosSaleInvoiceComponent {
|
|||||||
this.revokeLoading.set(false);
|
this.revokeLoading.set(false);
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.subscribe();
|
.subscribe((res) => {
|
||||||
|
this.toastService.success({
|
||||||
|
text: `صورتحساب شمارهی ${res.invoice?.invoice_number} با موفقیت ابطال شد.`,
|
||||||
|
});
|
||||||
|
this.store.updateStatus(res.status);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
<pos-order-price-info-card [info]="totalPriceInfo" />
|
<pos-order-price-info-card [info]="totalPriceInfo" />
|
||||||
|
|
||||||
<app-form-footer-actions [loading]="submitLoading()" (onCancel)="close()" />
|
<app-form-footer-actions [loading]="loading || submitLoading()" (onCancel)="close()" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<shared-light-bottomsheet
|
<shared-light-bottomsheet
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ export class SharedCorrectionFormComponent extends AbstractForm<
|
|||||||
@Input() beforeSubmit?: (payload: CorrectionInvoiceFormValue) => Promise<boolean> | boolean;
|
@Input() beforeSubmit?: (payload: CorrectionInvoiceFormValue) => Promise<boolean> | boolean;
|
||||||
@Input({ required: true }) invoiceDate!: string;
|
@Input({ required: true }) invoiceDate!: string;
|
||||||
@Input() visible = false;
|
@Input() visible = false;
|
||||||
|
@Input() loading = false;
|
||||||
|
|
||||||
form = this.fb.group({
|
form = this.fb.group({
|
||||||
invoice_date: [this.invoiceDate],
|
invoice_date: [this.invoiceDate],
|
||||||
|
|||||||
@@ -22,5 +22,5 @@
|
|||||||
|
|
||||||
<pos-order-price-info-card [info]="totalPriceInfo" />
|
<pos-order-price-info-card [info]="totalPriceInfo" />
|
||||||
|
|
||||||
<app-form-footer-actions (onCancel)="close()" />
|
<app-form-footer-actions [loading]="loading || submitLoading()" (onCancel)="close()" />
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
[initialValues]="invoice.items"
|
[initialValues]="invoice.items"
|
||||||
[invoiceDate]="invoice.invoice_date"
|
[invoiceDate]="invoice.invoice_date"
|
||||||
[beforeSubmit]="beforeCorrectionSubmitHandler.bind(this)"
|
[beforeSubmit]="beforeCorrectionSubmitHandler.bind(this)"
|
||||||
|
[loading]="correctionLoading || false"
|
||||||
(onSubmit)="correctionSubmit($event)"
|
(onSubmit)="correctionSubmit($event)"
|
||||||
(onClose)="cancelCorrection()" />
|
(onClose)="cancelCorrection()" />
|
||||||
</shared-light-bottomsheet>
|
</shared-light-bottomsheet>
|
||||||
|
|||||||
@@ -110,8 +110,10 @@ export class SharedSaleInvoiceSingleViewComponent {
|
|||||||
showQrCodeDialog = signal(false);
|
showQrCodeDialog = signal(false);
|
||||||
showCorrectionPaymentDialog = signal(false);
|
showCorrectionPaymentDialog = signal(false);
|
||||||
correctionRequiredPayment = signal(0);
|
correctionRequiredPayment = signal(0);
|
||||||
|
paymentData = signal<Maybe<IPayment>>(null);
|
||||||
readonly isApplication = config.isPosApplication;
|
readonly isApplication = config.isPosApplication;
|
||||||
private pendingCorrectionSubmitResolver: Maybe<(allowed: boolean) => void> = null;
|
private pendingCorrectionSubmitResolver: Maybe<(allowed: boolean, payment?: IPayment) => void> =
|
||||||
|
null;
|
||||||
|
|
||||||
publicInvoiceRoute = computed(() => {
|
publicInvoiceRoute = computed(() => {
|
||||||
if (this.invoice) {
|
if (this.invoice) {
|
||||||
@@ -282,6 +284,7 @@ export class SharedSaleInvoiceSingleViewComponent {
|
|||||||
total_amount,
|
total_amount,
|
||||||
discount_amount,
|
discount_amount,
|
||||||
tax_amount,
|
tax_amount,
|
||||||
|
payments: this.paymentData() || undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,7 +313,12 @@ export class SharedSaleInvoiceSingleViewComponent {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (await this.beforeCorrectionSubmit?.(mapped)) ?? true;
|
return (
|
||||||
|
(await this.beforeCorrectionSubmit?.({
|
||||||
|
...mapped,
|
||||||
|
payments: this.paymentData() || undefined,
|
||||||
|
})) ?? true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
confirmCorrectionPayment(_event: {
|
confirmCorrectionPayment(_event: {
|
||||||
@@ -318,7 +326,8 @@ export class SharedSaleInvoiceSingleViewComponent {
|
|||||||
settlementType: 'CASH' | 'CREDIT' | 'MIXED';
|
settlementType: 'CASH' | 'CREDIT' | 'MIXED';
|
||||||
}) {
|
}) {
|
||||||
this.showCorrectionPaymentDialog.set(false);
|
this.showCorrectionPaymentDialog.set(false);
|
||||||
this.pendingCorrectionSubmitResolver?.(true);
|
this.paymentData.set(_event.payment);
|
||||||
|
this.pendingCorrectionSubmitResolver?.(true, _event.payment);
|
||||||
this.pendingCorrectionSubmitResolver = null;
|
this.pendingCorrectionSubmitResolver = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user