Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
C
cms
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
Pedro-dev_2
cms
Commits
1f58b375
Commit
1f58b375
authored
Apr 22, 2021
by
PDuarte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaning code
parent
38aa7fd8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
105 additions
and
273 deletions
+105
-273
rootReducer.js
src/redux/reducers/rootReducer.js
+2
-2
TableServerSide.js
src/views/settings/projects/TableServerSide.js
+1
-1
index.js
src/views/settings/projects/edit/index.js
+27
-188
main.js
src/views/settings/projects/edit/main.js
+46
-0
plataform.js
src/views/settings/projects/edit/plataform.js
+2
-2
projectCard.js
src/views/settings/projects/edit/projectCard.js
+27
-80
No files found.
src/redux/reducers/rootReducer.js
View file @
1f58b375
...
...
@@ -14,7 +14,7 @@ import calendar from '@src/views/apps/calendar/store/reducer'
import
ecommerce
from
'@src/views/apps/ecommerce/store/reducer'
import
dataTables
from
'@src/views/tables/data-tables/store/reducer'
import
settings
from
'@src/views/settings/store/reducer'
import
project
settings
from
'@src/views/settings/store/reducer'
const
rootReducer
=
combineReducers
({
auth
,
...
...
@@ -28,7 +28,7 @@ const rootReducer = combineReducers({
calendar
,
ecommerce
,
dataTables
,
settings
project
settings
})
export
default
rootReducer
src/views/settings/projects/TableServerSide.js
View file @
1f58b375
...
...
@@ -17,7 +17,7 @@ import { Card, CardHeader, CardTitle, Input, Label, Row, Col } from 'reactstrap'
const
DataTableServerSide
=
()
=>
{
// ** Store Vars
const
dispatch
=
useDispatch
()
const
store
=
useSelector
(
state
=>
state
.
settings
)
const
store
=
useSelector
(
state
=>
state
.
project
settings
)
// ** States
const
[
currentPage
,
setCurrentPage
]
=
useState
(
1
)
...
...
src/views/settings/projects/edit/index.js
View file @
1f58b375
import
{
useState
,
useEffect
,
Fragment
}
from
'react'
import
{
useParams
,
Link
}
from
'react-router-dom'
// ** Store & Actions
import
{
getProject
,
updateProject
}
from
'../../store/actions'
import
{
useSelector
,
useDispatch
}
from
'react-redux'
// ** Utils
import
{
isObjEmpty
}
from
'@utils'
// ** Third Party Components
import
{
Lock
,
Edit
,
Trash2
}
from
'react-feather'
import
{
Media
,
Button
,
Label
,
Form
,
FormGroup
,
Input
,
Table
,
CustomInput
,
Card
,
CardBody
,
Row
,
Col
,
Nav
,
NavItem
,
NavLink
,
TabContent
,
TabPane
,
Alert
}
from
'reactstrap'
import
ProjectCard
from
'./projectCard'
import
ProjectPlatform
from
'./plataform'
import
{
useForm
}
from
'react-hook-form'
import
classnames
from
'classnames'
const
ProjectsEdit
=
()
=>
{
// ** States & Vars
const
store
=
useSelector
(
state
=>
state
.
settings
),
[
dataProject
,
setProjectData
]
=
useState
(
null
),
{
register
,
errors
,
handleSubmit
}
=
useForm
(),
dispatch
=
useDispatch
(),
{
id
}
=
useParams
()
// ** Function to get user on mount
useEffect
(()
=>
{
// console.log('eff')
// console.log(store.selectedProject)
dispatch
(
getProject
(
id
))
},
[
dispatch
])
// ** Update user image on mount or change
useEffect
(()
=>
{
if
(
store
.
selectedProject
!==
null
||
(
store
.
selectedProject
!==
null
&&
dataProject
!==
null
&&
store
.
selectedProject
.
id
!==
dataProject
.
id
))
{
return
setProjectData
(
store
.
selectedProject
)
}
},
[
store
.
selectedProject
])
return
store
.
selectedProject
!==
null
&&
store
.
selectedProject
!==
undefined
?
(
<
Row
>
<
Col
sm
=
'12'
>
<
Form
// onSubmit={handleSubmit(onSubmit)}
>
<
Row
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'email'
>
ID
<
/Label
>
<
Input
readOnly
=
{
true
}
type
=
'text'
name
=
'id'
id
=
'id'
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'id'
defaultValue
=
{
id
}
/
>
<
/FormGroup
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'app_name'
>
Project
Name
<
/Label
>
<
Input
type
=
'text'
name
=
'app_name'
id
=
'app_name'
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'Project Name'
defaultValue
=
{
dataProject
&&
dataProject
.
app_name
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'app_name'
]
})}
/
>
<
/FormGroup
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'customer_name'
>
Client
Name
<
/Label
>
<
Input
type
=
'text'
name
=
'customer_name'
id
=
'customer_name'
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'Client Name'
defaultValue
=
{
dataProject
&&
dataProject
.
customer_name
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'customer_name'
]
})}
/
>
<
/FormGroup
>
<
/Col
>
{
/* <Col md='4' sm='12'>
<FormGroup>
<Label for='email'>Email</Label>
<Input disabled='disabled' type='text' id='email' placeholder='Email' defaultValue={ProjectData && ProjectData.email} />
</FormGroup>
</Col> */
}
{
/* <Col md='4' sm='12'>
<FormGroup>
<Label for='status'>Status</Label>
<Input type='select' name='status' id='status' defaultValue={ProjectData && ProjectData.status}>
<option value='pending'>Pending</option>
<option value='active'>Active</option>
<option value='inactive'>Inactive</option>
</Input>
</FormGroup>
</Col> */
}
<
Col
sm
=
'6'
>
<
div
className
=
'permissions border mt-1'
>
<
h6
className
=
'py-1 mx-1 mb-0 font-medium-2'
>
<
Lock
size
=
{
18
}
className
=
'mr-25'
/>
<
span
className
=
'align-middle'
>
Platforms
<
/span
>
<
/h6
>
<
Table
borderless
striped
responsive
>
<
thead
className
=
'thead-light'
>
<
tr
>
<
th
>
Platforms
<
/th>
<
th
>
Active
<
/th>
<
/tr
>
<
/thead
>
<
tbody
>
<
tr
>
<
td
>
IOS
<
/td
>
<
td
>
<
CustomInput
type
=
'checkbox'
id
=
'admin-1'
label
=
''
defaultChecked
/>
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Android
<
/td
>
<
td
>
<
CustomInput
type
=
'checkbox'
id
=
'staff-1'
label
=
''
/>
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Android
Tv
<
/td
>
<
td
>
<
CustomInput
type
=
'checkbox'
id
=
'author-1'
label
=
''
defaultChecked
/>
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Roku
<
/td
>
<
td
>
<
CustomInput
type
=
'checkbox'
id
=
'contributor-1'
label
=
''
/>
<
/td
>
<
/tr
>
<
tr
>
<
td
>
STV
<
/td
>
<
td
>
<
CustomInput
type
=
'checkbox'
id
=
'user-1'
label
=
''
/>
<
/td
>
<
/tr
>
<
/tbody
>
<
/Table
>
<
/div
>
{
/* <ProjectPlatform /> */
}
<
/Col
>
<
Col
className
=
'd-flex flex-sm-row flex-column mt-2'
sm
=
'12'
>
<
Button
.
Ripple
className
=
'mb-1 mb-sm-0 mr-0 mr-sm-1'
type
=
'submit'
color
=
'primary'
>
Save
Changes
<
/Button.Ripple
>
<
Button
.
Ripple
color
=
'secondary'
outline
>
Reset
<
/Button.Ripple
>
<
/Col
>
<
/Row
>
<
/Form
>
{
/* <ProjectCard selectedProject={dataProject} /> */
}
{
/* {saveSucces ? 'sim' : 'nao'}
{errorMsg} */
}
<
/Col>
<
/Row
>
)
:
(
<
Alert
color
=
'danger'
>
<
h4
className
=
'alert-heading'
>
Project
not
found
<
/h4
>
<
div
className
=
'alert-body'
>
User
with
id
:
{
id
}
doesn
't exist. Check list of all Projects: <Link to='
/
settings
/
projects
'>Projects List</Link>
</div>
</Alert>
// ** React Imports
import
{
Fragment
}
from
'react'
// ** Custom Components
import
Breadcrumbs
from
'@components/breadcrumbs'
// ** Third Party Components
import
{
Row
,
Col
}
from
'reactstrap'
// ** Tables
import
ProjectsEdit
from
'./main'
// ** Styles
import
'@styles/react/libs/tables/react-dataTable-component.scss'
const
Tables
=
()
=>
{
return
(
<
Fragment
>
<
Breadcrumbs
breadCrumbTitle
=
'Settings'
breadCrumbParent
=
'Settings'
breadCrumbActive
=
'Projects'
/>
<
Row
>
<
Col
sm
=
'12'
>
<
ProjectsEdit
/>
<
/Col
>
<
/Row
>
<
/Fragment
>
)
}
export default ProjectsEdit
}
export
default
Tables
src/views/settings/projects/edit/main.js
0 → 100644
View file @
1f58b375
import
{
useState
,
useEffect
,
Fragment
}
from
'react'
import
{
useParams
,
Link
}
from
'react-router-dom'
// ** Store & Actions
import
{
getProject
,
updateProject
}
from
'../../store/actions'
import
{
useSelector
,
useDispatch
}
from
'react-redux'
import
{
Alert
}
from
'reactstrap'
import
ProjectCard
from
'./projectCard'
const
ProjectsEdit
=
()
=>
{
// ** States & Vars
const
store
=
useSelector
(
state
=>
state
.
projectsettings
),
[
dataProject
,
setProjectData
]
=
useState
(
null
),
dispatch
=
useDispatch
(),
{
id
}
=
useParams
()
// ** Function to get user on mount
useEffect
(()
=>
{
dispatch
(
getProject
(
id
))
},
[
dispatch
])
// ** Update user image on mount or change
useEffect
(()
=>
{
if
(
store
.
selectedProject
!==
null
||
(
store
.
selectedProject
!==
null
&&
dataProject
!==
null
&&
store
.
selectedProject
.
id
!==
dataProject
.
id
))
{
return
setProjectData
(
store
.
selectedProject
)
}
},
[
store
.
selectedProject
])
return
store
.
selectedProject
!==
null
&&
store
.
selectedProject
!==
undefined
?
(
<
ProjectCard
selectedProject
=
{
store
.
selectedProject
}
/>
)
:
(
<
Alert
color
=
'danger'
>
<
h4
className
=
'alert-heading'
>
Project
not
found
<
/h4
>
<
div
className
=
'alert-body'
>
User
with
id
:
{
id
}
doesn
't exist. Check list of all Projects: <Link to='
/
settings
/
projects
'>Projects List</Link>
</div>
</Alert>
)
}
export default ProjectsEdit
src/views/settings/projects/edit/plataform.js
View file @
1f58b375
import
{
Media
,
Button
,
Label
,
Form
,
FormGroup
,
Input
,
Table
,
CustomInput
,
Card
,
CardBody
,
Row
,
Col
,
Nav
,
NavItem
,
NavLink
,
TabContent
,
TabPane
,
Alert
}
from
'reactstrap'
// ** Styles
import
'@styles/react/apps/app-users.scss'
import
{
Lock
,
Edit
,
Trash2
}
from
'react-feather'
const
ProjectPlatform
=
()
=>
{
...
...
src/views/settings/projects/edit/projectCard.js
View file @
1f58b375
// ** React Imports
import
{
useState
,
useEffect
,
Fragment
}
from
'react'
import
{
useDispatch
}
from
'react-redux'
import
{
Media
,
Button
,
Label
,
Form
,
FormGroup
,
Input
,
Table
,
CustomInput
,
Card
,
CardBody
,
Row
,
Col
,
Nav
,
NavItem
,
NavLink
,
TabContent
,
TabPane
,
Alert
}
from
'reactstrap'
import
{
isEmptyObject
}
from
'jquery'
import
{
isObjEmpty
}
from
'@utils'
import
{
Lock
,
Edit
,
Trash2
}
from
'react-feather'
// ** Store & Actions
import
{
updateProject
}
from
'../../store/actions'
...
...
@@ -10,32 +14,23 @@ import { updateProject } from '../../store/actions'
import
{
useForm
}
from
'react-hook-form'
import
classnames
from
'classnames'
import
ProjectPlatform
from
'./plataform'
// ** Function to handle form submit
const
onSubmit
=
values
=>
{
// if (isObjEmpty(errors)) {
// dispatch(
// updateProject({
// id: values.id,
// app_name: values.app_name,
// customer_name: values.customer_name
// })
// )
// }
}
const
ProjectCard
=
({
selectedProject
})
=>
{
const
[
dataProject
,
setProjectData
]
=
useState
(
null
)
// const { register, errors, handleSubmit } = useForm()
// const [dataProject, setProjectData] = useState(null)
// // ** Update user image on mount or change
// useEffect(() => {
// if (selectedProject !== null || (selectedProject !== null && dataProject !== null && selectedProject.id !== dataProject.id)) {
// return setProjectData(selectedProject)
// }
// }, [selectedProject])
const
[
dataProject
,
setProjectData
]
=
useState
(
null
),
{
register
,
errors
,
handleSubmit
}
=
useForm
(),
dispatch
=
useDispatch
(),
onSubmit
=
values
=>
{
if
(
isObjEmpty
(
errors
))
{
dispatch
(
updateProject
({
id
:
values
.
id
,
app_name
:
values
.
app_name
,
customer_name
:
values
.
customer_name
})
)
}
}
useEffect
(()
=>
{
if
(
selectedProject
!==
null
||
(
selectedProject
!==
null
&&
dataProject
!==
null
&&
selectedProject
.
id
!==
dataProject
.
id
))
{
...
...
@@ -47,7 +42,7 @@ const ProjectCard = ({ selectedProject }) => {
return
(
<
Fragment
>
<
Form
//
onSubmit={handleSubmit(onSubmit)}
onSubmit
=
{
handleSubmit
(
onSubmit
)}
>
<
Row
>
<
Col
md
=
'4'
sm
=
'12'
>
...
...
@@ -58,9 +53,9 @@ return (
type
=
'text'
name
=
'id'
id
=
'id'
//
innerRef={register({ required: true })}
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'id'
defaultValue
=
'1'
defaultValue
=
{
dataProject
&&
dataProject
.
id
}
/
>
<
/FormGroup
>
<
/Col
>
...
...
@@ -71,10 +66,10 @@ return (
type
=
'text'
name
=
'app_name'
id
=
'app_name'
//
innerRef={register({ required: true })}
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'Project Name'
defaultValue
=
{
dataProject
&&
dataProject
.
app_name
}
//
className={classnames({ 'is-invalid': errors['app_name'] })}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'app_name'
]
})}
/
>
<
/FormGroup
>
<
/Col
>
...
...
@@ -88,7 +83,7 @@ return (
// innerRef={register({ required: true })}
placeholder
=
'Client Name'
defaultValue
=
{
dataProject
&&
dataProject
.
customer_name
}
//
className={classnames({ 'is-invalid': errors['customer_name'] })}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'customer_name'
]
})}
/
>
<
/FormGroup
>
<
/Col
>
...
...
@@ -110,55 +105,7 @@ return (
</Col> */
}
<
Col
sm
=
'6'
>
<
div
className
=
'permissions border mt-1'
>
<
h6
className
=
'py-1 mx-1 mb-0 font-medium-2'
>
<
Lock
size
=
{
18
}
className
=
'mr-25'
/>
<
span
className
=
'align-middle'
>
Platforms
<
/span
>
<
/h6
>
<
Table
borderless
striped
responsive
>
<
thead
className
=
'thead-light'
>
<
tr
>
<
th
>
Platforms
<
/th>
<
th
>
Active
<
/th>
<
/tr
>
<
/thead
>
<
tbody
>
<
tr
>
<
td
>
IOS
<
/td
>
<
td
>
<
CustomInput
type
=
'checkbox'
id
=
'admin-1'
label
=
''
defaultChecked
/>
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Android
<
/td
>
<
td
>
<
CustomInput
type
=
'checkbox'
id
=
'staff-1'
label
=
''
/>
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Android
Tv
<
/td
>
<
td
>
<
CustomInput
type
=
'checkbox'
id
=
'author-1'
label
=
''
defaultChecked
/>
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Roku
<
/td
>
<
td
>
<
CustomInput
type
=
'checkbox'
id
=
'contributor-1'
label
=
''
/>
<
/td
>
<
/tr
>
<
tr
>
<
td
>
STV
<
/td
>
<
td
>
<
CustomInput
type
=
'checkbox'
id
=
'user-1'
label
=
''
/>
<
/td
>
<
/tr
>
<
/tbody
>
<
/Table
>
<
/div
>
<
ProjectPlatform
/>
<
/Col
>
<
Col
className
=
'd-flex flex-sm-row flex-column mt-2'
sm
=
'12'
>
<
Button
.
Ripple
className
=
'mb-1 mb-sm-0 mr-0 mr-sm-1'
type
=
'submit'
color
=
'primary'
>
...
...
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