first commit
This commit is contained in:
26
source-code/ERP(B-ba)-廠商管理/src/utils/search.ts
Normal file
26
source-code/ERP(B-ba)-廠商管理/src/utils/search.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 搜尋相關工具函式
|
||||
*/
|
||||
|
||||
import type { Supplier } from "../types/vendor";
|
||||
|
||||
/**
|
||||
* 過濾廠商列表
|
||||
* @param suppliers 廠商列表
|
||||
* @param query 搜尋關鍵字
|
||||
* @returns 過濾後的廠商列表
|
||||
*/
|
||||
export function filterSuppliers(suppliers: Supplier[], query: string): Supplier[] {
|
||||
if (!query.trim()) {
|
||||
return suppliers;
|
||||
}
|
||||
|
||||
const lowerQuery = query.toLowerCase();
|
||||
|
||||
return suppliers.filter(
|
||||
(supplier) =>
|
||||
supplier.name.toLowerCase().includes(lowerQuery) ||
|
||||
supplier.contact?.toLowerCase().includes(lowerQuery) ||
|
||||
supplier.email?.toLowerCase().includes(lowerQuery)
|
||||
);
|
||||
}
|
||||
BIN
source-code/ERP(B-ba)-廠商管理/src/utils/search.ts:Zone.Identifier
Normal file
BIN
source-code/ERP(B-ba)-廠商管理/src/utils/search.ts:Zone.Identifier
Normal file
Binary file not shown.
Reference in New Issue
Block a user