mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-05 04:52:58 +00:00
Add files via upload
This commit is contained in:
@@ -192,18 +192,13 @@ func parseExcelFile(filename string) ([]Contact, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sheetName := sheets[0]
|
sheetName := sheets[0]
|
||||||
var contacts []Contact
|
|
||||||
|
// Parse the single table (columns A-E)
|
||||||
// Parse first table (A-D columns)
|
contacts := parseTable(f, sheetName, "A", "E")
|
||||||
contacts = append(contacts, parseTable(f, sheetName, "A", "D", 1)...)
|
|
||||||
|
|
||||||
// Parse second table (F-H columns)
|
|
||||||
contacts = append(contacts, parseTable(f, sheetName, "F", "H", 2)...)
|
|
||||||
|
|
||||||
return contacts, nil
|
return contacts, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseTable(f *excelize.File, sheetName, startCol, endCol string, tableNum int) []Contact {
|
func parseTable(f *excelize.File, sheetName, startCol, endCol string) []Contact {
|
||||||
var contacts []Contact
|
var contacts []Contact
|
||||||
var currentContact *Contact
|
var currentContact *Contact
|
||||||
|
|
||||||
|
|||||||
+20
-20
@@ -230,9 +230,17 @@
|
|||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
// Get contacts based on active tab
|
||||||
|
let contacts = [];
|
||||||
|
if (activeTab === 'main') {
|
||||||
|
contacts = [...allContacts.filter(c => !c.internal)];
|
||||||
|
} else if (activeTab === 'internal') {
|
||||||
|
contacts = [...allContacts.filter(c => c.internal)];
|
||||||
|
}
|
||||||
|
|
||||||
// Apply table filter
|
// Apply table filter
|
||||||
let contacts = allContacts;
|
|
||||||
if (currentTableFilter !== 'all') {
|
if (currentTableFilter !== 'all') {
|
||||||
contacts = contacts.filter(contact => contact.table == currentTableFilter);
|
contacts = contacts.filter(contact => contact.table == currentTableFilter);
|
||||||
}
|
}
|
||||||
@@ -315,26 +323,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showContacts(type) {
|
function showContacts(type) {
|
||||||
const mainDiv = document.getElementById('contacts');
|
// Update switcher buttons
|
||||||
const internalDiv = document.getElementById('internal-contacts');
|
document.querySelectorAll('.switcher-btn').forEach(btn => {
|
||||||
const mainBtn = document.getElementById('showMainContacts');
|
btn.classList.remove('active', 'bg-blue-600', 'text-white');
|
||||||
const internalBtn = document.getElementById('showInternalContacts');
|
btn.classList.add('bg-gray-100', 'text-gray-700');
|
||||||
|
if (btn.dataset.type === type) {
|
||||||
|
btn.classList.add('active', 'bg-blue-600', 'text-white');
|
||||||
|
btn.classList.remove('bg-gray-100', 'text-gray-700');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (type === 'main') {
|
// Filter contacts for the selected type
|
||||||
mainDiv.classList.remove('hidden');
|
filterContacts();
|
||||||
internalDiv.classList.add('hidden');
|
|
||||||
mainBtn.classList.add('bg-blue-600', 'text-white');
|
|
||||||
mainBtn.classList.remove('bg-gray-100', 'text-gray-700');
|
|
||||||
internalBtn.classList.remove('bg-blue-600', 'text-white');
|
|
||||||
internalBtn.classList.add('bg-gray-100', 'text-gray-700');
|
|
||||||
} else {
|
|
||||||
mainDiv.classList.add('hidden');
|
|
||||||
internalDiv.classList.remove('hidden');
|
|
||||||
mainBtn.classList.remove('bg-blue-600', 'text-white');
|
|
||||||
mainBtn.classList.add('bg-gray-100', 'text-gray-700');
|
|
||||||
internalBtn.classList.add('bg-blue-600', 'text-white');
|
|
||||||
internalBtn.classList.remove('bg-gray-100', 'text-gray-700');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function reloadContacts() {
|
async function reloadContacts() {
|
||||||
|
|||||||
Reference in New Issue
Block a user