tab-batch-description.php 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * Category Manipulations tab partial: Batch description between categories.
  4. *
  5. * @package Studiou_WC_Product_Cat_Manage
  6. *
  7. * @var Studiou_WC_Product_Cat_Manage_Manipulator $manipulator
  8. */
  9. // If this file is called directly, abort.
  10. if (!defined('WPINC')) {
  11. die;
  12. }
  13. $categories = $manipulator->get_categories_with_counts();
  14. ?>
  15. <!-- Batch Description Between Categories Operation -->
  16. <div class="studiou-wcpcm-card">
  17. <h2><?php echo esc_html__('Batch description between categories', 'studiou-wc-product-cat-manage'); ?></h2>
  18. <p><?php echo esc_html__('This operation allows you to set the same description for multiple categories at once.', 'studiou-wc-product-cat-manage'); ?></p>
  19. <form id="studiou-wcpcm-batch-description-form" method="post">
  20. <table class="form-table">
  21. <tr>
  22. <th scope="row">
  23. <label for="categories_list"><?php echo esc_html__('Select Categories', 'studiou-wc-product-cat-manage'); ?></label>
  24. </th>
  25. <td>
  26. <div class="studiou-wcpcm-categories-list-container">
  27. <div class="studiou-wcpcm-list-actions">
  28. <button type="button" id="studiou-wcpcm-check-all" class="button">
  29. <?php echo esc_html__('Check All', 'studiou-wc-product-cat-manage'); ?>
  30. </button>
  31. <button type="button" id="studiou-wcpcm-uncheck-all" class="button">
  32. <?php echo esc_html__('Uncheck All', 'studiou-wc-product-cat-manage'); ?>
  33. </button>
  34. </div>
  35. <div class="studiou-wcpcm-categories-list" id="categories_list">
  36. <?php foreach ($categories as $category): ?>
  37. <label class="studiou-wcpcm-category-item">
  38. <input type="checkbox" name="selected_categories[]" value="<?php echo esc_attr($category['id']); ?>">
  39. <span><?php echo esc_html($category['display_name']); ?></span>
  40. </label>
  41. <?php endforeach; ?>
  42. </div>
  43. </div>
  44. <p class="description"><?php echo esc_html__('Select the categories for which you want to set the description.', 'studiou-wc-product-cat-manage'); ?></p>
  45. </td>
  46. </tr>
  47. <tr>
  48. <th scope="row">
  49. <label for="category_description"><?php echo esc_html__('Product categories description', 'studiou-wc-product-cat-manage'); ?></label>
  50. </th>
  51. <td>
  52. <textarea name="category_description" id="category_description" rows="5" cols="50" class="large-text"></textarea>
  53. <p class="description"><?php echo esc_html__('Enter the description that will be applied to all selected categories.', 'studiou-wc-product-cat-manage'); ?></p>
  54. </td>
  55. </tr>
  56. </table>
  57. <div class="submit-buttons">
  58. <button type="submit" class="button button-primary" id="studiou-wcpcm-batch-description-button">
  59. <?php echo esc_html__('Do', 'studiou-wc-product-cat-manage'); ?>
  60. </button>
  61. <span class="spinner"></span>
  62. </div>
  63. </form>
  64. <div class="studiou-wcpcm-batch-description-results" style="display: none;">
  65. <h3><?php echo esc_html__('Batch Description Results', 'studiou-wc-product-cat-manage'); ?></h3>
  66. <div id="studiou-wcpcm-batch-description-message"></div>
  67. </div>
  68. </div>