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:
+13
-23
@@ -61,13 +61,15 @@
|
|||||||
<button
|
<button
|
||||||
id="showMainContacts"
|
id="showMainContacts"
|
||||||
class="px-4 py-2 text-sm font-medium rounded-l-lg border border-gray-200 bg-blue-600 text-white focus:z-10 focus:ring-2 focus:ring-blue-500"
|
class="px-4 py-2 text-sm font-medium rounded-l-lg border border-gray-200 bg-blue-600 text-white focus:z-10 focus:ring-2 focus:ring-blue-500"
|
||||||
onclick="switchTab(this)">
|
onclick="switchTab(this)"
|
||||||
|
data-type="main">
|
||||||
Hlavní kontakty
|
Hlavní kontakty
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
id="showInternalContacts"
|
id="showInternalContacts"
|
||||||
class="px-4 py-2 text-sm font-medium rounded-r-md border border-gray-200 bg-gray-100 text-gray-700 hover:bg-gray-200 focus:z-10 focus:ring-2 focus:ring-blue-500"
|
class="px-4 py-2 text-sm font-medium rounded-r-md border border-gray-200 bg-gray-100 text-gray-700 hover:bg-gray-200 focus:z-10 focus:ring-2 focus:ring-blue-500"
|
||||||
onclick="switchTab(this)">
|
onclick="switchTab(this)"
|
||||||
|
data-type="internal">
|
||||||
Interní kontakty
|
Interní kontakty
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -257,12 +259,10 @@
|
|||||||
|
|
||||||
function displayContacts(contacts = [], searchQuery = '') {
|
function displayContacts(contacts = [], searchQuery = '') {
|
||||||
const container = document.getElementById('contacts');
|
const container = document.getElementById('contacts');
|
||||||
const internalContainer = document.getElementById('internal-contacts');
|
|
||||||
const noResults = document.getElementById('noResults');
|
const noResults = document.getElementById('noResults');
|
||||||
|
|
||||||
// Clear previous results
|
// Clear previous results
|
||||||
container.innerHTML = '';
|
container.innerHTML = '';
|
||||||
internalContainer.innerHTML = '';
|
|
||||||
|
|
||||||
if (!contacts || !contacts.length) {
|
if (!contacts || !contacts.length) {
|
||||||
noResults.classList.remove('hidden');
|
noResults.classList.remove('hidden');
|
||||||
@@ -278,26 +278,16 @@
|
|||||||
// Get active tab
|
// Get active tab
|
||||||
const activeTab = document.querySelector('.switcher-btn.active')?.dataset.type || 'main';
|
const activeTab = document.querySelector('.switcher-btn.active')?.dataset.type || 'main';
|
||||||
|
|
||||||
// Show contacts based on active tab
|
// Filter by active tab if not searching
|
||||||
if (activeTab === 'main') {
|
const contactsToShow = searchQuery ? contacts :
|
||||||
container.innerHTML = contacts
|
contacts.filter(contact =>
|
||||||
.filter(contact => !contact.internal)
|
activeTab === 'main' ? !contact.internal : contact.internal
|
||||||
.map(contact => formatContactCard(contact, searchQuery))
|
);
|
||||||
.join('');
|
|
||||||
} else {
|
|
||||||
internalContainer.innerHTML = contacts
|
|
||||||
.filter(contact => contact.internal)
|
|
||||||
.map(contact => formatContactCard(contact, searchQuery))
|
|
||||||
.join('');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show empty state if needed
|
// Display contacts
|
||||||
if (!container.innerHTML && activeTab === 'main') {
|
container.innerHTML = contactsToShow
|
||||||
container.innerHTML = '<p class="text-gray-500 py-4">Žádné hlavní kontakty</p>';
|
.map(contact => formatContactCard(contact, searchQuery))
|
||||||
}
|
.join('');
|
||||||
if (!internalContainer.innerHTML && activeTab === 'internal') {
|
|
||||||
internalContainer.innerHTML = '<p class="text-gray-500 py-4">Žádné interní kontakty</p>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatContactCard(contact, searchQuery) {
|
function formatContactCard(contact, searchQuery) {
|
||||||
|
|||||||
Reference in New Issue
Block a user