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
e0be1629
Commit
e0be1629
authored
Aug 27, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get Revisi + get periode
parent
499042db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
204 additions
and
38 deletions
+204
-38
index.js
src/api/index.js
+9
-1
BudgetTahunan.js
src/container/BudgetTahunan.js
+195
-37
No files found.
src/api/index.js
View file @
e0be1629
...
...
@@ -156,6 +156,10 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
//Transaction
const
getReportTypeBody
=
(
body
)
=>
api
.
post
(
'transaction/get_all_report'
,
body
)
const
getMasterBudgetAtt
=
(
body
)
=>
api
.
post
(
'transaction/get_report_attachment'
,
body
)
const
uploadAttachment
=
(
body
)
=>
api
.
post
(
'transaction/upload_attachment'
,
body
)
const
getRevision
=
(
body
)
=>
api
.
post
(
'transaction/get_revision'
,
body
)
const
getPeriodeTransaction
=
()
=>
api
.
get
(
'transaction/get_periode'
)
//Template
const
downloadTemplate
=
(
fileName
,
fileType
)
=>
api
.
get
(
`attachment/download_file?fileName=
${
fileName
}
&&fileType=
${
fileType
}
`
)
...
...
@@ -254,7 +258,11 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
getDetailUnitBisnis
,
uploadFoto
,
getReportTypeBody
,
getPermission
getPermission
,
getMasterBudgetAtt
,
uploadAttachment
,
getPeriodeTransaction
,
getRevision
}
}
...
...
src/container/BudgetTahunan.js
View file @
e0be1629
...
...
@@ -10,13 +10,17 @@ import ProfitLoss from './BudgetTahunan/ProfitLoss';
import
TaxPlanning
from
'./BudgetTahunan/TaxPlanning'
;
import
FixedAssetsMovement
from
'./BudgetTahunan/FixedAssetsMovement'
;
import
CorporateAnnualTarget
from
'./BudgetTahunan/CorporateAnnualTarget'
;
import
{
ExcelRenderer
}
from
'react-excel-renderer'
;
import
UploadFile
from
"../library/Upload"
;
import
{
format
}
from
'date-fns'
;
export
default
class
BudgetTahunan
extends
Component
{
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
perusahaan
:
'TAP Group'
,
revisi
:
'0'
,
listRevision
:
null
,
revision
:
null
,
visibleBudgetTahunan
:
true
,
visibleBS
:
false
,
listPeriode
:
null
,
...
...
@@ -26,14 +30,33 @@ export default class BudgetTahunan extends Component {
report_id
:
null
,
visiblePL
:
false
,
visibleFAM
:
false
,
visibleCAT
:
false
visibleCAT
:
false
,
listAttachment
:
[],
visibleUpload
:
false
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
}
componentDidMount
()
{
this
.
getCompanyActive
()
}
getReportAttachment
()
{
let
payload
=
{
"company_id"
:
this
.
state
.
company
.
company_id
,
"periode"
:
this
.
state
.
periode
.
periode
,
"revision"
:
this
.
state
.
revision
.
revision
,
}
api
.
create
().
getMasterBudgetAtt
(
payload
).
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
listAttachment
:
response
.
data
.
data
})
}
}
// console.log(response);
})
}
getReport
()
{
let
payload
=
{
"company_id"
:
this
.
state
.
company
.
company_id
,
...
...
@@ -41,21 +64,21 @@ export default class BudgetTahunan extends Component {
"report_type"
:
"Master Budget"
,
}
api
.
create
().
getReportTypeBody
(
payload
).
then
(
response
=>
{
console
.
log
(
response
);
//
console.log(response);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
dataTable
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
return
[
item
.
number
,
item
.
report_name
,
item
.
revision
.
length
,
item
.
revision
,
item
.
current_status
,
item
.
report_id
,
item
.
is_can_upload
,
item
.
revision
.
length
item
.
revision
]
})
console
.
log
(
dataTable
);
//
console.log(dataTable);
this
.
setState
({
dataTable
})
}
}
...
...
@@ -76,7 +99,9 @@ export default class BudgetTahunan extends Component {
options
:
companyData
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
company_name
),
};
this
.
setState
({
listCompany
:
defaultProps
,
company
:
companyData
[
0
]
},
()
=>
this
.
getPeriode
())
this
.
setState
({
listCompany
:
defaultProps
,
company
:
companyData
[
0
]
},
()
=>
{
this
.
getPeriode
()
})
}
else
{
alert
(
response
.
data
.
message
)
}
...
...
@@ -84,17 +109,56 @@ export default class BudgetTahunan extends Component {
}
getPeriode
()
{
let
data
=
[
"2021"
,
"2020"
,
"2019"
]
let
periodeData
=
data
.
map
((
item
)
=>
{
return
{
periode
:
item
,
api
.
create
().
getPeriodeTransaction
().
then
(
response
=>
{
let
dateNow
=
new
Date
let
year
=
format
(
dateNow
,
'yyyy'
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
data
=
response
.
data
.
data
let
periodeData
=
data
.
map
((
item
)
=>
{
return
{
periode
:
item
,
}
})
let
defaultProps
=
{
options
:
periodeData
,
getOptionLabel
:
(
option
)
=>
option
.
periode
,
};
let
index
=
data
.
sort
((
a
,
b
)
=>
a
-
b
).
findIndex
((
val
)
=>
val
==
year
)
this
.
setState
({
listPeriode
:
defaultProps
,
periode
:
index
==
-
1
?
periodeData
[
0
]
:
periodeData
[
index
]
},
()
=>
{
this
.
getRevision
()
})
}
}
})
}
getRevision
()
{
let
payload
=
{
"company_id"
:
this
.
state
.
company
.
company_id
,
"periode"
:
this
.
state
.
periode
.
periode
}
api
.
create
().
getRevision
(
payload
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
data
=
response
.
data
.
data
let
revisionData
=
data
.
map
((
item
)
=>
{
return
{
revision
:
item
,
}
})
let
defaultProps
=
{
options
:
revisionData
,
getOptionLabel
:
(
option
)
=>
option
.
revision
,
};
this
.
setState
({
listRevision
:
defaultProps
,
revision
:
revisionData
[
0
]
},
()
=>
{
this
.
getReport
()
this
.
getReportAttachment
()
})
}
}
})
let
defaultProps
=
{
options
:
periodeData
,
getOptionLabel
:
(
option
)
=>
option
.
periode
,
};
this
.
setState
({
listPeriode
:
defaultProps
,
periode
:
periodeData
[
0
]
},
()
=>
this
.
getReport
())
}
clickDetail
(
item
,
id
)
{
...
...
@@ -152,6 +216,37 @@ export default class BudgetTahunan extends Component {
data
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
value
}
fileHandler
=
(
event
)
=>
{
let
fileObj
=
event
ExcelRenderer
(
fileObj
,
(
err
,
resp
)
=>
{
// console.log(resp)
if
(
err
)
{
console
.
log
(
err
);
}
else
{
const
formData
=
new
FormData
();
formData
.
append
(
"revision"
,
Number
(
this
.
state
.
revisi
));
formData
.
append
(
"companyId"
,
this
.
state
.
company
.
company_id
);
formData
.
append
(
"periode"
,
Number
(
this
.
state
.
periode
.
periode
));
formData
.
append
(
"file"
,
event
);
this
.
setState
({
formData
})
}
})
}
uploadAttachment
(
formData
)
{
api
.
create
().
uploadAttachment
(
formData
).
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
visibleUpload
:
false
},
()
=>
{
this
.
getReport
()
this
.
getReportAttachment
()
})
}
}
// console.log(response)
})
}
render
()
{
const
columns
=
[
"#"
,
"Jenis Laporan"
,
...
...
@@ -196,6 +291,8 @@ export default class BudgetTahunan extends Component {
<
div
style
=
{{
display
:
'flex'
}}
>
{
val
===
"submitted"
||
val
===
"approved"
?
<
img
src
=
{
Images
.
ceklis
}
style
=
{{
width
:
31
,
height
:
24
}}
/>
:
val
===
"revision"
?
<
span
>
Revisi
<
/span>
:
null
}
<
/div
>
...
...
@@ -297,7 +394,10 @@ export default class BudgetTahunan extends Component {
<
Autocomplete
{...
this
.
state
.
listPeriode
}
id
=
"periode"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
periode
:
newInputValue
},
()
=>
this
.
getReport
())}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
periode
:
newInputValue
},
()
=>
{
this
.
getReport
()
this
.
getReportAttachment
()
})}
debug
disableClearable
style
=
{{
width
:
250
}}
...
...
@@ -309,7 +409,10 @@ export default class BudgetTahunan extends Component {
<
Autocomplete
{...
this
.
state
.
listCompany
}
id
=
"company"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
company
:
newInputValue
},
()
=>
this
.
getReport
())}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
company
:
newInputValue
},
()
=>
{
this
.
getReport
()
this
.
getReportAttachment
()
})}
debug
disableClearable
style
=
{{
width
:
250
}}
...
...
@@ -318,20 +421,19 @@ export default class BudgetTahunan extends Component {
/
>
<
/div
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
TextField
style
=
{{
width
:
250
,
}}
id
=
"reivisi"
select
label
=
"Revisi"
value
=
{
this
.
state
.
revisi
}
onChange
=
{(
e
)
=>
this
.
setState
({
revisi
:
e
.
target
.
value
})}
>
{
revisi
.
map
((
option
)
=>
(
<
MenuItem
key
=
{
option
.
value
}
value
=
{
option
.
value
}
>
{
option
.
label
}
<
/MenuItem
>
))}
<
/TextField
>
<
Autocomplete
{...
this
.
state
.
listRevision
}
id
=
"revision"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
revision
:
newInputValue
},
()
=>
{
this
.
getReport
()
this
.
getReportAttachment
()
})}
debug
disableClearable
style
=
{{
width
:
250
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Revision"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
value
=
{
this
.
state
.
revision
}
/
>
<
/div
>
<
div
style
=
{{
marginTop
:
20
}}
>
...
...
@@ -346,17 +448,39 @@ export default class BudgetTahunan extends Component {
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'#4b4b4b'
,
fontWeight
:
'bold'
}}
>
Attachment
:
<
/Typography
>
<
/div
>
<
div
style
=
{{
width
:
'50%'
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'#5198ea'
}}
>
Upload
File
<
/Typography
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
}}
onClick
=
{()
=>
this
.
setState
({
visibleUpload
:
true
})}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'#5198ea'
}}
>
Upload
File
<
/Typography
>
<
/button
>
<
/div
>
<
/div
>
<
div
style
=
{{
display
:
'flex'
,
marginTop
:
10
}}
>
<
div
style
=
{{
width
:
'50%'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'#4b4b4b'
}}
>
File
1
.
xls
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'#4b4b4b'
}}
>
File
2
.
xls
<
/Typography
>
{
this
.
state
.
listAttachment
.
length
>
0
?
this
.
state
.
listAttachment
.
map
((
item
)
=>
{
return
(
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'#4b4b4b'
}}
>
{
item
.
attachment_name
}
<
/Typography
>
)
})
:
null
}
<
/div
>
<
div
style
=
{{
width
:
'50%'
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'#ff3939'
}}
>
Delete
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'#ff3939'
}}
>
Delete
<
/Typography
>
{
this
.
state
.
listAttachment
.
length
>
0
?
this
.
state
.
listAttachment
.
map
((
item
)
=>
{
return
(
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'#ff3939'
}}
>
Delete
<
/Typography
>
)
})
:
null
}
<
/div
>
<
/div
>
<
/div
>
...
...
@@ -371,6 +495,40 @@ export default class BudgetTahunan extends Component {
<
/div
>
)}
{
this
.
state
.
visibleUpload
&&
(
<
div
className
=
"test app-popup-show"
>
<
div
className
=
"popup-content background-white border-radius"
style
=
{{
borderRadius
:
8
}}
>
<
div
className
=
"popup-panel grid grid-2x main-color"
style
=
{{
height
:
64
,
borderTopRightRadius
:
8
,
borderTopLeftRadius
:
8
}}
>
<
div
className
=
"col-1"
style
=
{{
maxWidth
:
"inherit"
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
div
className
=
"popup-title"
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
16
,
fontWeight
:
'bold'
}}
>
Upload
File
<
/span
>
<
/div
>
<
/div
>
<
div
className
=
"col-2 content-right"
style
=
{{
maxWidth
:
"inherit"
,
alignSelf
:
'center'
}}
>
<
button
type
=
"button"
className
=
"btn btn-circle btn-white"
onClick
=
{()
=>
this
.
setState
({
visibleUpload
:
false
})}
>
<
img
src
=
{
Images
.
close
}
/
>
<
/button
>
<
/div
>
<
/div
>
<
UploadFile
type
=
{
this
.
state
.
uploadStatus
}
percentage
=
{
this
.
state
.
percentage
}
result
=
{
this
.
state
.
result
}
acceptedFiles
=
{[
"xlsx"
]}
onHandle
=
{(
dt
)
=>
{
this
.
fileHandler
(
dt
)
this
.
setState
({
uploadStatus
:
'idle'
,
percentage
:
'0'
})
}}
onUpload
=
{()
=>
this
.
uploadAttachment
(
this
.
state
.
formData
)}
/
>
<
/div
>
<
/div
>
)}
{
this
.
state
.
visibleBS
&&
(
<
BalanceSheet
report_id
=
{
this
.
state
.
report_id
}
...
...
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