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
e79c85e0
Commit
e79c85e0
authored
Apr 22, 2021
by
PDuarte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
saving alerts
parent
1f58b375
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
3 deletions
+47
-3
projectCard.js
src/views/settings/projects/edit/projectCard.js
+47
-3
No files found.
src/views/settings/projects/edit/projectCard.js
View file @
e79c85e0
...
@@ -2,11 +2,14 @@
...
@@ -2,11 +2,14 @@
import
{
useState
,
useEffect
,
Fragment
}
from
'react'
import
{
useState
,
useEffect
,
Fragment
}
from
'react'
import
{
useDispatch
}
from
'react-redux'
import
{
useDispatch
}
from
'react-redux'
import
{
toast
}
from
'react-toastify'
import
Avatar
from
'@components/avatar'
import
{
Media
,
Button
,
Label
,
Form
,
FormGroup
,
Input
,
Table
,
CustomInput
,
Card
,
CardBody
,
Row
,
Col
,
Nav
,
NavItem
,
NavLink
,
TabContent
,
TabPane
,
Alert
}
from
'reactstrap'
import
{
Media
,
Button
,
Label
,
Form
,
FormGroup
,
Input
,
Table
,
CustomInput
,
Card
,
CardBody
,
Row
,
Col
,
Nav
,
NavItem
,
NavLink
,
TabContent
,
TabPane
,
Alert
,
CardHeader
,
CardTitle
,
CardText
}
from
'reactstrap'
import
{
isObjEmpty
}
from
'@utils'
import
{
isObjEmpty
}
from
'@utils'
import
{
Lock
,
Edit
,
Trash2
}
from
'react-feather'
import
{
Bell
,
Check
,
X
,
AlertTriangle
,
Info
}
from
'react-feather'
// ** Store & Actions
// ** Store & Actions
import
{
updateProject
}
from
'../../store/actions'
import
{
updateProject
}
from
'../../store/actions'
...
@@ -16,12 +19,52 @@ import classnames from 'classnames'
...
@@ -16,12 +19,52 @@ import classnames from 'classnames'
import
ProjectPlatform
from
'./plataform'
import
ProjectPlatform
from
'./plataform'
import
Swal
from
'sweetalert2'
import
withReactContent
from
'sweetalert2-react-content'
const
SuccessProgressToast
=
()
=>
(
<
Fragment
>
<
div
className
=
'toastify-header'
>
<
div
className
=
'title-wrapper'
>
<
Avatar
size
=
'sm'
color
=
'success'
icon
=
{
<
Check
size
=
{
12
}
/>} /
>
<
h6
className
=
'toast-title'
>
Saving
Project
!<
/h6
>
<
/div
>
<
small
className
=
'text-muted'
>
now
<
/small
>
<
/div
>
<
div
className
=
'toastify-body'
>
<
span
role
=
'img'
aria
-
label
=
'toast-text'
>
👋
Good
job
.
<
/span
>
<
/div
>
<
/Fragment
>
)
const
ProjectCard
=
({
selectedProject
})
=>
{
const
ProjectCard
=
({
selectedProject
})
=>
{
const
MySwal
=
withReactContent
(
Swal
)
const
handleError
=
()
=>
{
return
MySwal
.
fire
({
title
:
'Error!'
,
text
:
' You clicked the button!'
,
icon
:
'error'
,
customClass
:
{
confirmButton
:
'btn btn-primary'
},
buttonsStyling
:
false
})
}
const
[
dataProject
,
setProjectData
]
=
useState
(
null
),
const
[
dataProject
,
setProjectData
]
=
useState
(
null
),
{
register
,
errors
,
handleSubmit
}
=
useForm
(),
{
register
,
errors
,
handleSubmit
}
=
useForm
(),
dispatch
=
useDispatch
(),
dispatch
=
useDispatch
(),
notifySuccessProgress
=
()
=>
toast
.
success
(
<
SuccessProgressToast
/>
),
onSubmit
=
values
=>
{
onSubmit
=
values
=>
{
if
(
isObjEmpty
(
errors
))
{
if
(
isObjEmpty
(
errors
))
{
notifySuccessProgress
()
// handleError()
dispatch
(
dispatch
(
updateProject
({
updateProject
({
id
:
values
.
id
,
id
:
values
.
id
,
...
@@ -32,6 +75,7 @@ const ProjectCard = ({ selectedProject }) => {
...
@@ -32,6 +75,7 @@ const ProjectCard = ({ selectedProject }) => {
}
}
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
selectedProject
!==
null
||
(
selectedProject
!==
null
&&
dataProject
!==
null
&&
selectedProject
.
id
!==
dataProject
.
id
))
{
if
(
selectedProject
!==
null
||
(
selectedProject
!==
null
&&
dataProject
!==
null
&&
selectedProject
.
id
!==
dataProject
.
id
))
{
return
setProjectData
(
selectedProject
)
return
setProjectData
(
selectedProject
)
...
@@ -80,7 +124,7 @@ return (
...
@@ -80,7 +124,7 @@ return (
type
=
'text'
type
=
'text'
name
=
'customer_name'
name
=
'customer_name'
id
=
'customer_name'
id
=
'customer_name'
//
innerRef={register({ required: true })}
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'Client Name'
placeholder
=
'Client Name'
defaultValue
=
{
dataProject
&&
dataProject
.
customer_name
}
defaultValue
=
{
dataProject
&&
dataProject
.
customer_name
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'customer_name'
]
})}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'customer_name'
]
})}
...
...
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