=== PN Tasks Manager ===
Contributors: felixmartinez, hamlet237
Donate link: https://padresenlanube.com/
Tags: task, time manager, tasking, time tracking, performance
Requires at least: 3.0
Tested up to: 7.0
Stable tag: 1.0.75
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Manage your tasks and time tracking with this plugin. Create tasks, assign them to users, and track the time spent on each task.

== Description ==

PN Tasks Manager is a comprehensive WordPress plugin designed to help you manage tasks, track time, and organize your team's workflow efficiently. Whether you're managing personal tasks, team projects, or community events, this plugin provides all the tools you need to stay organized and productive.

= Core Features =

* **Task Management**: Create, edit, and manage tasks with detailed information including titles, descriptions, dates, times, and estimated hours. Tasks support rich content editing with WordPress's built-in editor.

* **User Assignment**: Assign tasks to one or multiple users, making it easy to distribute workload and track responsibilities across your team.

* **Time Tracking**: Track estimated hours for each task and monitor completion status. The plugin calculates total hours per user for performance analysis.

* **Interactive Calendar**: View your tasks in multiple calendar formats:
  * Day view: Detailed view of tasks for a specific day
  * Week view: Overview of tasks across a week
  * Month view: Complete monthly calendar with task indicators
  * Year view: Annual overview with task distribution

* **Recurring Tasks**: Set up tasks that repeat automatically with customizable periodicity:
  * Repeat every X days, weeks, or months
  * Set an end date for recurring tasks
  * Tasks are automatically generated based on your schedule

* **Task Categories**: Organize tasks using hierarchical categories with custom icons and colors for easy visual identification.

* **Public Tasks**: Create public tasks that any user can join, perfect for community events, volunteer opportunities, or collaborative projects.

* **ICS Calendar Export**: Export your tasks to ICS format for seamless integration with Google Calendar, Outlook, Apple Calendar, and other calendar applications.

* **User Ranking**: Track and display user rankings based on completed task hours, motivating team members and recognizing top contributors (admin-only feature).

* **Email Notifications**: Automatically notify users when tasks are assigned to them. Supports automatic email notifications for appointments (requires MailPN plugin for enhanced functionality, falls back to wp_mail).

* **Gutenberg Blocks**: Full integration with WordPress block editor. Use blocks to display:
  * Calendar views
  * Task lists
  * Joinable tasks
  * User rankings
  * Individual tasks

* **Shortcodes**: Flexible shortcode system for displaying plugin features anywhere on your site:
  * `[pn-tasks-manager-calendar]` - Display interactive calendar
  * `[pn-tasks-manager-task-list]` - Show task listings
  * `[pn-tasks-manager-joinable-tasks]` - List tasks users can join
  * `[pn-tasks-manager-users-ranking]` - Display user rankings
  * `[pn-tasks-manager-task]` - Display individual tasks
  * `[pn-tasks-manager-booking]` - Display appointment booking interface (NEW in 1.0.14)
  * `[pn-tasks-manager-call-to-action]` - Create custom call-to-action elements

* **Role-Based Permissions**: Flexible permission system that integrates with WordPress user roles. Control who can create, edit, delete, and manage tasks.

* **Multilingual Support**: Fully translation-ready with support for multiple languages including Spanish, Catalan, Basque, Galician, Italian, and Portuguese. Compatible with Polylang for multilingual sites.

* **AJAX-Powered Interface**: Fast, responsive interface with AJAX functionality for seamless user experience without page reloads.

* **Customizable Styling**: Modern, clean interface with Material Design icons. Styles can be customized to match your theme.

* **Task Status Tracking**: Mark tasks as completed and track progress through your workflow.

* **Task Attachments**: Attach files and media to tasks for better collaboration and documentation.

* **Task Locations**: Add location information to tasks for events and meetings.

* **Task Icons and Colors**: Customize task appearance with icons and colors for quick visual identification.

