Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
<form nz-form nzLayout="horizontal" [formGroup]="searchForm" (ngSubmit)="submitForm()">
|
<form nz-form nzLayout="horizontal" [formGroup]="searchForm">
|
||||||
<nz-form-item nz-flex>
|
<nz-form-item nz-flex>
|
||||||
<nz-form-control nzSpan="12">
|
<nz-form-control nzSpan="12">
|
||||||
<div class="group">
|
<div class="group">
|
||||||
<nz-icon nzType="search" nzTheme="outline" class="mr-2 text-xl"></nz-icon>
|
<nz-icon nzType="search" nzTheme="outline" class="mr-2 text-xl" (click)="OnSearch()"></nz-icon>
|
||||||
<input class="input" placeholder="Rechercher" formControlName="searchValue"/>
|
<input class="input" placeholder="Rechercher" formControlName="searchValue" (input)="OnSearch()"/>
|
||||||
</div>
|
</div>
|
||||||
</nz-form-control>
|
</nz-form-control>
|
||||||
</nz-form-item>
|
</nz-form-item>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, output } from '@angular/core';
|
||||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||||
import {NzColDirective} from "ng-zorro-antd/grid";
|
import {NzColDirective} from "ng-zorro-antd/grid";
|
||||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||||
@@ -24,14 +24,12 @@ export class Search {
|
|||||||
searchValue: new FormControl<string>(null)
|
searchValue: new FormControl<string>(null)
|
||||||
})
|
})
|
||||||
|
|
||||||
submitForm() {
|
searchEvent = output<string>();
|
||||||
// Pour annuler si le formulaire est invalide
|
|
||||||
if (this.searchForm.invalid) return;
|
|
||||||
|
|
||||||
// Pour obtenir la valeur du formulaire
|
OnSearch(): void {
|
||||||
console.log(this.searchForm.getRawValue())
|
const raw = this.searchForm.controls['searchValue'].value ?? '';
|
||||||
|
const value = String(raw).trim();
|
||||||
|
this.searchEvent.emit(value);
|
||||||
|
|
||||||
// Pour vider le formulaire
|
|
||||||
this.searchForm.reset()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<nz-table
|
<nz-table
|
||||||
[nzData]="products()"
|
[nzData]="filteredProducts()"
|
||||||
[nzFrontPagination]="false"
|
[nzFrontPagination]="false"
|
||||||
[nzLoading]="productsLoading()"
|
[nzLoading]="productsLoading()"
|
||||||
(nzCurrentPageDataChange)="onCurrentPageDataChange($event)"
|
(nzCurrentPageDataChange)="onCurrentPageDataChange($event)"
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody class="text-center">
|
<tbody class="text-center">
|
||||||
@for (product of products(); track product.id) {
|
@for (product of filteredProducts(); track product.id) {
|
||||||
<tr>
|
<tr>
|
||||||
<td nzWidth="40px">
|
<td nzWidth="40px">
|
||||||
<label
|
<label
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {Component, inject, OnInit, output, signal, viewChild} from '@angular/core';
|
import {Component, computed, inject, OnInit, output, signal, viewChild} from '@angular/core';
|
||||||
import {NzTableComponent, NzThMeasureDirective} from "ng-zorro-antd/table";
|
import {NzTableComponent, NzThMeasureDirective} from "ng-zorro-antd/table";
|
||||||
import {ModalNav} from "../modal-nav/modal-nav";
|
import {ModalNav} from "../modal-nav/modal-nav";
|
||||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||||
@@ -45,6 +45,22 @@ export class StockTable implements OnInit {
|
|||||||
selectionChange = output<boolean>()
|
selectionChange = output<boolean>()
|
||||||
currentPageData: GetProductDto[] = [];
|
currentPageData: GetProductDto[] = [];
|
||||||
|
|
||||||
|
private searchQuery = signal<string>('');
|
||||||
|
|
||||||
|
filteredProducts = computed(() => {
|
||||||
|
const q = this.searchQuery().toLowerCase().trim();
|
||||||
|
|
||||||
|
if (!q) return this.products();
|
||||||
|
|
||||||
|
return this.products().filter(s => {
|
||||||
|
const name = (s.name ?? '').toLowerCase();
|
||||||
|
return name.includes(q);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
applySearch(query: string) {
|
||||||
|
this.searchQuery.set(query);
|
||||||
|
}
|
||||||
get hasSelection(): boolean {
|
get hasSelection(): boolean {
|
||||||
return this.setOfCheckedId.size > 0;
|
return this.setOfCheckedId.size > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<nz-table [nzData]="suppliers()"
|
<nz-table [nzData]="filteredSuppliers()"
|
||||||
[nzLoading]="suppliersLoading()"
|
[nzLoading]="suppliersLoading()"
|
||||||
[nzFrontPagination]="false">
|
[nzFrontPagination]="false">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody style="text-align: center">
|
<tbody style="text-align: center">
|
||||||
@for (supplier of suppliers(); track supplier.id) {
|
@for (supplier of filteredSuppliers(); track supplier.id) {
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ supplier.name }}</td>
|
<td>{{ supplier.name }}</td>
|
||||||
<td>{{ supplier.phone }}</td>
|
<td>{{ supplier.phone }}</td>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<td>{{ supplier.deliveryDelay }} jours</td>
|
<td>{{ supplier.deliveryDelay }} jours</td>
|
||||||
<td>
|
<td>
|
||||||
<app-modal-button type="link" [name]="'Voir les produits'" size="45%">
|
<app-modal-button type="link" [name]="'Voir les produits'" size="45%">
|
||||||
<nz-table [nzData]="suppliers()" [nzFrontPagination]="false">
|
<nz-table [nzData]="filteredSuppliers()" [nzFrontPagination]="false">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="text-center">
|
<tr class="text-center">
|
||||||
<th>Produit</th>
|
<th>Produit</th>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {Component, inject, OnInit, signal, viewChild} from '@angular/core';
|
import {Component, computed, inject, OnInit, signal, viewChild} from '@angular/core';
|
||||||
import {ModalNav} from "../modal-nav/modal-nav";
|
import {ModalNav} from "../modal-nav/modal-nav";
|
||||||
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
||||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||||
@@ -42,6 +42,23 @@ export class SupplierTable implements OnInit {
|
|||||||
await this.fetchSuppliers();
|
await this.fetchSuppliers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private searchQuery = signal<string>('');
|
||||||
|
|
||||||
|
filteredSuppliers = computed(() => {
|
||||||
|
const q = this.searchQuery().toLowerCase().trim();
|
||||||
|
|
||||||
|
if (!q) return this.suppliers();
|
||||||
|
|
||||||
|
return this.suppliers().filter(s => {
|
||||||
|
const name = (s.name ?? '').toLowerCase();
|
||||||
|
return name.includes(q);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
applySearch(query: string) {
|
||||||
|
this.searchQuery.set(query);
|
||||||
|
}
|
||||||
|
|
||||||
async fetchSuppliers() {
|
async fetchSuppliers() {
|
||||||
this.suppliersLoading.set(true);
|
this.suppliersLoading.set(true);
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -105,4 +105,7 @@ export class UserTable implements OnInit {
|
|||||||
onModalCancel(modal: ModalNav) {
|
onModalCancel(modal: ModalNav) {
|
||||||
modal.isVisible = false;
|
modal.isVisible = false;
|
||||||
}
|
}
|
||||||
|
filterUser(input: string, option: any) {
|
||||||
|
return option.nzLabel.toLowerCase().includes(input.toLowerCase());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
<div class="ml-95 w-150">
|
<div class="ml-95 w-150">
|
||||||
<app-search class="w-full"></app-search>
|
<app-search (searchEvent)="onProductSearch($event)"></app-search>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ export class Stock {
|
|||||||
private productsService = inject(ProductsService);
|
private productsService = inject(ProductsService);
|
||||||
private notificationService = inject(NzNotificationService)
|
private notificationService = inject(NzNotificationService)
|
||||||
|
|
||||||
|
onProductSearch(query: string) {
|
||||||
|
this.productTable().applySearch(query);
|
||||||
|
}
|
||||||
// async onModalOk() {
|
// async onModalOk() {
|
||||||
// await this.addSupplier()
|
// await this.addSupplier()
|
||||||
// this.createSupplier().supplierForm.reset();
|
// this.createSupplier().supplierForm.reset();
|
||||||
|
|||||||
@@ -8,9 +8,8 @@
|
|||||||
|
|
||||||
<app-supplier-form #supplierForm></app-supplier-form>
|
<app-supplier-form #supplierForm></app-supplier-form>
|
||||||
</app-modal-button>
|
</app-modal-button>
|
||||||
|
|
||||||
<div class="ml-95 w-150">
|
<div class="ml-95 w-150">
|
||||||
<app-search></app-search>
|
<app-search (searchEvent)="onSupplierSearch($event)"></app-search>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ export class Supplier {
|
|||||||
this.modal().isVisible = false;
|
this.modal().isVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onSupplierSearch(query: string) {
|
||||||
|
this.supplierTable().applySearch(query);
|
||||||
|
}
|
||||||
|
|
||||||
async addSupplier() {
|
async addSupplier() {
|
||||||
if (this.createSupplier().supplierForm.invalid)
|
if (this.createSupplier().supplierForm.invalid)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user