Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

order page #10

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 77 additions & 16 deletions src/pages/admin/Order/Order.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,53 @@
import React from "react";
import "./order.css";
import { useState, useEffect } from "react";


import { useState} from "react";
import Axios from "axios";

function Order() {

const [client_DOB, setClient_DOB] = useState("");


const [orderId, setorderId] = useState("");
const [companyName, setcompany_name] = useState("");
const [supplierName, setsuppliername] = useState("");
const [deliveryAddress, setdeliveryAddress] = useState("");
const [referenceNumber, setrefence] = useState("");
const [dates, setdates] = useState("");
const [quantity, setquantity] = useState("");
const [descriptionAgreedPrice, setdescriptionAgreedPrice] = useState("");
const [listOfpackage, setlistOfpackage] = useState([]);


const createorder = () => {
Axios.post("http://localhost/pci-backend/v1/pci/admin/order/create/", {
orderId,
companyName,
supplierName,
deliveryAddress,
referenceNumber,
dates,
quantity,
descriptionAgreedPrice,


}).then((response) => {
setlistOfpackage([
...listOfpackage,
{

orderId,
companyName,
supplierName,
deliveryAddress,
referenceNumber,
dates,
quantity,
descriptionAgreedPrice,
},
]);
});
};

return (
<div>
<div className="main_container">
Expand All @@ -29,9 +68,11 @@ function Order() {
<div className="col">
<input
type="text"

onChange={(event) => {
setcompany_name(event.target.value);
}}
className="form-control"
placeholder="Package Name"
placeholder="Company Name"

/>

Expand All @@ -42,7 +83,10 @@ function Order() {
<div className="col">
<input
type="text"

onChange={(event) => {
setsuppliername(event.target.value);
}}

className="form-control"
placeholder="Supplier Name"

Expand All @@ -55,7 +99,10 @@ function Order() {
<div className="col">
<input
type="text"

onChange={(event) => {
setrefence(event.target.value);
}}

className="form-control"
placeholder="Reffernece Number"

Expand All @@ -68,17 +115,22 @@ function Order() {
<div className="col">
<input
type="text"

className="form-control"
placeholder="Maximum Passengers"
onChange={(event) => {
setquantity(event.target.value);
}}
className="form-control"
placeholder="Quantity"

/>

</div>
<div className="col">
<input
type="text"

onChange={(event) => {
setdescriptionAgreedPrice(event.target.value);
}}

className="form-control"
placeholder="Price"

Expand All @@ -88,11 +140,17 @@ function Order() {
<div className="col">
<input name="dateOfBirth"
className="form-control"
placeholder="Date of Birth"

placeholder="Required date"
type="text"

onFocus={(e) => e.target.type = 'date'} id="dateOfBirth" onChange={(e) => {
setClient_DOB(e.target.value)
setdates(e.target.value)



onFocus={(e) => e.target.type = 'date'} id="dateOfBirth" onChange={(e) => {
setClient_DOB(e.target.value
}}/>

</div>
Expand All @@ -107,7 +165,9 @@ function Order() {
id="exampleFormControlTextarea1"
rows="4"
placeholder="Delivery Address"

onChange={(event) => {
setdeliveryAddress(event.target.value);
}}
></textarea>
</div>
</div>
Expand All @@ -121,7 +181,8 @@ function Order() {
type="submit"
id="reg"
className="btn btnRegister "

onClick={createorder}

>
Add Package
</button>
Expand Down