fix: resolve email saving issue and implement email substring search
This commit is contained in:
@@ -147,7 +147,10 @@ const App = () => {
|
|||||||
const deptMatch = emp.department_name && emp.department_name.toLowerCase().includes(queryClean);
|
const deptMatch = emp.department_name && emp.department_name.toLowerCase().includes(queryClean);
|
||||||
const buildingMatch = emp.building && emp.building.toLowerCase().includes(queryClean);
|
const buildingMatch = emp.building && emp.building.toLowerCase().includes(queryClean);
|
||||||
|
|
||||||
return nameMatch || phoneMatch || internalPhoneMatch || internalPhoneStringMatch || titleMatch || companyMatch || deptMatch || buildingMatch;
|
// Match email fragment (by start, middle, domain, part before @)
|
||||||
|
const emailMatch = emp.email && emp.email.toLowerCase().includes(queryClean);
|
||||||
|
|
||||||
|
return nameMatch || phoneMatch || internalPhoneMatch || internalPhoneStringMatch || titleMatch || companyMatch || deptMatch || buildingMatch || emailMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -305,12 +305,27 @@ const AdminPanel = ({ token, employees, departments, companies, onRefreshData })
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Filter employees within the admin table
|
// Filter employees within the admin table
|
||||||
const filteredEmployees = employees.filter(emp =>
|
const filteredEmployees = employees.filter(emp => {
|
||||||
emp.name.toLowerCase().includes(adminSearch.toLowerCase()) ||
|
const cleanSearch = adminSearch.toLowerCase().trim();
|
||||||
emp.job_title.toLowerCase().includes(adminSearch.toLowerCase()) ||
|
if (!cleanSearch) return true;
|
||||||
(emp.company_name && emp.company_name.toLowerCase().includes(adminSearch.toLowerCase())) ||
|
|
||||||
(emp.department_name && emp.department_name.toLowerCase().includes(adminSearch.toLowerCase()))
|
const nameMatch = emp.name.toLowerCase().includes(cleanSearch);
|
||||||
);
|
const jobMatch = emp.job_title.toLowerCase().includes(cleanSearch);
|
||||||
|
const companyMatch = emp.company_name && emp.company_name.toLowerCase().includes(cleanSearch);
|
||||||
|
const deptMatch = emp.department_name && emp.department_name.toLowerCase().includes(cleanSearch);
|
||||||
|
const emailMatch = emp.email && emp.email.toLowerCase().includes(cleanSearch);
|
||||||
|
|
||||||
|
// Normalize phone numbers for search
|
||||||
|
const cleanDigits = cleanSearch.replace(/\D/g, '');
|
||||||
|
const empPhoneDigits = emp.phone ? emp.phone.replace(/\D/g, '') : '';
|
||||||
|
const phoneMatch = cleanDigits.length > 0 && empPhoneDigits.includes(cleanDigits);
|
||||||
|
|
||||||
|
const empInternalPhoneDigits = emp.internal_phone ? emp.internal_phone.replace(/\D/g, '') : '';
|
||||||
|
const internalPhoneMatch = cleanDigits.length > 0 && empInternalPhoneDigits.includes(cleanDigits);
|
||||||
|
const internalPhoneStringMatch = emp.internal_phone && emp.internal_phone.toLowerCase().includes(cleanSearch);
|
||||||
|
|
||||||
|
return nameMatch || jobMatch || companyMatch || deptMatch || emailMatch || phoneMatch || internalPhoneMatch || internalPhoneStringMatch;
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="admin-layout">
|
<div className="admin-layout">
|
||||||
|
|||||||
@@ -26,6 +26,13 @@ fi
|
|||||||
log "Navigating to ${INSTALL_DIR}"
|
log "Navigating to ${INSTALL_DIR}"
|
||||||
cd "$INSTALL_DIR" || die "Directory ${INSTALL_DIR} does not exist. Run install.sh first."
|
cd "$INSTALL_DIR" || die "Directory ${INSTALL_DIR} does not exist. Run install.sh first."
|
||||||
|
|
||||||
|
# 2.1. Backup existing database
|
||||||
|
if [ -f "${INSTALL_DIR}/data/database.db" ]; then
|
||||||
|
log "Backing up existing database"
|
||||||
|
cp "${INSTALL_DIR}/data/database.db" "${INSTALL_DIR}/data/database.db.bak"
|
||||||
|
log "Database backup created at ${INSTALL_DIR}/data/database.db.bak"
|
||||||
|
fi
|
||||||
|
|
||||||
# 3. Configure git safe directory
|
# 3. Configure git safe directory
|
||||||
log "Configuring git safe directory"
|
log "Configuring git safe directory"
|
||||||
git config --global --add safe.directory "$INSTALL_DIR" || true
|
git config --global --add safe.directory "$INSTALL_DIR" || true
|
||||||
@@ -79,6 +86,7 @@ log "Running health check..."
|
|||||||
sleep 5
|
sleep 5
|
||||||
if curl -fsSI "http://127.0.0.1:${HOST_PORT}/" >/dev/null; then
|
if curl -fsSI "http://127.0.0.1:${HOST_PORT}/" >/dev/null; then
|
||||||
log "Update completed successfully!"
|
log "Update completed successfully!"
|
||||||
|
log "Service HTTP Status: $(curl -o /dev/null -s -w "%{http_code}" http://127.0.0.1:${HOST_PORT}/)"
|
||||||
log "Container Status:"
|
log "Container Status:"
|
||||||
docker ps --filter "name=${CONTAINER_NAME}"
|
docker ps --filter "name=${CONTAINER_NAME}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user