-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
116 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import React from "react"; | ||
import { Box, Card, CardContent, Typography } from "@mui/material"; | ||
import { CustomTextField } from "../../../components/CustomInputs"; | ||
import { useFormik } from "formik"; | ||
import * as Yup from "yup"; | ||
import { LoadingButton } from "@mui/lab"; | ||
|
||
const AddCompany = () => { | ||
const validationSchema = Yup.object({ | ||
password: Yup.string() | ||
.min(6, "Minimum 6 characters required") | ||
.required("Password is required"), | ||
confirmPassword: Yup.string() | ||
.min(6, "Minimum 6 characters required") | ||
.oneOf([Yup.ref("password"), null], "Passwords must match"), | ||
}); | ||
|
||
const initialValues = { | ||
name: "", | ||
website: "", | ||
number: 0, | ||
}; | ||
const { errors, values, handleChange, handleSubmit, touched } = useFormik({ | ||
initialValues, | ||
validationSchema, | ||
onSubmit: (values) => { | ||
// setIsLoading(true); | ||
}, | ||
}); | ||
|
||
return ( | ||
<> | ||
<Typography component="h1" variant="h3"> | ||
Add Company | ||
</Typography> | ||
<Box sx={{ mt: 3 }}> | ||
<Card> | ||
<CardContent | ||
sx={{ p: 5, display: "flex", gap: 2, flexDirection: "column" }} | ||
> | ||
<CustomTextField | ||
name="name" | ||
label="Name" | ||
placeholder="enter name" | ||
values={values.name} | ||
handleChange={handleChange} | ||
touched={touched} | ||
errors={errors} | ||
/> | ||
<CustomTextField | ||
name="website" | ||
label="Website" | ||
placeholder="enter website" | ||
values={values.website} | ||
handleChange={handleChange} | ||
touched={touched} | ||
errors={errors} | ||
/> | ||
<CustomTextField | ||
name="number" | ||
label="Number" | ||
placeholder="enter number" | ||
values={values.number} | ||
handleChange={handleChange} | ||
touched={touched} | ||
errors={errors} | ||
type="number" | ||
/> | ||
<LoadingButton | ||
onClick={handleSubmit} | ||
variant="contained" | ||
sx={{ mt: 3 }} | ||
> | ||
Add Company | ||
</LoadingButton> | ||
</CardContent> | ||
</Card> | ||
</Box> | ||
</> | ||
); | ||
}; | ||
|
||
export default AddCompany; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
775f8a7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
easy-crm – ./
easy-crm.vercel.app
easy-crm-git-master-shelcia.vercel.app
easy-crm-shelcia.vercel.app