deleted notifs components
This commit is contained in:
@@ -6,7 +6,7 @@ nz-table {
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2px 6px rgba(0,0,0,0.1);
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
}
|
||||
|
||||
@@ -66,18 +66,21 @@ nz-table tbody td p {
|
||||
nz-table thead {
|
||||
display: none;
|
||||
}
|
||||
|
||||
nz-table tbody tr {
|
||||
display: block;
|
||||
margin-bottom: 16px;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 8px;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
nz-table tbody td {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 6px 12px;
|
||||
}
|
||||
|
||||
nz-table tbody td::before {
|
||||
content: attr(data-label);
|
||||
font-weight: 600;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<nz-table
|
||||
[nzData]="filteredProducts()"
|
||||
[nzFrontPagination]="false"
|
||||
[nzLoading]="productsLoading()"
|
||||
(nzCurrentPageDataChange)="onCurrentPageDataChange($event)"
|
||||
[nzData]="filteredProducts()"
|
||||
[nzFrontPagination]="false"
|
||||
[nzLoading]="productsLoading()"
|
||||
(nzCurrentPageDataChange)="onCurrentPageDataChange($event)"
|
||||
>
|
||||
<thead>
|
||||
<tr class="text-center">
|
||||
@@ -47,9 +47,11 @@
|
||||
<td>{{ product.minimalQuantity }}</td>
|
||||
<td>
|
||||
<div style="justify-content: center; display: flex">
|
||||
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer" (click)="openEditModal(product)"></nz-icon>
|
||||
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer"
|
||||
(click)="openEditModal(product)"></nz-icon>
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(product.id)" class="text-red-600 cursor-pointer"></nz-icon>
|
||||
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(product.id)"
|
||||
class="text-red-600 cursor-pointer"></nz-icon>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -58,7 +60,8 @@
|
||||
</nz-table>
|
||||
|
||||
<div class="hidden">
|
||||
<app-modal-nav #modalNav nameIcon="edit" [name]="'Modifier'" (ok)="onModalOk(selectedProduct.id, stockForm, modalNav)" (cancel)="onModalCancel(modalNav)">
|
||||
<app-modal-nav #modalNav nameIcon="edit" [name]="'Modifier'"
|
||||
(ok)="onModalOk(selectedProduct.id, stockForm, modalNav)" (cancel)="onModalCancel(modalNav)">
|
||||
<app-stock-form #stockForm [product]="selectedProduct"></app-stock-form>
|
||||
</app-modal-nav>
|
||||
</div>
|
||||
@@ -61,6 +61,7 @@ export class StockTable implements OnInit {
|
||||
applySearch(query: string) {
|
||||
this.searchQuery.set(query);
|
||||
}
|
||||
|
||||
get hasSelection(): boolean {
|
||||
return this.setOfCheckedId.size > 0;
|
||||
}
|
||||
@@ -122,7 +123,7 @@ export class StockTable implements OnInit {
|
||||
const products = await firstValueFrom(this.productsService.getAllProductsEndpoint());
|
||||
|
||||
// transforme chaque produit en ProductWithQuantity
|
||||
const productsWithQuantity: ProductWithQuantity[] = products.map(p => ({ ...p }));
|
||||
const productsWithQuantity: ProductWithQuantity[] = products.map(p => ({...p}));
|
||||
|
||||
this.products.set(productsWithQuantity);
|
||||
|
||||
@@ -140,7 +141,7 @@ export class StockTable implements OnInit {
|
||||
this.productsLoading.set(false);
|
||||
}
|
||||
|
||||
async delete(productId:number) {
|
||||
async delete(productId: number) {
|
||||
try {
|
||||
await firstValueFrom(this.productsService.deleteProductEndpoint(productId))
|
||||
this.notificationService.success(
|
||||
@@ -184,8 +185,9 @@ export class StockTable implements OnInit {
|
||||
}
|
||||
|
||||
selectedProduct: GetProductDto | null = null;
|
||||
|
||||
openEditModal(product: GetProductDto) {
|
||||
this.selectedProduct = { ...product};
|
||||
this.selectedProduct = {...product};
|
||||
this.modal().showModal();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user