@@ -342,7 +342,7 @@ export default function Keywords() {
|
||||
};
|
||||
|
||||
// Import/Export handlers
|
||||
const { handleExport, handleImportClick: baseHandleImportClick, ImportModal } = useKeywordsImportExport(
|
||||
const { handleExport, handleImportClick, ImportModal } = useKeywordsImportExport(
|
||||
() => {
|
||||
toast.success('Import successful', 'Keywords imported successfully.');
|
||||
loadKeywords();
|
||||
@@ -350,34 +350,12 @@ export default function Keywords() {
|
||||
(error) => {
|
||||
toast.error('Import failed', error.message);
|
||||
},
|
||||
// Pass active site_id and active sector_id for import, but validate sector belongs to site
|
||||
activeSite && activeSector && activeSector.site_id === activeSite.id
|
||||
// Pass active site_id and active sector_id for import
|
||||
activeSite && activeSector
|
||||
? { site_id: activeSite.id, sector_id: activeSector.id }
|
||||
: activeSite // Only pass site_id if sector doesn't belong to site
|
||||
? { site_id: activeSite.id }
|
||||
: undefined
|
||||
);
|
||||
|
||||
// Custom import click handler with validation
|
||||
const handleImportClick = () => {
|
||||
// Validate that sector belongs to the selected site
|
||||
if (activeSite && activeSector && activeSector.site_id !== activeSite.id) {
|
||||
toast.error('Import failed', `Selected sector "${activeSector.name}" does not belong to site "${activeSite.name}". Please select a sector from the current site.`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Debug logging
|
||||
console.log('Import attempt:', {
|
||||
site_id: activeSite?.id,
|
||||
site_name: activeSite?.name,
|
||||
sector_id: activeSector?.id,
|
||||
sector_name: activeSector?.name,
|
||||
sector_site_id: activeSector?.site_id
|
||||
});
|
||||
|
||||
baseHandleImportClick();
|
||||
};
|
||||
|
||||
// Handle bulk actions (delete, export, update_status are now handled by TablePageTemplate)
|
||||
// This is only for actions that don't have modals (like auto_cluster)
|
||||
const handleBulkAction = useCallback(async (action: string, ids: string[]) => {
|
||||
|
||||
Reference in New Issue
Block a user