=== Clielo ===
Contributors: sylvestreui
Tags: chat, orders, invoices, payments, client
Requires at least: 5.8
Tested up to: 6.9
Stable tag: 1.3.1
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Turn any Custom Post Type into a complete client service platform — chat, orders, payments, invoices and notifications in one plugin.

== Description ==

Clielo turns any Custom Post Type into a full client service management system. Each post gets its own real-time chat, allowing clients and service providers to communicate directly, place orders, track progress and pay online.

**Core Features (Free)**

* Real-time chat attached to any CPT post
* Service packs and options management with pricing, delays and descriptions
* Order workflow: pending → paid → started → completed → revision → accepted
* Client account page with dashboard, orders, invoices and profile (`[clielo_my_account]` shortcode)
* Admin dashboard with statistics and recent activity
* In-app notification system
* Customisable accent colour and chat button position
* Fully responsive — mobile-friendly sidebar and chat
* WP-Cron warning if DISABLE_WP_CRON is active

**Premium Features (via Freemius)**

* Stripe Checkout integration for online payments (single, deposit, installments, monthly subscription)
* Automatic PDF invoice generation
* Email notifications (new order, status change, payment links, reminders)
* Full email template editor with live preview
* Todo list per order with progress tracking
* Automatic payment link sending on due date (WP Cron)
* Configurable payment reminders N days before due date
* Unlimited services (free plan limited to 1)
* Extra pages, express delivery and maintenance pricing options
* Elementor Dynamic Tags integration

== Installation ==

1. Upload the `clielo` folder to `/wp-content/plugins/`
2. Activate the plugin through the **Plugins** menu in WordPress
3. Go to **Clielo → Settings** and choose your Custom Post Type
4. Create a page and add the `[clielo_my_account]` shortcode for the client account dashboard (orders, invoices, profile). Optionally, add `[clielo_account]` in your header/navbar as a login/avatar widget.
5. *(Premium)* Configure Stripe under **Clielo → Stripe** — paste your API keys and webhook secret
6. *(Premium)* Configure email notifications under **Clielo → Notifications**

**WP Cron (for automatic payment links)**

On low-traffic sites, add a real system cron job for reliable daily scheduling:
`* 8 * * * curl https://yoursite.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1`

== Frequently Asked Questions ==

= Which Custom Post Types are supported? =

Any public Custom Post Type registered on your site. Configure it in Clielo → Settings.

= Is Stripe required? =

No. Without Stripe (free plan), orders follow a manual chat-based workflow. Enabling Stripe (premium) adds automatic payment collection via Stripe Checkout.

= Can I customise the chat appearance? =

Yes. You can change the accent colour and chat button position (bottom-left, bottom-right, top-left, top-right) from the settings page. All UI elements adapt to the chosen colour automatically.

= What payment modes does Stripe support? =

Four modes per service: single payment, 50% deposit + balance on delivery, installments (40% upfront + N monthly payments), or pure monthly subscription.

= My site already has an account system (WooCommerce, membership plugin…). Will it conflict with Clielo? =

No. The `[clielo_account]` shortcode (login/avatar widget for your header) is entirely optional. If your site already manages user accounts with another plugin, simply skip it and add a menu link pointing to the page that contains the `[clielo_my_account]` shortcode. Your users will access their Clielo dashboard (orders, invoices, chat history) directly from that link, without any conflict with your existing account system.

= Where is the webhook URL for Stripe? =

Go to **Clielo → Stripe** in your admin. The webhook URL is displayed there — copy it into your Stripe Dashboard under Developers → Webhooks. Select the `checkout.session.completed` event.

== External Services ==

This plugin optionally connects to the following third-party services:

= Stripe (premium only) =
Used to process online payments via Stripe Checkout. Only active when Stripe is enabled by the site administrator and API keys are configured.
* Service: https://stripe.com
* Privacy Policy: https://stripe.com/privacy
* Terms of Service: https://stripe.com/legal

= Freemius =
Used to manage plugin licensing, upgrades and trials. Activated on first use of the plugin admin area (opt-in required).
* Service: https://freemius.com
* Privacy Policy: https://freemius.com/privacy

No data is transmitted to external services in the free plan without explicit configuration by the site administrator.

== Changelog ==

= 1.3.1 =
* Add FedaPay Checkout integration (Mobile Money: MTN, Moov, Orange, Togocel, Airtel, Free)
* Add global currency setting (26 currencies) — display adapts across service cards, invoices, metabox labels and payment gateways
* Fix order button showing "Commander via le chat" when only CinetPay or FedaPay is active
* Fix JS footer totals (subtotal, TVA, total, breakdown) still displaying € after currency change
* Fix quote number configurable prefix/start/padding (mirrors invoice numbering)
* CinetPay tab temporarily hidden pending integration fix

= 1.3.0 =
* Fix: quote orders (status=quote) no longer appear in admin recent orders, orders tab or invoices list
* Fix: "Accès non autorisé" error when admin clicks View/Print on invoices and quotes
* Account page: quote tab now shows DEVIS-XXX number, amount and functional View/Print button (admin and client)
* Payments settings: Stripe and CinetPay merged into a single "Paiements" page with sub-tabs
* CinetPay: add test mode with separate Test API Key and Test Site ID fields
* Invoices: quote number prefix, start and zero-padding are now configurable (Settings → Facturation), mirroring invoice numbering options

= 1.2.9 =
* Manual quote creation (free): new "Nouveau devis" page — create quotes for external clients without needing a WordPress order
* External client invoicing now free: Factures + Nouvelle facture pages accessible without premium (WP user invoices remain premium)
* Devis page: shows manual quotes table with edit/view/delete actions

