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
76f099bd
Commit
76f099bd
authored
Jul 25, 2023
by
Riri Novita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simulasi RO PL
parent
56ded309
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
197 additions
and
82 deletions
+197
-82
ProfitLossRO.js
src/container/RollingOutlook/ProfitLossRO.js
+197
-82
No files found.
src/container/RollingOutlook/ProfitLossRO.js
View file @
76f099bd
...
...
@@ -87,7 +87,8 @@ export default class ProfitLossROO extends Component {
viewOnly
:
true
,
get_for
:
'view'
,
defaultCurrencyUpload
:
this
.
props
.
defaultCurrency
,
visibleAlertSave
:
false
visibleAlertSave
:
false
,
visibleButtonUpload
:
false
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
...
...
@@ -591,14 +592,106 @@ export default class ProfitLossROO extends Component {
})
}
u
ploadSimulasi
()
{
checkU
ploadSimulasi
()
{
let
payload
=
{
...
this
.
state
.
payload
,
currency_id
:
this
.
state
.
defaultCurrencyUpload
?.
id
}
api
.
create
().
checkImportRollingOutlookPL
(
payload
).
then
(
response
=>
{
// console.log(JSON.stringify(this.state.payload));
console
.
log
(
"checkUpload Response"
,
response
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
visibleUpload
:
false
,
visiblePLRO
:
false
,
loading
:
true
,
visibleButtonUpload
:
true
})
let
dataTable
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
return
[
item
.
type_report_id
,
item
.
item_report_id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
item_report
,
item
.
notes
,
item
.
last_year_total
===
""
?
"0"
:
item
.
last_year_total
,
item
.
january
===
""
?
"0"
:
item
.
january
,
item
.
february
===
""
?
"0"
:
item
.
february
,
item
.
march
===
""
?
"0"
:
item
.
march
,
item
.
april
===
""
?
"0"
:
item
.
april
,
item
.
may
===
""
?
"0"
:
item
.
may
,
item
.
june
===
""
?
"0"
:
item
.
june
,
item
.
july
===
""
?
"0"
:
item
.
july
,
item
.
august
===
""
?
"0"
:
item
.
august
,
item
.
september
===
""
?
"0"
:
item
.
september
,
item
.
october
===
""
?
"0"
:
item
.
october
,
item
.
november
===
""
?
"0"
:
item
.
november
,
item
.
december
===
""
?
"0"
:
item
.
december
,
item
.
current_year_total
===
""
?
"0"
:
item
.
current_year_total
,
""
,
item
.
order
,
]
})
this
.
setState
({
dataTable
,
dataLoaded
:
true
,
loading
:
false
,
buttonError
:
false
},
()
=>
{
this
.
state
.
dataTable
.
map
(
item
=>
{
// if (item[24].length > 0) {
// // console.log('masuk')
// this.setState({ buttonError: true, errorPreview: true })
// }
})
// console.log(this.state.buttonError)
})
console
.
log
(
"checkUpload DataTable"
,
dataTable
);
}
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
);
}
})
}
}
})
}
uploadSimulasi
(
type
)
{
let
data
=
[]
this
.
state
.
dataTable
.
map
(
i
=>
{
data
.
push
({
"item_report_id"
:
i
[
1
],
"item_report"
:
i
[
5
],
"notes"
:
String
(
i
[
6
]),
"last_year_total"
:
String
(
Number
(
i
[
7
]).
toFixed
(
1
)),
"january"
:
String
(
Number
(
i
[
8
]).
toFixed
(
1
)),
"february"
:
String
(
Number
(
i
[
9
]).
toFixed
(
1
)),
"march"
:
String
(
Number
(
i
[
10
]).
toFixed
(
1
)),
"april"
:
String
(
Number
(
i
[
11
]).
toFixed
(
1
)),
"may"
:
String
(
Number
(
i
[
12
]).
toFixed
(
1
)),
"june"
:
String
(
Number
(
i
[
13
]).
toFixed
(
1
)),
"july"
:
String
(
Number
(
i
[
14
]).
toFixed
(
1
)),
"august"
:
String
(
Number
(
i
[
15
]).
toFixed
(
1
)),
"september"
:
String
(
Number
(
i
[
16
]).
toFixed
(
1
)),
"october"
:
String
(
Number
(
i
[
17
]).
toFixed
(
1
)),
"november"
:
String
(
Number
(
i
[
18
]).
toFixed
(
1
)),
"december"
:
String
(
Number
(
i
[
19
]).
toFixed
(
1
)),
"current_year_total"
:
String
(
Number
(
i
[
20
]).
toFixed
(
1
)),
})
})
console
.
log
(
"uploadProfitLossRO Data"
,
data
)
let
body
=
{
"monthly_report_id"
:
this
.
props
.
monthlyReportId
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
,
"report_id"
:
this
.
props
.
report_id
,
"currency_id"
:
this
.
state
.
defaultCurrencyUpload
?.
id
,
"quartal"
:
this
.
props
.
quarter
,
"rolling_outlook_id"
:
this
.
props
.
rollingOutlookID
,
"status"
:
type
,
"profit_loss"
:
data
}
this
.
setState
({
loading
:
true
,
dataTable
:
[]
})
console
.
log
(
payload
)
api
.
create
().
uploadSimulasiROPL
(
payload
).
then
(
response
=>
{
console
.
log
(
body
)
api
.
create
().
uploadSimulasiROPL
(
body
).
then
(
response
=>
{
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
...
...
@@ -2407,22 +2500,6 @@ export default class ProfitLossROO extends Component {
}
<
/div
>
<
div
style
=
{{
width
:
'50%'
}}
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
<
ReactTooltip
border
=
{
true
}
id
=
"template"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Upload Simulasi'
}
data
-
for
=
"upload"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
15
}}
onClick
=
{()
=>
this
.
setState
({
visibleUploadSimulasi
:
true
,
buttonDraft
:
true
})}
>
<
img
src
=
{
Images
.
simulasiUpload
}
style
=
{{
width
:
40
,
height
:
40
,
marginRight
:
3
}}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"upload"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
{
this
.
props
.
isApprover
===
true
||
this
.
state
.
get_for
==
'view'
?
null
// <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
...
...
@@ -2448,6 +2525,20 @@ export default class ProfitLossROO extends Component {
// </div>
:
<
div
style
=
{{
justifyContent
:
'flex-end'
,
display
:
'flex'
,
flexFlow
:
'wrap'
}}
>
<
a
data
-
tip
=
{
'Upload Simulasi'
}
data
-
for
=
"upload"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
visibleUploadSimulasi
:
true
,
buttonDraft
:
true
})}
>
<
img
src
=
{
Images
.
simulasiUpload
}
style
=
{{
width
:
40
,
height
:
40
,
marginRight
:
3
}}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"upload"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Download Template'
}
data
-
for
=
"template"
>
<
button
style
=
{{
...
...
@@ -2478,7 +2569,7 @@ export default class ProfitLossROO extends Component {
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"upload"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Download'
}
data
-
for
=
"download"
>
{
/*
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
...
...
@@ -2494,12 +2585,11 @@ export default class ProfitLossROO extends Component {
<img src={Images.download} />
</button>
</a>
<
ReactTooltip
border
=
{
true
}
id
=
"download"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
*/
}
<
/div
>
}
<
/div
>
<
/div
>
<
/div
>
<
div
style
=
{{
marginTop
:
20
,
width
:
this
.
props
.
width
-
(
this
.
props
.
open
===
true
?
400
:
150
)
}}
>
{
!
this
.
state
.
refresh
&&
(
...
...
@@ -2849,12 +2939,37 @@ export default class ProfitLossROO extends Component {
}}
onUpload
=
{()
=>
{
String
(
this
.
state
.
judulColumn
).
includes
(
"TEMPLATE"
)
&&
String
(
this
.
state
.
judulColumn
).
includes
(
"UPLOAD"
)
&&
String
(
this
.
state
.
judul
).
includes
(
"ROLLING"
)
&&
String
(
this
.
state
.
judul
).
includes
(
"OUTLOOK"
)
&&
String
(
this
.
state
.
judul
).
includes
(
"PROFIT"
)
&&
String
(
this
.
state
.
judul
).
includes
(
"LOSS"
)
?
this
.
u
ploadSimulasi
()
:
this
.
checkU
ploadSimulasi
()
:
this
.
setState
({
alert
:
true
,
messageAlert
:
"Invalid Template"
,
tipeAlert
:
'warning'
})
}}
/
>
<
/div
>
<
div
style
=
{{
padding
:
'0px 30px 29px'
,
fontSize
:
17
,
color
:
'red'
}}
><
b
>
Warning
:
<
/b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1
?
"IDR" : "USD"}</
b
><
/div
>
{
this
.
state
.
visibleButtonUpload
&&
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
margin
:
'0px 32px 16px'
}}
>
<
div
>
<
button
type
=
"button"
// disabled={this.state.buttonError}
onClick
=
{()
=>
this
.
setState
({
handleDoubleClick
:
1
,
loading
:
true
},
()
=>
{
this
.
uploadSimulasi
(
'submitted'
)
})}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
}}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
Data
<
/Typography
>
<
/div
>
<
/button
>
<
/div
>
<
/div
>
}
{
/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */
}
<
/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