Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1202 from metasfresh/dev-1197
Browse files Browse the repository at this point in the history
[WIP] Implements export view to excel button
  • Loading branch information
teosarca authored Sep 18, 2017
2 parents b557536 + 9665022 commit c8a423d
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/components/header/SubHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,17 @@ class Subheader extends Component {
nodes.map(node => dispatch(updateBreadcrumb(node)));
}

handleDownloadSelected = event => {
if (this.props.selected.length === 0) {
event.preventDefault();
}
}

renderNavColumn = () => {
const {
dataId, windowType, openModal, closeSubheader, handlePrint,
dataId, windowType, query, openModal, closeSubheader, handlePrint,
handleDelete, docNo, redirect, breadcrumb, siteName, editmode,
handleEditModeToggle, handleEmail, handleClone
handleEditModeToggle, handleEmail, handleClone, selected
} = this.props;

const {
Expand Down Expand Up @@ -232,7 +238,7 @@ class Subheader extends Component {
transparentBookmarks={!!siteName}
updateData={this.handleUpdateBreadcrumb}
>
<span
<span
title={
currentNode ? currentNode.caption : siteName
}
Expand All @@ -242,7 +248,6 @@ class Subheader extends Component {
</BookmarkButton>
</div>
<div className="subheader-break" />

{windowType && <div
className="subheader-item js-subheader-item"
tabIndex={0}
Expand All @@ -256,6 +261,19 @@ class Subheader extends Component {
{keymap.GLOBAL_CONTEXT.NEW_DOCUMENT}
</span>
</div>}
{windowType && query && query.viewId && (
<a
className="subheader-item js-subheader-item"
href={`${config.API_URL}/documentView/${windowType}/${query.viewId}/export/excel?selectedIds=${selected.join(',')}`}
download
onClick={this.handleDownloadSelected}
style={{
opacity: selected.length === 0 ? '0.5' : 1
}}
>
{counterpart.translate('window.downloadSelected.caption')}{selected.length === 0 && ` (${counterpart.translate('window.downloadSelected.nothingSelected')})`}
</a>
)}
{docLinks}
{editmode !== undefined && <div
key={editmode}
Expand Down

0 comments on commit c8a423d

Please sign in to comment.