* **Interactive Onboarding Tutorial (NEW in 1.0.61)**: First-time user experience enhancement:
  * 5-step guided tour through plugin features
  * Spotlight effect highlighting relevant sections
  * Visual progress indicators and contextual tips
  * Mobile-responsive and keyboard-navigable
  * One-time display that respects user preferences
  * Skip/Resume functionality for flexibility

* **Smart Page Detection (NEW in 1.0.61)**: Intelligent page management system:
  * Automatically detects existing pages with plugin shortcodes
  * Recognizes both Gutenberg blocks and classic shortcodes
  * One-click linking of detected pages to plugin functions
  * Visual indicators for linked/unlinked status
  * Create new pages or link existing ones seamlessly
  * Support for Task List, Calendar, and Booking pages

* **Appointment Booking System (NEW in 1.0.14)**: Complete Calendly-style appointment scheduling system:
  * Public booking interface with 6-step flow
  * Customizable availability hours per day of the week
  * Automatic holiday management with API integration (Nager.Date)
  * Time slot management with visual availability indicators
  * Automatic email notifications (appointment confirmation, 24h reminders, cancellations)
  * WP Cron integration for automated reminder emails
  * Admin management of appointments in WordPress dashboard
  * Responsive design for mobile and desktop
  * Support for break periods during work hours
  * Custom appointment duration settings
  * Email fallback system (MailPN → wp_mail)

= Use Cases =

* **Project Management**: Organize team projects with assigned tasks and deadlines
* **Event Planning**: Schedule and manage events with recurring dates
* **Community Management**: Create public tasks for community participation
* **Time Tracking**: Monitor time spent on various activities and projects
* **Team Collaboration**: Assign and track tasks across team members
* **Personal Organization**: Manage personal tasks and schedules
* **Appointment Scheduling**: Accept online bookings from clients and customers
* **Service Businesses**: Schedule appointments for consultations, services, or meetings

= Technical Features =

* Custom Post Type implementation for tasks
* Hierarchical taxonomy system for categories
* REST API integration (with security controls)
* WordPress coding standards compliant
* Optimized database queries
* Security-focused with nonce verification and capability checks
* Compatible with WordPress 3.0 and higher
* PHP 7.2+ required

This plugin is perfect for WordPress sites that need a robust task management system without the complexity of external services. It integrates seamlessly with WordPress's native features and works with any WordPress theme.


== Credits ==
This plugin stands on the shoulders of giants

Owl Carousel v2.3.4
Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
Copyright 2013-2018 David Deutsch
https://owlcarousel2.github.io/OwlCarousel2/
https://github.com/OwlCarousel2/OwlCarousel2/blob/develop/dist/owl.carousel.js

Trumbowyg v2.27.3 - A lightweight WYSIWYG editor
alex-d.github.io/Trumbowyg/
License MIT - Author : Alexandre Demode (Alex-D)
https://github.com/Alex-D/Trumbowyg/blob/develop/src/ui/sass/trumbowyg.scss
https://github.com/Alex-D/Trumbowyg/blob/develop/src/ui/sass/trumbowyg.scss
https://github.com/Alex-D/Trumbowyg/blob/develop/src/trumbowyg.js


== Installation ==

1. Upload `pn-tasks-manager.php` to the `/wp-content/plugins/` directory
1. Activate the plugin through the 'Plugins' menu in WordPress

== Frequently Asked Questions ==

= How do I install the PN Tasks Manager plugin? =

To install the PN Tasks Manager plugin, you can either upload the plugin files to the /wp-content/plugins/pn-tasks-manager directory, or install the plugin through the WordPress plugins screen directly. After uploading, activate the plugin through the 'Plugins' screen in WordPress.

= Can I customize the look and feel of my listings? =

Yes, you can customize the appearance of your listings by modifying the CSS styles provided in the plugin. Additionally, you can enqueue your own custom styles to override the default plugin styles.

= Where can I find the uncompressed source code for the plugin's JavaScript and CSS files? =

You can find the uncompressed source code for the JavaScript and CSS files in the src directory of the plugin. You can also visit our GitHub repository for the complete source code.

= How do I add a new Custom Post Type to my site? =

