chore: initial import for test contour with k3s CI

This commit is contained in:
sova-bootstrap
2026-05-28 12:09:28 +03:00
commit d77d0a872f
423 changed files with 35401 additions and 0 deletions
+117
View File
@@ -0,0 +1,117 @@
console.log('wf form load');
// Получаем данные из атрибутов текущего скрипта
const currentScript = document.currentScript;
const formNameFancyBox = currentScript.dataset.formNameFancyBox;
const buttonClass = currentScript.dataset.buttonClass || '.wf-button'; // Добавляем fallback значение
// Кэш для cabinetHost чтобы не определять его каждый раз
const CABINET_HOST = location.host === 'wmtmed.ru'
? 'https://cabinet.wmtmed.ru'
: 'https://cabinet.sovamed.ru';
function wf_renderModal(formName, query, wfId, fbStyle, wfStyle) {
// Удаляем предыдущее модальное окно, если оно существует
const existingPopup = document.getElementById(formNameFancyBox);
if (existingPopup) {
existingPopup.remove();
}
// Создаем структуру модального окна
const wf_popup = document.createElement('div');
wf_popup.id = formNameFancyBox;
wf_popup.className = 'fancybox-content';
wf_popup.style.cssText = fbStyle || '';
wf_popup.style.display = 'none';
document.body.appendChild(wf_popup);
const wf_modalDialog = document.createElement('div');
wf_modalDialog.className = 'modal-dialog';
wf_modalDialog.setAttribute('role', 'document');
wf_popup.appendChild(wf_modalDialog);
const wf_modalContent = document.createElement('div');
wf_modalContent.className = 'modal-content';
wf_modalDialog.appendChild(wf_modalContent);
const wf_modalHeader = document.createElement('div');
wf_modalHeader.className = 'modal-header';
wf_modalContent.appendChild(wf_modalHeader);
const wf_modalTitle = document.createElement('h5');
wf_modalTitle.className = 'modal-title';
wf_modalTitle.textContent = formName;
wf_modalHeader.appendChild(wf_modalTitle);
const wf_popupBody = document.createElement('div');
wf_popupBody.id = 'wf_popup-body';
wf_popupBody.className = 'modal-body';
wf_modalContent.appendChild(wf_popupBody);
const wf_iframe = document.createElement('iframe');
wf_iframe.id = `${formNameFancyBox}-frame`;
wf_iframe.src = `${CABINET_HOST}/widget/form/${wfId}?${query}`;
wf_iframe.style.cssText = wfStyle || '';
wf_popupBody.appendChild(wf_iframe);
return true;
}
function getSessionId() {
try {
const calltrackingParams = window.ct?.('calltracking_params');
if (Array.isArray(calltrackingParams) && calltrackingParams.length > 0) {
console.error('getting sessionId:', calltrackingParams[0]?.sessionId);
return calltrackingParams[0]?.sessionId || null;
}
return null;
} catch (e) {
console.error('Error getting sessionId:', e);
return null;
}
}
function wf_listiner(wf_evn) {
try {
const target = wf_evn.target;
if (!target.dataset) return;
// Базовые параметры
const baseQuery = {
'ref': btoa(location.origin),
'sessionId': getSessionId(),
'ymNum': target.dataset?.ymNum,
'ymId': target.dataset?.ymId
};
// Дополнительные параметры из data-row
let additionalParams = {};
if (target.dataset.row) {
try {
additionalParams = JSON.parse(atob(target.dataset.row));
} catch (e) {
console.error('Error parsing dataset.row:', e);
}
}
// Объединяем параметры
const mergedQuery = {...additionalParams, ...baseQuery};
const queryString = new URLSearchParams(mergedQuery).toString();
// Вызываем рендер модального окна
wf_renderModal(
target.dataset.formName,
queryString,
target.dataset.wfId,
target.dataset.fbStyle,
target.dataset.wfStyle
);
} catch (error) {
console.error('Error in wf_listiner:', error);
}
}
// Инициализация слушателей событий
document.querySelectorAll(buttonClass).forEach(button => {
button.addEventListener('click', wf_listiner);
});
+16
View File
@@ -0,0 +1,16 @@
<?php $dataRow = base64_encode(json_encode([
"hidden[UF_CRM_1533790164]" => "Название услуги или ФИО врача", // если удалить, то будет отображаться поле в форме.
"fields[OPPORTUNITY]" => "990" // стоимость услуги, если не надо передавать, то удалить, либо 0
])); ?>
<!--
data-wf-style = стили фрейма
data-fb-style = стили fancyBox
data-form-name-fancy-box = id модального окна, одноименный с класом кнопки которую будет прослушивать скрипт (указывать без # .)
data-wf-id = id формы в ЛК если не известно, не менять!
-->
<button class="btn btn-primary wf_callback-form" data-form-name="Записаться на прием" data-row="<?= $dataRow ?>" data-wf-id="1" data-wf-style="border: 0px; width: 100%; height: 460px; overflow: auto;" data-fb-style="height:700px">Форма записаться</button>
<script id="wf-cabinet" src="https://cabinet.sovamed.ru/widgets/wf_cabinet.min.js" data-form-name-fancy-box="wf_callback-form" defer></script>
+1
View File
@@ -0,0 +1 @@
console.log("wf form load");const currentScript=document.currentScript,formNameFancyBox=currentScript.dataset.formNameFancyBox,buttonClass=currentScript.dataset.buttonClass||".wf-button",CABINET_HOST="wmtmed.ru"===location.host?"https://cabinet.wmtmed.ru":"https://cabinet.sovamed.ru";function wf_renderModal(e,t,n,o,a){const r=document.getElementById(formNameFancyBox);r&&r.remove();const s=document.createElement("div");s.id=formNameFancyBox,s.className="fancybox-content",s.style.cssText=o||"",s.style.display="none",document.body.appendChild(s);const c=document.createElement("div");c.className="modal-dialog",c.setAttribute("role","document"),s.appendChild(c);const d=document.createElement("div");d.className="modal-content",c.appendChild(d);const l=document.createElement("div");l.className="modal-header",d.appendChild(l);const m=document.createElement("h5");m.className="modal-title",m.textContent=e,l.appendChild(m);const i=document.createElement("div");i.id="wf_popup-body",i.className="modal-body",d.appendChild(i);const u=document.createElement("iframe");return u.id=`${formNameFancyBox}-frame`,u.src=`${CABINET_HOST}/widget/form/${n}?${t}`,u.style.cssText=a||"",i.appendChild(u),!0}function getSessionId(){try{const e=window.ct?.("calltracking_params");return Array.isArray(e)&&e.length>0?(console.error("getting sessionId:",e[0]?.sessionId),e[0]?.sessionId||null):null}catch(e){return console.error("Error getting sessionId:",e),null}}function wf_listiner(e){try{const t=e.target;if(!t.dataset)return;const n={ref:btoa(location.origin),sessionId:getSessionId(),ymNum:t.dataset?.ymNum,ymId:t.dataset?.ymId};let o={};if(t.dataset.row)try{o=JSON.parse(atob(t.dataset.row))}catch(e){console.error("Error parsing dataset.row:",e)}const a={...o,...n},r=new URLSearchParams(a).toString();wf_renderModal(t.dataset.formName,r,t.dataset.wfId,t.dataset.fbStyle,t.dataset.wfStyle)}catch(e){console.error("Error in wf_listiner:",e)}}document.querySelectorAll(buttonClass).forEach((e=>{e.addEventListener("click",wf_listiner)}));