Ajout settings visuels
This commit is contained in:
parent
87e80dd93f
commit
70a27f2421
@ -1173,7 +1173,14 @@ class PEPPOL_Plugin {
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public static function get_vat_notice_message(): ?string {
|
||||
/**
|
||||
* Récupère toutes les notices TVA à afficher
|
||||
*
|
||||
* @return array Tableau de notices, chaque notice contient 'message' et 'type' (info, warning, etc.)
|
||||
*/
|
||||
public static function get_vat_notice_message(): array {
|
||||
$notices = [];
|
||||
|
||||
// Vérifier d'abord si un champ TVA client a été détecté
|
||||
$vat_field_key = (string) get_option('esi_peppol_vat_field_key', '');
|
||||
$auto_detected = (bool) get_option('esi_peppol_vat_field_auto_detected', false);
|
||||
@ -1181,35 +1188,45 @@ class PEPPOL_Plugin {
|
||||
// Si aucun champ TVA détecté, proposer la détection dans settings
|
||||
if ($vat_field_key === '' && $auto_detected) {
|
||||
$settings_url = admin_url('admin.php?page=esi-peppol-settings');
|
||||
return sprintf(
|
||||
$notices[] = [
|
||||
'message' => sprintf(
|
||||
/* translators: %s: URL vers la page de réglages */
|
||||
__('Aucun champ TVA client n\'a été détecté automatiquement. Vous pouvez utiliser l\'outil de détection dans <a href="%s">ESI Peppol > Configuration</a> pour rechercher manuellement les champs TVA dans vos commandes.', 'esi_peppol'),
|
||||
esc_url($settings_url)
|
||||
);
|
||||
),
|
||||
'type' => 'warning'
|
||||
];
|
||||
}
|
||||
|
||||
$vat_number = (string) get_option('woocommerce_store_vat_number', '');
|
||||
|
||||
if ($vat_number !== '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Si le numéro de TVA est renseigné, on ne vérifie pas les autres notices liées au TVA
|
||||
if ($vat_number === '') {
|
||||
$api_key = (string) get_option('esi_peppol_api_key', '');
|
||||
$password = (string) get_option('esi_peppol_password', '');
|
||||
|
||||
if ($api_key === '' && $password === '') {
|
||||
// Invitation initiale
|
||||
return __(
|
||||
$notices[] = [
|
||||
'message' => __(
|
||||
'Pour finaliser la mise en place de Peppol, pensez à renseigner le numéro de TVA de la boutique dans WooCommerce > Réglages > Général.',
|
||||
'esi_peppol'
|
||||
);
|
||||
}
|
||||
|
||||
),
|
||||
'type' => 'info'
|
||||
];
|
||||
} else {
|
||||
// Rappel après configuration du connecteur
|
||||
return __(
|
||||
$notices[] = [
|
||||
'message' => __(
|
||||
'Votre connecteur ESI Peppol est configuré, mais le numéro de TVA de la boutique n\'est pas encore renseigné dans WooCommerce > Réglages > Général. Sans ce numéro, les factures Peppol risquent d\'être incomplètes.',
|
||||
'esi_peppol'
|
||||
);
|
||||
),
|
||||
'type' => 'warning'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $notices;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1226,27 +1243,106 @@ class PEPPOL_Plugin {
|
||||
return;
|
||||
}
|
||||
|
||||
$vat_notice_message = self::get_vat_notice_message();
|
||||
$vat_notices = self::get_vat_notice_message();
|
||||
|
||||
if (empty($vat_notice_message)) {
|
||||
if (empty($vat_notices)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$api_key = (string) \get_option('esi_peppol_api_key', '');
|
||||
$password = (string) \get_option('esi_peppol_password', '');
|
||||
$vat_field_key = (string) \get_option('esi_peppol_vat_field_key', '');
|
||||
$auto_detected = (bool) \get_option('esi_peppol_vat_field_auto_detected', false);
|
||||
|
||||
// Si aucun champ TVA détecté, utiliser notice-warning
|
||||
if ($vat_field_key === '' && $auto_detected) {
|
||||
$notice_class = 'notice-warning';
|
||||
} else {
|
||||
$notice_class = ($api_key === '' && $password === '') ? 'notice-info' : 'notice-warning';
|
||||
foreach ($vat_notices as $notice) {
|
||||
$notice_class = 'notice-' . $notice['type'];
|
||||
echo '<div class="notice ' . \esc_attr($notice_class) . '"><p>' .
|
||||
\wp_kses_post($notice['message']) .
|
||||
'</p></div>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '<div class="notice ' . \esc_attr($notice_class) . '"><p>' .
|
||||
\wp_kses_post($vat_notice_message) .
|
||||
'</p></div>';
|
||||
/**
|
||||
* Vérifie l'état de configuration des settings ESI Peppol
|
||||
*
|
||||
* @return array Tableau avec l'état de chaque étape du setup
|
||||
*/
|
||||
public static function check_settings_status(): array {
|
||||
$status = [
|
||||
'vat_number' => [
|
||||
'completed' => false,
|
||||
'value' => '',
|
||||
'label' => __('Numéro de TVA de la boutique', 'esi_peppol'),
|
||||
'description' => __('Le numéro de TVA de votre boutique doit être renseigné dans WooCommerce > Réglages > Général', 'esi_peppol'),
|
||||
'action_url' => admin_url('admin.php?page=wc-settings&tab=general'),
|
||||
'action_label' => __('Configurer dans WooCommerce', 'esi_peppol'),
|
||||
],
|
||||
'vat_field' => [
|
||||
'completed' => false,
|
||||
'value' => '',
|
||||
'label' => __('Champ TVA client', 'esi_peppol'),
|
||||
'description' => __('Le champ utilisé pour récupérer le numéro de TVA du client dans les commandes', 'esi_peppol'),
|
||||
'action_url' => admin_url('admin.php?page=esi-peppol-settings'),
|
||||
'action_label' => __('Détecter le champ TVA', 'esi_peppol'),
|
||||
],
|
||||
'api_credentials' => [
|
||||
'completed' => false,
|
||||
'value' => '',
|
||||
'label' => __('Identifiants API', 'esi_peppol'),
|
||||
'description' => __('Votre clé API et mot de passe pour vous connecter à la plateforme ESI Peppol', 'esi_peppol'),
|
||||
'action_url' => admin_url('admin.php?page=esi-peppol-settings'),
|
||||
'action_label' => __('Configurer les identifiants', 'esi_peppol'),
|
||||
],
|
||||
'webhook' => [
|
||||
'completed' => true, // Toujours disponible
|
||||
'value' => '',
|
||||
'label' => __('URL Webhook', 'esi_peppol'),
|
||||
'description' => __('URL à configurer dans votre profil d\'entreprise sur la plateforme', 'esi_peppol'),
|
||||
'action_url' => admin_url('admin.php?page=esi-peppol-settings'),
|
||||
'action_label' => __('Voir l\'URL webhook', 'esi_peppol'),
|
||||
],
|
||||
'email' => [
|
||||
'completed' => false,
|
||||
'optional' => true,
|
||||
'value' => '',
|
||||
'label' => __('Email de notification', 'esi_peppol'),
|
||||
'description' => __('Adresse email pour recevoir les notifications en cas d\'erreur d\'envoi des factures', 'esi_peppol'),
|
||||
'action_url' => admin_url('admin.php?page=esi-peppol-settings'),
|
||||
'action_label' => __('Configurer l\'email', 'esi_peppol'),
|
||||
],
|
||||
];
|
||||
|
||||
// Vérifier le numéro de TVA de la boutique
|
||||
$vat_number = (string) get_option('woocommerce_store_vat_number', '');
|
||||
if ($vat_number !== '') {
|
||||
$status['vat_number']['completed'] = true;
|
||||
$status['vat_number']['value'] = $vat_number;
|
||||
}
|
||||
|
||||
// Vérifier le champ TVA client
|
||||
$vat_field_key = (string) get_option('esi_peppol_vat_field_key', '');
|
||||
if ($vat_field_key !== '') {
|
||||
$status['vat_field']['completed'] = true;
|
||||
$status['vat_field']['value'] = $vat_field_key;
|
||||
}
|
||||
|
||||
// Vérifier les identifiants API
|
||||
$api_key = (string) get_option('esi_peppol_api_key', '');
|
||||
$password = (string) get_option('esi_peppol_password', '');
|
||||
if ($api_key !== '' && $password !== '') {
|
||||
$status['api_credentials']['completed'] = true;
|
||||
$status['api_credentials']['value'] = substr($api_key, 0, 8) . '...'; // Masquer partiellement
|
||||
}
|
||||
|
||||
// Récupérer l'URL webhook
|
||||
if (class_exists(\ESI_PEPPOL\controllers\PEPPOL_Webhook_controller::class)) {
|
||||
$webhook_url = \ESI_PEPPOL\controllers\PEPPOL_Webhook_controller::get_webhook_url();
|
||||
$status['webhook']['value'] = $webhook_url;
|
||||
}
|
||||
|
||||
// Vérifier l'email
|
||||
$email = (string) get_option('esi_peppol_email', '');
|
||||
if ($email !== '') {
|
||||
$status['email']['completed'] = true;
|
||||
$status['email']['value'] = $email;
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
public static function write_log($message, $level = 'INFO') {
|
||||
|
||||
@ -403,3 +403,221 @@ a.statut:visited {
|
||||
height: 16px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
/* Styles pour le dashboard et le setup guidé */
|
||||
.esi-peppol-dashboard-wrap {
|
||||
max-width: 1200px;
|
||||
}
|
||||
|
||||
.esi-peppol-dashboard-intro {
|
||||
font-size: 15px;
|
||||
color: #50575e;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.esi-peppol-setup-guide {
|
||||
background: #ffffff;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
||||
padding: 32px;
|
||||
margin: 30px 0;
|
||||
}
|
||||
|
||||
.esi-peppol-setup-title {
|
||||
margin: 0 0 32px 0;
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
color: #1d2327;
|
||||
border-bottom: 2px solid #f0f0f1;
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
|
||||
.esi-peppol-setup-step {
|
||||
margin-bottom: 24px;
|
||||
padding: 24px;
|
||||
background: #f9f9f9;
|
||||
border-radius: 8px;
|
||||
border-left: 4px solid #c3c4c7;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.esi-peppol-setup-step:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.esi-peppol-setup-step.completed {
|
||||
background: #f0f9f4;
|
||||
border-left-color: #10b981;
|
||||
}
|
||||
|
||||
.esi-peppol-setup-step.pending {
|
||||
background: #fffbf0;
|
||||
border-left-color: #f59e0b;
|
||||
}
|
||||
|
||||
.esi-peppol-setup-step.esi-peppol-step-no-check {
|
||||
background: #f0f6ff;
|
||||
border-left-color: #3b82f6;
|
||||
}
|
||||
|
||||
.esi-peppol-setup-step.esi-peppol-step-optional {
|
||||
background: #f8f9fa;
|
||||
border-left-color: #9ca3af;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.esi-peppol-step-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.esi-peppol-step-number {
|
||||
flex-shrink: 0;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 50%;
|
||||
background: #ffffff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: #50575e;
|
||||
border: 3px solid #c3c4c7;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.esi-peppol-setup-step.completed .esi-peppol-step-number {
|
||||
background: #10b981;
|
||||
border-color: #10b981;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.esi-peppol-setup-step.pending .esi-peppol-step-number {
|
||||
background: #ffffff;
|
||||
border-color: #f59e0b;
|
||||
color: #f59e0b;
|
||||
}
|
||||
|
||||
.esi-peppol-setup-step.esi-peppol-step-no-check .esi-peppol-step-number {
|
||||
background: #ffffff;
|
||||
border-color: #3b82f6;
|
||||
color: #3b82f6;
|
||||
}
|
||||
|
||||
.esi-peppol-setup-step.esi-peppol-step-optional .esi-peppol-step-number {
|
||||
background: #ffffff;
|
||||
border-color: #9ca3af;
|
||||
color: #9ca3af;
|
||||
}
|
||||
|
||||
.esi-peppol-check-icon {
|
||||
font-size: 28px;
|
||||
line-height: 1;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.esi-peppol-step-content {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.esi-peppol-step-title {
|
||||
margin: 0 0 8px 0;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #1d2327;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.esi-peppol-optional-badge {
|
||||
display: inline-block;
|
||||
padding: 2px 8px;
|
||||
background: #e5e7eb;
|
||||
color: #6b7280;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.esi-peppol-step-description {
|
||||
margin: 0 0 16px 0;
|
||||
font-size: 14px;
|
||||
color: #646970;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.esi-peppol-step-value {
|
||||
margin-top: 12px;
|
||||
padding: 12px;
|
||||
background: #ffffff;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #d1d5db;
|
||||
}
|
||||
|
||||
.esi-peppol-step-value strong {
|
||||
display: block;
|
||||
margin-bottom: 6px;
|
||||
font-size: 13px;
|
||||
color: #374151;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.esi-peppol-step-value code {
|
||||
display: inline-block;
|
||||
padding: 4px 8px;
|
||||
background: #f3f4f6;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 4px;
|
||||
font-family: 'Courier New', Courier, monospace;
|
||||
font-size: 13px;
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.esi-peppol-webhook-display {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin: 16px 0;
|
||||
padding: 12px;
|
||||
background: #ffffff;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #d1d5db;
|
||||
}
|
||||
|
||||
.esi-peppol-webhook-url {
|
||||
flex: 1;
|
||||
padding: 8px 12px;
|
||||
background: #f9fafb;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 4px;
|
||||
font-family: 'Courier New', Courier, monospace;
|
||||
font-size: 13px;
|
||||
color: #1f2937;
|
||||
word-break: break-all;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.esi-peppol-step-note {
|
||||
margin: 12px 0 0 0;
|
||||
font-size: 13px;
|
||||
color: #6b7280;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.esi-peppol-dashboard-actions {
|
||||
margin-top: 40px;
|
||||
padding-top: 30px;
|
||||
border-top: 2px solid #f0f0f1;
|
||||
}
|
||||
|
||||
.esi-peppol-dashboard-actions h2 {
|
||||
margin: 0 0 16px 0;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: #1d2327;
|
||||
}
|
||||
|
||||
@ -507,6 +507,45 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Copier l'URL webhook depuis le dashboard (avec data-copy-text)
|
||||
$(document).on('click', '.esi-peppol-copy-webhook-url[data-copy-text]', function (e) {
|
||||
e.preventDefault();
|
||||
var $btn = $(this);
|
||||
var text = $btn.attr('data-copy-text');
|
||||
|
||||
if (text) {
|
||||
// Utiliser l'API Clipboard moderne si disponible
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
navigator.clipboard.writeText(text).then(function () {
|
||||
var originalText = $btn.text();
|
||||
$btn.text('Copié !');
|
||||
setTimeout(function () {
|
||||
$btn.text(originalText);
|
||||
}, 2000);
|
||||
}).catch(function (err) {
|
||||
console.error('Erreur lors de la copie:', err);
|
||||
});
|
||||
} else {
|
||||
// Fallback pour les anciens navigateurs
|
||||
try {
|
||||
var $temp = $('<textarea>');
|
||||
$('body').append($temp);
|
||||
$temp.val(text).select();
|
||||
document.execCommand('copy');
|
||||
$temp.remove();
|
||||
|
||||
var originalText = $btn.text();
|
||||
$btn.text('Copié !');
|
||||
setTimeout(function () {
|
||||
$btn.text(originalText);
|
||||
}, 2000);
|
||||
} catch (err) {
|
||||
console.error('Erreur lors de la copie:', err);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Gestion de la détection des champs TVA
|
||||
var $detectVatBtn = $('#esi-peppol-detect-vat-fields');
|
||||
var $vatFieldsResult = $('#esi-peppol-vat-fields-result');
|
||||
|
||||
@ -6,40 +6,178 @@ if (!defined('ABSPATH')) {
|
||||
|
||||
/** @var string $settings_url */
|
||||
/** @var string $logs_url */
|
||||
|
||||
// Récupérer l'état des settings
|
||||
$settings_status = \ESI_PEPPOL\controllers\PEPPOL_Plugin::check_settings_status();
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<div class="wrap esi-peppol-dashboard-wrap">
|
||||
<h1><?php esc_html_e('ESI Peppol - Passerelle WooCommerce', 'esi_peppol'); ?></h1>
|
||||
|
||||
<p>
|
||||
<p class="esi-peppol-dashboard-intro">
|
||||
<?php esc_html_e(
|
||||
'Ce plugin permet d\'envoyer vos documents de facturation WooCommerce vers le réseau Peppol.
|
||||
Utilisez les boutons ci-dessous pour configurer la connexion et consulter l\'historique des échanges.',
|
||||
Suivez les étapes ci-dessous pour configurer votre connexion.',
|
||||
'esi_peppol'
|
||||
); ?>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
$vat_notice_message = \ESI_PEPPOL\controllers\PEPPOL_Plugin::get_vat_notice_message();
|
||||
if (!empty($vat_notice_message)) :
|
||||
$api_key = (string) get_option('esi_peppol_api_key', '');
|
||||
$password = (string) get_option('esi_peppol_password', '');
|
||||
$notice_class = ($api_key === '' && $password === '') ? 'notice-info' : 'notice-warning';
|
||||
?>
|
||||
<div class="notice <?php echo esc_attr($notice_class); ?>">
|
||||
<p><?php echo esc_html($vat_notice_message); ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<!-- Setup guidé -->
|
||||
<div class="esi-peppol-setup-guide">
|
||||
<h2 class="esi-peppol-setup-title"><?php esc_html_e('Configuration du connecteur', 'esi_peppol'); ?></h2>
|
||||
|
||||
<!-- Étape 1: Numéro TVA boutique -->
|
||||
<div class="esi-peppol-setup-step <?php echo $settings_status['vat_number']['completed'] ? 'completed' : 'pending'; ?>">
|
||||
<div class="esi-peppol-step-header">
|
||||
<div class="esi-peppol-step-number">
|
||||
<?php if ($settings_status['vat_number']['completed']) : ?>
|
||||
<span class="esi-peppol-check-icon">✓</span>
|
||||
<?php else : ?>
|
||||
<span>1</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="esi-peppol-step-content">
|
||||
<h3 class="esi-peppol-step-title"><?php echo esc_html($settings_status['vat_number']['label']); ?></h3>
|
||||
<p class="esi-peppol-step-description"><?php echo esc_html($settings_status['vat_number']['description']); ?></p>
|
||||
<?php if ($settings_status['vat_number']['completed']) : ?>
|
||||
<div class="esi-peppol-step-value">
|
||||
<strong><?php esc_html_e('Valeur configurée :', 'esi_peppol'); ?></strong>
|
||||
<code><?php echo esc_html($settings_status['vat_number']['value']); ?></code>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<a href="<?php echo esc_url($settings_status['vat_number']['action_url']); ?>" class="button button-primary">
|
||||
<?php echo esc_html($settings_status['vat_number']['action_label']); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Étape 2: Champ TVA client -->
|
||||
<div class="esi-peppol-setup-step <?php echo $settings_status['vat_field']['completed'] ? 'completed' : 'pending'; ?>">
|
||||
<div class="esi-peppol-step-header">
|
||||
<div class="esi-peppol-step-number">
|
||||
<?php if ($settings_status['vat_field']['completed']) : ?>
|
||||
<span class="esi-peppol-check-icon">✓</span>
|
||||
<?php else : ?>
|
||||
<span>2</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="esi-peppol-step-content">
|
||||
<h3 class="esi-peppol-step-title"><?php echo esc_html($settings_status['vat_field']['label']); ?></h3>
|
||||
<p class="esi-peppol-step-description"><?php echo esc_html($settings_status['vat_field']['description']); ?></p>
|
||||
<?php if ($settings_status['vat_field']['completed']) : ?>
|
||||
<div class="esi-peppol-step-value">
|
||||
<strong><?php esc_html_e('Champ détecté :', 'esi_peppol'); ?></strong>
|
||||
<code><?php echo esc_html($settings_status['vat_field']['value']); ?></code>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<a href="<?php echo esc_url($settings_status['vat_field']['action_url']); ?>" class="button button-primary">
|
||||
<?php echo esc_html($settings_status['vat_field']['action_label']); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Étape 3: Identifiants API -->
|
||||
<div class="esi-peppol-setup-step <?php echo $settings_status['api_credentials']['completed'] ? 'completed' : 'pending'; ?>">
|
||||
<div class="esi-peppol-step-header">
|
||||
<div class="esi-peppol-step-number">
|
||||
<?php if ($settings_status['api_credentials']['completed']) : ?>
|
||||
<span class="esi-peppol-check-icon">✓</span>
|
||||
<?php else : ?>
|
||||
<span>3</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="esi-peppol-step-content">
|
||||
<h3 class="esi-peppol-step-title"><?php echo esc_html($settings_status['api_credentials']['label']); ?></h3>
|
||||
<p class="esi-peppol-step-description"><?php echo esc_html($settings_status['api_credentials']['description']); ?></p>
|
||||
<?php if ($settings_status['api_credentials']['completed']) : ?>
|
||||
<div class="esi-peppol-step-value">
|
||||
<strong><?php esc_html_e('Clé API configurée :', 'esi_peppol'); ?></strong>
|
||||
<code><?php echo esc_html($settings_status['api_credentials']['value']); ?></code>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<a href="<?php echo esc_url($settings_status['api_credentials']['action_url']); ?>" class="button button-primary">
|
||||
<?php echo esc_html($settings_status['api_credentials']['action_label']); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Étape 4: Webhook -->
|
||||
<div class="esi-peppol-setup-step esi-peppol-step-no-check">
|
||||
<div class="esi-peppol-step-header">
|
||||
<div class="esi-peppol-step-number">
|
||||
<span>4</span>
|
||||
</div>
|
||||
<div class="esi-peppol-step-content">
|
||||
<h3 class="esi-peppol-step-title"><?php echo esc_html($settings_status['webhook']['label']); ?></h3>
|
||||
<p class="esi-peppol-step-description"><?php echo esc_html($settings_status['webhook']['description']); ?></p>
|
||||
<div class="esi-peppol-webhook-display">
|
||||
<code class="esi-peppol-webhook-url"><?php echo esc_html($settings_status['webhook']['value']); ?></code>
|
||||
<button type="button" class="button button-small esi-peppol-copy-webhook-url" data-copy-text="<?php echo esc_attr($settings_status['webhook']['value']); ?>">
|
||||
<?php esc_html_e('Copier', 'esi_peppol'); ?>
|
||||
</button>
|
||||
</div>
|
||||
<p class="esi-peppol-step-note">
|
||||
<?php
|
||||
printf(
|
||||
wp_kses_post(
|
||||
/* translators: %s: URL de la documentation */
|
||||
__('Configurez cette URL dans votre profil d\'entreprise sur <a href="%s" target="_blank" rel="noopener noreferrer">https://peppol.esi-web.be/</a>', 'esi_peppol')
|
||||
),
|
||||
esc_url('https://peppol.esi-web.be/')
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Étape 5: Email (optionnel) -->
|
||||
<div class="esi-peppol-setup-step esi-peppol-step-optional <?php echo $settings_status['email']['completed'] ? 'completed' : 'pending'; ?>">
|
||||
<div class="esi-peppol-step-header">
|
||||
<div class="esi-peppol-step-number">
|
||||
<?php if ($settings_status['email']['completed']) : ?>
|
||||
<span class="esi-peppol-check-icon">✓</span>
|
||||
<?php else : ?>
|
||||
<span>5</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="esi-peppol-step-content">
|
||||
<h3 class="esi-peppol-step-title">
|
||||
<?php echo esc_html($settings_status['email']['label']); ?>
|
||||
<span class="esi-peppol-optional-badge"><?php esc_html_e('Optionnel', 'esi_peppol'); ?></span>
|
||||
</h3>
|
||||
<p class="esi-peppol-step-description"><?php echo esc_html($settings_status['email']['description']); ?></p>
|
||||
<?php if ($settings_status['email']['completed']) : ?>
|
||||
<div class="esi-peppol-step-value">
|
||||
<strong><?php esc_html_e('Email configuré :', 'esi_peppol'); ?></strong>
|
||||
<code><?php echo esc_html($settings_status['email']['value']); ?></code>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<a href="<?php echo esc_url($settings_status['email']['action_url']); ?>" class="button button-secondary">
|
||||
<?php echo esc_html($settings_status['email']['action_label']); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Actions rapides -->
|
||||
<div class="esi-peppol-dashboard-actions">
|
||||
<h2><?php esc_html_e('Actions rapides', 'esi_peppol'); ?></h2>
|
||||
<p>
|
||||
<a href="<?php echo esc_url($settings_url); ?>" class="button button-primary button-hero">
|
||||
<?php esc_html_e('Configuration du connecteur', 'esi_peppol'); ?>
|
||||
<?php esc_html_e('Configuration avancée', 'esi_peppol'); ?>
|
||||
</a>
|
||||
|
||||
<a href="<?php echo esc_url($logs_url); ?>" class="button button-secondary button-hero" style="margin-left: 10px;">
|
||||
<?php esc_html_e('Journal des envois Peppol', 'esi_peppol'); ?>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ if ($logo_email_id) {
|
||||
<div class="wrap esi-peppol-settings-wrap">
|
||||
<h1><?php esc_html_e('Configuration ESI Peppol', 'esi_peppol'); ?></h1>
|
||||
|
||||
<p>
|
||||
<!-- <p>
|
||||
<?php
|
||||
printf(
|
||||
wp_kses_post(
|
||||
@ -34,19 +34,18 @@ if ($logo_email_id) {
|
||||
esc_url('https://scrada.esiweb.pro/api-demo.html')
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</p> -->
|
||||
|
||||
<?php
|
||||
$vat_notice_message = \ESI_PEPPOL\controllers\PEPPOL_Plugin::get_vat_notice_message();
|
||||
if (!empty($vat_notice_message)) :
|
||||
// Si les identifiants ESI Peppol sont déjà saisis, on passe en notice "warning"
|
||||
$api_key = (string) get_option('esi_peppol_api_key', '');
|
||||
$password = (string) get_option('esi_peppol_password', '');
|
||||
$notice_class = ($api_key === '' && $password === '') ? 'notice-info' : 'notice-warning';
|
||||
$vat_notices = \ESI_PEPPOL\controllers\PEPPOL_Plugin::get_vat_notice_message();
|
||||
if (!empty($vat_notices)) :
|
||||
foreach ($vat_notices as $notice) :
|
||||
$notice_class = 'notice-' . $notice['type'];
|
||||
?>
|
||||
<div class="notice <?php echo esc_attr($notice_class); ?>">
|
||||
<p><?php echo esc_html($vat_notice_message); ?></p>
|
||||
<p><?php echo wp_kses_post($notice['message']); ?></p>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($notice)) : ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user