From: Vincent Vanwaelscappel Date: Wed, 24 Nov 2021 10:13:36 +0000 (+0100) Subject: wait #4740 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=588ae84393d07970784d89c4f8815a1a28e00372;p=fluidbook-html5.git wait #4740 @1 --- diff --git a/js/libs/fluidbook/special/wescosales.js b/js/libs/fluidbook/special/wescosales.js index 8ebf5f5f..7b557f39 100644 --- a/js/libs/fluidbook/special/wescosales.js +++ b/js/libs/fluidbook/special/wescosales.js @@ -103,7 +103,7 @@ function setWescoSalesPanel(ref, e, updateOnly) { var groupId = groupsByRef[ref][j]; var group = groups[groupId]; tabs.push('' + group.label + ''); - w += wescoSalesTab('group_' + groupId, group.references.join(',')); + w += wescoSalesTab('group_' + groupId, group.references.join(','), undefined, group.longlabel); } } @@ -123,7 +123,6 @@ function setWescoSalesPanel(ref, e, updateOnly) { } // Close tab - var nbtabs = tabs.length; tabs.push(''); w = '
' + tabs.join('') + '
' + w; @@ -162,7 +161,6 @@ function wescoSalesTab(id, ref, refquantities, titleref, hideca) { var activeCountry = $("#wescosalesselect").val(); - var first = true; var wtitle = ''; var wrefs = []; var unique = refs.length === 1; @@ -173,10 +171,6 @@ function wescoSalesTab(id, ref, refquantities, titleref, hideca) { if (r.ref === undefined) { return; } - if (first) { - first = false; - wtitle = r.title; - } var rref = r.ref; if (rref.length === 9) { @@ -217,9 +211,11 @@ function wescoSalesTab(id, ref, refquantities, titleref, hideca) { } }); - if (titleref !== undefined) { + if (isRef(titleref)) { var r = getWescoRef(titleref); wtitle = r.title; + } else { + wtitle = titleref; } var w = '
'; @@ -227,7 +223,6 @@ function wescoSalesTab(id, ref, refquantities, titleref, hideca) { w += '

' + wrefs.join(', ') + '

'; w += '
'; - w += ''; w += ''; var colspan = 2; @@ -240,7 +235,6 @@ function wescoSalesTab(id, ref, refquantities, titleref, hideca) { var format = new Intl.NumberFormat('fr-FR'); $.each(wlines, function (date, line) { - console.log(line.ca); var ca = unique && line.ca.toString().match(/[^0-9, .]/) ? line.ca : format.format(wescoParseNumber(line.ca)); var qte = unique && line.qte.toString().match(/[^0-9, .]/) ? line.qte : format.format(wescoParseNumber(line.qte)); w += ''; @@ -313,7 +307,7 @@ function getAllRefs() { } var groupId = linenum; var label = (line[1] === null || line[1] === '' || line[1] === undefined) ? line[0] : line[1]; - var group = {label: label}; + var group = {label: label, longlabel: line[0]}; var references = []; for (var gi = 2; gi <= line.length; gi++) { var v = line[gi]; @@ -459,6 +453,11 @@ function wescoLinksReady() { }); } +function isRef(ref) { + var ref = ref.toString().replace(/\s*/g, ''); + return ref.match(/^\d{1,5}$/); +} + function normalizeRef(oref) { if (normalizeRefCache[oref] == null) { ref = oref.toString().replace(/\s*/g, '');
Qté