diff --git a/.tx/index.php b/.tx/index.php
deleted file mode 100644
index cd6990e..0000000
--- a/.tx/index.php
+++ /dev/null
@@ -1,2 +0,0 @@
-
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * Library javascript to enable Browser notifications
+ */
+
+/**
+ * \file js/dolicar.js
+ * \ingroup dolicar
+ * \brief JavaScript file for module DoliCar
+ */
/**
* @namespace Saturne_Framework_Init
*
- * @author Evarisk
- * @copyright 2015-2023 Evarisk
+ * @author Evarisk
+ * @copyright 2021-2024 Evarisk
*/
-if ( ! window.dolicar ) {
- /**
- * [dolicar description]
- *
- * @memberof Saturne_Framework_Init
- *
- * @type {Object}
- */
- window.dolicar = {};
-
- /**
- * [scriptsLoaded description]
- *
- * @memberof Saturne_Framework_Init
- *
- * @type {Boolean}
- */
- window.dolicar.scriptsLoaded = false;
-}
-
-if ( ! window.dolicar.scriptsLoaded ) {
- /**
- * [description]
- *
- * @memberof Saturne_Framework_Init
- *
- * @returns {void} [description]
- */
- window.dolicar.init = function() {
- window.dolicar.load_list_script();
- };
+'use strict';
- /**
- * [description]
- *
- * @memberof Saturne_Framework_Init
- *
- * @returns {void} [description]
- */
- window.dolicar.load_list_script = function() {
- if ( ! window.dolicar.scriptsLoaded) {
- var key = undefined, slug = undefined;
- for ( key in window.dolicar ) {
+if (!window.dolicar) {
+ /**
+ * Init Dolicar JS
+ *
+ * @memberof Saturne_Framework_Init
+ *
+ * @since 1.0.0
+ * @version 1.2.0
+ *
+ * @type {Object}
+ */
+ window.dolicar = {};
- if ( window.dolicar[key].init ) {
- window.dolicar[key].init();
- }
-
- for ( slug in window.dolicar[key] ) {
+ /**
+ * Init load script dolicar JS
+ *
+ * @memberof Saturne_Framework_Init
+ *
+ * @since 1.0.0
+ * @version 1.2.0
+ *
+ * @type {Boolean}
+ */
+ window.dolicar.scriptsLoaded = false;
+}
- if ( window.dolicar[key] && window.dolicar[key][slug] && window.dolicar[key][slug].init ) {
- window.dolicar[key][slug].init();
- }
+if (!window.dolicar.scriptsLoaded) {
+ /**
+ * Dolicar init
+ *
+ * @memberof Saturne_Framework_Init
+ *
+ * @since 1.0.0
+ * @version 1.2.0
+ *
+ * @returns {void}
+ */
+ window.dolicar.init = function() {
+ window.dolicar.load_list_script();
+ };
- }
- }
+ /**
+ * Load script/module of dolicar
+ *
+ * @memberof Saturne_Framework_Init
+ *
+ * @since 1.0.0
+ * @version 1.2.0
+ *
+ * @returns {void}
+ */
+ window.dolicar.load_list_script = function() {
+ if (!window.dolicar.scriptsLoaded) {
+ for (let key in window.dolicar) {
+ if (window.dolicar.hasOwnProperty(key) && typeof window.dolicar[key] === 'object') {
+ if (typeof window.dolicar[key].init === 'function') {
+ window.dolicar[key].init();
+ }
- window.dolicar.scriptsLoaded = true;
- }
- };
+ for (let slug in window.dolicar[key]) {
+ if (window.dolicar[key].hasOwnProperty(slug) && typeof window.dolicar[key][slug] === 'object' && typeof window.dolicar[key][slug].init === 'function') {
+ window.dolicar[key][slug].init();
+ }
+ }
+ }
+ }
- /**
- * [description]
- *
- * @memberof Saturne_Framework_Init
- *
- * @returns {void} [description]
- */
- window.dolicar.refresh = function() {
- var key = undefined;
- var slug = undefined;
- for ( key in window.dolicar ) {
- if ( window.dolicar[key].refresh ) {
- window.dolicar[key].refresh();
- }
+ window.dolicar.scriptsLoaded = true;
+ }
+ };
- for ( slug in window.dolicar[key] ) {
+ /**
+ * Reload script/module of dolicar
+ *
+ * @memberof Saturne_Framework_Init
+ *
+ * @returns {void}
+ */
+ window.dolicar.refresh = function() {
+ for (let key in window.dolicar) {
+ if (window.dolicar.hasOwnProperty(key) && typeof window.dolicar[key] === 'object') {
+ if (typeof window.dolicar[key].refresh === 'function') {
+ window.dolicar[key].refresh();
+ }
- if ( window.dolicar[key] && window.dolicar[key][slug] && window.dolicar[key][slug].refresh ) {
- window.dolicar[key][slug].refresh();
- }
- }
- }
- };
+ for (let slug in window.dolicar[key]) {
+ if (window.dolicar[key].hasOwnProperty(slug) && window.dolicar[key][slug] && typeof window.dolicar[key][slug].refresh === 'function') {
+ window.dolicar[key][slug].refresh();
+ }
+ }
+ }
+ }
+ };
- $( document ).ready( window.dolicar.init );
+ $(document).ready(window.dolicar.init);
}
-
diff --git a/js/dolicar.min.js b/js/dolicar.min.js
index 331a75e..5f2c832 100644
--- a/js/dolicar.min.js
+++ b/js/dolicar.min.js
@@ -1 +1 @@
-window.dolicar||(window.dolicar={},window.dolicar.scriptsLoaded=!1),window.dolicar.scriptsLoaded||(window.dolicar.init=function(){window.dolicar.load_list_script()},window.dolicar.load_list_script=function(){if(!window.dolicar.scriptsLoaded){var i=void 0,t=void 0;for(i in window.dolicar)for(t in window.dolicar[i].init&&window.dolicar[i].init(),window.dolicar[i])window.dolicar[i]&&window.dolicar[i][t]&&window.dolicar[i][t].init&&window.dolicar[i][t].init();window.dolicar.scriptsLoaded=!0}},window.dolicar.refresh=function(){var i=void 0,t=void 0;for(i in window.dolicar)for(t in window.dolicar[i].refresh&&window.dolicar[i].refresh(),window.dolicar[i])window.dolicar[i]&&window.dolicar[i][t]&&window.dolicar[i][t].refresh&&window.dolicar[i][t].refresh()},$(document).ready(window.dolicar.init)),window.dolicar.registrationcertificate={},window.dolicar.registrationcertificate.init=function(){window.dolicar.registrationcertificate.event()},window.dolicar.registrationcertificate.event=function(){$(document).on("change","#fk_product",window.dolicar.registrationcertificate.actualizeBrand),$(document).on("change","#fk_product",window.dolicar.registrationcertificate.actualizeProductlot),$(document).ready(()=>{$(document).find(".field_fk_soc .butActionNew").attr("target","_blank"),$(document).find(".field_fk_project .butActionNew").attr("target","_blank")})},window.dolicar.registrationcertificate.actualizeBrand=function(i){var t=$('input[name="token"]').val(),o=document.getElementById("registrationcertificatefr_create")?document.getElementById("registrationcertificatefr_create"):document.getElementById("registrationcertificatefr_edit"),o=new FormData(o).get("fk_product"),e=window.saturne.toolbox.getQuerySeparator(document.URL);$.ajax({url:document.URL+e+"subaction=getProductBrand&token="+t,data:JSON.stringify({productId:o}),type:"POST",processData:!1,contentType:!1,success:function(i){$("#d1_vehicle_brand").attr("value",$(i).find(".car-brand").val()),$("#d1_vehicle_brand").prop("readonly",!0)}})},window.dolicar.registrationcertificate.actualizeProductlot=function(i){var t=$('input[name="token"]').val(),o=document.getElementById("registrationcertificatefr_create")?document.getElementById("registrationcertificatefr_create"):document.getElementById("registrationcertificatefr_edit"),o=new FormData(o),e=o.get("fk_product");let r=o.get("action");"update"==r&&(r="edit");o=window.saturne.toolbox.getQuerySeparator(document.URL);window.saturne.loader.display($(".lot-content")),$.ajax({url:document.URL+o+"action="+r+"&fk_product="+e+"&token="+t,type:"POST",processData:!1,contentType:!1,success:function(i){$(".lot-container").html($(i).find(".lot-content")),$(".wpeo-loader").removeClass("wpeo-loader")}})};
\ No newline at end of file
+"use strict";window.dolicar||(window.dolicar={},window.dolicar.scriptsLoaded=!1),window.dolicar.scriptsLoaded||(window.dolicar.init=function(){window.dolicar.load_list_script()},window.dolicar.load_list_script=function(){if(!window.dolicar.scriptsLoaded){for(var t in window.dolicar)if(window.dolicar.hasOwnProperty(t)&&"object"==typeof window.dolicar[t])for(var o in"function"==typeof window.dolicar[t].init&&window.dolicar[t].init(),window.dolicar[t])window.dolicar[t].hasOwnProperty(o)&&"object"==typeof window.dolicar[t][o]&&"function"==typeof window.dolicar[t][o].init&&window.dolicar[t][o].init();window.dolicar.scriptsLoaded=!0}},window.dolicar.refresh=function(){for(var t in window.dolicar)if(window.dolicar.hasOwnProperty(t)&&"object"==typeof window.dolicar[t])for(var o in"function"==typeof window.dolicar[t].refresh&&window.dolicar[t].refresh(),window.dolicar[t])window.dolicar[t].hasOwnProperty(o)&&window.dolicar[t][o]&&"function"==typeof window.dolicar[t][o].refresh&&window.dolicar[t][o].refresh()},$(document).ready(window.dolicar.init)),window.dolicar.registrationcertificate={},window.dolicar.registrationcertificate.init=function(){window.dolicar.registrationcertificate.event()},window.dolicar.registrationcertificate.event=function(){$(document).on("change","#fk_product",window.dolicar.registrationcertificate.actualizeBrand),$(document).on("change","#fk_product",window.dolicar.registrationcertificate.actualizeProductlot),$(document).ready(()=>{$(document).find(".field_fk_soc .butActionNew").attr("target","_blank"),$(document).find(".field_fk_project .butActionNew").attr("target","_blank")})},window.dolicar.registrationcertificate.actualizeBrand=function(){var t=window.saturne.toolbox.getToken(),o=window.saturne.toolbox.getQuerySeparator(document.URL),i=document.getElementById("registrationcertificatefr_create")?document.getElementById("registrationcertificatefr_create"):document.getElementById("registrationcertificatefr_edit"),i=new FormData(i).get("fk_product");$.ajax({url:document.URL+o+"subaction=getProductBrand&token="+t,data:JSON.stringify({productId:i}),type:"POST",processData:!1,contentType:!1,success:function(t){var o=$("#d1_vehicle_brand");o.attr("value",$(t).find(".car-brand").val()),o.prop("readonly",!0)}})},window.dolicar.registrationcertificate.actualizeProductlot=function(){var t=window.saturne.toolbox.getToken(),o=window.saturne.toolbox.getQuerySeparator(document.URL),i=document.getElementById("registrationcertificatefr_create")?document.getElementById("registrationcertificatefr_create"):document.getElementById("registrationcertificatefr_edit"),i=new FormData(i),e=i.get("fk_product");let r=i.get("action");"update"===r&&(r="edit"),window.saturne.loader.display($(".lot-content")),$.ajax({url:document.URL+o+"action="+r+"&fk_product="+e+"&token="+t,type:"POST",processData:!1,contentType:!1,success:function(t){$(".lot-container").html($(t).find(".lot-content")),$(".wpeo-loader").removeClass("wpeo-loader")}})};
\ No newline at end of file
diff --git a/js/index.php b/js/index.php
new file mode 100644
index 0000000..17927e6
--- /dev/null
+++ b/js/index.php
@@ -0,0 +1,2 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * Library javascript to enable Browser notifications
+ */
+
+/**
+ * \file js/modules/registrationcertificate.js
+ * \ingroup dolicar
+ * \brief JavaScript Registration Certificate file for module DoliCar
+ */
+
+'use strict';
+
/**
- * Initialise l'objet "registrationcertificate" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS.
+ * Init registrationcertificate JS
+ *
+ * @memberof DoliCar_RegistrationCertificate
*
* @since 1.0.0
- * @version 1.0.0
+ * @version 1.2.0
+ *
+ * @type {Object}
*/
window.dolicar.registrationcertificate = {};
/**
- * La méthode appelée automatiquement par la bibliothèque EoxiaJS.
+ * RegistrationCertificate init
+ *
+ * @memberof DoliCar_RegistrationCertificate
*
* @since 1.0.0
- * @version 1.0.0
+ * @version 1.2.0
*
* @return {void}
*/
window.dolicar.registrationcertificate.init = function() {
- window.dolicar.registrationcertificate.event();
+ window.dolicar.registrationcertificate.event();
};
/**
- * La méthode contenant tous les événements pour le migration.
+ * RegistrationCertificate event
*
* @since 1.0.0
- * @version 9.0.0
+ * @version 1.2.0
*
* @return {void}
*/
window.dolicar.registrationcertificate.event = function() {
- $( document ).on( 'change', '#fk_product', window.dolicar.registrationcertificate.actualizeBrand );
- $( document ).on( 'change', '#fk_product', window.dolicar.registrationcertificate.actualizeProductlot );
- $( document ).ready(() => {
- $(document).find('.field_fk_soc .butActionNew').attr('target', '_blank')
- $(document).find('.field_fk_project .butActionNew').attr('target', '_blank')
- })
-
-}
-
+ $(document).on('change', '#fk_product', window.dolicar.registrationcertificate.actualizeBrand);
+ $(document).on('change', '#fk_product', window.dolicar.registrationcertificate.actualizeProductlot);
+ $(document).ready(() => {
+ $(document).find('.field_fk_soc .butActionNew').attr('target', '_blank');
+ $(document).find('.field_fk_project .butActionNew').attr('target', '_blank');
+ });
+};
/**
* Actualize brand input
*
* @since 0.0.2
- * @version 0.0.2
+ * @version 1.2.0
*
* @return {void}
*/
-window.dolicar.registrationcertificate.actualizeBrand = function( event ) {
-
- let token = $('input[name="token"]').val();
+window.dolicar.registrationcertificate.actualizeBrand = function() {
+ let token = window.saturne.toolbox.getToken();
+ let querySeparator = window.saturne.toolbox.getQuerySeparator(document.URL);
- var form = document.getElementById('registrationcertificatefr_create')? document.getElementById('registrationcertificatefr_create') : document.getElementById('registrationcertificatefr_edit')
- var formData = new FormData(form);
- let productId = formData.get('fk_product');
- let querySeparator = window.saturne.toolbox.getQuerySeparator(document.URL)
+ const form = document.getElementById('registrationcertificatefr_create') ? document.getElementById('registrationcertificatefr_create') : document.getElementById('registrationcertificatefr_edit');
+ const formData = new FormData(form);
+ let productId = formData.get('fk_product');
- $.ajax({
- url: document.URL + querySeparator + 'subaction=getProductBrand&token='+token,
- data: JSON.stringify({
- productId: productId,
- }),
- type: "POST",
- processData: false,
- contentType: false,
- success: function ( resp ) {
- $('#d1_vehicle_brand').attr('value', $(resp).find('.car-brand').val())
- $('#d1_vehicle_brand').prop("readonly", true)
- },
- });
+ $.ajax({
+ url: document.URL + querySeparator + 'subaction=getProductBrand&token='+token,
+ data: JSON.stringify({
+ productId: productId,
+ }),
+ type: 'POST',
+ processData: false,
+ contentType: false,
+ success: function (resp) {
+ let vehicleBrand = $('#d1_vehicle_brand');
+ vehicleBrand.attr('value', $(resp).find('.car-brand').val());
+ vehicleBrand.prop("readonly", true);
+ },
+ });
};
/**
- * Actualize productlot selector
+ * Actualize product lot selector
*
* @since 0.0.2
- * @version 0.0.2
+ * @version 1.2.0
*
* @return {void}
*/
-window.dolicar.registrationcertificate.actualizeProductlot = function( event ) {
-
- let token = $('input[name="token"]').val();
-
- var form = document.getElementById('registrationcertificatefr_create')? document.getElementById('registrationcertificatefr_create') : document.getElementById('registrationcertificatefr_edit')
- var formData = new FormData(form);
- let productId = formData.get('fk_product');
- let action = formData.get('action');
+window.dolicar.registrationcertificate.actualizeProductlot = function() {
+ let token = window.saturne.toolbox.getToken();
+ let querySeparator = window.saturne.toolbox.getQuerySeparator(document.URL);
- if (action == 'update') {
- action = 'edit';
- }
+ const form = document.getElementById('registrationcertificatefr_create') ? document.getElementById('registrationcertificatefr_create') : document.getElementById('registrationcertificatefr_edit');
+ const formData = new FormData(form);
+ let productId = formData.get('fk_product');
+ let action = formData.get('action');
- let querySeparator = window.saturne.toolbox.getQuerySeparator(document.URL)
+ if (action === 'update') {
+ action = 'edit';
+ }
- window.saturne.loader.display($('.lot-content'));
+ window.saturne.loader.display($('.lot-content'));
- $.ajax({
- url: document.URL + querySeparator + 'action=' + action + '&fk_product=' + productId + '&token='+token,
- type: "POST",
- processData: false,
- contentType: false,
- success: function ( resp ) {
- $('.lot-container').html($(resp).find('.lot-content'))
- $('.wpeo-loader').removeClass('wpeo-loader');
- },
- });
+ $.ajax({
+ url: document.URL + querySeparator + 'action=' + action + '&fk_product=' + productId + '&token='+token,
+ type: "POST",
+ processData: false,
+ contentType: false,
+ success: function ( resp ) {
+ $('.lot-container').html($(resp).find('.lot-content'));
+ $('.wpeo-loader').removeClass('wpeo-loader');
+ },
+ });
};