This commit is contained in:
seb
2026-10-18 16:10:18 +02:00
parent 5644678b7d
commit cf85ec102d
3 changed files with 114 additions and 0 deletions

View File

@@ -5,14 +5,24 @@ import Stack from '@mui/material/Stack';
import Tooltip from '@mui/material/Tooltip';
import DeleteIcon from '@mui/icons-material/Delete';
import CallMergeIcon from '@mui/icons-material/CallMerge';
import GoogleIcon from '@mui/icons-material/Google';
import { enqueueSnackbar } from 'notistack';
import { article as articleApi } from '../../../api';
import { artikelAutomat, getArticle } from '../../../automats';
import { notifyError } from '../../../utils/notify';
import {
articleEans,
getArticleEan,
getArticleBrand,
getArticleName,
buildGoogleSearchQuery,
} from '../../../utils/articleDetail';
import ArticleSearch from '../ArticleSearch';
import ArticleUnifyDialog from '../ArticleUnifyDialog';
export { getArticleEan, getArticleBrand, getArticleName, buildGoogleSearchQuery };
export function isArticleFather(article) {
if (!article) return false;
return Boolean(
@@ -48,6 +58,15 @@ export default class ArticleSettingsTab extends Component {
this.handleDeleteArticle = this.handleDeleteArticle.bind(this);
this.handleOpenSearch = this.handleOpenSearch.bind(this);
this.handleSelectTargetArticle = this.handleSelectTargetArticle.bind(this);
this.handleOpenGoogle = this.handleOpenGoogle.bind(this);
}
handleOpenGoogle() {
const { article: articleData } = this.props;
const query = buildGoogleSearchQuery(articleData);
if (!query) return;
const url = `https://www.google.com/search?q=${encodeURIComponent(query)}`;
window.open(url, '_blank', 'noopener,noreferrer');
}
async handleDeleteArticle() {
@@ -128,6 +147,7 @@ export default class ArticleSettingsTab extends Component {
: isStueckliste
? 'Ein Stücklisten-Artikel kann nicht vereint werden.'
: null;
const googleQuery = buildGoogleSearchQuery(articleData);
return (
<Box>
@@ -169,6 +189,18 @@ export default class ArticleSettingsTab extends Component {
Artikel vereinen
</Button>
)}
<Button
type="button"
color="primary"
variant="outlined"
startIcon={<GoogleIcon />}
disabled={busy || !googleQuery}
onClick={this.handleOpenGoogle}
title={googleQuery ? `Google-Suche: ${googleQuery}` : 'Google'}
>
Google
</Button>
</Stack>
<ArticleSearch