refactor external orders
This commit is contained in:
@@ -26,6 +26,12 @@ import type { LieferantFormData } from '../types/bestellung.types';
|
||||
|
||||
const emptyForm: LieferantFormData = { name: '', kontakt_name: '', email: '', telefon: '', adresse: '', website: '', notizen: '' };
|
||||
|
||||
function ensureUrl(url: string): string {
|
||||
if (!url) return url;
|
||||
if (url.startsWith('http://') || url.startsWith('https://')) return url;
|
||||
return `https://${url}`;
|
||||
}
|
||||
|
||||
export default function LieferantDetail() {
|
||||
const { id } = useParams<{ id: string }>();
|
||||
const navigate = useNavigate();
|
||||
@@ -265,7 +271,7 @@ export default function LieferantDetail() {
|
||||
<Card variant="outlined"><CardContent>
|
||||
<Typography variant="caption" color="text.secondary">Website</Typography>
|
||||
<Typography>
|
||||
{vendor!.website ? <a href={vendor!.website} target="_blank" rel="noopener noreferrer">{vendor!.website}</a> : '–'}
|
||||
{vendor!.website ? <a href={ensureUrl(vendor!.website)} target="_blank" rel="noopener noreferrer">{vendor!.website}</a> : '–'}
|
||||
</Typography>
|
||||
</CardContent></Card>
|
||||
</Grid>
|
||||
|
||||
Reference in New Issue
Block a user