{"id":3314,"date":"2025-02-18T09:24:42","date_gmt":"2025-02-18T08:24:42","guid":{"rendered":"https:\/\/www.whatthefit.fr\/?page_id=3314"},"modified":"2025-02-18T09:24:49","modified_gmt":"2025-02-18T08:24:49","slug":"validation-des-entrees","status":"publish","type":"page","link":"https:\/\/www.whatthefit.fr\/index.php\/validation-des-entrees\/","title":{"rendered":"Validation des entr\u00e9es"},"content":{"rendered":"\n    <form id=\"wtf-validation-form\" style=\"margin-bottom:20px;\">\n        <label for=\"commande_id\" style=\"display:block; margin-bottom:5px;\">Num\u00e9ro de commande :<\/label>\n        <input type=\"text\" id=\"commande_id\" name=\"commande_id\" required style=\"padding:8px; font-size:16px; width:200px;\">\n        <button type=\"submit\" style=\"padding:8px 16px; font-size:16px; margin-left:10px;\">V\u00e9rifier<\/button>\n    <\/form>\n\n    <div id=\"wtf-resultat\"><\/div>\n\n    <script>\n    document.addEventListener(\"DOMContentLoaded\", function () {\n        const form = document.getElementById(\"wtf-validation-form\");\n        if (!form) return;\n\n        form.addEventListener(\"submit\", function (event) {\n            event.preventDefault();\n            const commandeId = document.getElementById(\"commande_id\").value.trim();\n            const resultDiv  = document.getElementById(\"wtf-resultat\");\n            resultDiv.innerHTML = \"\u23f3 V\u00e9rification en cours...\";\n\n\/\/ V\u00e9rifier\nfetch(\"https:\/\/www.whatthefit.fr\/wp-json\/wtf\/v1\/verifier-commande\/\" + commandeId)\n                .then(response => response.json())\n                .then(data => {\n                    if (data.status !== 'ready') {\n                        resultDiv.innerHTML = `<p style=\"color:red;\">${data.message}<\/p>`;\n                        return;\n                    }\n\n                    \/\/ \u2705 Nouveau rendu apr\u00e8s \/verifier-commande\n                    resultDiv.innerHTML = `\n                      <h3>\ud83d\udc64 ${data.client}<\/h3>\n                      <p><strong>\ud83d\udcb3 Paiement :<\/strong> ${data.paiement}<\/p>\n                      <p><strong>\ud83e\uddfe Produit :<\/strong> ${data.type_produit ? data.type_produit : '\u2014'}<\/p>\n                      <p id=\"wtf-entrees\"><strong>\ud83c\udf9f\ufe0f Entr\u00e9es restantes :<\/strong> ${typeof data.entrees !== 'undefined' ? data.entrees : '\u2014'}<\/p>\n                      ${data.requiert_unites ? '' : `<p style=\"color:#555;\"><em>\u2139\ufe0f Abonnement\/forfait : pas d\u2019unit\u00e9s \u00e0 d\u00e9cr\u00e9menter.<\/em><\/p>`}\n                      <div id=\"historique\">\n                        <h4>\ud83d\udcdc Historique :<\/h4>\n                        <ul>${(data.historique || []).slice().reverse().map(h => `<li>${h}<\/li>`).join('')}<\/ul>\n                      <\/div>\n                      ${data.requiert_unites ? `\n                        <button id=\"valider-btn\" style=\"\n                          margin-top:15px;\n                          padding:10px 20px;\n                          font-size:16px;\n                          background:#111;\n                          color:white;\n                          border:none;\n                          border-radius:6px;\n                          cursor:pointer;\n                        \">Valider l\u2019entr\u00e9e<\/button>\n                        <div id=\"wtf-message\" style=\"margin-top:12px;\"><\/div>\n                      ` : ''}\n                    `;\n\n                    \/\/ \u2705 Handler du bouton uniquement s'il existe\n                    const validerBtn = document.getElementById(\"valider-btn\");\n                    const messageBox = document.getElementById(\"wtf-message\");\n\n                    if (validerBtn) {\n                      validerBtn.addEventListener(\"click\", function () {\n                  \/\/ Valider\n\/\/ Valider\nfetch(\"https:\/\/www.whatthefit.fr\/wp-json\/wtf\/v1\/valider-entree\/\" + commandeId, { method: 'POST' })\n                          .then(res => res.json())\n                          .then(validation => {\n                            const ok = validation.status === 'success';\n                            if (messageBox) {\n                              messageBox.innerHTML = `<p style=\"font-weight:bold;color:${ok ? 'green' : 'red'};\">${validation.message || ''}<\/p>`;\n                            }\n\n                            \/\/ MAJ compteur si dispo\n                            if (typeof validation.entrees !== 'undefined') {\n                              const countEl = document.getElementById(\"wtf-entrees\");\n                              if (countEl) countEl.innerHTML = `<strong>\ud83c\udf9f\ufe0f Entr\u00e9es restantes :<\/strong> ${validation.entrees}`;\n                            }\n\/\/ MAJ date de validit\u00e9 si renvoy\u00e9e\nif (validation.date_validite_display) {\n  const v = document.getElementById('wtf-validite');\n  if (v) v.textContent = validation.date_validite_display;\n}\n                            \/\/ MAJ historique si dispo\n                            if (validation.historique && validation.historique.length) {\n                              const histDiv = document.getElementById(\"historique\");\n                              if (histDiv) {\n                                const list = validation.historique.slice().reverse().map(h => `<li>${h}<\/li>`).join('');\n                                histDiv.innerHTML = `<h4>\ud83d\udcdc Historique :<\/h4><ul>${list}<\/ul>`;\n                              }\n                            }\n                          })\n                          .catch(() => {\n                            if (messageBox) {\n                              messageBox.innerHTML = `<p style=\"color:red;\">\u274c Erreur lors de la validation.<\/p>`;\n                            }\n                          });\n                      });\n                    }\n                })\n                .catch(error => {\n                    console.error(\"Erreur :\", error);\n                    resultDiv.innerHTML = \"<p style='color:red;'>\u274c Erreur lors de la v\u00e9rification.<\/p>\";\n                });\n        });\n    });\n    <\/script>\n\n    \n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_uag_custom_page_level_css":"","footnotes":""},"class_list":["post-3314","page","type-page","status-publish","hentry","entry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Validation des entr\u00e9es - What the Fit<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.whatthefit.fr\/index.php\/validation-des-entrees\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Validation des entr\u00e9es - What the Fit\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.whatthefit.fr\/index.php\/validation-des-entrees\/\" \/>\n<meta property=\"og:site_name\" content=\"What the Fit\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/AdminWTFit\/\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-18T08:24:49+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.whatthefit.fr\\\/index.php\\\/validation-des-entrees\\\/\",\"url\":\"https:\\\/\\\/www.whatthefit.fr\\\/index.php\\\/validation-des-entrees\\\/\",\"name\":\"Validation des entr\u00e9es - What the Fit\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.whatthefit.fr\\\/#website\"},\"datePublished\":\"2025-02-18T08:24:42+00:00\",\"dateModified\":\"2025-02-18T08:24:49+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.whatthefit.fr\\\/index.php\\\/validation-des-entrees\\\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.whatthefit.fr\\\/index.php\\\/validation-des-entrees\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.whatthefit.fr\\\/index.php\\\/validation-des-entrees\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.whatthefit.fr\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Validation des entr\u00e9es\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.whatthefit.fr\\\/#website\",\"url\":\"https:\\\/\\\/www.whatthefit.fr\\\/\",\"name\":\"What the Fit\",\"description\":\"May the Fit be With You !\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.whatthefit.fr\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.whatthefit.fr\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.whatthefit.fr\\\/#organization\",\"name\":\"WTF - What the Fit\",\"url\":\"https:\\\/\\\/www.whatthefit.fr\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/www.whatthefit.fr\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.whatthefit.fr\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/Copie-de-Logo-Flo-VF-Noir.png\",\"contentUrl\":\"https:\\\/\\\/www.whatthefit.fr\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/Copie-de-Logo-Flo-VF-Noir.png\",\"width\":1079,\"height\":1419,\"caption\":\"WTF - What the Fit\"},\"image\":{\"@id\":\"https:\\\/\\\/www.whatthefit.fr\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/AdminWTFit\\\/\",\"https:\\\/\\\/www.instagram.com\\\/wtfwhatthefitaix\\\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Validation des entr\u00e9es - What the Fit","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.whatthefit.fr\/index.php\/validation-des-entrees\/","og_locale":"fr_FR","og_type":"article","og_title":"Validation des entr\u00e9es - What the Fit","og_url":"https:\/\/www.whatthefit.fr\/index.php\/validation-des-entrees\/","og_site_name":"What the Fit","article_publisher":"https:\/\/www.facebook.com\/AdminWTFit\/","article_modified_time":"2025-02-18T08:24:49+00:00","twitter_card":"summary_large_image","twitter_misc":{"Dur\u00e9e de lecture estim\u00e9e":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.whatthefit.fr\/index.php\/validation-des-entrees\/","url":"https:\/\/www.whatthefit.fr\/index.php\/validation-des-entrees\/","name":"Validation des entr\u00e9es - What the Fit","isPartOf":{"@id":"https:\/\/www.whatthefit.fr\/#website"},"datePublished":"2025-02-18T08:24:42+00:00","dateModified":"2025-02-18T08:24:49+00:00","breadcrumb":{"@id":"https:\/\/www.whatthefit.fr\/index.php\/validation-des-entrees\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.whatthefit.fr\/index.php\/validation-des-entrees\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.whatthefit.fr\/index.php\/validation-des-entrees\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.whatthefit.fr\/"},{"@type":"ListItem","position":2,"name":"Validation des entr\u00e9es"}]},{"@type":"WebSite","@id":"https:\/\/www.whatthefit.fr\/#website","url":"https:\/\/www.whatthefit.fr\/","name":"What the Fit","description":"May the Fit be With You !","publisher":{"@id":"https:\/\/www.whatthefit.fr\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.whatthefit.fr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/www.whatthefit.fr\/#organization","name":"WTF - What the Fit","url":"https:\/\/www.whatthefit.fr\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/www.whatthefit.fr\/#\/schema\/logo\/image\/","url":"https:\/\/www.whatthefit.fr\/wp-content\/uploads\/2022\/09\/Copie-de-Logo-Flo-VF-Noir.png","contentUrl":"https:\/\/www.whatthefit.fr\/wp-content\/uploads\/2022\/09\/Copie-de-Logo-Flo-VF-Noir.png","width":1079,"height":1419,"caption":"WTF - What the Fit"},"image":{"@id":"https:\/\/www.whatthefit.fr\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/AdminWTFit\/","https:\/\/www.instagram.com\/wtfwhatthefitaix\/"]}]}},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"ocean-thumb-m":false,"ocean-thumb-ml":false,"ocean-thumb-l":false,"mailpoet_newsletter_max":false,"woocommerce_thumbnail":false,"woocommerce_single":false,"woocommerce_gallery_thumbnail":false},"uagb_author_info":{"display_name":"Admin1944","author_link":"https:\/\/www.whatthefit.fr\/index.php\/author\/admin1944\/"},"uagb_comment_info":0,"uagb_excerpt":null,"_links":{"self":[{"href":"https:\/\/www.whatthefit.fr\/index.php\/wp-json\/wp\/v2\/pages\/3314","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.whatthefit.fr\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.whatthefit.fr\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.whatthefit.fr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.whatthefit.fr\/index.php\/wp-json\/wp\/v2\/comments?post=3314"}],"version-history":[{"count":1,"href":"https:\/\/www.whatthefit.fr\/index.php\/wp-json\/wp\/v2\/pages\/3314\/revisions"}],"predecessor-version":[{"id":3315,"href":"https:\/\/www.whatthefit.fr\/index.php\/wp-json\/wp\/v2\/pages\/3314\/revisions\/3315"}],"wp:attachment":[{"href":"https:\/\/www.whatthefit.fr\/index.php\/wp-json\/wp\/v2\/media?parent=3314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}