# CheckMate Pro - Enhanced Checklist Application

A modern, glassmorphism-styled checklist management application built with PHP and MySQL.

## Features

- **Modern Glassmorphism Design** - Beautiful dark/light theme with glass effect cards
- **Theme Toggle** - Switch between dark and light modes (persists via cookie)
- **User Authentication** - Admin-created accounts with "Remember Me" functionality
- **User Profile** - Change display name, email, password, and upload avatar
- **Password Reset** - Via email notification
- **Checklist Templates** - Create and manage reusable checklists
- **Per-Question Options** - Choose to show Notes, Photos, or Yes/No only per question
- **All Admins See All Templates** - Shared visibility across admin users
- **Analytics Dashboard** - Comprehensive statistics with charts
- **Data Export** - Export data to CSV format
- **Email Notifications** - Gmail SMTP integration for completed checklist alerts
- **Image Attachments** - Support for up to 5 images per question

## Requirements

- PHP 7.4 or higher
- MySQL 5.7 or higher / MariaDB 10.x
- XAMPP, WAMP, or similar local server environment

## Installation

### 1. Copy Files
Copy the entire `checklist_app_enhanced` folder to your web server's document root:
- **XAMPP**: `C:\xampp\htdocs\checklist_app_enhanced`
- **WAMP**: `C:\wamp64\www\checklist_app_enhanced`

### 2. Configure Database Connection
Edit `config.php` and update these settings if needed:
```php
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', '');      // Your MySQL password
define('DB_DATABASE', 'checklist_app');
define('DB_PORT', 3306);        // Usually 3306, check your XAMPP
```

### 3. Start Services
1. Start Apache and MySQL from XAMPP Control Panel
2. Access the application at: `http://localhost/checklist_app_enhanced/`

### 4. Database Setup
The application will **automatically** create the database and all required tables on first access. No manual SQL import is needed!

### 5. Default Admin Account
- **Username**: `admin`
- **Password**: `admin123`
- **IMPORTANT**: Change this password immediately after first login!

## Email Configuration (Optional)

To enable email notifications for completed checklists:

1. Log in as admin
2. Go to **Settings** (gear icon in navigation)
3. Configure Gmail SMTP:
   - **SMTP Host**: `smtp.gmail.com`
   - **SMTP Port**: `587`
   - **Gmail Address**: Your Gmail address
   - **App Password**: Generate from Google Account > Security > App Passwords
   - **From Email**: Your notification email
   - **From Name**: `CheckMate Pro`
   - **Encryption**: `TLS`

### Generating Gmail App Password
1. Go to your Google Account → Security
2. Enable 2-Step Verification
3. Search for "App Passwords"
4. Generate a new app password for "Mail"
5. Use this 16-character password in the settings

## Application Structure

```
checklist_app_enhanced/
├── css/
│   └── glassmorphism.css    # Main stylesheet (dark/light themes)
├── uploads/                  # Uploaded images & avatars
├── exports/                  # Exported files
├── index.php                 # Main entry & dashboard
├── login.php                 # Login handler
├── logout.php                # Logout handler
├── profile.php               # User profile (NEW)
├── config.php                # Database & app configuration
├── api.php                   # API endpoints
├── analytics.php             # Analytics dashboard
├── export.php                # Data export functionality
├── create_template.php       # Create new templates (with question options)
├── edit_template.php         # Edit existing templates
├── view_template.php         # View template details
├── start_checklist.php       # Fill out a checklist
├── view_checklist.php        # View completed checklist
├── create_user.php           # Create new users (admin)
├── manage_users.php          # User management (admin)
├── email_settings.php        # Email configuration (admin)
├── forgot_password.php       # Password reset request
├── reset_password.php        # Password reset handler
└── email_helper.php          # Email sending functions
```

## User Roles

### Admin
- Create and manage templates
- Create user accounts
- View analytics
- Export data
- Configure email settings
- Reset user passwords

### Regular User
- View available checklists
- Complete checklists
- View their completed checklists

## Troubleshooting

### Database Connection Failed
- Verify MySQL is running in XAMPP
- Check credentials in `config.php`
- Verify the port number (default: 3306)

### Images Not Uploading
- Ensure `uploads/` folder has write permissions
- Check PHP upload limits in `php.ini`

### Email Not Sending
- Verify SMTP settings are correct
- Use App Password, not your regular Gmail password
- Check if "Less secure apps" needs to be enabled (not recommended)

## Security Recommendations

1. Change the default admin password immediately
2. Use HTTPS in production
3. Regularly backup your database
4. Keep PHP and MySQL updated

## Credits

Built with:
- PHP & MySQL
- Chart.js for analytics
- Font Awesome icons
- Inter font family

---

Version 2.0 | CheckMate Pro
