=== Doli Training Management ===
Contributors: oandrade
Tags: dolibarr, training, catalog, integration, formations
Requires at least: 5.8
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Embed your Dolibarr Training Management catalog in WordPress via a shortcode and a server-side proxy to your own Dolibarr instance.

== Description ==

**Doli Training Management** connects WordPress to **your** Dolibarr instance (with the Training Management module). Site administrators enter the Dolibarr base URL and API key in the plugin settings. Visitors see the training catalog through the `[doli-training-management]` shortcode.

* No calls to the plugin author's servers for catalog data: HTTP requests go only to the Dolibarr URL you configure.
* Optional link to create a hosted Training Management / Ma Gestion Cloud trial account (third-party commercial service); not required to use the plugin with your own Dolibarr.
* Self-hosted fonts (Roboto, Material Icons) bundled with the front-end assets — no Google Fonts CDN.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install through the WordPress Plugins screen.
2. Activate the plugin.
3. Go to **Doli Training** → **Settings** and set your Dolibarr URL and API key.
4. Add `[doli-training-management]` to a page or post.

== Frequently Asked Questions ==

= Where does the plugin send data? =

Catalog and inquiry requests are proxied through WordPress `admin-ajax.php` to the **Dolibarr REST API** at the URL you save in settings, using your API key on the server. The plugin does not send that traffic to the plugin author's infrastructure.

= Why do scripts load only on some pages? =

Front-end JavaScript and CSS load only when the current singular post content contains the `[doli-training-management]` shortcode (for performance). Use `add_filter( 'doli_training_management_force_enqueue_assets', '__return_true' );` if you embed the shortcode outside post content (advanced).

== External services ==

This plugin connects to external services to display catalog data and process training inquiries.

1) **Your Dolibarr instance** (required)
- **Service purpose:** read the training catalog and create inquiry tickets.
- **What is sent / when:** when a visitor loads the widget, the plugin proxies catalog requests to the Dolibarr URL configured by the site administrator. When a visitor submits the inquiry form, the submitted contact fields (name, email, phone/company if provided, message, preferred date/time, selected training identifiers) are sent to that same Dolibarr API endpoint.
- **Service provider:** chosen and configured by the site owner (your own Dolibarr host or managed Dolibarr provider).
- **Terms / privacy:** depend on your Dolibarr provider and hosting contract.

2) **Ma Gestion Cloud signup page** (optional link in admin settings)
- **Service purpose:** optional account creation link for users who want a hosted Training Management / Dolibarr service.
- **What is sent / when:** no background data transfer by the plugin. Data is only sent if an administrator voluntarily clicks the signup link and submits the external form.
- **Terms of service:** https://www.ma-gestion-cloud.fr/conditions-generales-dutilisation-des-services/
- **Privacy policy:** https://www.ma-gestion-cloud.fr/politique-de-confidentialite/

== Screenshots ==

1. Training catalog embedded on the front end.
2. Plugin settings (Dolibarr URL and API key).

== Changelog ==

= 1.0.1 =
* WordPress.org `readme.txt`, uninstall cleanup, conditional front-end assets, nonce on training inquiry AJAX, admin-only error traces, signup URL fix.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.1 =
Maintenance and WordPress.org review alignment.

= 1.0.0 =
Initial release.

== Source code ==

The WordPress plugin PHP lives in this package. The front-end is built with **Angular** from TypeScript / HTML / SCSS sources in the author’s development repository.

**Public Angular source repository:** https://git.aplose-dev.fr/aplose/DolibarrTrainingManagement.git

**Shipped JavaScript:** The files under `assets/doli-training-management/browser/` (including `main.js` and `polyfills.js`) are built with **`npm run build:wordpress`** (optimized/minified distribution build). Human-readable TypeScript / HTML / SCSS sources and build tooling are publicly available in the repository above.

**Third-party front-end libraries** (npm): Angular, Angular Material, RxJS, ngx-translate, Zone.js, tslib, and **Fontsource** packages `@fontsource/roboto` and `@fontsource/material-icons` (font files under Apache 2.0 / SIL OFL as per each package). See each package’s `LICENSE` in `node_modules` when developing from source.

== Build (regenerate browser assets) ==

From the Angular project root (same machine as your clone of the plugin sources):

1. Install dependencies: `npm ci` (use `npm ci --legacy-peer-deps` if npm reports peer dependency conflicts).
2. Optimized distribution build (used for WordPress.org package): `npm run build:wordpress`
3. Optional default production build: `npm run build`

Output is written to `wp-content/plugins/doli-training-management/assets/doli-training-management/` in this repository layout.