To add a new Custom Post Type, go to the 'Task' section in the WordPress dashboard and click on 'Add New'. Fill in the required details for your Task, including any custom fields provided by the plugin. Once you're done, click 'Publish' to make the Task live on your site.

= Can I use this plugin with any WordPress theme? =

Yes, the PN Tasks Manager plugin is designed to be compatible with any WordPress theme. However, some themes may require additional customization to ensure the plugin's styles integrate seamlessly.

= Is the plugin translation-ready? =

Yes, the PN Tasks Manager plugin is fully translation-ready. You can use translation plugins such as Loco Translate to translate the plugin into your desired language.

= How do I update the plugin? =

You can update the plugin through the WordPress plugins screen just like any other plugin. When a new version is available, you will see an update notification, and you can click 'Update Now' to install the latest version.

= How do I backup my Task before updating the plugin? =

To backup your Task, you can export your posts and custom post types from the WordPress Tools > Export menu. Choose the 'Task' post type and download the export file. You can import this file later if needed.

= How do I add ratings and reviews to my Task? =

The plugin don't include a built-in ratings and reviews system yet. You can integrate third-party plugins that offer these features or customize the plugin to include them.

= How do I optimize my Task for SEO? =

To optimize your Task for SEO, ensure that you use relevant keywords in your Task titles, descriptions, and content. You can also use SEO plugins like Yoast SEO to further enhance your Task posts' search engine visibility.

= How do I get support for the PN Tasks Manager plugin? =

For support, you can visit the plugin's support forum on the WordPress.org website or contact the plugin author directly through our contact information info@padresenlanube.com.

= Is the plugin compatible with the latest version of WordPress? =

The PN Tasks Manager plugin is tested with the latest version of WordPress. However, it is always a good practice to check for any compatibility issues before updating WordPress or the plugin.

= How do I uninstall the plugin? =

To uninstall the plugin, go to the 'Plugins' screen in WordPress, find the PN Tasks Manager plugin, and click 'Deactivate'. After deactivating, you can click 'Delete' to remove the plugin and its files from your site. Note that this will not delete your Task, but you should back up your data before uninstalling any plugin.


== Changelog ==

= 1.0.65 =

**Shortcode Configuration System**

This update introduces a powerful configuration system that allows each shortcode instance to have custom title, description, and featured image.

**New Features:**

* **Per-Instance Shortcode Configuration**: Each shortcode placed on your site can now have unique customization
  - Custom title for each shortcode instance
  - Custom description with rich text support
  - Featured image selection using WordPress media library
  - Visual edit button for administrators (displayed only to admins on frontend)
  - Popup configuration interface similar to custom fields editor
  - Automatic configuration persistence per shortcode instance

* **Supported Shortcodes**:
  - `[pn-tasks-manager-calendar]` - Customizable calendar display
  - `[pn-tasks-manager-joinable-tasks]` - Customizable joinable tasks list
  - `[pn-tasks-manager-booking]` - Customizable appointment booking interface

* **Admin Configuration UI**:
  - Settings button appears only for administrators on frontend
  - Clean popup interface with image preview
  - WordPress media library integration for image selection
  - Real-time preview of selected images
  - AJAX-powered save without page reload
  - Responsive design for mobile devices

* **Technical Implementation**:
  - Dedicated configuration class (`PN_TASKS_MANAGER_Shortcode_Config`)
  - Unique ID generation per shortcode instance
  - Configuration stored in WordPress options
  - Automatic asset enqueuing on frontend and admin
  - Secure AJAX endpoints with nonce verification
  - Fully sanitized and escaped output

**User Experience:**

* Administrators see a configure button on each shortcode instance
* Click to open popup with configuration options
* Select image from media library with visual preview
* Add custom title and description
* Save changes with instant feedback
* Page reloads to display updated shortcode configuration
* Non-admin users see only the customized content without edit buttons

= 1.0.61 =

**Enhanced Page Management & Onboarding Experience**

This update significantly improves the plugin configuration experience with smart page detection, an interactive tutorial system, and enhanced settings management.

**New Features:**

