Commit 3a84115e authored by PDuarte's avatar PDuarte

basic layout menu

parent e319af13
// ** React Imports
import { Link } from 'react-router-dom'
import { cleanLayoutMenu } from '../store/actions'
import { store } from '@store/storeConfig/store'
// ** Custom Components
import Avatar from '@components/avatar'
// module settings
......@@ -225,7 +228,7 @@ export const serverSideColumns = [
<Link
to={`${moduleSettings.baseURL}/edit/${row.id}`}
className='user-name text-truncate mb-0'
// onClick={() => store.dispatch(cleanProject(row.id))}
onClick={() => store.dispatch(cleanLayoutMenu(row.id))}
>
<span className='font-weight-bold'>{row.name}</span>
</Link>
......
......@@ -26,11 +26,11 @@ const Tables = () => {
</Row>
<Row>
<Col sm='12'>
<div class="card">
<div class="card-header">
<h4 class="card-title">{moduleSettings.mainTitleSingle}</h4>
<div className="card">
<div className="card-header">
<h4 className="card-title">{moduleSettings.mainTitleSingle}</h4>
</div>
<div class="card-body">
<div className="card-body">
<ElementEdit />
</div>
</div>
......
......@@ -15,7 +15,7 @@ import moduleSettings from '../module'
const ElementEdit = () => {
// ** States & Vars
const store = useSelector(state => state.projectsettings),
const store = useSelector(state => state.screens),
[dataElement, setElementData] = useState(null),
dispatch = useDispatch(),
{ id } = useParams()
......@@ -39,15 +39,15 @@ const ElementEdit = () => {
// ** Update user image on mount or change
useEffect(() => {
if (store.selectedElement !== null || (store.selectedElement !== null && dataElement !== null && store.selectedElement.id !== dataElement.id)) {
return setElementData(store.selectedElement)
if (store.selectedLayoutMenu !== null || (store.selectedLayoutMenu !== null && dataElement !== null && store.selectedLayoutMenu.id !== dataElement.id)) {
return setElementData(store.selectedLayoutMenu)
}
}, [store.selectedElement])
}, [store.selectedLayoutMenu])
return store.selectedElement !== null && store.selectedElement !== undefined ? (
return store.selectedLayoutMenu !== null && store.selectedLayoutMenu !== undefined ? (
<ElementCard
selectedElement={store.selectedElement}
selectedElement={store.selectedLayoutMenu}
onSubmitHandler={onSubmitHandler}
/>
) : (
......
......@@ -85,10 +85,19 @@ export const getData_layoutmenus = params => {
}
}
export const cleanLayoutMenu = id => {
return async dispatch => {
dispatch({
type: 'GET_LAYOUTMENU',
data: null
})
}
}
export const updateLayoutMenu = layoumenu => {
return (dispatch, getState) => {
axios
.put(`${process.env.REACT_APP_API}/api/layoumenus/${layoumenu.id}`, project)
.put(`${process.env.REACT_APP_API}/api/layoutmenus/${layoumenu.id}`, layoumenu)
.then(response => {
dispatch({
type: 'UPDATE_LAYOUTMENU',
......
......@@ -57,6 +57,10 @@ const screens = (state = initialState, action) => {
return { ...state,
selectedLayoutMenu : action.data
}
case 'GET_LAYOUTMENU':
return { ...state,
selectedLayoutMenu : action.data
}
case 'UPDATE_LAYOUTMENU':
return { ...state }
......
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