694 lines
35 KiB
PHP
694 lines
35 KiB
PHP
<?php
|
|
/**
|
|
* بلوکهای طراحی غنی صفحات ماژول — آمار، طیف کسبوکار، نمودار، فلو
|
|
*
|
|
* @package Hesabix2
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
/**
|
|
* @param string $key
|
|
* @param array<string, mixed> $def
|
|
*/
|
|
function hesabix2_module_render_rich_sections($key, array $def) {
|
|
if (empty($def['rich']) || !is_array($def['rich'])) {
|
|
return;
|
|
}
|
|
$rich = $def['rich'];
|
|
$wrap = 'hx-module__wrap';
|
|
$compose = !empty($rich['compose']) && is_array($rich['compose'])
|
|
? $rich['compose']
|
|
: array('stats', 'messenger', 'spectrum', 'capabilities', 'problems', 'groups', 'audiences', 'flow', 'chart', 'channels', 'compare', 'journey');
|
|
|
|
foreach ($compose as $block) {
|
|
switch ((string) $block) {
|
|
case 'stats':
|
|
if (!empty($rich['stats']) && is_array($rich['stats'])) {
|
|
hesabix2_rich_render_stats($rich['stats'], $wrap);
|
|
}
|
|
break;
|
|
case 'messenger':
|
|
if (!empty($rich['messenger']) && is_array($rich['messenger'])) {
|
|
hesabix2_rich_render_messenger($rich['messenger'], $wrap);
|
|
}
|
|
break;
|
|
case 'spectrum':
|
|
if (!empty($rich['spectrum']) && is_array($rich['spectrum'])) {
|
|
hesabix2_rich_render_spectrum($rich['spectrum'], $wrap, $rich['spectrum_title'] ?? '');
|
|
}
|
|
break;
|
|
case 'capabilities':
|
|
if (!empty($rich['capabilities']) && is_array($rich['capabilities'])) {
|
|
hesabix2_rich_render_capabilities($rich['capabilities'], $wrap, $rich['capabilities_title'] ?? '', $rich['capabilities_lead'] ?? '');
|
|
}
|
|
break;
|
|
case 'problems':
|
|
if (!empty($rich['problems']) && is_array($rich['problems'])) {
|
|
hesabix2_rich_render_problems($rich['problems'], $wrap, $rich['problems_title'] ?? '');
|
|
}
|
|
break;
|
|
case 'groups':
|
|
if (!empty($rich['groups']) && is_array($rich['groups'])) {
|
|
hesabix2_rich_render_groups($rich['groups'], $wrap, $rich['groups_title'] ?? '');
|
|
}
|
|
break;
|
|
case 'audiences':
|
|
if (!empty($rich['audiences']) && is_array($rich['audiences'])) {
|
|
hesabix2_rich_render_audiences($rich['audiences'], $wrap, $rich['audiences_title'] ?? '');
|
|
}
|
|
break;
|
|
case 'flow':
|
|
if (!empty($rich['flow']) && is_array($rich['flow'])) {
|
|
hesabix2_rich_render_flow($rich['flow'], $wrap, $rich['flow_title'] ?? '');
|
|
}
|
|
break;
|
|
case 'chart':
|
|
if (!empty($rich['chart']) && is_array($rich['chart'])) {
|
|
hesabix2_rich_render_chart($rich['chart'], $wrap);
|
|
}
|
|
break;
|
|
case 'channels':
|
|
if (!empty($rich['channels']) && is_array($rich['channels'])) {
|
|
hesabix2_rich_render_channels($rich['channels'], $wrap, $rich['channels_title'] ?? '');
|
|
}
|
|
break;
|
|
case 'compare':
|
|
if (!empty($rich['compare']) && is_array($rich['compare'])) {
|
|
hesabix2_rich_render_compare($rich['compare'], $wrap);
|
|
}
|
|
break;
|
|
case 'journey':
|
|
if (!empty($rich['journey']) && is_array($rich['journey'])) {
|
|
hesabix2_rich_render_journey($rich['journey'], $wrap, $rich['journey_title'] ?? '');
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* بلوک بله و تلگرام — نزدیکی به کاربر بدون ورود به پنل
|
|
*
|
|
* @param array<string, mixed> $data
|
|
*/
|
|
function hesabix2_rich_render_messenger(array $data, $wrap) {
|
|
$apps = !empty($data['apps']) && is_array($data['apps']) ? $data['apps'] : array();
|
|
if (empty($apps)) {
|
|
return;
|
|
}
|
|
?>
|
|
<section class="hx-rich-messenger" aria-labelledby="hx-messenger-title">
|
|
<div class="<?php echo esc_attr($wrap); ?>">
|
|
<div class="hx-rich-messenger__layout">
|
|
<div class="hx-rich-messenger__copy hx-reveal">
|
|
<?php if (!empty($data['eyebrow'])) : ?>
|
|
<span class="hx-rich-head__eyebrow"><?php echo esc_html($data['eyebrow']); ?></span>
|
|
<?php endif; ?>
|
|
<h2 id="hx-messenger-title" class="hx-rich-messenger__title">
|
|
<?php echo esc_html($data['title'] ?? __('همیشه نزدیک مشتری و تیم', 'hesabix2')); ?>
|
|
</h2>
|
|
<?php if (!empty($data['lead'])) : ?>
|
|
<p class="hx-rich-messenger__lead"><?php echo esc_html($data['lead']); ?></p>
|
|
<?php endif; ?>
|
|
<?php if (!empty($data['bullets']) && is_array($data['bullets'])) : ?>
|
|
<ul class="hx-rich-messenger__bullets">
|
|
<?php foreach ($data['bullets'] as $bullet) : ?>
|
|
<li><?php echo esc_html($bullet); ?></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="hx-rich-messenger__apps">
|
|
<?php foreach ($apps as $i => $app) :
|
|
$app_id = !empty($app['id']) ? sanitize_html_class((string) $app['id']) : 'app';
|
|
?>
|
|
<article class="hx-rich-messenger__app hx-rich-messenger__app--<?php echo esc_attr($app_id); ?> hx-reveal" style="--hx-delay: <?php echo (int) $i * 100; ?>ms">
|
|
<div class="hx-rich-messenger__app-head">
|
|
<span class="hx-rich-messenger__app-icon" aria-hidden="true"></span>
|
|
<span class="hx-rich-messenger__app-name"><?php echo esc_html($app['name'] ?? ''); ?></span>
|
|
</div>
|
|
<p class="hx-rich-messenger__app-text"><?php echo esc_html($app['text'] ?? ''); ?></p>
|
|
<?php if (!empty($app['samples']) && is_array($app['samples'])) : ?>
|
|
<div class="hx-rich-messenger__chat" role="presentation">
|
|
<?php foreach ($app['samples'] as $sample) : ?>
|
|
<div class="hx-rich-messenger__bubble hx-rich-messenger__bubble--<?php echo !empty($sample['out']) ? 'out' : 'in'; ?>">
|
|
<?php echo esc_html($sample['text'] ?? ''); ?>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<?php
|
|
}
|
|
|
|
/**
|
|
* @param array<int, array{value: string, label: string, suffix?: string}> $stats
|
|
*/
|
|
function hesabix2_rich_render_stats(array $stats, $wrap) {
|
|
?>
|
|
<section class="hx-rich-stats" aria-label="<?php esc_attr_e('آمار کلیدی', 'hesabix2'); ?>">
|
|
<div class="<?php echo esc_attr($wrap); ?>">
|
|
<div class="hx-rich-stats__grid">
|
|
<?php foreach ($stats as $i => $stat) : ?>
|
|
<div class="hx-rich-stats__item hx-reveal" style="--hx-delay: <?php echo (int) $i * 80; ?>ms">
|
|
<p class="hx-rich-stats__value">
|
|
<span class="hx-rich-counter" data-target="<?php echo esc_attr(preg_replace('/[^\d]/', '', (string) ($stat['value'] ?? '0'))); ?>"><?php echo esc_html($stat['value'] ?? ''); ?></span>
|
|
<?php if (!empty($stat['suffix'])) : ?>
|
|
<span class="hx-rich-stats__suffix"><?php echo esc_html($stat['suffix']); ?></span>
|
|
<?php endif; ?>
|
|
</p>
|
|
<p class="hx-rich-stats__label"><?php echo esc_html($stat['label'] ?? ''); ?></p>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<?php
|
|
}
|
|
|
|
/**
|
|
* @param array<int, array{title: string, text: string, tag?: string, tone?: string}> $items
|
|
*/
|
|
function hesabix2_rich_render_spectrum(array $items, $wrap, $title = '') {
|
|
?>
|
|
<section class="hx-rich-spectrum">
|
|
<div class="<?php echo esc_attr($wrap); ?>">
|
|
<?php if ($title) : ?>
|
|
<div class="hx-rich-head hx-reveal">
|
|
<span class="hx-rich-head__eyebrow"><?php esc_html_e('از کوچک تا بزرگ', 'hesabix2'); ?></span>
|
|
<h2 class="hx-rich-head__title"><?php echo esc_html($title); ?></h2>
|
|
<p class="hx-rich-head__lead"><?php esc_html_e('از مغازه و فروش آنلاین تا پخش، کارخانه، پتروشیمی و هلدینگ — یک هسته؛ مقیاس با افزونه.', 'hesabix2'); ?></p>
|
|
</div>
|
|
<?php endif; ?>
|
|
<div class="hx-rich-spectrum__grid">
|
|
<?php foreach ($items as $i => $item) :
|
|
$tone = !empty($item['tone']) ? sanitize_html_class((string) $item['tone']) : 'brand';
|
|
?>
|
|
<article class="hx-rich-card hx-rich-card--<?php echo esc_attr($tone); ?> hx-reveal" style="--hx-delay: <?php echo (int) $i * 60; ?>ms">
|
|
<?php if (!empty($item['tag'])) : ?>
|
|
<span class="hx-rich-card__tag"><?php echo esc_html($item['tag']); ?></span>
|
|
<?php endif; ?>
|
|
<h3 class="hx-rich-card__title"><?php echo esc_html($item['title'] ?? ''); ?></h3>
|
|
<p class="hx-rich-card__text"><?php echo esc_html($item['text'] ?? ''); ?></p>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<?php
|
|
}
|
|
|
|
/**
|
|
* @param array<int, array{title: string, text: string}> $steps
|
|
*/
|
|
function hesabix2_rich_render_flow(array $steps, $wrap, $title = '') {
|
|
?>
|
|
<section class="hx-rich-flow">
|
|
<div class="<?php echo esc_attr($wrap); ?>">
|
|
<?php if ($title) : ?>
|
|
<div class="hx-rich-head hx-rich-head--center hx-reveal">
|
|
<h2 class="hx-rich-head__title"><?php echo esc_html($title); ?></h2>
|
|
</div>
|
|
<?php endif; ?>
|
|
<div class="hx-rich-flow__track" role="list">
|
|
<?php foreach ($steps as $i => $step) : ?>
|
|
<div class="hx-rich-flow__step hx-reveal" role="listitem" style="--hx-delay: <?php echo (int) $i * 100; ?>ms">
|
|
<span class="hx-rich-flow__dot" aria-hidden="true"></span>
|
|
<div class="hx-rich-flow__body">
|
|
<h3 class="hx-rich-flow__title"><?php echo esc_html($step['title'] ?? ''); ?></h3>
|
|
<p class="hx-rich-flow__text"><?php echo esc_html($step['text'] ?? ''); ?></p>
|
|
</div>
|
|
</div>
|
|
<?php if ($i < count($steps) - 1) : ?>
|
|
<div class="hx-rich-flow__connector hx-reveal" aria-hidden="true" style="--hx-delay: <?php echo (int) $i * 100 + 50; ?>ms"></div>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<?php
|
|
}
|
|
|
|
/**
|
|
* @param array{title?: string, items: array<int, array{label: string, value: int, hint?: string}>} $chart
|
|
*/
|
|
function hesabix2_rich_render_chart(array $chart, $wrap) {
|
|
$items = $chart['items'] ?? array();
|
|
if (empty($items)) {
|
|
return;
|
|
}
|
|
$max = max(1, max(array_column($items, 'value')));
|
|
?>
|
|
<section class="hx-rich-chart">
|
|
<div class="<?php echo esc_attr($wrap); ?>">
|
|
<div class="hx-rich-head hx-reveal">
|
|
<?php if (!empty($chart['title'])) : ?>
|
|
<h2 class="hx-rich-head__title"><?php echo esc_html($chart['title']); ?></h2>
|
|
<?php endif; ?>
|
|
<?php if (!empty($chart['subtitle'])) : ?>
|
|
<p class="hx-rich-head__lead"><?php echo esc_html($chart['subtitle']); ?></p>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="hx-rich-chart__panel hx-reveal">
|
|
<?php foreach ($items as $i => $row) :
|
|
$pct = min(100, round(((int) $row['value'] / $max) * 100));
|
|
?>
|
|
<div class="hx-rich-chart__row">
|
|
<div class="hx-rich-chart__meta">
|
|
<span class="hx-rich-chart__label"><?php echo esc_html($row['label']); ?></span>
|
|
<?php if (!empty($row['hint'])) : ?>
|
|
<span class="hx-rich-chart__hint"><?php echo esc_html($row['hint']); ?></span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="hx-rich-chart__bar-wrap">
|
|
<div class="hx-rich-chart__bar" style="--hx-pct: <?php echo (int) $pct; ?>%; --hx-delay: <?php echo (int) $i * 120; ?>ms" role="progressbar" aria-valuemin="0" aria-valuemax="<?php echo (int) $max; ?>" aria-valuenow="<?php echo (int) $row['value']; ?>" aria-label="<?php echo esc_attr($row['label']); ?>"></div>
|
|
</div>
|
|
<span class="hx-rich-chart__value"><?php echo (int) $row['value']; ?>%</span>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<?php
|
|
}
|
|
|
|
/**
|
|
* @param array<int, array{title: string, text: string}> $channels
|
|
*/
|
|
function hesabix2_rich_render_channels(array $channels, $wrap, $title = '') {
|
|
?>
|
|
<section class="hx-rich-channels">
|
|
<div class="<?php echo esc_attr($wrap); ?>">
|
|
<?php if ($title) : ?>
|
|
<h2 class="hx-rich-channels__title hx-reveal"><?php echo esc_html($title); ?></h2>
|
|
<?php endif; ?>
|
|
<div class="hx-rich-channels__grid">
|
|
<?php foreach ($channels as $i => $ch) : ?>
|
|
<div class="hx-rich-channel hx-reveal" style="--hx-delay: <?php echo (int) $i * 70; ?>ms">
|
|
<h3 class="hx-rich-channel__title"><?php echo esc_html($ch['title'] ?? ''); ?></h3>
|
|
<p class="hx-rich-channel__text"><?php echo esc_html($ch['text'] ?? ''); ?></p>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<?php
|
|
}
|
|
|
|
/**
|
|
* @param array{before_title?: string, after_title?: string, rows: array<int, array{label: string, before: string, after: string}>} $compare
|
|
*/
|
|
function hesabix2_rich_render_compare(array $compare, $wrap) {
|
|
$rows = $compare['rows'] ?? array();
|
|
if (empty($rows)) {
|
|
return;
|
|
}
|
|
?>
|
|
<section class="hx-rich-compare">
|
|
<div class="<?php echo esc_attr($wrap); ?>">
|
|
<div class="hx-rich-head hx-rich-head--center hx-reveal">
|
|
<h2 class="hx-rich-head__title"><?php echo esc_html($compare['title'] ?? __('قبل و بعد از یکپارچگی', 'hesabix2')); ?></h2>
|
|
</div>
|
|
<div class="hx-rich-compare__table hx-reveal">
|
|
<div class="hx-rich-compare__head">
|
|
<span></span>
|
|
<span class="hx-rich-compare__col hx-rich-compare__col--before"><?php echo esc_html($compare['before_title'] ?? __('پراکنده', 'hesabix2')); ?></span>
|
|
<span class="hx-rich-compare__col hx-rich-compare__col--after"><?php echo esc_html($compare['after_title'] ?? __('با حسابیکس', 'hesabix2')); ?></span>
|
|
</div>
|
|
<?php foreach ($rows as $row) : ?>
|
|
<div class="hx-rich-compare__row">
|
|
<span class="hx-rich-compare__label"><?php echo esc_html($row['label'] ?? ''); ?></span>
|
|
<span class="hx-rich-compare__cell hx-rich-compare__cell--before"><?php echo esc_html($row['before'] ?? ($row['left'] ?? '')); ?></span>
|
|
<span class="hx-rich-compare__cell hx-rich-compare__cell--after"><?php echo esc_html($row['after'] ?? ($row['right'] ?? '')); ?></span>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<?php
|
|
}
|
|
|
|
/**
|
|
* @param array<int, array{title: string, text: string, icon?: string}> $steps
|
|
*/
|
|
function hesabix2_rich_render_journey(array $steps, $wrap, $title = '') {
|
|
?>
|
|
<section class="hx-rich-journey">
|
|
<div class="<?php echo esc_attr($wrap); ?>">
|
|
<?php if ($title) : ?>
|
|
<div class="hx-rich-head hx-reveal">
|
|
<h2 class="hx-rich-head__title"><?php echo esc_html($title); ?></h2>
|
|
</div>
|
|
<?php endif; ?>
|
|
<div class="hx-rich-journey__grid">
|
|
<?php foreach ($steps as $i => $step) : ?>
|
|
<div class="hx-rich-journey__card hx-reveal" style="--hx-delay: <?php echo (int) $i * 90; ?>ms">
|
|
<span class="hx-rich-journey__num"><?php echo (int) ($i + 1); ?></span>
|
|
<h3 class="hx-rich-journey__title"><?php echo esc_html($step['title'] ?? ''); ?></h3>
|
|
<p class="hx-rich-journey__text"><?php echo esc_html($step['text'] ?? ''); ?></p>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<?php
|
|
}
|
|
|
|
/**
|
|
* @param array<int, array{title: string, text: string}> $items
|
|
*/
|
|
function hesabix2_rich_render_capabilities(array $items, $wrap, $title = '', $lead = '') {
|
|
if (empty($items)) {
|
|
return;
|
|
}
|
|
?>
|
|
<section class="hx-rich-caps">
|
|
<div class="<?php echo esc_attr($wrap); ?>">
|
|
<div class="hx-rich-head hx-reveal">
|
|
<?php if ($title) : ?>
|
|
<h2 class="hx-rich-head__title"><?php echo esc_html($title); ?></h2>
|
|
<?php endif; ?>
|
|
<?php if ($lead) : ?>
|
|
<p class="hx-rich-head__lead"><?php echo esc_html($lead); ?></p>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="hx-rich-caps__grid">
|
|
<?php foreach ($items as $i => $item) : ?>
|
|
<article class="hx-rich-caps__card hx-reveal" style="--hx-delay: <?php echo (int) $i * 70; ?>ms">
|
|
<span class="hx-rich-caps__num"><?php echo esc_html(str_pad((string) ($i + 1), 2, '0', STR_PAD_LEFT)); ?></span>
|
|
<h3 class="hx-rich-caps__title"><?php echo esc_html($item['title'] ?? ''); ?></h3>
|
|
<p class="hx-rich-caps__text"><?php echo esc_html($item['text'] ?? ''); ?></p>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<?php
|
|
}
|
|
|
|
/**
|
|
* @param array<int, array{title: string, text: string, fix?: string}> $items
|
|
*/
|
|
function hesabix2_rich_render_problems(array $items, $wrap, $title = '') {
|
|
if (empty($items)) {
|
|
return;
|
|
}
|
|
?>
|
|
<section class="hx-rich-problems">
|
|
<div class="<?php echo esc_attr($wrap); ?>">
|
|
<?php if ($title) : ?>
|
|
<div class="hx-rich-head hx-reveal">
|
|
<h2 class="hx-rich-head__title"><?php echo esc_html($title); ?></h2>
|
|
</div>
|
|
<?php endif; ?>
|
|
<div class="hx-rich-problems__grid">
|
|
<?php foreach ($items as $i => $item) : ?>
|
|
<article class="hx-rich-problems__card hx-reveal" style="--hx-delay: <?php echo (int) $i * 80; ?>ms">
|
|
<p class="hx-rich-problems__q"><?php echo esc_html($item['title'] ?? ''); ?></p>
|
|
<p class="hx-rich-problems__a"><?php echo esc_html($item['text'] ?? ''); ?></p>
|
|
<?php if (!empty($item['fix'])) : ?>
|
|
<p class="hx-rich-problems__fix"><?php echo esc_html($item['fix']); ?></p>
|
|
<?php endif; ?>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<?php
|
|
}
|
|
|
|
/**
|
|
* @param array<int, array{title: string, items: array<int, string>}> $groups
|
|
*/
|
|
function hesabix2_rich_render_groups(array $groups, $wrap, $title = '') {
|
|
if (empty($groups)) {
|
|
return;
|
|
}
|
|
?>
|
|
<section class="hx-rich-groups">
|
|
<div class="<?php echo esc_attr($wrap); ?>">
|
|
<?php if ($title) : ?>
|
|
<div class="hx-rich-head hx-reveal">
|
|
<h2 class="hx-rich-head__title"><?php echo esc_html($title); ?></h2>
|
|
</div>
|
|
<?php endif; ?>
|
|
<div class="hx-rich-groups__grid">
|
|
<?php foreach ($groups as $i => $group) : ?>
|
|
<article class="hx-rich-groups__col hx-reveal" style="--hx-delay: <?php echo (int) $i * 70; ?>ms">
|
|
<h3 class="hx-rich-groups__title"><?php echo esc_html($group['title'] ?? ''); ?></h3>
|
|
<?php if (!empty($group['items']) && is_array($group['items'])) : ?>
|
|
<ul class="hx-rich-groups__list">
|
|
<?php foreach ($group['items'] as $row) : ?>
|
|
<li><?php echo esc_html($row); ?></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
<?php endif; ?>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<?php
|
|
}
|
|
|
|
/**
|
|
* @param array<int, array{title: string, text: string}> $items
|
|
*/
|
|
function hesabix2_rich_render_audiences(array $items, $wrap, $title = '') {
|
|
if (empty($items)) {
|
|
return;
|
|
}
|
|
?>
|
|
<section class="hx-rich-audiences">
|
|
<div class="<?php echo esc_attr($wrap); ?>">
|
|
<?php if ($title) : ?>
|
|
<div class="hx-rich-head hx-reveal">
|
|
<h2 class="hx-rich-head__title"><?php echo esc_html($title); ?></h2>
|
|
</div>
|
|
<?php endif; ?>
|
|
<div class="hx-rich-audiences__grid">
|
|
<?php foreach ($items as $i => $item) : ?>
|
|
<article class="hx-rich-audiences__card hx-reveal" style="--hx-delay: <?php echo (int) $i * 70; ?>ms">
|
|
<h3 class="hx-rich-audiences__title"><?php echo esc_html($item['title'] ?? ''); ?></h3>
|
|
<p class="hx-rich-audiences__text"><?php echo esc_html($item['text'] ?? ''); ?></p>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<?php
|
|
}
|
|
|
|
/**
|
|
* نمای اختصاصی هیرو برای هر بخش
|
|
*
|
|
* @param array<string, mixed> $def
|
|
*/
|
|
function hesabix2_module_render_hero_visual(array $def) {
|
|
$visual = isset($def['hero_visual']) ? sanitize_html_class((string) $def['hero_visual']) : 'panel';
|
|
if ('' === $visual) {
|
|
$visual = 'panel';
|
|
}
|
|
$panel_title = !empty($def['hero_panel_title']) ? (string) $def['hero_panel_title'] : __('نمای عملیاتی', 'hesabix2');
|
|
$rows = array();
|
|
if (!empty($def['hero_rows']) && is_array($def['hero_rows'])) {
|
|
$rows = array_values($def['hero_rows']);
|
|
} elseif (!empty($def['features']) && is_array($def['features'])) {
|
|
$rows = array_slice(array_values($def['features']), 0, 4);
|
|
}
|
|
$metrics = array();
|
|
if (!empty($def['rich']['stats']) && is_array($def['rich']['stats'])) {
|
|
$metrics = array_slice(array_values($def['rich']['stats']), 0, 2);
|
|
}
|
|
?>
|
|
<div class="hx-module-hero__visual hx-hv hx-hv--<?php echo esc_attr($visual); ?>" aria-hidden="true">
|
|
<?php if ('ledger' === $visual) : ?>
|
|
<div class="hx-hv-card hx-hv-ledger">
|
|
<div class="hx-hv-card__head"><span><?php echo esc_html($panel_title); ?></span></div>
|
|
<table>
|
|
<thead><tr><th><?php esc_html_e('حساب', 'hesabix2'); ?></th><th><?php esc_html_e('بدهکار', 'hesabix2'); ?></th><th><?php esc_html_e('بستانکار', 'hesabix2'); ?></th></tr></thead>
|
|
<tbody>
|
|
<tr><td><?php esc_html_e('فروش کالا', 'hesabix2'); ?></td><td>—</td><td>۱۲٬۴۸۰</td></tr>
|
|
<tr><td><?php esc_html_e('موجودی کالا', 'hesabix2'); ?></td><td>۸٬۲۱۰</td><td>—</td></tr>
|
|
<tr><td><?php esc_html_e('حسابهای دریافتنی', 'hesabix2'); ?></td><td>۳٬۹۴۰</td><td>—</td></tr>
|
|
<tr><td><?php esc_html_e('بانک ملت', 'hesabix2'); ?></td><td>۶٬۱۲۰</td><td>—</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php elseif ('cash' === $visual) : ?>
|
|
<div class="hx-hv-card hx-hv-cash">
|
|
<div class="hx-hv-card__head"><span><?php echo esc_html($panel_title); ?></span></div>
|
|
<div class="hx-hv-cash__bars">
|
|
<span style="--hx-h:72%"><i><?php esc_html_e('صندوق', 'hesabix2'); ?></i></span>
|
|
<span style="--hx-h:54%"><i><?php esc_html_e('بانک', 'hesabix2'); ?></i></span>
|
|
<span style="--hx-h:38%"><i><?php esc_html_e('چک', 'hesabix2'); ?></i></span>
|
|
<span style="--hx-h:86%"><i><?php esc_html_e('وصول', 'hesabix2'); ?></i></span>
|
|
</div>
|
|
</div>
|
|
<?php elseif ('people' === $visual) : ?>
|
|
<div class="hx-hv-card hx-hv-people">
|
|
<div class="hx-hv-card__head"><span><?php echo esc_html($panel_title); ?></span></div>
|
|
<ul>
|
|
<li><b><?php esc_html_e('حکم تا سند', 'hesabix2'); ?></b><span><?php esc_html_e('کارگزینی → کارکرد → حقوق → دفتر', 'hesabix2'); ?></span></li>
|
|
<li><b><?php esc_html_e('خروجی قانونی', 'hesabix2'); ?></b><span><?php esc_html_e('بیمه، مالیات، فایل بانک', 'hesabix2'); ?></span></li>
|
|
<li><b><?php esc_html_e('معوقات و عیدی', 'hesabix2'); ?></b><span><?php esc_html_e('جدا از حقوق جاری', 'hesabix2'); ?></span></li>
|
|
</ul>
|
|
</div>
|
|
<?php elseif ('machine' === $visual) : ?>
|
|
<div class="hx-hv-card hx-hv-machine">
|
|
<div class="hx-hv-card__head"><span><?php echo esc_html($panel_title); ?></span></div>
|
|
<div class="hx-hv-machine__grid">
|
|
<span><?php esc_html_e('پلاک', 'hesabix2'); ?></span>
|
|
<span><?php esc_html_e('استهلاک', 'hesabix2'); ?></span>
|
|
<span><?php esc_html_e('انتقال', 'hesabix2'); ?></span>
|
|
<span><?php esc_html_e('اسقاط', 'hesabix2'); ?></span>
|
|
</div>
|
|
</div>
|
|
<?php elseif ('bom' === $visual) : ?>
|
|
<div class="hx-hv-card hx-hv-bom">
|
|
<div class="hx-hv-card__head"><span><?php echo esc_html($panel_title); ?></span></div>
|
|
<div class="hx-hv-bom__tree">
|
|
<strong><?php esc_html_e('محصول نهایی', 'hesabix2'); ?></strong>
|
|
<div>
|
|
<span><?php esc_html_e('مواد اولیه', 'hesabix2'); ?></span>
|
|
<span><?php esc_html_e('نیمهساخته', 'hesabix2'); ?></span>
|
|
<span><?php esc_html_e('ضایعات', 'hesabix2'); ?></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php elseif ('routes' === $visual) : ?>
|
|
<div class="hx-hv-card hx-hv-routes">
|
|
<div class="hx-hv-card__head"><span><?php echo esc_html($panel_title); ?></span></div>
|
|
<div class="hx-hv-routes__map">
|
|
<i></i><i></i><i></i><i></i>
|
|
<span><?php esc_html_e('ویزیت', 'hesabix2'); ?></span>
|
|
<span><?php esc_html_e('سفارش', 'hesabix2'); ?></span>
|
|
<span><?php esc_html_e('تحویل', 'hesabix2'); ?></span>
|
|
<span><?php esc_html_e('وصول', 'hesabix2'); ?></span>
|
|
</div>
|
|
</div>
|
|
<?php elseif ('shield' === $visual) : ?>
|
|
<div class="hx-hv-card hx-hv-shield">
|
|
<div class="hx-hv-card__head"><span><?php echo esc_html($panel_title); ?></span></div>
|
|
<div class="hx-hv-shield__badge"><?php esc_html_e('گارانتی فعال', 'hesabix2'); ?></div>
|
|
<p><?php esc_html_e('سریال → دوره پوشش → ادعای خدمات → قطعه', 'hesabix2'); ?></p>
|
|
</div>
|
|
<?php elseif ('kanban' === $visual) : ?>
|
|
<div class="hx-hv-card hx-hv-kanban">
|
|
<div class="hx-hv-card__head"><span><?php echo esc_html($panel_title); ?></span></div>
|
|
<div class="hx-hv-kanban__cols">
|
|
<div><b><?php esc_html_e('پذیرش', 'hesabix2'); ?></b><i></i><i></i></div>
|
|
<div><b><?php esc_html_e('تعمیر', 'hesabix2'); ?></b><i></i></div>
|
|
<div><b><?php esc_html_e('تحویل', 'hesabix2'); ?></b><i></i><i></i></div>
|
|
</div>
|
|
</div>
|
|
<?php elseif ('gantt' === $visual) : ?>
|
|
<div class="hx-hv-card hx-hv-gantt">
|
|
<div class="hx-hv-card__head"><span><?php echo esc_html($panel_title); ?></span></div>
|
|
<div class="hx-hv-gantt__rows">
|
|
<span style="--hx-w:78%"><?php esc_html_e('فاز طراحی', 'hesabix2'); ?></span>
|
|
<span style="--hx-w:54%"><?php esc_html_e('اجرا', 'hesabix2'); ?></span>
|
|
<span style="--hx-w:36%"><?php esc_html_e('تحویل', 'hesabix2'); ?></span>
|
|
</div>
|
|
</div>
|
|
<?php elseif ('agent' === $visual) : ?>
|
|
<div class="hx-hv-card hx-hv-agent">
|
|
<div class="hx-hv-card__head"><span><?php echo esc_html($panel_title); ?></span></div>
|
|
<div class="hx-hv-agent__chat">
|
|
<p class="is-user"><?php esc_html_e('مانده چکهای این هفته؟', 'hesabix2'); ?></p>
|
|
<p class="is-bot"><?php esc_html_e('۱۲ سند؛ ۳ سررسید امروز. از دادهٔ آرک خواندم.', 'hesabix2'); ?></p>
|
|
</div>
|
|
</div>
|
|
<?php elseif ('pos' === $visual) : ?>
|
|
<div class="hx-hv-card hx-hv-pos">
|
|
<div class="hx-hv-card__head"><span><?php echo esc_html($panel_title); ?></span></div>
|
|
<div class="hx-hv-pos__slip">
|
|
<b><?php esc_html_e('فاکتور شعبه ۱۲', 'hesabix2'); ?></b>
|
|
<span><?php esc_html_e('۳ قلم · باشگاه · کارتخوان', 'hesabix2'); ?></span>
|
|
<em><?php esc_html_e('همگام با دفتر مرکزی', 'hesabix2'); ?></em>
|
|
</div>
|
|
</div>
|
|
<?php elseif ('warehouse' === $visual) : ?>
|
|
<div class="hx-hv-card hx-hv-wh">
|
|
<div class="hx-hv-card__head"><span><?php echo esc_html($panel_title); ?></span></div>
|
|
<div class="hx-hv-wh__bins">
|
|
<span class="is-full"><?php esc_html_e('A1', 'hesabix2'); ?></span>
|
|
<span><?php esc_html_e('A2', 'hesabix2'); ?></span>
|
|
<span class="is-low"><?php esc_html_e('B1', 'hesabix2'); ?></span>
|
|
<span><?php esc_html_e('B2', 'hesabix2'); ?></span>
|
|
<span class="is-full"><?php esc_html_e('C1', 'hesabix2'); ?></span>
|
|
<span><?php esc_html_e('C2', 'hesabix2'); ?></span>
|
|
</div>
|
|
</div>
|
|
<?php elseif ('org' === $visual) : ?>
|
|
<div class="hx-hv-card hx-hv-org">
|
|
<div class="hx-hv-card__head"><span><?php echo esc_html($panel_title); ?></span></div>
|
|
<div class="hx-hv-org__tree">
|
|
<strong><?php esc_html_e('هلدینگ', 'hesabix2'); ?></strong>
|
|
<div>
|
|
<span><?php esc_html_e('شرکت الف', 'hesabix2'); ?></span>
|
|
<span><?php esc_html_e('شرکت ب', 'hesabix2'); ?></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php elseif ('plant' === $visual) : ?>
|
|
<div class="hx-hv-card hx-hv-plant">
|
|
<div class="hx-hv-card__head"><span><?php echo esc_html($panel_title); ?></span></div>
|
|
<div class="hx-hv-plant__line">
|
|
<span><?php esc_html_e('خوراک', 'hesabix2'); ?></span>
|
|
<span><?php esc_html_e('خط', 'hesabix2'); ?></span>
|
|
<span><?php esc_html_e('QC', 'hesabix2'); ?></span>
|
|
<span><?php esc_html_e('انبار', 'hesabix2'); ?></span>
|
|
</div>
|
|
</div>
|
|
<?php elseif ('tax' === $visual) : ?>
|
|
<div class="hx-hv-card hx-hv-tax">
|
|
<div class="hx-hv-card__head"><span><?php echo esc_html($panel_title); ?></span></div>
|
|
<div class="hx-hv-tax__box">
|
|
<b><?php esc_html_e('صورتحساب الکترونیکی', 'hesabix2'); ?></b>
|
|
<span><?php esc_html_e('از فاکتور آرک → کارپوشه مودیان', 'hesabix2'); ?></span>
|
|
</div>
|
|
</div>
|
|
<?php else : ?>
|
|
<div class="hx-module-hero-panel">
|
|
<div class="hx-module-hero-panel__head">
|
|
<span class="hx-module-hero-panel__dot"></span>
|
|
<span><?php echo esc_html($panel_title); ?></span>
|
|
</div>
|
|
<?php if (!empty($metrics)) : ?>
|
|
<div class="hx-module-hero-panel__metrics">
|
|
<?php foreach ($metrics as $metric) : ?>
|
|
<div class="hx-module-hero-panel__metric">
|
|
<strong>
|
|
<?php echo esc_html($metric['value'] ?? ''); ?>
|
|
<?php if (!empty($metric['suffix'])) : ?>
|
|
<small><?php echo esc_html($metric['suffix']); ?></small>
|
|
<?php endif; ?>
|
|
</strong>
|
|
<span><?php echo esc_html($metric['label'] ?? ''); ?></span>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
<div class="hx-module-hero-panel__flow">
|
|
<?php
|
|
$visual_rows = !empty($rows) ? $rows : array($def['title'] ?? '', __('گزارش و کنترل', 'hesabix2'), __('اتصال به آرک', 'hesabix2'));
|
|
foreach (array_slice($visual_rows, 0, 3) as $i => $row) :
|
|
?>
|
|
<span style="--hx-row: <?php echo (int) $i; ?>">
|
|
<i></i>
|
|
<?php echo esc_html(is_string($row) ? $row : ''); ?>
|
|
</span>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php
|
|
}
|