click-tracking
11 months ago
date-picker
5 months ago
email
9 months ago
examiner
11 months ago
icons
6 months ago
integrations
11 months ago
interrupt
11 months ago
journeys
6 months ago
notices
6 months ago
overview
6 months ago
partials
5 months ago
settings
5 months ago
tables
6 months ago
campaign-builder.blade.php
11 months ago
chart.blade.php
11 months ago
debug.blade.php
11 months ago
plugin-group-options.blade.php
11 months ago
quick-stat-loading.blade.php
11 months ago
quick-stat.blade.php
5 months ago
quick-stats.blade.php
11 months ago
real-time.blade.php
6 months ago
support.blade.php
6 months ago
updates.blade.php
6 months ago
woocommerce-order-meta-box.blade.php
6 months ago
plugin-group-options.blade.php
138 lines
| 1 | @php /** @var \IAWP\Plugin_Group[] $plugin_groups */ @endphp |
| 2 | @php /** @var \IAWP\Plugin_Group_Option[] $options */ @endphp |
| 3 | @php /** @var string $option_type */ @endphp |
| 4 | @php /** @var string $option_name */ @endphp |
| 5 | @php /** @var string $option_icon */ @endphp |
| 6 | |
| 7 | {{-- Array indicies are used to add section headers. Make sure there are no gaps. --}} |
| 8 | <?php $options = array_values($options); ?> |
| 9 | |
| 10 | <?php |
| 11 | $plugin_groups = array_filter($plugin_groups, function ($plugin_group) use ($options) { |
| 12 | foreach ($options as $option) { |
| 13 | if($option->is_member_of_plugin_group($plugin_group->id())) { |
| 14 | return true; |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | return false; |
| 19 | }); |
| 20 | ?> |
| 21 | |
| 22 | <?php |
| 23 | // Only one group with one option? Don't render the button or modal. |
| 24 | if(count($plugin_groups) === 1) { |
| 25 | $plugin_group_options = array_filter($options, function ($option) use ($plugin_groups) { |
| 26 | return $option->is_member_of_plugin_group($plugin_groups[0]->id()); |
| 27 | }); |
| 28 | |
| 29 | if(count($plugin_group_options) === 1) { |
| 30 | return; |
| 31 | } |
| 32 | } |
| 33 | ?> |
| 34 | |
| 35 | <div data-controller="plugin-group-options" |
| 36 | data-plugin-group-options-option-type-value="<?php echo esc_attr($option_type); ?>" |
| 37 | class="button-modal-container" |
| 38 | > |
| 39 | {{-- Toggle button --}} |
| 40 | <button class="stats-toggle-button iawp-button" |
| 41 | data-plugin-group-options-target="modalButton" |
| 42 | data-action="plugin-group-options#toggleModal" |
| 43 | > |
| 44 | <span class="dashicons dashicons-<?php echo esc_attr($option_icon); ?>"></span> |
| 45 | <?php echo esc_html($option_name); ?> |
| 46 | </button> |
| 47 | |
| 48 | {{-- Toggle modal --}} |
| 49 | <div data-plugin-group-options-target="modal" |
| 50 | class="stats-toggle" |
| 51 | > |
| 52 | <div class="top title-small"> |
| 53 | <?php esc_html_e('Choose Stats to Display', 'independent-analytics'); ?> |
| 54 | <span data-plugin-group-options-target="spinner" class="dashicons dashicons-update iawp-spin hidden"></span> |
| 55 | </div> |
| 56 | <div class="inner"> |
| 57 | <div id="stats-toggle-sidebar" class="sidebar"> |
| 58 | <ul> |
| 59 | <?php foreach($plugin_groups as $plugin_group) : ?> |
| 60 | <li> |
| 61 | <a class="link-dark <?php echo $plugin_group->id() === 'general' ? 'current' : ''; ?>" |
| 62 | data-option-id="<?php echo esc_attr($plugin_group->id()); ?>" |
| 63 | data-action="plugin-group-options#requestGroupChange" |
| 64 | data-plugin-group-options-target="tab" |
| 65 | href="#" |
| 66 | > |
| 67 | <span><?php echo esc_html($plugin_group->name()); ?></span> |
| 68 | <?php if($plugin_group->requires_pro() && iawp_is_free()) : ?> |
| 69 | <span class="pro-label"><?php esc_html_e('PRO', 'independent-analytics'); ?></span> |
| 70 | <?php endif; ?> |
| 71 | </a> |
| 72 | </li> |
| 73 | <?php endforeach; ?> |
| 74 | </ul> |
| 75 | </div> |
| 76 | <div class="main"> |
| 77 | <?php foreach($plugin_groups as $plugin_group) : ?> |
| 78 | <div class="checkbox-container <?php echo $plugin_group->id() === 'general' ? 'current' : ''; ?>" |
| 79 | data-option-id="<?php echo esc_attr($plugin_group->id()); ?>" |
| 80 | data-plugin-group-options-target="checkboxContainer" |
| 81 | {{-- data-metric-category="{{ $plugin_group->id() }}"--}} |
| 82 | > |
| 83 | <span class="metrics-title"><?php echo esc_attr($plugin_group->name()); ?></span> |
| 84 | |
| 85 | <?php foreach($options as $index => $option) : |
| 86 | if(!$option->is_subgroup_plugin_enabled() || !$option->is_member_of_plugin_group($plugin_group->id())) { |
| 87 | continue; |
| 88 | } |
| 89 | |
| 90 | if(is_string($option->plugin_group_header()) && array_key_exists($index - 1, $options) && ($options[$index -1])->plugin_group_header() !== $option->plugin_group_header()) : ?> |
| 91 | <span class="metrics-subtitle"><?php echo esc_html($option->plugin_group_header()); ?></span> |
| 92 | <?php endif; ?> |
| 93 | |
| 94 | <label class="<?php echo !$option->is_group_plugin_enabled() ? 'disabled' : ''; ?>"> |
| 95 | <?php if (!$option->is_group_plugin_enabled()) : ?> |
| 96 | <input id="iawp_<?php echo esc_attr($option_type) . '_' . esc_attr($option->id()); ?>" |
| 97 | type="checkbox" |
| 98 | disabled="disabled"> |
| 99 | <?php else : ?> |
| 100 | <input id="iawp_<?php echo esc_attr($option_type) . '_' . esc_attr($option->id()); ?>" |
| 101 | type="checkbox" |
| 102 | data-action="plugin-group-options#toggleOption" |
| 103 | data-plugin-group-options-target="checkbox" |
| 104 | name="<?php echo esc_attr($option->id()); ?>" |
| 105 | <?php checked(true, $option->is_visible(), true); ?> |
| 106 | /> |
| 107 | <?php endif; ?> |
| 108 | <span><?php echo esc_html($option->name()); ?></span> |
| 109 | </label> |
| 110 | <?php endforeach; |
| 111 | |
| 112 | if ($plugin_group->requires_pro() && iawp_is_free()) : ?> |
| 113 | <div class="required-plugin-note"> |
| 114 | <p><?php echo esc_html($plugin_group->upgrade_message()); ?></p> |
| 115 | <p><a href="<?php echo esc_attr($plugin_group->upgrade_link()); ?>" |
| 116 | class="link-purple" |
| 117 | target="_blank"><?php esc_html_e('Learn more', 'independent-analytics'); ?></a> |
| 118 | </p> |
| 119 | </div> |
| 120 | <?php elseif(!$plugin_group->has_active_group_plugins() && iawp_is_pro()) : ?> |
| 121 | <div class="required-plugin-note"> |
| 122 | <p><?php echo esc_html($plugin_group->activate_message()); ?></p> |
| 123 | <p><a href="<?php echo esc_attr($plugin_group->activate_link()); ?>" |
| 124 | class="link-purple" |
| 125 | target="_blank"><?php esc_html_e('Learn more', 'independent-analytics'); ?></a> |
| 126 | </p> |
| 127 | </div> |
| 128 | <?php elseif(!$plugin_group->has_tracked_data()) : ?> |
| 129 | <div class="required-plugin-note"> |
| 130 | <p><?php echo esc_html($plugin_group->no_tracked_data_message()); ?></p> |
| 131 | </div> |
| 132 | <?php endif; ?> |
| 133 | </div> |
| 134 | <?php endforeach; ?> |
| 135 | </div> |
| 136 | </div> |
| 137 | </div> |
| 138 | </div> |