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
2f461a19
Commit
2f461a19
authored
Sep 16, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
api aplot ++
parent
bd1aea9a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
25 deletions
+78
-25
index.js
src/api/index.js
+38
-14
BudgetTahunan.js
src/container/BudgetTahunan.js
+2
-0
BalanceSheet.js
src/container/BudgetTahunan/BalanceSheet.js
+38
-11
No files found.
src/api/index.js
View file @
2f461a19
...
...
@@ -3,25 +3,47 @@ import apisauce from 'apisauce'
import
Constant
from
'../library/Constant'
// our "constructor"
const
create
=
(
baseURL
=
'https://tia.eksad.com/tia-reporting-dev/public/'
)
=>
{
const
create
=
(
type
=
""
)
=>
{
let
api
;
// ------
// STEP 1
// ------
//
// Create and configure an apisauce-based api object.
//
const
api
=
apisauce
.
create
({
// base URL is read from the "constructor"
baseURL
,
// here are some default headers
headers
:
{
'Cache-Control'
:
'no-cache'
,
Accept
:
'application/json'
,
'Content-Type'
:
'application/json'
,
},
// 10 second timeout...
timeout
:
30000
})
const
baseURL
=
'https://tia.eksad.com/tia-reporting-dev/public/'
switch
(
type
)
{
case
''
:
api
=
apisauce
.
create
({
// base URL is read from the "constructor"
baseURL
,
// here are some default headers
headers
:
{
'Cache-Control'
:
'no-cache'
,
Accept
:
'application/json'
,
'Content-Type'
:
'application/json'
,
},
// 60 second timeout...
timeout
:
30000
})
break
;
case
'UPLOAD'
:
api
=
apisauce
.
create
({
// base URL is read from the "constructor"
baseURL
,
// here are some default headers
headers
:
{
'Cache-Control'
:
'no-cache'
,
Accept
:
'application/json'
,
'Content-Type'
:
'application/json'
,
},
// 40 second timeout...
timeout
:
40000
})
break
;
default
:
break
;
}
api
.
addAsyncRequestTransform
(
request
=>
async
()
=>
{
var
token
...
...
@@ -169,6 +191,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const
createSubmitReport
=
(
body
)
=>
api
.
post
(
'transaction/master_budget/create_submission_report'
,
body
)
const
getSubmission
=
(
body
)
=>
api
.
post
(
'transaction/get_submission_id'
,
body
)
const
checkUploadMB
=
(
body
)
=>
api
.
post
(
'transaction/master_budget/check_import'
,
body
)
const
uploadMasterBudget
=
(
body
)
=>
api
.
post
(
'transaction/master_budget/import_master_budget'
,
body
)
//Template
const
downloadTemplate
=
(
fileName
,
fileType
)
=>
api
.
get
(
`attachment/download_file?fileName=
${
fileName
}
&&fileType=
${
fileType
}
`
)
...
...
@@ -293,7 +316,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
downloadDocument
,
createSubmitReport
,
getSubmission
,
checkUploadMB
checkUploadMB
,
uploadMasterBudget
}
}
...
...
src/container/BudgetTahunan.js
View file @
2f461a19
...
...
@@ -653,6 +653,8 @@ export default class BudgetTahunan extends Component {
submissionID
=
{
this
.
state
.
submissionID
}
saveToMasterBudget
=
{
this
.
saveToMasterBudget
.
bind
(
this
)}
onClickClose
=
{()
=>
this
.
setState
({
visibleBS
:
false
,
visibleBudgetTahunan
:
true
})}
getReport
=
{
this
.
getReport
.
bind
(
this
)}
getReportAttachment
=
{
this
.
getReportAttachment
.
bind
(
this
)}
/
>
)}
{
this
.
state
.
visiblePL
&&
(
...
...
src/container/BudgetTahunan/BalanceSheet.js
View file @
2f461a19
...
...
@@ -714,11 +714,6 @@ export default class BalanceSheet extends Component {
}
else
{
data
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
val
)
}
// this.forceUpdate()
// console.log(this.state.dataTable)
// this.setState({
// data: a,
// }, () => console.log(this.state.dataTable))
}
backToMasterBudget
(
type
)
{
...
...
@@ -880,12 +875,37 @@ export default class BalanceSheet extends Component {
item
.
error
]
})
this
.
setState
({
dataTable
,
dataLoaded
:
true
,
loading
:
false
})
this
.
setState
({
dataTable
,
dataLoaded
:
true
,
loading
:
false
,
buttonError
:
false
})
}
}
})
}
checkError
(
tableMeta
)
{
if
(
tableMeta
.
rowData
[
22
])
{
if
(
tableMeta
.
rowData
[
22
][
0
]
===
'item'
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
uploadBalanceSheet
()
{
api
.
create
(
'UPLOAD'
).
uploadMasterBudget
(
this
.
state
.
payload
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
props
.
onClickClose
()
this
.
props
.
getReport
()
this
.
props
.
getReportAttachment
()
}
else
{
alert
(
response
.
data
.
status
)
}
}
else
{
alert
(
response
.
problem
)
}
})
}
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
const
handleChange
=
(
value
,
tableMeta
)
=>
{
...
...
@@ -957,6 +977,7 @@ export default class BalanceSheet extends Component {
return
a
}
const
columns
=
[{
name
:
""
,
options
:
{
...
...
@@ -1000,11 +1021,13 @@ export default class BalanceSheet extends Component {
tableMeta
.
rowData
[
4
]
==
0
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
22
][
0
].
message
}
data
-
for
=
"account"
>
<
span
style
=
{{
fontSize
:
12
,
fontWeight
:
'bold'
,
color
:
'red'
}}
>
{
String
(
tableMeta
.
rowData
[
0
]
===
4
?
""
:
val
).
toUpperCase
()}
<
/span
>
{
this
.
checkError
(
tableMeta
)}
<
/a
>
:
<
div
style
=
{{
paddingLeft
:
20
*
Number
(
tableMeta
.
rowData
[
4
])
}}
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
22
][
0
].
message
}
data
-
for
=
"account"
>
<
span
style
=
{{
fontSize
:
12
,
color
:
'red'
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
""
:
val
}
<
/span
>
{
this
.
checkError
(
tableMeta
)}
<
/a
>
<
/div
>
:
...
...
@@ -2551,10 +2574,10 @@ export default class BalanceSheet extends Component {
cursor
:
this
.
state
.
disabledSave
===
true
?
'default'
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
marginRight
:
20
}}
>
<
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'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
<
/Typography
>
<
/div
>
<
/button
>
...
...
@@ -2609,14 +2632,18 @@ export default class BalanceSheet extends Component {
onClick
=
{()
=>
this
.
setState
({
visibleBalanceSheet
:
true
},
()
=>
this
.
getItemHierarki
())}
style
=
{{
marginRight
:
20
}}
>
<
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'
}}
>
Cancel
<
/Typography
>
<
/div
>
<
/button
>
<
button
type
=
"button"
disabled
=
{
this
.
state
.
buttonError
==
true
?
true
:
false
}
onClick
=
{()
=>
null
}
onClick
=
{()
=>
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
uploadBalanceSheet
()
},
100
);
})}
style
=
{{
marginRight
:
20
}}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
...
...
@@ -2635,7 +2662,7 @@ export default class BalanceSheet extends Component {
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
,
buttonError
:
false
})
this
.
setState
({
loading
:
false
})
},
100
);
})
}}
...
...
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