Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nisum-scorecard
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
Venkaiah Naidu Singamchetty
nisum-scorecard
Commits
755f2adb
Commit
755f2adb
authored
Mar 22, 2024
by
Ramadevi Guduri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reportsuiand slice
parent
09e51d5b
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
262 additions
and
192 deletions
+262
-192
index.jsx
src/pages/reportexport/index.jsx
+241
-143
exporttableslice.js
src/redux/reducers/exporttableslice.js
+21
-49
No files found.
src/pages/reportexport/index.jsx
View file @
755f2adb
This diff is collapsed.
Click to expand it.
src/redux/reducers/exporttableslice.js
View file @
755f2adb
import
{
createSlice
,
createAsyncThunk
}
from
"@reduxjs/toolkit"
;
import
{
createSlice
,
createAsyncThunk
}
from
"@reduxjs/toolkit"
;
import
{
base_url
}
from
"../../utils/constants"
;
import
{
base_url
}
from
"../../utils/constants"
;
import
axios
from
"axios"
;
import
axios
from
"axios"
;
const
initialState
=
{
const
initialState
=
{
totalReporteesData
:
[],
//
totalReporteesData: [],
activitiesData
:
null
,
activitiesData
:
[]
,
loading
:
false
,
loading
:
false
,
error
:
null
,
error
:
null
,
fromDate
:
null
,
toDate
:
null
,
};
};
export
const
fetchReportstableData
=
createAsyncThunk
(
"getreportees"
,
async
(
data
)
=>
{
return
await
axios
.
post
(
`
${
base_url
}
/getreportees`
,
data
)
export
const
fetchReportesActivitiesData
=
createAsyncThunk
(
"gettotalactivities"
,
async
(
data
)
=>
{
return
await
axios
.
post
(
`
${
base_url
}
/getActivities`
,
data
)
.
then
((
response
)
=>
response
.
data
);
.
then
((
response
)
=>
response
.
data
);
});
});
const
exporttableSlice
=
createSlice
({
const
exporttableSlice
=
createSlice
({
name
:
"totalReportees"
,
name
:
"totalReportees"
,
initialState
,
initialState
,
...
@@ -23,57 +24,28 @@ const exporttableSlice = createSlice({
...
@@ -23,57 +24,28 @@ const exporttableSlice = createSlice({
resetReporteesTableData
:()
=>
{
resetReporteesTableData
:()
=>
{
return
initialState
return
initialState
},
},
setPastMonth
:
(
state
)
=>
{
const
toDate
=
new
Date
();
const
fromDate
=
new
Date
();
fromDate
.
setMonth
(
fromDate
.
getMonth
()
-
1
);
state
.
fromDate
=
fromDate
;
state
.
toDate
=
toDate
;
console
.
log
(
fromDate
,
toDate
)
},
setPastTwoMonths
:
(
state
)
=>
{
const
toDate
=
new
Date
();
const
fromDate
=
new
Date
();
fromDate
.
setMonth
(
fromDate
.
getMonth
()
-
3
);
state
.
fromDate
=
fromDate
;
state
.
toDate
=
toDate
;
console
.
log
(
fromDate
,
toDate
)
},
setPastsixMonths
:
(
state
)
=>
{
const
toDate
=
new
Date
();
const
fromDate
=
new
Date
();
fromDate
.
setMonth
(
fromDate
.
getMonth
()
-
6
);
state
.
fromDate
=
fromDate
;
state
.
toDate
=
toDate
;
console
.
log
(
fromDate
,
toDate
)
},
setPasttwelvemonths
:
(
state
)
=>
{
const
toDate
=
new
Date
();
const
fromDate
=
new
Date
();
fromDate
.
setMonth
(
fromDate
.
getMonth
()
-
12
);
state
.
fromDate
=
fromDate
;
state
.
toDate
=
toDate
;
console
.
log
(
fromDate
,
toDate
)
},
},
},
extraReducers
:
(
builder
)
=>
{
extraReducers
:
(
builder
)
=>
{
builder
.
addCase
(
fetchReportstableData
.
pending
,
(
state
)
=>
{
builder
.
addCase
(
fetchReportesActivitiesData
.
pending
,
(
state
)
=>
{
state
.
loading
=
true
;
state
.
loading
=
true
;
state
.
error
=
"pending"
;
state
.
error
=
"pending"
;
});
});
builder
.
addCase
(
fetchReportstableData
.
fulfilled
,
(
state
,
action
)
=>
{
builder
.
addCase
(
fetchReportesActivitiesData
.
fulfilled
,
(
state
,
action
)
=>
{
console
.
log
(
action
.
payload
.
activities
)
state
.
loading
=
false
;
state
.
loading
=
false
;
state
.
totalReporteesData
=
action
.
payload
.
data
;
state
.
activitiesData
=
action
.
payload
.
activities
;
state
.
error
=
""
;
state
.
error
=
""
;
});
});
builder
.
addCase
(
fetchReport
stable
Data
.
rejected
,
(
state
,
action
)
=>
{
builder
.
addCase
(
fetchReport
esActivities
Data
.
rejected
,
(
state
,
action
)
=>
{
state
.
loading
=
false
;
state
.
loading
=
false
;
state
.
totalReporte
esData
=
null
;
state
.
activiti
esData
=
null
;
state
.
error
=
action
.
error
||
"Something went wrong!"
;
state
.
error
=
action
.
error
||
"Something went wrong!"
;
});
});
},
},
});
});
export
const
{
resetReporteesTableData
,
setPastMonth
,
setPastTwoMonths
,
setPastsixMonths
,
setPasttwelvemonths
}
=
exporttableSlice
.
actions
;
export
const
{
resetReporteesTableData
}
=
exporttableSlice
.
actions
;
export
default
exporttableSlice
.
reducer
;
export
default
exporttableSlice
.
reducer
;
\ 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