show order

This commit is contained in:
pawan-dot 2023-11-29 16:02:06 +05:30
parent c0862b0b1e
commit 4ca7f525d6
4 changed files with 1311 additions and 1330 deletions

View File

@ -13,7 +13,7 @@
"license": "MIT",
"author": "The CoreUI Team (https://github.com/orgs/coreui/people)",
"scripts": {
"dev": "react-scripts --openssl-legacy-provider start",
"dev": "react-scripts start",
"build": "react-scripts build",
"build:n17": "react-scripts --openssl-legacy-provider build",
"changelog": "auto-changelog --starting-version 4.1.0 --commit-limit false --hide-credit",

File diff suppressed because it is too large Load Diff

View File

@ -1,84 +1,91 @@
import React, { useState, useEffect } from 'react'
import { Link } from 'react-router-dom'
import axios from 'axios'
import React, { useState, useEffect } from "react";
import { Link } from "react-router-dom";
import axios from "axios";
import { isAutheticated } from 'src/auth'
import Button from '@material-ui/core/Button'
import { isAutheticated } from "src/auth";
import Button from "@material-ui/core/Button";
function NewOrders() {
const token = isAutheticated()
const [loading, setLoading] = useState(true)
const [success, setSuccess] = useState(true)
const [newOrdersData, setNewOrdersData] = useState([])
const token = isAutheticated();
const [loading, setLoading] = useState(true);
const [success, setSuccess] = useState(true);
const [newOrdersData, setNewOrdersData] = useState([]);
const [currentPage, setCurrentPage] = useState(1)
const [itemPerPage, setItemPerPage] = useState(10)
const [showData, setShowData] = useState(newOrdersData)
const [currentPage, setCurrentPage] = useState(1);
const [itemPerPage, setItemPerPage] = useState(10);
const [showData, setShowData] = useState(newOrdersData);
const handleShowEntries = (e) => {
setCurrentPage(1)
setItemPerPage(e.target.value)
}
setCurrentPage(1);
setItemPerPage(e.target.value);
};
useEffect(() => {
function getNewOrder() {
axios
.get(`/api/order/getAll`, {
headers: { 'Access-Control-Allow-Origin': '*', Authorization: `Bearer ${token}` },
.get(`/api/order/getAll/:new`, {
headers: {
"Access-Control-Allow-Origin": "*",
Authorization: `Bearer ${token}`,
},
})
.then((res) => {
setNewOrdersData(res.data.order)
// console.log(res.data.order)
setLoading(false)
setNewOrdersData(res.data.order);
console.log(res.data);
setLoading(false);
})
.catch((err) => {
console.log(err)
setLoading(false)
})
console.log(err);
setLoading(false);
});
}
getNewOrder()
}, [success])
getNewOrder();
}, [success]);
useEffect(() => {
const loadData = () => {
const indexOfLastPost = currentPage * itemPerPage
const indexOfFirstPost = indexOfLastPost - itemPerPage
setShowData(newOrdersData.slice(indexOfFirstPost, indexOfLastPost))
}
loadData()
}, [currentPage, itemPerPage, newOrdersData])
const indexOfLastPost = currentPage * itemPerPage;
const indexOfFirstPost = indexOfLastPost - itemPerPage;
setShowData(newOrdersData.slice(indexOfFirstPost, indexOfLastPost));
};
loadData();
}, [currentPage, itemPerPage, newOrdersData]);
const handleDelete = (id) => {
console.log(id)
console.log(id);
swal({
title: 'Are you sure?',
icon: 'error',
buttons: { Yes: { text: 'Yes', value: true }, Cancel: { text: 'Cancel', value: 'cancel' } },
title: "Are you sure?",
icon: "error",
buttons: {
Yes: { text: "Yes", value: true },
Cancel: { text: "Cancel", value: "cancel" },
},
}).then((value) => {
if (value === true) {
axios
.delete(`/api/order/delete/${id}`, {
headers: {
'Access-Control-Allow-Origin': '*',
"Access-Control-Allow-Origin": "*",
Authorization: `Bearer ${token}`,
},
})
.then((res) => {
setSuccess((prev) => !prev)
setSuccess((prev) => !prev);
})
.catch((err) => {
swal({
title: 'Warning',
text: err.response.data.message ? err.response.data.message : 'Something went wrong!',
icon: 'error',
button: 'Retry',
title: "Warning",
text: err.response.data.message
? err.response.data.message
: "Something went wrong!",
icon: "error",
button: "Retry",
dangerMode: true,
})
})
}
})
});
});
}
});
};
return (
<div className="main-content">
@ -94,26 +101,25 @@ function NewOrders() {
justify-content-between
"
>
<div style={{ fontSize: '22px' }} className="fw-bold">
<div style={{ fontSize: "22px" }} className="fw-bold">
New Orders
</div>
<div className="page-title-right">
{/* <div className="page-title-right">
<Link to="/order/add">
<Button
variant="contained"
color="primary"
style={{
fontWeight: 'bold',
marginBottom: '1rem',
textTransform: 'capitalize',
fontWeight: "bold",
marginBottom: "1rem",
textTransform: "capitalize",
}}
>
Add Order
</Button>
</Link>
</div>
</div> */}
</div>
</div>
</div>
@ -127,7 +133,7 @@ function NewOrders() {
<label className="w-100">
Show
<select
style={{ width: '10%' }}
style={{ width: "10%" }}
name=""
onChange={(e) => handleShowEntries(e)}
className="
@ -150,13 +156,15 @@ function NewOrders() {
<div className="table-responsive table-shoot mt-3">
<table
className="table table-centered table-nowrap"
style={{ border: '1px solid' }}
style={{ border: "1px solid" }}
>
<thead
className="thead"
style={{ background: "rgb(140, 213, 213)" }}
>
<thead className="thead" style={{ background: 'rgb(140, 213, 213)' }}>
<tr>
<th className="text-start">Order ID</th>
<th className="text-start">Franchisee</th>
<th className="text-start">Customer</th>
<th className="text-start">Order value</th>
<th className="text-start">Order At</th>
<th className="text-start">Status</th>
@ -181,18 +189,25 @@ function NewOrders() {
showData.map((order, i) => {
return (
<tr key={i}>
<td className="text-start">{order?.order_id}</td>
<td className="text-start">{order?.shippingInfo?.name}</td>
<td className="text-start">{order?.total_amount}</td>
<td className="text-start">{order?.orderID}</td>
<td className="text-start">
{new Date(order?.createdAt).toLocaleString('en-IN', {
month: 'short',
day: 'numeric',
year: 'numeric',
hour: '2-digit',
minute: 'numeric',
{order?.user?.name}
</td>
<td className="text-start">
${order?.total_amount}
</td>
<td className="text-start">
{new Date(order?.paidAt).toLocaleString(
"en-IN",
{
month: "short",
day: "numeric",
year: "numeric",
hour: "2-digit",
minute: "numeric",
hour12: true,
})}
}
)}
</td>
<td className="text-start">
<span className="badge text-bg-success text-white">
@ -200,12 +215,10 @@ function NewOrders() {
</span>
</td>
<td className="text-start">
{/* <Link to={`/orders/${order.orderStatus}/${order._id}`}> */}
<Link to={`/orders/view/${order._id}`}>
<button
style={{ color: 'white' }}
style={{ color: "white" }}
type="button"
className="
btn btn-primary btn-sm
@ -219,7 +232,7 @@ function NewOrders() {
</Link>
<Link to={`/orders/edit/${order._id}`}>
<button
style={{ color: 'white' }}
style={{ color: "white" }}
type="button"
className="
btn btn-info btn-sm
@ -233,7 +246,7 @@ function NewOrders() {
</Link>
<button
style={{ color: 'white' }}
style={{ color: "white" }}
type="button"
className="
btn btn-danger btn-sm
@ -245,10 +258,9 @@ function NewOrders() {
>
Delete
</button>
</td>
</tr>
)
);
})
)}
</tbody>
@ -263,9 +275,12 @@ function NewOrders() {
role="status"
aria-live="polite"
>
Showing {currentPage * itemPerPage - itemPerPage + 1} to{' '}
{Math.min(currentPage * itemPerPage, newOrdersData.length)} of{' '}
{newOrdersData.length} entries
Showing {currentPage * itemPerPage - itemPerPage + 1} to{" "}
{Math.min(
currentPage * itemPerPage,
newOrdersData.length
)}{" "}
of {newOrdersData.length} entries
</div>
</div>
@ -275,13 +290,13 @@ function NewOrders() {
<li
className={
currentPage === 1
? 'paginate_button page-item previous disabled'
: 'paginate_button page-item previous'
? "paginate_button page-item previous disabled"
: "paginate_button page-item previous"
}
>
<span
className="page-link"
style={{ cursor: 'pointer' }}
style={{ cursor: "pointer" }}
onClick={() => setCurrentPage((prev) => prev - 1)}
>
Previous
@ -292,8 +307,10 @@ function NewOrders() {
<li className="paginate_button page-item">
<span
className="page-link"
style={{ cursor: 'pointer' }}
onClick={(e) => setCurrentPage((prev) => prev - 1)}
style={{ cursor: "pointer" }}
onClick={(e) =>
setCurrentPage((prev) => prev - 1)
}
>
{currentPage - 1}
</span>
@ -301,7 +318,10 @@ function NewOrders() {
)}
<li className="paginate_button page-item active">
<span className="page-link" style={{ cursor: 'pointer' }}>
<span
className="page-link"
style={{ cursor: "pointer" }}
>
{currentPage}
</span>
</li>
@ -313,9 +333,9 @@ function NewOrders() {
<li className="paginate_button page-item ">
<span
className="page-link"
style={{ cursor: 'pointer' }}
style={{ cursor: "pointer" }}
onClick={() => {
setCurrentPage((prev) => prev + 1)
setCurrentPage((prev) => prev + 1);
}}
>
{currentPage + 1}
@ -329,13 +349,13 @@ function NewOrders() {
(currentPage + 1) * itemPerPage - itemPerPage >
newOrdersData.length - 1
)
? 'paginate_button page-item next'
: 'paginate_button page-item next disabled'
? "paginate_button page-item next"
: "paginate_button page-item next disabled"
}
>
<span
className="page-link"
style={{ cursor: 'pointer' }}
style={{ cursor: "pointer" }}
onClick={() => setCurrentPage((prev) => prev + 1)}
>
Next
@ -352,7 +372,7 @@ function NewOrders() {
</div>
</div>
</div>
)
);
}
export default NewOrders
export default NewOrders;

View File

@ -1,46 +1,36 @@
import React, { useState, useEffect, useRef } from 'react'
import axios from 'axios'
import { Link, useNavigate, useParams } from 'react-router-dom'
import QRCode from 'react-qr-code'
import { isAutheticated } from 'src/auth'
import { useDispatch, useSelector } from 'react-redux'
import { addItemsToCart } from 'src/redux/Actions/cartAction'
import toast from 'react-hot-toast'
import { cibBlackberry } from '@coreui/icons'
import Button from '@material-ui/core/Button'
import React, { useState, useEffect, useRef } from "react";
import axios from "axios";
import { Link, useNavigate, useParams } from "react-router-dom";
import QRCode from "react-qr-code";
import { isAutheticated } from "src/auth";
import { useDispatch, useSelector } from "react-redux";
import { addItemsToCart } from "src/redux/Actions/cartAction";
import toast from "react-hot-toast";
import { cibBlackberry } from "@coreui/icons";
import Button from "@material-ui/core/Button";
function ViewOrders() {
const { status, id } = useParams()
const { status, id } = useParams();
const { cartItems, subTotal, shippingCharge, tax, shipingInfo, total } = useSelector(
(state) => state.cart
);
const { cartItems, subTotal, shippingCharge, tax, shipingInfo, total } =
useSelector((state) => state.cart);
const AllStates = useSelector(
(state) => state
);
const getValue = useRef()
const getFranchiseeID = useRef()
const AllStates = useSelector((state) => state);
const getValue = useRef();
const getFranchiseeID = useRef();
const dispatch = useDispatch();
const navigate = useNavigate()
const printOrderRef = useRef()
const token = isAutheticated()
const [productData, setProductData] = useState([])
const [allFranchisee, setAllFranchisee] = useState([])
const [allTax, setAllTax] = useState([])
const [orderDetails, setOrderDetails] = useState()
const navigate = useNavigate();
const printOrderRef = useRef();
const token = isAutheticated();
const [productData, setProductData] = useState([]);
const [allFranchisee, setAllFranchisee] = useState([]);
const [allTax, setAllTax] = useState([]);
const [orderDetails, setOrderDetails] = useState();
const [productDetails, setProductDetails] = useState()
const [loading, setLoading] = useState(true)
const [orderId, setOrderId] = useState(null)
const [orderStatus, setOrderStatus] = useState('')
const [productDetails, setProductDetails] = useState();
const [loading, setLoading] = useState(true);
const [orderId, setOrderId] = useState(null);
const [orderStatus, setOrderStatus] = useState("");
// const [data, setData] = useState({
// product_Name: '',
// address: '',
@ -50,20 +40,22 @@ function ViewOrders() {
// })
useEffect(() => {
const getSingleOrder = async () => {
setLoading(true)
setLoading(true);
const res = await axios.get(`/api/order/getOne/${id}`, {
headers: { 'Access-Control-Allow-Origin': '*', Authorization: `Bearer ${token}` },
})
headers: {
"Access-Control-Allow-Origin": "*",
Authorization: `Bearer ${token}`,
},
});
if (res.data) {
setLoading(false)
setOrderId(res.data?.order?.order_id)
setOrderDetails(res.data?.order)
console.log(res.data?.order.shippingInfo?.city)
setLoading(false);
setOrderId(res.data?.order?.order_id);
setOrderDetails(res.data?.order);
console.log(res.data?.order);
// let options = {
// Franchisee: res.data?.order?.shippingInfo?.Franchisee?._id,
// name: res.data?.order?.shippingInfo?.name,
// contact_Number: res.data?.order?.shippingInfo?.contact_Number,
// contact_Person_Name: res.data?.order?.shippingInfo?.contact_Person_Name,
// address: res.data?.order?.shippingInfo?.address,
@ -81,43 +73,33 @@ function ViewOrders() {
// })
// }
}
}
getSingleOrder()
}, [token])
};
getSingleOrder();
}, [token]);
const handleChange = (e) => {
if (e.target.type === 'text') {
setData((prev) => ({ ...prev, [e.target.id]: e.target.value }))
if (e.target.type === "text") {
setData((prev) => ({ ...prev, [e.target.id]: e.target.value }));
} else {
setOrderStatus(e.target.value)
}
setOrderStatus(e.target.value);
}
};
const handleQuantityChange = (e) => {
setData((prev) => ({
...prev,
quantity: e.target.value,
total_Price: (productDetails?.base_Price * e.target.value)
}))
}
total_Price: productDetails?.base_Price * e.target.value,
}));
};
function getBack() {
navigate(`/orders/${status}`, { replace: true })
navigate(`/orders/${status}`, { replace: true });
}
return (
<>
{' '}
{" "}
<div className="main-content">
<div className="page-content">
<div className="container-fluid">
@ -131,11 +113,13 @@ function ViewOrders() {
justify-content-between
"
>
<div style={{ fontSize: '22px' }} className="fw-bold">
<div style={{ fontSize: "22px" }} className="fw-bold">
<p> View Order</p>
{orderId && <span><small>Order ID : {orderId}</small> </span>}
{orderId && (
<span>
<small>Order ID : {orderId}</small>{" "}
</span>
)}
</div>
<div className="page-title-right">
{/* <Button
@ -157,18 +141,16 @@ function ViewOrders() {
variant="contained"
color="secondary"
style={{
fontWeight: 'bold',
marginBottom: '1rem',
textTransform: 'capitalize',
fontWeight: "bold",
marginBottom: "1rem",
textTransform: "capitalize",
}}
>
Back
</Button>
</Link>
</div>
</div>
</div>
</div>
{loading ? (
@ -178,117 +160,10 @@ function ViewOrders() {
</div>
</div>
) : (
<div className="row">
<div className="col-lg-6 mt-3">
<div className="col-lg-7 mt-3">
{orderDetails?.shipingInfo !== null && (
<div className="card">
<div className="card-body">
<div className="mt-1">
<h5 className='text-success'>Order Status: {orderDetails?.orderStatus}</h5>
<label className="fw-bold">Franchisee :</label>
{/* <div className="d-flex">
<select
className="form-control me-2"
onChange={handleChange}
value={orderStatus}
ref={getFranchiseeID}
disabled={shipingInfo !== null}
>
<option value="" disabled></option>
{allFranchisee && allFranchisee.map((item, index) =>
<option key={index} value={item?._id}>{item?.name}</option>
)}
</select>
<button className='btn-sm btn-primary' onClick={(e) => handleGetSingleFrenchisee(e)} >Add</button>
</div> */}
</div>
{
orderDetails?.shipingInfo !== null &&
<div className="my-2">
<div className="row" style={{ fontSize: '14px' }}>
<div className="col-sm-4">
<img
src={orderDetails?.shippingInfo?.Franchisee?.banner?.url}
alt={orderDetails?.shippingInfo?.name}
// width='100%'
style={{
width: '100%',
objectFit: 'contain',
maxHeight: '100px',
}}
/>
</div>
<div className="col-sm-8">
<h6 className="m-0 ms-2">{orderDetails?.shippingInfo?.name}</h6>
<parent className="m-0 ms-2 mt-3">
Address. : {orderDetails?.shippingInfo?.address}
</parent>
<p className="m-0 ms-2 mt-1">
Contact No. : {orderDetails?.shippingInfo?.contact_Number}
</p>
<p className="m-0 ms-2 mt-1">
Contact Person Name : {orderDetails?.shippingInfo?.contact_Person_Name}
</p>
<p className="m-0 ms-2 mt-1">
Price Lable : {orderDetails?.shippingInfo?.Franchisee?.price_Lable}
</p>
<p className="m-0 ms-2 mt-1">
City : {orderDetails?.shippingInfo?.city}
</p>
<p className="m-0 ms-2 mt-1">
State : {orderDetails?.shippingInfo?.state}
</p>
</div>
</div>
<hr />
</div>
}
<div className="mt-3">
<label>
<span className="fw-bold">Payment Status : </span>
{orderDetails?.isPaid === false ? 'Not Paid' : 'Paid'}
</label>
</div>
<div className="mt-1">
<label>
<span className="fw-bold"> Order Created By: </span>
{orderDetails?.user?.name}
</label>
</div>
<div className="mt-1">
<label>
<span className="fw-bold">Razorpay Order ID : </span>
{productData?.razorpay_order_id}
</label>
</div>
<div className="mt-1">
<label>
<span className="fw-bold">Razorpay Payment ID : </span>
{productData?.razorpay_payment_id}
</label>
</div>
</div>
</div>
</div>
<div className="col-lg-6 mt-3">
{orderDetails?.shipingInfo !== null && <div className="card">
<div className="card-body">
{/* <div className="mt-1">
<label className="fw-bold">Select Product:</label>
@ -313,80 +188,82 @@ function ViewOrders() {
</div> */}
<div className="mt-2">
<h6 className="fw-bold">Products : {orderDetails?.orderItems?.length}</h6>
<h6 className="fw-bold">
Products : {orderDetails?.orderItems?.length}
</h6>
<hr />
{
orderDetails?.orderItems && orderDetails?.orderItems.map((productDetails, i) =>
{orderDetails?.orderItems &&
orderDetails?.orderItems.map(
(productDetails, i) => (
<div className="my-2">
<div className="row" style={{ fontSize: '14px' }}>
<div
className="row"
style={{ fontSize: "14px" }}
>
<div className="col-sm-4">
<img
src={productDetails?.image}
src={productDetails?.image[0]?.url}
alt={productDetails?.name}
style={{
width: '100%',
objectFit: 'contain',
maxHeight: '150px',
width: "100%",
objectFit: "contain",
maxHeight: "150px",
}}
/>
</div>
<div className="col-sm-8">
<h6 className="m-0 ms-2">{productDetails?.name}</h6>
<h6 className="m-0 ms-2">
{productDetails?.name}
</h6>
<div className="row">
<div className="col-sm-6">
<div
className='d-flex justify-content-center mt-3 me-3 '
className="d-flex justify-content-center mt-3 me-3 "
style={{
width: "6rem",
}}>
<span className='px-2 mt-1' style={{}}> Quantity: {productDetails?.quantity}</span>
}}
>
<span
className="px-2 mt-1"
style={{}}
>
{" "}
Quantity:{" "}
{productDetails?.quantity}
</span>
</div>
<p className="m-0 mt-3 ms-3">
<stong>Price With Tax:</stong> {productDetails?.price_With_Tax}
<stong> Total Price:</stong> $
{productDetails?.quantity *
productDetails?.price}
</p>
</div>
<div className="col-sm-6">
<p className="m-0 mt-3">
<stong> Price:</stong> {productDetails?.price}
<stong> Price:</stong> $
{productDetails?.price}
</p>
</div>
</div>
</div>
</div>
<hr />
</div>
)
}
<h5 className="m-0 contents-center mt-3">
<small className='mb-2'>Shipping Charge: </small> {orderDetails?.shipping_charge}
)}
<div className="m-0 contents-center mt-3 mb-2">
<small className="mb-4">Shipping Charge: </small> $
{orderDetails?.shipping_charge}
<br />
<span className='mt-2'> Total Order Value: </span> {orderDetails?.total_amount}
</h5>
<span className="mt-2"> Total Order Value: </span> $
{orderDetails?.total_amount}
</div>
</div>
</div>
}
</div>
)}
<div className="card my-1">
<div className="card-body">
@ -394,9 +271,9 @@ function ViewOrders() {
<table
className="table table-info table-sm m-0"
style={{
borderRadius: '8px',
borderCollapse: 'collapse',
overflow: 'hidden',
borderRadius: "8px",
borderCollapse: "collapse",
overflow: "hidden",
}}
>
<tbody>
@ -405,20 +282,24 @@ function ViewOrders() {
<td> : </td>
<td>
{orderDetails?.createdAt
? new Date(orderDetails?.createdAt).toLocaleString('en-IN', {
month: 'short',
day: 'numeric',
year: 'numeric',
hour: '2-digit',
minute: 'numeric',
? new Date(
orderDetails?.createdAt
).toLocaleString("en-IN", {
month: "short",
day: "numeric",
year: "numeric",
hour: "2-digit",
minute: "numeric",
hour12: true,
})
: new Date(productData?.placed_on).toLocaleString('en-IN', {
month: 'short',
day: 'numeric',
year: 'numeric',
hour: '2-digit',
minute: 'numeric',
: new Date(
productData?.placed_on
).toLocaleString("en-IN", {
month: "short",
day: "numeric",
year: "numeric",
hour: "2-digit",
minute: "numeric",
hour12: true,
})}
</td>
@ -428,18 +309,17 @@ function ViewOrders() {
<td> : </td>
<td>
{productData?.status_timeline?.processing
? new Date(productData?.status_timeline?.processing).toLocaleString(
'en-IN',
{
month: 'short',
day: 'numeric',
year: 'numeric',
hour: '2-digit',
minute: 'numeric',
? new Date(
productData?.status_timeline?.processing
).toLocaleString("en-IN", {
month: "short",
day: "numeric",
year: "numeric",
hour: "2-digit",
minute: "numeric",
hour12: true,
},
)
: '-'}
})
: "-"}
</td>
</tr>
<tr className="text-center">
@ -447,18 +327,17 @@ function ViewOrders() {
<td> : </td>
<td>
{productData?.status_timeline?.dispatched
? new Date(productData?.status_timeline?.dispatched).toLocaleString(
'en-IN',
{
month: 'short',
day: 'numeric',
year: 'numeric',
hour: '2-digit',
minute: 'numeric',
? new Date(
productData?.status_timeline?.dispatched
).toLocaleString("en-IN", {
month: "short",
day: "numeric",
year: "numeric",
hour: "2-digit",
minute: "numeric",
hour12: true,
},
)
: '-'}
})
: "-"}
</td>
</tr>
<tr className="text-center">
@ -466,18 +345,17 @@ function ViewOrders() {
<td> : </td>
<td>
{productData?.status_timeline?.delivered
? new Date(productData?.status_timeline?.delivered).toLocaleString(
'en-IN',
{
month: 'short',
day: 'numeric',
year: 'numeric',
hour: '2-digit',
minute: 'numeric',
? new Date(
productData?.status_timeline?.delivered
).toLocaleString("en-IN", {
month: "short",
day: "numeric",
year: "numeric",
hour: "2-digit",
minute: "numeric",
hour12: true,
},
)
: '-'}
})
: "-"}
</td>
</tr>
<tr className="text-center">
@ -485,18 +363,17 @@ function ViewOrders() {
<td> : </td>
<td>
{productData?.status_timeline?.cancelled
? new Date(productData?.status_timeline?.cancelled).toLocaleString(
'en-IN',
{
month: 'short',
day: 'numeric',
year: 'numeric',
hour: '2-digit',
minute: 'numeric',
? new Date(
productData?.status_timeline?.cancelled
).toLocaleString("en-IN", {
month: "short",
day: "numeric",
year: "numeric",
hour: "2-digit",
minute: "numeric",
hour12: true,
},
)
: '-'}
})
: "-"}
</td>
</tr>
<tr className="text-center">
@ -504,40 +381,143 @@ function ViewOrders() {
<td> : </td>
<td>
{productData?.status_timeline?.returned
? new Date(productData?.status_timeline?.returned).toLocaleString(
'en-IN',
{
month: 'short',
day: 'numeric',
year: 'numeric',
hour: '2-digit',
minute: 'numeric',
? new Date(
productData?.status_timeline?.returned
).toLocaleString("en-IN", {
month: "short",
day: "numeric",
year: "numeric",
hour: "2-digit",
minute: "numeric",
hour12: true,
},
)
: '-'}
})
: "-"}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>)}
<div className="col-lg-5 mt-3">
<div className="card">
<div className="card-body">
<div className="mt-1">
<h5 className="text-success">
Order Status: {orderDetails?.orderStatus}
</h5>
<label className="fw-bold mt-1">Shipping Info :</label>
{/* <div className="d-flex">
<select
className="form-control me-2"
onChange={handleChange}
value={orderStatus}
ref={getFranchiseeID}
disabled={shipingInfo !== null}
>
<option value="" disabled></option>
{allFranchisee && allFranchisee.map((item, index) =>
<option key={index} value={item?._id}>{item?.name}</option>
)}
</select>
<button className='btn-sm btn-primary' onClick={(e) => handleGetSingleFrenchisee(e)} >Add</button>
</div> */}
</div>
{orderDetails?.shipingInfo !== null && (
<div className="">
<div className="row" style={{ fontSize: "14px" }}>
{/* <div className="col-sm-4">
<img
src={
orderDetails?.shippingInfo?.Franchisee?.banner
?.url
}
alt={orderDetails?.shippingInfo?.name}
// width='100%'
style={{
width: "100%",
objectFit: "contain",
maxHeight: "100px",
}}
/>
</div> */}
<div className="col-sm-12">
<h6 className="m-0 ms-2">
Name: {orderDetails?.shippingInfo?.first_Name}{" "}
{orderDetails?.shippingInfo?.last_Name}
</h6>
<p className="m-0 ms-2 mt-1">
Contact No. :{" "}
{orderDetails?.shippingInfo?.phone_Number}
</p>
<parent className="m-0 ms-2 mt-3">
street. : {orderDetails?.shippingInfo?.street}
</parent>
<p className="m-0 ms-2 mt-1">
City : {orderDetails?.shippingInfo?.city}
</p>
<p className="m-0 ms-2 mt-1">
State : {orderDetails?.shippingInfo?.state}
</p>
<p className="m-0 ms-2 mt-1">
country : {orderDetails?.shippingInfo?.country}
</p>
<p className="m-0 ms-2 mt-1">
Postal Code. :{" "}
{orderDetails?.shippingInfo?.postalCode}
</p>
</div>
</div>
<hr />
</div>
)}
<div className="mt-3">
<label>
<span className="fw-bold">Payment Status : </span>
{orderDetails?.isPaid === false ? (
<span className="fw-bold text-danger">
Not Paid
</span>
) : (
<span className="fw-bold text-success">Paid</span>
)}
</label>
</div>
<div className="mt-1">
<label>
<span className="fw-bold"> Order Created By: </span>
{orderDetails?.user?.name}
</label>
</div>
<div className="mt-1">
<label>
<span className="fw-bold">paypal_payment_id : </span>
{orderDetails?.paypal_payment_id}
</label>
</div>
<div className="mt-1">
<label>
<span className="fw-bold">paypal_payer_id : </span>
{orderDetails?.paypal_payer_id}
</label>
</div>
</div>
</div>
<div style={{ display: 'none' }}>
</div>
</div>
)}
</div>
</div>
</div>
<div style={{ display: "none" }}>
{/* <PrintOrderDetails productData={productData} ref={printOrderRef} /> */}
</div>
</>
)
);
}
export default ViewOrders
export default ViewOrders;