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 { Component, EventEmitter, Input, OnDestroy, Output } from '@angular/core';
|
||||
import { ConfirmationService } from 'primeng/api';
|
||||
import { Button } from 'primeng/button';
|
||||
import { ConfirmDialog } from 'primeng/confirmdialog';
|
||||
|
||||
@Component({
|
||||
selector: 'app-shared-confirmation-dialog',
|
||||
templateUrl: './confirmation-dialog.component.html',
|
||||
providers: [ConfirmationService],
|
||||
imports: [ConfirmDialog, Button],
|
||||
})
|
||||
export class ConfirmationDialogComponent implements OnDestroy {
|
||||
@Input() message!: string;
|
||||
@Input() header: string = 'تأیید عملیات';
|
||||
@Input() acceptLabel: string = 'بله';
|
||||
@Input() rejectLabel: string = 'خیر';
|
||||
@Output() onAccept = new EventEmitter<void>();
|
||||
@Output() onReject = new EventEmitter<void>();
|
||||
|
||||
constructor(private confirmationService: ConfirmationService) {}
|
||||
|
||||
show() {
|
||||
this.confirmationService.confirm({
|
||||
header: this.header,
|
||||
message: this.message,
|
||||
acceptLabel: this.acceptLabel,
|
||||
rejectLabel: this.rejectLabel,
|
||||
accept: () => {
|
||||
this.accept();
|
||||
},
|
||||
reject: () => {
|
||||
this.reject();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
accept() {
|
||||
this.onAccept.emit();
|
||||
}
|
||||
|
||||
reject() {
|
||||
this.onReject.emit();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
// Cleanup if needed
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user