mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
add phone
This commit is contained in:
@@ -5,7 +5,7 @@ import Input from '../input'
|
|||||||
export default function Contact() {
|
export default function Contact() {
|
||||||
const { state, onChangeEvent } = useContext(WizardContext)
|
const { state, onChangeEvent } = useContext(WizardContext)
|
||||||
|
|
||||||
const { org, name, email, street, zip, city } = state.formData
|
const { org, name, email, phone, street, zip, city } = state.formData
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -25,6 +25,13 @@ export default function Contact() {
|
|||||||
onChange={onChangeEvent}
|
onChange={onChangeEvent}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
<Input
|
||||||
|
label="Telefon"
|
||||||
|
type="phone"
|
||||||
|
name="phone"
|
||||||
|
value={phone}
|
||||||
|
onChange={onChangeEvent}
|
||||||
|
/>
|
||||||
<Input
|
<Input
|
||||||
label="Straße"
|
label="Straße"
|
||||||
name="street"
|
name="street"
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ interface WizardFormData {
|
|||||||
destination: string
|
destination: string
|
||||||
name: string
|
name: string
|
||||||
email: string
|
email: string
|
||||||
|
phone: string
|
||||||
street: string
|
street: string
|
||||||
zip: string
|
zip: string
|
||||||
city: string
|
city: string
|
||||||
@@ -125,6 +126,7 @@ const initialState: WizardStoreState = {
|
|||||||
destination: '',
|
destination: '',
|
||||||
name: '',
|
name: '',
|
||||||
email: '',
|
email: '',
|
||||||
|
phone: '',
|
||||||
street: '',
|
street: '',
|
||||||
zip: '',
|
zip: '',
|
||||||
city: '',
|
city: '',
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import * as mongoose from 'mongoose'
|
|||||||
export interface Booker {
|
export interface Booker {
|
||||||
name: string
|
name: string
|
||||||
email: string
|
email: string
|
||||||
|
phone: string
|
||||||
street: string
|
street: string
|
||||||
zip: string
|
zip: string
|
||||||
city: string
|
city: string
|
||||||
@@ -19,6 +20,7 @@ const BookerSchema = new mongoose.Schema<BookerDocument>(
|
|||||||
{
|
{
|
||||||
name: { type: String, required: true },
|
name: { type: String, required: true },
|
||||||
email: { type: String, required: true, unique: true, minlength: 5 },
|
email: { type: String, required: true, unique: true, minlength: 5 },
|
||||||
|
phone: { type: String, required: false },
|
||||||
street: { type: String, required: true },
|
street: { type: String, required: true },
|
||||||
zip: { type: String, required: true },
|
zip: { type: String, required: true },
|
||||||
city: { type: String, required: true },
|
city: { type: String, required: true },
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ export async function createBooking({
|
|||||||
destination,
|
destination,
|
||||||
name,
|
name,
|
||||||
email,
|
email,
|
||||||
|
phone,
|
||||||
street,
|
street,
|
||||||
zip,
|
zip,
|
||||||
city,
|
city,
|
||||||
@@ -80,7 +81,7 @@ export async function createBooking({
|
|||||||
|
|
||||||
let booker = await BookerModel.findOne({ email }).exec()
|
let booker = await BookerModel.findOne({ email }).exec()
|
||||||
if (!booker) {
|
if (!booker) {
|
||||||
booker = new BookerModel({ name, email, street, zip, city })
|
booker = new BookerModel({ name, email, phone, street, zip, city })
|
||||||
await booker.save()
|
await booker.save()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user