Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dashboard
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
red-giant
dashboard
Commits
10569759
Verified
Commit
10569759
authored
3 years ago
by
Defendi Alberto
Browse files
Options
Downloads
Patches
Plain Diff
Move dialog to this file.
parent
dd9350c2
No related branches found
No related tags found
2 merge requests
!56
Refined auth flow and new website pages.
,
!55
Refactoring to reservation page.
Pipeline
#12494
passed
3 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/Dashboard/ReservationPage/ReservationDialog.tsx
+108
-0
108 additions, 0 deletions
...omponents/Dashboard/ReservationPage/ReservationDialog.tsx
src/components/Dashboard/ReservationPage/ReservationPage.tsx
+5
-58
5 additions, 58 deletions
src/components/Dashboard/ReservationPage/ReservationPage.tsx
with
113 additions
and
58 deletions
src/components/Dashboard/ReservationPage/ReservationDialog.tsx
0 → 100644
+
108
−
0
View file @
10569759
import
React
,
{
FC
}
from
'
react
'
;
import
{
Grid
,
Typography
,
Dialog
,
DialogActions
,
DialogContent
,
DialogContentText
,
DialogTitle
,
Button
,
}
from
'
@material-ui/core
'
;
import
AddIcon
from
'
@material-ui/icons/Add
'
;
import
Fab
from
'
@material-ui/core/Fab
'
;
import
{
NavBar
}
from
'
components/Dashboard/HomePage/NavBar
'
;
import
{
Reservation
}
from
'
components/Dashboard/ReservationPage/Reservation/Reservation
'
;
import
{
useReservations
}
from
'
hooks/useReservations
'
;
import
{
ReservationProps
}
from
'
components/Dashboard/ReservationPage/Reservation/ReservationProps
'
;
import
{
SubmitHandler
,
useForm
}
from
'
react-hook-form
'
;
import
{
InputField
}
from
'
components/Auth/InputField/InputField
'
;
import
{
useStyles
}
from
'
./ReservationPage.style
'
;
type
ReservationDialogProps
=
{
handleClose
:
()
=>
void
;
isOpen
:
boolean
;
};
export
const
ReservationDialog
:
FC
<
ReservationDialogProps
>
=
({
handleClose
,
isOpen
,
}:
ReservationDialogProps
)
=>
{
const
classes
=
useStyles
();
const
{
control
,
handleSubmit
}
=
useForm
<
ReservationProps
>
();
const
reservation
=
useReservations
();
const
onSubmit
:
SubmitHandler
<
ReservationProps
>
=
(
data
:
ReservationProps
,
)
=>
{
console
.
log
(
data
);
handleClose
();
};
return
(
<
div
data-testid
=
"ReservationDialog"
>
<
Grid
container
direction
=
"column"
className
=
{
classes
.
paddingBottom
}
>
<
div
className
=
{
classes
.
root
}
>
<
Grid
item
>
<
NavBar
/>
</
Grid
>
<
Dialog
open
=
{
isOpen
}
onClose
=
{
handleClose
}
aria-labelledby
=
"form-dialog-title"
>
<
form
onSubmit
=
{
handleSubmit
(
onSubmit
)
}
data-testid
=
"Form"
>
<
DialogTitle
id
=
"form-dialog-title"
>
Book New Reservation
</
DialogTitle
>
<
DialogContent
>
<
DialogContentText
>
Write here below the details of your next reservation
</
DialogContentText
>
<
InputField
name
=
"name"
label
=
"Name Reservation"
type
=
"text"
control
=
{
control
}
/>
<
InputField
name
=
"date"
label
=
"Reservation date"
type
=
"date"
control
=
{
control
}
/>
<
InputField
name
=
"time"
label
=
"Department Time"
type
=
"time"
control
=
{
control
}
/>
<
InputField
name
=
"destination"
label
=
"Destination"
type
=
"text"
control
=
{
control
}
/>
</
DialogContent
>
<
DialogActions
>
<
Button
onClick
=
{
handleClose
}
color
=
"primary"
>
Cancel
</
Button
>
<
Button
type
=
"submit"
fullWidth
variant
=
"contained"
color
=
"primary"
>
Insert
</
Button
>
</
DialogActions
>
</
form
>
</
Dialog
>
</
div
>
</
Grid
>
</
div
>
);
};
This diff is collapsed.
Click to expand it.
src/components/Dashboard/ReservationPage/ReservationPage.tsx
+
5
−
58
View file @
10569759
...
@@ -18,21 +18,22 @@ import { ReservationProps } from 'components/Dashboard/ReservationPage/Reservati
...
@@ -18,21 +18,22 @@ import { ReservationProps } from 'components/Dashboard/ReservationPage/Reservati
import
{
SubmitHandler
,
useForm
}
from
'
react-hook-form
'
;
import
{
SubmitHandler
,
useForm
}
from
'
react-hook-form
'
;
import
{
InputField
}
from
'
components/Auth/InputField/InputField
'
;
import
{
InputField
}
from
'
components/Auth/InputField/InputField
'
;
import
{
useStyles
}
from
'
./ReservationPage.style
'
;
import
{
useStyles
}
from
'
./ReservationPage.style
'
;
import
{
ReservationDialog
}
from
'
./ReservationDialog
'
;
export
const
ReservationPage
:
FC
=
()
=>
{
export
const
ReservationPage
:
FC
=
()
=>
{
const
classes
=
useStyles
();
const
classes
=
useStyles
();
const
{
control
,
handleSubmit
}
=
useForm
<
ReservationProps
>
();
const
{
control
,
handleSubmit
}
=
useForm
<
ReservationProps
>
();
const
[
o
pen
,
setOpen
]
=
React
.
useState
(
false
);
const
[
isO
pen
,
set
Is
Open
]
=
React
.
useState
<
boolean
>
(
false
);
const
reservation
=
useReservations
();
const
reservation
=
useReservations
();
const
handleOpen
=
():
void
=>
{
const
handleOpen
=
():
void
=>
{
setOpen
(
true
);
set
Is
Open
(
true
);
};
};
const
handleClose
=
():
void
=>
{
const
handleClose
=
():
void
=>
{
setOpen
(
false
);
set
Is
Open
(
false
);
};
};
const
onSubmit
:
SubmitHandler
<
ReservationProps
>
=
(
const
onSubmit
:
SubmitHandler
<
ReservationProps
>
=
(
...
@@ -48,61 +49,7 @@ export const ReservationPage: FC = () => {
...
@@ -48,61 +49,7 @@ export const ReservationPage: FC = () => {
<
Grid
item
>
<
Grid
item
>
<
NavBar
/>
<
NavBar
/>
</
Grid
>
</
Grid
>
<
ReservationDialog
handleClose
=
{
handleClose
}
isOpen
=
{
isOpen
}
/>
<
Dialog
open
=
{
open
}
onClose
=
{
handleOpen
}
aria-labelledby
=
"form-dialog-title"
>
<
form
onSubmit
=
{
handleSubmit
(
onSubmit
)
}
data-testid
=
"Form"
>
<
DialogTitle
id
=
"form-dialog-title"
>
Book New Reservation
</
DialogTitle
>
<
DialogContent
>
<
DialogContentText
>
Write here below the details of your next reservation
</
DialogContentText
>
<
InputField
name
=
"name"
label
=
"Name Reservation"
type
=
"text"
control
=
{
control
}
/>
<
InputField
name
=
"date"
label
=
"Reservation date"
type
=
"date"
control
=
{
control
}
/>
<
InputField
name
=
"time"
label
=
"Department Time"
type
=
"time"
control
=
{
control
}
/>
<
InputField
name
=
"destination"
label
=
"Destination"
type
=
"text"
control
=
{
control
}
/>
</
DialogContent
>
<
DialogActions
>
<
Button
onClick
=
{
handleClose
}
color
=
"primary"
>
Cancel
</
Button
>
<
Button
type
=
"submit"
fullWidth
variant
=
"contained"
color
=
"primary"
>
Insert
</
Button
>
</
DialogActions
>
</
form
>
</
Dialog
>
<
Grid
item
container
className
=
{
classes
.
paddingBottom
}
>
<
Grid
item
container
className
=
{
classes
.
paddingBottom
}
>
<
Grid
item
xs
=
{
1
}
md
=
{
2
}
lg
=
{
2
}
/>
<
Grid
item
xs
=
{
1
}
md
=
{
2
}
lg
=
{
2
}
/>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment