function ConfirmationPage() { var self = this; var imageCdn = "https://i.static-companeo.com"; var contextVersion = "?23.10.26"; var visibilityNumber = 4; var ret = ``; var facHtmlList = []; var userData = {}; var confirmation_text = { "bb_survey_confirmation_modal_address_title": "Bedankt om uw bedrijfsadres in te voeren zodat we zoveel mogelijk leveranciers uit uw regio kunnen voorstellen.", "lib_address": "Adres:", "bb_api_field_error": "Oeps! Gelieve dit veld in te vullen…", "cancel": "Annuleren", "btn_finish": "Verzenden", "bb_confirmation_page_user_request_recorded_success": function (fullname) { return `Dank u ${fullname},
Wij hebben uw offerte aanvraag verwerkt!` }, "bb_api_confirm_rfq_saved": "OFFERTE AANVRAAG AFGEROND", "bb_api_confirm_goto_extranet": 'U kunt op elk moment de gegevens van uw offerte aanvraag raadplegen op uw Companeo Account.', "ph_confirm_page_ft_intro": "Dit is de lijst met de leveranciers aan wie we uw aanvraag zullen overmaken:", "ph_confirm_page_click_intro": "Op basis van uw aanvraag hebben we de volgende leveranciers geselecteerd.
Surf naar hun website om hun voorstel in detail te bekijken en er al dan niet rechtstreeks online op in te gaan :", "ph_confirm_page_match_intro": "Dit is de lijst met de leveranciers aan wie we uw aanvraag zullen overmaken. Het is mogelijk dat we u opbellen alvorens u de offertes te bezorgen. Deze oproep kan worden opgenomen voor kwaliteitsdoeleinden.", "ph_confirm_delete_lead": "Deze leverancier verwijderen", "ph_confirm_remove_fac": "Deze leverancier verwijderen", "ph_confirm_page_deselect_reason": "Gelieve een reden te selecteren", "bb_confirmation_page_supplier_cancel_reason_current_supplier": "Huidige leverancier", "bb_confirmation_page_supplier_cancel_reason_already_work": "Was in het verleden reeds mijn leverancier", "bb_confirmation_page_supplier_cancel_reason_quote_received": "Offerte reeds ontvangen", "bb_confirmation_page_supplier_cancel_reason_bad_reputation": "Slechte reputatie", "bb_confirmation_page_supplier_cancel_reason_other": "Andere reden", "bb_api_confirm_call_back_title": "Om u uw offertes zo snel mogelijk te bezorgen kan het voorkomen dat wij telefonisch contact met u opnemen.", "bb_api_confirm_next_step_title": "En nu?", "bb_api_confirm_next_step_extranet": "Vind al uw informatie in uw Companeo Account, ook als de contact gegevens van de leveranciers die offerte aanvraag zullen beantwoorden.", "bb_api_confirm_tricks": "TIP", "bb_api_confirm_buyingguide": function (category_name) { return `Bekijk de ${category_name} buyers guide en koop nog slimmer aan!` }, "bb_api_confirm_tricks": "TIP", "bePrefix": '/nl_BE', "ph_confirm_page_registered_request": `Uw offerteaanvraag werd goed ontvangen`, "ph_confirm_page_transmit_request": `We maken uw gegevens over aan onze dienstverleners`, "ph_confirm_page_contact": `U zult binnenkort gecontacteerd worden`, "ph_confirm_page_request_number": `ph_confirm_page_request_number`, "ph_confirm_page_fac_list": `Wie zijn de dienstverleners die met u contact zullen opnemen?`, "ph_confirm_page_fac_default_description": `Erkend Companeo-leverancier voor :1`, "ph_confirm_page_fac_learn_more": `Meer weten`, "ph_confirm_page_delete_fac": `Om bepaalde aanbieders te deselecteren`, "ph_confirm_page_delete_fac_cta": `klik hier`, "ph_confirm_page_delete_fac_cta_abort": `Annuleren`, "ph_confirm_page_qa_no_cas_available": `Helaas hebben we op dit moment geen beschikbare dienstverlener voor deze aanvraag`, "ph_confirm_page_qa_no_cas_available_detail": `We zullen contact met u opnemen indien een dienstverlener aan uw aanvraag voldoet`, "ph_confirm_page_no_cas_available": `Helaas hebben we op dit moment geen beschikbare dienstverlener voor deze aanvraag`, "ph_confirm_page_companeo_call_back": `We zullen contact met u opnemen indien een dienstverlener aan uw aanvraag voldoet`, }; function __(value, val) { return (typeof confirmation_text[value] == 'function') ? confirmation_text[value](val) : confirmation_text[value]; } _removeSelected = function(e) { // remove selected items from data and send information to the server let checkedList = e.closest(".presta-list").querySelectorAll('input[class=prestaSelection]:checked'); if (checkedList.length > 0) { checkedList.forEach((elem) => { let data = { ...elem.dataset, ...{"reason": "CAS deselected by user"} }; delete userData.blockList[data.listindex].facList[data.itemindex] store.removeFac(data); }) // reindex array userData.blockList[e.dataset.listindex].facList = userData.blockList[e.dataset.listindex].facList.filter(val => val); // remove all elements let cardList = e.closest(".presta-list").querySelectorAll('.card-presta'); for (let i = 0; i < cardList.length; i++) { cardList[i].remove() } // find after what element to add the new html let d1 = e.closest(".presta-list").querySelector('.presta-list__cat'); // generate and insert a new html d1.insertAdjacentHTML('afterend', _facList(userData.blockList[e.dataset.listindex], e.dataset.listindex)); } let nextElement = e.nextElementSibling; while (nextElement) { if (nextElement.classList.contains('presta-footer')) { const initialText = __('ph_confirm_page_delete_fac_cta'); const textNextToBtn = __('ph_confirm_page_delete_fac') + ' '; const initialTextNode = document.createTextNode(textNextToBtn); nextElement.firstChild.textContent = initialText; nextElement.prepend(initialTextNode); break; } nextElement = nextElement.nextElementSibling; } removeAllVisibility(e); } _toggleAllVisibility = function(e) { // change text const initialText = __('ph_confirm_page_delete_fac_cta'); const textNextToBtn = __('ph_confirm_page_delete_fac') + ' '; if (e.textContent.toLowerCase().includes(initialText.toLowerCase())) { // check if the first element is a text node // then remove it if (e.parentElement.childNodes[0].nodeType === 3) { e.parentElement.removeChild(e.parentElement.childNodes[0]); } e.textContent = __('ph_confirm_page_delete_fac_cta_abort'); // show trash button e.closest(".presta-list").querySelector(".presta-trash").style.display = "block" // show checkboxes e.closest(".presta-list").classList.add('show-checkbox') } else { const initialTextNode = document.createTextNode(textNextToBtn); const pNode = e.parentElement; pNode.prepend(initialTextNode); e.textContent = initialText; removeAllVisibility(e); } } const removeAllVisibility = function (e) { // show trash button e.closest(".presta-list").querySelector(".presta-trash").style.display = "none" // show checkboxes e.closest(".presta-list").classList.remove('show-checkbox') } // self.test = function () { // // Good data for test : remove after development + integration // var ldata = `{"status": "success", "message": "getConfirmation", "data": {"fullname": "rf BALTARD", "cliId": 9190271, "ratioMax": 4, "blockList": [{"categoryList": {"name": "VoIP, Voix sur IP, telephonie IP", "rfq_id": 20408110 }, "guideBlocks": [{"cat_id": "6062", "group_categ": "636010", "cat_type": "Primary", "visible": true, "group_qa_active": true, "cat_lib": "Opérateurs telecoms et FAI", "rfq_image": "https://www.lcompaneo-fr.lan/i/fr_FR/rfq/_6062.jpeg", "permalink_url": "operateur-telecoms", "cg_portal_url": "https://www.lcompaneo-fr.lan/operateur-telecoms"}, {"cat_id": "1341", "group_categ": "740010", "cat_type": "Focus", "visible": true, "group_qa_active": true, "cat_lib": "Fournisseur délectricité", "rfq_image": "https://www.lcompaneo-fr.lan/i/fr_FR/rfq/1341_1341.jpeg", "permalink_url": "energie-fournisseur-electricite-gaz", "cg_portal_url": "https://www.lcompaneo-fr.lan/energie-fournisseur-electricite-gaz"}, {"cat_id": "344", "group_categ": "207010", "cat_type": "Primary", "visible": true, "group_qa_active": true, "cat_lib": "Permanence Téléphonique", "rfq_image": "https://www.lcompaneo-fr.lan/i/fr_FR/rfq/344_344.jpeg", "permalink_url": "permanence-telephonique", "cg_portal_url": "https://www.lcompaneo-fr.lan/permanence-telephonique"} ], "facList": [{"facName": "FMI TELECOM", "tradingName": "FMI TELECOM", "facId": "202357", "permalinkFacHomepage": "https://www.lcompaneo-fr.lan/standard-telephonique/annuaire/fmi-telecom", "isUrlActive": true, "offerId": "58143", "rfqId": "20408110", "cliId": 9190271, "ratioMax": 4, "bigLogo": "/i/fr_FR/faclogobig/202357.gif", "fac_resume": "est un opérateur de télécommunication proposant ses services sur les 3 principaux réseaux Orange, SFR et Bouygues Télécom. ", "pack_online": false }, {"facName": "MY IBS", "tradingName": "MY IBS", "facId": "175557", "permalinkFacHomepage": "https://www.lcompaneo-fr.lan/standard-telephonique/annuaire/my-ibs", "isUrlActive": true, "offerId": "58431", "rfqId": "20408110", "cliId": 9190271, "ratioMax": 4, "bigLogo": "/i/fr_FR/faclogobig/175557.gif", "fac_resume": "
le spécialiste de la bureautique pour les TPE/ PME depuis plus de 8 ans. 
Les domaines de limprimerie, des télécoms et de linformatique sont nos 3 compétences.
", "pack_online": false }, {"facName": "ETM", "tradingName": "ETM", "facId": "194892", "permalinkFacHomepage": "https://www.lcompaneo-fr.lan/standard-telephonique/annuaire/etm", "isUrlActive": true, "offerId": "56981", "rfqId": "20408110", "cliId": 9190271, "ratioMax": 4, "bigLogo": "/i/fr_FR/faclogobig/194892.gif", "fac_resume": "intégrateur et opérateur de nouvelle génération, fournit des solutions Télécoms innovantes aux Entreprises depuis plus de 40 ans. 
Installation de standard téléphonique, Téléphonie VoIP dans le Cloud (IP Centrex), Fibre optique, outils collaboratifs et sécurité.
", "pack_online": false }, {"facName": "TECH TELECOM", "tradingName": "TECH TELECOM", "facId": "41685", "permalinkFacHomepage": "", "isUrlActive": false, "offerId": "43671", "rfqId": "20408110", "cliId": 9190271, "ratioMax": 4, "bigLogo": null, "fac_resume": "", "pack_online": false }, {"facName": "KERTEL", "tradingName": "KERTEL", "facId": "188172", "permalinkFacHomepage": "", "isUrlActive": false, "offerId": "56416", "rfqId": "20408110", "cliId": 9190271, "ratioMax": 4, "bigLogo": null, "fac_resume": "", "pack_online": false }, {"facName": "BOUYGUES TELECOM ENTREPRISES", "tradingName": "BOUYGUES TELECOM ENTREPRISES", "facId": "192146", "permalinkFacHomepage": "", "isUrlActive": false, "offerId": "55384", "rfqId": "20408110", "cliId": 9190271, "ratioMax": 4, "bigLogo": "/i/fr_FR/faclogobig/192146.gif", "fac_resume": "", "pack_online": false }, {"facName": "CUBE", "tradingName": "CUBE", "facId": "6824", "permalinkFacHomepage": "https://www.lcompaneo-fr.lan/standard-telephonique/annuaire/cube", "isUrlActive": true, "offerId": "12209", "rfqId": "20408110", "cliId": 9190271, "ratioMax": 4, "bigLogo": "/i/fr_FR/faclogobig/6824.gif", "fac_resume": " existe depuis 2002. Dirigée par Cyrille PATRIGEON, elle propose d’accompagner les PMI, PME et TPE de Paris et sa région dans la conception, l’installation, le suivi et la maintenance de leurs réseaux informatiques et téléphoniques. Sa vocation ? Proposer un service de qualité, une solution globale et une tranquillité aux entreprises. Informatique, infogérance, téléphonie et solutions de mobilité, Cube s’occupe des réseaux, de la prévention des problèmes techniques éventuels, d’être un interlocuteur et une solution unique avec Be Cube ! et des techniciens experts dédiés.", "pack_online": false }, {"facName": "PRECTEL", "tradingName": "PRECTEL", "facId": "6427", "permalinkFacHomepage": "https://www.lcompaneo-fr.lan/standard-telephonique/annuaire/prectel", "isUrlActive": true, "offerId": "11224", "rfqId": "20408110", "cliId": 9190271, "ratioMax": 4, "bigLogo": "/i/fr_FR/faclogobig/6427.gif", "fac_resume": "

est intégrateur de solutions de communication pour les TPE/PME depuis 1949.

 

 

", "pack_online": false }, {"facName": "5EME AVENUE", "tradingName": "5EME AVENUE", "facId": "172746", "permalinkFacHomepage": "", "isUrlActive": false, "offerId": "51065", "rfqId": "20408110", "cliId": 9190271, "ratioMax": 4, "bigLogo": null, "fac_resume": "", "pack_online": false }, {"facName": "SISTEO COMMUNICATIONS", "tradingName": "SISTEO COMMUNICATIONS", "facId": "12569", "permalinkFacHomepage": "", "isUrlActive": false, "offerId": "31479", "rfqId": "20408110", "cliId": 9190271, "ratioMax": 4, "bigLogo": "/i/fr_FR/faclogobig/12569.gif", "fac_resume": "est spécialisé depuis 2005, sur les systèmes téléphoniques, informatiques, périphériques et sécurité.", "pack_online": false }, {"facName": "Paritel", "tradingName": "Paritel", "facId": "5158", "permalinkFacHomepage": "https://www.lcompaneo-fr.lan/standard-telephonique/annuaire/paritel", "isUrlActive": true, "offerId": "35454", "rfqId": "20408110", "cliId": 9190271, "ratioMax": 4, "bigLogo": "/i/fr_FR/faclogobig/5158.gif", "fac_resume": ", filiale du Groupe Global Concept, est le spécialiste des solutions télécoms pour les TPE-PME et professions libérales.", "pack_online": false }, {"facName": "E - LEADS Distributeur BOUYGUES", "tradingName": "E - LEADS Distributeur BOUYGUES", "facId": "13478", "permalinkFacHomepage": "", "isUrlActive": false, "offerId": "34724", "rfqId": "20408110", "cliId": 9190271, "ratioMax": 4, "bigLogo": null, "fac_resume": "est spécialisé dans les télécoms", "pack_online": false } ], "isFasttracked": false, "isClic": false, "isMatch": true } ], "category_name": "VoIP, Voix sur IP, telephonie IP", "cg_permalink": "standard-telephonique"} }`; // var response = JSON.parse(ldata); // userData = response.data; // console.log(response) // document.getElementById('jsConfirmationCallback').innerHTML = self.render(userData) // } /** * Modal Address * @param data * @returns {string} */ function modalEditAddress(data) { // Modal Edit Company return `
${__("bb_api_field_error")}
icon-phone icon-confirm icon-cross icon-exclamation icon-disable icon-address ` } /** * 3 cards * @param data * @param isMatch * @returns {string} * @private */ function _cards(data, isMatch) { var rfqId = ``; for (let index in data) { if (undefined !== data[index].categoryList.rfq_id) { rfqId = `n° ${data[index].categoryList.rfq_id}`; break; } } ret = `

${__("ph_confirm_page_registered_request")}

` + `${rfqId}` + `

` + (isMatch ? __("ph_confirm_page_transmit_request") : __("ph_confirm_page_no_cas_available")) + `

` + (isMatch ? __("ph_confirm_page_contact") : __("ph_confirm_page_companeo_call_back")) + `

`; return ret; } function _cardsNoFacs(block) { return `
` + `

${block.categoryList.name}

` + `

${__('ph_confirm_page_qa_no_cas_available')}

${__('ph_confirm_page_qa_no_cas_available_detail')}

` + `
`; } /** * Fac list HTML * @param data * @returns {string} * @private */ function _listFac(data) { let cardsMatchExists = false; let cardsNoMatchExists = false; for (let x in data) { let block = data[x]; if (block.facList?.length > 0) { if (x === '0') { cardsMatchExists = true; ret = _cards(data, true); ret += `

${__('ph_confirm_page_fac_list')}

` } ret += `
` + `

${block.categoryList.name}

`; ret += _facList(block, x) ret += `
` } else { if (x === '0') { ret += _cards(data, false); cardsNoMatchExists = true; } else if (cardsMatchExists || !cardsNoMatchExists) { ret += _cardsNoFacs(block) } } } return ret; } /** * Fac list builder * @param block * @param listindex * @returns {string} * @private */ function _facList(block, listindex) { var res = ``; var iter = block.facList.length > visibilityNumber ? visibilityNumber : block.facList.length for (let y = 0; y < iter; y++) { res += _facInfo(block.facList[y], listindex, y); } return res; } /** * Fac Information * @param facData * @param listindex * @param itemindex * @returns {string} * @private */ function _facInfo(facData, listindex, itemindex) { var noLogo = (undefined === facData.bigLogo || facData.bigLogo === "" || null === facData.bigLogo); var res = `
` + `
` + (noLogo ? `` : `${facData.tradingName}`) + `
` + `

${facData.tradingName}

${facData.fac_resume}

` + (facData.pack_online && facData.permalinkFacHomepage !== "" ? `${__('ph_confirm_page_fac_learn_more')}` : '' ) + `
` facHtmlList.push(res) return res; } /** * Main render * @param data * @returns {string} */ self.render = function (data) { userData = data var html = ``; html = `
` + `
` + _listFac(data.blockList) + `
` + `
` + modalEditAddress(data); return html; } return self; }