PD updated with new field SBU

This commit is contained in:
Sibunnayak 2024-08-23 11:29:11 +05:30
parent 185bda1261
commit ab8a468c0b
6 changed files with 461 additions and 230 deletions

View File

@ -52,7 +52,7 @@ const AddMultiplePd = () => {
},
}
);
// console.log(data);
console.log(data);
if (data.errors && data.errors.length > 0) {
setErrors(data.errors);
}
@ -211,8 +211,8 @@ const AddMultiplePd = () => {
<td>{distributor.name || "N/A"}</td>
<td>{distributor.email || "N/A"}</td>
<td>{distributor.phone || "N/A"}</td>
<td>{distributor.panNumber || "N/A"}</td>
<td>{distributor.gstNumber || "N/A"}</td>
<td>{distributor?.address?.panNumber || "N/A"}</td>
<td>{distributor?.address?.gstNumber || "N/A"}</td>
</tr>
))}
</tbody>

View File

@ -8,6 +8,8 @@ import {
FormHelperText,
Autocomplete,
CircularProgress,
FormControl,
InputLabel,
} from "@mui/material";
import { useNavigate } from "react-router-dom";
import { toast } from "react-hot-toast";
@ -21,6 +23,7 @@ const AddPrincipalDistributor = () => {
const [user, setUser] = useState({
PD_ID: "",
SBU: "",
name: "",
email: "",
phone: "",
@ -165,11 +168,22 @@ const AddPrincipalDistributor = () => {
Add Principal Distributor
</Typography>
<form onSubmit={handleFormSubmit}>
<Typography variant="h6" sx={{ mb: 2 }}>
<Typography variant="h5" sx={{ mb: 2 }}>
Basic Information
</Typography>
<Grid container spacing={2} sx={{ mb: 2 }}>
<Grid item xs={6}>
{/* Principal Distributor ID */}
<Grid item xs={12} className="d-flex align-items-center">
<Grid item xs={2}>
<Typography
variant="body1"
htmlFor="PD_ID"
className="form-label"
>
Principal Distributor ID*
</Typography>
</Grid>
<Grid item xs={10}>
<TextField
id="PD_ID"
required
@ -177,12 +191,49 @@ const AddPrincipalDistributor = () => {
fullWidth
name="PD_ID"
value={user.PD_ID}
label="Principal Distributor ID"
variant="outlined"
onChange={handleInputChange}
/>
</Grid>
<Grid item xs={6}>
</Grid>
{/* Principal Distributor SBU */}
<Grid item xs={12} className="d-flex align-items-center">
<Grid item xs={2}>
<Typography
variant="body1"
htmlFor="SBU"
className="form-label"
>
Principal Distributor SBU*
</Typography>
</Grid>
<Grid item xs={10}>
<TextField
id="SBU"
required
type="text"
fullWidth
name="SBU"
value={user.SBU}
variant="outlined"
onChange={handleInputChange}
/>
</Grid>
</Grid>
{/* Name */}
<Grid item xs={12} className="d-flex align-items-center">
<Grid item xs={2}>
<Typography
variant="body1"
htmlFor="name"
className="form-label"
>
Name*
</Typography>
</Grid>
<Grid item xs={10}>
<TextField
id="name"
required
@ -190,12 +241,24 @@ const AddPrincipalDistributor = () => {
fullWidth
name="name"
value={user.name}
label="Name"
variant="outlined"
onChange={handleInputChange}
/>
</Grid>
<Grid item xs={6}>
</Grid>
{/* Email */}
<Grid item xs={12} className="d-flex align-items-center">
<Grid item xs={2}>
<Typography
variant="body1"
htmlFor="email"
className="form-label"
>
Email*
</Typography>
</Grid>
<Grid item xs={10}>
<TextField
id="email"
required
@ -203,12 +266,24 @@ const AddPrincipalDistributor = () => {
fullWidth
name="email"
value={user.email}
label="Email"
variant="outlined"
onChange={handleInputChange}
/>
</Grid>
<Grid item xs={6}>
</Grid>
{/* Phone Number */}
<Grid item xs={12} className="d-flex align-items-center">
<Grid item xs={2}>
<Typography
variant="body1"
htmlFor="phone"
className="form-label"
>
Phone Number*
</Typography>
</Grid>
<Grid item xs={10}>
<TextField
id="phone"
required
@ -216,18 +291,29 @@ const AddPrincipalDistributor = () => {
fullWidth
name="phone"
value={user.phone}
label="Phone Number"
variant="outlined"
onChange={handleInputChange}
/>
</Grid>
</Grid>
</Grid>
<Typography variant="h6" sx={{ mb: 2 }}>
<Typography variant="h5" sx={{ mb: 2 }}>
Business Details
</Typography>
<Grid container spacing={2} sx={{ mb: 2 }}>
<Grid item xs={12} sm={4}>
{/* PAN Number */}
<Grid item xs={12} className="d-flex align-items-center">
<Grid item xs={2}>
<Typography
variant="body1"
htmlFor="panNumber"
className="form-label"
>
PAN Number*
</Typography>
</Grid>
<Grid item xs={10}>
<TextField
id="panNumber"
required
@ -235,12 +321,24 @@ const AddPrincipalDistributor = () => {
fullWidth
name="panNumber"
value={data.panNumber}
label="PAN Number"
variant="outlined"
onChange={handleDataChange}
/>
</Grid>
<Grid item xs={12} sm={4}>
</Grid>
{/* Trade Name */}
<Grid item xs={12} className="d-flex align-items-center">
<Grid item xs={2}>
<Typography
variant="body1"
htmlFor="tradeName"
className="form-label"
>
Trade Name*
</Typography>
</Grid>
<Grid item xs={10}>
<TextField
id="tradeName"
required
@ -248,12 +346,24 @@ const AddPrincipalDistributor = () => {
fullWidth
name="tradeName"
value={data.tradeName}
label="Trade Name"
variant="outlined"
onChange={handleDataChange}
/>
</Grid>
<Grid item xs={12} sm={4}>
</Grid>
{/* GST Number */}
<Grid item xs={12} className="d-flex align-items-center">
<Grid item xs={2}>
<Typography
variant="body1"
htmlFor="gstNumber"
className="form-label"
>
GST Number*
</Typography>
</Grid>
<Grid item xs={10}>
<TextField
id="gstNumber"
required
@ -261,18 +371,29 @@ const AddPrincipalDistributor = () => {
fullWidth
name="gstNumber"
value={data.gstNumber}
label="GST Number"
variant="outlined"
onChange={handleDataChange}
/>
</Grid>
</Grid>
</Grid>
<Typography variant="h6" sx={{ mb: 2 }}>
<Typography variant="h5" sx={{ mb: 2 }}>
Address
</Typography>
<Grid container spacing={2} sx={{ mb: 2 }}>
<Grid item xs={12} sm={4}>
{/* Country */}
<Grid item xs={12} className="d-flex align-items-center">
<Grid item xs={2}>
<Typography
variant="body1"
htmlFor="country"
className="form-label"
>
Country*
</Typography>
</Grid>
<Grid item xs={10}>
<TextField
id="country"
required
@ -280,12 +401,24 @@ const AddPrincipalDistributor = () => {
fullWidth
name="country"
value={data.country}
label="Country"
variant="outlined"
disabled
/>
</Grid>
<Grid item xs={12} sm={4}>
</Grid>
{/* State */}
<Grid item xs={12} className="d-flex align-items-center">
<Grid item xs={2}>
<Typography
variant="body1"
htmlFor="state"
className="form-label"
>
State*
</Typography>
</Grid>
<Grid item xs={10}>
<Autocomplete
id="state"
options={stateOptions}
@ -296,15 +429,28 @@ const AddPrincipalDistributor = () => {
<TextField
{...params}
fullWidth
label="State"
variant="outlined"
label="Select State"
error={!selectedState}
helperText={!selectedState ? "Select a state" : null}
/>
)}
/>
</Grid>
<Grid item xs={12} sm={4}>
</Grid>
{/* City */}
<Grid item xs={12} className="d-flex align-items-center">
<Grid item xs={2}>
<Typography
variant="body1"
htmlFor="city"
className="form-label"
>
City*
</Typography>
</Grid>
<Grid item xs={10}>
<Autocomplete
id="city"
options={cityOptions}
@ -315,15 +461,28 @@ const AddPrincipalDistributor = () => {
<TextField
{...params}
fullWidth
label="City"
variant="outlined"
label="Select City"
error={!selectedCity}
helperText={!selectedCity ? "Select a city" : null}
/>
)}
/>
</Grid>
<Grid item xs={6}>
</Grid>
{/* Street */}
<Grid item xs={12} className="d-flex align-items-center">
<Grid item xs={2}>
<Typography
variant="body1"
htmlFor="street"
className="form-label"
>
Street*
</Typography>
</Grid>
<Grid item xs={10}>
<TextField
id="street"
required
@ -331,12 +490,24 @@ const AddPrincipalDistributor = () => {
fullWidth
name="street"
value={data.street}
label="Street"
variant="outlined"
onChange={handleDataChange}
/>
</Grid>
<Grid item xs={6}>
</Grid>
{/* Postal Code */}
<Grid item xs={12} className="d-flex align-items-center">
<Grid item xs={2}>
<Typography
variant="body1"
htmlFor="postalCode"
className="form-label"
>
Postal Code*
</Typography>
</Grid>
<Grid item xs={10}>
<TextField
id="postalCode"
required
@ -344,12 +515,12 @@ const AddPrincipalDistributor = () => {
fullWidth
name="postalCode"
value={data.postalCode}
label="Postal Code"
variant="outlined"
onChange={handleDataChange}
/>
</Grid>
</Grid>
</Grid>
<Button
type="submit"

View File

@ -148,7 +148,9 @@ const principalDistributor = () => {
color="primary"
className="font-bold mb-2 capitalize"
onClick={() =>
navigate("/add-principal-distributor/multiple", { replace: true })
navigate("/add-principal-distributor/multiple", {
replace: true,
})
}
>
Upload Spreadsheet
@ -199,6 +201,7 @@ const principalDistributor = () => {
>
<tr>
<th>Unique Id </th>
<th>SBU</th>
<th>Name</th>
<th>Email</th>
{/* <th>Profile Image</th> */}
@ -228,6 +231,7 @@ const principalDistributor = () => {
return (
<tr key={i}>
<td>{user.uniqueId}</td>
<td>{user.SBU?user.SBU:"N/A"}</td>
<td className="text-start">{user.name}</td>
<td>{user.email}</td>
<td className="text-start">

View File

@ -137,35 +137,85 @@ const SinglePrincipalDistributorAllDetails = () => {
</div>
</div>
<div className="card" style={{ padding: "1rem" }}>
<h5 style={{ fontWeight: "bold" }}>&bull; Principal Distributor Profile </h5>
<h5 style={{ fontWeight: "bold" }}>
&bull; Principal Distributor Profile{" "}
</h5>
<div style={{ marginLeft: "1rem", marginTop: "1rem" }}>
<Typography style={{ fontWeight: "bold", fontSize: "1.2rem" }}>
Principal Distributor ID:
<Typography component="span" style={{ fontWeight: "normal", fontSize: "1.2rem",marginLeft: "0.5rem" }}>
<Typography
component="span"
style={{
fontWeight: "normal",
fontSize: "1.2rem",
marginLeft: "0.5rem",
}}
>
{user?.uniqueId}
</Typography>
</Typography>
<Typography style={{ fontWeight: "bold", fontSize: "1.2rem" }}>
Principal Distributor SBU:
<Typography
component="span"
style={{
fontWeight: "normal",
fontSize: "1.2rem",
marginLeft: "0.5rem",
}}
>
{user?.SBU}
</Typography>
</Typography>
<Typography style={{ fontWeight: "bold", fontSize: "1.2rem" }}>
Name:
<Typography component="span" style={{ fontWeight: "normal", fontSize: "1.2rem",marginLeft: "0.5rem"}}>
<Typography
component="span"
style={{
fontWeight: "normal",
fontSize: "1.2rem",
marginLeft: "0.5rem",
}}
>
{user?.name}
</Typography>
</Typography>
<Typography style={{ fontWeight: "bold", fontSize: "1.2rem" }}>
Email:
<Typography component="span" style={{ fontWeight: "normal", fontSize: "1.2rem" ,marginLeft: "0.5rem"}}>
<Typography
component="span"
style={{
fontWeight: "normal",
fontSize: "1.2rem",
marginLeft: "0.5rem",
}}
>
{user?.email}
</Typography>
</Typography>
<Typography style={{ fontWeight: "bold", fontSize: "1.2rem" }}>
Mobile Number:
<Typography component="span" style={{ fontWeight: "normal", fontSize: "1.2rem" ,marginLeft: "0.5rem"}}>
<Typography
component="span"
style={{
fontWeight: "normal",
fontSize: "1.2rem",
marginLeft: "0.5rem",
}}
>
{user?.phone}
</Typography>
</Typography>
<Typography style={{ fontWeight: "bold", fontSize: "1.2rem" }}>
Date Registered:
<Typography component="span" style={{ fontWeight: "normal", fontSize: "1.2rem" ,marginLeft: "0.5rem"}}>
<Typography
component="span"
style={{
fontWeight: "normal",
fontSize: "1.2rem",
marginLeft: "0.5rem",
}}
>
{new Date(user?.createdAt).toLocaleString("en-IN", {
weekday: "short",
month: "short",
@ -179,7 +229,14 @@ const SinglePrincipalDistributorAllDetails = () => {
</Typography>
<Typography style={{ fontWeight: "bold", fontSize: "1.2rem" }}>
Last Purchase:
<Typography component="span" style={{ fontWeight: "normal", fontSize: "1.2rem", marginLeft: "1.5rem" }}>
<Typography
component="span"
style={{
fontWeight: "normal",
fontSize: "1.2rem",
marginLeft: "1.5rem",
}}
>
{userOrder?.length > 0
? new Date(userOrder[0]?.createdAt).toLocaleString("en-IN", {
weekday: "short",
@ -239,9 +296,8 @@ const SinglePrincipalDistributorAllDetails = () => {
? `${address.tradeName},`
: "No tradeName "}
{address.gstNumber ? `${address.gstNumber},` : ""}
{address?.street},
{address?.city},{address?.state},{address?.country},
{address?.postalCode}
{address?.street},{address?.city},{address?.state},
{address?.country},{address?.postalCode}
</strong>
</td>
</tr>

View File

@ -25,7 +25,7 @@ const AddProduct = () => {
price: "",
GST: "",
HSN_Code: "",
product_Status: "",
product_Status: "Active",
});
const getCategories = () => {

View File

@ -185,7 +185,7 @@ const ProductDetails = (props) => {
</div>
<div className="mb-3 row d-flex align-items-center">
<label htmlFor="product_Status" className="form-label col-sm-3">
Product Status *
Product Status
</label>
<div className="col-sm-9">
<select