ماتریس
/* ==============================
بنر پیشفرض بدون تصویر
============================== */
.detail-panel-fallback-banner {
width: 100%;
height: 140px;
border-radius: 16px 16px 0 0;
background: linear-gradient(
135deg,
#0f172a 0%,
#1e1b4b 50%,
#431407 100%
);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8px;
border-bottom: 1px solid #7c3312;
position: relative;
overflow: hidden;
}
.detail-panel-fallback-banner svg {
color: #f97316;
background: rgba(249, 115, 22, 0.12);
padding: 8px;
border-radius: 10px;
border: 1px solid #7c3312;
}
.detail-panel-fallback-banner span {
font-size: 13px;
font-weight: 700;
color: #f1f5f9;
}
/* ==============================
دکمه مشاهده اطلاعات بیشتر
============================== */
.pegah-more-info-btn {
display: inline-flex !important;
align-items: center;
justify-content: center;
gap: 8px;
min-height: 42px;
padding: 0 17px;
border-radius: 10px;
border: 1px solid #0f766e;
background: #ffffff;
color: #0f766e;
font-family: inherit;
font-size: 13px;
font-weight: 700;
text-decoration: none !important;
cursor: pointer;
transition: all 0.2s ease;
box-sizing: border-box;
}
.pegah-more-info-btn:hover {
background: #0f766e;
color: #ffffff;
transform: translateY(-1px);
box-shadow: 0 5px 14px rgba(15, 118, 110, 0.2);
}
.pegah-more-info-btn svg {
width: 17px;
height: 17px;
flex-shrink: 0;
}
/* ==============================
وضعیت نبودن لینک
============================== */
.pegah-more-info-btn.no-link {
opacity: 0.5;
cursor: default;
}
/* ==============================
کانتینر دکمهها
============================== */
.pegah-demo-actions {
display: flex !important;
align-items: center !important;
gap: 10px !important;
flex-wrap: wrap !important;
}
/* ==============================
تصویر اختصاصی زیرسیستم
============================== */
.pegah-subsystem-image {
width: 100% !important;
height: auto !important;
object-fit: cover !important;
display: block !important;
}
@media (max-width: 640px) {
.pegah-demo-actions {
flex-direction: column !important;
width: 100% !important;
}
.pegah-demo-actions > * {
width: 100% !important;
}
.pegah-more-info-btn {
width: 100% !important;
}
}
(function () {
"use strict";
/* =========================================================
تنظیمات اصلی
فقط این دو قسمت را تغییر بده.
========================================================= */
const basePath =
"https://pegahsystem.com/wp-content/uploads/erp-matrix/";
/* =========================================================
1. عکس هر زیرسیستم
مثال:
"حسابداری": "accounting.png"
یعنی فایل:
https://pegahsystem.com/wp-content/uploads/erp-matrix/accounting.png
========================================================= */
const subsystemImages = {
"حسابداری":
"accounting.png",
"خزانه داری":
"treasury.png",
"خزانهداری":
"treasury.png",
"منابع انسانی":
"hr.png",
"انبار":
"inventory.png",
"خرید داخلی":
"domestic-purchase.png",
"خرید خارجی":
"foreign-purchase.png",
"فروش":
"sales.png",
"تولید":
"production.png",
"اموال و دارایی ثابت":
"assets.png",
"مدیریت کیفیت":
"quality.png",
"مدیریت پروژه":
"project.png",
"گزارش ساز":
"report-builder.png",
"کارتابل متمرکز":
"workflow.png",
"مدیریت پیام":
"messages.png",
"نقشه":
"map.png",
"چت سازمانی":
"chat.png",
"اتوماسیون اداری":
"automation.png"
};
/* =========================================================
2. لینک فرم اختصاصی هر زیرسیستم
این لینک با کلیک روی:
«مشاهده اطلاعات بیشتر»
باز میشود.
========================================================= */
const subsystemLinks = {
"حسابداری":
https://pegahsystem.com/solutions/%D9%86%D8%B1%D9%85-%D8%A7%D9%81%D8%B2%D8%A7%D8%B1-%D8%AC%D8%B0%D8%A8-%D9%88-%D8%A7%D8%B3%D8%AA%D8%AE%D8%AF%D8%A7%D9%85/
"خزانه داری":
"https://example.com/treasury",
"خزانهداری":
"https://example.com/treasury",
"منابع انسانی":
"https://example.com/hr",
"انبار":
"https://example.com/inventory",
"خرید داخلی":
"https://example.com/domestic-purchase",
"خرید خارجی":
"https://example.com/foreign-purchase",
"فروش":
"https://example.com/sales",
"تولید":
"https://example.com/production",
"اموال و دارایی ثابت":
"https://example.com/assets",
"مدیریت کیفیت":
"https://example.com/quality",
"مدیریت پروژه":
"https://example.com/project",
"گزارش ساز":
"https://example.com/report-builder",
"کارتابل متمرکز":
"https://example.com/workflow",
"مدیریت پیام":
"https://example.com/messages",
"نقشه":
"https://example.com/map",
"چت سازمانی":
"https://example.com/chat",
"اتوماسیون اداری":
"https://example.com/automation"
};
/* =========================================================
توابع کمکی
========================================================= */
function normalizeText(text) {
if (!text) {
return "";
}
return String(text)
.replace(/ي/g, "ی")
.replace(/ى/g, "ی")
.replace(/ك/g, "ک")
.replace(/\u200c/g, " ")
.replace(/\u200f/g, "")
.replace(/\u200e/g, "")
.replace(/\s+/g, " ")
.trim();
}
function getKeyByName(name) {
const normalized =
normalizeText(name);
const keys =
Object.keys(subsystemImages);
for (let i = 0; i < keys.length; i++) {
if (
normalizeText(keys[i]) === normalized
) {
return keys[i];
}
}
return null;
}
/* =========================================================
پیدا کردن نام زیرسیستم فعال
========================================================= */
function detectActiveSubsystem() {
const possiblePanels = [
".detail-panel",
".detail-panel-content",
"[data-subsystem]",
"[data-module]",
"[data-system]",
/* پنلهای رایج پروژه */
"aside",
'[role="dialog"]'
];
/*
ابتدا عناصر دارای data attribute را بررسی میکنیم.
*/
for (
let i = 0;
i < possiblePanels.length;
i++
) {
const elements =
document.querySelectorAll(
possiblePanels[i]
);
for (
let j = 0;
j < elements.length;
j++
) {
const element =
elements[j];
if (!isVisible(element)) {
continue;
}
const directName =
element.getAttribute(
"data-subsystem"
) ||
element.getAttribute(
"data-module"
) ||
element.getAttribute(
"data-system"
);
if (directName) {
const key =
getKeyByName(directName);
if (key) {
return key;
}
}
}
}
/*
اگر data attribute وجود نداشت،
متن پنل را بررسی میکنیم.
*/
const allKeys =
Object.keys(subsystemImages);
const candidates = [];
for (
let i = 0;
i < possiblePanels.length;
i++
) {
const elements =
document.querySelectorAll(
possiblePanels[i]
);
for (
let j = 0;
j < elements.length;
j++
) {
const element =
elements[j];
if (!isVisible(element)) {
continue;
}
const text =
normalizeText(
element.innerText
);
if (!text) {
continue;
}
for (
let k = 0;
k 0 &&
rect.height > 0
);
}
/* =========================================================
ساخت URL تصویر
========================================================= */
function getImageUrl(subsystemName) {
const key =
getKeyByName(subsystemName);
if (!key) {
return null;
}
const file =
subsystemImages[key];
if (!file) {
return null;
}
/*
اگر URL کامل داده شده باشد،
همان را استفاده میکنیم.
*/
if (
file.startsWith("http://") ||
file.startsWith("https://")
) {
return file;
}
return basePath + file;
}
/* =========================================================
ساخت URL فرم
========================================================= */
function getSubsystemLink(subsystemName) {
const key =
getKeyByName(subsystemName);
if (!key) {
return null;
}
return (
subsystemLinks[key] || null
);
}
/* =========================================================
جایگذاری عکس اختصاصی
========================================================= */
function applySubsystemImage() {
const subsystem =
detectActiveSubsystem();
if (!subsystem) {
return;
}
const imageUrl =
getImageUrl(subsystem);
if (!imageUrl) {
return;
}
/*
عکسهای داخل پنل جزئیات را پیدا میکنیم.
*/
const images =
document.querySelectorAll(
"#root img"
);
images.forEach(function (img) {
if (!isVisible(img)) {
return;
}
/*
فقط تصاویر نسبتاً بزرگ را تغییر میدهیم
تا آیکونها و تصاویر کوچک UI خراب نشوند.
*/
const rect =
img.getBoundingClientRect();
if (
rect.width < 100 ||
rect.height < 60
) {
return;
}
/*
اگر قبلاً برای همین زیرسیستم
تنظیم شده، دوباره کاری نکن.
*/
if (
img.dataset.pegahSubsystem ===
subsystem
) {
return;
}
img.dataset.pegahSubsystem =
subsystem;
img.dataset.originalSrc =
img.getAttribute("src") || "";
img.classList.add(
"pegah-subsystem-image"
);
img.src =
imageUrl;
img.onerror =
function () {
/*
اگر عکس اختصاصی پیدا نشد،
تصویر قبلی React را برمیگردانیم.
*/
if (
img.dataset.originalSrc
) {
img.src =
img.dataset.originalSrc;
}
};
});
}
/* =========================================================
ساخت دکمه مشاهده اطلاعات بیشتر
========================================================= */
function createMoreInfoButton(
subsystemName
) {
const link =
getSubsystemLink(
subsystemName
);
const button =
document.createElement("a");
button.className =
"pegah-more-info-btn";
button.innerHTML = `
مشاهده اطلاعات بیشتر
`;
/*
اگر لینک وجود داشته باشد.
*/
if (link) {
button.href = link;
button.target = "_blank";
button.rel =
"noopener noreferrer";
}
else {
button.href = "#";
button.classList.add(
"no-link"
);
button.addEventListener(
"click",
function (e) {
e.preventDefault();
console.warn(
"لینک برای زیرسیستم «" +
subsystemName +
"» تعریف نشده است."
);
}
);
}
return button;
}
/* =========================================================
اضافه کردن دکمه کنار درخواست دمو
========================================================= */
function addMoreInfoButton() {
const subsystem =
detectActiveSubsystem();
if (!subsystem) {
return;
}
const demoButtons =
document.querySelectorAll(
"button, a"
);
demoButtons.forEach(
function (demoButton) {
const text =
normalizeText(
demoButton.textContent
);
if (
!text.includes(
"درخواست دمو"
)
) {
return;
}
/*
اگر قبلاً دکمه اضافه شده،
دوباره ایجاد نکن.
*/
const parent =
demoButton.parentElement;
if (!parent) {
return;
}
if (
parent.querySelector(
".pegah-more-info-btn"
)
) {
return;
}
/*
کانتینر دکمهها
*/
parent.classList.add(
"pegah-demo-actions"
);
/*
ساخت دکمه
*/
const moreInfoButton =
createMoreInfoButton(
subsystem
);
/*
کنار درخواست دمو قرار میگیرد.
*/
parent.appendChild(
moreInfoButton
);
}
);
}
/* =========================================================
حذف دکمه قبلی هنگام تغییر زیرسیستم
========================================================= */
function refreshButtons() {
const currentSubsystem =
detectActiveSubsystem();
if (!currentSubsystem) {
return;
}
document
.querySelectorAll(
".pegah-more-info-btn"
)
.forEach(function (button) {
const parent =
button.parentElement;
if (!parent) {
return;
}
/*
اگر دکمه مربوط به زیرسیستم قبلی است،
حذف میشود تا لینک اشتباه باقی نماند.
*/
button.remove();
});
addMoreInfoButton();
}
/* =========================================================
اصلاح تصاویر قبلی پروژه
========================================================= */
function fixOriginalImages() {
const imgs =
document.querySelectorAll(
'img[src*="image-1"], img[src*="image-2"]'
);
imgs.forEach(function (img) {
const src =
img.getAttribute("src") || "";
if (
src.includes("image-1") &&
!img.src.startsWith(basePath)
) {
img.src =
basePath +
"image-1-BcPAJ-Ub.png";
}
if (
src.includes("image-2") &&
!img.src.startsWith(basePath)
) {
img.src =
basePath +
"image-2-BkHYiEQL.png";
}
img.onerror =
function () {
const albumContainer =
img.closest(
'div[style*="cursor: zoom-in"]'
);
if (
albumContainer &&
!albumContainer.classList.contains(
"fallback-applied"
)
) {
albumContainer.classList.add(
"fallback-applied"
);
albumContainer.style.cursor =
"default";
albumContainer.innerHTML = `
اطلاعات تکمیلی ماژول
`;
const thumbsRow =
albumContainer.nextElementSibling;
if (
thumbsRow &&
thumbsRow.style.display ===
"flex"
) {
thumbsRow.style.display =
"none";
}
}
};
});
}
/* =========================================================
مدیریت مودال درخواست دمو
========================================================= */
document.addEventListener(
"click",
function (e) {
const demoBtn =
e.target.closest(
".open-demo-modal"
) ||
(
e.target.closest("button") &&
normalizeText(
e.target
.closest("button")
.textContent
).includes(
"درخواست دمو"
)
);
/*
اگر کلیک روی مشاهده اطلاعات بیشتر بود،
اجازه بده لینک خودش کار کند.
*/
if (
e.target.closest(
".pegah-more-info-btn"
)
) {
return;
}
if (demoBtn) {
e.preventDefault();
e.stopPropagation();
const modalOverlay =
document.getElementById(
"hrDemoModalOverlay"
) ||
document.querySelector(
".hr-modal-overlay"
) ||
document.querySelector(
'[data-modal="demo"]'
);
if (modalOverlay) {
modalOverlay.classList.add(
"is-active"
);
modalOverlay.style.display =
"flex";
modalOverlay.style.opacity =
"1";
modalOverlay.style.visibility =
"visible";
}
else {
console.warn(
"کانتینر مودال پیدا نشد. " +
"مطمئن شوید شورتکد hr_demo_modal " +
"در صفحه قرار دارد."
);
}
}
},
true
);
/* =========================================================
اجرای اولیه
========================================================= */
function runAll() {
fixOriginalImages();
applySubsystemImage();
addMoreInfoButton();
}
/*
React بعد از بارگذاری اولیه
اطلاعات را ایجاد میکند.
*/
setTimeout(
runAll,
500
);
setTimeout(
runAll,
1200
);
setTimeout(
runAll,
2500
);
setTimeout(
runAll,
4000
);
/* =========================================================
MutationObserver
هر بار React چیزی را تغییر داد،
سیستم دوباره بررسی میشود.
========================================================= */
let refreshTimer = null;
const observer =
new MutationObserver(
function () {
clearTimeout(
refreshTimer
);
refreshTimer =
setTimeout(
function () {
fixOriginalImages();
applySubsystemImage();
/*
فقط زمانی دکمه را اضافه میکنیم
که وجود نداشته باشد.
*/
addMoreInfoButton();
},
150
);
}
);
observer.observe(
document.body,
{
childList: true,
subtree: true
}
);
})();