Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Commit

Permalink
Se arregló la busqueda
Browse files Browse the repository at this point in the history
  • Loading branch information
diego-rascon committed May 16, 2023
1 parent bd4a430 commit 3bfbc73
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/routes/home/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@
product.producto_nombre.toLowerCase().includes(word) ||
nfd(product.producto_nombre.toLowerCase()).includes(word) ||
nfc(product.producto_nombre.toLowerCase()).includes(word) ||
nfd(product.plataforma_nombre.toLowerCase()).includes(word) ||
nfc(product.plataforma_nombre.toLowerCase()).includes(word) ||
product.producto_stock.toString().includes(word) ||
product.producto_minimo.toString().includes(word) ||
product.producto_precio.toString().includes(word)
Expand All @@ -137,8 +135,6 @@
product.producto_nombre.toLowerCase().includes(word) ||
nfd(product.producto_nombre.toLowerCase()).includes(word) ||
nfc(product.producto_nombre.toLowerCase()).includes(word) ||
nfd(product.plataforma_nombre.toLowerCase()).includes(word) ||
nfc(product.plataforma_nombre.toLowerCase()).includes(word) ||
product.producto_stock.toString().includes(word) ||
product.producto_minimo.toString().includes(word) ||
product.producto_precio.toString().includes(word)
Expand All @@ -152,8 +148,6 @@
product.producto_nombre.toLowerCase().includes(word) ||
nfd(product.producto_nombre.toLowerCase()).includes(word) ||
nfc(product.producto_nombre.toLowerCase()).includes(word) ||
nfd(product.plataforma_nombre.toLowerCase()).includes(word) ||
nfc(product.plataforma_nombre.toLowerCase()).includes(word) ||
product.producto_stock.toString().includes(word) ||
product.producto_minimo.toString().includes(word) ||
product.producto_precio.toString().includes(word)
Expand Down
36 changes: 36 additions & 0 deletions src/routes/home/rents/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@
const searchRent = (search: string) => {
const searchWords = search.split(' ');
filteredPendingRents = pendingRents.filter((rent: any) =>
searchWords.every(
(word: string) =>
rent.renta_id.toString().includes(word) ||
new Date(String(rent.renta_fecha_inicio)).toLocaleDateString('en-GB').includes(word) ||
new Date(String(rent.renta_fecha_final)).toLocaleDateString('en-GB').includes(word) ||
rent.renta_cantidad.toString().includes(word) ||
rent.renta_descuento.toString().includes(word) ||
rent.renta_monto.toString().includes(word)
)
);
filteredActiveRents = activeRents.filter((rent: any) =>
searchWords.every(
(word: string) =>
Expand All @@ -146,6 +158,30 @@
rent.renta_monto.toString().includes(word)
)
);
filteredPreviousRents = previousRents.filter((rent: any) =>
searchWords.every(
(word: string) =>
rent.renta_id.toString().includes(word) ||
new Date(String(rent.renta_fecha_inicio)).toLocaleDateString('en-GB').includes(word) ||
new Date(String(rent.renta_fecha_final)).toLocaleDateString('en-GB').includes(word) ||
rent.renta_cantidad.toString().includes(word) ||
rent.renta_descuento.toString().includes(word) ||
rent.renta_monto.toString().includes(word)
)
);
filteredUnactiveRents = unactiveRents.filter((rent: any) =>
searchWords.every(
(word: string) =>
rent.renta_id.toString().includes(word) ||
new Date(String(rent.renta_fecha_inicio)).toLocaleDateString('en-GB').includes(word) ||
new Date(String(rent.renta_fecha_final)).toLocaleDateString('en-GB').includes(word) ||
rent.renta_cantidad.toString().includes(word) ||
rent.renta_descuento.toString().includes(word) ||
rent.renta_monto.toString().includes(word)
)
);
};
const rentFinished: ToastSettings = {
Expand Down

0 comments on commit 3bfbc73

Please sign in to comment.