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
e25c902d
Commit
e25c902d
authored
Jul 19, 2022
by
muhammad ridwan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfixing autocomplete and add initial table
parent
bbe55470
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
52 deletions
+54
-52
RepotrCafrm.js
src/container/ReportCarfm/RepotrCafrm.js
+54
-52
No files found.
src/container/ReportCarfm/RepotrCafrm.js
View file @
e25c902d
...
...
@@ -40,8 +40,6 @@ class RepotrCafrm extends Component {
super
(
props
)
this
.
state
=
{
dataTable
:
[],
listMonth
:
null
,
listPeriodeMB
:
null
,
curMonth
:
0
,
curYear
:
0
,
data
:
false
...
...
@@ -54,7 +52,7 @@ class RepotrCafrm extends Component {
this
.
setState
({
loading
:
true
})
await
api
.
create
().
getMonthTransaction
().
then
(
response
=>
{
let
dateNow
=
new
Date
()
dateNow
.
setMonth
(
dateNow
.
getMonth
()
-
1
);
dateNow
.
setMonth
(
dateNow
.
getMonth
());
let
month
=
format
(
dateNow
,
'MMMM'
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
...
...
@@ -71,11 +69,14 @@ class RepotrCafrm extends Component {
};
console
.
log
(
"month "
);
console
.
log
(
defaultProps
);
console
.
log
(
monthData
[
0
]);
let
index
=
data
.
findIndex
((
val
)
=>
val
.
month_name
==
month
)
this
.
setState
({
listMonth
:
defaultProps
,
month
:
index
==
-
1
?
monthData
[
0
]
:
monthData
[
index
],
loading
:
false
curMonth
:
monthData
[
index
][
'month_id'
]
},
async
()
=>
{
await
this
.
getPeriode
()
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
...
...
@@ -93,7 +94,7 @@ class RepotrCafrm extends Component {
})
}
getPeriode
()
{
async
getPeriode
()
{
let
currentYear
=
new
Date
().
getFullYear
()
let
MB
=
[]
for
(
var
i
=
2000
;
i
<=
currentYear
;
i
++
)
{
...
...
@@ -108,10 +109,12 @@ class RepotrCafrm extends Component {
getOptionLabel
:
(
option
)
=>
option
.
name
,
};
this
.
setState
({
await
this
.
setState
({
listPeriodeMB
:
defaultPropsMB
,
periodeMB
:
MB
[
MB
.
length
-
1
],
loading
:
false
periodeMB
:
MB
[
MB
.
length
-
2
],
curYear
:
currentYear
,
},
async
()
=>
{
await
this
.
getFromCallback
()
})
}
...
...
@@ -152,7 +155,7 @@ class RepotrCafrm extends Component {
async
getFromCallback
()
{
if
(
this
.
state
.
curYear
>=
2000
&&
this
.
state
.
curMonth
>
0
)
{
let
month
=
0
;
if
(
this
.
state
.
curMonth
>=
1
&&
this
.
state
.
curMonth
<=
9
){
if
(
this
.
state
.
curMonth
>=
1
&&
this
.
state
.
curMonth
<=
9
&&
this
.
state
.
curMonth
.
toString
().
length
==
1
){
month
=
'0'
+
this
.
state
.
curMonth
;
}
else
{
month
=
this
.
state
.
curMonth
;
...
...
@@ -165,10 +168,6 @@ class RepotrCafrm extends Component {
curMonth
:
month
,
loading
:
false
})
}
else
{
this
.
setState
({
loading
:
false
})
}
}
...
...
@@ -191,16 +190,9 @@ class RepotrCafrm extends Component {
async
componentDidMount
()
{
await
this
.
getMonth
();
await
this
.
getPeriode
();
this
.
setState
({
loading
:
false
})
console
.
log
(
"month"
);
console
.
log
(
this
.
state
.
listMonth
);
console
.
log
(
"year"
);
console
.
log
(
this
.
state
.
listPeriodeMB
);
console
.
log
(
"data"
)
console
.
log
(
this
.
state
.
dataTable
);
// this.setState({
// loading: false
// })
}
render
()
{
...
...
@@ -322,36 +314,46 @@ class RepotrCafrm extends Component {
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
margin
:
10
}}
>
Report
Status
&
Approval
Progress
CAFRM
<
/Typography
>
<
/div
>
<
div
style
=
{{
minWidth
:
'max-content'
,
padding
:
'20px 20px 0px 20px'
}}
>
<
div
style
=
{{
marginTop
:
15
,
display
:
'flex'
}}
>
<
Autocomplete
{...
this
.
state
.
listPeriodeMB
}
id
=
"periode"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
periodeMB
:
newInputValue
,
curYear
:
newInputValue
[
'value'
],
loading
:
true
},
()
=>
{
this
.
getFromCallback
()})}
disableClearable
style
=
{{
minWidth
:
210
,
marginRight
:
20
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Periode"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
/>
<
Autocomplete
{...
this
.
state
.
listMonth
}
id
=
"month"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
month
:
newInputValue
,
curMonth
:
newInputValue
[
'month_id'
],
loading
:
true
},
()
=>
{
this
.
getFromCallback
()})}
disableClearable
style
=
{{
minWidth
:
210
,
marginRight
:
20
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Month"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
/>
{
this
.
state
.
curMonth
>
0
&&
this
.
state
.
curYear
>
2000
&&
!
this
.
state
.
loading
&&
(
<
div
style
=
{{
minWidth
:
'max-content'
,
padding
:
'20px 20px 0px 20px'
}}
>
<
div
style
=
{{
marginTop
:
15
,
display
:
'flex'
}}
>
<
Autocomplete
{...
this
.
state
.
listPeriodeMB
}
id
=
"periode"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
periodeMB
:
newInputValue
,
curYear
:
newInputValue
[
'value'
],
loading
:
true
,
},
async
()
=>
{
await
this
.
getFromCallback
()
})}
disableClearable
style
=
{{
minWidth
:
210
,
marginRight
:
20
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Periode"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
defaultValue
=
{
this
.
state
.
periodeMB
}
value
=
{
this
.
state
.
periodeMB
}
/
>
<
Autocomplete
{...
this
.
state
.
listMonth
}
id
=
"month"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
month
:
newInputValue
,
curMonth
:
newInputValue
[
'month_id'
],
loading
:
true
},
async
()
=>
{
await
this
.
getFromCallback
()
})}
disableClearable
style
=
{{
minWidth
:
210
,
marginRight
:
20
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Month"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
value
=
{
this
.
state
.
month
}
/
>
<
/div
>
<
/div
>
<
/div
>
)}
<
div
style
=
{{
marginTop
:
20
,
marginBottom
:
20
}}
>
<
div
style
=
{{
display
:
'flex'
,
...
...
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