diff --git a/src/food-market.api/Controllers/Catalog/ProductsController.cs b/src/food-market.api/Controllers/Catalog/ProductsController.cs index 3ab04b6..b07a341 100644 --- a/src/food-market.api/Controllers/Catalog/ProductsController.cs +++ b/src/food-market.api/Controllers/Catalog/ProductsController.cs @@ -92,6 +92,10 @@ private async Task ResolveDefaultVatAsync(CancellationToken ct) ("group", true) => q.OrderByDescending(p => p.ProductGroup != null ? p.ProductGroup.Name : null).ThenBy(p => p.Name), ("unit", false) => q.OrderBy(p => p.UnitOfMeasure!.Name).ThenBy(p => p.Name), ("unit", true) => q.OrderByDescending(p => p.UnitOfMeasure!.Name).ThenBy(p => p.Name), + ("packaging", false) => q.OrderBy(p => p.Packaging).ThenBy(p => p.Name), + ("packaging", true) => q.OrderByDescending(p => p.Packaging).ThenBy(p => p.Name), + ("purchasePrice", false) => q.OrderBy(p => p.PurchasePrice).ThenBy(p => p.Name), + ("purchasePrice", true) => q.OrderByDescending(p => p.PurchasePrice).ThenBy(p => p.Name), ("vat", false) => q.OrderBy(p => p.Vat).ThenBy(p => p.Name), ("vat", true) => q.OrderByDescending(p => p.Vat).ThenBy(p => p.Name), ("isActive", false) => q.OrderBy(p => p.IsActive).ThenBy(p => p.Name), diff --git a/src/food-market.web/src/pages/ProductsPage.tsx b/src/food-market.web/src/pages/ProductsPage.tsx index de7db62..3a13beb 100644 --- a/src/food-market.web/src/pages/ProductsPage.tsx +++ b/src/food-market.web/src/pages/ProductsPage.tsx @@ -8,7 +8,7 @@ import { Plus, Filter, X } from 'lucide-react' import { useCatalogList } from '@/lib/useCatalog' import { useOrgSettings } from '@/lib/useOrgSettings' import { ProductGroupTree } from '@/components/ProductGroupTree' -import type { Product } from '@/lib/types' +import { packagingLabel, type Product } from '@/lib/types' const URL = '/api/catalog/products' @@ -117,16 +117,19 @@ export function ProductsPage() { {r.article &&
{r.article}
} )}, - { header: 'Группа', width: '200px', sortKey: 'group', cell: (r) => r.productGroupName ?? '—' }, - { header: 'Ед.', width: '70px', sortKey: 'unit', cell: (r) => r.unitName }, + { header: 'Фасовка', width: '110px', sortKey: 'packaging', cell: (r) => packagingLabel[r.packaging] ?? '—' }, + { header: 'Штрихкод', width: '160px', cell: (r) => ( + {r.barcodes[0]?.code ?? '—'} + )}, + { header: 'Закупочная цена', width: '160px', className: 'text-right font-mono', sortKey: 'purchasePrice', cell: (r) => ( + r.purchasePrice != null + ? `${r.purchasePrice.toLocaleString('ru', { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${r.purchaseCurrencyCode ?? ''}`.trim() + : '—' + )}, ] if (showVat) { baseColumns.push({ header: 'НДС', width: '90px', className: 'text-right', sortKey: 'vat', cell: (r) => r.vatEnabled ? `${r.vat.toFixed(2)}%` : '—' }) } - baseColumns.push( - { header: 'Штрихкодов', width: '120px', className: 'text-right', cell: (r) => r.barcodes.length }, - { header: 'Активен', width: '100px', sortKey: 'isActive', cell: (r) => r.isActive ? '✓' : '—' }, - ) return (