* **Interactive Tutorial Onboarding**: First-time users now get a guided tour through plugin features
  - 5-step interactive tutorial with spotlight highlighting
  - Visual progress indicators
  - Contextual tips and feature explanations
  - Keyboard navigation support
  - Mobile-responsive design
  - Skip/Resume functionality
  - One-time display that doesn't interrupt returning users

* **Smart Page Detection**: Automatic recognition of existing pages with plugin shortcodes
  - Detects pages containing `[pn-tasks-manager-calendar]`, `[pn-tasks-manager-joinable-tasks]`, and `[pn-tasks-manager-booking]` shortcodes
  - Recognizes both Gutenberg blocks and classic shortcodes
  - Shows available pages for quick linking in settings
  - No need to manually create pages if they already exist

* **Enhanced Page Manager**:
  - Link existing pages to plugin functionality
  - Create new pages directly from settings
  - Visual indicators for linked/unlinked pages
  - One-click page linking from available pages list
  - Separate management for Task List, Calendar, and Booking pages
  - Automatic detection when pages contain required content

* **Improved Settings Interface**:
  - Better visual organization with alert boxes
  - Dividers between options for clarity
  - Improved information architecture
  - Enhanced tooltips and descriptions
  - More intuitive navigation

**Technical Improvements:**

* **New PHP Classes**:
  - `PN_TASKS_MANAGER_Tutorial`: Dedicated class for tutorial management
  - Separated concerns for better code organization
  - Reusable methods for tutorial steps and progress indicators

* **New Assets**:
  - `assets/js/admin/pn-tasks-manager-tutorial.js` - Tutorial navigation and positioning logic
  - `assets/css/admin/pn-tasks-manager-tutorial.css` - Modern tutorial styling with animations
  - Enhanced `pn-tasks-manager-forms.js` with page linking functionality

* **Database & Options**:
  - New option: `pn_tasks_manager_tutorial_completed` - Tracks tutorial completion status
  - Smart page option linking for all three page types
  - Improved option validation and sanitization

* **AJAX Endpoints**:
  - `pn_tasks_manager_link_plugin_page` - Link existing pages to plugin functions
  - `pn_tasks_manager_complete_tutorial` - Save tutorial completion status
  - Enhanced page search with shortcode/block detection

**Enhanced Features:**

* **Settings Page Management**:
  - Support for booking page configuration (previously missing from allowed options)
  - Automatic search for pages containing plugin shortcodes
  - Display up to 5 available pages per function
  - Quick link button for each available page

* **User Experience Improvements**:
  - Welcoming tutorial for new users reduces learning curve
  - Faster setup with automatic page detection
  - Clear visual feedback for all actions
  - Reduced configuration time with smart defaults
  - Better error messages and status indicators

**Developer Features:**

* **Tutorial System**:
  - Easy to extend with new tutorial steps
  - Spotlight positioning system with automatic fallbacks
  - Responsive design considerations built-in
  - Action hooks for custom tutorial steps
  - Methods for resetting tutorial state (useful for testing)

* **Page Detection System**:
  - Searches both shortcode syntax and Gutenberg block comments
  - Configurable shortcode-to-block mapping
  - Extensible for future page types
  - Query optimization for large sites

**CSS Additions:**

* New alert styles: `.pn-tasks-manager-alert-info`, `.pn-tasks-manager-alert-warning`
* Divider component: `.pn-tasks-manager-divider`
* Tutorial-specific styles with smooth animations
* Responsive breakpoints for mobile devices
* Material Design-inspired visual language

**Files Added:**

* `includes/class-pn-tasks-manager-tutorial.php` - Tutorial management class
* `assets/js/admin/pn-tasks-manager-tutorial.js` - Tutorial JavaScript logic
* `assets/css/admin/pn-tasks-manager-tutorial.css` - Tutorial styles

**Files Modified:**

* `includes/class-pn-tasks-manager-settings.php` - Integrated tutorial system
* `includes/class-pn-tasks-manager-forms.php` - Enhanced page_manager with page detection
* `includes/class-pn-tasks-manager-ajax.php` - Added link and tutorial completion handlers
* `assets/js/pn-tasks-manager-forms.js` - Added page linking functionality
* `assets/css/admin/pn-tasks-manager-admin.css` - Added new utility styles

