feat(F-093): completed feature
This commit is contained in:
@@ -236,7 +236,7 @@ export default function InventoryPage() {
|
||||
type="search"
|
||||
id="admin-inventory-search"
|
||||
name="q"
|
||||
placeholder="Buscar por producto o SKU..."
|
||||
placeholder="Buscar por EAN o nombre..."
|
||||
value={search}
|
||||
onChange={(e) => setSearch(e.target.value)}
|
||||
className="w-full pl-10 pr-4 py-2.5 border border-gray-300 rounded-xl text-sm focus:ring-2 focus:ring-[#2D6A4F] focus:border-transparent outline-none"
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -189,7 +189,13 @@ export class PgProductRepository implements ProductRepository {
|
||||
|
||||
const countResult = await this.pool.query<{ count: string }>(
|
||||
q
|
||||
? `SELECT COUNT(*) FROM catalog_products WHERE name ILIKE $1`
|
||||
? `SELECT COUNT(*)
|
||||
FROM catalog_products p
|
||||
WHERE p.name ILIKE $1
|
||||
OR EXISTS (
|
||||
SELECT 1 FROM catalog_product_variants v
|
||||
WHERE v.product_id = p.id AND v.ean ILIKE $1
|
||||
)`
|
||||
: 'SELECT COUNT(*) FROM catalog_products',
|
||||
q ? [`%${q}%`] : [],
|
||||
);
|
||||
@@ -202,6 +208,10 @@ export class PgProductRepository implements ProductRepository {
|
||||
LEFT JOIN catalog_product_categories pc ON pc.product_id = p.id
|
||||
LEFT JOIN brands_brands b ON b.id = p.brand_id
|
||||
WHERE p.name ILIKE $1
|
||||
OR EXISTS (
|
||||
SELECT 1 FROM catalog_product_variants v
|
||||
WHERE v.product_id = p.id AND v.ean ILIKE $1
|
||||
)
|
||||
GROUP BY p.id, b.name, b.slug
|
||||
ORDER BY p.created_at DESC
|
||||
LIMIT $2 OFFSET $3`
|
||||
|
||||
Reference in New Issue
Block a user