+
+
+
+
+
+
+
diff --git a/WebfrontCore/wwwroot/js/search.js b/WebfrontCore/wwwroot/js/search.js
index 253b51616..370142551 100644
--- a/WebfrontCore/wwwroot/js/search.js
+++ b/WebfrontCore/wwwroot/js/search.js
@@ -31,5 +31,38 @@
prevArrow: '<',
orientation: 'auto top'
});
- })
+ });
+
+
+ const clientSearchWrapper = $('*[id^="clientSearchWrapper"]');
+ const chatSearchWrapper = $('*[id^="chatSearchWrapper"]');
+ const searchTypeSelector = $('#searchTypeSelectorParent select');
+ let isClients = false;
+
+ searchTypeSelector.on('change', function () {
+ if (isClients) {
+ clientSearchWrapper.removeClass('d-none');
+ chatSearchWrapper.addClass('d-none');
+ } else {
+ chatSearchWrapper.removeClass('d-none');
+ clientSearchWrapper.addClass('d-none');
+ }
+ isClients = !isClients;
+ });
+
+ const isDefault = clientSearchWrapper.data('has-data') !== 'True' && chatSearchWrapper.data('has-data') !== 'True';
+
+ if (isDefault) {
+ isClients = false;
+ searchTypeSelector.val('client').change();
+ } else {
+ if (clientSearchWrapper.data('has-data') === 'True') {
+ isClients = false;
+ searchTypeSelector.val('client').change();
+ }
+ if (chatSearchWrapper.data('has-data') === 'True') {
+ isClients = true;
+ searchTypeSelector.val('chat').change();
+ }
+ }
});