-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02589dc
commit fe181d3
Showing
4 changed files
with
154 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React, { Component, Fragment } from 'react'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import { Button } from '@folio/stripes/components'; | ||
|
||
import ClosePOModalForm from './ClosePOModalForm'; | ||
|
||
class ClosePOModal extends Component { | ||
static propTypes = { | ||
orderId: PropTypes.string.isRequired, | ||
}; | ||
|
||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
openModal: false, | ||
}; | ||
} | ||
|
||
openModal = () => { | ||
this.setState({ | ||
openModal: true, | ||
}); | ||
} | ||
|
||
closeModal = () => { | ||
this.setState({ | ||
openModal: false, | ||
}); | ||
} | ||
|
||
render() { | ||
const { orderId } = this.props; | ||
|
||
return ( | ||
<Fragment> | ||
<Button | ||
buttonStyle="primary" | ||
marginBottom0 | ||
onClick={this.openModal} | ||
style={{ marginRight: '10px' }} | ||
> | ||
<FormattedMessage id="ui-orders.paneBlock.closeBtn" /> | ||
</Button> | ||
<ClosePOModalForm | ||
close={this.closeModal} | ||
orderId={orderId} | ||
open={this.state.openModal} | ||
/> | ||
</Fragment> | ||
); | ||
} | ||
} | ||
|
||
export default ClosePOModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React from 'react'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import PropTypes from 'prop-types'; | ||
import { Field } from 'redux-form'; | ||
|
||
import stripesForm from '@folio/stripes/form'; | ||
import { | ||
Col, | ||
Modal, | ||
ModalFooter, | ||
Row, | ||
Select, | ||
TextArea, | ||
} from '@folio/stripes/components'; | ||
|
||
const ClosePOModalForm = ({ close, open, orderId }) => { | ||
const cancelBtn = <FormattedMessage id="ui-orders.closePOModal.cancel" />; | ||
const submitBtn = <FormattedMessage id="ui-orders.closePOModal.submit" />; | ||
const footer = ( | ||
<ModalFooter | ||
secondaryButton={{ | ||
label: cancelBtn, | ||
onClick: close, | ||
}} | ||
primaryButton={{ | ||
label: submitBtn, | ||
onClick: close, | ||
}} | ||
/> | ||
); | ||
|
||
return ( | ||
<Modal | ||
footer={footer} | ||
label={<FormattedMessage id="ui-orders.closePOModal.title" values={{ orderId }} />} | ||
open={open} | ||
> | ||
<Row> | ||
<Col xs={12}> | ||
<Field | ||
component={Select} | ||
label={<FormattedMessage id="ui-orders.closePOModal.reason" />} | ||
name="reason" | ||
/> | ||
<Field | ||
component={TextArea} | ||
label={<FormattedMessage id="ui-orders.closePOModal.notes" />} | ||
name="notes" | ||
/> | ||
</Col> | ||
</Row> | ||
</Modal> | ||
); | ||
}; | ||
|
||
ClosePOModalForm.propTypes = { | ||
close: PropTypes.func.isRequired, | ||
open: PropTypes.bool.isRequired, | ||
orderId: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default stripesForm({ | ||
form: 'closePOModalForm', | ||
navigationCheck: true, | ||
enableReinitialize: true, | ||
})(ClosePOModalForm); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters