| 1 |
<script type="text/javascript"> |
| 2 |
|
| 3 |
jQuery(document).ready(function ($) { |
| 4 |
|
| 5 |
AmplitudeAnalytics.setUser("{{ user_email }}"); |
| 6 |
|
| 7 |
jQuery('.wtotem_body').on('click', '#sites_load_more', function (e) { |
| 8 |
jQuery('#all_sites_wrap').addClass('wtotem_loader_spinner'); |
| 9 |
jQuery.post(ajaxurl, { |
| 10 |
action: 'wtotem_ajax', |
| 11 |
ajax_action: 'lazy_load', |
| 12 |
wtotem_page_nonce: '{{ page_nonce }}', |
| 13 |
service: 'all_sites', |
| 14 |
}, function (data) { |
| 15 |
jQuery('#all_sites_wrap').removeClass('wtotem_loader_spinner').append(data.content); |
| 16 |
|
| 17 |
if(!data.has_next_page) { |
| 18 |
jQuery('#sites_load_more').remove(); |
| 19 |
} |
| 20 |
|
| 21 |
jQuery('#wtotem_notifications').html(data.notifications); |
| 22 |
}); |
| 23 |
}).on('click', '.wtotem_remove_site', function (e) { |
| 24 |
jQuery('#all_sites_wrap').addClass('wtotem_loader_spinner'); |
| 25 |
jQuery.post(ajaxurl, { |
| 26 |
action: 'wtotem_ajax', |
| 27 |
ajax_action: 'multisite', |
| 28 |
wtotem_page_nonce: '{{ page_nonce }}', |
| 29 |
multisite_action: 'remove_site', |
| 30 |
hid: jQuery(this).data('hid'), |
| 31 |
}, function (data) { |
| 32 |
jQuery('#all_sites_wrap').removeClass('wtotem_loader_spinner'); |
| 33 |
if(data.content){ |
| 34 |
jQuery('#all_sites_wrap').html(data.content); |
| 35 |
} |
| 36 |
|
| 37 |
if(!data.has_next_page) { |
| 38 |
jQuery('#sites_load_more').remove(); |
| 39 |
} |
| 40 |
|
| 41 |
jQuery('#wtotem_notifications').html(data.notifications); |
| 42 |
}); |
| 43 |
}).on('click', '.wtotem_add_site', function (e) { |
| 44 |
jQuery('#all_sites_wrap').addClass('wtotem_loader_spinner'); |
| 45 |
jQuery.post(ajaxurl, { |
| 46 |
action: 'wtotem_ajax', |
| 47 |
ajax_action: 'multisite', |
| 48 |
wtotem_page_nonce: '{{ page_nonce }}', |
| 49 |
multisite_action: 'add_site', |
| 50 |
site_name: jQuery(this).data('site'), |
| 51 |
}, function (data) { |
| 52 |
jQuery('#all_sites_wrap').removeClass('wtotem_loader_spinner').html(data.content); |
| 53 |
|
| 54 |
if(!data.has_next_page) { |
| 55 |
jQuery('#sites_load_more').remove(); |
| 56 |
} |
| 57 |
|
| 58 |
jQuery('#wtotem_notifications').html(data.notifications); |
| 59 |
}); |
| 60 |
}); |
| 61 |
|
| 62 |
jQuery('body').addClass('{{ theme_mode.is_dark_mode }}'); |
| 63 |
|
| 64 |
}); |
| 65 |
|
| 66 |
</script> |
| 67 |
|
| 68 |
<div class="wtotem_welcome-wrapper"> |
| 69 |
<div class="wtotem_body {{ theme_mode.is_dark_mode }}"> |
| 70 |
|
| 71 |
<div class="wtotem_content"> |
| 72 |
<div class="wtotem_container"> |
| 73 |
<div class="wtotem_notifications_wrapper" id="wtotem_notifications"> |
| 74 |
{% include 'notifications.html.twig' with {'notifications': notifications, 'images_path': images_path } %} |
| 75 |
</div> |
| 76 |
</div> |
| 77 |
</div> |
| 78 |
|
| 79 |
<div class="wtotem_container"> |
| 80 |
|
| 81 |
<div class="wtotem_all"> |
| 82 |
<div class="wtotem_all__first"> |
| 83 |
<h2 class="title">{{ 'All sites'|trans }}</h2> |
| 84 |
</div> |
| 85 |
|
| 86 |
{% if sites %} |
| 87 |
<table class="wtotem_all__table"> |
| 88 |
<thead class="wtotem_all__thead"> |
| 89 |
<tr class="wtotem_all__tr card"> |
| 90 |
<th class="wtotem_all__th">{{ 'Site name'|trans }}</th> |
| 91 |
<th class="wtotem_all__th">{{ 'Firewall'|trans }}</th> |
| 92 |
<th class="wtotem_all__th">{{ 'Antivirus'|trans }}</th> |
| 93 |
<th class="wtotem_all__th">{{ 'Services status'|trans }}</th> |
| 94 |
<th class="wtotem_all__th" colspan="2">{{ 'Technologies'|trans }} </th> |
| 95 |
</tr> |
| 96 |
</thead> |
| 97 |
<tbody class="wtotem_all__tbody" id="all_sites_wrap"> |
| 98 |
{% include 'multisite_list.html.twig' with {'sites': sites, 'images_path': images_path, 'hasNextPage': hasNextPage } %} |
| 99 |
</tbody> |
| 100 |
</table> |
| 101 |
{% else %} |
| 102 |
<div class="wtotem__no-data"> |
| 103 |
<div class="wtotem__no-data-icon"> |
| 104 |
<img src="{{ images_path }}list.svg"> |
| 105 |
</div> |
| 106 |
<div> |
| 107 |
{{ 'No site here'|trans }} |
| 108 |
</div> |
| 109 |
</div> |
| 110 |
{% endif %} |
| 111 |
</div> |
| 112 |
</div> |
| 113 |
</div> |
| 114 |
</div> |