Skip to content

Commit

Permalink
Merge pull request #31 from Neeraj2212/master
Browse files Browse the repository at this point in the history
Backend Book a Service and Service section in Professional
  • Loading branch information
Devanshi-123 authored Nov 9, 2020
2 parents c0456e9 + 3c035c1 commit 8752d93
Show file tree
Hide file tree
Showing 7 changed files with 271 additions and 186 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ class SignUpForCustomer extends Component {
super(props);
this.state = {
name: "",
type_of_work: "",
// type_of_work: "",
contact: "",
email: "",
cost_of_work: "",
experience: "",
location: "",
// cost_of_work: "",
// experience: "",
// location: "",
address: "",
password: "",
confirm_password: "",
Expand Down
209 changes: 104 additions & 105 deletions client/src/components/signup_for_worker/SignupWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,124 +4,123 @@ import { Button, Form, TextArea } from "semantic-ui-react";

// reusable component to render input field whenever needed
const InputForm = ({ label, name, type, placeholder, textArea, ...props }) => (
<Form.Field {...props} width={16}>
{/* <label>{label}</label> */}
{textArea ? (
<TextArea
name={name}
type={type}
placeholder={placeholder}
{...props}
></TextArea>
) : (
<input
name={name}
type={type}
placeholder={placeholder}
{...props}
id="input"
></input>
)}
</Form.Field>
<Form.Field {...props} width={16}>
{/* <label>{label}</label> */}
{textArea ? (
<TextArea
name={name}
type={type}
placeholder={placeholder}
{...props}
></TextArea>
) : (
<input
name={name}
type={type}
placeholder={placeholder}
{...props}
id="input"
></input>
)}
</Form.Field>
);

class SignUpForWorker extends Component {
render() {
return (
<div className="form-div">
<h1 className="form-header">Sign Up (Worker)</h1>
<div className="form-component">
<Form id="form">
<InputForm
name="name"
type="text"
placeholder="Name"
label="Name"
required
/>
render() {
return (
<div className="form-div">
<h1 className="form-header">Sign Up (Worker)</h1>
<div className="form-component">
<Form id="form">
<InputForm
name="name"
type="text"
placeholder="Name"
label="Name"
required
/>

<InputForm
name="work"
type="text"
placeholder="For Example - Plumber, Carpenter, Painter"
label="Type of Work"
required
/>
<InputForm
name="work"
type="text"
placeholder="For Example - Plumber, Carpenter, Painter"
label="Type of Work"
required
/>

<InputForm
name="contact"
type="number"
placeholder="(+91) Contact Number"
id="contact"
label="Contact"
width="8"
required
/>
<InputForm
name="contact"
type="number"
placeholder="(+91) Contact Number"
id="contact"
label="Contact"
width="8"
required
/>

<InputForm
name="email"
type="email"
placeholder="Email"
label="Email"
/>
<InputForm
name="email"
type="email"
placeholder="Email"
label="Email"
/>

<InputForm
name="cost"
type="number"
placeholder="Cost of Work"
label="Cost of Work (INR)"
width="8"
min="0"
step="100"
/>
<InputForm
name="cost"
type="number"
placeholder="Cost of Work"
label="Cost of Work (INR)"
width="8"
min="0"
/>

<InputForm
name="experience"
type="text"
placeholder="For Example- Experience of 4 years in Carpentry "
label="Experience"
/>
<InputForm
name="experience"
type="text"
placeholder="For Example- Experience of 4 years in Carpentry "
label="Experience"
/>

<InputForm
name="location"
type="text"
placeholder="Location"
label="Location"
width="8"
required
/>
<InputForm
name="location"
type="text"
placeholder="Location"
label="Location"
width="8"
required
/>

<InputForm
name="address"
type="text"
placeholder="Address"
label="Address"
/>
<InputForm
name="address"
type="text"
placeholder="Address"
label="Address"
/>

<InputForm
name="password"
type="password"
placeholder="Password"
label="Password"
required
/>
<InputForm
name="password"
type="password"
placeholder="Password"
label="Password"
required
/>

<InputForm
name="confirm-password"
type="password"
placeholder="Confirm Password"
label=" Confirm Password"
required
/>
<InputForm
name="confirm-password"
type="password"
placeholder="Confirm Password"
label=" Confirm Password"
required
/>

<Button type="submit" secondary id="button">
Sign Up
</Button>
</Form>
</div>
</div>
);
}
<Button type="submit" secondary id="button">
Sign Up
</Button>
</Form>
</div>
</div>
);
}
}

export default SignUpForWorker;
6 changes: 4 additions & 2 deletions server/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const workerRouter = require("./routers/signup_workers");
const routes = require("./routers/api");
const bodyParser = require("body-parser");
const mongoose = require("mongoose");
const book_service = require("./routers/book-services");
require("./db/mongoose");
require("dotenv").config();

Expand All @@ -12,13 +13,14 @@ require("dotenv").config();
app.use(bodyParser.json());
app.use(routes);
app.use(workerRouter);
app.use(book_service);

const port = process.env.PORT || 5000;

app.get("/", (req, res) => {
res.send("Hello world");
res.send("Hello world");
});

app.listen(port, () => {
console.log("Server is up on the port " + port);
console.log("Server is up on the port " + port);
});
13 changes: 7 additions & 6 deletions server/src/db/mongoose.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ const mongoose = require("mongoose");
require("dotenv").config();

mongoose
.connect(process.env.MainDB, {
useNewUrlParser: true,
useUnifiedTopology: true,
})
.then(() => console.log(`Main Database connected successfully`))
.catch((err) => console.log(err));
.connect(process.env.MainDB, {
useNewUrlParser: true,
useUnifiedTopology: true,
useCreateIndex: true,
})
.then(() => console.log(`Main Database connected successfully`))
.catch((err) => console.log(err));
Loading

0 comments on commit 8752d93

Please sign in to comment.