feat: ajouter region_csc à toutes les références marchés
Implémente buildRef(r) dans calc.js : ref = id_marche + ' - ' + region_csc (ex: AO 58/2024 : Lot01 - ULS Gabes) Propagé dans : - services/calc.js → champ ref de normalizeMarche() - services/export-xlsx.js → toutes les cellules référence - routes/export.js → PPTX + DOCX (3 occurrences) - index.html → normalizeMarche() champ id_marche export-pdf.js déjà couvert via r.ref (utilise normalizeMarche) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
2074893978
commit
7ca0eccb96
+7
-6
@@ -13,6 +13,7 @@ const {
|
||||
isCloture, normalizeMarche, parseNum, formatMontant, selectVal,
|
||||
getDelaiRestant, niveauAlerte, niveauAvancement, niveauRisque,
|
||||
DELAI_CRITIQUE, DELAI_ATTENTION, SEUIL_STANDARD, SEUIL_CRITIQUE_PCT,
|
||||
buildRef,
|
||||
} = require('../services/calc');
|
||||
|
||||
const pdfGen = require('../services/export-pdf');
|
||||
@@ -50,7 +51,7 @@ async function buildViewData(view, req) {
|
||||
const alertes = actifs
|
||||
.map(r=>({...r,_d:getDelaiRestant(r)}))
|
||||
.filter(r=>r._d!==null&&r._d<=DELAI_ATTENTION)
|
||||
.map(r=>({ref:r.id_marche||r.reference||'',projet:r.projet||'',region:r.region||'',entrepreneur:r.entrepreneur||'',delai_restant:r._d,niveau:niveauAlerte(r._d)}))
|
||||
.map(r=>({ref:buildRef(r),projet:r.projet||'',region:r.region||'',entrepreneur:r.entrepreneur||'',delai_restant:r._d,niveau:niveauAlerte(r._d)}))
|
||||
.sort((a,b)=>a.delai_restant-b.delai_restant);
|
||||
return {
|
||||
total: rows.length, actifs: actifs.length, clotures: clotures.length,
|
||||
@@ -315,7 +316,7 @@ router.get('/pptx', async (req, res) => {
|
||||
const alertRows = alerteItems.slice(0, 18).map(r => {
|
||||
const alColor = r._d <= DELAI_CRITIQUE ? 'EF4444' : 'EA580C';
|
||||
return [
|
||||
{ text: r.id_marche||r.reference||'', options: { fontSize: 8, color: 'CBD5E1' } },
|
||||
{ text: buildRef(r), options: { fontSize: 8, color: 'CBD5E1' } },
|
||||
{ text: r.projet||'', options: { fontSize: 8, color: 'CBD5E1' } },
|
||||
{ text: r.region||'', options: { fontSize: 8, color: 'CBD5E1' } },
|
||||
{ text: r.entrepreneur||'', options: { fontSize: 8, color: 'CBD5E1' } },
|
||||
@@ -355,7 +356,7 @@ router.get('/pptx', async (req, res) => {
|
||||
const t = parseN(r.taux_phy||r.avt_phy);
|
||||
const res = classify(r);
|
||||
return [
|
||||
{ text: r.id_marche||r.reference||'', options: { fontSize: 8, color: 'CBD5E1' } },
|
||||
{ text: buildRef(r), options: { fontSize: 8, color: 'CBD5E1' } },
|
||||
{ text: r.projet||'', options: { fontSize: 8, color: 'CBD5E1' } },
|
||||
{ text: r.region||'', options: { fontSize: 8, color: 'CBD5E1' } },
|
||||
{ text: r.entrepreneur||'', options: { fontSize: 8, color: 'CBD5E1' } },
|
||||
@@ -564,7 +565,7 @@ router.get('/docx', async (req, res) => {
|
||||
rows: [
|
||||
tr([['Référence',2500,navyFill],['Projet',3000,navyFill],['Région',1200,navyFill],['Délai (j)',1200,navyFill]], true),
|
||||
...alerteItems.slice(0,20).map((r, i) => tr([
|
||||
[r.id_marche||r.reference||'', 2500, i%2===1?altFill:undefined],
|
||||
[buildRef(r), 2500, i%2===1?altFill:undefined],
|
||||
[r.projet||'', 3000, i%2===1?altFill:undefined],
|
||||
[r.region||'', 1200, i%2===1?altFill:undefined],
|
||||
[String(r._d||'—'), 1200, i%2===1?altFill:undefined],
|
||||
@@ -594,7 +595,7 @@ router.get('/docx', async (req, res) => {
|
||||
...regActifs.map((r, i) => {
|
||||
const phy = parseN(r.taux_phy||r.avt_phy);
|
||||
return tr([
|
||||
[r.id_marche||r.reference||'', 2500, i%2===1?altFill:undefined],
|
||||
[buildRef(r), 2500, i%2===1?altFill:undefined],
|
||||
[r.projet||'', 2800, i%2===1?altFill:undefined],
|
||||
[r.entrepreneur||'', 2000, i%2===1?altFill:undefined],
|
||||
[fmtPct(phy), 700, i%2===1?altFill:undefined],
|
||||
@@ -620,7 +621,7 @@ router.get('/docx', async (req, res) => {
|
||||
rows: [
|
||||
tr([['Référence',2200,navyFill],['Projet',2500,navyFill],['Région',1000,navyFill],['Entrepreneur',1800,navyFill],['Phy %',700,navyFill],['Résultat',1300,navyFill]], true),
|
||||
...pilotItems.map(({ r, res, phy }, i) => tr([
|
||||
[r.id_marche||r.reference||'', 2200, i%2===1?altFill:undefined],
|
||||
[buildRef(r), 2200, i%2===1?altFill:undefined],
|
||||
[r.projet||'', 2500, i%2===1?altFill:undefined],
|
||||
[r.region||'', 1000, i%2===1?altFill:undefined],
|
||||
[r.entrepreneur||'', 1800, i%2===1?altFill:undefined],
|
||||
|
||||
Reference in New Issue
Block a user