274 lines
18 KiB
XML
274 lines
18 KiB
XML
|
|
<?xml version="1.0" encoding="utf-8"?>
|
||
|
|
<odoo>
|
||
|
|
<template id="cpp_dashboard" name="CPP Election Dashboard">
|
||
|
|
<t t-call="portal.portal_layout">
|
||
|
|
<div class="container-fluid mt-4">
|
||
|
|
<!-- Auto-refresh meta tag -->
|
||
|
|
<meta http-equiv="refresh" content="3600"/>
|
||
|
|
|
||
|
|
<!-- Header -->
|
||
|
|
<div class="row mb-4">
|
||
|
|
<div class="col-12">
|
||
|
|
<div class="card bg-primary text-white shadow-sm">
|
||
|
|
<div class="card-body py-3">
|
||
|
|
<div class="row align-items-center">
|
||
|
|
<div class="col-md-8">
|
||
|
|
<h3 class="mb-0 fw-bold">
|
||
|
|
<i class="fa fa-chart-line me-2"/>
|
||
|
|
លទ្ធផលដំណើរការបោះឆ្នោត
|
||
|
|
</h3>
|
||
|
|
<small>Dashboard - Election Process Results</small>
|
||
|
|
</div>
|
||
|
|
<div class="col-md-4 text-md-end">
|
||
|
|
<h4 class="mb-0 fw-bold">
|
||
|
|
<i class="fa fa-clock me-2"/>
|
||
|
|
ម៉ោង: <t t-esc="current_dt.strftime('%H:%M')"/>
|
||
|
|
</h4>
|
||
|
|
<small>ថ្ងៃ: <t t-esc="current_dt.strftime('%d/%m/%Y')"/></small>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- ✅ UPDATED FILTERS SECTION -->
|
||
|
|
<div class="row mb-4">
|
||
|
|
<div class="col-12">
|
||
|
|
<div class="card shadow-sm">
|
||
|
|
<div class="card-body">
|
||
|
|
<form method="get" action="/my/cpp_entries/dashboard" class="row g-2">
|
||
|
|
|
||
|
|
<!-- 1. Province Filter -->
|
||
|
|
<div class="col-md-2">
|
||
|
|
<label class="form-label fw-bold small">រាជធានី/ខេត្ដ</label>
|
||
|
|
<select name="province_id" class="form-select form-select-sm" onchange="this.form.submit()">
|
||
|
|
<option value="">-- ទាំងអស់ --</option>
|
||
|
|
<t t-foreach="provinces" t-as="prov">
|
||
|
|
<option t-att-value="prov.id" t-att-selected="sel_province == str(prov.id)">
|
||
|
|
<t t-esc="prov.location_name"/>
|
||
|
|
</option>
|
||
|
|
</t>
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- 2. District Filter -->
|
||
|
|
<div class="col-md-2">
|
||
|
|
<label class="form-label fw-bold small">ស្រុក/ខណ្ឌ</label>
|
||
|
|
<select name="district_id" class="form-select form-select-sm" onchange="this.form.submit()">
|
||
|
|
<option value="">-- ទាំងអស់ --</option>
|
||
|
|
<t t-foreach="districts" t-as="dist">
|
||
|
|
<option t-att-value="dist.id" t-att-selected="sel_district == str(dist.id)">
|
||
|
|
<t t-esc="dist.location_name"/>
|
||
|
|
</option>
|
||
|
|
</t>
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- 3. Commune Filter -->
|
||
|
|
<div class="col-md-2">
|
||
|
|
<label class="form-label fw-bold small">ឃុំ/សង្កាត់</label>
|
||
|
|
<select name="commune_id" class="form-select form-select-sm" onchange="this.form.submit()">
|
||
|
|
<option value="">-- ទាំងអស់ --</option>
|
||
|
|
<t t-foreach="communes" t-as="com">
|
||
|
|
<option t-att-value="com.id" t-att-selected="sel_commune == str(com.id)">
|
||
|
|
<t t-esc="com.location_name"/>
|
||
|
|
</option>
|
||
|
|
</t>
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- 4. Al Office Filter (Text Input) -->
|
||
|
|
<div class="col-md-3">
|
||
|
|
<label class="form-label fw-bold small">ការិយាល័យបោះឆ្នោត</label>
|
||
|
|
<input type="text" name="al_office" class="form-control form-control-sm"
|
||
|
|
placeholder="ស្វែងរកការិយាល័យ..."
|
||
|
|
t-att-value="sel_al_office or ''"/>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- 5. Company Filter -->
|
||
|
|
<div class="col-md-2">
|
||
|
|
<label class="form-label fw-bold small">ក្រុមហ៊ុន</label>
|
||
|
|
<select name="company_id" class="form-select form-select-sm">
|
||
|
|
<option value="">-- ទាំងអស់ --</option>
|
||
|
|
<t t-foreach="companies" t-as="comp">
|
||
|
|
<option t-att-value="comp.id" t-att-selected="sel_company == str(comp.id)">
|
||
|
|
<t t-esc="comp.name"/>
|
||
|
|
</option>
|
||
|
|
</t>
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- 6. Action Buttons -->
|
||
|
|
<div class="col-md-1 d-flex align-items-end">
|
||
|
|
<button type="submit" class="btn btn-primary btn-sm w-100" title="តម្រង">
|
||
|
|
<i class="fa fa-filter"/>
|
||
|
|
</button>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Reset Button (Full width below or separate) -->
|
||
|
|
<div class="col-12 mt-2 text-end">
|
||
|
|
<a href="/my/cpp_entries/dashboard" class="btn btn-outline-secondary btn-sm">
|
||
|
|
<i class="fa fa-refresh me-1"/> រីផ្រេស (Reset)
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Overall Statistics Cards -->
|
||
|
|
<div class="row mb-4">
|
||
|
|
<div class="col-12">
|
||
|
|
<h4 class="text-primary mb-3">
|
||
|
|
<i class="fa fa-chart-pie me-2"/> លទ្ធផលទូទាំងស្រុក
|
||
|
|
</h4>
|
||
|
|
</div>
|
||
|
|
<div class="col-md-3 mb-3">
|
||
|
|
<div class="card bg-info text-white h-100 shadow-sm">
|
||
|
|
<div class="card-body text-center">
|
||
|
|
<h6 class="card-title">ចំនួនអ្នកបោះឆ្នោតសរុប</h6>
|
||
|
|
<h2 class="display-6 fw-bold"><t t-esc="totals['voters']"/></h2>
|
||
|
|
<p class="mb-0 small">នាក់</p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="col-md-3 mb-3">
|
||
|
|
<div class="card bg-success text-white h-100 shadow-sm">
|
||
|
|
<div class="card-body text-center">
|
||
|
|
<h6 class="card-title">បោះឆ្នោតរួច</h6>
|
||
|
|
<h2 class="display-6 fw-bold"><t t-esc="totals['voted']"/></h2>
|
||
|
|
<p class="mb-0 small"><t t-esc="'%.2f' % overall_pct"/>%</p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="col-md-3 mb-3">
|
||
|
|
<div class="card bg-warning text-dark h-100 shadow-sm">
|
||
|
|
<div class="card-body text-center">
|
||
|
|
<h6 class="card-title">សមាជិក</h6>
|
||
|
|
<h3 class="fw-bold"><t t-esc="totals['members_voted']"/> / <t t-esc="totals['members']"/></h3>
|
||
|
|
<p class="mb-0 small"><t t-esc="'%.2f' % totals.get('members_pct', 0)"/>%</p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="col-md-3 mb-3">
|
||
|
|
<div class="card bg-danger text-white h-100 shadow-sm">
|
||
|
|
<div class="card-body text-center">
|
||
|
|
<h6 class="card-title">មិនមែនសមាជិក</h6>
|
||
|
|
<h3 class="fw-bold"><t t-esc="totals['non_members_voted']"/> / <t t-esc="totals['non_members']"/></h3>
|
||
|
|
<p class="mb-0 small"><t t-esc="'%.2f' % totals.get('non_members_pct', 0)"/>%</p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Hourly Progress Table -->
|
||
|
|
<div class="row mb-4">
|
||
|
|
<div class="col-12">
|
||
|
|
<div class="card shadow-sm">
|
||
|
|
<div class="card-header bg-primary text-white">
|
||
|
|
<h5 class="mb-0"><i class="fa fa-clock me-2"/> តារាងម៉ោងបោះឆ្នោត</h5>
|
||
|
|
</div>
|
||
|
|
<div class="card-body p-0">
|
||
|
|
<div class="table-responsive">
|
||
|
|
<table class="table table-bordered table-striped mb-0 text-center align-middle">
|
||
|
|
<thead class="table-light">
|
||
|
|
<tr>
|
||
|
|
<th class="text-start ps-3">ឃុំ/សង្កាត់</th>
|
||
|
|
<th t-foreach="hours" t-as="hour" class="text-center"><t t-esc="hour"/>:00</th>
|
||
|
|
<th class="text-center bg-warning text-dark">សរុប</th>
|
||
|
|
<th class="text-center bg-primary text-white">ភាគរយ</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<t t-foreach="commune_data.items()" t-as="commune">
|
||
|
|
<tr>
|
||
|
|
<td class="text-start fw-bold ps-3"><t t-esc="commune[0]"/></td>
|
||
|
|
<t t-foreach="hours" t-as="hour">
|
||
|
|
<td>
|
||
|
|
<t t-if="commune[1]['hourly'][hour]['count'] > 0">
|
||
|
|
<span class="badge bg-success"><t t-esc="commune[1]['hourly'][hour]['count']"/></span>
|
||
|
|
</t>
|
||
|
|
<t t-else="">-</t>
|
||
|
|
</td>
|
||
|
|
</t>
|
||
|
|
<td class="fw-bold"><t t-esc="commune[1]['voted']"/> / <t t-esc="commune[1]['total']"/></td>
|
||
|
|
<td><span class="badge bg-primary"><t t-esc="'%.2f' % commune[1]['pct']"/>%</span></td>
|
||
|
|
</tr>
|
||
|
|
</t>
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Detailed Statistics Table -->
|
||
|
|
<div class="row mb-4">
|
||
|
|
<div class="col-12">
|
||
|
|
<div class="card shadow-sm">
|
||
|
|
<div class="card-header bg-success text-white">
|
||
|
|
<h5 class="mb-0"><i class="fa fa-table me-2"/> តារាងស្ថិតិលម្អិត</h5>
|
||
|
|
</div>
|
||
|
|
<div class="card-body p-0">
|
||
|
|
<div class="table-responsive">
|
||
|
|
<table class="table table-bordered table-hover mb-0 text-center align-middle">
|
||
|
|
<thead class="table-light">
|
||
|
|
<tr>
|
||
|
|
<th rowspan="2" class="align-middle">ល.រ</th>
|
||
|
|
<th rowspan="2" class="align-middle text-start ps-3">ឃុំ/សង្កាត់</th>
|
||
|
|
<th colspan="3" class="bg-warning bg-opacity-25">សមាជិកគណបក្ស</th>
|
||
|
|
<th colspan="3" class="bg-danger bg-opacity-25">មិនមែនសមាជិក</th>
|
||
|
|
<th rowspan="2" class="align-middle">សរុប</th>
|
||
|
|
<th rowspan="2" class="align-middle">ភាគរយ</th>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<th>សរុប</th><th>បោះឆ្នោតរួច</th><th>%</th>
|
||
|
|
<th>សរុប</th><th>បោះឆ្នោតរួច</th><th>%</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<t t-foreach="commune_data.items()" t-as="commune">
|
||
|
|
<tr>
|
||
|
|
<td><t t-esc="commune_index + 1"/></td>
|
||
|
|
<td class="text-start fw-bold ps-3"><t t-esc="commune[0]"/></td>
|
||
|
|
<td><t t-esc="commune[1]['members']"/></td>
|
||
|
|
<td class="text-success fw-bold"><t t-esc="commune[1]['members_voted']"/></td>
|
||
|
|
<td><t t-esc="'%.2f' % commune[1]['members_pct']"/>%</td>
|
||
|
|
<td><t t-esc="commune[1]['non_members']"/></td>
|
||
|
|
<td class="text-success fw-bold"><t t-esc="commune[1]['non_members_voted']"/></td>
|
||
|
|
<td><t t-esc="'%.2f' % commune[1]['non_members_pct']"/>%</td>
|
||
|
|
<td class="fw-bold"><t t-esc="commune[1]['voted']"/> / <t t-esc="commune[1]['total']"/></td>
|
||
|
|
<td>
|
||
|
|
<div class="progress" style="height: 20px;">
|
||
|
|
<div class="progress-bar bg-success" t-attf-style="width: {{commune[1]['pct']}}%">
|
||
|
|
<t t-esc="'%.1f' % commune[1]['pct']"/>%
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
</t>
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Footer Info -->
|
||
|
|
<div class="row">
|
||
|
|
<div class="col-12">
|
||
|
|
<div class="alert alert-light border text-center small">
|
||
|
|
<i class="fa fa-info-circle text-primary me-1"/>
|
||
|
|
ទិន្នន័យនឹងធ្វើបចចុប្បន្នភាពដោយស្វ័យប្រវត្តិរងរាល់ ១ ម៉ោងម្តង |
|
||
|
|
ព័ត៌មានចុងក្រោយ: <t t-esc="current_dt.strftime('%d/%m/%Y %H:%M:%S')"/>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</t>
|
||
|
|
</template>
|
||
|
|
</odoo>
|