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

Initial commit

parent e1f08b69
...@@ -96,7 +96,6 @@ class FormApprover extends Component { ...@@ -96,7 +96,6 @@ class FormApprover extends Component {
let dataRevision = responseDataRevision.data.revisionCollection.revision; let dataRevision = responseDataRevision.data.revisionCollection.revision;
// Check is user valid to open the document // Check is user valid to open the document
if ( if (
dataRevision[dataRevision.length - 1].status == "Waiting for Approval - Hendra" ||
(dataRevision[dataRevision.length - 1].status == "Waiting for Approval - " + JSON.parse(localStorage.getItem("dataLogin")).user_name[0] && JSON.parse(localStorage.getItem('dataLogin')).user_role[0].includes("Approver") && JSON.parse(localStorage.getItem("dataLDAP"))["Login Name"] == JSON.parse(approver).LoginName) || (dataRevision[dataRevision.length - 1].status == "Waiting for Approval - " + JSON.parse(localStorage.getItem("dataLogin")).user_name[0] && JSON.parse(localStorage.getItem('dataLogin')).user_role[0].includes("Approver") && JSON.parse(localStorage.getItem("dataLDAP"))["Login Name"] == JSON.parse(approver).LoginName) ||
(dataRevision[dataRevision.length - 1].status == "Waiting for Approval - " + JSON.parse(localStorage.getItem("dataLogin")).user_name[0] && JSON.parse(localStorage.getItem('dataLogin')).user_role[0].includes("Compliance Officer")) || (dataRevision[dataRevision.length - 1].status == "Waiting for Approval - " + JSON.parse(localStorage.getItem("dataLogin")).user_name[0] && JSON.parse(localStorage.getItem('dataLogin')).user_role[0].includes("Compliance Officer")) ||
(dataRevision[dataRevision.length - 1].status == "Waiting for Approval - " + JSON.parse(localStorage.getItem("dataLogin")).user_name[0] && JSON.parse(localStorage.getItem('dataLogin')).user_role[0].includes("Manager Representative")) || (dataRevision[dataRevision.length - 1].status == "Waiting for Approval - " + JSON.parse(localStorage.getItem("dataLogin")).user_name[0] && JSON.parse(localStorage.getItem('dataLogin')).user_role[0].includes("Manager Representative")) ||
...@@ -1266,7 +1265,6 @@ class FormApprover extends Component { ...@@ -1266,7 +1265,6 @@ class FormApprover extends Component {
} }
//fungsi halaman 4 //fungsi halaman 4
handleSelectReference = (e) => { handleSelectReference = (e) => {
e.preventDefault();
if (e.target.checked) { if (e.target.checked) {
let isAddReference = window.confirm("Are you sure want to add document " + e.target.value + " as reference?"); let isAddReference = window.confirm("Are you sure want to add document " + e.target.value + " as reference?");
if (isAddReference) { if (isAddReference) {
......
...@@ -552,13 +552,12 @@ class FormCreate extends Component { ...@@ -552,13 +552,12 @@ class FormCreate extends Component {
} }
//fungsi halaman 3 //fungsi halaman 3
handleSelectReference = (e) => { handleSelectReference = (e) => {
e.preventDefault(); let listShowReference = document.getElementsByName("listShowReference[]");
if (e.target.checked) { if (e.target.checked) {
let isAddReference = window.confirm("Are you sure want to add document " + e.target.value + " as reference?"); let isAddReference = window.confirm("Are you sure want to add document " + e.target.value + " as reference?");
if (isAddReference) { if (isAddReference) {
this.state.selectReferences.push(e.target.value); this.state.selectReferences.push(e.target.value);
} else { } else {
let listShowReference = document.getElementsByName("listShowReference[]");
for (let i = 0; i < listShowReference.length; i++) { for (let i = 0; i < listShowReference.length; i++) {
if (listShowReference[i].value == e.target.value) { if (listShowReference[i].value == e.target.value) {
listShowReference[i].checked = false; listShowReference[i].checked = false;
...@@ -701,6 +700,23 @@ class FormCreate extends Component { ...@@ -701,6 +700,23 @@ class FormCreate extends Component {
await this.setState({ submitForm: true }) await this.setState({ submitForm: true })
var js2xmlparser = require('js2xmlparser'); var js2xmlparser = require('js2xmlparser');
var parseString = require('xml2js').parseString; var parseString = require('xml2js').parseString;
//Send Email Notification
let postdataEmail = {
"subject": "Permintaan Review dan Approval Dokumen",
"emailcc": "andrewahyudi1899@gmail.com",// JSON.parse(localStorage.getItem("dataLogin")).email[0]
"emailsend": "672016038@student.uksw.edu",// 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("user"))["Full Name"] + ".<br /> Untuk review dan approval silahkan klik link berikut ini <a href='http://10.10.86.48:3000' target='_blank'>Link Dokumen</a></p> \
<p>Terimakasih</p> \
<p>Regards, \
<p>Admin</p><br /> \
<p><i>Ini adalah email otomatis, harap jangan me-reply ke alamat email ini</i></p>"
}
let responseSendEmail = await fetch(process.env.REACT_APP_MAIN_APIURL + '/email', {
headers: { 'Content-Type': 'application/json' },
method: 'POST',
body: JSON.stringify(postdataEmail)
})
let user_id, doc_id; let user_id, doc_id;
user_id = JSON.parse(localStorage.getItem("dataLogin")).user_id[0]; user_id = JSON.parse(localStorage.getItem("dataLogin")).user_id[0];
//Get data manager creator //Get data manager creator
...@@ -830,23 +846,7 @@ class FormCreate extends Component { ...@@ -830,23 +846,7 @@ class FormCreate extends Component {
} }
let postDataTrail = js2xmlparser.parse("_posttrailinsert", dataTrail); 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' } }) let responseInsertTrail = await axios.post(process.env.REACT_APP_MAIN_APIURL + '/DocumentManagement/trailinsert', postDataTrail, { headers: { 'Content-Type': 'text/xml' } })
// //Send Email Notification
// let postdataEmail = {
// "subject": "Permintaan Review dan Approval Dokumen",
// "emailcc": "andrewahyudi1899@gmail.com",// JSON.parse(localStorage.getItem("dataLogin")).email[0]
// "emailsend": "672016038@student.uksw.edu",// 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("user"))["Full Name"] + ".<br /> Untuk review dan approval silahkan klik link berikut ini <a href='http://10.10.86.48:3000' target='_blank'>Link Dokumen</a></p> \
// <p>Terimakasih</p> \
// <p>Regards, \
// <p>Admin</p><br /> \
// <p><i>Ini adalah email otomatis, harap jangan me-reply ke alamat email ini</i></p>"
// }
// let responseSendEmail = await fetch(process.env.REACT_APP_MAIN_APIURL + '/email', {
// headers: { 'Content-Type': 'application/json' },
// method: 'POST',
// body: JSON.stringify(postdataEmail)
// })
await this.setState({ submitForm: false }); await this.setState({ submitForm: false });
alert("Document has been successfully submited"); alert("Document has been successfully submited");
this.props.history.push("/yourdocument"); this.props.history.push("/yourdocument");
...@@ -1395,23 +1395,6 @@ class FormCreate extends Component { ...@@ -1395,23 +1395,6 @@ class FormCreate extends Component {
</label> </label>
</div> </div>
</div> </div>
<div className="form-group row">
<div className="col-xl-12 col-lg-12 col-md-12 col-sm-12">
<h5>Revision History Table</h5>
</div>
</div>
<div className="form-group row">
<table className="my-table table table-striped table-hover">
<thead>
<tr>
<th className="col-xl-3 col-lg-3 col-md-3 col-sm-3">Code</th>
<th className="col-xl-3 col-lg-3 col-md-3 col-sm-3">Remark</th>
<th className="col-xl-3 col-lg-3 col-md-3 col-sm-3">Creator</th>
<th className="col-xl-3 col-lg-3 col-md-3 col-sm-3">Approval</th>
</tr>
</thead>
</table>
</div>
</div> </div>
</form> </form>
</div> </div>
......
...@@ -722,7 +722,6 @@ class FormRevision extends Component { ...@@ -722,7 +722,6 @@ class FormRevision extends Component {
} }
//fungsi halaman 3 //fungsi halaman 3
handleSelectReference = (e) => { handleSelectReference = (e) => {
e.preventDefault();
if (e.target.checked) { if (e.target.checked) {
let isAddReference = window.confirm("Are you sure want to add document " + e.target.value + " as reference?"); let isAddReference = window.confirm("Are you sure want to add document " + e.target.value + " as reference?");
if (isAddReference) { if (isAddReference) {
......
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