Browse Source

fixes print comment

old_master
Listat.an 4 years ago
parent
commit
380f62a143
  1. 5
      src/containers/Task/components/Form/index.jsx
  2. 12
      src/containers/Task/components/PrintComponent/components/Item/index.jsx

5
src/containers/Task/components/Form/index.jsx

@ -120,6 +120,7 @@ class Form extends Component { @@ -120,6 +120,7 @@ class Form extends Component {
if(values.id){
await this.props.updateTask(values.id, tmp_values);
} else {
localStorage.removeItem('task_data');
if(tmp_values.user_done && Array.isArray(tmp_values.user_done)){
// for(const user_done of tmp_values.user_done){
@ -128,17 +129,19 @@ class Form extends Component { @@ -128,17 +129,19 @@ class Form extends Component {
let task = await this.props.createTask({...tmp_values, user_done: tmp_values.user_done[0] });
await this.props.actionsComments(this.state.action_comments, task.id);
await this.props.actionsDocuments(this.state.action_documents, task.id);
localStorage.removeItem('task_data');
if(tmp_values.user_done.length > 1){
await this.props.taskClone({
user_ids: tmp_values.user_done.filter((id, index) => index > 0),
task_id: task.id
})
localStorage.removeItem('task_data');
}
} else if(tmp_values.user_done) {
let task = await this.props.createTask({...tmp_values});
await this.props.actionsComments(this.state.action_comments, task.id);
await this.props.actionsDocuments(this.state.action_documents, task.id);
localStorage.removeItem('task_data');
}

12
src/containers/Task/components/PrintComponent/components/Item/index.jsx

@ -98,7 +98,7 @@ class Item extends Component { @@ -98,7 +98,7 @@ class Item extends Component {
return (
<div style={{ pageBreakInside: 'avoid', paddingTop: '20px'}}>
<table style={{width: '100%', marginTop: '20px', borderBottom: '1px solid black'}}>
<table style={{width: '100%', marginTop: '20px', borderBottom: comments && task.comments.filter(i => i.comment_type == 'text').length > 0 ? '0px solid black' : '1px solid black'}}>
{!hide_user ? <tr style={{pageBreakInside: 'avoid', pageBreakAfter: 'auto'}} >
<td colSpan={4} style={{...styles.td, fontSize: '19px'}}>
<strong><span style={{textDecoration: 'underline',}}>{user_done.name}</span></strong> <i>{factory}</i>
@ -140,11 +140,15 @@ class Item extends Component { @@ -140,11 +140,15 @@ class Item extends Component {
<tr><td colSpan={3} ></td><td></td></tr>
</table>
{comments && task.comments.filter(i => i.comment_type == 'text').length > 0 && <p style={{fontSize: '14px', pageBreakInside: 'avoid', pageBreakAfter: 'auto', fontWeight: 'bold', color: 'black'}}>Коментарі:</p>}
{comments && task.comments.filter(i => i.comment_type == 'text').length > 0 && <table style={{width: '100%', marginTop: '10px', color: 'black'}}>
{task.comments.filter(i => i.comment_type == 'text').map((item) => <tr style={{pageBreakInside: 'avoid', pageBreakAfter: 'auto', fontSize: '14px', color: 'black'}}>
{comments && task.comments.filter(i => i.comment_type == 'text').length > 0 && <table style={{width: '100%', marginTop: '10px', color: 'black', borderBottom: '1px solid black'}}>
{task.comments.filter(i => i.comment_type == 'text').map((item) => <><tr style={{pageBreakInside: 'avoid', pageBreakAfter: 'auto', fontSize: '14px', color: 'black'}}>
<td>{this.getUser(item.user_created)}:</td>
<td>{item.description}</td>
</tr>)}
</tr>
<tr>
<td colSpan="2"><br/></td>
</tr>
</>)}
</table>}
</div>

Loading…
Cancel
Save