upskill-event-manager/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/templates/template-google-sheets.php
bengizmo f69146432c feat: Implement Google Sheets integration with comprehensive reporting
Add complete Google Sheets integration system for HVAC Community Events:

Core Components:
- Google Sheets OAuth 2.0 authentication handler
- Google Sheets manager for spreadsheet creation and data export
- Admin interface with full UI for configuration and operations
- Integration with Master Dashboard data aggregation

Features Implemented:
- Master Report generation with 4 tabs (Overview, Performance, Events, Revenue)
- Event-specific spreadsheets with 3 tabs (Details, Attendees, Financial)
- Connection status monitoring and testing
- Report history tracking and management
- AJAX endpoints for all operations
- Responsive admin interface with loading states

Integration Points:
- Page creation during plugin activation (/google-sheets/)
- Access control matching Master Dashboard permissions
- Navigation integration from Master Dashboard
- CSS loading and template support
- Extended Master Dashboard data class with additional methods

Configuration:
- Template configuration file for Google Cloud setup
- OAuth 2.0 flow with token management and refresh
- Google Sheets API and Drive API integration
- Secure token storage using WordPress options

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-13 18:08:58 -03:00

289 lines
No EOL
5.2 KiB
PHP
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.

<?php
/**
* Template for Google Sheets Integration page
*
* @package HVAC_Community_Events
* @subpackage Templates
*/
// Exit if accessed directly.
if (!defined('ABSPATH')) {
exit;
}
get_header(); ?>
<div class="hvac-page-wrapper">
<main class="hvac-main-content">
<?php echo do_shortcode('[hvac_google_sheets]'); ?>
</main>
</div>
<style>
/* Google Sheets specific styles */
.hvac-google-sheets-admin {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.hvac-status-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 15px;
margin-bottom: 20px;
}
.hvac-status-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 15px;
background: #f8f9fa;
border-radius: 6px;
border-left: 4px solid #6c757d;
}
.hvac-status-value.success {
color: #28a745;
font-weight: 600;
}
.hvac-status-value.error {
color: #dc3545;
font-weight: 600;
}
.hvac-latest-report {
background: #e3f2fd;
border: 1px solid #90caf9;
border-radius: 6px;
padding: 15px;
margin-bottom: 20px;
}
.hvac-report-meta {
display: flex;
justify-content: space-between;
align-items: center;
gap: 15px;
}
.hvac-event-selection {
display: flex;
gap: 15px;
align-items: end;
margin-bottom: 20px;
flex-wrap: wrap;
}
.hvac-event-selection label {
display: block;
margin-bottom: 5px;
font-weight: 600;
}
.hvac-select {
min-width: 250px;
padding: 8px 12px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 14px;
}
.hvac-event-sheets-list {
display: grid;
gap: 10px;
}
.hvac-event-sheet-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px;
background: #f8f9fa;
border-radius: 6px;
border-left: 4px solid #007cba;
}
.hvac-sheet-info h4 {
margin: 0 0 5px 0;
color: #333;
}
.hvac-sheet-trainer,
.hvac-sheet-date {
font-size: 12px;
color: #666;
margin-right: 10px;
}
.hvac-no-sheets {
color: #666;
font-style: italic;
text-align: center;
padding: 20px;
}
.hvac-history-list {
display: grid;
gap: 10px;
}
.hvac-history-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 15px;
background: #f1f3f4;
border-radius: 4px;
}
.hvac-history-meta {
display: flex;
gap: 15px;
align-items: center;
}
.hvac-history-date {
font-weight: 600;
color: #333;
}
.hvac-history-user {
color: #666;
font-size: 14px;
}
/* Loading overlay */
.hvac-loading-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.7);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
}
.hvac-loading-content {
background: white;
padding: 30px;
border-radius: 8px;
text-align: center;
max-width: 300px;
}
.hvac-spinner {
border: 4px solid #f3f3f3;
border-top: 4px solid #007cba;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin: 0 auto 15px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Notifications */
.hvac-notification {
position: fixed;
top: 20px;
right: 20px;
padding: 15px 20px;
border-radius: 6px;
color: white;
font-weight: 600;
z-index: 10000;
max-width: 400px;
display: flex;
justify-content: space-between;
align-items: center;
gap: 15px;
}
.hvac-notification-success {
background: #28a745;
}
.hvac-notification-error {
background: #dc3545;
}
.hvac-notification-warning {
background: #ffc107;
color: #212529;
}
.hvac-notification button {
background: none;
border: none;
color: inherit;
font-size: 18px;
cursor: pointer;
padding: 0;
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
}
/* Icons */
.hvac-icon-sheets::before { content: "📊"; }
.hvac-icon-connection::before { content: "🔗"; }
.hvac-icon-test::before { content: "🧪"; }
.hvac-icon-auth::before { content: "🔐"; }
.hvac-icon-report::before { content: "📈"; }
.hvac-icon-events::before { content: "📅"; }
.hvac-icon-history::before { content: "📜"; }
.hvac-icon-calendar::before { content: "📅"; }
.hvac-icon-external::before { content: "🔗"; }
.hvac-icon-create::before { content: ""; }
.hvac-icon-arrow-left::before { content: "←"; }
/* Responsive adjustments */
@media (max-width: 768px) {
.hvac-google-sheets-admin {
padding: 15px;
}
.hvac-status-grid {
grid-template-columns: 1fr;
}
.hvac-event-selection {
flex-direction: column;
align-items: stretch;
}
.hvac-select {
min-width: auto;
width: 100%;
}
.hvac-report-meta,
.hvac-event-sheet-item,
.hvac-history-item {
flex-direction: column;
align-items: stretch;
gap: 10px;
}
.hvac-notification {
left: 10px;
right: 10px;
top: 10px;
max-width: none;
}
}
</style>
<?php get_footer(); ?>