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": "Para ayudarnos a encontrar el máximo de proveedores que respondan a sus necesidades, introduzca su dirección profesional.", "lib_address": "Dirección:", "bb_api_field_error": "¡Vaya! Por favor, rellene este campo …", "cancel": "Cancelar", "btn_finish": "Enviar", "bb_confirmation_page_user_request_recorded_success": function (fullname) { return `Gracias, ${fullname} , su solicitud de presupuesto ha sido registrada.` }, "bb_api_confirm_rfq_saved": "Su solicitud ha sido registrada", "bb_api_confirm_goto_extranet": 'A partir de ahora, puede consultarla cuando quiera en su espacio profesional Companeo.', "ph_confirm_page_ft_intro": "Esta es la lista de los proveedores a quienes comunicaremos su solicitud:", "ph_confirm_page_click_intro": "A raíz de su solicitud, hemos seleccionado a los siguientes proveedores.
Visite su página para descubrir en detalle sus propuestas y suscríbase directamente en línea:", "ph_confirm_page_match_intro": "Esta es la lista de los proveedores a quienes comunicaremos su solicitud. Podríamos llamarle antes de proceder a la comunicación de su solicitud.", "ph_confirm_delete_lead": "Suprimir a este proveedor", "ph_confirm_remove_fac": "Suprimir a este proveedor", "ph_confirm_page_deselect_reason": "Seleccione una razón", "bb_confirmation_page_supplier_cancel_reason_current_supplier": "Proveedor actual", "bb_confirmation_page_supplier_cancel_reason_already_work": "Ya ha sido mi proveedor", "bb_confirmation_page_supplier_cancel_reason_quote_received": "Presupuesto ya recibido", "bb_confirmation_page_supplier_cancel_reason_bad_reputation": "Mala reputación", "bb_confirmation_page_supplier_cancel_reason_other": "Otros", "bb_api_confirm_call_back_title": "Puede ser que, si necesario, nuestro servicio de atención al cliente se ponga en contacto con usted.", "bb_api_confirm_next_step_title": "¿Y ahora?", "bb_api_confirm_next_step_extranet": "Encuentre toda su información en su espacio profesional, así como los datos de los proveedores que realizarán sus presupuestos.", "bb_api_confirm_tricks": "CONSEJO", "bb_api_confirm_buyingguide": function (category_name) { return `Compra con inteligencia con nuestra guía de compra ${category_name}!` }, "bb_api_confirm_tricks": "CONSEJO", "bePrefix": '', "ph_confirm_page_registered_request": `Su solicitud de presupuesto se ha registrado correctamente`, "ph_confirm_page_transmit_request": `Transmitimos sus datos a nuestros proveedores`, "ph_confirm_page_contact": `Pronto se pondrán en contacto con usted`, "ph_confirm_page_request_number": `ph_confirm_page_request_number`, "ph_confirm_page_fac_list": `¿Quiénes son los proveedores que contactarán con usted?`, "ph_confirm_page_fac_default_description": `Proveedor autorizado Companeo en :1`, "ph_confirm_page_fac_learn_more": `Más información`, "ph_confirm_page_delete_fac": `Para deseleccionar determinados proveedores`, "ph_confirm_page_delete_fac_cta": `haga clic aquí`, "ph_confirm_page_delete_fac_cta_abort": `Cancelar`, "ph_confirm_page_qa_no_cas_available": `Desgraciadamente no contamos con ningún proveedor adecuado en estos momentos`, "ph_confirm_page_qa_no_cas_available_detail": `Nos pondremos en contacto con usted en cuanto un proveedor encaje con su solicitud`, "ph_confirm_page_no_cas_available": `Desgraciadamente no contamos con ningún proveedor adecuado en estos momentos`, "ph_confirm_page_companeo_call_back": `Nos pondremos en contacto con usted en cuanto un proveedor encaje con su solicitud`, }; 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; }