Files
ewoooc/templates/monthly_summary_analysis.html
ogt 4443beb3af
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
fix(analytics): show honest empty period states
2026-07-15 16:40:32 +08:00

467 lines
21 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends 'ewoooc_base.html' %}
{% block title %}PChome 月結作戰分析 - EwoooC{% endblock %}
{#
Turn B — extends ewoooc_base + BEM 結構化
- 原 inline <style> page-monthly-summary.css (Turn A)
- 新 BEM class 由 page-monthly-summary-bem.css 提供 (Turn B)
- JS 邏輯保留在 Turn C 處理;本檔暫保留原 inline <script> 以維持頁面可運作
#}
{% block extra_css %}
<link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/dataTables.bootstrap5.min.css">
<link rel="stylesheet" href="{{ url_for('static', filename='css/page-monthly-summary.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/page-monthly-summary-bem.css') }}">
{% endblock %}
{% block ewooo_content %}
{# Runtime data source lives in page-monthly-summary.js: /api/monthly_summary_data #}
<div id="loadingOverlay" class="ms-loading" role="status" aria-live="polite">
<div class="ms-loading__spinner" aria-hidden="true"></div>
<span class="ms-loading__text">月結業績整理中</span>
</div>
<div class="monthly-analysis-page ms-page"
data-page-group="analytics"
data-screen-label="monthly-summary-analysis">
{% include 'components/_analysis_report_tabs.html' %}
<header class="monthly-analysis-hero ms-page-head">
<div class="ms-page-head__main">
<h1 class="ms-page-head__title">
<i class="fas fa-chart-pie ms-page-head__icon" aria-hidden="true"></i>
PChome 月結作戰分析
</h1>
<p class="ms-page-head__sub">
用月結資料判斷成長毛利與品類結構
</p>
</div>
<div class="ms-page-head__meta">
<span class="ms-tag ms-tag--pill">
<i class="fas fa-calendar-check" aria-hidden="true"></i>
<span id="activeReportPeriod" data-report-period>{{ analysis_period.label }}</span>
</span>
</div>
</header>
<section class="ms-action-strip" aria-label="月結業績判斷順序">
<span class="ms-action-strip__label">決策路徑</span>
<strong><i class="fas fa-chart-line" aria-hidden="true"></i></strong>
<strong><i class="fas fa-coins" aria-hidden="true"></i></strong>
<strong><i class="fas fa-layer-group" aria-hidden="true"></i>調</strong>
</section>
<section class="ms-filter-card filter-section" aria-label="資料篩選器">
<div class="ms-period-bar" aria-label="月結分析區間">
<label for="periodStartMonth">開始月份</label>
<input type="month" id="periodStartMonth" value="{{ request.args.get('start_month', '') }}">
<label for="periodEndMonth">結束月份</label>
<input type="month" id="periodEndMonth" value="{{ request.args.get('end_month', '') }}">
<button type="button" class="btn btn-sm btn-primary" onclick="applyMonthRange()">
<i class="fas fa-filter" aria-hidden="true"></i>
</button>
<button type="button" class="btn btn-sm btn-outline-secondary" onclick="resetMonthRange()" title="重置月份區間">
<i class="fas fa-rotate-left" aria-hidden="true"></i>
</button>
</div>
<div class="row g-3">
<div class="col-md-2 ms-filter-group ms-filter-group--year">
<label class="ms-filter-group__label form-label" for="btnYear">
<i class="fas fa-calendar-alt" aria-hidden="true"></i>
</label>
<div class="dropdown">
<button class="btn btn-light custom-dropdown-btn dropdown-toggle ms-filter-group__btn"
type="button" id="btnYear" data-bs-toggle="dropdown" aria-expanded="false">
最新年份
</button>
<ul class="dropdown-menu w-100 ms-filter-group__menu" id="listYear">
<li><a class="dropdown-item" href="#" onclick="selectFilter('year', '')">最新年份</a></li>
</ul>
</div>
</div>
<div class="col-md-2 ms-filter-group ms-filter-group--month">
<label class="ms-filter-group__label form-label" for="btnMonth">
<i class="fas fa-calendar-day" aria-hidden="true"></i>
</label>
<div class="dropdown">
<button class="btn btn-light custom-dropdown-btn dropdown-toggle ms-filter-group__btn"
type="button" id="btnMonth" data-bs-toggle="dropdown" aria-expanded="false">
選擇月份
</button>
<ul class="dropdown-menu w-100 ms-filter-group__menu" id="listMonth">
<li><a class="dropdown-item" href="#" onclick="selectFilter('month', '')">全部月份</a></li>
</ul>
</div>
</div>
<div class="col-md-2 ms-filter-group ms-filter-group--area">
<label class="ms-filter-group__label form-label" for="btnArea">
<i class="fas fa-map-marker-alt" aria-hidden="true"></i>
</label>
<div class="dropdown">
<button class="btn btn-light custom-dropdown-btn dropdown-toggle ms-filter-group__btn"
type="button" id="btnArea" data-bs-toggle="dropdown" aria-expanded="false">
全部區域
</button>
<ul class="dropdown-menu w-100 ms-filter-group__menu" id="listArea">
<li><a class="dropdown-item" href="#" onclick="selectFilter('area', '')">全部區域</a></li>
</ul>
</div>
</div>
<div class="col-md-3 ms-filter-group ms-filter-group--vendor">
<label class="ms-filter-group__label form-label" for="btnVendor">
<i class="fas fa-truck" aria-hidden="true"></i>
</label>
<div class="dropdown">
<button class="btn btn-light custom-dropdown-btn dropdown-toggle ms-filter-group__btn"
type="button" id="btnVendor" data-bs-toggle="dropdown" aria-expanded="false">
全部廠商
</button>
<ul class="dropdown-menu w-100 ms-filter-group__menu" id="listVendor">
<li class="px-2 py-1">
<input type="text" class="form-control form-control-sm" placeholder="搜尋..." onkeyup="filterList(this)">
</li>
<li><a class="dropdown-item" href="#" onclick="selectFilter('vendor', '')">所有廠商</a></li>
</ul>
</div>
</div>
<div class="col-md-2 ms-filter-group ms-filter-group--trade">
<label class="ms-filter-group__label form-label" for="btnTrade">
<i class="fas fa-exchange-alt" aria-hidden="true"></i>
</label>
<div class="dropdown">
<button class="btn btn-light custom-dropdown-btn dropdown-toggle ms-filter-group__btn"
type="button" id="btnTrade" data-bs-toggle="dropdown" aria-expanded="false">
所有類別
</button>
<ul class="dropdown-menu w-100 ms-filter-group__menu" id="listTrade">
<li><a class="dropdown-item" href="#" onclick="selectFilter('trade', '')">所有類別</a></li>
</ul>
</div>
</div>
<div class="col-md-1 d-flex align-items-end">
<button class="btn ms-filter-card__refresh w-100" type="button" onclick="fetchData()">
<i class="fas fa-sync-alt" aria-hidden="true"></i>
</button>
</div>
</div>
</section>
<section class="ms-period-empty" id="monthlyPeriodEmptyState" role="status" hidden>
<i class="fas fa-calendar-xmark" aria-hidden="true"></i>
<div>
<strong><span id="monthlyPeriodEmptyLabel">所選期間</span></strong>
<p>頁面不會混入其他月份仍保留去年同期資料供趨勢比較</p>
</div>
</section>
<section class="row g-3 mb-4 ms-highlight-grid" id="highlightsRow" style="display: none;" aria-label="Top 3 品牌洞察">
<div class="col-md-4">
<article class="card h-100 border-0 shadow-sm overflow-hidden ms-highlight ms-highlight--accent">
<header class="card-header ms-highlight__head">
<h6 class="ms-highlight__title"><i class="fas fa-trophy" aria-hidden="true"></i> </h6>
</header>
<div class="card-body p-0">
<table class="table table-sm table-hover mb-0 ms-highlight__table">
<tbody id="revHighlightsBody"></tbody>
</table>
</div>
</article>
</div>
<div class="col-md-4">
<article class="card h-100 border-0 shadow-sm overflow-hidden ms-highlight ms-highlight--olive">
<header class="card-header ms-highlight__head">
<h6 class="ms-highlight__title"><i class="fas fa-coins" aria-hidden="true"></i> </h6>
</header>
<div class="card-body p-0">
<table class="table table-sm table-hover mb-0 ms-highlight__table">
<tbody id="profitHighlightsBody"></tbody>
</table>
</div>
</article>
</div>
<div class="col-md-4">
<article class="card h-100 border-0 shadow-sm overflow-hidden ms-highlight ms-highlight--honey">
<header class="card-header ms-highlight__head">
<h6 class="ms-highlight__title"><i class="fas fa-fire" aria-hidden="true"></i> </h6>
</header>
<div class="card-body p-0">
<table class="table table-sm table-hover mb-0 ms-highlight__table">
<tbody id="volHighlightsBody"></tbody>
</table>
</div>
</article>
</div>
</section>
<section class="row mb-4">
<div class="col-12">
<article class="card border-0 shadow-sm ms-chart-card">
<header class="card-header ms-chart-card__head">
<h6 class="ms-chart-card__title"><i class="fas fa-history ms-chart-card__icon" aria-hidden="true"></i>年度業績對照(本期 / 去年同期</h6>
</header>
<div class="card-body">
<div id="yoyTrendChart" class="ms-chart-card__canvas" style="height: 400px;"></div>
<div class="table-responsive mt-3">
<table class="table table-bordered table-sm text-center mb-0 small ms-chart-card__table">
<tbody id="yoyTrendChartTableBody"></tbody>
</table>
</div>
</div>
</article>
</div>
</section>
<section class="row mb-4">
<div class="col-lg-12">
<article class="card border-0 shadow-sm ms-chart-card">
<header class="card-header ms-chart-card__head">
<h6 class="ms-chart-card__title"><i class="fas fa-building ms-chart-card__icon" aria-hidden="true"></i>Top 50 </h6>
</header>
<div class="card-body">
<div id="vendorRankingChart" class="ms-chart-card__canvas" style="height: 900px;"></div>
<div class="table-responsive mt-3">
<table class="table table-bordered table-sm text-center mb-0 small ms-chart-card__table">
<tbody id="vendorRankingChartTableBody"></tbody>
</table>
</div>
</div>
</article>
</div>
</section>
<section class="row mb-4">
<div class="col-lg-6">
<article class="card border-0 shadow-sm h-100 ms-chart-card">
<header class="card-header ms-chart-card__head">
<h6 class="ms-chart-card__title"><i class="fas fa-chart-pie ms-chart-card__icon" aria-hidden="true"></i></h6>
</header>
<div class="card-body text-center">
<div id="divisionDistChart" class="ms-chart-card__canvas" style="height: 350px;"></div>
<div id="divisionDistChartTable" class="mt-2 ms-chart-card__scroll" style="max-height: 200px; overflow-y: auto;">
<table class="table table-bordered table-sm text-center mb-0 small ms-chart-card__table">
<tbody id="divisionDistChartTableBody"></tbody>
</table>
</div>
</div>
</article>
</div>
<div class="col-lg-6">
<article class="card border-0 shadow-sm h-100 ms-chart-card">
<header class="card-header ms-chart-card__head">
<h6 class="ms-chart-card__title"><i class="fas fa-tags ms-chart-card__icon" aria-hidden="true"></i></h6>
</header>
<div class="card-body">
<div id="priceRangeChart" class="ms-chart-card__canvas" style="height: 350px;"></div>
<div class="table-responsive mt-2">
<table class="table table-bordered table-sm text-center mb-0 small ms-chart-card__table">
<tbody id="priceRangeChartTableBody"></tbody>
</table>
</div>
</div>
</article>
</div>
</section>
<section class="row">
<div class="col-lg-12">
<article class="card mb-4 ms-chart-card">
<header class="card-header ms-chart-card__head">
<h6 class="ms-chart-card__title"><i class="fas fa-chart-line ms-chart-card__icon" aria-hidden="true"></i></h6>
</header>
<div class="card-body">
<div id="compareChart" class="ms-chart-card__canvas" style="height: 400px;"></div>
<div id="compareChartDataTable" class="mt-2">
<div class="table-responsive">
<table class="table table-bordered table-sm text-center mb-0 small ms-chart-card__table">
<tbody id="compareChartTableBody"></tbody>
</table>
</div>
</div>
</div>
</article>
</div>
</section>
<section class="row mb-4">
<div class="col-lg-6">
<article class="card border-0 shadow-sm ms-chart-card">
<header class="card-header ms-chart-card__head">
<h6 class="ms-chart-card__title"><i class="fas fa-th ms-chart-card__icon" aria-hidden="true"></i>品牌策略矩陣(銷量 / 毛利率</h6>
</header>
<div class="card-body">
<div id="bcgMatrixChart" class="ms-chart-card__canvas" style="height: 400px;"></div>
</div>
</article>
</div>
<div class="col-lg-6">
<article class="card border-0 shadow-sm ms-chart-card">
<header class="card-header ms-chart-card__head">
<h6 class="ms-chart-card__title"><i class="fas fa-braille ms-chart-card__icon" aria-hidden="true"></i></h6>
</header>
<div class="card-body">
<div id="priceVolumeScatterChart" class="ms-chart-card__canvas" style="height: 400px;"></div>
</div>
</article>
</div>
</section>
<section class="row mb-4">
<div class="col-lg-12">
<article class="card border-0 shadow-sm ms-chart-card">
<header class="card-header ms-chart-card__head">
<h6 class="ms-chart-card__title"><i class="fas fa-th-large ms-chart-card__icon" aria-hidden="true"></i></h6>
</header>
<div class="card-body">
<div id="seasonalityHeatmapChart" class="ms-chart-card__canvas" style="height: 400px;"></div>
</div>
</article>
</div>
</section>
<section class="row mb-4">
<div class="col-lg-12">
<article class="card border-0 shadow-sm ms-chart-card">
<header class="card-header ms-chart-card__head">
<h6 class="ms-chart-card__title"><i class="fas fa-map ms-chart-card__icon" aria-hidden="true"></i></h6>
</header>
<div class="card-body">
<div id="areaRankingChart" class="ms-chart-card__canvas" style="height: 400px;"></div>
<div class="table-responsive mt-3">
<table class="table table-bordered table-sm text-center mb-0 small ms-chart-card__table">
<tbody id="areaRankingChartTableBody"></tbody>
</table>
</div>
</div>
</article>
</div>
</section>
<section class="row">
<div class="col-lg-12">
<article class="card mb-4 shadow-sm ms-special ms-special--info">
<header class="card-header ms-special__head">
<h6 class="ms-special__title"><i class="fas fa-layer-group" aria-hidden="true"></i></h6>
</header>
<div class="card-body">
<div id="specialChart" class="ms-chart-card__canvas" style="height: 400px;"></div>
<div id="specialChartDataTable" class="mt-2">
<div class="table-responsive">
<table class="table table-bordered table-sm text-center mb-0 small ms-chart-card__table">
<tbody id="specialChartTableBody"></tbody>
</table>
</div>
</div>
</div>
</article>
</div>
</section>
<section class="row">
<div class="col-lg-12">
<article class="card mb-4 shadow-sm ms-special ms-special--olive">
<header class="card-header ms-special__head">
<h6 class="ms-special__title"><i class="fas fa-magic" aria-hidden="true"></i></h6>
</header>
<div class="card-body">
<div id="bodyCareChart" class="ms-chart-card__canvas" style="height: 400px;"></div>
<div id="bodyCareChartDataTable" class="mt-2">
<div class="table-responsive">
<table class="table table-bordered table-sm text-center mb-0 small ms-chart-card__table">
<tbody id="bodyCareChartTableBody"></tbody>
</table>
</div>
</div>
</div>
</article>
</div>
</section>
<section class="row">
<div class="col-lg-12">
<article class="card mb-4 shadow-sm ms-special ms-special--honey">
<header class="card-header ms-special__head">
<h6 class="ms-special__title"><i class="fas fa-palette" aria-hidden="true"></i></h6>
</header>
<div class="card-body">
<div id="makeupFragranceChart" class="ms-chart-card__canvas" style="height: 400px;"></div>
<div id="makeupFragranceChartDataTable" class="mt-2">
<div class="table-responsive">
<table class="table table-bordered table-sm text-center mb-0 small ms-chart-card__table">
<tbody id="makeupFragranceChartTableBody"></tbody>
</table>
</div>
</div>
</div>
</article>
</div>
</section>
<section class="row">
<div class="col-lg-12">
<article class="card mb-4 shadow-sm ms-special ms-special--mahogany">
<header class="card-header ms-special__head">
<h6 class="ms-special__title"><i class="fas fa-heartbeat" aria-hidden="true"></i></h6>
</header>
<div class="card-body">
<div id="privacyInfantChart" class="ms-chart-card__canvas" style="height: 400px;"></div>
<div id="privacyInfantChartDataTable" class="mt-2">
<div class="table-responsive">
<table class="table table-bordered table-sm text-center mb-0 small ms-chart-card__table">
<tbody id="privacyInfantChartTableBody"></tbody>
</table>
</div>
</div>
</div>
</article>
</div>
</section>
<section class="card shadow-sm mb-5 ms-data-table">
<header class="card-header ms-data-table__head">
<h5 class="ms-data-table__title"><i class="fas fa-list" aria-hidden="true"></i> </h5>
<a href="/system_settings" class="btn btn-sm btn-outline-primary ms-data-table__import">
<i class="fas fa-plus" aria-hidden="true"></i>
</a>
</header>
<div class="card-body">
<div class="table-responsive">
<table id="summaryTable" class="table table-hover align-middle ms-data-table__table" style="width:100%">
<thead>
<tr>
<th>/</th>
<th>處別</th>
<th>區域</th>
<th>PM</th>
<th>品牌</th>
<th>廠商</th>
<th>交易型態</th>
<th>銷售額(本月)</th>
<th>YoY</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</section>
</div>
{% endblock %}
{% block extra_js %}
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.11.5/js/dataTables.bootstrap5.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
<script src="{{ url_for('static', filename='js/analysis-chart-theme.js') }}"></script>
<script src="{{ url_for('static', filename='js/page-monthly-summary.js') }}"></script>
{% endblock %}