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": "Pour nous aider à trouver le plus de fournisseurs répondant à votre besoin, merci de compléter votre adresse professionnelle.", "lib_address": "Adresse :", "bb_api_field_error": "Oups ! Merci de renseigner ce champ...", "cancel": "Annuler", "btn_finish": "Terminer", "bb_confirmation_page_user_request_recorded_success": function (fullname) { return `Merci ${fullname},
Nous avons bien pris en compte votre demande !` }, "bb_api_confirm_rfq_saved": "DEMANDE(S) DE DEVIS ENREGISTRÉE(S)", "bb_api_confirm_goto_extranet": 'Vous pouvez à tout moment consulter le détail de vos demandes sur votre espace Companeo.', "ph_confirm_page_ft_intro": "Voici la liste des fournisseurs à qui nous allons transmettre votre demande :", "ph_confirm_page_click_intro": "Suite à votre demande, nous avons sélectionné les prestataires suivants.
Rendez-vous sur leur site pour découvrir en détail leurs offres et souscrivez directement en ligne :", "ph_confirm_page_match_intro": "Voici la liste des fournisseurs à qui nous allons transmettre votre demande. Nous sommes susceptibles de vous rappeler avant de procéder à la transmission, cet appel sera enregistré pour des raisons de qualité.", "ph_confirm_delete_lead": "Supprimer ce fournisseur", "ph_confirm_remove_fac": "Supprimer ce fournisseur", "ph_confirm_page_deselect_reason": "Veuillez sélectionner une raison", "bb_confirmation_page_supplier_cancel_reason_current_supplier": "Fournisseur actuel", "bb_confirmation_page_supplier_cancel_reason_already_work": "A déjà été mon fournisseur", "bb_confirmation_page_supplier_cancel_reason_quote_received": "Devis déjà reçu", "bb_confirmation_page_supplier_cancel_reason_bad_reputation": "Mauvaise réputation", "bb_confirmation_page_supplier_cancel_reason_other": "Autre", "bb_api_confirm_call_back_title": "Afin de vous permettre de recevoir vos devis le plus rapidement possible, nous sommes susceptibles de vous appeler.", "bb_api_confirm_next_step_title": "Et maintenant ?", "bb_api_confirm_next_step_extranet": "Retrouvez l'ensemble de vos informations sur votre espace Companeo, ainsi que les coordonnées des fournisseurs qui vont réaliser vos devis.", "bb_api_confirm_tricks": "ASTUCE", "bb_api_confirm_buyingguide": function (category_name) { return `Achetez malin avec notre guide d'achat ${category_name} !` }, "bb_api_confirm_tricks": "ASTUCE", "bePrefix": '/fr_BE', "ph_confirm_page_registered_request": `Vos demandes de devis ont bien été enregistrées`, "ph_confirm_page_transmit_request": `Nous transmettons vos informations à nos prestataires`, "ph_confirm_page_contact": `Vous allez être rapidement recontacté`, "ph_confirm_page_request_number": `ph_confirm_page_request_number`, "ph_confirm_page_fac_list": `Qui sont les prestataires qui vont vous contacter ?`, "ph_confirm_page_fac_default_description": `Fournisseur Agréé Companeo en :1`, "ph_confirm_page_fac_learn_more": `En savoir plus`, "ph_confirm_page_delete_fac": `Pour désélectionner certains des prestataires`, "ph_confirm_page_delete_fac_cta": `cliquez ici`, "ph_confirm_page_delete_fac_cta_abort": `Annuler`, "ph_confirm_page_qa_no_cas_available": `Malheureusement nous n’avons aucun prestataire actuellement`, "ph_confirm_page_qa_no_cas_available_detail": `Nous reviendrons vers vous si un prestataire correspond à votre demande`, "ph_confirm_page_no_cas_available": `Malheureusement nous n’avons aucun prestataire actuellement`, "ph_confirm_page_companeo_call_back": `Nous reviendrons vers vous si un prestataire correspond à votre demande`, }; 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; }