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
f847a4c7
Commit
f847a4c7
authored
Dec 08, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'deni-' into 'master'
apivalidate See merge request
!780
parents
87326875
80c96750
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
7 deletions
+64
-7
index.js
src/api/index.js
+3
-1
BalanceSheetMR.js
src/container/MonthlyReport/BalanceSheetMR.js
+61
-6
No files found.
src/api/index.js
View file @
f847a4c7
...
...
@@ -283,6 +283,7 @@ const create = (type = "") => {
const
uploadMonthlyReportFAM
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report/fam/import_monthly_report'
,
body
)
const
uploadMonthlyReportTP
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report_tp/import_monthly_report'
,
body
)
const
uploadMonthlyReportOI
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report_oi/import_monthly_report'
,
body
)
const
validateSubmitReportMR
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report/validate_save'
,
body
)
// MonthlyPL
const
getHierarkiMontlyReportPL
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report_pl/get_report_hierarki'
,
body
)
...
...
@@ -508,7 +509,8 @@ const create = (type = "") => {
uploadMonthlyReportFAM
,
uploadMonthlyReportTP
,
uploadMonthlyReportOI
,
getHierarkiMontlyReportCF
getHierarkiMontlyReportCF
,
validateSubmitReportMR
}
}
...
...
src/container/MonthlyReport/BalanceSheetMR.js
View file @
f847a4c7
...
...
@@ -439,6 +439,63 @@ export default class BalanceSheetMR extends Component {
})
}
handleValidate
()
{
let
data
=
[]
// console.log(this.state.dataTable)
this
.
state
.
dataTable
.
map
(
i
=>
{
data
.
push
({
"item_report_id"
:
i
[
1
],
"rolling_outlook"
:
i
[
6
],
"master_budget"
:
i
[
7
],
"rolling_budget"
:
i
[
8
],
"actual"
:
i
[
9
],
"actual_previous_month"
:
i
[
10
],
"amount_act_vs_previous_month"
:
i
[
11
],
"percent_act_vs_previous_month"
:
i
[
12
],
"amount_act_vs_mb"
:
i
[
13
],
"percent_act_vs_mb"
:
i
[
14
],
"amount_act_vs_rb"
:
i
[
15
],
"percent_act_vs_rb"
:
i
[
16
],
"mtd_vs_previous_month"
:
i
[
17
],
"mtd_vs_mb"
:
i
[
18
],
"mtd_vs_rb"
:
i
[
19
]
})
})
// console.log(JSON.stringify(data))
let
payload
=
{
"monthly_report_id"
:
this
.
props
.
monthlyReportId
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
,
"report_id"
:
this
.
props
.
report_id
,
"status"
:
"submitted"
,
"months"
:
this
.
props
.
month
.
month_id
,
"balance_sheet"
:
data
}
api
.
create
().
validateSubmitReportMR
(
payload
).
then
((
response
)
=>
{
// console.log(response)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
data
.
result
)
{
this
.
setState
({
loading
:
false
,
buttonError
:
false
,
editable
:
false
,
saveDraft
:
false
})
}
else
{
this
.
setState
({
loading
:
false
,
buttonError
:
true
,
editable
:
true
,
saveDraft
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
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'
,
loading
:
false
})
}
})
}
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
const
handleChange
=
(
value
,
tableMeta
,
type
)
=>
{
...
...
@@ -1811,8 +1868,7 @@ export default class BalanceSheetMR extends Component {
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
})
// this.handleValidate()
this
.
handleValidate
()
},
100
);
})
}}
...
...
@@ -1846,7 +1902,7 @@ export default class BalanceSheetMR extends Component {
<
/button
>
<
button
type
=
"button"
//
disabled={this.state.buttonError}
disabled
=
{
this
.
state
.
buttonError
}
onClick
=
{()
=>
this
.
state
.
buttonError
?
this
.
setState
({
alert
:
true
,
messageAlert
:
'Data is not complete !'
,
tipeAlert
:
'warning'
})
...
...
@@ -1928,8 +1984,7 @@ export default class BalanceSheetMR extends Component {
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
})
// this.handleValidate()
this
.
handleValidate
()
},
100
);
})
}}
...
...
@@ -1963,7 +2018,7 @@ export default class BalanceSheetMR extends Component {
<
/button
>
<
button
type
=
"button"
//
disabled={this.state.buttonError}
disabled
=
{
this
.
state
.
buttonError
}
onClick
=
{()
=>
this
.
state
.
buttonError
?
this
.
setState
({
alert
:
true
,
messageAlert
:
'Data is not complete !'
,
tipeAlert
:
'warning'
})
...
...
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