| 1 |
<?php |
| 2 |
|
| 3 |
use SyncBasalam\JobManager; |
| 4 |
use SyncBasalam\Utilities\ProductMetaKey; |
| 5 |
|
| 6 |
defined('ABSPATH') || exit; |
| 7 |
|
| 8 |
global $wpdb; |
| 9 |
|
| 10 |
$count_of_published_woocommerce_products = wp_count_posts('product')->publish; |
| 11 |
$productIdMetaKey = ProductMetaKey::basalamProductId(); |
| 12 |
$count_of_synced_basalam_products = intval($wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->postmeta} WHERE meta_key = %s", $productIdMetaKey))); |
| 13 |
|
| 14 |
$job_manager = new JobManager(); |
| 15 |
|
| 16 |
$quick_update_processing_job = $job_manager->getJob(['job_type' => 'sync_basalam_bulk_update_products', 'status' => 'processing']) |
| 17 |
?: $job_manager->getJob(['job_type' => 'sync_basalam_bulk_update_products', 'status' => 'pending']); |
| 18 |
|
| 19 |
$full_update_job = $job_manager->getJob(['job_type' => 'sync_basalam_update_all_products', 'status' => 'pending']); |
| 20 |
$full_update_processing_job = $job_manager->getJob(['job_type' => 'sync_basalam_update_all_products', 'status' => 'processing']); |
| 21 |
|
| 22 |
$single_update_count = $job_manager->getCountJobs(['job_type' => 'sync_basalam_update_single_product', 'status' => ['pending', 'processing']]); |
| 23 |
|
| 24 |
$has_active_update_jobs = ($quick_update_processing_job || $full_update_job || $full_update_processing_job || $single_update_count > 0); |
| 25 |
$active_update_type = ''; |
| 26 |
if ($quick_update_processing_job) { |
| 27 |
$active_update_type = 'quick'; |
| 28 |
} elseif ($full_update_job || $full_update_processing_job || $single_update_count > 0) { |
| 29 |
$active_update_type = 'full'; |
| 30 |
} |
| 31 |
|
| 32 |
$create_products_job = $job_manager->getJob(['job_type' => 'sync_basalam_create_all_products', 'status' => 'pending']); |
| 33 |
$create_products_processing_job = $job_manager->getJob(['job_type' => 'sync_basalam_create_all_products', 'status' => 'processing']); |
| 34 |
|
| 35 |
$single_create_count = $job_manager->getCountJobs(['job_type' => 'sync_basalam_create_single_product', 'status' => ['pending', 'processing']]); |
| 36 |
|
| 37 |
$has_active_create_jobs = ($create_products_job || $create_products_processing_job || $single_create_count > 0); |
| 38 |
|
| 39 |
$auto_connect_page_job = $job_manager->getJob(['job_type' => 'sync_basalam_auto_connect_products', 'status' => 'pending']) ?: $job_manager->getJob(['job_type' => 'sync_basalam_auto_connect_products', 'status' => 'processing']); |
| 40 |
|
| 41 |
$auto_connect_product_job_exist = $auto_connect_page_job ? 'not-allowed' : ''; |
| 42 |
?> |
| 43 |
|
| 44 |
<div class="basalam-dashboard"> |
| 45 |
<?php |
| 46 |
require_once(syncBasalamPlugin()->templatePath("products/Popups/AddProduct.php")); |
| 47 |
require_once(syncBasalamPlugin()->templatePath("products/Popups/EditProduct.php")); |
| 48 |
require_once(syncBasalamPlugin()->templatePath("products/Popups/AutoConnect.php")); |
| 49 |
require_once(syncBasalamPlugin()->templatePath("products/sections/Status.php")); |
| 50 |
?> |
| 51 |
<div class="basalam-action-cards"> |
| 52 |
<?php |
| 53 |
require_once(syncBasalamPlugin()->templatePath("products/sections/ProductList.php")); |
| 54 |
require_once(syncBasalamPlugin()->templatePath("orders/sections/OrderManagement.php")); |
| 55 |
require_once(syncBasalamPlugin()->templatePath("products/sections/Settings.php")); |
| 56 |
?> |
| 57 |
</div> |
| 58 |
</div> |
| 59 |
|