Implement Phase 8: Dashboard & Reports (v0.8.0)
Some checks failed
Create Release Package / build-release (push) Has been cancelled
Some checks failed
Create Release Package / build-release (push) Has been cancelled
- Add comprehensive admin dashboard with stat cards and widgets - Add Chart.js for occupancy/revenue trend charts - Add Reports page with Occupancy, Revenue, Guest tabs - Add CSV and PDF export functionality (using mPDF) - Add date range filters for reports Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,382 @@
|
||||
* @package Magdev\WpBnb
|
||||
*/
|
||||
|
||||
/* Dashboard */
|
||||
/* ============================================
|
||||
Dashboard
|
||||
============================================ */
|
||||
.wp-bnb-dashboard-grid {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.wp-bnb-dashboard-row {
|
||||
display: grid;
|
||||
gap: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* Stats Row - 4 columns */
|
||||
.wp-bnb-stats-row {
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
}
|
||||
|
||||
/* Charts Row - 2 columns */
|
||||
.wp-bnb-charts-row {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
/* Activity Row - 3 columns */
|
||||
.wp-bnb-activity-row {
|
||||
grid-template-columns: 1fr 1.5fr 1fr;
|
||||
}
|
||||
|
||||
/* Responsive adjustments */
|
||||
@media screen and (max-width: 1400px) {
|
||||
.wp-bnb-stats-row {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
.wp-bnb-activity-row {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
.wp-bnb-activity-row .wp-bnb-quick-actions {
|
||||
grid-column: span 2;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 782px) {
|
||||
.wp-bnb-stats-row,
|
||||
.wp-bnb-charts-row,
|
||||
.wp-bnb-activity-row {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.wp-bnb-activity-row .wp-bnb-quick-actions {
|
||||
grid-column: span 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Stat Cards */
|
||||
.wp-bnb-stat-card {
|
||||
background: #fff;
|
||||
border: 1px solid #c3c4c7;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 15px;
|
||||
transition: box-shadow 0.2s ease;
|
||||
}
|
||||
|
||||
.wp-bnb-stat-card:hover {
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.wp-bnb-stat-icon {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 12px;
|
||||
background: linear-gradient(135deg, #2271b1, #135e96);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.wp-bnb-stat-icon.revenue {
|
||||
background: linear-gradient(135deg, #00a32a, #007017);
|
||||
}
|
||||
|
||||
.wp-bnb-stat-icon.bookings {
|
||||
background: linear-gradient(135deg, #9b59b6, #8e44ad);
|
||||
}
|
||||
|
||||
.wp-bnb-stat-icon.guests {
|
||||
background: linear-gradient(135deg, #e67e22, #d35400);
|
||||
}
|
||||
|
||||
.wp-bnb-stat-icon .dashicons {
|
||||
color: #fff;
|
||||
font-size: 24px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.wp-bnb-stat-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.wp-bnb-stat-label {
|
||||
font-size: 13px;
|
||||
color: #50575e;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.wp-bnb-stat-value {
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
color: #1d2327;
|
||||
line-height: 1.2;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.wp-bnb-stat-meta {
|
||||
font-size: 12px;
|
||||
color: #787c82;
|
||||
}
|
||||
|
||||
.wp-bnb-stat-change {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 12px;
|
||||
margin-top: 8px;
|
||||
padding: 2px 8px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.wp-bnb-stat-change.positive {
|
||||
background: #d4edda;
|
||||
color: #00a32a;
|
||||
}
|
||||
|
||||
.wp-bnb-stat-change.negative {
|
||||
background: #f8d7da;
|
||||
color: #d63638;
|
||||
}
|
||||
|
||||
.wp-bnb-stat-change .dashicons {
|
||||
font-size: 14px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
/* Widgets */
|
||||
.wp-bnb-widget {
|
||||
background: #fff;
|
||||
border: 1px solid #c3c4c7;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wp-bnb-widget-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 15px 20px;
|
||||
background: #f6f7f7;
|
||||
border-bottom: 1px solid #c3c4c7;
|
||||
}
|
||||
|
||||
.wp-bnb-widget-header h3 {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #1d2327;
|
||||
}
|
||||
|
||||
.wp-bnb-widget-header .wp-bnb-widget-date {
|
||||
font-size: 12px;
|
||||
color: #787c82;
|
||||
}
|
||||
|
||||
.wp-bnb-widget-header .wp-bnb-view-all {
|
||||
font-size: 12px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.wp-bnb-widget-content {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
/* Chart Widgets */
|
||||
.wp-bnb-chart-widget .wp-bnb-widget-content {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
/* Empty State */
|
||||
.wp-bnb-empty-state {
|
||||
text-align: center;
|
||||
padding: 30px 20px;
|
||||
color: #787c82;
|
||||
}
|
||||
|
||||
.wp-bnb-empty-state .dashicons {
|
||||
font-size: 48px;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
color: #c3c4c7;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.wp-bnb-empty-state p {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* Activity Section */
|
||||
.wp-bnb-activity-section {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.wp-bnb-activity-section:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.wp-bnb-activity-section h4 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin: 0 0 12px;
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 1px solid #f0f0f1;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #1d2327;
|
||||
}
|
||||
|
||||
.wp-bnb-activity-section h4 .dashicons {
|
||||
font-size: 16px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
color: #2271b1;
|
||||
}
|
||||
|
||||
.wp-bnb-activity-section h4 .count {
|
||||
background: #2271b1;
|
||||
color: #fff;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
padding: 2px 6px;
|
||||
border-radius: 10px;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.wp-bnb-activity-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.wp-bnb-activity-list li {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.wp-bnb-activity-list li:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.wp-bnb-activity-list a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 8px 12px;
|
||||
background: #f6f7f7;
|
||||
border-radius: 4px;
|
||||
text-decoration: none;
|
||||
transition: background 0.15s ease;
|
||||
}
|
||||
|
||||
.wp-bnb-activity-list a:hover {
|
||||
background: #dcdcde;
|
||||
}
|
||||
|
||||
.wp-bnb-activity-list strong {
|
||||
color: #1d2327;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.wp-bnb-activity-list .room {
|
||||
font-size: 12px;
|
||||
color: #787c82;
|
||||
}
|
||||
|
||||
/* Upcoming Bookings Table */
|
||||
.wp-bnb-upcoming-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.wp-bnb-upcoming-table th {
|
||||
text-align: left;
|
||||
padding: 8px 12px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #50575e;
|
||||
background: #f6f7f7;
|
||||
border-bottom: 1px solid #c3c4c7;
|
||||
}
|
||||
|
||||
.wp-bnb-upcoming-table td {
|
||||
padding: 10px 12px;
|
||||
font-size: 13px;
|
||||
border-bottom: 1px solid #f0f0f1;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.wp-bnb-upcoming-table tr:last-child td {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.wp-bnb-upcoming-table a {
|
||||
color: #2271b1;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.wp-bnb-upcoming-table a:hover {
|
||||
color: #135e96;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.wp-bnb-upcoming-table .wp-bnb-status-badge {
|
||||
font-size: 10px;
|
||||
padding: 3px 8px;
|
||||
}
|
||||
|
||||
/* Quick Actions */
|
||||
.wp-bnb-quick-actions .wp-bnb-widget-content {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.wp-bnb-actions-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.wp-bnb-action-btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
padding: 20px 10px;
|
||||
background: #f6f7f7;
|
||||
border: 1px solid #c3c4c7;
|
||||
border-radius: 6px;
|
||||
text-decoration: none;
|
||||
color: #1d2327;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.wp-bnb-action-btn:hover {
|
||||
background: #2271b1;
|
||||
border-color: #2271b1;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.wp-bnb-action-btn .dashicons {
|
||||
font-size: 24px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.wp-bnb-action-btn span:last-child {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Legacy Dashboard (backward compatibility) */
|
||||
.wp-bnb-dashboard {
|
||||
background: #fff;
|
||||
border: 1px solid #c3c4c7;
|
||||
@@ -1345,3 +1720,305 @@
|
||||
font-size: 18px;
|
||||
color: #135e96;
|
||||
}
|
||||
|
||||
/* ============================================
|
||||
Reports Page
|
||||
============================================ */
|
||||
|
||||
/* Reports Tabs */
|
||||
.wp-bnb-reports-tabs .nav-tab {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.wp-bnb-reports-tabs .nav-tab .dashicons {
|
||||
font-size: 16px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
/* Reports Content Container */
|
||||
.wp-bnb-reports-content {
|
||||
background: #fff;
|
||||
border: 1px solid #c3c4c7;
|
||||
border-top: none;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
/* Reports Filters */
|
||||
.wp-bnb-reports-filters {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 15px;
|
||||
padding: 15px 20px;
|
||||
background: #f6f7f7;
|
||||
border: 1px solid #c3c4c7;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.wp-bnb-filter-form {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.wp-bnb-filter-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.wp-bnb-filter-group label {
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
color: #50575e;
|
||||
}
|
||||
|
||||
.wp-bnb-period-select {
|
||||
min-width: 150px;
|
||||
}
|
||||
|
||||
.wp-bnb-custom-dates {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.wp-bnb-custom-dates input[type="date"] {
|
||||
width: 140px;
|
||||
}
|
||||
|
||||
.wp-bnb-report-period {
|
||||
font-size: 13px;
|
||||
color: #50575e;
|
||||
}
|
||||
|
||||
.wp-bnb-report-period strong {
|
||||
color: #1d2327;
|
||||
}
|
||||
|
||||
/* Report Body */
|
||||
.wp-bnb-report-body {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.wp-bnb-report-section {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.wp-bnb-report-section h3 {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #1d2327;
|
||||
margin: 25px 0 15px;
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 1px solid #c3c4c7;
|
||||
}
|
||||
|
||||
.wp-bnb-report-section h3:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
/* Summary Cards */
|
||||
.wp-bnb-summary-cards {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 15px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
.wp-bnb-summary-cards.secondary {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1200px) {
|
||||
.wp-bnb-summary-cards {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
.wp-bnb-summary-cards.secondary {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 782px) {
|
||||
.wp-bnb-summary-cards,
|
||||
.wp-bnb-summary-cards.secondary {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.wp-bnb-summary-card {
|
||||
background: #f6f7f7;
|
||||
border: 1px solid #c3c4c7;
|
||||
border-radius: 6px;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.wp-bnb-summary-card.primary {
|
||||
background: linear-gradient(135deg, #d4edda, #c3e6cb);
|
||||
border-color: #a3d4aa;
|
||||
}
|
||||
|
||||
.wp-bnb-summary-card.small {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.wp-bnb-summary-value {
|
||||
display: block;
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
color: #2271b1;
|
||||
line-height: 1.2;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.wp-bnb-summary-card.primary .wp-bnb-summary-value {
|
||||
color: #00a32a;
|
||||
}
|
||||
|
||||
.wp-bnb-summary-card.small .wp-bnb-summary-value {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.wp-bnb-summary-label {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: #50575e;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
/* Report Tables */
|
||||
.wp-bnb-report-table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.wp-bnb-report-table th,
|
||||
.wp-bnb-report-table td {
|
||||
padding: 10px 12px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.wp-bnb-report-table th.num,
|
||||
.wp-bnb-report-table td.num {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.wp-bnb-report-table tfoot th {
|
||||
background: #f0f6fc;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.wp-bnb-report-table a {
|
||||
color: #2271b1;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.wp-bnb-report-table a:hover {
|
||||
color: #135e96;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Progress Bar */
|
||||
.wp-bnb-progress-bar {
|
||||
position: relative;
|
||||
background: #dcdcde;
|
||||
border-radius: 10px;
|
||||
height: 20px;
|
||||
overflow: hidden;
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
.wp-bnb-progress-fill {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, #2271b1, #135e96);
|
||||
border-radius: 10px;
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
|
||||
.wp-bnb-progress-text {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: #1d2327;
|
||||
text-shadow: 0 0 3px #fff;
|
||||
}
|
||||
|
||||
/* Status Labels */
|
||||
.wp-bnb-status {
|
||||
display: inline-block;
|
||||
padding: 3px 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.wp-bnb-status.high {
|
||||
background: #d4edda;
|
||||
color: #00a32a;
|
||||
}
|
||||
|
||||
.wp-bnb-status.medium {
|
||||
background: #fff3cd;
|
||||
color: #856404;
|
||||
}
|
||||
|
||||
.wp-bnb-status.low {
|
||||
background: #f8d7da;
|
||||
color: #d63638;
|
||||
}
|
||||
|
||||
/* No Data Message */
|
||||
.wp-bnb-no-data {
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
color: #787c82;
|
||||
font-style: italic;
|
||||
background: #f6f7f7;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
/* Export Buttons */
|
||||
.wp-bnb-export-buttons {
|
||||
padding: 20px;
|
||||
background: #f6f7f7;
|
||||
border: 1px solid #c3c4c7;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.wp-bnb-export-buttons h4 {
|
||||
margin: 0 0 15px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.wp-bnb-export-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.wp-bnb-export-actions .button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.wp-bnb-export-actions .button .dashicons {
|
||||
font-size: 16px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
@@ -1024,6 +1024,181 @@
|
||||
updateServicesTotal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize dashboard charts.
|
||||
*/
|
||||
function initDashboardCharts() {
|
||||
// Only run on dashboard page.
|
||||
if (!wpBnbAdmin.isDashboard || typeof Chart === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = wpBnbAdmin.chartData;
|
||||
if (!chartData) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Chart.js default configuration.
|
||||
Chart.defaults.font.family = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif';
|
||||
Chart.defaults.font.size = 12;
|
||||
Chart.defaults.color = '#50575e';
|
||||
|
||||
// Initialize Occupancy Chart.
|
||||
var occupancyCtx = document.getElementById('wp-bnb-occupancy-chart');
|
||||
if (occupancyCtx && chartData.occupancy) {
|
||||
new Chart(occupancyCtx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: chartData.occupancy.labels,
|
||||
datasets: [{
|
||||
label: wpBnbAdmin.i18n.occupancy,
|
||||
data: chartData.occupancy.data,
|
||||
borderColor: '#2271b1',
|
||||
backgroundColor: 'rgba(34, 113, 177, 0.1)',
|
||||
fill: true,
|
||||
tension: 0.3,
|
||||
pointRadius: 3,
|
||||
pointHoverRadius: 5,
|
||||
pointBackgroundColor: '#2271b1',
|
||||
pointBorderColor: '#fff',
|
||||
pointBorderWidth: 2
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
plugins: {
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
tooltip: {
|
||||
backgroundColor: '#1d2327',
|
||||
titleColor: '#fff',
|
||||
bodyColor: '#fff',
|
||||
padding: 12,
|
||||
displayColors: false,
|
||||
callbacks: {
|
||||
label: function(context) {
|
||||
return context.parsed.y.toFixed(1) + '%';
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
scales: {
|
||||
y: {
|
||||
beginAtZero: true,
|
||||
max: 100,
|
||||
ticks: {
|
||||
callback: function(value) {
|
||||
return value + '%';
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
color: 'rgba(0, 0, 0, 0.05)'
|
||||
}
|
||||
},
|
||||
x: {
|
||||
grid: {
|
||||
display: false
|
||||
}
|
||||
}
|
||||
},
|
||||
interaction: {
|
||||
intersect: false,
|
||||
mode: 'index'
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Initialize Revenue Chart.
|
||||
var revenueCtx = document.getElementById('wp-bnb-revenue-chart');
|
||||
if (revenueCtx && chartData.revenue) {
|
||||
new Chart(revenueCtx, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: chartData.revenue.labels,
|
||||
datasets: [{
|
||||
label: wpBnbAdmin.i18n.revenue,
|
||||
data: chartData.revenue.data,
|
||||
backgroundColor: 'rgba(0, 163, 42, 0.8)',
|
||||
borderColor: '#00a32a',
|
||||
borderWidth: 1,
|
||||
borderRadius: 4,
|
||||
barPercentage: 0.6
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
plugins: {
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
tooltip: {
|
||||
backgroundColor: '#1d2327',
|
||||
titleColor: '#fff',
|
||||
bodyColor: '#fff',
|
||||
padding: 12,
|
||||
displayColors: false,
|
||||
callbacks: {
|
||||
label: function(context) {
|
||||
return new Intl.NumberFormat('de-CH', {
|
||||
style: 'currency',
|
||||
currency: 'CHF'
|
||||
}).format(context.parsed.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
scales: {
|
||||
y: {
|
||||
beginAtZero: true,
|
||||
ticks: {
|
||||
callback: function(value) {
|
||||
return new Intl.NumberFormat('de-CH', {
|
||||
style: 'currency',
|
||||
currency: 'CHF',
|
||||
maximumFractionDigits: 0
|
||||
}).format(value);
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
color: 'rgba(0, 0, 0, 0.05)'
|
||||
}
|
||||
},
|
||||
x: {
|
||||
grid: {
|
||||
display: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize reports page functionality.
|
||||
*/
|
||||
function initReportsPage() {
|
||||
var $periodSelect = $('.wp-bnb-period-select');
|
||||
var $customDates = $('.wp-bnb-custom-dates');
|
||||
|
||||
if (!$periodSelect.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Toggle custom date fields based on period selection.
|
||||
$periodSelect.on('change', function() {
|
||||
if ($(this).val() === 'custom') {
|
||||
$customDates.show();
|
||||
} else {
|
||||
$customDates.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Initialize on document ready.
|
||||
$(document).ready(function() {
|
||||
initLicenseManagement();
|
||||
@@ -1037,6 +1212,8 @@
|
||||
initGuestSearch();
|
||||
initServicePricing();
|
||||
initBookingServices();
|
||||
initDashboardCharts();
|
||||
initReportsPage();
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
Reference in New Issue
Block a user