2015-07-08 22:54:07 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import Row from 'react-bootstrap/lib/Row';
|
|
|
|
import Col from 'react-bootstrap/lib/Col';
|
|
|
|
|
|
|
|
import GlobalNotificationModel from '../../models/global_notification_model';
|
|
|
|
import GlobalNotificationActions from '../../actions/global_notification_actions';
|
|
|
|
|
2015-08-12 13:34:41 +02:00
|
|
|
import FurtherDetailsFileuploader from './further_details_fileuploader';
|
2015-07-08 22:54:07 +02:00
|
|
|
|
2016-01-15 14:22:28 +01:00
|
|
|
import Form from './../ascribe_forms/form';
|
|
|
|
import PieceExtraDataForm from './../ascribe_forms/form_piece_extradata';
|
|
|
|
|
2015-09-01 14:42:09 +02:00
|
|
|
import { formSubmissionValidation } from '../ascribe_uploader/react_s3_fine_uploader_utils';
|
2015-08-18 13:15:22 +02:00
|
|
|
|
2016-01-18 13:29:08 +01:00
|
|
|
import { getLangText } from '../../utils/lang_utils';
|
|
|
|
|
2015-10-21 23:45:53 +02:00
|
|
|
|
2015-07-08 22:54:07 +02:00
|
|
|
let FurtherDetails = React.createClass({
|
|
|
|
propTypes: {
|
2016-01-14 16:31:19 +01:00
|
|
|
pieceId: React.PropTypes.number.isRequired,
|
|
|
|
|
2015-07-09 14:37:33 +02:00
|
|
|
editable: React.PropTypes.bool,
|
|
|
|
extraData: React.PropTypes.object,
|
2016-01-14 16:31:19 +01:00
|
|
|
handleSuccess: React.PropTypes.func,
|
2015-08-17 20:52:36 +02:00
|
|
|
otherData: React.PropTypes.arrayOf(React.PropTypes.object),
|
2015-07-08 22:54:07 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
getInitialState() {
|
|
|
|
return {
|
|
|
|
loading: false
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2016-01-07 18:29:55 +01:00
|
|
|
showNotification() {
|
2016-01-18 13:29:08 +01:00
|
|
|
const { handleSuccess } = this.props;
|
|
|
|
|
|
|
|
if (typeof handleSucess === 'function') {
|
|
|
|
handleSuccess();
|
2016-01-14 16:31:19 +01:00
|
|
|
}
|
|
|
|
|
2016-01-18 13:29:08 +01:00
|
|
|
const notification = new GlobalNotificationModel(getLangText('Details updated'), 'success');
|
2015-07-08 22:54:07 +02:00
|
|
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
|
|
|
},
|
|
|
|
|
2016-01-07 18:29:55 +01:00
|
|
|
submitFile(file) {
|
2015-07-08 22:54:07 +02:00
|
|
|
this.setState({
|
2015-09-14 14:46:03 +02:00
|
|
|
otherDataKey: file.key
|
2015-07-08 22:54:07 +02:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
setIsUploadReady(isReady) {
|
|
|
|
this.setState({
|
|
|
|
isUploadReady: isReady
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
render() {
|
2016-01-07 18:29:55 +01:00
|
|
|
const { editable, extraData, otherData, pieceId } = this.props;
|
|
|
|
|
2015-07-09 14:37:33 +02:00
|
|
|
return (
|
|
|
|
<Row>
|
|
|
|
<Col md={12} className="ascribe-edition-personal-note">
|
|
|
|
<PieceExtraDataForm
|
|
|
|
name='artist_contact_info'
|
2016-02-08 14:50:24 +01:00
|
|
|
title={getLangText('Artist Contact Info')}
|
2016-01-19 19:36:30 +01:00
|
|
|
convertLinks
|
2016-01-07 18:29:55 +01:00
|
|
|
editable={editable}
|
|
|
|
extraData={extraData}
|
2016-01-20 12:31:02 +01:00
|
|
|
handleSuccess={this.showNotification}
|
2016-01-19 19:36:30 +01:00
|
|
|
pieceId={pieceId} />
|
2015-07-09 14:37:33 +02:00
|
|
|
<PieceExtraDataForm
|
|
|
|
name='display_instructions'
|
2016-02-08 14:50:24 +01:00
|
|
|
title={getLangText('Display Instructions')}
|
2016-01-07 18:29:55 +01:00
|
|
|
editable={editable}
|
2016-01-20 12:31:02 +01:00
|
|
|
extraData={extraData}
|
|
|
|
handleSuccess={this.showNotification}
|
|
|
|
pieceId={pieceId} />
|
2015-07-09 14:37:33 +02:00
|
|
|
<PieceExtraDataForm
|
|
|
|
name='technology_details'
|
2016-02-08 14:50:24 +01:00
|
|
|
title={getLangText('Technology Details')}
|
2016-01-07 18:29:55 +01:00
|
|
|
editable={editable}
|
2016-01-20 12:31:02 +01:00
|
|
|
extraData={extraData}
|
|
|
|
handleSuccess={this.showNotification}
|
|
|
|
pieceId={pieceId} />
|
2015-08-12 13:34:41 +02:00
|
|
|
<Form>
|
|
|
|
<FurtherDetailsFileuploader
|
2015-09-14 14:46:03 +02:00
|
|
|
submitFile={this.submitFile}
|
2015-08-12 13:34:41 +02:00
|
|
|
setIsUploadReady={this.setIsUploadReady}
|
2015-09-01 14:42:09 +02:00
|
|
|
isReadyForFormSubmission={formSubmissionValidation.atLeastOneUploadedFile}
|
2016-01-07 18:29:55 +01:00
|
|
|
editable={editable}
|
2015-08-24 10:48:40 +02:00
|
|
|
overrideForm={true}
|
2016-01-07 18:29:55 +01:00
|
|
|
pieceId={pieceId}
|
|
|
|
otherData={otherData}
|
2015-11-23 10:46:20 +01:00
|
|
|
multiple={true} />
|
2015-08-12 13:34:41 +02:00
|
|
|
</Form>
|
2015-07-09 14:37:33 +02:00
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
);
|
2015-07-08 22:54:07 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default FurtherDetails;
|