mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-04 20:42:59 +00:00
Add files via upload
This commit is contained in:
+17
-16
@@ -201,23 +201,24 @@
|
|||||||
|
|
||||||
function filterContacts() {
|
function filterContacts() {
|
||||||
const query = document.getElementById('searchInput').value.toLowerCase().trim();
|
const query = document.getElementById('searchInput').value.toLowerCase().trim();
|
||||||
const activeTab = document.querySelector('.switcher-btn.active')?.dataset.type || 'main';
|
|
||||||
|
|
||||||
// Get contacts for active tab
|
// Always show all contacts when searching
|
||||||
const contacts = activeTab === 'main' ?
|
if (query) {
|
||||||
(currentData?.Contacts || []) :
|
const allContacts = [...(currentData?.Contacts || []), ...(currentData?.InternalContacts || [])];
|
||||||
(currentData?.InternalContacts || []);
|
const filteredContacts = allContacts.filter(contact =>
|
||||||
|
(contact.name && contact.name.toLowerCase().includes(query)) ||
|
||||||
// Apply search filter
|
(contact.position && contact.position.toLowerCase().includes(query)) ||
|
||||||
const filteredContacts = query ?
|
(contact.phone && contact.phone.includes(query)) ||
|
||||||
contacts.filter(c =>
|
(contact.service_phone && contact.service_phone.includes(query))
|
||||||
(c.name && c.name.toLowerCase().includes(query)) ||
|
);
|
||||||
(c.position && c.position.toLowerCase().includes(query)) ||
|
displayContacts(filteredContacts, query);
|
||||||
(c.phone && c.phone.includes(query)) ||
|
}
|
||||||
(c.service_phone && c.service_phone.includes(query))
|
// Show only active tab's contacts when no search
|
||||||
) : contacts;
|
else {
|
||||||
|
const activeTab = document.querySelector('.switcher-btn.active')?.dataset.type || 'main';
|
||||||
displayContacts(filteredContacts, query);
|
const contacts = activeTab === 'main' ? currentData?.Contacts : currentData?.InternalContacts;
|
||||||
|
displayContacts(contacts || [], '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showError(message) {
|
function showError(message) {
|
||||||
|
|||||||
Reference in New Issue
Block a user