**Upgrade Notes:**

* Tutorial will automatically display for users who haven't seen it
* Existing page configurations remain unchanged
* New page detection runs automatically on settings page load
* No database migrations required
* Fully backward compatible with previous versions

= 1.0.14 =

**Major Update: Appointment Booking System**

This release introduces a complete appointment scheduling system inspired by Calendly, transforming PN Tasks Manager into a comprehensive task and appointment management solution.

**New Features:**

* **Appointment Booking Interface**: Calendly-style public booking interface with 6-step user flow
  - Service information display
  - Interactive calendar with availability indicators
  - Visual time slot selection
  - User information form
  - Booking confirmation and review
  - Success confirmation page

* **Appointment Management**:
  - New "Appointments" custom post type
  - Complete CRUD operations for appointments
  - Admin dashboard integration
  - Appointment status tracking (confirmed/cancelled)
  - User information storage (name, email, phone, notes)

* **Availability System**:
  - Configure available hours per day of the week
  - Set break periods during work hours
  - Holiday management with automatic API integration
  - Real-time availability calculation
  - Prevent double-booking with automatic validation

* **Email Notifications**:
  - Automatic appointment confirmation emails to admin
  - 24-hour reminder emails to users
  - Cancellation notifications to users and admin
  - Smart fallback system: MailPN → wp_mail()
  - Email tracking to prevent duplicates
  - Customizable HTML email templates

* **Holiday Integration**:
  - Integration with Nager.Date API (free, no API key required)
  - Auto-import holidays for 100+ countries
  - Support for Spain, Mexico, Argentina, Colombia, Peru, USA, UK, France, Germany, Italy
  - Manual holiday management
  - Visual holiday indicators in calendar

* **WP Cron Integration**:
  - Automated reminder email scheduling
  - Configurable reminder timing (default 24h before appointment)
  - Daily cleanup of orphaned cron jobs
  - Automatic cron management on plugin activation/deactivation

* **Responsive Design**:
  - Mobile-friendly booking interface
  - Touch-optimized calendar and time slot selection
  - Responsive grid layouts
  - Modern CSS with smooth transitions

* **Developer Features**:
  - Well-documented code structure
  - Action hooks for extensibility
  - Filter hooks for customization
  - Separate classes for availability, management, emails, and reminders
  - RESTful AJAX handlers

**New Shortcode:**
* `[pn-tasks-manager-booking]` - Display the complete appointment booking interface

**New Settings:**
* Appointment Scheduling section with availability configuration
* Email Notifications section with individual email type controls
* Holiday country selection for API integration
* Default appointment duration setting
* Admin notification email configuration

**Technical Improvements:**
* New custom post type: pn_tasks_appointment
* 6 new PHP classes for appointment system
* 3 email templates (appointment-request, reminder-24h, cancellation)
* New JavaScript file for booking interface (2.5KB minified)
* New CSS file for booking styles (3KB minified)
* Enhanced AJAX handler with 5 new endpoints
* Improved security with data validation and sanitization

**Files Added:**
* includes/class-pn-tasks-manager-post-type-appointment.php
* includes/class-pn-tasks-manager-appointment-availability.php
* includes/class-pn-tasks-manager-appointment-manager.php
* includes/class-pn-tasks-manager-email-service.php
* includes/class-pn-tasks-manager-email-templates.php
* includes/class-pn-tasks-manager-appointment-reminders.php
* assets/js/pn-tasks-manager-booking.js
* assets/css/pn-tasks-manager-booking.css
* templates/booking-interface.php
* templates/emails/appointment-request.php
* templates/emails/reminder-24h.php
* templates/emails/cancellation.php

**Upgrade Notes:**
* New appointments CPT will be registered automatically
* Flush rewrite rules on activation
* Daily cron job scheduled for cleanup
* Default settings applied for new options
* No breaking changes to existing task functionality

= 1.0.12 =

Previous release notes...

= 1.0.0 =

Hello world!