= 1.2.5 =
* Trial period reduced from 14 to 7 days (synced with Freemius dashboard)

= 1.2.4 =
* Chat: image sharing — clients and admin can send images (auto-resized to 1200px, 5 MB max)
* Chat: voice messages — record and send audio clips up to 3 minutes (mic button)
* Chat: URLs in messages are now clickable links
* Chat: image lightbox — clicking a thumbnail opens a full-screen overlay; click again to close
* Chat: attach and mic buttons use flat SVG stroke icons, correctly aligned with the input field
* Fix: recent messages were disappearing after quote generation or order transitions (query now loads latest 100 messages)
* Fix: chat polling interval reduced from 5 s to 2 s for near-real-time updates
* Elementor widget "Options de service": add "Show quote button" toggle (Content tab)
* Elementor widget "Options de service": add "Bouton Devis" style section — typography, border/text color, background, border radius

= 1.2.3 =
* Quote flow: client can now view the DEVIS document directly from the chat order bar ("Voir le devis" button)
* Quote flow: client gets "Accepter le devis" and "Refuser le devis" buttons when a quote is pending
* Quote flow: fix card order button text — shows "Devis en attente", "En attente de paiement", "Livraison terminée" or "Retouche en cours" instead of generic "Commande en cours..."
* Quote flow: invoice view endpoint now allows clients to view quote documents (type=quote) regardless of status

= 1.2.2 =
* Admin menu: reorganize with GESTION / PARAMÈTRES separators — centralize all submenu registrations in Dashboard
* Admin menu: replace "Clients WP" with "Clients" (external clients from clielo_clients table)
* Admin menu: add "Devis" page listing pending quote orders and generated DEVIS-XXX documents
* Quote flow: add toast notification on client quote submission
* Quote flow: admin bell notification when a client submits a quote
* Quote flow: add "Générer le devis" button (premium) — creates DEVIS-XXX document in invoices table, posts link in chat
* Quote flow: rename "Approuver" → "Devis accepté" — transitions quote→pending, posts approval message in chat, sends client in-app notification

= 1.2.0 =
* Elementor widget: add "Clielo — Cloche" widget for notification bell — style controls for icon color/size, badge color, panel background/radius/width and "Mark all read" link color
* Elementor widget: add "Clielo — Compte" widget for login/avatar button — style controls for avatar size/border, dropdown background/radius/width, login & register button colors/typography/radius
* Notifications shortcode: add CSS classes (clielo-nb-icon, clielo-nb-badge, clielo-nb-drop, clielo-nb-readall) to enable Elementor override
* Account shortcode: add CSS classes (clielo-acct-login, clielo-acct-register, clielo-acct-wrap, clielo-acct-toggle, clielo-acct-drop) to enable Elementor override

= 1.1.0 =
* Elementor widget: add "En-tête" style section — background color, text color and Typography group for the "Options de service" header bar

= 1.0.9 =
* Elementor widget: reorganize Style tab — pack name/price/delay/features/border-radius/states all in one "Packs" section
* Elementor widget: add "Options avancées" section — Typography + color for title, price/unit and icon color
* Elementor widget: add "Case à cocher" color control (accent-color) in Options supplémentaires
* Elementor widget: add Typography group controls for all Récapitulatif text elements (sous-total, total label, total value, delay label, delay value)
* Service card: footer text elements use CSS classes — Elementor Typography controls can now override all footer text

= 1.0.8 =
* Elementor widget: footer recap (subtotal, TVA, total, order button) now visible in Elementor editor/preview mode even when logged in as admin
* Elementor widget: floating chat button now visible in Elementor editor/preview mode, including on non-service pages where the widget is placed
* Elementor widget: plugin CSS assets loaded in Elementor preview so all styles apply correctly during editing

= 1.0.7 =
* Elementor widget: full Typography group controls (font family, style, weight, size, transform, line-height, letter-spacing) for all text elements — section labels, pack names/prices/delays, features, option names/prices, order button
* Elementor widget: pack card states now fully customizable — separate Default, Hover and Selected controls (background + border each)
* Service card: footer recap no longer sticky on desktop — sticky only on mobile (≤768 px)
* Fix chat button color: Elementor controls now correctly override PHP defaults via higher-specificity selectors

= 1.0.6 =
* Elementor widget: add comprehensive style controls for all service card elements — section labels, pack state (selected/unselected bg + border), option prices, footer recap (background, separators, subtotal, total, delay)
* Elementor widget: JS pack switching now uses CSS variables — pack colors update live when Elementor controls change
* Elementor widget: all new controls update live in Elementor editor with zero PHP re-render

= 1.0.5 =
* Elementor widget: add style controls for chat button (color, size, radius) and chat popup (background, radius, width, height)
* Elementor widget: chat button and popup now use CSS variables — controls update live in Elementor editor via :root selectors

= 1.0.4 =
* Elementor widget: live preview now works correctly for all style controls (CSS variables via style tag, overridable by Elementor selectors)
* Elementor widget: add comprehensive style controls — card background, pack name/price typography, features, options, button (color, size, weight, radius)
* Elementor widget: fix border radius controls (card and button) now apply correctly

= 1.0.3 =
* Elementor widget: color override now updates live in editor via CSS variables
* Elementor widget: service options auto-detect current post, no manual ID needed

= 1.0.2 =
* Fix UTF-8 BOM in PHP files causing Freemius license activation to fail

= 1.0.1 =
* Add Elementor widget for service options (packs, options, order button toggle)
* Premium features now unlock instantly via license key activation (no separate zip required)
* Rename all internal identifiers from serviceflow to clielo

= 1.0.0 =
* Initial public release

== Upgrade Notice ==

= 1.0.0 =
Initial public release.
