Commit f28b6f23 authored by Internship UKSW 2019's avatar Internship UKSW 2019

Initial commit

parent 644de931
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].doc_code[0] + " - " + dataReferences[i].subject[0]);
datarow.push(dataReferences[i].doc_code[0]);
datarow.push(content);
datarow.push(dataReferences[i].user_id[0]);
this.state.dataReferences.push(datarow);
......@@ -280,32 +280,46 @@ class FormCreate extends Component {
clonePage[index] = false;
if (action == "Next") {
if (index == 0) {
try {
// Check is exist document with same subject
let responseDataCheckSubject = await axios.get(process.env.REACT_APP_MAIN_APIURL + '/DocumentManagement/document/' + this.state.subject, { headers: { 'accept': 'application/xml' } })
let dataCheckSubject;
parseString(responseDataCheckSubject.data, function (err, result) {
dataCheckSubject = result.documentCollection.document;
})
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;
let sbj = this.state.subject;
for (let i = (sbj.length - 1); i >= 0; i--) {
if (sbj[i] == " ") {
sbj = sbj.slice(0, i);
} else {
break;
}
}
await this.setState({ subject: sbj });
if (this.state.subject != "") {
try {
// Check is exist document with same subject
let responseDataCheckSubject = await axios.get(process.env.REACT_APP_MAIN_APIURL + '/DocumentManagement/document/' + this.state.subject, { headers: { 'accept': 'application/xml' } })
let dataCheckSubject;
parseString(responseDataCheckSubject.data, function (err, result) {
dataCheckSubject = result.documentCollection.document;
})
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) {
if (isAlreadyExist == false) {
clonePage[index + 1] = true;
}
} else {
clonePage[index + 1] = true;
}
} else {
clonePage[index + 1] = true;
} catch (err) {
clonePage[index] = true;
alert(err + "");
}
} catch (err) {
} else {
clonePage[index] = true;
alert(err + "");
alert("Subject cannot only contain space");
}
} else {
clonePage[index + 1] = true;
......@@ -749,7 +763,7 @@ class FormCreate extends Component {
Email: dataApprover[0].EMail[0]
}
let postdataDokumen = {
"doc_code": this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode,
"doc_code": this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode + "-" + this.state.subject,
"user_id": user_id,
"doc_type": this.state.documentType,
"rev_date": this.state.effectiveDate,
......@@ -864,7 +878,7 @@ class FormCreate extends Component {
"user_role": "Creator",
"action": "Create New Document",
"trail_status": "Waiting for Approval - " + dataApprover[0].EmpFullName[0],
"doc_code": this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode
"doc_code": this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode + "-" + this.state.subject
}
let postDataTrail = js2xmlparser.parse("_posttrailinsert", dataTrail);
let responseInsertTrail = await axios.post(process.env.REACT_APP_MAIN_APIURL + '/DocumentManagement/trailinsert', postDataTrail, { headers: { 'Content-Type': 'text/xml' } })
......@@ -874,7 +888,7 @@ class FormCreate extends Component {
"emailcc": JSON.parse(localStorage.getItem("dataLogin")).email[0],
"emailsend": dataApprover[0].EMail[0],
"message": "<p>Dengan hormat,</p> \
<p>Terdapat pengajuan dokumen dengan No." + this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode + " " + this.state.subject + " yang diajukan oleh " + JSON.parse(localStorage.getItem("dataLDAP"))["Full Name"] + ".<br /> Untuk review dan approval silahkan klik link berikut ini <a href='http://" + localStorage.getItem('host') + "' target='_blank'>Link Dokumen</a></p> \
<p>Terdapat pengajuan dokumen dengan No." + this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode + "-" + this.state.subject + " yang diajukan oleh " + JSON.parse(localStorage.getItem("dataLDAP"))["Full Name"] + ".<br /> Untuk review dan approval silahkan klik link berikut ini <a href='http://" + localStorage.getItem('host') + "' target='_blank'>Link Dokumen</a></p> \
<p>Terimakasih</p> \
<p>Regards,</p> \
<p>Admin</p><br /> \
......@@ -1043,7 +1057,7 @@ class FormCreate extends Component {
<h2 className={"text-center" + (pageNumber == 1 ? " text-danger" : "")}>{this.state.subject}</h2><br />
<div className={"form-group row" + (pageNumber == 1 ? " text-danger" : "")}>
<label className="col-xl-4 col-lg-4 col-md-5 col-sm-4 control-label">Code</label>
<label className="col-xl-8 col-lg-8 col-md-7 col-sm-8">{": " + this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode}</label>
<label className="col-xl-8 col-lg-8 col-md-7 col-sm-8">{": " + this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode + "-" + this.state.subject}</label>
</div>
<div className={"form-group row" + (pageNumber == 1 ? " text-danger" : "")}>
<label className="col-xl-4 col-lg-4 col-md-5 col-sm-4 control-label">Revision Date</label>
......@@ -1395,7 +1409,7 @@ class FormCreate extends Component {
<h1 className="text-center">{this.state.subject}</h1><br />
<div className="form-group row">
<label className="col-xl-3 col-lg-3 col-md-3 col-sm-3 control-label">Code</label>
<label className="col-xl-9 col-lg-9 col-md-9 col-sm-9 control-label">{": " + this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode}</label>
<label className="col-xl-9 col-lg-9 col-md-9 col-sm-9 control-label">{": " + this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode + "-" + this.state.subject}</label>
</div>
<div className="form-group row">
<label className="col-xl-3 col-lg-3 col-md-3 col-sm-3 control-label">Revision Date</label>
......
......@@ -247,7 +247,7 @@ class FormPublish extends Component {
"emailcc": JSON.parse(localStorage.getItem("dataLogin")).email[0],
"emailsend": sendEmailPublish,
"message": "<p>Dengan hormat,</p> \
<p>Dokumen dengan No." + this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode + " " + this.state.subject + " yang diajukan oleh " + this.state.creator_name + " telah dipublish.<br /> Untuk melihat dokumen, silahkan klik link berikut <a href='http://" + localStorage.getItem('host') + "' target='_blank'>Link Dokumen</a></p> \
<p>Dokumen dengan No." + this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode + "-" + this.state.subject + " yang diajukan oleh " + this.state.creator_name + " telah dipublish.<br /> Untuk melihat dokumen, silahkan klik link berikut <a href='http://" + localStorage.getItem('host') + "' target='_blank'>Link Dokumen</a></p> \
<p>Terimakasih</p> \
<p>Regards,</p> \
<p>Admin</p><br /> \
......@@ -273,7 +273,7 @@ class FormPublish extends Component {
"emailcc": "",
"emailsend": sendEmailPublish,
"message": "<p>Dengan hormat,</p> \
<p>Dokumen dengan No." + this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode + " " + this.state.subject + " yang diajukan oleh " + this.state.creator_name + " telah diunpublish oleh " + JSON.parse(localStorage.getItem("dataLogin")).user_name[0] + ".</p> \
<p>Dokumen dengan No." + this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode + "-" + this.state.subject + " yang diajukan oleh " + this.state.creator_name + " telah diunpublish oleh " + JSON.parse(localStorage.getItem("dataLogin")).user_name[0] + ".</p> \
<p>Terimakasih</p> \
<p>Regards,</p> \
<p>Admin</p><br /> \
......@@ -297,7 +297,7 @@ class FormPublish extends Component {
// contents: this.state.contents
}
let putdataDokumen = {
"doc_code": this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode,
"doc_code": this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode + "-" + this.state.subject,
"user_id": this.state.user_id,
"doc_type": this.state.documentType,
"rev_date": this.state.effectiveDate,
......@@ -386,7 +386,7 @@ class FormPublish extends Component {
"user_role": "Compliance Officer",
"action": actionPublish,
"trail_status": tracking,
"doc_code": this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode,
"doc_code": this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode + "-" + this.state.subject,
}
let postDataTrail = js2xmlparser.parse("_posttrailinsert", dataTrail);
let responseInsertTrail = await axios.post(process.env.REACT_APP_MAIN_APIURL + '/DocumentManagement/trailinsert', postDataTrail, { headers: { 'Content-Type': 'text/xml' } })
......@@ -557,7 +557,7 @@ class FormPublish extends Component {
<h1 className="text-center">{this.state.subject}</h1><br />
<div className="form-group row">
<label className="col-xl-3 col-lg-3 col-md-3 col-sm-3 control-label">Code</label>
<label className="col-xl-9 col-lg-9 col-md-9 col-sm-9 control-label">{": " + this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode}</label>
<label className="col-xl-9 col-lg-9 col-md-9 col-sm-9 control-label">{": " + this.state.businessUnit + "-" + this.state.documentType + "-" + this.state.revisionCode + "-" + this.state.subject}</label>
</div>
<div className="form-group row">
<label className="col-xl-3 col-lg-3 col-md-3 col-sm-3 control-label">Revision Date</label>
......
This diff is collapsed.
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