Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
I
Internship UKSW 2019 document-management
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Internship UKSW 2019
Internship UKSW 2019 document-management
Commits
84c9ef98
Commit
84c9ef98
authored
Apr 28, 2020
by
Internship UKSW 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parent
25eae3f3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
169 additions
and
104 deletions
+169
-104
DataTableMyDocument.js
src/DataTableMyDocument.js
+2
-0
FormApproverDocument.js
src/FormApproverDocument.js
+68
-39
FormCreateDocument.js
src/FormCreateDocument.js
+22
-17
FormRevisionDocument.js
src/FormRevisionDocument.js
+71
-42
YourDocument.js
src/YourDocument.js
+6
-6
No files found.
src/DataTableMyDocument.js
View file @
84c9ef98
...
@@ -19,6 +19,8 @@ export class DataTableMyDocument extends Component {
...
@@ -19,6 +19,8 @@ export class DataTableMyDocument extends Component {
{
title
:
"Status"
},
{
title
:
"Status"
},
{
title
:
"Tracking"
},
{
title
:
"Tracking"
},
{
title
:
"Creator"
},
{
title
:
"Creator"
},
{
title
:
""
},
{
title
:
""
},
{
title
:
"Withdraw"
,
width
:
50
}
{
title
:
"Withdraw"
,
width
:
50
}
],
],
columnDefs
:
[
columnDefs
:
[
...
...
src/FormApproverDocument.js
View file @
84c9ef98
...
@@ -308,26 +308,44 @@ class FormApprover extends Component {
...
@@ -308,26 +308,44 @@ class FormApprover extends Component {
})
})
if
(
dataReferences
!=
undefined
)
{
if
(
dataReferences
!=
undefined
)
{
for
(
let
i
=
0
;
i
<
dataReferences
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
dataReferences
.
length
;
i
++
)
{
if
(
dataReferences
[
i
].
subject
[
0
]
!=
this
.
state
.
subjectEdit
)
{
let
datarow
=
[];
let
datarow
=
[];
let
content
=
""
;
let
checked
=
false
;
let
apiContent
=
"contentkey"
;
datarow
.
push
(
dataReferences
[
i
].
doc_code
[
0
]);
if
(
dataReferences
[
i
].
doc_code
[
0
].
includes
(
"FORM"
))
{
datarow
.
push
(
dataReferences
[
i
].
subject
[
0
]);
apiContent
=
"contentkey2"
;
datarow
.
push
(
dataReferences
[
i
].
doc_type
[
0
]);
}
datarow
.
push
(
dataReferences
[
i
].
usr_dpt
[
0
]);
let
responseDataContent
=
await
axios
.
get
(
process
.
env
.
REACT_APP_MAIN_APIURL
+
'/DocumentManagement/'
+
apiContent
+
'/'
+
dataReferences
[
i
].
doc_id
[
0
],
{
headers
:
{
'accept'
:
'application/xml'
}
})
for
(
let
j
=
0
;
j
<
this
.
state
.
selectReferences
.
length
;
j
++
)
{
let
dataContent
;
if
(
this
.
state
.
selectReferences
[
j
]
==
(
dataReferences
[
i
].
subject
[
0
]))
{
parseString
(
responseDataContent
.
data
,
function
(
err
,
result
)
{
checked
=
true
;
dataContent
=
result
.
contentCollection
.
content
;
break
;
})
}
if
(
dataContent
!=
undefined
&&
dataReferences
[
i
].
doc_type
[
0
]
!=
"FORM"
)
{
for
(
let
j
=
0
;
j
<
dataContent
.
length
;
j
++
)
{
content
+=
"<p>"
+
dataContent
[
j
].
cont_title
[
0
]
+
"</p>"
+
dataContent
[
j
].
cont
[
0
];
}
}
if
(
checked
)
{
}
datarow
.
push
(
dataReferences
[
i
].
subject
[
0
]
+
" true"
);
if
(
dataContent
!=
undefined
&&
dataReferences
[
i
].
doc_type
[
0
]
==
"FORM"
)
{
}
else
{
content
=
"<p>"
+
dataContent
[
0
].
cont_title
[
0
]
+
"</p>"
;
datarow
.
push
(
dataReferences
[
i
].
subject
[
0
]
+
" false"
);
}
let
checked
=
false
;
datarow
.
push
(
dataReferences
[
i
].
doc_code
[
0
]);
datarow
.
push
(
dataReferences
[
i
].
subject
[
0
]);
datarow
.
push
(
dataReferences
[
i
].
doc_type
[
0
]);
datarow
.
push
(
dataReferences
[
i
].
usr_dpt
[
0
]);
for
(
let
j
=
0
;
j
<
this
.
state
.
selectReferences
.
length
;
j
++
)
{
if
(
this
.
state
.
selectReferences
[
j
]
==
(
dataReferences
[
i
].
doc_code
[
0
]
+
" - "
+
dataReferences
[
i
].
subject
[
0
]))
{
checked
=
true
;
break
;
}
}
this
.
state
.
dataReferences
.
push
(
datarow
);
}
}
if
(
checked
)
{
datarow
.
push
(
dataReferences
[
i
].
doc_code
[
0
]
+
" - "
+
dataReferences
[
i
].
subject
[
0
]
+
" true"
);
}
else
{
datarow
.
push
(
dataReferences
[
i
].
doc_code
[
0
]
+
" - "
+
dataReferences
[
i
].
subject
[
0
]
+
" false"
);
}
datarow
.
push
(
content
);
datarow
.
push
(
dataReferences
[
i
].
user_id
[
0
]);
this
.
state
.
dataReferences
.
push
(
datarow
);
}
}
}
}
tableScope
=
$
(
'#tableScope'
).
DataTable
({
tableScope
=
$
(
'#tableScope'
).
DataTable
({
...
@@ -432,6 +450,20 @@ class FormApprover extends Component {
...
@@ -432,6 +450,20 @@ class FormApprover extends Component {
render
:
function
(
data
,
type
,
row
)
{
render
:
function
(
data
,
type
,
row
)
{
return
"<input type='checkbox' name='listReference[]' "
+
((
data
.
includes
(
"true"
))
?
"checked"
:
""
)
+
" value='"
+
data
+
"'/>"
;
return
"<input type='checkbox' name='listReference[]' "
+
((
data
.
includes
(
"true"
))
?
"checked"
:
""
)
+
" value='"
+
data
+
"'/>"
;
}
}
},
{
visible
:
false
,
orderable
:
false
,
targets
:
5
,
render
:
function
(
data
,
type
,
row
)
{
return
"<div>"
+
data
+
"</div>"
;
}
},
{
visible
:
false
,
searchable
:
false
,
orderable
:
false
,
targets
:
6
}
}
]
]
})
})
...
@@ -439,10 +471,10 @@ class FormApprover extends Component {
...
@@ -439,10 +471,10 @@ class FormApprover extends Component {
e
.
preventDefault
();
e
.
preventDefault
();
let
data
=
tableReference
.
row
(
$
(
this
).
parents
(
"tr"
)).
data
();
let
data
=
tableReference
.
row
(
$
(
this
).
parents
(
"tr"
)).
data
();
if
(
e
.
target
.
checked
)
{
if
(
e
.
target
.
checked
)
{
self
.
state
.
copyReferences
.
push
(
data
[
1
]);
self
.
state
.
copyReferences
.
push
(
data
[
0
]
+
" - "
+
data
[
1
]);
self
.
state
.
validAddReference
=
true
;
self
.
state
.
validAddReference
=
true
;
}
else
{
}
else
{
let
i
=
self
.
state
.
copyReferences
.
indexOf
(
data
[
1
]);
let
i
=
self
.
state
.
copyReferences
.
indexOf
(
data
[
0
]
+
" - "
+
data
[
1
]);
self
.
state
.
copyReferences
.
splice
(
i
,
1
);
self
.
state
.
copyReferences
.
splice
(
i
,
1
);
if
(
self
.
state
.
copyReferences
.
length
==
0
)
{
if
(
self
.
state
.
copyReferences
.
length
==
0
)
{
self
.
state
.
validAddReference
=
false
;
self
.
state
.
validAddReference
=
false
;
...
@@ -453,7 +485,7 @@ class FormApprover extends Component {
...
@@ -453,7 +485,7 @@ class FormApprover extends Component {
tableReference
.
on
(
"click"
,
"a"
,
function
(
e
)
{
tableReference
.
on
(
"click"
,
"a"
,
function
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
let
data
=
tableReference
.
row
(
$
(
this
).
parents
(
"tr"
)).
data
();
let
data
=
tableReference
.
row
(
$
(
this
).
parents
(
"tr"
)).
data
();
window
.
open
(
"http://"
+
localStorage
.
getItem
(
'host'
)
+
"/previewdocument?subject="
+
data
[
1
],
"_blank"
);
window
.
open
(
"http://"
+
localStorage
.
getItem
(
'host'
)
+
"/previewdocument?subject="
+
data
[
1
]
+
"&userid="
+
data
[
6
]
,
"_blank"
);
})
})
}
}
}
catch
(
err
)
{
}
catch
(
err
)
{
...
@@ -712,11 +744,21 @@ class FormApprover extends Component {
...
@@ -712,11 +744,21 @@ class FormApprover extends Component {
parseString
(
responseDataCheckSubject
.
data
,
function
(
err
,
result
)
{
parseString
(
responseDataCheckSubject
.
data
,
function
(
err
,
result
)
{
dataCheckSubject
=
result
.
documentCollection
.
document
;
dataCheckSubject
=
result
.
documentCollection
.
document
;
})
})
if
(
dataCheckSubject
!=
undefined
&&
dataCheckSubject
[
0
].
doc_code
[
0
].
includes
(
this
.
state
.
businessUnit
))
{
if
(
dataCheckSubject
!=
undefined
)
{
clonePage
[
index
]
=
true
;
let
isAlreadyExist
=
false
;
alert
(
"Document with same subject is already exist in your department!"
);
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
{
}
else
{
clonePage
[
index
+
1
]
=
true
;
alert
(
"There is no data document for subject "
+
this
.
state
.
subject
)
;
}
}
}
catch
(
err
)
{
}
catch
(
err
)
{
clonePage
[
index
]
=
true
;
clonePage
[
index
]
=
true
;
...
@@ -1535,15 +1577,6 @@ class FormApprover extends Component {
...
@@ -1535,15 +1577,6 @@ class FormApprover extends Component {
this
.
setState
({
isTableReferenceDraw
:
true
});
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
//fungsi halaman add reference
handleSubmitReference
=
async
()
=>
{
handleSubmitReference
=
async
()
=>
{
this
.
changePageReference
();
this
.
changePageReference
();
...
@@ -3099,8 +3132,7 @@ class FormApprover extends Component {
...
@@ -3099,8 +3132,7 @@ class FormApprover extends Component {
<
table
className
=
"my-table table table-striped table-hover"
id
=
"tableShowReference"
>
<
table
className
=
"my-table table table-striped table-hover"
id
=
"tableShowReference"
>
<
thead
>
<
thead
>
<
tr
>
<
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-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-2 col-lg-2 col-md-2 col-sm-2"
>
Code
<
/th
>
<
th
className
=
"col-xl-1 col-lg-1 col-md-1 col-sm-1"
style
=
{{
width
:
"50px"
}}
>
#
<
/th
>
<
th
className
=
"col-xl-1 col-lg-1 col-md-1 col-sm-1"
style
=
{{
width
:
"50px"
}}
>
#
<
/th
>
<
/tr
>
<
/tr
>
<
/thead
>
<
/thead
>
...
@@ -3110,7 +3142,6 @@ class FormApprover extends Component {
...
@@ -3110,7 +3142,6 @@ class FormApprover extends Component {
return
(
return
(
<
tr
key
=
{
index
}
>
<
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
)}
>
{
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
}
<
td
><
input
type
=
"checkbox"
name
=
"listShowReference[]"
value
=
{
reference
}
onChange
=
{(
e
)
=>
this
.
handleSelectReference
(
e
)}
/></
td
>
onChange
=
{(
e
)
=>
this
.
handleSelectReference
(
e
)}
/></
td
>
<
/tr
>
<
/tr
>
...
@@ -3138,9 +3169,7 @@ class FormApprover extends Component {
...
@@ -3138,9 +3169,7 @@ class FormApprover extends Component {
}
}
<
/div
>
<
/div
>
<
div
hidden
=
{
!
this
.
state
.
pageReference
}
>
<
div
hidden
=
{
!
this
.
state
.
pageReference
}
>
<
div
className
=
"form-group"
>
<
table
className
=
"display"
width
=
"100%"
id
=
"tableReference"
><
/table
>
<
table
className
=
"display"
width
=
"100%"
id
=
"tableReference"
><
/table
>
<
/div
>
<
div
className
=
"form-group row"
>
<
div
className
=
"form-group row"
>
<
div
className
=
"col-xl-12 col-lg-12 col-md-12 col-sm-12 text-right"
>
<
div
className
=
"col-xl-12 col-lg-12 col-md-12 col-sm-12 text-right"
>
<
Button
color
=
"danger"
onClick
=
{()
=>
this
.
changePageReference
()}
>&
nbsp
;
Cancel
&
nbsp
;
<
/Button>  
;
<
Button
color
=
"danger"
onClick
=
{()
=>
this
.
changePageReference
()}
>&
nbsp
;
Cancel
&
nbsp
;
<
/Button>  
;
...
...
src/FormCreateDocument.js
View file @
84c9ef98
...
@@ -89,7 +89,7 @@ class FormCreate extends Component {
...
@@ -89,7 +89,7 @@ class FormCreate extends Component {
datarow
.
push
(
dataReferences
[
i
].
subject
[
0
]);
datarow
.
push
(
dataReferences
[
i
].
subject
[
0
]);
datarow
.
push
(
dataReferences
[
i
].
doc_type
[
0
]);
datarow
.
push
(
dataReferences
[
i
].
doc_type
[
0
]);
datarow
.
push
(
dataReferences
[
i
].
usr_dpt
[
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
(
content
);
datarow
.
push
(
dataReferences
[
i
].
user_id
[
0
]);
datarow
.
push
(
dataReferences
[
i
].
user_id
[
0
]);
this
.
state
.
dataReferences
.
push
(
datarow
);
this
.
state
.
dataReferences
.
push
(
datarow
);
...
@@ -287,9 +287,19 @@ class FormCreate extends Component {
...
@@ -287,9 +287,19 @@ class FormCreate extends Component {
parseString
(
responseDataCheckSubject
.
data
,
function
(
err
,
result
)
{
parseString
(
responseDataCheckSubject
.
data
,
function
(
err
,
result
)
{
dataCheckSubject
=
result
.
documentCollection
.
document
;
dataCheckSubject
=
result
.
documentCollection
.
document
;
})
})
if
(
dataCheckSubject
!=
undefined
&&
dataCheckSubject
[
0
].
doc_code
[
0
].
includes
(
this
.
state
.
businessUnit
))
{
if
(
dataCheckSubject
!=
undefined
)
{
clonePage
[
index
]
=
true
;
let
isAlreadyExist
=
false
;
alert
(
"Document with same subject is already exist in your department!"
);
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
{
}
else
{
clonePage
[
index
+
1
]
=
true
;
clonePage
[
index
+
1
]
=
true
;
}
}
...
@@ -608,15 +618,6 @@ class FormCreate extends Component {
...
@@ -608,15 +618,6 @@ class FormCreate extends Component {
this
.
setState
({
isTableReferenceDraw
:
true
});
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
//fungsi halaman add reference
handleSubmitReference
=
async
()
=>
{
handleSubmitReference
=
async
()
=>
{
this
.
changePageReference
();
this
.
changePageReference
();
...
@@ -766,10 +767,16 @@ class FormCreate extends Component {
...
@@ -766,10 +767,16 @@ class FormCreate extends Component {
body
:
JSON
.
stringify
(
postdataDokumen
)
body
:
JSON
.
stringify
(
postdataDokumen
)
})
})
//Get Data Document By Subject
//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'
}
})
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
)
{
parseString
(
responseDataDocument
.
data
,
function
(
err
,
result
)
{
d
oc_id
=
result
.
documentCollection
.
document
[
0
].
doc_id
[
0
]
;
d
ataDocument
=
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
=
{
let
dataRevision
=
{
"doc_id"
:
doc_id
,
"doc_id"
:
doc_id
,
"rev_code"
:
this
.
state
.
revisionCode
,
"rev_code"
:
this
.
state
.
revisionCode
,
...
@@ -1316,8 +1323,7 @@ class FormCreate extends Component {
...
@@ -1316,8 +1323,7 @@ class FormCreate extends Component {
<
table
className
=
"my-table table table-striped table-hover"
id
=
"tableShowReference"
>
<
table
className
=
"my-table table table-striped table-hover"
id
=
"tableShowReference"
>
<
thead
>
<
thead
>
<
tr
>
<
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-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-2 col-lg-2 col-md-2 col-sm-2"
>
Code
<
/th
>
<
th
className
=
"col-xl-1 col-lg-1 col-md-1 col-sm-1"
style
=
{{
width
:
"50px"
}}
>
#
<
/th
>
<
th
className
=
"col-xl-1 col-lg-1 col-md-1 col-sm-1"
style
=
{{
width
:
"50px"
}}
>
#
<
/th
>
<
/tr
>
<
/tr
>
<
/thead
>
<
/thead
>
...
@@ -1327,7 +1333,6 @@ class FormCreate extends Component {
...
@@ -1327,7 +1333,6 @@ class FormCreate extends Component {
return
(
return
(
<
tr
key
=
{
index
}
>
<
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
)}
>
{
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
}
<
td
><
input
type
=
"checkbox"
name
=
"listShowReference[]"
value
=
{
reference
}
onChange
=
{(
e
)
=>
this
.
handleSelectReference
(
e
)}
/></
td
>
onChange
=
{(
e
)
=>
this
.
handleSelectReference
(
e
)}
/></
td
>
<
/tr
>
<
/tr
>
...
...
src/FormRevisionDocument.js
View file @
84c9ef98
...
@@ -246,9 +246,9 @@ class FormRevision extends Component {
...
@@ -246,9 +246,9 @@ class FormRevision extends Component {
}
}
}
}
if
(
checked
)
{
if
(
checked
)
{
datarow
.
push
(
dataDepartmentList
[
i
].
DepartmentCode
[
0
]
+
"
-
"
+
dataDepartmentList
[
i
].
Department
[
0
]
+
" true"
);
datarow
.
push
(
dataDepartmentList
[
i
].
DepartmentCode
[
0
]
+
"
-
"
+
dataDepartmentList
[
i
].
Department
[
0
]
+
" true"
);
}
else
{
}
else
{
datarow
.
push
(
dataDepartmentList
[
i
].
DepartmentCode
[
0
]
+
"
-
"
+
dataDepartmentList
[
i
].
Department
[
0
]
+
" false"
);
datarow
.
push
(
dataDepartmentList
[
i
].
DepartmentCode
[
0
]
+
"
-
"
+
dataDepartmentList
[
i
].
Department
[
0
]
+
" false"
);
}
}
this
.
state
.
dataScopes
.
push
(
datarow
);
this
.
state
.
dataScopes
.
push
(
datarow
);
}
}
...
@@ -259,26 +259,44 @@ class FormRevision extends Component {
...
@@ -259,26 +259,44 @@ class FormRevision extends Component {
})
})
if
(
dataReferences
!=
undefined
)
{
if
(
dataReferences
!=
undefined
)
{
for
(
let
i
=
0
;
i
<
dataReferences
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
dataReferences
.
length
;
i
++
)
{
if
(
dataReferences
[
i
].
subject
[
0
]
!=
this
.
state
.
subjectEdit
)
{
let
datarow
=
[];
let
datarow
=
[];
let
content
=
""
;
let
checked
=
false
;
let
apiContent
=
"contentkey"
;
datarow
.
push
(
dataReferences
[
i
].
doc_code
[
0
]);
if
(
dataReferences
[
i
].
doc_code
[
0
].
includes
(
"FORM"
))
{
datarow
.
push
(
dataReferences
[
i
].
subject
[
0
]);
apiContent
=
"contentkey2"
;
datarow
.
push
(
dataReferences
[
i
].
doc_type
[
0
]);
}
datarow
.
push
(
dataReferences
[
i
].
usr_dpt
[
0
]);
let
responseDataContent
=
await
axios
.
get
(
process
.
env
.
REACT_APP_MAIN_APIURL
+
'/DocumentManagement/'
+
apiContent
+
'/'
+
dataReferences
[
i
].
doc_id
[
0
],
{
headers
:
{
'accept'
:
'application/xml'
}
})
for
(
let
j
=
0
;
j
<
this
.
state
.
selectReferences
.
length
;
j
++
)
{
let
dataContent
;
if
(
this
.
state
.
selectReferences
[
j
]
==
(
dataReferences
[
i
].
subject
[
0
]))
{
parseString
(
responseDataContent
.
data
,
function
(
err
,
result
)
{
checked
=
true
;
dataContent
=
result
.
contentCollection
.
content
;
break
;
})
}
if
(
dataContent
!=
undefined
&&
dataReferences
[
i
].
doc_type
[
0
]
!=
"FORM"
)
{
for
(
let
j
=
0
;
j
<
dataContent
.
length
;
j
++
)
{
content
+=
"<p>"
+
dataContent
[
j
].
cont_title
[
0
]
+
"</p>"
+
dataContent
[
j
].
cont
[
0
];
}
}
if
(
checked
)
{
}
datarow
.
push
(
dataReferences
[
i
].
subject
[
0
]
+
" true"
);
if
(
dataContent
!=
undefined
&&
dataReferences
[
i
].
doc_type
[
0
]
==
"FORM"
)
{
}
else
{
content
=
"<p>"
+
dataContent
[
0
].
cont_title
[
0
]
+
"</p>"
;
datarow
.
push
(
dataReferences
[
i
].
subject
[
0
]
+
" false"
);
}
let
checked
=
false
;
datarow
.
push
(
dataReferences
[
i
].
doc_code
[
0
]);
datarow
.
push
(
dataReferences
[
i
].
subject
[
0
]);
datarow
.
push
(
dataReferences
[
i
].
doc_type
[
0
]);
datarow
.
push
(
dataReferences
[
i
].
usr_dpt
[
0
]);
for
(
let
j
=
0
;
j
<
this
.
state
.
selectReferences
.
length
;
j
++
)
{
if
(
this
.
state
.
selectReferences
[
j
]
==
(
dataReferences
[
i
].
doc_code
[
0
]
+
" - "
+
dataReferences
[
i
].
subject
[
0
]))
{
checked
=
true
;
break
;
}
}
this
.
state
.
dataReferences
.
push
(
datarow
);
}
}
if
(
checked
)
{
datarow
.
push
(
dataReferences
[
i
].
doc_code
[
0
]
+
" - "
+
dataReferences
[
i
].
subject
[
0
]
+
" true"
);
}
else
{
datarow
.
push
(
dataReferences
[
i
].
doc_code
[
0
]
+
" - "
+
dataReferences
[
i
].
subject
[
0
]
+
" false"
);
}
datarow
.
push
(
content
);
datarow
.
push
(
dataReferences
[
i
].
user_id
[
0
]);
this
.
state
.
dataReferences
.
push
(
datarow
);
}
}
}
}
tableScope
=
$
(
'#tableScope'
).
DataTable
({
tableScope
=
$
(
'#tableScope'
).
DataTable
({
...
@@ -383,6 +401,20 @@ class FormRevision extends Component {
...
@@ -383,6 +401,20 @@ class FormRevision extends Component {
render
:
function
(
data
,
type
,
row
)
{
render
:
function
(
data
,
type
,
row
)
{
return
"<input type='checkbox' name='listReference[]' "
+
((
data
.
includes
(
"true"
))
?
"checked"
:
""
)
+
" value='"
+
data
+
"'/>"
;
return
"<input type='checkbox' name='listReference[]' "
+
((
data
.
includes
(
"true"
))
?
"checked"
:
""
)
+
" value='"
+
data
+
"'/>"
;
}
}
},
{
visible
:
false
,
orderable
:
false
,
targets
:
5
,
render
:
function
(
data
,
type
,
row
)
{
return
"<div>"
+
data
+
"</div>"
;
}
},
{
visible
:
false
,
searchable
:
false
,
orderable
:
false
,
targets
:
6
}
}
]
]
})
})
...
@@ -390,10 +422,10 @@ class FormRevision extends Component {
...
@@ -390,10 +422,10 @@ class FormRevision extends Component {
e
.
preventDefault
();
e
.
preventDefault
();
let
data
=
tableReference
.
row
(
$
(
this
).
parents
(
"tr"
)).
data
();
let
data
=
tableReference
.
row
(
$
(
this
).
parents
(
"tr"
)).
data
();
if
(
e
.
target
.
checked
)
{
if
(
e
.
target
.
checked
)
{
self
.
state
.
copyReferences
.
push
(
data
[
1
]);
self
.
state
.
copyReferences
.
push
(
data
[
0
]
+
" - "
+
data
[
1
]);
self
.
state
.
validAddReference
=
true
;
self
.
state
.
validAddReference
=
true
;
}
else
{
}
else
{
let
i
=
self
.
state
.
copyReferences
.
indexOf
(
data
[
1
]);
let
i
=
self
.
state
.
copyReferences
.
indexOf
(
data
[
0
]
+
" - "
+
data
[
1
]);
self
.
state
.
copyReferences
.
splice
(
i
,
1
);
self
.
state
.
copyReferences
.
splice
(
i
,
1
);
if
(
self
.
state
.
copyReferences
.
length
==
0
)
{
if
(
self
.
state
.
copyReferences
.
length
==
0
)
{
self
.
state
.
validAddReference
=
false
;
self
.
state
.
validAddReference
=
false
;
...
@@ -404,7 +436,7 @@ class FormRevision extends Component {
...
@@ -404,7 +436,7 @@ class FormRevision extends Component {
tableReference
.
on
(
"click"
,
"a"
,
function
(
e
)
{
tableReference
.
on
(
"click"
,
"a"
,
function
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
let
data
=
tableReference
.
row
(
$
(
this
).
parents
(
"tr"
)).
data
();
let
data
=
tableReference
.
row
(
$
(
this
).
parents
(
"tr"
)).
data
();
window
.
open
(
"http://"
+
localStorage
.
getItem
(
'host'
)
+
"/previewdocument?subject="
+
data
[
1
],
"_blank"
);
window
.
open
(
"http://"
+
localStorage
.
getItem
(
'host'
)
+
"/previewdocument?subject="
+
data
[
1
]
+
"&userid="
+
data
[
6
]
,
"_blank"
);
})
})
}
catch
(
err
)
{
}
catch
(
err
)
{
this
.
setState
({
isFetched
:
true
,
fetchError
:
true
});
this
.
setState
({
isFetched
:
true
,
fetchError
:
true
});
...
@@ -464,11 +496,21 @@ class FormRevision extends Component {
...
@@ -464,11 +496,21 @@ class FormRevision extends Component {
parseString
(
responseDataCheckSubject
.
data
,
function
(
err
,
result
)
{
parseString
(
responseDataCheckSubject
.
data
,
function
(
err
,
result
)
{
dataCheckSubject
=
result
.
documentCollection
.
document
;
dataCheckSubject
=
result
.
documentCollection
.
document
;
})
})
if
(
dataCheckSubject
!=
undefined
&&
dataCheckSubject
[
0
].
doc_code
[
0
].
includes
(
this
.
state
.
businessUnit
))
{
if
(
dataCheckSubject
!=
undefined
)
{
clonePage
[
index
]
=
true
;
let
isAlreadyExist
=
false
;
alert
(
"Document with same subject is already exist in your department!"
);
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
{
}
else
{
clonePage
[
index
+
1
]
=
true
;
alert
(
"There is no data document for subject "
+
this
.
state
.
subject
)
;
}
}
}
catch
(
err
)
{
}
catch
(
err
)
{
clonePage
[
index
]
=
true
;
clonePage
[
index
]
=
true
;
...
@@ -894,15 +936,6 @@ class FormRevision extends Component {
...
@@ -894,15 +936,6 @@ class FormRevision extends Component {
this
.
setState
({
isTableReferenceDraw
:
true
});
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
//fungsi halaman add reference
handleSubmitReference
=
async
()
=>
{
handleSubmitReference
=
async
()
=>
{
this
.
changePageReference
();
this
.
changePageReference
();
...
@@ -2161,8 +2194,7 @@ class FormRevision extends Component {
...
@@ -2161,8 +2194,7 @@ class FormRevision extends Component {
<
table
className
=
"my-table table table-striped table-hover"
id
=
"tableShowReference"
>
<
table
className
=
"my-table table table-striped table-hover"
id
=
"tableShowReference"
>
<
thead
>
<
thead
>
<
tr
>
<
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-11 col-lg-11 col-md-11 col-sm-1"
>
Code
Document
<
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-1 col-lg-1 col-md-1 col-sm-1"
style
=
{{
width
:
"50px"
}}
>
#
<
/th
>
<
th
className
=
"col-xl-1 col-lg-1 col-md-1 col-sm-1"
style
=
{{
width
:
"50px"
}}
>
#
<
/th
>
<
/tr
>
<
/tr
>
<
/thead
>
<
/thead
>
...
@@ -2172,7 +2204,6 @@ class FormRevision extends Component {
...
@@ -2172,7 +2204,6 @@ class FormRevision extends Component {
return
(
return
(
<
tr
key
=
{
index
}
>
<
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
)}
>
{
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
}
<
td
><
input
type
=
"checkbox"
name
=
"listShowReference[]"
value
=
{
reference
}
onChange
=
{(
e
)
=>
this
.
handleSelectReference
(
e
)}
/></
td
>
onChange
=
{(
e
)
=>
this
.
handleSelectReference
(
e
)}
/></
td
>
<
/tr
>
<
/tr
>
...
@@ -2190,7 +2221,7 @@ class FormRevision extends Component {
...
@@ -2190,7 +2221,7 @@ class FormRevision extends Component {
<
div
className
=
"col-xl-12 col-lg-12 col-md-12 col-sm-12 text-right"
>
<
div
className
=
"col-xl-12 col-lg-12 col-md-12 col-sm-12 text-right"
>
<
Button
color
=
"primary"
onClick
=
{(
e
)
=>
this
.
changePage
(
e
,
"Back"
,
3
)}
>
<
Button
color
=
"primary"
onClick
=
{(
e
)
=>
this
.
changePage
(
e
,
"Back"
,
3
)}
>
&
nbsp
;{
this
.
state
.
labelChangePage
[
0
]}
&
nbsp
;
<
/Button>  
;
&
nbsp
;{
this
.
state
.
labelChangePage
[
0
]}
&
nbsp
;
<
/Button>  
;
<
Button
color
=
"primary"
onClick
=
{(
e
)
=>
this
.
changePage
(
e
,
"Next"
,
3
)}
>
<
Button
color
=
"primary"
onClick
=
{(
e
)
=>
this
.
changePage
(
e
,
"Next"
,
3
)}
>
&
nbsp
;{
this
.
state
.
labelChangePage
[
1
]}
&
nbsp
;
<
/Button
>
&
nbsp
;{
this
.
state
.
labelChangePage
[
1
]}
&
nbsp
;
<
/Button
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
@@ -2200,9 +2231,7 @@ class FormRevision extends Component {
...
@@ -2200,9 +2231,7 @@ class FormRevision extends Component {
}
}
<
/div
>
<
/div
>
<
div
hidden
=
{
!
this
.
state
.
pageReference
}
>
<
div
hidden
=
{
!
this
.
state
.
pageReference
}
>
<
div
className
=
"form-group"
>
<
table
className
=
"display"
width
=
"100%"
id
=
"tableReference"
><
/table
>
<
table
className
=
"display"
width
=
"100%"
id
=
"tableReference"
><
/table
>
<
/div
>
<
div
className
=
"form-group row"
>
<
div
className
=
"form-group row"
>
<
div
className
=
"col-xl-12 col-lg-12 col-md-12 col-sm-12 text-right"
>
<
div
className
=
"col-xl-12 col-lg-12 col-md-12 col-sm-12 text-right"
>
<
Button
color
=
"danger"
onClick
=
{()
=>
this
.
changePageReference
()}
>&
nbsp
;
Cancel
&
nbsp
;
<
/Button>  
;
<
Button
color
=
"danger"
onClick
=
{()
=>
this
.
changePageReference
()}
>&
nbsp
;
Cancel
&
nbsp
;
<
/Button>  
;
...
...
src/YourDocument.js
View file @
84c9ef98
...
@@ -21,7 +21,7 @@ class YourDocument extends Component {
...
@@ -21,7 +21,7 @@ class YourDocument extends Component {
}
}
}
}
componentDidMount
=
async
()
=>
{
componentDidMount
=
async
()
=>
{
try
{
//
try {
var
parseString
=
require
(
'xml2js'
).
parseString
;
var
parseString
=
require
(
'xml2js'
).
parseString
;
let
user_id
=
JSON
.
parse
(
localStorage
.
getItem
(
"dataLogin"
)).
user_id
[
0
];
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'
}
})
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 {
...
@@ -63,7 +63,7 @@ class YourDocument extends Component {
datarow
.
push
(
dataAllDocument
[
i
].
doc_code
[
0
]);
datarow
.
push
(
dataAllDocument
[
i
].
doc_code
[
0
]);
datarow
.
push
(
dataAllDocument
[
i
].
subject
[
0
]);
datarow
.
push
(
dataAllDocument
[
i
].
subject
[
0
]);
datarow
.
push
(
dataAllDocument
[
i
].
doc_status
[
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
(
JSON
.
parse
(
localStorage
.
getItem
(
"dataLDAP"
))[
"Full Name"
]);
datarow
.
push
(
content
);
datarow
.
push
(
content
);
datarow
.
push
(
dataAllDocument
[
i
].
user_id
);
datarow
.
push
(
dataAllDocument
[
i
].
user_id
);
...
@@ -182,10 +182,10 @@ class YourDocument extends Component {
...
@@ -182,10 +182,10 @@ class YourDocument extends Component {
}
}
}
}
await
this
.
setState
({
fetchStatus
:
true
});
await
this
.
setState
({
fetchStatus
:
true
});
}
catch
(
error
)
{
//
} catch (error) {
await
this
.
setState
({
fetchStatus
:
true
,
fetchError
:
true
});
//
await this.setState({ fetchStatus: true, fetchError: true });
console
.
log
(
error
+
""
);
//
console.log(error + "");
}
//
}
}
}
retryRetrievingData
=
(
e
)
=>
{
retryRetrievingData
=
(
e
)
=>
{
e
.
preventDefault
();
e
.
preventDefault
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment