Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Tia-dev
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dida Adams Arizona
Tia-dev
Commits
d3587957
Commit
d3587957
authored
Oct 03, 2020
by
Dida Adams Arizona
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'rifka' into 'master'
issue managdoc See merge request
!435
parents
4b705e7e
22f5a09c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
108 additions
and
34 deletions
+108
-34
AllDocument.js
src/container/DocumentManagement/AllDocument.js
+22
-25
CreateManagementDoc.js
src/container/DocumentManagement/CreateManagementDoc.js
+5
-5
DocumentManagement.js
src/container/DocumentManagement/DocumentManagement.js
+81
-4
No files found.
src/container/DocumentManagement/AllDocument.js
View file @
d3587957
...
...
@@ -10,7 +10,6 @@ import PopUpDelete from "./PopUpDelete";
import
api
from
'../../api'
;
import
CreateManagementDoc
from
'./CreateManagementDoc'
;
import
EditManagementDoc
from
'./EditManagementDoc'
;
import
PropagateLoader
from
"react-spinners/PropagateLoader"
var
ct
=
require
(
"../../library/CustomTable"
);
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
...
...
@@ -34,6 +33,7 @@ export default class getAllDocument extends Component {
componentDidMount
()
{
this
.
getData
()
console
.
log
(
this
.
props
.
userCompActive
)
}
componentWillReceiveProps
(
props
)
{
...
...
@@ -55,20 +55,26 @@ export default class getAllDocument extends Component {
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
dataTable
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
return
[
index
,
item
.
document_name
,
item
.
description
,
item
.
company_name
,
item
.
document_month
,
item
.
document_periode
,
item
.
document_type
,
String
(
Number
(
item
.
document_size
)
/
1000
+
' KB'
),
item
.
created_by
,
item
.
created_at
,
]
let
dataTable
=
[]
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
let
indexId
=
this
.
props
.
userCompActive
.
findIndex
((
val
)
=>
val
==
item
.
company_id
)
console
.
log
(
indexId
)
if
(
indexId
!==
-
1
)
{
dataTable
.
push
(
[
index
,
item
.
document_name
,
item
.
description
,
item
.
company_name
,
item
.
document_month
,
item
.
document_periode
,
item
.
document_type
,
String
(
Number
(
item
.
document_size
)
/
1000
+
' KB'
),
item
.
created_by
,
item
.
created_at
,
])
}
})
console
.
log
(
dataTable
)
this
.
setState
({
dataTable
,
loading
:
false
})
let
docPath
=
response
.
data
.
data
.
map
((
item
)
=>
{
return
[
...
...
@@ -276,16 +282,7 @@ export default class getAllDocument extends Component {
"Type"
,
"File Size"
,
"Created By"
,
"Created Date"
]
const
loadingComponent
=
(
<
div
style
=
{{
position
:
'absolute'
,
zIndex
:
110
,
top
:
0
,
left
:
0
,
width
:
'100%'
,
height
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
background
:
'rgba(255,255,255,0.8)'
}}
>
<
PropagateLoader
// css={override}
size
=
{
20
}
color
=
{
"#274B80"
}
loading
=
{
this
.
state
.
loading
}
/
>
<
/div
>
);
return
(
<
div
style
=
{{
width
:
'100%'
}}
>
...
...
@@ -296,7 +293,7 @@ export default class getAllDocument extends Component {
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Snackbar
>
{
this
.
state
.
loading
&&
loadingComponent
}
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
// theme={getMuiTheme()}
...
...
src/container/DocumentManagement/CreateManagementDoc.js
View file @
d3587957
...
...
@@ -494,11 +494,11 @@ export default class CreateManagementDoc extends Component {
<
button
type
=
"button"
onClick
=
{()
=>
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
validasi
()
},
100
);
})
// {this.props.handleLoading(1)
setTimeout
(()
=>
{
this
.
validasi
()
},
100
)
// }
}
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
...
...
src/container/DocumentManagement/DocumentManagement.js
View file @
d3587957
...
...
@@ -13,6 +13,7 @@ import ManualBookETMS from './ManualBookETMS'
import
PopUpKonfirmasi
from
"./PopUpKonfirmasi"
;
import
Constant
from
'../../library/Constant'
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
PropagateLoader
from
"react-spinners/PropagateLoader"
const
Alert
=
withStyles
({
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
...
...
@@ -28,7 +29,8 @@ export default class DocumentManagement extends Component {
btnedit
:
false
,
btndelete
:
false
,
load
:
false
,
name
:
''
name
:
''
,
userCompActive
:
[]
}
}
...
...
@@ -65,6 +67,7 @@ export default class DocumentManagement extends Component {
componentDidMount
()
{
this
.
getDataDocument
()
this
.
getPermission
()
this
.
getDetailUser
()
}
getDataDocument
(
id
,
name
)
{
...
...
@@ -102,7 +105,7 @@ export default class DocumentManagement extends Component {
}
else
if
(
response
.
data
.
message
===
"Data was Saved Successfully"
)
{
this
.
getDataDocument
(
settingID
,
menuName
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
,
settingID
,
menuName
,
visibleCreate
:
false
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
,
settingID
,
menuName
,
visibleCreate
:
false
,
loading
:
false
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
...
...
@@ -163,7 +166,77 @@ export default class DocumentManagement extends Component {
this
.
setState
({
alert
:
false
})
}
handleLoading
(
tipe
)
{
this
.
setState
({
loading
:
tipe
==
0
?
false
:
true
})
}
getDetailUser
()
{
let
userId
=
localStorage
.
getItem
(
Constant
.
USER
)
api
.
create
().
getDetailUser
(
userId
).
then
((
response
)
=>
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
userCompany
:
response
.
data
.
data
.
company
,
visibleTrue
:
false
},
()
=>
{
this
.
getCompanyActive
()
})
}
}
}
})
}
getCompanyActive
()
{
api
.
create
().
getPerusahaanActive
().
then
((
response
)
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
compActive
=
[]
let
userCompActive
=
[]
this
.
state
.
userCompany
.
map
((
item
,
index
)
=>
{
let
indeks
=
data
.
findIndex
((
val
)
=>
val
.
company_id
==
item
)
if
(
indeks
!==
-
1
&&
String
(
data
[
indeks
].
status
).
toLocaleLowerCase
()
==
'active'
){
userCompActive
.
push
(
item
)
}
})
data
.
map
((
item
,
index
)
=>
{
if
(
String
(
item
.
status
).
toLocaleLowerCase
()
==
'active'
)
{
compActive
.
push
(
item
)
}
})
if
(
compActive
.
length
==
userCompActive
.
length
){
this
.
setState
({
btnadd
:
true
})
}
else
{
this
.
setState
({
btnadd
:
false
})
}
this
.
setState
({
userCompActive
,
visibleTrue
:
true
})
console
.
log
(
userCompActive
)
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
visibleTrue
:
true
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
listCompany
:
null
,
company
:
null
,
visibleTrue
:
true
})
}
})
}
render
()
{
const
loadingComponent
=
(
<
div
style
=
{{
position
:
'absolute'
,
zIndex
:
110
,
top
:
0
,
left
:
0
,
width
:
'100%'
,
height
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
background
:
'rgba(255,255,255,0.8)'
}}
>
<
PropagateLoader
// css={override}
size
=
{
20
}
color
=
{
"#274B80"
}
loading
=
{
this
.
state
.
loading
}
/
>
<
/div
>
);
return
(
<
div
style
=
{{
height
:
this
.
props
.
height
,
backgroundColor
:
'#f8f8f8'
}}
>
{
/* {this.props.load && ()} */
}
...
...
@@ -172,13 +245,15 @@ export default class DocumentManagement extends Component {
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Snackbar
>
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Document
Management
<
/Typography
>
<
/div
>
<
div
style
=
{{
padding
:
20
}}
>
{
this
.
state
.
loading
&&
loadingComponent
}
<
Paper
style
=
{{
padding
:
20
}}
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
{
this
.
state
.
btncreate
&&
<
span
>
{
(
this
.
state
.
btncreate
&&
this
.
state
.
btnadd
)
&&
<
span
>
<
a
data
-
tip
=
{
'Add'
}
data
-
for
=
"add"
>
<
div
style
=
{{
display
:
'grid'
,
justifyContent
:
'flex-end'
}}
>
<
button
...
...
@@ -211,7 +286,7 @@ export default class DocumentManagement extends Component {
)
})}
<
/Tabs
>
{
this
.
state
.
loadTable
&&
(
{
this
.
state
.
loadTable
&&
this
.
state
.
visibleTrue
&&
(
<
AllDocument
data
=
{
this
.
state
.
listData
[
this
.
state
.
tab
]}
refresh
=
{
this
.
state
.
refresh
}
...
...
@@ -219,6 +294,7 @@ export default class DocumentManagement extends Component {
btndelete
=
{
this
.
state
.
btndelete
}
load
=
{
this
.
state
.
load
}
setId
=
{
this
.
state
.
id
}
userCompActive
=
{
this
.
state
.
userCompActive
}
/
>
// this.state.id === 68542 ?
// <AuditTahunan
...
...
@@ -282,6 +358,7 @@ export default class DocumentManagement extends Component {
createDocument
=
{
this
.
createDocument
.
bind
(
this
)}
setting_id
=
{
this
.
state
.
id
}
name
=
{
this
.
state
.
name
}
handleLoading
=
{
this
.
handleLoading
.
bind
(
this
)}
/
>
)}
<
/div
>
...
...
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