remove unnecessary css

This commit is contained in:
Çetin
2021-12-23 09:08:09 +03:00
parent aaf167cdd0
commit 96e98bcbc6
3 changed files with 61 additions and 89 deletions

View File

@@ -11,6 +11,10 @@ export class AppCrudComponent implements OnInit {
productDialog: boolean;
deleteProductDialog: boolean = false;
deleteProductsDialog: boolean = false;
products: Product[];
product: Product;
@@ -23,8 +27,6 @@ export class AppCrudComponent implements OnInit {
statuses: any[];
selectedStatus:any;
rowsPerPageOptions = [5, 10, 20];
constructor(private productService: ProductService, private messageService: MessageService,
@@ -55,16 +57,7 @@ export class AppCrudComponent implements OnInit {
}
deleteSelectedProducts() {
this.confirmationService.confirm({
message: 'Are you sure you want to delete the selected products?',
header: 'Confirm',
icon: 'pi pi-exclamation-triangle',
accept: () => {
this.products = this.products.filter(val => !this.selectedProducts.includes(val));
this.selectedProducts = null;
this.messageService.add({severity: 'success', summary: 'Successful', detail: 'Products Deleted', life: 3000});
}
});
this.deleteProductsDialog = true;
}
editProduct(product: Product) {
@@ -73,16 +66,22 @@ export class AppCrudComponent implements OnInit {
}
deleteProduct(product: Product) {
this.confirmationService.confirm({
message: 'Are you sure you want to delete ' + product.name + '?',
header: 'Confirm',
icon: 'pi pi-exclamation-triangle',
accept: () => {
this.products = this.products.filter(val => val.id !== product.id);
this.product = {};
this.messageService.add({severity: 'success', summary: 'Successful', detail: 'Product Deleted', life: 3000});
}
});
this.deleteProductDialog = true;
this.product = {...product};
}
confirmDeleteSelected(){
this.deleteProductsDialog = false;
this.products = this.products.filter(val => !this.selectedProducts.includes(val));
this.messageService.add({severity: 'success', summary: 'Successful', detail: 'Products Deleted', life: 3000});
this.selectedProducts = null;
}
confirmDelete(){
this.deleteProductDialog = false;
this.products = this.products.filter(val => val.id !== this.product.id);
this.messageService.add({severity: 'success', summary: 'Successful', detail: 'Product Deleted', life: 3000});
this.product = {};
}
hideDialog() {
@@ -95,11 +94,16 @@ export class AppCrudComponent implements OnInit {
if (this.product.name.trim()) {
if (this.product.id) {
// @ts-ignore
this.product.inventoryStatus = this.product.inventoryStatus.value ? this.product.inventoryStatus.value: this.product.inventoryStatus;
this.products[this.findIndexById(this.product.id)] = this.product;
this.messageService.add({severity: 'success', summary: 'Successful', detail: 'Product Updated', life: 3000});
} else {
this.product.id = this.createId();
this.product.code = this.createId();
this.product.image = 'product-placeholder.svg';
// @ts-ignore
this.product.inventoryStatus = this.product.inventoryStatus ? this.product.inventoryStatus.value : 'INSTOCK';
this.products.push(this.product);
this.messageService.add({severity: 'success', summary: 'Successful', detail: 'Product Created', life: 3000});
}