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
23f63534
Commit
23f63534
authored
Jan 06, 2026
by
Hardiansyah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reuse component
parent
2dc61b4e
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
20 deletions
+48
-20
ReportHistorical.js
src/container/Reports/ReportHistorical.js
+4
-13
AlertSnackbar.js
src/library/AlertSnackbar.js
+1
-1
AutocompleteField.js
src/library/AutocompleteField.js
+14
-0
ContentContainer.js
src/library/ContentContainer.js
+5
-0
DDLCompany.js
src/library/Dropdown/DDLCompany.js
+10
-2
DDLYear.js
src/library/Dropdown/DDLYear.js
+0
-1
Utils.js
src/library/Utils.js
+14
-3
No files found.
src/container/Reports/ReportHistorical.js
View file @
23f63534
import
React
,
{
Component
}
from
'react'
import
{
Paper
,
}
from
'@material-ui/core'
;
import
AlertSnackbar
from
'../../library/AlertSnackbar'
import
Header
from
'../../library/Header'
;
import
SectionHeader
from
'../../library/SectionHeader'
;
import
AutocompleteField
from
'../../library/AutocompleteField'
;
import
CustomButton
from
'../../library/CustomButton'
;
...
...
@@ -11,6 +10,7 @@ import DDLMonth from '../../library/Dropdown/DDLMonth';
import
DDLCompany
from
'../../library/Dropdown/DDLCompany'
;
import
ContentContainer
from
'../../library/ContentContainer'
;
import
Constant
from
'../../library/Constant'
;
import
{
downloadFileBlob
}
from
'../../library/Utils'
;
class
ReportHistorical
extends
Component
{
constructor
(
props
)
{
...
...
@@ -115,14 +115,7 @@ class ReportHistorical extends Component {
const
blob
=
res
.
data
if
(
blob
&&
blob
.
size
>
0
)
{
const
url
=
window
.
URL
.
createObjectURL
(
blob
)
const
a
=
document
.
createElement
(
'a'
)
a
.
href
=
url
a
.
download
=
'Historical.xlsx'
document
.
body
.
appendChild
(
a
)
a
.
click
()
a
.
remove
()
window
.
URL
.
revokeObjectURL
(
url
)
downloadFileBlob
(
'Historical.xlsx'
,
blob
)
}
this
.
showAlert
(
'Download Berhasil'
,
'success'
);
...
...
@@ -139,10 +132,7 @@ class ReportHistorical extends Component {
const
contentStyle
=
{
display
:
'flex'
,
marginTop
:
10
,
gap
:
'20px'
};
return
(
<
ContentContainer
isLoading
=
{
isLoading
}
>
<
Header
title
=
"Report Historical"
/>
<
ContentContainer
isLoading
=
{
isLoading
}
title
=
"Report Historical"
>
<
div
style
=
{{
padding
:
20
}}
>
<
Paper
style
=
{{
paddingTop
:
10
,
paddingBottom
:
20
}}
>
<
SectionHeader
...
...
@@ -155,6 +145,7 @@ class ReportHistorical extends Component {
value
=
{
data
?.
report_id
}
onChange
=
{(
event
,
newValue
)
=>
this
.
handleChangeDropdown
(
newValue
,
'report_id'
)}
label
=
"Report Type"
isLoading
=
{
isLoading
}
/
>
<
AutocompleteField
options
=
{
listPeriodType
}
...
...
src/library/AlertSnackbar.js
View file @
23f63534
...
...
@@ -59,7 +59,7 @@ class AlertSnackbar extends Component {
children
,
// Props untuk Snackbar
autoHideDuration
=
15
00
,
autoHideDuration
=
20
00
,
anchorOrigin
=
{
vertical
:
'bottom'
,
horizontal
:
'center'
},
// Props untuk Alert
...
...
src/library/AutocompleteField.js
View file @
23f63534
...
...
@@ -3,6 +3,7 @@ import { TextField, Checkbox } from '@material-ui/core';
import
{
Autocomplete
}
from
'@material-ui/lab'
;
import
CheckBoxOutlineBlankIcon
from
'@material-ui/icons/CheckBoxOutlineBlank'
;
import
CheckBoxIcon
from
'@material-ui/icons/CheckBox'
;
import
CircularProgress
from
'@material-ui/core/CircularProgress'
;
const
icon
=
<
CheckBoxOutlineBlankIcon
fontSize
=
"small"
/>
;
const
checkedIcon
=
<
CheckBoxIcon
fontSize
=
"small"
/>
;
...
...
@@ -25,6 +26,7 @@ const AutocompleteField = ({
noOptionsText
=
"No options available"
,
multiple
=
false
,
showCheckbox
=
false
,
isLoading
=
false
,
...
props
})
=>
{
const
defaultRenderInput
=
(
params
)
=>
(
...
...
@@ -38,6 +40,17 @@ const AutocompleteField = ({
error
=
{
error
}
helperText
=
{
helperText
}
fullWidth
InputProps
=
{{
...
params
.
InputProps
,
endAdornment
:
(
<>
{
isLoading
?
(
<
CircularProgress
color
=
"inherit"
size
=
{
20
}
/
>
)
:
null
}
{
params
.
InputProps
.
endAdornment
}
<
/
>
),
}}
/
>
);
...
...
@@ -89,6 +102,7 @@ const AutocompleteField = ({
return
option
.
id
===
value
.
id
;
}}
renderOption
=
{
showCheckbox
&&
multiple
?
renderOptionWithCheckbox
:
undefined
}
loadingText
=
"Loading..."
{...
props
}
/
>
);
...
...
src/library/ContentContainer.js
View file @
23f63534
import
React
,
{
Component
}
from
'react'
;
import
OverlayLoader
from
'./OverlayLoader'
;
import
Header
from
'./Header'
;
class
ContentContainer
extends
Component
{
render
()
{
...
...
@@ -11,6 +12,7 @@ class ContentContainer extends Component {
padding
=
0
,
style
=
{},
loaderProps
=
{},
title
=
''
,
...
restProps
}
=
this
.
props
;
...
...
@@ -27,6 +29,9 @@ class ContentContainer extends Component {
{
isLoading
&&
(
<
OverlayLoader
isLoading
=
{
isLoading
}
{...
loaderProps
}
/
>
)}
<
Header
title
=
{
title
}
/
>
{
children
}
<
/div
>
);
...
...
src/library/Dropdown/DDLCompany.js
View file @
23f63534
...
...
@@ -11,6 +11,7 @@ class DDLCompany extends Component {
?
(
props
.
value
||
[])
:
(
props
.
value
||
null
),
companies
:
[],
isLoading
:
false
,
};
}
...
...
@@ -30,8 +31,13 @@ class DDLCompany extends Component {
}
}
setLoading
=
(
isLoading
)
=>
{
this
.
setState
({
isLoading
});
}
getCompanyActive
=
async
()
=>
{
try
{
this
.
setLoading
(
true
);
const
response
=
await
api
.
create
().
getPerusahaanActive
();
const
data
=
response
?.
data
?.
data
||
[];
...
...
@@ -44,6 +50,8 @@ class DDLCompany extends Component {
}
catch
(
err
)
{
console
.
error
(
'Failed to load companies'
,
err
);
this
.
setState
({
companies
:
[]
});
}
finally
{
this
.
setLoading
(
false
);
}
};
...
...
@@ -117,7 +125,7 @@ class DDLCompany extends Component {
multiple
,
}
=
this
.
props
;
const
{
selectedValue
,
companies
}
=
this
.
state
;
const
{
selectedValue
,
companies
,
isLoading
}
=
this
.
state
;
return
(
<
AutocompleteField
...
...
@@ -134,7 +142,7 @@ class DDLCompany extends Component {
margin
=
{
margin
}
multiple
=
{
multiple
}
showCheckbox
=
{
multiple
}
noOptionsText
=
"No companies available"
isLoading
=
{
isLoading
}
/
>
);
}
...
...
src/library/Dropdown/DDLYear.js
View file @
23f63534
...
...
@@ -180,7 +180,6 @@ class DDLYear extends Component {
helperText
=
{
helperText
}
style
=
{
style
}
margin
=
{
margin
}
noOptionsText
=
"No years available"
/
>
);
}
...
...
src/library/Utils.js
View file @
23f63534
export
function
titleCase
(
text
)
{
var
value
=
String
(
text
).
replace
(
/
\.
/g
,
' '
)
.
replace
(
/
\s
/g
,
' '
)
.
replace
(
/^
(
.
)
/
,
function
(
$1
)
{
return
$1
.
toUpperCase
();
})
.
replace
(
/^
(
.
)
/
,
function
(
$1
)
{
return
$1
.
toUpperCase
();
})
// .replace(/\s(.)/g, function($1) { return $1.toUpperCase(); })
return
value
...
...
@@ -13,6 +13,17 @@ export function roundMath(number, decimalPlaces) {
}
export
function
fixNumber
(
num
,
decimalCount
=
2
)
{
const
output
=
Math
.
round
((
num
+
Number
.
EPSILON
)
*
(
Math
.
pow
(
10
,
decimalCount
)))
/
(
Math
.
pow
(
10
,
decimalCount
))
const
output
=
Math
.
round
((
num
+
Number
.
EPSILON
)
*
(
Math
.
pow
(
10
,
decimalCount
)))
/
(
Math
.
pow
(
10
,
decimalCount
))
return
output
}
export
function
downloadFileBlob
(
fileName
,
blobData
)
{
const
url
=
window
.
URL
.
createObjectURL
(
blobData
)
const
a
=
document
.
createElement
(
'a'
)
a
.
href
=
url
a
.
download
=
fileName
document
.
body
.
appendChild
(
a
)
a
.
click
()
a
.
remove
()
window
.
URL
.
revokeObjectURL
(
url
)
}
\ No newline at end of file
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