Commit 84c9ef98 authored by Internship UKSW 2019's avatar Internship UKSW 2019

Initial commit

parent 25eae3f3
......@@ -19,6 +19,8 @@ export class DataTableMyDocument extends Component {
{ title: "Status" },
{ title: "Tracking" },
{ title: "Creator" },
{ title: ""},
{ title: ""},
{ title: "Withdraw", width: 50 }
],
columnDefs: [
......
This diff is collapsed.
......@@ -89,7 +89,7 @@ class FormCreate extends Component {
datarow.push(dataReferences[i].subject[0]);
datarow.push(dataReferences[i].doc_type[0]);
datarow.push(dataReferences[i].usr_dpt[0]);
datarow.push(dataReferences[i].subject[0]);
datarow.push(dataReferences[i].doc_code[0] + " - " + dataReferences[i].subject[0]);
datarow.push(content);
datarow.push(dataReferences[i].user_id[0]);
this.state.dataReferences.push(datarow);
......@@ -287,9 +287,19 @@ class FormCreate extends Component {
parseString(responseDataCheckSubject.data, function (err, result) {
dataCheckSubject = result.documentCollection.document;
})
if (dataCheckSubject != undefined && dataCheckSubject[0].doc_code[0].includes(this.state.businessUnit)) {
clonePage[index] = true;
alert("Document with same subject is already exist in your department!");
if (dataCheckSubject != undefined) {
let isAlreadyExist = false;
for (let i = 0; i < dataCheckSubject.length; i++) {
if (dataCheckSubject[i].doc_code[0].includes(this.state.businessUnit)) {
isAlreadyExist = true;
clonePage[index] = true;
alert("Document with same subject is already exist in your department!");
break;
}
}
if (isAlreadyExist == false) {
clonePage[index + 1] = true;
}
} else {
clonePage[index + 1] = true;
}
......@@ -608,15 +618,6 @@ class FormCreate extends Component {
this.setState({ isTableReferenceDraw: true });
}
}
handleAddCode = (subject) => {
let code;
for (var i = 0; i < this.state.dataReferences.length; i++) {
if (this.state.dataReferences[i][1] == subject) {
code = this.state.dataReferences[i][0];
}
}
return code;
}
//fungsi halaman add reference
handleSubmitReference = async () => {
this.changePageReference();
......@@ -766,10 +767,16 @@ class FormCreate extends Component {
body: JSON.stringify(postdataDokumen)
})
//Get Data Document By Subject
let dataDocument;
let responseDataDocument = await axios.get(process.env.REACT_APP_MAIN_APIURL + '/DocumentManagement/document/' + this.state.subject, { headers: { 'accept': 'application/xml' } })
parseString(responseDataDocument.data, function (err, result) {
doc_id = result.documentCollection.document[0].doc_id[0];
dataDocument = result.documentCollection.document;
})
for (let i = 0; i < dataDocument.length; i++) {
if (JSON.parse(localStorage.getItem("dataLogin")).user_id[0] == dataDocument[i].user_id[0]) {
doc_id = dataDocument[i].doc_id[0];
}
}
let dataRevision = {
"doc_id": doc_id,
"rev_code": this.state.revisionCode,
......@@ -1316,8 +1323,7 @@ class FormCreate extends Component {
<table className="my-table table table-striped table-hover" id="tableShowReference" >
<thead>
<tr>
<th className="col-xl-6 col-lg-9 col-md-9 col-sm-9">Subject <img src="sorting-table.png" alt="sorting-table" height="14" width="12" onClick={() => this.sortTable("tableShowReference", 0)} /></th>
<th className="col-xl-2 col-lg-2 col-md-2 col-sm-2">Code</th>
<th className="col-xl-11 col-lg-11 col-md-11 col-sm-11">Code Document <img src="sorting-table.png" alt="sorting-table" height="14" width="12" onClick={() => this.sortTable("tableShowReference", 0)} /></th>
<th className="col-xl-1 col-lg-1 col-md-1 col-sm-1" style={{ width: "50px" }}>#</th>
</tr>
</thead>
......@@ -1327,7 +1333,6 @@ class FormCreate extends Component {
return (
<tr key={index}>
<td><a className="text-decoration-none text-dark" href="#" onClick={(e) => this.handleSelectReference2(e, reference)}>{reference}</a></td>
<td><a className="text-decoration-none text-dark" href="#" onClick={(e) => this.handleSelectReference2(e, reference)}>{this.handleAddCode(reference)}</a></td>
<td><input type="checkbox" name="listShowReference[]" value={reference}
onChange={(e) => this.handleSelectReference(e)} /></td>
</tr>
......
This diff is collapsed.
......@@ -21,7 +21,7 @@ class YourDocument extends Component {
}
}
componentDidMount = async () => {
try {
// try {
var parseString = require('xml2js').parseString;
let user_id = JSON.parse(localStorage.getItem("dataLogin")).user_id[0];
let responseDataUser = await axios.get(process.env.REACT_APP_MAIN_APIURL + '/DocumentManagement/user', { headers: { 'accept': 'application/xml' } })
......@@ -63,7 +63,7 @@ class YourDocument extends Component {
datarow.push(dataAllDocument[i].doc_code[0]);
datarow.push(dataAllDocument[i].subject[0]);
datarow.push(dataAllDocument[i].doc_status[0]);
datarow.push(dataRevision[dataRevision.length - 1].status);
datarow.push(dataRevision[dataRevision.length-1].status);
datarow.push(JSON.parse(localStorage.getItem("dataLDAP"))["Full Name"]);
datarow.push(content);
datarow.push(dataAllDocument[i].user_id);
......@@ -182,10 +182,10 @@ class YourDocument extends Component {
}
}
await this.setState({ fetchStatus: true });
} catch (error) {
await this.setState({ fetchStatus: true, fetchError: true });
console.log(error + "");
}
// } catch (error) {
// await this.setState({ fetchStatus: true, fetchError: true });
// console.log(error + "");
// }
}
retryRetrievingData = (e) => {
e.preventDefault();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment