2015-07-14 16:29:01 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
2015-08-06 10:15:02 +02:00
|
|
|
import Form from '../ascribe_forms/form';
|
|
|
|
|
2015-07-14 16:29:01 +02:00
|
|
|
import ApiUrls from '../../constants/api_urls';
|
2015-08-06 10:15:02 +02:00
|
|
|
import AppConstants from '../../constants/application_constants';
|
|
|
|
|
2015-07-14 16:29:01 +02:00
|
|
|
import { getLangText } from '../../utils/lang_utils';
|
|
|
|
|
2015-08-06 10:23:01 +02:00
|
|
|
|
2015-07-14 16:29:01 +02:00
|
|
|
let PieceDeleteForm = React.createClass({
|
|
|
|
propTypes: {
|
2015-08-06 10:15:02 +02:00
|
|
|
pieceId: React.PropTypes.number,
|
2015-07-14 16:29:01 +02:00
|
|
|
|
2015-08-06 10:15:02 +02:00
|
|
|
// Propagated by ModalWrapper in most cases
|
|
|
|
handleSuccess: React.PropTypes.func
|
2015-07-14 16:29:01 +02:00
|
|
|
},
|
|
|
|
|
2015-08-06 10:15:02 +02:00
|
|
|
getFormData() {
|
|
|
|
return {
|
|
|
|
piece_id: this.props.pieceId
|
|
|
|
};
|
2015-07-14 16:29:01 +02:00
|
|
|
},
|
|
|
|
|
2015-08-06 10:15:02 +02:00
|
|
|
render() {
|
2015-07-14 16:29:01 +02:00
|
|
|
return (
|
2015-08-06 10:15:02 +02:00
|
|
|
<Form
|
|
|
|
ref='form'
|
|
|
|
url={ApiUrls.piece}
|
|
|
|
getFormData={this.getFormData}
|
|
|
|
method="delete"
|
|
|
|
handleSuccess={this.props.handleSuccess}
|
|
|
|
buttons={
|
|
|
|
<div className="modal-footer">
|
|
|
|
<p className="pull-right">
|
|
|
|
<button
|
|
|
|
type="submit"
|
|
|
|
className="btn btn-danger btn-delete btn-sm ascribe-margin-1px"
|
|
|
|
onClick={this.submit}>
|
|
|
|
{getLangText('YES, DELETE')}
|
|
|
|
</button>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
spinner={
|
|
|
|
<div className="modal-footer">
|
|
|
|
<img src={AppConstants.baseUrl + 'static/img/ascribe_animated_small.gif'} />
|
|
|
|
</div>
|
|
|
|
}>
|
2015-07-14 16:29:01 +02:00
|
|
|
<p>{getLangText('Are you sure you would like to permanently delete this piece')}?</p>
|
|
|
|
<p>{getLangText('This is an irrevocable action%s', '.')}</p>
|
2015-08-06 10:15:02 +02:00
|
|
|
</Form>
|
2015-07-14 16:29:01 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
export default PieceDeleteForm;
|