Competitor pricelist: aggregate all competitors, rebuild without re-import
- Add GetLatestQuotesAllCompetitors() repo method: latest quote per (competitor_id, partnumber) across all active competitors - Add RebuildPricelist() service method: loads all quotes, applies each competitor's discount, aggregates with weighted_median per lot, creates single combined competitor pricelist - Add POST /api/competitors/pricelist handler + route - JS: "Создать прайслист" on competitor tab calls new endpoint instead of the generic one that required explicit items This allows recreating the competitor pricelist after new lot mappings are added, without requiring a new file upload. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1769,7 +1769,10 @@ async function createPricelist() {
|
||||
progressStats.textContent = '';
|
||||
|
||||
// Start background task
|
||||
const resp = await fetch('/api/pricelists/create-with-progress', {
|
||||
const url = currentPricelistSource === 'competitor'
|
||||
? '/api/competitors/pricelist'
|
||||
: '/api/pricelists/create-with-progress';
|
||||
const resp = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ source: currentPricelistSource })
|
||||
|
||||
Reference in New Issue
Block a user