- {temple.name} |
+ {franchisee.name} |
-
+
|
- {temple?.city?.city_name} |
+ {franchisee?.city?.city_name} |
- {new Date(temple.createdAt).toLocaleString('en-IN', {
+ {new Date(franchisee.createdAt).toLocaleString('en-IN', {
month: '2-digit',
day: 'numeric',
year: 'numeric',
@@ -195,9 +195,9 @@ const Temples = () => {
})}
|
-
+
-
+
-
+
|
-
+
+ {/* */}
+
+
state.cart
+ );
+
+
+ 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 [productDetails, setProductDetails] = useState()
+ const [loading, setLoading] = useState(true)
+ const [orderId, setOrderId] = useState(null)
+ const [orderStatus, setOrderStatus] = useState('')
+ // const [data, setData] = useState({
+ // product_Name: '',
+ // address: '',
+ // quantity: '',
+ // contact_Number: '',
+ // total_Price: '',
+ // })
+ useEffect(() => {
+ const getSingleOrder = async () => {
+ setLoading(true)
+ const res = await axios.get(`/api/order/getOne/${id}`, {
+ 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)
+ // 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,
+ // city: res.data?.order?.shippingInfo?.city,
+ // price_Lable: res.data?.order?.shippingInfo?.Franchisee?.price_Lable,
+ // state: res.data?.order?.shippingInfo?.state,
+ // banner: res.data?.order?.shippingInfo?.Franchisee?.banner?.url,
+ // // Franchisee_Url: res?.data?.data?.url
+ // }
+ // dispatch({ type: "addShippingInfo", payload: options });
+ // if (res.data?.order?.orderItems) {
+ // res.data?.order?.orderItems.map((i, ind) => {
+ // dispatch({ type: "addToCart", payload: i });
+ // dispatch({ type: "calculatePrice" });
+
+ // })
+ // }
+
+ }
+ }
+ getSingleOrder()
+
+ }, [token])
+
+
+
+ const handleChange = (e) => {
+ if (e.target.type === 'text') {
+ setData((prev) => ({ ...prev, [e.target.id]: e.target.value }))
+ } else {
+ setOrderStatus(e.target.value)
+ }
+ }
+ const handleQuantityChange = (e) => {
+
+ setData((prev) => ({
+ ...prev,
+ quantity: e.target.value,
+ total_Price: (productDetails?.base_Price * e.target.value)
+ }))
+
+ }
+
+
+
+
+
+ function getBack() {
+ navigate(`/orders/${status}`, { replace: true })
+ }
+
+ return (
+ <>
+ {' '}
+
+
+
+
+
+
+
+
+ View Order
+ {orderId && Order ID : {orderId} }
+
+
+
+ {/* handleSubmit()}
+ disabled={loading}
+ >
+ {loading ? 'Loading' : 'Edit Now'}
+ */}
+
+
+ Back
+
+
+
+
+
+
+
+
+ {loading ? (
+
+ ) : (
+
+
+
+
+
+
+ Order Status: {orderDetails?.orderStatus}
+
+ {/*
+
+ handleGetSingleFrenchisee(e)} >Add
+ */}
+
+
+
+
+
+ {
+ orderDetails?.shipingInfo !== null &&
+
+
+
+ 
+
+
+ {orderDetails?.shippingInfo?.name}
+
+ Address. : {orderDetails?.shippingInfo?.address}
+
+
+ Contact No. : {orderDetails?.shippingInfo?.contact_Number}
+
+
+ Contact Person Name : {orderDetails?.shippingInfo?.contact_Person_Name}
+
+
+ Price Lable : {orderDetails?.shippingInfo?.Franchisee?.price_Lable}
+
+
+
+ City : {orderDetails?.shippingInfo?.city}
+
+
+ State : {orderDetails?.shippingInfo?.state}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {orderDetails?.shipingInfo !== null &&
+
+ {/*
+
+
+
+ handleGetSingleProduct(e)}>Add
+
+
+
+ */}
+
+
+ Products : {orderDetails?.orderItems?.length}
+
+ {
+ orderDetails?.orderItems && orderDetails?.orderItems.map((productDetails, i) =>
+
+
+
+ 
+
+
+ {productDetails?.name}
+
+
+
+
+
+ Quantity: {productDetails?.quantity}
+
+
+
+
+ Price With Tax: ₹{productDetails?.price_With_Tax}
+
+
+
+
+ Price: ₹{productDetails?.price}
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+ }
+
+
+ Shipping Charge: ₹{orderDetails?.shipping_charge}
+
+
+ Total Order Value: ₹{orderDetails?.total_amount}
+
+
+
+
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Order Placed On |
+ : |
+
+ {orderDetails?.createdAt
+ ? 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',
+ hour12: true,
+ })}
+ |
+
+
+ Processing Started |
+ : |
+
+ {productData?.status_timeline?.processing
+ ? new Date(productData?.status_timeline?.processing).toLocaleString(
+ 'en-IN',
+ {
+ month: 'short',
+ day: 'numeric',
+ year: 'numeric',
+ hour: '2-digit',
+ minute: 'numeric',
+ hour12: true,
+ },
+ )
+ : '-'}
+ |
+
+
+ Dispatched On |
+ : |
+
+ {productData?.status_timeline?.dispatched
+ ? new Date(productData?.status_timeline?.dispatched).toLocaleString(
+ 'en-IN',
+ {
+ month: 'short',
+ day: 'numeric',
+ year: 'numeric',
+ hour: '2-digit',
+ minute: 'numeric',
+ hour12: true,
+ },
+ )
+ : '-'}
+ |
+
+
+ Delivered On |
+ : |
+
+ {productData?.status_timeline?.delivered
+ ? new Date(productData?.status_timeline?.delivered).toLocaleString(
+ 'en-IN',
+ {
+ month: 'short',
+ day: 'numeric',
+ year: 'numeric',
+ hour: '2-digit',
+ minute: 'numeric',
+ hour12: true,
+ },
+ )
+ : '-'}
+ |
+
+
+ Cancelled On |
+ : |
+
+ {productData?.status_timeline?.cancelled
+ ? new Date(productData?.status_timeline?.cancelled).toLocaleString(
+ 'en-IN',
+ {
+ month: 'short',
+ day: 'numeric',
+ year: 'numeric',
+ hour: '2-digit',
+ minute: 'numeric',
+ hour12: true,
+ },
+ )
+ : '-'}
+ |
+
+
+ Returned On |
+ : |
+
+ {productData?.status_timeline?.returned
+ ? new Date(productData?.status_timeline?.returned).toLocaleString(
+ 'en-IN',
+ {
+ month: 'short',
+ day: 'numeric',
+ year: 'numeric',
+ hour: '2-digit',
+ minute: 'numeric',
+ hour12: true,
+ },
+ )
+ : '-'}
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+ )}
+
+
+
+
+ >
+ )
+}
+
+export default ViewOrders
|