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