feat: enhance product and purchase components
- Added new components for handling purchase receipts and payment wrappers. - Updated product details view to include sales count and stock alerts. - Refactored invoice payment form to use a template for better structure. - Introduced confirmation dialog service for payment confirmations. - Improved state card component for better visual representation of orders. - Added loading indicators and error handling in various components. - Updated routes to include new purchase functionality for suppliers. - Enhanced stock alert component to visually indicate low stock levels.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import { ToastService } from '@/core/services/toast.service';
|
||||
import { SupplierInvoicePayFormComponent } from '@/modules/suppliers/components/invoices/pay-form.component';
|
||||
import { Component, Input, signal } from '@angular/core';
|
||||
import { IPurchaseReceiptResponse } from '../../../modules/purchases/models';
|
||||
import { ConfirmationDialogService } from '../confirmationDialog/confirmation-dialog.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-purchase-receipt-payment-wrapper',
|
||||
templateUrl: './wrapper.component.html',
|
||||
imports: [SupplierInvoicePayFormComponent],
|
||||
})
|
||||
export class PurchaseReceiptPaymentWrapperComponent {
|
||||
@Input() purchaseReceipt!: IPurchaseReceiptResponse;
|
||||
|
||||
showPaymentForm = signal(false);
|
||||
constructor(
|
||||
private confirmService: ConfirmationDialogService,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
setTimeout(() => {
|
||||
this.showConfirm();
|
||||
}, 1);
|
||||
}
|
||||
|
||||
showConfirm() {
|
||||
this.confirmService.confirm({
|
||||
message: 'آیا پرداخت فاکتور انجام شده است؟',
|
||||
header: 'وضعیت پرداخت فاکتور',
|
||||
acceptLabel: 'بله',
|
||||
rejectLabel: 'خیر',
|
||||
accept: () => {
|
||||
this.toPaymentForm();
|
||||
},
|
||||
reject: () => {
|
||||
this.toastService.info({
|
||||
text: 'میتوانید از طریق منوی پرداخت فاکتور، در آینده اقدام به پرداخت نمایید.',
|
||||
title: 'پرداخت فاکتور انجام نشد',
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
submit() {}
|
||||
|
||||
toPaymentForm() {
|
||||
this.showPaymentForm.set(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user