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
afa0db98
Commit
afa0db98
authored
Jul 17, 2022
by
Arfin Syadziy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ENV-DEV-CR-CAFRM' into 'ENV-DEPLOYMENT'
Env dev cr cafrm See merge request
!1600
parents
41171d80
bfd45510
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
159 additions
and
224 deletions
+159
-224
CafrmDocument.js
src/container/CAFRM/CafrmDocument.js
+100
-128
CreateCarfmDocument.js
src/container/CAFRM/CreateCarfmDocument.js
+52
-89
TableCafrmDocument.js
src/container/CAFRM/TableCafrmDocument.js
+5
-6
DocumentManagement.js
src/container/DocumentManagement/DocumentManagement.js
+1
-0
homeRoutes.js
src/router/homeRoutes.js
+1
-1
No files found.
src/container/C
RFM/Carf
mDocument.js
→
src/container/C
AFRM/Cafr
mDocument.js
View file @
afa0db98
import
React
,
{
Component
}
from
'react'
import
{
withStyles
}
from
'@material-ui/core/styles'
;
import
{
createMuiTheme
,
MuiThemeProvider
,
Paper
,
Snackbar
,
Tab
,
Tabs
,
Typography
}
from
'@material-ui/core'
;
import
React
,
{
Component
}
from
'react'
import
{
withStyles
}
from
'@material-ui/core/styles'
;
import
{
Paper
,
Snackbar
,
Typography
}
from
'@material-ui/core'
;
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
Constant
from
'../../library/Constant'
;
import
Images
from
'../../assets/Images'
;
import
ReactTooltip
from
'react-tooltip'
;
import
api
from
'../../api'
;
import
PropagateLoader
from
"react-spinners/PropagateLoader"
import
TableDocument
from
"./TableDocument"
;
import
CreateCarfmDoc
from
"./CreateCarfmDoc"
;
import
TableDocument
from
"./Table
Cafrm
Document"
;
import
CreateCarfmDoc
from
"./CreateCarfmDoc
ument
"
;
const
Alert
=
withStyles
({})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
...
...
@@ -23,44 +23,34 @@ export default class CarfmDocument extends Component {
load
:
false
,
name
:
''
,
userCompActive
:
[],
isHasAccessDocument
:
true
,
submenu_id
:
0
,
submenu_name
:
""
,
menu_title
:
""
,
loading
:
true
,
finishLoad
:
false
,
loading
:
false
}
}
async
componentDidMount
()
{
// this.getPermission()
await
this
.
getMenuName
();
await
this
.
getPermission
(
this
.
state
.
submenu_name
)
await
this
.
getDataCarfm
();
await
this
.
getDetailUser
();
await
this
.
setState
({
finishLoad
:
true
})
componentDidMount
()
{
this
.
getMenuName
();
}
async
getMenuName
(){
await
api
.
create
().
getMenuByUser
().
then
(
getMenuName
(){
api
.
create
().
getMenuByUser
().
then
(
response
=>
{
if
(
response
.
data
){
if
(
response
.
data
.
status
===
'success'
){
response
.
data
.
data
.
map
(
(
item
)
=>
{
let
arr
=
window
.
location
.
href
.
split
(
'/'
);
if
(
item
.
class_id
==
arr
.
slice
(
-
1
)[
0
]){
if
(
item
.
class_id
==
arr
.
slice
(
-
1
)[
0
]){
this
.
setState
({
submenu_id
:
item
.
menu_id
,
submenu_name
:
item
.
menu_name
.
toLowerCase
(),
menu_title
:
item
.
menu_name
.
replace
(
/
\b\w
/g
,
c
=>
c
.
toUpperCase
())
},
()
=>
{
this
.
getPermission
(
this
.
state
.
submenu_name
)
// this.getDataCarfm();
this
.
getDetailUser
();
})
}
}
...
...
@@ -71,50 +61,46 @@ export default class CarfmDocument extends Component {
)
}
async
getDataCarfm
(
create
){
let
payload
=
{
submenu_id
:
this
.
state
.
submenu_id
}
await
api
.
create
().
getCarfmDocumentBySubmenu
(
payload
).
then
(
response
=>
{
if
(
response
){
if
(
response
.
data
.
status
===
'success'
){
let
dataList
=
[]
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
dataList
.
push
(
item
)
})
this
.
setState
({
isHasAccessDocument
:
true
,
listData
:
dataList
,
refresh
:
create
==
undefined
?
''
:
create
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
)
}
async
getPermission
(
subMenu
)
{
// getDataCarfm(create){
// let payload = {
// submenu_id : this.state.submenu_id
// }
// api.create().getCarfmDocumentBySubmenu(payload).then(
// response => {
// if(response){
// if(response.data.status === 'success'){
// let dataList = []
// response.data.data.map((item, index) => {
// dataList.push(item)
// })
// this.setState({
// listData: dataList,
// refresh: create == undefined ? '' : create,
// loading: false
// })
// } else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
// if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
// setTimeout(() => {
// localStorage.removeItem(Constant.TOKEN)
// window.location.reload();
// }, 1000);
// }
// })
// }
// }else {
// this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
// }
// }
// )
// }
getPermission
(
subMenu
)
{
let
payload
=
{
menu
:
subMenu
}
a
wait
a
pi
.
create
().
getPermission
(
payload
).
then
(
response
=>
{
api
.
create
().
getPermission
(
payload
).
then
(
response
=>
{
if
(
response
.
data
)
{
console
.
log
(
`status get permission
${
response
.
data
.
status
}
`
);
if
(
response
.
data
.
status
===
"success"
)
{
...
...
@@ -124,9 +110,6 @@ export default class CarfmDocument extends Component {
btndownload
:
response
.
data
.
data
.
download
,
load
:
true
,
})
this
.
setState
({
},
console
.
log
(
`btnview
${
this
.
state
.
btnview
}
, btncreate
${
this
.
state
.
btncreate
}
, btndownload
${
this
.
state
.
btnview
}
`
),
console
.
log
(
response
.
data
.
data
))
console
.
log
(
"btn create "
+
this
.
state
.
btncreate
);
}
else
{
this
.
setState
({
...
...
@@ -139,13 +122,13 @@ export default class CarfmDocument extends Component {
})
}
async
getDetailUser
()
{
getDetailUser
()
{
let
userId
=
localStorage
.
getItem
(
Constant
.
USER
)
a
wait
a
pi
.
create
().
getDetailUser
(
userId
).
then
((
response
)
=>
{
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
,
loading
:
false
},
()
=>
{
this
.
setState
({
userCompany
:
response
.
data
.
data
.
company
,
visibleTrue
:
false
},
()
=>
{
this
.
getCompanyActive
()
console
.
log
(
this
.
state
.
userCompany
);
})
...
...
@@ -155,8 +138,8 @@ export default class CarfmDocument extends Component {
})
}
async
getCompanyActive
()
{
a
wait
a
pi
.
create
().
getPerusahaanActive
().
then
((
response
)
=>
{
getCompanyActive
()
{
api
.
create
().
getPerusahaanActive
().
then
((
response
)
=>
{
console
.
log
(
"getcompanyactive start"
);
console
.
log
(
response
.
data
.
data
);
console
.
log
(
"getcompanyactive stop"
);
...
...
@@ -200,15 +183,15 @@ export default class CarfmDocument extends Component {
})
}
async
createDocument
(
payload
)
{
//upload apinya disini
createDocument
(
payload
)
{
//upload apinya disini
this
.
setState
({
loading
:
true
})
a
wait
a
pi
.
create
().
uploadCarfmDocument
(
payload
).
then
(
response
=>
{
api
.
create
().
uploadCarfmDocument
(
payload
).
then
(
response
=>
{
// console.log(response)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
message
===
"Data was Saved Successfully"
)
{
this
.
setState
({
visibleCreate
:
false
,
loading
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
this
.
getDataCarfm
(
'create'
)
//
this.getDataCarfm('create')
}
else
{
this
.
setState
({
visibleCreate
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
...
...
@@ -260,31 +243,27 @@ export default class CarfmDocument extends Component {
/
>
<
/div
>
);
return
(
<
div
style
=
{{
height
:
this
.
props
.
height
,
backgroundColor
:
'#f8f8f8'
}}
>
{
/* {this.props.load && ()} */
}
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
6000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
this
.
state
.
tipeAlert
}
>
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Snackbar
>
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
{
this
.
state
.
menu_title
}
<
/Typography
>
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
{
this
.
state
.
menu_title
}
<
/Typography
>
<
/div
>
<
div
style
=
{{
padding
:
20
}}
>
{
this
.
state
.
loading
&&
loadingComponent
}
{
this
.
state
.
btnview
&&
this
.
state
.
finishLoad
&&
(
{
this
.
state
.
btnview
&&
(
<
Paper
style
=
{{
padding
:
20
}}
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
{
console
.
log
(
"renderbtn"
+
this
.
state
.
btncreate
)}
{(
this
.
state
.
btncreate
)
&&
<
span
>
{
/* {console.log("renderbtn" + this.state.btncreate)} */
}
{(
this
.
state
.
btncreate
)
&&
(
<
span
>
<
a
data
-
tip
=
{
'Add'
}
data
-
for
=
"add"
>
<
div
style
=
{{
display
:
'grid'
,
justifyContent
:
'flex-end'
}}
>
<
button
...
...
@@ -297,16 +276,16 @@ export default class CarfmDocument extends Component {
<
/div
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"add"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/span>
}
<
/span
>
)}
<
/div
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
this
.
state
.
visibleTrue
&&
(
<
TableDocument
{
this
.
state
.
visibleTrue
&&
(
<
TableDocument
data
=
{
this
.
state
.
listData
}
refresh
=
{
this
.
state
.
refresh
}
load
=
{
true
}
load
=
{
this
.
state
.
load
}
userCompActive
=
{
this
.
state
.
userCompActive
}
handleLoading
=
{
this
.
handleLoading
.
bind
(
this
)}
name
=
{
this
.
state
.
name
}
...
...
@@ -315,18 +294,10 @@ export default class CarfmDocument extends Component {
/>
)
}
<
/div
>
<
/Paper
>
)}
{
!
this
.
state
.
btnview
&&
this
.
state
.
finishLoad
&&
(
<
Paper
style
=
{{
padding
:
20
}}
>
<
label
>
You
Don
't Have Any Access in Document Management</label>
</Paper>
)}
<
/div
>
{
this
.
state
.
visibleCreate
&&
(
<
CreateCarfmDoc
onClickClose
=
{()
=>
this
.
setState
({
visibleCreate
:
false
})}
...
...
@@ -334,6 +305,7 @@ export default class CarfmDocument extends Component {
createDocument
=
{
this
.
createDocument
.
bind
(
this
)}
handleLoading
=
{
this
.
handleLoading
.
bind
(
this
)}
submenu_id
=
{
this
.
state
.
submenu_id
}
menuName
=
{
this
.
state
.
menu_title
}
/
>
)}
...
...
src/container/C
RFM/CreateCarfmDoc
.js
→
src/container/C
AFRM/CreateCarfmDocument
.js
View file @
afa0db98
...
...
@@ -19,6 +19,7 @@ export default class CreateCarfmDoc extends Component {
super
(
props
)
this
.
state
=
{
perusahaan
:
null
,
perusahaanData
:
null
,
getPerusahaan
:
null
,
errorPerusahaan
:
false
,
msgErrorPerusahaan
:
''
,
...
...
@@ -45,29 +46,24 @@ export default class CreateCarfmDoc extends Component {
fileType
:
''
,
docId
:
''
,
sizeUpload
:
"1"
,
menuName
:
null
,
saveDisable
:
false
,
submitVal
:
0
isClickSave
:
0
}
}
async
componentDidMount
()
{
this
.
props
.
handleLoading
(
1
)
await
this
.
getMenuName
()
await
this
.
getDataCompany
()
await
this
.
getPeriode
()
await
this
.
getMonth
()
await
this
.
getFileSize
()
this
.
props
.
handleLoading
(
0
)
componentDidMount
()
{
this
.
getDataCompany
()
this
.
getPeriode
()
this
.
getMonth
()
this
.
getFileSize
()
}
async
getFileSize
()
{
getFileSize
()
{
let
body
=
{
group
:
'MAX_FILE_SIZE'
,
company_id
:
0
,
type
:
'MAX_FILE_SIZE'
}
a
wait
a
pi
.
create
().
getAllSettingByType
(
body
).
then
(
response
=>
{
api
.
create
().
getAllSettingByType
(
body
).
then
(
response
=>
{
// console.log(response);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
...
...
@@ -95,8 +91,8 @@ export default class CreateCarfmDoc extends Component {
})
}
async
getDataCompany
()
{
a
wait
a
pi
.
create
().
getPerusahaanUserActive
().
then
((
response
)
=>
{
getDataCompany
()
{
api
.
create
().
getPerusahaanUserActive
().
then
((
response
)
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
...
...
@@ -111,10 +107,10 @@ export default class CreateCarfmDoc extends Component {
// company_name: 'Default'
// })
let
typeProps
=
{
options
:
typeData
.
sort
((
a
,
b
)
=>
a
.
company_name
.
localeCompare
(
b
.
company_name
)
),
options
:
typeData
.
sort
((
a
,
b
)
=>
a
.
company_name
-
b
.
company_name
),
getOptionLabel
:
(
option
)
=>
option
.
company_name
,
};
this
.
setState
({
perusahaan
:
typeProps
},
()
=>
console
.
log
(
this
.
state
.
perusahaan
)
)
this
.
setState
({
perusahaan
:
typeProps
}
)
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
...
...
@@ -131,30 +127,8 @@ export default class CreateCarfmDoc extends Component {
})
}
async
getMenuName
(){
await
api
.
create
().
getMenuByUser
().
then
(
response
=>
{
if
(
response
.
data
){
if
(
response
.
data
.
status
===
'success'
){
response
.
data
.
data
.
map
(
(
item
)
=>
{
if
(
item
.
menu_id
==
this
.
props
.
submenu_id
){
this
.
setState
({
menuName
:
item
.
menu_name
}
);
}
}
)
}
}
}
)
}
async
getPeriode
()
{
await
api
.
create
().
getPeriodeTransaction
().
then
(
response
=>
{
getPeriode
()
{
api
.
create
().
getPeriodeTransaction
().
then
(
response
=>
{
let
dateNow
=
new
Date
let
year
=
format
(
dateNow
,
'yyyy'
)
if
(
response
.
data
)
{
...
...
@@ -185,8 +159,8 @@ export default class CreateCarfmDoc extends Component {
})
}
async
getMonth
()
{
a
wait
a
pi
.
create
().
getMonthTransaction
().
then
(
response
=>
{
getMonth
()
{
api
.
create
().
getMonthTransaction
().
then
(
response
=>
{
let
dateNow
=
new
Date
// let bulan = format(dateNow, 'MMMM')
if
(
response
.
data
)
{
...
...
@@ -261,7 +235,8 @@ export default class CreateCarfmDoc extends Component {
}
else
if
(
R
.
isNil
(
this
.
state
.
file
))
{
this
.
setState
({
alert
:
true
,
messageAlert
:
'File Cannot be Empty'
,
tipeAlert
:
'warning'
,
saveDisable
:
false
})
}
else
if
(
this
.
state
.
submitVal
===
1
)
{
}
else
{
console
.
log
(
this
.
state
.
isClickSave
+
" ===> di luar"
);
const
formData
=
new
FormData
();
formData
.
append
(
"file"
,
this
.
state
.
file
);
formData
.
append
(
"companyId"
,
this
.
state
.
getPerusahaan
.
company_id
);
...
...
@@ -271,7 +246,7 @@ export default class CreateCarfmDoc extends Component {
formData
.
append
(
"documentPeriode"
,
this
.
state
.
periode
.
periode
);
formData
.
append
(
"documentMonth"
,
this
.
state
.
monthId
.
month_id
);
this
.
setState
({
formData
},
()
=>
{
this
.
props
.
createDocument
(
this
.
state
.
formData
,
)
this
.
props
.
createDocument
(
this
.
state
.
formData
)
})
}
}
...
...
@@ -338,13 +313,12 @@ export default class CreateCarfmDoc extends Component {
<
/div
>
<
div
className
=
"column-2"
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
,
marginTop
:
"1.2em"
}}
>
<
TextField
value
=
{
this
.
state
.
menuName
}
value
=
{
this
.
props
.
menuName
}
InputProps
=
{{
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
placeholder
=
"Category"
disabled
size
=
"medium"
fullWidth
=
{
true
}
/
>
...
...
@@ -459,21 +433,10 @@ export default class CreateCarfmDoc extends Component {
disabled
=
{
this
.
state
.
saveDisable
}
type
=
"button"
onClick
=
{()
=>
{
this
.
props
.
handleLoading
(
1
);
this
.
setState
({
saveDisable
:
true
,
submitVal
:
this
.
state
.
submitVal
+
1
},
console
.
log
());
setTimeout
(()
=>
{
this
.
state
.
isClickSave
==
1
?
null
:
this
.
setState
({
isClickSave
:
1
},
()
=>
{
this
.
validasi
()
console
.
log
(
"vlidasi "
+
this
.
validasi
());
},
100
)
this
.
props
.
handleLoading
(
0
);
}
})
}
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
...
...
src/container/C
RFM/Table
Document.js
→
src/container/C
AFRM/TableCafrm
Document.js
View file @
afa0db98
...
...
@@ -57,7 +57,6 @@ export default class TableDocument extends Component {
let
dataTable
=
[]
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
let
indexId
=
this
.
props
.
userCompActive
.
findIndex
((
val
)
=>
val
==
item
.
company_id
)
if
(
indexId
!==
-
1
)
{
dataTable
.
push
(
[
index
,
...
...
@@ -73,22 +72,22 @@ export default class TableDocument extends Component {
item
.
values
])
}
})
// console.log(dataTable)
this
.
setState
({
dataTable
,
loading
:
false
})
let
docPath
=
response
.
data
.
data
.
map
((
item
)
=>
{
return
[
item
.
document_filepath
]
})
this
.
setState
({
docPath
,
loading
:
false
})
let
docId
=
response
.
data
.
data
.
map
((
item
)
=>
{
return
[
item
.
document_id
]
})
this
.
setState
({
docId
,
loading
:
false
})
// console.log(dataTable)
this
.
setState
({
dataTable
,
docPath
,
docId
,
loading
:
false
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
...
...
src/container/DocumentManagement/DocumentManagement.js
View file @
afa0db98
...
...
@@ -22,6 +22,7 @@ export default class DocumentManagement extends Component {
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
alert
:
false
,
tab
:
0
,
listData
:
[],
id
:
0
,
...
...
src/router/homeRoutes.js
View file @
afa0db98
...
...
@@ -20,7 +20,7 @@ import SubHolding from '../container/Reports/SubHolding';
import
SummaryTriputra
from
'../container/SummaryTriputra/SummaryOfTriputra'
;
import
MasterDataCAT
from
'../container/MasterData/MasterDataCAT/MasterDataCAT'
;
import
ProgressReport
from
'../container/ProgressReport/ProgressReport'
;
import
CarfmDocument
from
"../container/C
RFM/Carf
mDocument"
;
import
CarfmDocument
from
"../container/C
AFRM/Cafr
mDocument"
;
const
routes
=
[
{
...
...
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