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
932be3a2
Commit
932be3a2
authored
Dec 23, 2020
by
faisalhamdi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upload cat
parent
30ff1786
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
32 deletions
+75
-32
CorporateAnnualTargetMR.js
src/container/MonthlyReport/CorporateAnnualTargetMR.js
+75
-32
No files found.
src/container/MonthlyReport/CorporateAnnualTargetMR.js
View file @
932be3a2
...
@@ -64,7 +64,10 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -64,7 +64,10 @@ export default class CorporateAnnualTargetMR extends Component {
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
value
),
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
value
),
},
},
visibleCATMR
:
true
,
visibleCATMR
:
true
,
updateBy
:
'-'
updateBy
:
'-'
,
notes
:
""
,
judulColumn
:
null
,
get_for
:
"view"
}
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
}
}
...
@@ -76,6 +79,12 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -76,6 +79,12 @@ export default class CorporateAnnualTargetMR extends Component {
this
.
getMaxAch
()
this
.
getMaxAch
()
}
}
handleGetFor
(
type
)
{
this
.
setState
({
get_for
:
type
},
()
=>
{
this
.
getLatestUpdate
()
})
}
getLatestUpdate
()
{
getLatestUpdate
()
{
let
payload
=
{
let
payload
=
{
"report_id"
:
this
.
props
.
report_id
,
"report_id"
:
this
.
props
.
report_id
,
...
@@ -91,7 +100,8 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -91,7 +100,8 @@ export default class CorporateAnnualTargetMR extends Component {
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
this
.
setState
({
updateBy
:
response
.
data
.
data
.
latest_update
===
null
?
'-'
:
response
.
data
.
data
.
latest_update
updateBy
:
response
.
data
.
data
.
latest_update
===
null
?
'-'
:
response
.
data
.
data
.
latest_update
,
notes
:
response
.
data
.
data
.
notes_update
===
null
?
""
:
response
.
data
.
data
.
notes_update
})
})
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
typeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
typeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
...
@@ -194,7 +204,7 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -194,7 +204,7 @@ export default class CorporateAnnualTargetMR extends Component {
}
}
})
})
// console.log(dataTable);
// console.log(dataTable);
this
.
setState
({
dataTable
,
loading
:
false
})
this
.
setState
({
dataTable
,
loading
:
false
,
saveDraft
:
true
})
}
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
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
...
@@ -208,7 +218,7 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -208,7 +218,7 @@ export default class CorporateAnnualTargetMR extends Component {
}
else
{
}
else
{
// console.log('terrrr')
// console.log('terrrr')
//
//
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
,
saveDraft
:
true
})
}
}
console
.
log
(
dataTable
);
console
.
log
(
dataTable
);
})
})
...
@@ -216,10 +226,10 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -216,10 +226,10 @@ export default class CorporateAnnualTargetMR extends Component {
downloadTemplate
=
async
()
=>
{
downloadTemplate
=
async
()
=>
{
let
res
=
await
fetch
(
let
res
=
await
fetch
(
`
${
process
.
env
.
REACT_APP_URL_MAIN_BE
}
/public/transaction/monthly_report/cat/download_template?report_id=
${
this
.
props
.
report_id
}
&&company_id=
${
this
.
props
.
company
.
company_id
}
&&year=
${
this
.
props
.
periode
}
`
`
${
process
.
env
.
REACT_APP_URL_MAIN_BE
}
/public/transaction/monthly_report/cat/download_template?report_id=
${
this
.
props
.
report_id
}
&&company_id=
${
this
.
props
.
company
.
company_id
}
&&year=
2021
`
)
)
res
=
await
res
.
blob
()
console
.
log
(
res
);
console
.
log
(
res
);
res
=
await
res
.
blob
()
if
(
res
.
size
>
0
)
{
if
(
res
.
size
>
0
)
{
let
url
=
window
.
URL
.
createObjectURL
(
res
);
let
url
=
window
.
URL
.
createObjectURL
(
res
);
let
a
=
document
.
createElement
(
'a'
);
let
a
=
document
.
createElement
(
'a'
);
...
@@ -350,15 +360,15 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -350,15 +360,15 @@ export default class CorporateAnnualTargetMR extends Component {
})
})
})
})
let
body
=
{
let
body
=
{
"monthly_report_id"
:
this
.
props
.
monthlyReportId
,
//
"monthly_report_id": this.props.monthlyReportId,
"company_id"
:
this
.
props
.
company
.
company_id
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
,
"periode"
:
"2021"
,
"report_id"
:
this
.
props
.
report_id
,
"report_id"
:
this
.
props
.
report_id
,
"status"
:
type
,
"status"
:
type
,
"months"
:
this
.
props
.
month
.
month_id
,
"months"
:
this
.
props
.
month
.
month_id
,
"corporate_annual_target"
:
data
"corporate_annual_target"
:
data
}
}
console
.
log
(
data
);
console
.
log
(
JSON
.
stringify
(
body
)
);
api
.
create
(
'UPLOAD'
).
uploadMonthlyReportCAT
(
body
).
then
(
response
=>
{
api
.
create
(
'UPLOAD'
).
uploadMonthlyReportCAT
(
body
).
then
(
response
=>
{
// console.log(response);
// console.log(response);
if
(
response
.
data
)
{
if
(
response
.
data
)
{
...
@@ -494,7 +504,7 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -494,7 +504,7 @@ export default class CorporateAnnualTargetMR extends Component {
let
payload
=
{
let
payload
=
{
"monthly_report_id"
:
this
.
props
.
monthlyReportId
,
"monthly_report_id"
:
this
.
props
.
monthlyReportId
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
,
"periode"
:
"2021"
,
"report_id"
:
this
.
props
.
report_id
,
"report_id"
:
this
.
props
.
report_id
,
"status"
:
type
,
"status"
:
type
,
"months"
:
this
.
props
.
month
.
month_id
,
"months"
:
this
.
props
.
month
.
month_id
,
...
@@ -1241,6 +1251,7 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -1241,6 +1251,7 @@ export default class CorporateAnnualTargetMR extends Component {
)}
)}
<
/div
>
<
/div
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
,
marginTop
:
20
}}
>
Last
Updated
by
:
{
this
.
state
.
updateBy
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
,
marginTop
:
20
}}
>
Last
Updated
by
:
{
this
.
state
.
updateBy
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
Notes
:
{
this
.
state
.
notes
}
<
/Typography
>
<
/div
>
<
/div
>
<
div
className
=
"grid grid-2x"
style
=
{{
marginTop
:
20
}}
>
<
div
className
=
"grid grid-2x"
style
=
{{
marginTop
:
20
}}
>
<
div
className
=
"col-1"
>
<
div
className
=
"col-1"
>
...
@@ -1267,7 +1278,27 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -1267,7 +1278,27 @@ export default class CorporateAnnualTargetMR extends Component {
<
div
className
=
"col-2"
><
/div>
<
div
className
=
"col-2"
><
/div>
:
:
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
button
{
this
.
state
.
get_for
==
'view'
&&
<
button
className
=
"button"
type
=
"button"
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
}}
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
this
.
handleGetFor
(
'edit'
)
})
}}
>
<
div
style
=
{{
backgroundColor
:
'#fff'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
,
border
:
'solid 1px #354960'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#354960'
,
textAlign
:
'center'
}}
>
Edit
<
/Typography
>
<
/div
>
<
/button>
}
{
this
.
state
.
get_for
==
'edit'
&&
<
button
className
=
"button"
className
=
"button"
type
=
"button"
type
=
"button"
style
=
{{
style
=
{{
...
@@ -1280,8 +1311,7 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -1280,8 +1311,7 @@ export default class CorporateAnnualTargetMR extends Component {
onClick
=
{()
=>
{
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
})
this
.
handleValidate
()
// this.handleValidate()
},
100
);
},
100
);
})
})
}}
}}
...
@@ -1289,38 +1319,43 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -1289,38 +1319,43 @@ export default class CorporateAnnualTargetMR extends Component {
<
div
style
=
{{
backgroundColor
:
'#fff'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
,
border
:
'solid 1px #354960'
}}
>
<
div
style
=
{{
backgroundColor
:
'#fff'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
,
border
:
'solid 1px #354960'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#354960'
,
textAlign
:
'center'
}}
>
Calculate
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#354960'
,
textAlign
:
'center'
}}
>
Calculate
<
/Typography
>
<
/div
>
<
/div
>
<
/button
>
<
/button>
}
<
button
{
this
.
state
.
get_for
===
'edit'
&&
<
button
className
=
"button"
className
=
"button"
type
=
"button"
type
=
"button"
style
=
{{
style
=
{{
backgroundColor
:
'transparent'
,
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
editable
!==
true
?
'pointer'
:
'default'
,
cursor
:
this
.
state
.
saveDraft
!==
true
?
'pointer'
:
'default'
,
borderColor
:
'transparent'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
outline
:
'none'
,
marginRight
:
20
marginRight
:
20
}}
}}
onClick
=
{()
=>
onClick
=
{()
=>
this
.
state
.
editable
===
true
?
this
.
state
.
saveDraft
===
true
?
null
:
null
:
this
.
state
.
handleTekTekTek
==
=
1
?
null
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
backToMonthlyReport
(
'draft'
)
this
.
backToMonthlyReport
(
'draft'
)
})
})
}
}
>
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
{
this
.
state
.
saveDraft
?
<
LightTooltip
title
=
{
"Data Incomplete"
}
arrow
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
as
Draft
<
/Typography
>
<
/LightTooltip>
:
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
as
Draft
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
as
Draft
<
/Typography
>
}
<
/div
>
<
/div
>
<
/button
>
<
/button>
}
<
button
{
this
.
state
.
get_for
===
'edit'
&&
<
button
type
=
"button"
type
=
"button"
disabled
=
{
this
.
state
.
buttonError
}
disabled
=
{
this
.
state
.
buttonError
}
onClick
=
{()
=>
onClick
=
{()
=>
this
.
state
.
buttonError
?
this
.
state
.
buttonError
?
this
.
setState
({
alert
:
true
,
messageAlert
:
'Data is not complete !'
,
tipeAlert
:
'warning'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
'Data is not complete !'
,
tipeAlert
:
'warning'
})
:
:
this
.
state
.
handleTekTekTek
==
=
1
?
null
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
backToMonthlyReport
(
'submitted'
)
this
.
backToMonthlyReport
(
'submitted'
)
})}
})}
...
@@ -1332,9 +1367,14 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -1332,9 +1367,14 @@ export default class CorporateAnnualTargetMR extends Component {
}}
}}
>
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
{
this
.
state
.
buttonError
?
<
LightTooltip
title
=
{
"Data Incomplete"
}
arrow
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
&
Complete
<
/Typography
>
<
/LightTooltip>
:
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
&
Complete
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
&
Complete
<
/Typography
>
}
<
/div
>
<
/div
>
<
/button
>
<
/button>
}
<
/div>
<
/div>
}
}
<
/div
>
<
/div
>
...
@@ -1346,7 +1386,7 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -1346,7 +1386,7 @@ export default class CorporateAnnualTargetMR extends Component {
<
div
style
=
{{
padding
:
20
}}
>
<
div
style
=
{{
padding
:
20
}}
>
<
div
>
<
div
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
{
this
.
props
.
company
.
company_name
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
{
this
.
props
.
company
.
company_name
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
Period
:
{
this
.
props
.
periode
}
(
rev
.{
this
.
props
.
revision
})
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
Period
:
{
String
(
this
.
props
.
month
.
month_value
).
toLocaleUpperCase
()}
{
this
.
props
.
periode
}
(
rev
.{
this
.
props
.
revision
})
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
in
IDR
mn
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
in
IDR
mn
<
/Typography
>
<
/div
>
<
/div
>
<
div
style
=
{{
marginTop
:
20
,
width
:
this
.
props
.
width
-
(
this
.
props
.
open
===
true
?
400
:
150
)
}}
>
<
div
style
=
{{
marginTop
:
20
,
width
:
this
.
props
.
width
-
(
this
.
props
.
open
===
true
?
400
:
150
)
}}
>
...
@@ -1360,13 +1400,13 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -1360,13 +1400,13 @@ export default class CorporateAnnualTargetMR extends Component {
<
/MuiThemeProvider
>
<
/MuiThemeProvider
>
)}
)}
<
/div
>
<
/div
>
<
div
className
=
"grid grid-2x"
style
=
{{
marginTop
:
20
}}
>
<
div
className
=
"grid grid-2x"
style
=
{{
marginTop
:
10
,
padding
:
20
}}
>
<
div
className
=
"col-1"
>
<
div
className
=
"col-1"
style
=
{{
paddingLeft
:
0
}}
>
<
button
<
button
type
=
"button"
type
=
"button"
onClick
=
{()
=>
this
.
setState
({
loading
:
true
},
()
=>
{
onClick
=
{()
=>
this
.
setState
({
loading
:
true
,
visibleCATMR
:
true
},
()
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
props
.
onClickClose
()
this
.
getItemHierarki
()
},
100
);
},
100
);
})}
})}
style
=
{{
style
=
{{
...
@@ -1381,8 +1421,6 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -1381,8 +1421,6 @@ export default class CorporateAnnualTargetMR extends Component {
<
/div
>
<
/div
>
<
/button
>
<
/button
>
<
/div
>
<
/div
>
{
/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === "draft" || this.props.status === 'submitted') ? */
}
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
button
<
button
className
=
"button"
className
=
"button"
...
@@ -1427,7 +1465,12 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -1427,7 +1465,12 @@ export default class CorporateAnnualTargetMR extends Component {
}
}
>
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
{
this
.
state
.
saveDraft
?
<
LightTooltip
title
=
{
"Data Incomplete"
}
arrow
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
as
Draft
<
/Typography
>
<
/LightTooltip>
:
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
as
Draft
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
as
Draft
<
/Typography
>
}
<
/div
>
<
/div
>
<
/button
>
<
/button
>
<
button
<
button
...
...
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