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
Show 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 {
...
@@ -40,8 +40,6 @@ class RepotrCafrm extends Component {
super
(
props
)
super
(
props
)
this
.
state
=
{
this
.
state
=
{
dataTable
:
[],
dataTable
:
[],
listMonth
:
null
,
listPeriodeMB
:
null
,
curMonth
:
0
,
curMonth
:
0
,
curYear
:
0
,
curYear
:
0
,
data
:
false
data
:
false
...
@@ -54,7 +52,7 @@ class RepotrCafrm extends Component {
...
@@ -54,7 +52,7 @@ class RepotrCafrm extends Component {
this
.
setState
({
loading
:
true
})
this
.
setState
({
loading
:
true
})
await
api
.
create
().
getMonthTransaction
().
then
(
response
=>
{
await
api
.
create
().
getMonthTransaction
().
then
(
response
=>
{
let
dateNow
=
new
Date
()
let
dateNow
=
new
Date
()
dateNow
.
setMonth
(
dateNow
.
getMonth
()
-
1
);
dateNow
.
setMonth
(
dateNow
.
getMonth
());
let
month
=
format
(
dateNow
,
'MMMM'
)
let
month
=
format
(
dateNow
,
'MMMM'
)
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
status
===
"success"
)
{
...
@@ -71,11 +69,14 @@ class RepotrCafrm extends Component {
...
@@ -71,11 +69,14 @@ class RepotrCafrm extends Component {
};
};
console
.
log
(
"month "
);
console
.
log
(
"month "
);
console
.
log
(
defaultProps
);
console
.
log
(
defaultProps
);
console
.
log
(
monthData
[
0
]);
let
index
=
data
.
findIndex
((
val
)
=>
val
.
month_name
==
month
)
let
index
=
data
.
findIndex
((
val
)
=>
val
.
month_name
==
month
)
this
.
setState
({
this
.
setState
({
listMonth
:
defaultProps
,
listMonth
:
defaultProps
,
month
:
index
==
-
1
?
monthData
[
0
]
:
monthData
[
index
],
month
:
index
==
-
1
?
monthData
[
0
]
:
monthData
[
index
],
loading
:
false
curMonth
:
monthData
[
index
][
'month_id'
]
},
async
()
=>
{
await
this
.
getPeriode
()
})
})
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
...
@@ -93,7 +94,7 @@ class RepotrCafrm extends Component {
...
@@ -93,7 +94,7 @@ class RepotrCafrm extends Component {
})
})
}
}
getPeriode
()
{
async
getPeriode
()
{
let
currentYear
=
new
Date
().
getFullYear
()
let
currentYear
=
new
Date
().
getFullYear
()
let
MB
=
[]
let
MB
=
[]
for
(
var
i
=
2000
;
i
<=
currentYear
;
i
++
)
{
for
(
var
i
=
2000
;
i
<=
currentYear
;
i
++
)
{
...
@@ -108,10 +109,12 @@ class RepotrCafrm extends Component {
...
@@ -108,10 +109,12 @@ class RepotrCafrm extends Component {
getOptionLabel
:
(
option
)
=>
option
.
name
,
getOptionLabel
:
(
option
)
=>
option
.
name
,
};
};
this
.
setState
({
await
this
.
setState
({
listPeriodeMB
:
defaultPropsMB
,
listPeriodeMB
:
defaultPropsMB
,
periodeMB
:
MB
[
MB
.
length
-
1
],
periodeMB
:
MB
[
MB
.
length
-
2
],
loading
:
false
curYear
:
currentYear
,
},
async
()
=>
{
await
this
.
getFromCallback
()
})
})
}
}
...
@@ -152,7 +155,7 @@ class RepotrCafrm extends Component {
...
@@ -152,7 +155,7 @@ class RepotrCafrm extends Component {
async
getFromCallback
()
{
async
getFromCallback
()
{
if
(
this
.
state
.
curYear
>=
2000
&&
this
.
state
.
curMonth
>
0
)
{
if
(
this
.
state
.
curYear
>=
2000
&&
this
.
state
.
curMonth
>
0
)
{
let
month
=
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
;
month
=
'0'
+
this
.
state
.
curMonth
;
}
else
{
}
else
{
month
=
this
.
state
.
curMonth
;
month
=
this
.
state
.
curMonth
;
...
@@ -165,10 +168,6 @@ class RepotrCafrm extends Component {
...
@@ -165,10 +168,6 @@ class RepotrCafrm extends Component {
curMonth
:
month
,
curMonth
:
month
,
loading
:
false
loading
:
false
})
})
}
else
{
this
.
setState
({
loading
:
false
})
}
}
}
}
...
@@ -191,16 +190,9 @@ class RepotrCafrm extends Component {
...
@@ -191,16 +190,9 @@ class RepotrCafrm extends Component {
async
componentDidMount
()
{
async
componentDidMount
()
{
await
this
.
getMonth
();
await
this
.
getMonth
();
await
this
.
getPeriode
();
// this.setState({
this
.
setState
({
// loading: false
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
);
}
}
render
()
{
render
()
{
...
@@ -322,6 +314,8 @@ class RepotrCafrm extends Component {
...
@@ -322,6 +314,8 @@ class RepotrCafrm extends Component {
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
margin
:
10
}}
>
Report
Status
&
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
margin
:
10
}}
>
Report
Status
&
Approval
Progress
CAFRM
<
/Typography
>
Approval
Progress
CAFRM
<
/Typography
>
<
/div
>
<
/div
>
{
this
.
state
.
curMonth
>
0
&&
this
.
state
.
curYear
>
2000
&&
!
this
.
state
.
loading
&&
(
<
div
style
=
{{
minWidth
:
'max-content'
,
padding
:
'20px 20px 0px 20px'
}}
>
<
div
style
=
{{
minWidth
:
'max-content'
,
padding
:
'20px 20px 0px 20px'
}}
>
<
div
style
=
{{
marginTop
:
15
,
display
:
'flex'
}}
>
<
div
style
=
{{
marginTop
:
15
,
display
:
'flex'
}}
>
<
Autocomplete
<
Autocomplete
...
@@ -330,12 +324,15 @@ class RepotrCafrm extends Component {
...
@@ -330,12 +324,15 @@ class RepotrCafrm extends Component {
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
periodeMB
:
newInputValue
,
periodeMB
:
newInputValue
,
curYear
:
newInputValue
[
'value'
],
curYear
:
newInputValue
[
'value'
],
loading
:
true
loading
:
true
,
},
()
=>
{
this
.
getFromCallback
()})}
},
async
()
=>
{
await
this
.
getFromCallback
()
})}
disableClearable
disableClearable
style
=
{{
minWidth
:
210
,
marginRight
:
20
}}
style
=
{{
minWidth
:
210
,
marginRight
:
20
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Periode"
margin
=
"normal"
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Periode"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
style
=
{{
marginTop
:
7
}}
/>
}
defaultValue
=
{
this
.
state
.
periodeMB
}
value
=
{
this
.
state
.
periodeMB
}
/
>
/
>
<
Autocomplete
<
Autocomplete
{...
this
.
state
.
listMonth
}
{...
this
.
state
.
listMonth
}
...
@@ -344,14 +341,19 @@ class RepotrCafrm extends Component {
...
@@ -344,14 +341,19 @@ class RepotrCafrm extends Component {
month
:
newInputValue
,
month
:
newInputValue
,
curMonth
:
newInputValue
[
'month_id'
],
curMonth
:
newInputValue
[
'month_id'
],
loading
:
true
loading
:
true
},
()
=>
{
this
.
getFromCallback
()})}
},
async
()
=>
{
await
this
.
getFromCallback
()
})}
disableClearable
disableClearable
style
=
{{
minWidth
:
210
,
marginRight
:
20
}}
style
=
{{
minWidth
:
210
,
marginRight
:
20
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Month"
margin
=
"normal"
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Month"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
style
=
{{
marginTop
:
7
}}
/>
}
value
=
{
this
.
state
.
month
}
/
>
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
)}
<
div
style
=
{{
marginTop
:
20
,
marginBottom
:
20
}}
>
<
div
style
=
{{
marginTop
:
20
,
marginBottom
:
20
}}
>
<
div
style
=
{{
<
div
style
=
{{
display
:
'flex'
,
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