diff --git a/resources/pot/retailcrm-es_ES.pot b/resources/pot/retailcrm-es_ES.pot
index 23a3f66..9def175 100644
--- a/resources/pot/retailcrm-es_ES.pot
+++ b/resources/pot/retailcrm-es_ES.pot
@@ -274,3 +274,5 @@ msgstr "Introduce el número de teléfono correcto"
msgid "You can export all orders and customers from CMS to Simla.com by clicking the «Upload» button. This process can take much time and before it is completed, you need to keep the tab open."
msgstr "Presionando el botón «Exportar» puedes descargar a todos los pedidos y clientes de CMS a Simla.com. Este proceso puede llevar mucho tiempo y es necesario mantener abierta la pestaña hasta que termine el proceso."
+msgid "Debug information"
+msgstr "Información Debug"
diff --git a/resources/pot/retailcrm-ru_RU.pot b/resources/pot/retailcrm-ru_RU.pot
index 78c86ec..db5fc0b 100644
--- a/resources/pot/retailcrm-ru_RU.pot
+++ b/resources/pot/retailcrm-ru_RU.pot
@@ -283,4 +283,8 @@ msgstr "Введите корректный номер телефона"
msgid "You can export all orders and customers from CMS to Simla.com by clicking the «Upload» button. This process can take much time and before it is completed, you need to keep the tab open."
msgstr "Вы можете экспортировать все заказы и клиентов из CMS в Simla.com, нажав кнопку «Выгрузить». Этот процесс может занять много времени, и до его завершения необходимо держать вкладку открытой."
+msgid "Debug information"
+msgstr "Отладочная информация"
+
+
diff --git a/src/assets/css/debug-info.css b/src/assets/css/debug-info.css
new file mode 100644
index 0000000..5a7d4c5
--- /dev/null
+++ b/src/assets/css/debug-info.css
@@ -0,0 +1,7 @@
+.retail-cron-info {
+ padding: 5px 30px !important;
+}
+
+.retail-cron-info-title {
+ font-weight: bold;
+}
diff --git a/src/assets/css/debug-info.min.css b/src/assets/css/debug-info.min.css
new file mode 100644
index 0000000..e533148
--- /dev/null
+++ b/src/assets/css/debug-info.min.css
@@ -0,0 +1 @@
+.retail-cron-info{padding:5px 30px!important}.retail-cron-info-title{font-weight:700}
\ No newline at end of file
diff --git a/src/assets/js/retailcrm-cron-info.js b/src/assets/js/retailcrm-cron-info.js
new file mode 100644
index 0000000..e13189f
--- /dev/null
+++ b/src/assets/js/retailcrm-cron-info.js
@@ -0,0 +1,49 @@
+jQuery(function () {
+ function RetailcrmCronInfo()
+ {
+ this.title = jQuery('h2[id="woocommerce_integration-retailcrm_16"]').get(0);
+
+ if (typeof this.title === 'undefined') {
+ return false;
+ }
+
+ this.history = 0;
+ this.icml = 0;
+ this.inventories = 0;
+
+ let _this = this;
+
+ jQuery.ajax({
+ url: window.location.origin + '/wp-admin/admin-ajax.php?action=cron_info',
+ method: "POST",
+ timeout: 0,
+ data: {ajax: 1},
+ dataType: "json"
+ })
+ .done(function (response) {
+ _this.history = response.history;
+ _this.icml = response.icml;
+ _this.inventories = response.inventories;
+
+ _this.displayInfoAboutCron();
+
+ })
+ }
+
+ RetailcrmCronInfo.prototype.displayInfoAboutCron = function () {
+ this.table = jQuery(this.title).next();
+ this.table.append('
');
+ this.infoTable = jQuery('tbody[class="retail-debug-info"]').get(0);
+
+ jQuery(this.infoTable).append("" + "Cron launches:" + " |
");
+ jQuery(this.infoTable).append("" + "History: " + this.history + " |
");
+ jQuery(this.infoTable).append("" + "Icml: " + this.icml + " |
");
+ jQuery(this.infoTable).append("" + "Inventories: " + this.inventories + " |
");
+ }
+
+ window.RetailcrmCronInfo = RetailcrmCronInfo;
+
+ if (!(typeof RetailcrmCronInfo === 'undefined')) {
+ new window.RetailcrmCronInfo();
+ }
+});
diff --git a/src/include/abstracts/class-wc-retailcrm-abstracts-settings.php b/src/include/abstracts/class-wc-retailcrm-abstracts-settings.php
index 3e3a035..05dc1a0 100644
--- a/src/include/abstracts/class-wc-retailcrm-abstracts-settings.php
+++ b/src/include/abstracts/class-wc-retailcrm-abstracts-settings.php
@@ -36,37 +36,6 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
) {
add_action('init', array($this, 'init_settings_fields'), 99);
}
-
- // Include js scripts
- $this->includeJsScripts();
-
- // Include css file
- $this->includeCssFile();
-
- }//end __construct()
-
-
- /**
- * In this method we include JS scripts.
- *
- * @return void
- */
- private function includeJsScripts()
- {
- wp_register_script('retailcrm-export', plugins_url() . '/woo-retailcrm/assets/js/retailcrm-export.js');
- wp_enqueue_script('retailcrm-export');
- }
-
-
- /**
- * In this method we include CSS file
- *
- * @return void
- */
- private function includeCssFile()
- {
- wp_register_style('retailcrm-orders-export', plugins_url() . '/woo-retailcrm/assets/css/progress-bar.min.css', false, '0.1');
- wp_enqueue_style('retailcrm-orders-export');
}
@@ -89,6 +58,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
'checkbox'
);
- /*
+ /**
* Upload single order
*/
$this->form_field[] = array(
@@ -561,6 +532,16 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
'class' => 'checkbox',
'type' => 'checkbox'
);
+
+ /**
+ * Debug information
+ */
+ $this->form_fields[] = array(
+ 'title' => __('Debug information', 'retailcrm'),
+ 'type' => 'heading',
+ 'description' => '',
+ 'id' => 'cron_info_options'
+ );
}
}
}
diff --git a/src/include/class-wc-retailcrm-base.php b/src/include/class-wc-retailcrm-base.php
index 51405ea..d409db6 100644
--- a/src/include/class-wc-retailcrm-base.php
+++ b/src/include/class-wc-retailcrm-base.php
@@ -88,6 +88,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
add_action('retailcrm_icml', array($this, 'generate_icml'));
add_action('retailcrm_inventories', array($this, 'load_stocks'));
add_action('wp_ajax_do_upload', array($this, 'upload_to_crm'));
+ add_action('wp_ajax_cron_info', array($this, 'get_cron_info'), 99);
add_action('wp_ajax_content_upload', array($this, 'count_upload_data'), 99);
add_action('wp_ajax_generate_icml', array($this, 'generate_icml'));
add_action('wp_ajax_order_upload', array($this, 'order_upload'));
@@ -103,6 +104,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
add_action('wp_enqueue_scripts', array($this, 'include_whatsapp_icon_style'), 101);
add_action('wp_print_footer_scripts', array($this, 'initialize_whatsapp'), 101);
add_action('wp_print_footer_scripts', array($this, 'send_analytics'), 99);
+ add_action('admin_enqueue_scripts', array($this, 'include_files_for_admin'), 101);
add_action('woocommerce_new_order', array($this, 'create_order'), 11, 1);
if (
@@ -415,6 +417,54 @@ if (!class_exists('WC_Retailcrm_Base')) {
}
+ /**
+ * In this method we include files in admin WP
+ *
+ * @return void
+ */
+ public function include_files_for_admin()
+ {
+ $this->include_css_files_for_admin();
+ $this->include_js_scripts_for_admin();
+ }
+
+
+ /**
+ * In this method we include CSS file
+ *
+ * @return void
+ */
+ private function include_css_files_for_admin()
+ {
+ $path = plugins_url() . '/woo-retailcrm/assets/css/';
+
+ // Include style for export
+ wp_register_style('retailcrm-export-style', $path . 'progress-bar.min.css', false, '0.1');
+ wp_enqueue_style('retailcrm-export-style');
+
+ // Include style for debug info
+ wp_register_style('retailcrm-debug-info-style', $path . 'debug-info.min.css', false, '0.1');
+ wp_enqueue_style('retailcrm-debug-info-style');
+ }
+
+
+ /**
+ * In this method we include JS scripts.
+ *
+ * @return void
+ */
+ private function include_js_scripts_for_admin()
+ {
+ $path = plugins_url() . '/woo-retailcrm/assets/js/';
+
+ wp_register_script('retailcrm-export', $path . 'retailcrm-export.js');
+ wp_enqueue_script('retailcrm-export', $path . 'retailcrm-export.js', '', '', true);
+
+ wp_register_script('retailcrm-cron-info', $path . 'retailcrm-cron-info.js');
+ wp_enqueue_script('retailcrm-cron-info', $path . 'retailcrm-export.js', '', '', true);
+ }
+
+
/**
* Include style for WhatsApp icon
*/
@@ -445,7 +495,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
/**
- * Rerurn count upload data
+ * Return count upload data
*/
public function count_upload_data()
{
@@ -460,6 +510,38 @@ if (!class_exists('WC_Retailcrm_Base')) {
}
+ /**
+ * Return time work next cron
+ */
+ public function get_cron_info() {
+ $icml = 'This option is disabled';
+ $history = 'This option is disabled';
+ $inventories = 'This option is disabled';
+
+ if (isset($this->settings['history']) && $this->settings['history'] == static::YES) {
+ $history = date("H:i:s d-m-Y", wp_next_scheduled('retailcrm_history'));
+ }
+
+ if (isset($this->settings['icml']) && $this->settings['icml'] == static::YES) {
+ $icml = date("H:i:s d-m-Y", wp_next_scheduled('retailcrm_icml'));
+ }
+
+ if (isset($this->settings['sync']) && $this->settings['sync'] == static::YES) {
+ $inventories = date("H:i:s d-m-Y ", wp_next_scheduled('retailcrm_inventories'));
+ }
+
+ echo json_encode(
+ array(
+ 'history' => $history,
+ 'icml' => $icml,
+ 'inventories' => $inventories
+ )
+ );
+
+ wp_die();
+ }
+
+
/**
* Get retailcrm api client
*
@@ -522,3 +604,4 @@ if (!class_exists('WC_Retailcrm_Base')) {
}
}
}
+
diff --git a/src/languages/retailcrm-es_ES.mo b/src/languages/retailcrm-es_ES.mo
index e1f8f91..ddc6e38 100644
Binary files a/src/languages/retailcrm-es_ES.mo and b/src/languages/retailcrm-es_ES.mo differ
diff --git a/src/languages/retailcrm-ru_RU.mo b/src/languages/retailcrm-ru_RU.mo
index 5514223..83db6ec 100644
Binary files a/src/languages/retailcrm-ru_RU.mo and b/src/languages/retailcrm-ru_RU.mo differ