currency smbol add
This commit is contained in:
parent
956ddfdef4
commit
8d7edbf972
@ -121,9 +121,9 @@ const _nav = [
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "GST Rate",
|
||||
name: "VAT",
|
||||
icon: <CIcon icon={cilTablet} customClassName="nav-icon" />,
|
||||
to: "/tax",
|
||||
to: "/vat",
|
||||
group: "Product Management",
|
||||
},
|
||||
],
|
||||
|
@ -238,7 +238,7 @@ const routes = [
|
||||
},
|
||||
//Gst tax
|
||||
{
|
||||
path: "/tax",
|
||||
path: "/vat",
|
||||
name: "Tax Rates",
|
||||
element: Tax,
|
||||
navName: "Product Management",
|
||||
|
@ -155,7 +155,7 @@ const ProductDetails = (props) => {
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
placeholder="₹"
|
||||
placeholder=""
|
||||
id="master_price"
|
||||
name="master_price"
|
||||
value={data.master_price}
|
||||
@ -165,7 +165,7 @@ const ProductDetails = (props) => {
|
||||
</div>
|
||||
<div className="col-lg-6 ">
|
||||
<label htmlFor="product" className="form-label">
|
||||
Master GST *
|
||||
Master VAT *
|
||||
</label>
|
||||
<select
|
||||
name="master_GST"
|
||||
|
@ -20,6 +20,7 @@ const Products = () => {
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [itemPerPage, setItemPerPage] = useState(10);
|
||||
const [totalData, setTotalData] = useState(0);
|
||||
|
||||
// const {
|
||||
// edit,
|
||||
// add,
|
||||
@ -73,9 +74,26 @@ const Products = () => {
|
||||
setCategories(res?.data?.categories);
|
||||
});
|
||||
};
|
||||
const [currencyDetails, setCurrencyDetails] = useState(null);
|
||||
|
||||
const getCurrency = async () => {
|
||||
try {
|
||||
const response = await axios.get("/api/currency/getall", {
|
||||
// headers: {
|
||||
// Authorization: `Bearer ${token}`,
|
||||
// },
|
||||
});
|
||||
|
||||
if (response.status === 200) {
|
||||
setCurrencyDetails(response?.data?.currency[0]);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
getCatagories();
|
||||
getCurrency();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
@ -202,6 +220,7 @@ const Products = () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
console.log("currencyDetails", currencyDetails);
|
||||
return (
|
||||
<div className="main-content">
|
||||
<div className="page-content">
|
||||
@ -395,7 +414,7 @@ const Products = () => {
|
||||
</button>
|
||||
</td>
|
||||
<th className="text-start">
|
||||
₹
|
||||
{currencyDetails?.CurrencySymbol}
|
||||
{product?.variants?.length > 0
|
||||
? product?.variants[0]?.price
|
||||
: product?.master_price}
|
||||
@ -446,7 +465,11 @@ const Products = () => {
|
||||
Variants
|
||||
</button>
|
||||
</Link> */}
|
||||
<Link to={`/product/view/${product._id}`}>
|
||||
<Link
|
||||
to={`/product/view/${product._id}`}
|
||||
state={{ currencyDetails }}
|
||||
// to={`/product/view/${product._id}`}
|
||||
>
|
||||
<button
|
||||
style={{
|
||||
color: "white",
|
||||
|
@ -1,10 +1,14 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import axios from "axios";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { useLocation, useNavigate, useParams } from "react-router-dom";
|
||||
import { isAutheticated } from "src/auth";
|
||||
|
||||
const ViewProduct = () => {
|
||||
// const id = useParams()?.id;
|
||||
|
||||
const location = useLocation();
|
||||
const { currencyDetails } = location.state || {};
|
||||
|
||||
const { id } = useParams();
|
||||
const token = isAutheticated();
|
||||
|
||||
@ -101,7 +105,10 @@ const ViewProduct = () => {
|
||||
{productData?.master_price && (
|
||||
<tr>
|
||||
<th>Master Price</th>
|
||||
<td>₹{productData?.master_price}</td>
|
||||
<td>
|
||||
{currencyDetails?.CurrencySymbol}
|
||||
{productData?.master_price}
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
{productData?.master_GST && (
|
||||
@ -117,7 +124,7 @@ const ViewProduct = () => {
|
||||
<tr>
|
||||
<th>Master GST Price</th>
|
||||
<td>
|
||||
₹
|
||||
{currencyDetails?.CurrencySymbol}
|
||||
{(
|
||||
(Number(productData?.master_price) *
|
||||
Number(productData?.master_GST?.tax)) /
|
||||
@ -170,7 +177,7 @@ const ViewProduct = () => {
|
||||
<th className="text-center">Variant Name</th>
|
||||
<th className="text-center">Price</th>
|
||||
|
||||
<th className="text-center">Gst</th>
|
||||
<th className="text-center">VAT</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -181,7 +188,10 @@ const ViewProduct = () => {
|
||||
<td className="text-center">
|
||||
{r?.variant_Name}
|
||||
</td>
|
||||
<td className="text-center">₹{r?.price}</td>
|
||||
<td className="text-center">
|
||||
{currencyDetails?.CurrencySymbol}
|
||||
{r?.price}
|
||||
</td>
|
||||
|
||||
<td className="text-center">
|
||||
{r?.gst_Id?.name + " " + r?.gst_Id?.tax + "%"}
|
||||
|
@ -1,18 +1,18 @@
|
||||
import axios from 'axios'
|
||||
import React, { useState } from 'react'
|
||||
import { Link, useNavigate } from 'react-router-dom'
|
||||
import { isAutheticated } from 'src/auth'
|
||||
import swal from 'sweetalert'
|
||||
import axios from "axios";
|
||||
import React, { useState } from "react";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
import { isAutheticated } from "src/auth";
|
||||
import swal from "sweetalert";
|
||||
|
||||
function Addtax() {
|
||||
const navigate = useNavigate()
|
||||
const token = isAutheticated()
|
||||
const [loading, setLoading] = useState(false)
|
||||
const navigate = useNavigate();
|
||||
const token = isAutheticated();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [data, setData] = useState({
|
||||
name: '',
|
||||
tax: '',
|
||||
hsn_code: '',
|
||||
})
|
||||
name: "",
|
||||
tax: "",
|
||||
hsn_code: "",
|
||||
});
|
||||
const [limiter, setLimiter] = useState({
|
||||
name: 50,
|
||||
namehas: 50,
|
||||
@ -20,23 +20,29 @@ function Addtax() {
|
||||
taxhas: 2,
|
||||
hsn_code: 10,
|
||||
hsn_codehas: 10,
|
||||
})
|
||||
});
|
||||
|
||||
const handleChange = (e) => {
|
||||
if ((e.target.name === 'tax' || e.target.name === 'hsn_code') && /^\D+$/.test(e.target.value))
|
||||
return
|
||||
setData((prev) => ({ ...prev, [e.target.name]: e.target.value }))
|
||||
if (
|
||||
(e.target.name === "tax" || e.target.name === "hsn_code") &&
|
||||
/^\D+$/.test(e.target.value)
|
||||
)
|
||||
return;
|
||||
setData((prev) => ({ ...prev, [e.target.name]: e.target.value }));
|
||||
setLimiter((prev) => ({
|
||||
...prev,
|
||||
[e.target.name + 'has']: prev[e.target.name] - e.target.value.length,
|
||||
}))
|
||||
}
|
||||
[e.target.name + "has"]: prev[e.target.name] - e.target.value.length,
|
||||
}));
|
||||
};
|
||||
|
||||
async function handleSubmit() {
|
||||
if ((data.name.trim() === '' || data.tax.trim() === '', data.hsn_code.trim() === '')) {
|
||||
return swal('Error', 'All fields are required!', 'error')
|
||||
if (
|
||||
(data.name.trim() === "" || data.tax.trim() === "",
|
||||
data.hsn_code.trim() === "")
|
||||
) {
|
||||
return swal("Error", "All fields are required!", "error");
|
||||
}
|
||||
setLoading(true)
|
||||
setLoading(true);
|
||||
await axios
|
||||
.post(`/api/tax/add_tax`, data, {
|
||||
headers: {
|
||||
@ -44,15 +50,21 @@ function Addtax() {
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
setLoading(false)
|
||||
swal('Success', 'Tax added successfully', 'success')
|
||||
navigate('/tax', { replace: true })
|
||||
setLoading(false);
|
||||
swal("Success", "Tax added successfully", "success");
|
||||
navigate("/tax", { replace: true });
|
||||
})
|
||||
.catch((err) => {
|
||||
// console.log(err)
|
||||
swal('Error', err.response.data.message ? err.response.data.message : 'Something Went Wrong', 'error')
|
||||
setLoading(false)
|
||||
})
|
||||
swal(
|
||||
"Error",
|
||||
err.response.data.message
|
||||
? err.response.data.message
|
||||
: "Something Went Wrong",
|
||||
"error"
|
||||
);
|
||||
setLoading(false);
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
@ -69,7 +81,7 @@ function Addtax() {
|
||||
justify-content-between
|
||||
"
|
||||
>
|
||||
<h4 className="mb-0">Add New Tax Rate</h4>
|
||||
<h4 className="mb-0">Add New VAT Rate</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -90,7 +102,7 @@ function Addtax() {
|
||||
Save
|
||||
</button>
|
||||
|
||||
<Link to="/tax">
|
||||
<Link to="/vat">
|
||||
<button
|
||||
type="button"
|
||||
className="
|
||||
@ -116,7 +128,10 @@ function Addtax() {
|
||||
<div className="row">
|
||||
<div className="col-lg-12">
|
||||
<div className="form-group">
|
||||
<label htmlFor="basicpill-phoneno-input" className="label-100">
|
||||
<label
|
||||
htmlFor="basicpill-phoneno-input"
|
||||
className="label-100"
|
||||
>
|
||||
Name*
|
||||
</label>
|
||||
<input
|
||||
@ -127,7 +142,10 @@ function Addtax() {
|
||||
className="form-control input-field"
|
||||
maxLength={limiter.name}
|
||||
/>
|
||||
<label htmlFor="basicpill-phoneno-input" className="label-100">
|
||||
<label
|
||||
htmlFor="basicpill-phoneno-input"
|
||||
className="label-100"
|
||||
>
|
||||
Remaining Characters: {limiter.namehas}
|
||||
</label>
|
||||
</div>
|
||||
@ -137,7 +155,10 @@ function Addtax() {
|
||||
<div className="row mt-2">
|
||||
<div className="col-lg-12">
|
||||
<div className="form-group">
|
||||
<label htmlFor="basicpill-phoneno-input" className="label-100">
|
||||
<label
|
||||
htmlFor="basicpill-phoneno-input"
|
||||
className="label-100"
|
||||
>
|
||||
HSN Code*
|
||||
</label>
|
||||
<input
|
||||
@ -148,7 +169,10 @@ function Addtax() {
|
||||
maxLength={limiter.hsn_code}
|
||||
className="form-control input-field"
|
||||
/>
|
||||
<label htmlFor="basicpill-phoneno-input" className="label-100">
|
||||
<label
|
||||
htmlFor="basicpill-phoneno-input"
|
||||
className="label-100"
|
||||
>
|
||||
Remaining Characters: {limiter.hsn_codehas}
|
||||
</label>
|
||||
</div>
|
||||
@ -158,8 +182,11 @@ function Addtax() {
|
||||
<div className="row mt-2">
|
||||
<div className="col-lg-12">
|
||||
<div className="form-group">
|
||||
<label htmlFor="basicpill-phoneno-input" className="label-100">
|
||||
Tax Rate (in %)*
|
||||
<label
|
||||
htmlFor="basicpill-phoneno-input"
|
||||
className="label-100"
|
||||
>
|
||||
VAT Rate (in %)*
|
||||
</label>
|
||||
<input
|
||||
value={data.tax}
|
||||
@ -169,7 +196,10 @@ function Addtax() {
|
||||
maxLength={limiter.tax}
|
||||
className="form-control input-field"
|
||||
/>
|
||||
<label htmlFor="basicpill-phoneno-input" className="label-100">
|
||||
<label
|
||||
htmlFor="basicpill-phoneno-input"
|
||||
className="label-100"
|
||||
>
|
||||
Remaining Characters: {limiter.taxhas}
|
||||
</label>
|
||||
</div>
|
||||
@ -185,7 +215,7 @@ function Addtax() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export default Addtax
|
||||
export default Addtax;
|
||||
|
@ -1,19 +1,18 @@
|
||||
import axios from 'axios'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { Link, useParams, useNavigate } from 'react-router-dom'
|
||||
import { isAutheticated } from 'src/auth'
|
||||
|
||||
import axios from "axios";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Link, useParams, useNavigate } from "react-router-dom";
|
||||
import { isAutheticated } from "src/auth";
|
||||
|
||||
function Edittax() {
|
||||
const { id } = useParams()
|
||||
const token = isAutheticated()
|
||||
const navigate = useNavigate()
|
||||
const [loading, setLoading] = useState(false)
|
||||
const { id } = useParams();
|
||||
const token = isAutheticated();
|
||||
const navigate = useNavigate();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [data, setData] = useState({
|
||||
name: '',
|
||||
tax: '',
|
||||
hsn_code: '',
|
||||
})
|
||||
name: "",
|
||||
tax: "",
|
||||
hsn_code: "",
|
||||
});
|
||||
const [limiter, setLimiter] = useState({
|
||||
name: 50,
|
||||
namehas: 50,
|
||||
@ -21,11 +20,11 @@ function Edittax() {
|
||||
taxhas: 2,
|
||||
hsn_code: 10,
|
||||
hsn_codehas: 10,
|
||||
})
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
function getTax() {
|
||||
setLoading(true)
|
||||
setLoading(true);
|
||||
axios
|
||||
.get(`/api/tax/view_tax/${id}`, {
|
||||
headers: {
|
||||
@ -33,43 +32,49 @@ function Edittax() {
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
setLoading(false)
|
||||
setLoading(false);
|
||||
setData((prev) => ({
|
||||
...prev,
|
||||
name: res.data?.name,
|
||||
tax: res.data?.tax?.toString(),
|
||||
hsn_code: res.data?.hsn_code?.toString(),
|
||||
}))
|
||||
}));
|
||||
setLimiter((prev) => ({
|
||||
...prev,
|
||||
namehas: prev.name - res.data?.name.length,
|
||||
taxhas: prev.tax - res.data?.tax?.toString().length,
|
||||
hsn_codehas: prev.hsn_code - res.data?.hsn_code.toString()?.length,
|
||||
}))
|
||||
}));
|
||||
})
|
||||
.catch((res) => {
|
||||
setLoading(false)
|
||||
navigate('/tax', { replace: true })
|
||||
})
|
||||
setLoading(false);
|
||||
navigate("/tax", { replace: true });
|
||||
});
|
||||
}
|
||||
getTax()
|
||||
}, [])
|
||||
getTax();
|
||||
}, []);
|
||||
|
||||
const handleChange = (e) => {
|
||||
if ((e.target.name === 'tax' || e.target.name === 'hsn_code') && /^\D+$/.test(e.target.value))
|
||||
return
|
||||
setData((prev) => ({ ...prev, [e.target.name]: e.target.value }))
|
||||
if (
|
||||
(e.target.name === "tax" || e.target.name === "hsn_code") &&
|
||||
/^\D+$/.test(e.target.value)
|
||||
)
|
||||
return;
|
||||
setData((prev) => ({ ...prev, [e.target.name]: e.target.value }));
|
||||
setLimiter((prev) => ({
|
||||
...prev,
|
||||
[e.target.name + 'has']: prev[e.target.name] - e.target.value.length,
|
||||
}))
|
||||
}
|
||||
[e.target.name + "has"]: prev[e.target.name] - e.target.value.length,
|
||||
}));
|
||||
};
|
||||
|
||||
function handleSubmit() {
|
||||
if ((data.name.trim() === '' || data.tax.trim() === '', data.hsn_code.trim() === '')) {
|
||||
return swal('Error', 'All fields are required!', 'error')
|
||||
if (
|
||||
(data.name.trim() === "" || data.tax.trim() === "",
|
||||
data.hsn_code.trim() === "")
|
||||
) {
|
||||
return swal("Error", "All fields are required!", "error");
|
||||
}
|
||||
setLoading(true)
|
||||
setLoading(true);
|
||||
axios
|
||||
.patch(`/api/tax/update_tax/${id}`, data, {
|
||||
headers: {
|
||||
@ -77,14 +82,14 @@ function Edittax() {
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
setLoading(false)
|
||||
swal('Success', 'Tax updated successfully', 'success')
|
||||
navigate('/tax', { replace: true })
|
||||
setLoading(false);
|
||||
swal("Success", "Tax updated successfully", "success");
|
||||
navigate("/tax", { replace: true });
|
||||
})
|
||||
.catch((err) => {
|
||||
swal('Error', 'Something went wrong!', 'error')
|
||||
setLoading(false)
|
||||
})
|
||||
swal("Error", "Something went wrong!", "error");
|
||||
setLoading(false);
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
@ -107,7 +112,7 @@ function Edittax() {
|
||||
Save
|
||||
</button>
|
||||
|
||||
<Link to="/tax">
|
||||
<Link to="/vat">
|
||||
<button
|
||||
type="button"
|
||||
className="
|
||||
@ -133,7 +138,10 @@ function Edittax() {
|
||||
<div className="row">
|
||||
<div className="col-lg-12">
|
||||
<div className="form-group">
|
||||
<label htmlFor="basicpill-phoneno-input" className="label-100">
|
||||
<label
|
||||
htmlFor="basicpill-phoneno-input"
|
||||
className="label-100"
|
||||
>
|
||||
Name*
|
||||
</label>
|
||||
<input
|
||||
@ -144,7 +152,10 @@ function Edittax() {
|
||||
className="form-control input-field"
|
||||
maxLength={limiter.name}
|
||||
/>
|
||||
<label htmlFor="basicpill-phoneno-input" className="label-100">
|
||||
<label
|
||||
htmlFor="basicpill-phoneno-input"
|
||||
className="label-100"
|
||||
>
|
||||
Remaining Characters: {limiter.namehas}
|
||||
</label>
|
||||
</div>
|
||||
@ -154,7 +165,10 @@ function Edittax() {
|
||||
<div className="row mt-2">
|
||||
<div className="col-lg-12">
|
||||
<div className="form-group">
|
||||
<label htmlFor="basicpill-phoneno-input" className="label-100">
|
||||
<label
|
||||
htmlFor="basicpill-phoneno-input"
|
||||
className="label-100"
|
||||
>
|
||||
HSN Code*
|
||||
</label>
|
||||
<input
|
||||
@ -165,7 +179,10 @@ function Edittax() {
|
||||
maxLength={limiter.hsn_code}
|
||||
className="form-control input-field"
|
||||
/>
|
||||
<label htmlFor="basicpill-phoneno-input" className="label-100">
|
||||
<label
|
||||
htmlFor="basicpill-phoneno-input"
|
||||
className="label-100"
|
||||
>
|
||||
Remaining Characters: {limiter.hsn_codehas}
|
||||
</label>
|
||||
</div>
|
||||
@ -175,8 +192,11 @@ function Edittax() {
|
||||
<div className="row mt-2">
|
||||
<div className="col-lg-12">
|
||||
<div className="form-group">
|
||||
<label htmlFor="basicpill-phoneno-input" className="label-100">
|
||||
Tax Rate (in %)*
|
||||
<label
|
||||
htmlFor="basicpill-phoneno-input"
|
||||
className="label-100"
|
||||
>
|
||||
VAT Rate (in %)*
|
||||
</label>
|
||||
<input
|
||||
value={data.tax}
|
||||
@ -186,7 +206,10 @@ function Edittax() {
|
||||
maxLength={limiter.tax}
|
||||
className="form-control input-field"
|
||||
/>
|
||||
<label htmlFor="basicpill-phoneno-input" className="label-100">
|
||||
<label
|
||||
htmlFor="basicpill-phoneno-input"
|
||||
className="label-100"
|
||||
>
|
||||
Remaining Characters: {limiter.taxhas}
|
||||
</label>
|
||||
</div>
|
||||
@ -202,7 +225,7 @@ function Edittax() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export default Edittax
|
||||
export default Edittax;
|
||||
|
@ -1,19 +1,19 @@
|
||||
import axios from 'axios'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { isAutheticated } from 'src/auth'
|
||||
import axios from "axios";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { isAutheticated } from "src/auth";
|
||||
|
||||
import { Link } from 'react-router-dom'
|
||||
import swal from 'sweetalert'
|
||||
import { Link } from "react-router-dom";
|
||||
import swal from "sweetalert";
|
||||
|
||||
function Tax() {
|
||||
const [taxList, settaxList] = useState([])
|
||||
const [success, setSuccess] = useState(true)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const token = isAutheticated()
|
||||
const [taxList, settaxList] = useState([]);
|
||||
const [success, setSuccess] = useState(true);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const token = isAutheticated();
|
||||
|
||||
useEffect(() => {
|
||||
function getTaxes() {
|
||||
setLoading(true)
|
||||
setLoading(true);
|
||||
axios
|
||||
.get(`/api/tax/view_tax`, {
|
||||
headers: {
|
||||
@ -21,13 +21,13 @@ function Tax() {
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
setLoading(false)
|
||||
settaxList(res.data)
|
||||
setLoading(false);
|
||||
settaxList(res.data);
|
||||
})
|
||||
.catch((err) => setLoading(false))
|
||||
.catch((err) => setLoading(false));
|
||||
}
|
||||
getTaxes()
|
||||
}, [success])
|
||||
getTaxes();
|
||||
}, [success]);
|
||||
|
||||
function handleDelete(id) {
|
||||
axios
|
||||
@ -37,7 +37,7 @@ function Tax() {
|
||||
},
|
||||
})
|
||||
.then((res) => setSuccess((prev) => !prev))
|
||||
.catch((err) => swal('Error!', 'Something went wrong!', 'error'))
|
||||
.catch((err) => swal("Error!", "Something went wrong!", "error"));
|
||||
}
|
||||
return (
|
||||
<div className="main-content">
|
||||
@ -61,7 +61,11 @@ function Tax() {
|
||||
float-right
|
||||
"
|
||||
>
|
||||
<i className="fa fa-plus mb-2" aria-hidden="true"></i> Add New Tax Rate
|
||||
<i
|
||||
className="fa fa-plus mb-2"
|
||||
aria-hidden="true"
|
||||
></i>{" "}
|
||||
Add New VAT Rate
|
||||
</button>
|
||||
</Link>
|
||||
</div>
|
||||
@ -69,10 +73,13 @@ function Tax() {
|
||||
</div>
|
||||
<div className="table-responsive table-shoot mt-2">
|
||||
<table className="table table-centered table-nowrap mb-0">
|
||||
<thead className="thead" style={{ background: 'rgb(140, 213, 213)' }}>
|
||||
<thead
|
||||
className="thead"
|
||||
style={{ background: "rgb(140, 213, 213)" }}
|
||||
>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Tax Rate</th>
|
||||
<th>VAT Rate</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -113,7 +120,7 @@ function Tax() {
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
@ -211,7 +218,7 @@ function Tax() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export default Tax
|
||||
export default Tax;
|
||||
|
@ -1,13 +1,12 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import QRCode from 'react-qr-code'
|
||||
import axios from 'axios'
|
||||
import { isAutheticated } from 'src/auth'
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import QRCode from "react-qr-code";
|
||||
import axios from "axios";
|
||||
import { isAutheticated } from "src/auth";
|
||||
|
||||
const PrintOrderDetails = React.forwardRef(({ orderData }, ref) => {
|
||||
const token = isAutheticated()
|
||||
const [company, setCompany] = useState({})
|
||||
const [logo, setLogo] = useState('')
|
||||
const token = isAutheticated();
|
||||
const [company, setCompany] = useState({});
|
||||
const [logo, setLogo] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
function getConfig() {
|
||||
@ -18,34 +17,47 @@ const PrintOrderDetails = React.forwardRef(({ orderData }, ref) => {
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
setCompany(res.data?.result[0]?.address[0])
|
||||
setLogo(res.data?.result[0]?.logo[0]?.Headerlogo)
|
||||
})
|
||||
setCompany(res.data?.result[0]?.address[0]);
|
||||
setLogo(res.data?.result[0]?.logo[0]?.Headerlogo);
|
||||
});
|
||||
}
|
||||
getConfig()
|
||||
}, [])
|
||||
getConfig();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="container" ref={ref}>
|
||||
<div className="mx-5 my-5" style={{ border: '0.3px solid grey', height: '100%' }}>
|
||||
<div
|
||||
className="mx-5 my-5"
|
||||
style={{ border: "0.3px solid grey", height: "100%" }}
|
||||
>
|
||||
<div className="text-center">
|
||||
<h4 className="m-0">Order Confirmation</h4>
|
||||
</div>
|
||||
<hr className="my-1" />
|
||||
<table className="table table-sm mt-2 table-borderless" style={{ fontSize: '12px' }}>
|
||||
<table
|
||||
className="table table-sm mt-2 table-borderless"
|
||||
style={{ fontSize: "12px" }}
|
||||
>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td rowSpan={6}>
|
||||
{logo && (
|
||||
<div
|
||||
className="d-flex justify-content-center align-items-center"
|
||||
style={{ height: '100%' }}
|
||||
style={{ height: "100%" }}
|
||||
>
|
||||
<img src={logo} alt={company?.company} style={{ width: '150px' }} />
|
||||
<img
|
||||
src={logo}
|
||||
alt={company?.company}
|
||||
style={{ width: "150px" }}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</td>
|
||||
<th style={{ whiteSpace: 'nowrap', fontSize: '15px' }} className="fw-bold">
|
||||
<th
|
||||
style={{ whiteSpace: "nowrap", fontSize: "15px" }}
|
||||
className="fw-bold"
|
||||
>
|
||||
{company?.company}
|
||||
</th>
|
||||
</tr>
|
||||
@ -53,7 +65,7 @@ const PrintOrderDetails = React.forwardRef(({ orderData }, ref) => {
|
||||
<td>
|
||||
{company?.address}
|
||||
<br />
|
||||
{company?.city + ' ' + company?.state + ' ' + company?.pincode}
|
||||
{company?.city + " " + company?.state + " " + company?.pincode}
|
||||
<br />
|
||||
{company?.country}
|
||||
<br />
|
||||
@ -63,32 +75,36 @@ const PrintOrderDetails = React.forwardRef(({ orderData }, ref) => {
|
||||
</tbody>
|
||||
</table>
|
||||
<hr className="m-0" />
|
||||
<div className="row" style={{ fontSize: '12px' }}>
|
||||
<div className="row" style={{ fontSize: "12px" }}>
|
||||
<div className="col-6">
|
||||
<label className="ms-1">
|
||||
Order ID: <span className="fw-bold">{orderData?.order_id}</span>
|
||||
</label>
|
||||
<label className="ms-1">
|
||||
Razorpay Order ID: <span className="fw-bold">{orderData?.razorpay_order_id}</span>
|
||||
Razorpay Order ID:{" "}
|
||||
<span className="fw-bold">{orderData?.razorpay_order_id}</span>
|
||||
</label>
|
||||
</div>
|
||||
<div className="col-6">
|
||||
<label>
|
||||
Order Placed On:{' '}
|
||||
Order Placed On:{" "}
|
||||
<span className="fw-bold">
|
||||
{new Date(orderData?.placed_on).toLocaleString('en-IN', {
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
year: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: 'numeric',
|
||||
{new Date(orderData?.placed_on).toLocaleString("en-IN", {
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
year: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "numeric",
|
||||
hour12: true,
|
||||
})}
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<table className="table table-sm table-bordered m-0" style={{ fontSize: '12px' }}>
|
||||
<table
|
||||
className="table table-sm table-bordered m-0"
|
||||
style={{ fontSize: "12px" }}
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Bill To</th>
|
||||
@ -118,7 +134,7 @@ const PrintOrderDetails = React.forwardRef(({ orderData }, ref) => {
|
||||
)}
|
||||
{orderData.address?.city}
|
||||
<br />
|
||||
{orderData.address?.pincode + ' ' + orderData.address?.state}
|
||||
{orderData.address?.pincode + " " + orderData.address?.state}
|
||||
</td>
|
||||
<td>
|
||||
<span className="fw-bold">{orderData?.address?.full_name}</span>
|
||||
@ -141,17 +157,17 @@ const PrintOrderDetails = React.forwardRef(({ orderData }, ref) => {
|
||||
)}
|
||||
{orderData.address?.city}
|
||||
<br />
|
||||
{orderData.address?.pincode + ' ' + orderData.address?.state}
|
||||
{orderData.address?.pincode + " " + orderData.address?.state}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<label className="mt-1 ms-1" style={{ fontSize: '12px' }}>
|
||||
<label className="mt-1 ms-1" style={{ fontSize: "12px" }}>
|
||||
Items :
|
||||
</label>
|
||||
<table
|
||||
className="table table-sm table-bordered text-center m-0"
|
||||
style={{ fontSize: '12px' }}
|
||||
style={{ fontSize: "12px" }}
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
@ -162,7 +178,7 @@ const PrintOrderDetails = React.forwardRef(({ orderData }, ref) => {
|
||||
<th>Qnty</th>
|
||||
<th>Tax Type</th>
|
||||
<th>Gross Amount</th>
|
||||
<th>Tax Rate</th>
|
||||
<th>VAT Rate</th>
|
||||
<th>Net Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -176,19 +192,26 @@ const PrintOrderDetails = React.forwardRef(({ orderData }, ref) => {
|
||||
<td>{e.product.name}</td>
|
||||
<td>{e.variant.size}</td>
|
||||
<td>{e.quantity}</td>
|
||||
<td>{e?.igst ? 'IGST' : 'CGST, SGST'}</td>
|
||||
<td>{e?.igst ? "IGST" : "CGST, SGST"}</td>
|
||||
<td>{e.price}</td>
|
||||
<td>
|
||||
{(e?.igst ? Number(e?.igst) : Number(e?.sgst) + Number(e?.cgst)).toFixed(2) +
|
||||
'%'}
|
||||
{(e?.igst
|
||||
? Number(e?.igst)
|
||||
: Number(e?.sgst) + Number(e?.cgst)
|
||||
).toFixed(2) + "%"}
|
||||
</td>
|
||||
<td>
|
||||
{e?.igst
|
||||
? ((e.price + (e.price * e.igst) / 100) * e.quantity).toFixed(2)
|
||||
? (
|
||||
(e.price + (e.price * e.igst) / 100) *
|
||||
e.quantity
|
||||
).toFixed(2)
|
||||
: (
|
||||
(e.price + (e.price * e.cgst) / 100 + (e.price * e.sgst) / 100) *
|
||||
e.quantity
|
||||
).toFixed(2)}
|
||||
(e.price +
|
||||
(e.price * e.cgst) / 100 +
|
||||
(e.price * e.sgst) / 100) *
|
||||
e.quantity
|
||||
).toFixed(2)}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
@ -220,20 +243,23 @@ const PrintOrderDetails = React.forwardRef(({ orderData }, ref) => {
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p className="text-center fw-bold my-1 p-0" style={{ fontSize: '12px' }}>
|
||||
<p
|
||||
className="text-center fw-bold my-1 p-0"
|
||||
style={{ fontSize: "12px" }}
|
||||
>
|
||||
Note: Tax Invoice will be sent along with the goods.
|
||||
</p>
|
||||
<p className="ms-2" style={{ fontSize: '12px' }}>
|
||||
<p className="ms-2" style={{ fontSize: "12px" }}>
|
||||
Thanks for your business.
|
||||
</p>
|
||||
<QRCode
|
||||
value={JSON.stringify({ order_id: orderData?.order_id })}
|
||||
size={256}
|
||||
style={{ height: '150px', width: '150px', margin: '10px' }}
|
||||
style={{ height: "150px", width: "150px", margin: "10px" }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
export default PrintOrderDetails
|
||||
export default PrintOrderDetails;
|
||||
|
Loading…
Reference in New Issue
Block a user