save attachment from email in customer data and - or contracts
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { Reply, Star, Paperclip, Link2, X, Download, ExternalLink, Trash2, Undo2 } from 'lucide-react';
|
||||
import { Reply, Star, Paperclip, Link2, X, Download, ExternalLink, Trash2, Undo2, Save } from 'lucide-react';
|
||||
import { CachedEmail, cachedEmailApi } from '../../services/api';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import Button from '../ui/Button';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useAuth } from '../../context/AuthContext';
|
||||
import toast from 'react-hot-toast';
|
||||
import SaveAttachmentModal from './SaveAttachmentModal';
|
||||
|
||||
interface EmailDetailProps {
|
||||
email: CachedEmail;
|
||||
@@ -35,6 +36,7 @@ export default function EmailDetail({
|
||||
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
||||
const [showRestoreConfirm, setShowRestoreConfirm] = useState(false);
|
||||
const [showPermanentDeleteConfirm, setShowPermanentDeleteConfirm] = useState(false);
|
||||
const [saveAttachmentFilename, setSaveAttachmentFilename] = useState<string | null>(null);
|
||||
const queryClient = useQueryClient();
|
||||
const { hasPermission } = useAuth();
|
||||
|
||||
@@ -327,6 +329,16 @@ export default function EmailDetail({
|
||||
>
|
||||
<Download className="w-4 h-4 text-gray-500" />
|
||||
</a>
|
||||
{/* Speichern-Button (nicht im Papierkorb) */}
|
||||
{!isTrashView && (
|
||||
<button
|
||||
onClick={() => setSaveAttachmentFilename(name)}
|
||||
className="p-1 hover:bg-blue-100 rounded transition-colors"
|
||||
title={`${name} speichern unter...`}
|
||||
>
|
||||
<Save className="w-4 h-4 text-blue-500" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
@@ -459,6 +471,16 @@ export default function EmailDetail({
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Anhang speichern Modal */}
|
||||
{saveAttachmentFilename && (
|
||||
<SaveAttachmentModal
|
||||
isOpen={true}
|
||||
onClose={() => setSaveAttachmentFilename(null)}
|
||||
emailId={email.id}
|
||||
attachmentFilename={saveAttachmentFilename}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user