u
This commit is contained in:
@@ -68,7 +68,7 @@ export class Attachment extends PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
handleTileClick = (e) => {
|
||||
handleTileClick = () => {
|
||||
const { attachment, onClick } = this.props;
|
||||
if (onClick && attachment) {
|
||||
onClick(attachment);
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import { PureComponent } from 'react';
|
||||
import Box from '@mui/material/Box';
|
||||
import Button from '@mui/material/Button';
|
||||
import CircularProgress from '@mui/material/CircularProgress';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import { enqueueSnackbar } from 'notistack';
|
||||
import BackendError from '../BackendError';
|
||||
import { PageTitleRight } from '../PageLayout';
|
||||
import { PanelTile, PanelTileGrid } from 'dashgui/panels';
|
||||
import { PanelTileGrid } from 'dashgui/panels';
|
||||
import { StorageManagerContext } from '../../api/storageManagerContext';
|
||||
import { requireArray, requireDefined, requireObject } from '../../utils/apiShape';
|
||||
import { backendErrorFrom } from '../../utils/backendError';
|
||||
@@ -435,7 +432,7 @@ class ManifestForm extends PureComponent {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { kind, mode } = this.props;
|
||||
const { kind } = this.props;
|
||||
const cfg = this.cfg;
|
||||
const {
|
||||
status,
|
||||
|
||||
@@ -85,7 +85,6 @@ class ManifestHeader extends PureComponent {
|
||||
saving,
|
||||
pdfUploading,
|
||||
attachments,
|
||||
lines,
|
||||
onPdfUpload,
|
||||
onPdfRescan,
|
||||
onPdfDelete,
|
||||
|
||||
@@ -24,7 +24,6 @@ class ManifestLines extends PureComponent {
|
||||
onAddLine,
|
||||
onRemoveLine,
|
||||
onRemoveAllLines,
|
||||
onSave,
|
||||
columns = LINE_COLUMNS,
|
||||
supplierArticlesMap = {},
|
||||
supplierArticlesByLineKey = {},
|
||||
|
||||
@@ -275,31 +275,6 @@ function fileToBase64(file) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert base64 string to Blob
|
||||
* @param {string} base64
|
||||
* @param {string} mimeType
|
||||
* @returns {Blob}
|
||||
*/
|
||||
function base64ToBlob(base64, mimeType) {
|
||||
const clean = base64.includes(',') ? base64.split(',')[1] : base64;
|
||||
const byteCharacters = atob(clean);
|
||||
const byteArrays = [];
|
||||
const sliceSize = 512;
|
||||
|
||||
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
|
||||
const slice = byteCharacters.slice(offset, offset + sliceSize);
|
||||
const byteNumbers = new Array(slice.length);
|
||||
for (let i = 0; i < slice.length; i++) {
|
||||
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
||||
}
|
||||
const byteArray = new Uint8Array(byteNumbers);
|
||||
byteArrays.push(byteArray);
|
||||
}
|
||||
|
||||
return new Blob(byteArrays, { type: mimeType });
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore attachments from API response
|
||||
* @param {Array<{id: number, fileId?: number, manifestId?: number, mimetype: string, name: string, thumbavif?: any, size: number, created?: string, meta?: object}>} apiFiles
|
||||
|
||||
Reference in New Issue
Block a user