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
5b1cc3c3
Commit
5b1cc3c3
authored
Jan 19, 2021
by
faisalhamdi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update fam
parent
79e955ef
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
13 deletions
+72
-13
index.js
src/api/index.js
+3
-1
FixedAssetsMovementMR.js
src/container/MonthlyReport/FixedAssetsMovementMR.js
+69
-12
No files found.
src/api/index.js
View file @
5b1cc3c3
...
...
@@ -311,6 +311,7 @@ const create = (type = "") => {
const
checkUploadMonthlyReportLOCF
=
(
body
)
=>
api
.
post
(
'transaction/locf/monthly_report/check_import'
,
body
)
const
uploadMonthlyReportLOCF
=
(
body
)
=>
api
.
post
(
'transaction/locf/monthly_report/import_monthly_report'
,
body
)
const
validateSubmitReportOI
=
(
body
)
=>
api
.
post
(
'transaction/operating_indicator/monthly_report/validate_save'
,
body
)
const
validateSubmitReportFAM
=
(
body
)
=>
api
.
post
(
'transaction/fam/monthly_report/validate_save'
,
body
)
const
getListUserSubcoMB
=
(
periode
)
=>
api
.
get
(
`transaction/get_dashboard_sub_co/master_budget/
${
periode
}
`
)
const
getListUserSubcoMR
=
(
months
,
periode
)
=>
api
.
get
(
`transaction/get_dashboard_sub_co/monthly_report/
${
periode
}
/
${
months
}
`
)
...
...
@@ -566,7 +567,8 @@ const create = (type = "") => {
approvalMonthly
,
createPeriodeRevisionMonthly
,
getListUserSubcoMB
,
getListUserSubcoMR
getListUserSubcoMR
,
validateSubmitReportFAM
}
}
...
...
src/container/MonthlyReport/FixedAssetsMovementMR.js
View file @
5b1cc3c3
...
...
@@ -49,6 +49,8 @@ export default class FixedAssetsMovementMR extends Component {
updateBy
:
'-'
,
notesUpdate
:
'-'
,
get_for
:
'view'
,
saveDraft
:
true
,
buttonError
:
true
,
viewOnly
:
true
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
...
...
@@ -205,10 +207,10 @@ export default class FixedAssetsMovementMR extends Component {
}
})
console
.
log
(
dataTable
);
this
.
setState
({
dataTable
,
loading
:
false
,
refresh
:
false
},
()
=>
{
this
.
setState
({
dataTable
,
loading
:
false
,
refresh
:
false
,
buttonError
:
true
,
saveDraft
:
true
},
()
=>
{
this
.
setState
({
loading
:
true
,
refresh
:
true
})
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
,
refresh
:
false
})
this
.
setState
({
loading
:
false
,
refresh
:
false
,
buttonError
:
true
,
saveDraft
:
true
})
},
200
);
})
...
...
@@ -223,7 +225,7 @@ export default class FixedAssetsMovementMR extends Component {
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
,
refresh
:
false
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
,
refresh
:
false
,
buttonError
:
true
,
saveDraft
:
true
})
}
})
}
...
...
@@ -322,8 +324,8 @@ export default class FixedAssetsMovementMR extends Component {
item
.
error
]
})
//
console.log(dataTable)
this
.
setState
({
dataTable
,
dataLoaded
:
true
,
loading
:
false
,
buttonError
:
fals
e
,
editable
:
true
,
refresh
:
false
},
()
=>
{
console
.
log
(
dataTable
)
this
.
setState
({
dataTable
,
dataLoaded
:
true
,
loading
:
false
,
buttonError
:
tru
e
,
editable
:
true
,
refresh
:
false
},
()
=>
{
this
.
state
.
dataTable
.
map
(
item
=>
{
if
(
item
[
15
].
length
>
0
)
{
console
.
log
(
'masuk'
)
...
...
@@ -434,6 +436,61 @@ export default class FixedAssetsMovementMR extends Component {
})
}
handleValidate
()
{
let
data
=
[]
let
err
=
false
this
.
state
.
dataTable
.
map
((
i
,
index
)
=>
{
data
.
push
({
"item_report_id"
:
i
[
1
],
"mtd_mb"
:
i
[
6
],
"mtd_rb"
:
i
[
7
],
"mtd_actual"
:
i
[
8
],
"act_vs_mb_amount"
:
String
(
i
[
9
])
===
'NaN'
||
String
(
i
[
9
])
===
'Infinity'
||
String
(
i
[
9
])
===
'-Infinity'
?
'0.0'
:
String
(
i
[
9
]),
"act_vs_mb_percent"
:
String
(
i
[
10
])
===
'NaN'
||
String
(
i
[
10
])
===
'Infinity'
||
String
(
i
[
10
])
===
'-Infinity'
?
'0.0'
:
String
(
i
[
10
]),
"act_vs_rb_amount"
:
String
(
i
[
11
])
===
'NaN'
||
String
(
i
[
11
])
===
'Infinity'
||
String
(
i
[
11
])
===
'-Infinity'
?
'0.0'
:
String
(
i
[
11
]),
"act_vs_rb_percent"
:
String
(
i
[
12
])
===
'NaN'
||
String
(
i
[
12
])
===
'Infinity'
||
String
(
i
[
12
])
===
'-Infinity'
?
'0.0'
:
String
(
i
[
12
])
})
})
// 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
,
"fixed_asset_movement"
:
data
}
// console.log(JSON.stringify(payload));
api
.
create
().
validateSubmitReportFAM
(
payload
).
then
((
response
)
=>
{
console
.
log
(
response
.
data
.
data
.
result
)
console
.
log
(
err
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
data
.
result
&&
err
===
false
)
{
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
})
}
})
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
}
...
...
@@ -703,8 +760,8 @@ export default class FixedAssetsMovementMR extends Component {
}
// console.log(dex)
// console.log(Number(tableMeta.columnIndex) + Number(type))
console
.
log
(
total
);
console
.
log
(
dataTable2
);
//
console.log(total);
//
console.log(dataTable2);
return
total
}
...
...
@@ -1409,8 +1466,8 @@ export default class FixedAssetsMovementMR extends Component {
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
})
//
this.handleValidate()
//
this.setState({ loading: false })
this
.
handleValidate
()
},
100
);
})
}}
...
...
@@ -1527,8 +1584,8 @@ export default class FixedAssetsMovementMR extends Component {
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
})
//
this.handleValidate()
//
this.setState({ loading: false })
this
.
handleValidate
()
},
100
);
})
}}
...
...
@@ -1563,7 +1620,7 @@ export default class FixedAssetsMovementMR 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
:
'error'
})
...
...
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