Commit 78b82b37 authored by PDuarte's avatar PDuarte

menupages project select

parent dcc55563
......@@ -4,7 +4,7 @@ import { Link } from 'react-router-dom'
// ** Store & Actions
import { addmenupages } from '../../store/actions'
import { useDispatch } from 'react-redux'
import { useDispatch, useSelector } from 'react-redux'
// ** Custom Components
import Breadcrumbs from '@components/breadcrumbs'
......@@ -21,6 +21,7 @@ import '@styles/react/libs/tables/react-dataTable-component.scss'
const Tables = () => {
const dispatch = useDispatch()
const storeNavbar = useSelector(state => state.navbar)
const onSubmitHandler = values => {
dispatch(
addmenupages({
......@@ -53,9 +54,11 @@ const Tables = () => {
<h4 className="card-title">New {moduleSettings.mainTitleSingle}</h4>
</div>
<div className="card-body">
<ElementCard selectedElement={{
{storeNavbar.projectCurrent === null ? <div>
Select Project
</div> : <ElementCard selectedElement={{
id: '<generate>',
idproject: '2',
idproject: storeNavbar.projectCurrent.value,
system_name: '',
last_seen: '',
layout_page_id: '',
......@@ -73,6 +76,7 @@ const Tables = () => {
}}
onSubmitHandler={onSubmitHandler}
/>
}
</div>
</div>
......
......@@ -13,7 +13,14 @@ const DataTable = () => {
// ** Store Vars
const dispatch = useDispatch()
const store = useSelector(state => state.menupages)
const storeNavbar = useSelector(state => state.navbar)
useEffect(() => {
dispatch(getData_menupages({
start: 0,
length: 1000
}))
}, [storeNavbar.projectCurrent])
return (
<DataTableServerSide
cardTitle={moduleSettings.mainTitle}
......
......@@ -2,7 +2,7 @@ import axios from 'axios'
import {setSaveSatus, setErrorMsg} from '../../../../redux/actions/api'
import moduleSettings from '../../mainpages/module'
import {store} from '@store/storeConfig/store'
// ** Get table Data ///api/datatables/data
......@@ -22,9 +22,10 @@ const _getData_menupages = params => {
}
}
export const getData_menupages = params => {
const currentProject = store.getState().navbar.projectCurrent
const newparams = {
...params,
idproject: 2
idproject: !currentProject ? '%' : currentProject.value
}
return _getData_menupages(newparams)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment