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 #321 from metasfresh/dev-320
Browse files Browse the repository at this point in the history
#320 Ability to opening docView over MasterWindow
  • Loading branch information
damianprzygodzki authored Feb 16, 2017
2 parents e929143 + 0b9374e commit 93accb3
Showing 1 changed file with 38 additions and 8 deletions.
46 changes: 38 additions & 8 deletions src/containers/MasterWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ import {

import Window from '../components/Window';
import Modal from '../components/app/Modal';
import RawModal from '../components/app/RawModal';
import DocumentList from '../components/app/DocumentList';
import Container from '../components/Container';

class MasterWindow extends Component {
constructor(props){
super(props);

this.state = {
newRow: false
newRow: false,
modalTitle: null
}
}

Expand Down Expand Up @@ -51,12 +54,18 @@ class MasterWindow extends Component {
return dispatch(attachFileAction(type, dataId, fd));
}

setModalTitle = (title) => {
this.setState({
modalTitle: title
})
}

render() {
const {
master, modal, breadcrumb, references, actions,
attachments
master, modal, breadcrumb, references, actions, attachments, rawModal,
selected
} = this.props;
const {newRow} = this.state;
const {newRow, modalTitle} = this.state;
const {documentNoElement, docActionElement, documentSummaryElement, type} = master.layout;
const dataId = master.docId;
const docNoData = findRowByPropName(master.data, documentNoElement && documentNoElement.fields[0].field);
Expand Down Expand Up @@ -107,6 +116,19 @@ class MasterWindow extends Component {
)}
/>
}
{rawModal.visible &&
<RawModal
modalTitle={modalTitle}
>
<DocumentList
type="grid"
windowType={parseInt(rawModal.type)}
defaultViewId={rawModal.viewId}
selected={selected}
setModalTitle={this.setModalTitle}
/>
</RawModal>
}
<Window
data={master.data}
layout={master.layout}
Expand All @@ -128,17 +150,23 @@ MasterWindow.propTypes = {
references: PropTypes.array.isRequired,
actions: PropTypes.array.isRequired,
attachments: PropTypes.array.isRequired,
dispatch: PropTypes.func.isRequired
dispatch: PropTypes.func.isRequired,
selected: PropTypes.array,
rawModal: PropTypes.object.isRequired
};

function mapStateToProps(state) {
const { windowHandler, menuHandler } = state;
const {
master,
modal
modal,
rawModal,
selected
} = windowHandler || {
master: {},
modal: false
modal: false,
rawModal: {},
selected: []
}

const {
Expand All @@ -159,7 +187,9 @@ function mapStateToProps(state) {
references,
modal,
actions,
attachments
attachments,
selected,
rawModal
}
}

Expand Down

0 comments on commit 93accb3

Please sign in to comment.