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
Show 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";
...
@@ -10,7 +10,6 @@ import PopUpDelete from "./PopUpDelete";
import
api
from
'../../api'
;
import
api
from
'../../api'
;
import
CreateManagementDoc
from
'./CreateManagementDoc'
;
import
CreateManagementDoc
from
'./CreateManagementDoc'
;
import
EditManagementDoc
from
'./EditManagementDoc'
;
import
EditManagementDoc
from
'./EditManagementDoc'
;
import
PropagateLoader
from
"react-spinners/PropagateLoader"
var
ct
=
require
(
"../../library/CustomTable"
);
var
ct
=
require
(
"../../library/CustomTable"
);
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
...
@@ -34,6 +33,7 @@ export default class getAllDocument extends Component {
...
@@ -34,6 +33,7 @@ export default class getAllDocument extends Component {
componentDidMount
()
{
componentDidMount
()
{
this
.
getData
()
this
.
getData
()
console
.
log
(
this
.
props
.
userCompActive
)
}
}
componentWillReceiveProps
(
props
)
{
componentWillReceiveProps
(
props
)
{
...
@@ -55,8 +55,12 @@ export default class getAllDocument extends Component {
...
@@ -55,8 +55,12 @@ export default class getAllDocument extends Component {
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
dataTable
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
let
dataTable
=
[]
return
[
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
,
index
,
item
.
document_name
,
item
.
document_name
,
item
.
description
,
item
.
description
,
...
@@ -67,8 +71,10 @@ export default class getAllDocument extends Component {
...
@@ -67,8 +71,10 @@ export default class getAllDocument extends Component {
String
(
Number
(
item
.
document_size
)
/
1000
+
' KB'
),
String
(
Number
(
item
.
document_size
)
/
1000
+
' KB'
),
item
.
created_by
,
item
.
created_by
,
item
.
created_at
,
item
.
created_at
,
]
])
}
})
})
console
.
log
(
dataTable
)
this
.
setState
({
dataTable
,
loading
:
false
})
this
.
setState
({
dataTable
,
loading
:
false
})
let
docPath
=
response
.
data
.
data
.
map
((
item
)
=>
{
let
docPath
=
response
.
data
.
data
.
map
((
item
)
=>
{
return
[
return
[
...
@@ -276,16 +282,7 @@ export default class getAllDocument extends Component {
...
@@ -276,16 +282,7 @@ export default class getAllDocument extends Component {
"Type"
,
"File Size"
,
"Created By"
,
"Created Date"
"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
(
return
(
<
div
style
=
{{
width
:
'100%'
}}
>
<
div
style
=
{{
width
:
'100%'
}}
>
...
@@ -296,7 +293,7 @@ export default class getAllDocument extends Component {
...
@@ -296,7 +293,7 @@ export default class getAllDocument extends Component {
{
this
.
state
.
messageAlert
}
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Alert
>
<
/Snackbar
>
<
/Snackbar
>
{
this
.
state
.
loading
&&
loadingComponent
}
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
<
MUIDataTable
// theme={getMuiTheme()}
// theme={getMuiTheme()}
...
...
src/container/DocumentManagement/CreateManagementDoc.js
View file @
d3587957
...
@@ -494,11 +494,11 @@ export default class CreateManagementDoc extends Component {
...
@@ -494,11 +494,11 @@ export default class CreateManagementDoc extends Component {
<
button
<
button
type
=
"button"
type
=
"button"
onClick
=
{()
=>
onClick
=
{()
=>
this
.
setState
({
loading
:
true
},
()
=>
{
// {this.props.handleLoading(1)
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
validasi
()
this
.
validasi
()
},
100
);
},
100
)
})
// }
}
}
>
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
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'
...
@@ -13,6 +13,7 @@ import ManualBookETMS from './ManualBookETMS'
import
PopUpKonfirmasi
from
"./PopUpKonfirmasi"
;
import
PopUpKonfirmasi
from
"./PopUpKonfirmasi"
;
import
Constant
from
'../../library/Constant'
import
Constant
from
'../../library/Constant'
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
PropagateLoader
from
"react-spinners/PropagateLoader"
const
Alert
=
withStyles
({
const
Alert
=
withStyles
({
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
...
@@ -28,7 +29,8 @@ export default class DocumentManagement extends Component {
...
@@ -28,7 +29,8 @@ export default class DocumentManagement extends Component {
btnedit
:
false
,
btnedit
:
false
,
btndelete
:
false
,
btndelete
:
false
,
load
:
false
,
load
:
false
,
name
:
''
name
:
''
,
userCompActive
:
[]
}
}
}
}
...
@@ -65,6 +67,7 @@ export default class DocumentManagement extends Component {
...
@@ -65,6 +67,7 @@ export default class DocumentManagement extends Component {
componentDidMount
()
{
componentDidMount
()
{
this
.
getDataDocument
()
this
.
getDataDocument
()
this
.
getPermission
()
this
.
getPermission
()
this
.
getDetailUser
()
}
}
getDataDocument
(
id
,
name
)
{
getDataDocument
(
id
,
name
)
{
...
@@ -102,7 +105,7 @@ export default class DocumentManagement extends Component {
...
@@ -102,7 +105,7 @@ export default class DocumentManagement extends Component {
}
}
else
if
(
response
.
data
.
message
===
"Data was Saved Successfully"
)
{
else
if
(
response
.
data
.
message
===
"Data was Saved Successfully"
)
{
this
.
getDataDocument
(
settingID
,
menuName
)
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
{
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
...
@@ -163,7 +166,77 @@ export default class DocumentManagement extends Component {
...
@@ -163,7 +166,77 @@ export default class DocumentManagement extends Component {
this
.
setState
({
alert
:
false
})
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
()
{
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
(
return
(
<
div
style
=
{{
height
:
this
.
props
.
height
,
backgroundColor
:
'#f8f8f8'
}}
>
<
div
style
=
{{
height
:
this
.
props
.
height
,
backgroundColor
:
'#f8f8f8'
}}
>
{
/* {this.props.load && ()} */
}
{
/* {this.props.load && ()} */
}
...
@@ -172,13 +245,15 @@ export default class DocumentManagement extends Component {
...
@@ -172,13 +245,15 @@ export default class DocumentManagement extends Component {
{
this
.
state
.
messageAlert
}
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Alert
>
<
/Snackbar
>
<
/Snackbar
>
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Document
Management
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Document
Management
<
/Typography
>
<
/div
>
<
/div
>
<
div
style
=
{{
padding
:
20
}}
>
<
div
style
=
{{
padding
:
20
}}
>
{
this
.
state
.
loading
&&
loadingComponent
}
<
Paper
style
=
{{
padding
:
20
}}
>
<
Paper
style
=
{{
padding
:
20
}}
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
<
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"
>
<
a
data
-
tip
=
{
'Add'
}
data
-
for
=
"add"
>
<
div
style
=
{{
display
:
'grid'
,
justifyContent
:
'flex-end'
}}
>
<
div
style
=
{{
display
:
'grid'
,
justifyContent
:
'flex-end'
}}
>
<
button
<
button
...
@@ -211,7 +286,7 @@ export default class DocumentManagement extends Component {
...
@@ -211,7 +286,7 @@ export default class DocumentManagement extends Component {
)
)
})}
})}
<
/Tabs
>
<
/Tabs
>
{
this
.
state
.
loadTable
&&
(
{
this
.
state
.
loadTable
&&
this
.
state
.
visibleTrue
&&
(
<
AllDocument
<
AllDocument
data
=
{
this
.
state
.
listData
[
this
.
state
.
tab
]}
data
=
{
this
.
state
.
listData
[
this
.
state
.
tab
]}
refresh
=
{
this
.
state
.
refresh
}
refresh
=
{
this
.
state
.
refresh
}
...
@@ -219,6 +294,7 @@ export default class DocumentManagement extends Component {
...
@@ -219,6 +294,7 @@ export default class DocumentManagement extends Component {
btndelete
=
{
this
.
state
.
btndelete
}
btndelete
=
{
this
.
state
.
btndelete
}
load
=
{
this
.
state
.
load
}
load
=
{
this
.
state
.
load
}
setId
=
{
this
.
state
.
id
}
setId
=
{
this
.
state
.
id
}
userCompActive
=
{
this
.
state
.
userCompActive
}
/
>
/
>
// this.state.id === 68542 ?
// this.state.id === 68542 ?
// <AuditTahunan
// <AuditTahunan
...
@@ -282,6 +358,7 @@ export default class DocumentManagement extends Component {
...
@@ -282,6 +358,7 @@ export default class DocumentManagement extends Component {
createDocument
=
{
this
.
createDocument
.
bind
(
this
)}
createDocument
=
{
this
.
createDocument
.
bind
(
this
)}
setting_id
=
{
this
.
state
.
id
}
setting_id
=
{
this
.
state
.
id
}
name
=
{
this
.
state
.
name
}
name
=
{
this
.
state
.
name
}
handleLoading
=
{
this
.
handleLoading
.
bind
(
this
)}
/
>
/
>
)}
)}
<
/div
>
<
/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