This commit is contained in:
Sibunnayak 2024-08-02 10:29:14 +05:30
parent a6fe8988bc
commit 1cdf63f00d
17 changed files with 306 additions and 41 deletions

View File

@ -80,7 +80,7 @@ const _nav = [
name: "Sales Coordinator",
icon: <CIcon icon={cilUser} customClassName="nav-icon" />,
to: "/salescoordinators",
group: "SalesCoOrdinator",
group: "SalesCoordinator",
},
{
component: CNavItem,

View File

@ -140,6 +140,7 @@ import SingleUserAttendance from "./views/Attendance/SingleUserAttendance";
import SingleUserleave from "./views/Leaves/SingleUserLeave";
import LeaveTerritoryManager from "./views/Leaves/LeaveTerritoryManager";
import RetailDistributor from "./views/RetailDistributors/RetailDistributor";
import SingleRetailDistributor from "./views/RetailDistributors/SingleRetailDistributor";
const routes = [
//dashboard
@ -302,6 +303,12 @@ const routes = [
element: RetailDistributor,
navName: "RetailDistributor",
},
{
path: "/single/retail-distributor",
name: "Single Retail Distributor",
element: SingleRetailDistributor,
navName: "RetailDistributor",
},
//----------------------- End Product Management Routes------------------------------------------------
//Departure

View File

@ -72,7 +72,7 @@ const AttendanceSalesCoordinator = () => {
<div className="col-12">
<div className="page-title-box d-flex align-items-center justify-content-between">
<div style={{ fontSize: "22px" }} className="fw-bold">
SalesCoOrdinators Attendance
Sales Coordinators Attendance
</div>
<div className="page-title-right">
<Button
@ -121,7 +121,7 @@ const AttendanceSalesCoordinator = () => {
</div>
</div>
<div className="col-lg-3">
<label>SalesCoOrdinator Name:</label>
<label>Sales Coordinator Name:</label>
<input
type="text"
placeholder="SalesCoOrdinator name"
@ -143,7 +143,7 @@ const AttendanceSalesCoordinator = () => {
/>
</div>
<div className="col-lg-3">
<label>Verify SalesCoOrdinator:</label>
<label>Filter by Verify:</label>
<select
className="form-control"
ref={VerifySalesCoOrdinatorRef}
@ -247,7 +247,7 @@ const AttendanceSalesCoordinator = () => {
) : (
<tr className="text-center">
<td colSpan="6">
<h5>No SalesCoOrdinator Available...</h5>
<h5>No Sales Coordinator Available...</h5>
</td>
</tr>
)}

View File

@ -72,7 +72,7 @@ const AttendanceTerritoryManager = () => {
<div className="col-12">
<div className="page-title-box d-flex align-items-center justify-content-between">
<div style={{ fontSize: "22px" }} className="fw-bold">
territorymanager Attendance
Territory Manager Attendance
</div>
<div className="page-title-right">
<Button
@ -121,10 +121,10 @@ const AttendanceTerritoryManager = () => {
</div>
</div>
<div className="col-lg-3">
<label>territorymanager Name:</label>
<label>Territory Manager Name:</label>
<input
type="text"
placeholder="territorymanager name"
placeholder="Territory Manager name"
className="form-control"
ref={nameRef}
onChange={handleSearchChange}
@ -143,7 +143,7 @@ const AttendanceTerritoryManager = () => {
/>
</div>
<div className="col-lg-3">
<label>Verify territorymanager:</label>
<label>Filter by Verify:</label>
<select
className="form-control"
ref={VerifyterritorymanagerRef}

View File

@ -88,7 +88,7 @@ const TodayAttendance = () => {
});
}}
>
Show SalesCoOrdinator Attendance
Show Sales Coordinator Attendance
</Button>
<Button
variant="contained"
@ -148,7 +148,7 @@ const TodayAttendance = () => {
<th className="text-start">ID</th>
<th className="text-start">Name</th>
<th className="text-start">Email</th>
<th className="text-start">Position</th>
<th className="text-start">Designation</th>
<th className="text-start">Time</th>
<th className="text-start">Location</th>
<th className="text-start">Note</th>
@ -184,7 +184,7 @@ const TodayAttendance = () => {
<td className="text-start">
{attendance?.user?.userType || (
<small className="m-0 text-secondary">
No Position Added!
No Designation Added!
</small>
)}
</td>

View File

@ -142,7 +142,7 @@ const LeaveSalesCoordinator = () => {
/>
</div>
<div className="col-lg-3">
<label>Verify Sales Coordinator:</label>
<label>Filter by Verify:</label>
<select
className="form-control"
ref={verifyRef}

View File

@ -142,7 +142,7 @@ const LeaveTerritoryManager = () => {
/>
</div>
<div className="col-lg-3">
<label>Verify Territory Manager:</label>
<label>Filter by Verify:</label>
<select
className="form-control"
ref={verifyRef}

View File

@ -89,7 +89,7 @@ const TodayLeave = () => {
});
}}
>
Show SalesCoOrdinator Leave
Show Sales Coordinator Leave
</Button>
<Button
variant="contained"
@ -149,9 +149,9 @@ const TodayLeave = () => {
<th className="text-start">ID</th>
<th className="text-start">Name</th>
<th className="text-start">Email</th>
<th className="text-start">Position</th>
<th className="text-start">Designation</th>
<th className="text-start">Time</th>
<th className="text-start">ReasonType</th>
<th className="text-start">Leave Type</th>
<th className="text-start">Reason</th>
</tr>
</thead>
@ -199,7 +199,7 @@ const TodayLeave = () => {
<td className="text-start">
{leave?.leaveType || (
<small className="m-0 text-secondary">
No Reason Type Added!
No Leave Type Added!
</small>
)}
</td>

View File

@ -152,7 +152,7 @@ const SinglePrincipalDistributorAllDetails = () => {
</Typography>
</Typography>
<Typography style={{ fontWeight: "bold", fontSize: "1.2rem" }}>
Mail:
Email:
<Typography component="span" style={{ fontWeight: "normal", fontSize: "1.2rem" ,marginLeft: "0.5rem"}}>
{user?.email}
</Typography>

View File

@ -155,7 +155,9 @@ const RetailDistributor = () => {
<th>ID</th>
<th className="text-start">Trade Name</th>
<th className="text-start">Created On</th>
<th className="text-start">Mapped</th>
<th className="text-start">PrincipleDistributor</th>
<th className="text-start">TerritoryManager</th>
<th className="text-start">SalesCoOrdinator</th>
<th className="text-start">Action</th>
</tr>
</thead>

View File

@ -0,0 +1,256 @@
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import { Box, Typography, Grid, Paper, Avatar, IconButton, Dialog, DialogContent, DialogTitle } from '@mui/material';
import { useParams, useNavigate } from 'react-router-dom';
import { format } from 'date-fns';
import { isAutheticated } from '../../auth';
import CancelIcon from '@mui/icons-material/Cancel'; // Add this import
const SingleRetailDistributor = () => {
const { id } = useParams();
const [retailerDetails, setRetailerDetails] = useState(null);
const [openPopup, setOpenPopup] = useState(false);
const [selectedImage, setSelectedImage] = useState('');
const token = isAutheticated();
const navigate = useNavigate();
useEffect(() => {
const fetchData = async () => {
try {
// Commented out the API call and using dummy data
// const response = await axios.get(`/api/kyc/get-single-kyc/${id}`, {
// headers: {
// 'Access-Control-Allow-Origin': '*',
// Authorization: `Bearer ${token}`,
// 'Content-Type': 'multipart/form-data',
// },
// });
// setRetailerDetails(response.data);
// Dummy data
const dummyData = {
_id: '66a8bb8392d90216331b1f73',
name: 'roshan garg',
trade_name: 'abc',
address: 'abc btm',
state: 'KA',
city: 'Bengaluru',
district: 'benga',
pincode: '124515',
mobile_number: '8516913819',
principal_distributer: { name: 'Distributor Name' },
pan_number: '123456454',
pan_img: { url: 'https://res.cloudinary.com/dslvetard/image/upload/v1722334072/KYC/pan/u3a08xjvrpovfzruedeq.png' },
aadhar_number: '123123123123',
aadhar_img: { url: 'https://res.cloudinary.com/dslvetard/image/upload/v1722334074/KYC/aadhar/ep64tuufileifysol4dx.png' },
gst_number: '121212',
gst_img: { url: 'https://res.cloudinary.com/dslvetard/image/upload/v1722334076/KYC/gst/jqy8uqa6ejntwhc7mq86.png' },
pesticide_license_img: { url: 'https://res.cloudinary.com/dslvetard/image/upload/v1722334077/KYC/pesticide_license/iyznci3iibp50pug8e8p.png' },
fertilizer_license_img: { url: 'https://res.cloudinary.com/dslvetard/image/upload/v1722334080/KYC/fertilizer_license/jnj1r8rzwsbkclarbbch.png' },
selfie_entrance_img: { url: 'https://res.cloudinary.com/dslvetard/image/upload/v1722334082/KYC/selfie_entrance/weri7zhyioi7lqwv3dvg.png' },
status: 'new',
addedBy: { name: 'Added By', uniqueId: 'E123' },
notes: [],
createdAt: '2024-01-01T00:00:00Z',
updatedAt: '2024-01-01T00:00:00Z',
};
setRetailerDetails(dummyData);
} catch (error) {
console.error('Error fetching data: ', error);
}
};
fetchData();
}, [id]);
const handleOpenPopup = (imageUrl) => {
setSelectedImage(imageUrl);
setOpenPopup(true);
};
const handleClosePopup = () => {
setOpenPopup(false);
setSelectedImage('');
};
const handleCancel = () => {
navigate('/retail-distributor');
};
if (!retailerDetails) {
return <Typography>Loading...</Typography>;
}
return (
<Box sx={{ p: 3 }}>
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 3 }}>
<Typography variant="h4">Retailer Details</Typography>
<IconButton
sx={{ color: 'red' }}
onClick={handleCancel}
>
Cancel <CancelIcon />
</IconButton>
</Box>
<Paper sx={{ p: 2, mb: 3 }}>
<Typography variant="h5" gutterBottom>
Retailer Details
</Typography>
<Grid container spacing={2}>
<Grid item xs={6}>
<Typography>
<strong>Trade Name:</strong> {retailerDetails.trade_name}
</Typography>
<Typography>
<strong>Name:</strong> {retailerDetails.name}
</Typography>
<Typography>
<strong>Address:</strong> {retailerDetails.address}
</Typography>
<Typography>
<strong>Town/City:</strong> {retailerDetails.city}
</Typography>
</Grid>
<Grid item xs={6}>
<Typography>
<strong>District:</strong> {retailerDetails.district}
</Typography>
<Typography>
<strong>State:</strong> {retailerDetails.state}
</Typography>
<Typography>
<strong>Pincode:</strong> {retailerDetails.pincode}
</Typography>
<Typography>
<strong>Mobile Number:</strong> {retailerDetails.mobile_number}
</Typography>
<Typography>
<strong>Mapped Principal Distributor:</strong> {retailerDetails.principal_distributer.name}
</Typography>
</Grid>
</Grid>
</Paper>
<Paper sx={{ p: 2, mb: 3 }}>
<Typography variant="h6" gutterBottom>
Documents
</Typography>
<Grid container spacing={2}>
<Grid item xs={6}>
<Typography>
<strong>PAN Number:</strong> {retailerDetails.pan_number}
</Typography>
<Avatar
variant="square"
src={retailerDetails.pan_img.url}
sx={{ width: 100, height: 100, mb: 2, cursor: 'pointer' }}
onClick={() => handleOpenPopup(retailerDetails.pan_img.url)}
/>
<Typography>
<strong>Aadhar Number:</strong> {retailerDetails.aadhar_number}
</Typography>
<Avatar
variant="square"
src={retailerDetails.aadhar_img.url}
sx={{ width: 100, height: 100, mb: 2, cursor: 'pointer' }}
onClick={() => handleOpenPopup(retailerDetails.aadhar_img.url)}
/>
<Typography>
<strong>GST Number:</strong> {retailerDetails.gst_number}
</Typography>
<Avatar
variant="square"
src={retailerDetails.gst_img.url}
sx={{ width: 100, height: 100, mb: 2, cursor: 'pointer' }}
onClick={() => handleOpenPopup(retailerDetails.gst_img.url)}
/>
</Grid>
<Grid item xs={6}>
<Typography>
<strong>Pesticide License:</strong>
</Typography>
<Avatar
variant="square"
src={retailerDetails.pesticide_license_img.url}
sx={{ width: 100, height: 100, mb: 2, cursor: 'pointer' }}
onClick={() => handleOpenPopup(retailerDetails.pesticide_license_img.url)}
/>
<Typography>
<strong>Fertilizer License (optional):</strong>
</Typography>
{retailerDetails.fertilizer_license_img ? (
<Avatar
variant="square"
src={retailerDetails.fertilizer_license_img.url}
sx={{ width: 100, height: 100, mb: 2, cursor: 'pointer' }}
onClick={() => handleOpenPopup(retailerDetails.fertilizer_license_img.url)}
/>
) : (
<Typography>Img not available</Typography>
)}
<Typography>
<strong>Selfie of Entrance Board:</strong>
</Typography>
<Avatar
variant="square"
src={retailerDetails.selfie_entrance_img.url}
sx={{ width: 100, height: 100, mb: 2, cursor: 'pointer' }}
onClick={() => handleOpenPopup(retailerDetails.selfie_entrance_img.url)}
/>
</Grid>
</Grid>
</Paper>
<Paper sx={{ p: 2, mb: 3 }}>
<Typography variant="h6" gutterBottom>
Sales Coordinators/Territory Manager Details
</Typography>
<Grid container spacing={2}>
<Grid item xs={6}>
<Typography>
<strong>Designation:</strong> {retailerDetails.addedBy.name}
</Typography>
<Typography>
<strong>ID:</strong> {retailerDetails.addedBy.uniqueId}
</Typography>
</Grid>
</Grid>
</Paper>
<Dialog open={openPopup} onClose={handleClosePopup} maxWidth="md" fullWidth>
<DialogTitle>
<IconButton
sx={{ position: 'absolute', right: 16, top: 16, color: 'red' }}
onClick={handleClosePopup}
>
<CancelIcon />
</IconButton>
</DialogTitle>
<DialogContent
sx={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
p: 0,
overflow: 'auto',
maxHeight: '80vh',
maxWidth: '80vw',
}}
>
<img
src={selectedImage}
alt="Large Preview"
style={{
maxWidth: '100%',
maxHeight: '100%',
objectFit: 'contain',
}}
/>
</DialogContent>
</Dialog>
</Box>
);
};
export default SingleRetailDistributor;

View File

@ -284,7 +284,7 @@ const EditSalesCoOrdinator = () => {
onClick={handleVerifyMobile}
style={{ display: "block" }}
>
Verify Mobile
Verify Mobile Number
</button>
</div>
</div>

View File

@ -116,7 +116,7 @@ const SalesCoOrdinator = () => {
<div className="col-12">
<div className="page-title-box d-flex align-items-center justify-content-between">
<div style={{ fontSize: "22px" }} className="fw-bold">
SalesCoOrdinators
Sales Coordinators
</div>
<div className="page-title-right">
<Button
@ -131,7 +131,7 @@ const SalesCoOrdinator = () => {
navigate("/salescoordinator/add", { replace: true });
}}
>
Add SalesCoOrdinator
Add Sales Coordinator
</Button>
</div>
</div>
@ -165,10 +165,10 @@ const SalesCoOrdinator = () => {
</div>
</div>
<div className="col-lg-3">
<label>SalesCoOrdinator Name:</label>
<label>Sales Coordinator Name:</label>
<input
type="text"
placeholder="SalesCoOrdinator name"
placeholder="Sales Coordinator name"
className="form-control"
ref={nameRef}
onChange={handleSearchChange}
@ -187,7 +187,7 @@ const SalesCoOrdinator = () => {
/>
</div>
<div className="col-lg-3">
<label>Verify SalesCoOrdinator:</label>
<label>Filter by Verify</label>
<select
className="form-control"
ref={VerifySalesCoOrdinatorRef}
@ -304,7 +304,7 @@ const SalesCoOrdinator = () => {
) : (
<tr>
<td className="text-center" colSpan="6">
No SalesCoOrdinator found!
No Sales Coordinator found!
</td>
</tr>
)}

View File

@ -93,7 +93,7 @@ const AddTerritoryManager = () => {
<div className="row">
<div className="col-12">
<div className="page-title-box d-flex align-items-center justify-content-between">
<h4 className="mb-3">Add Sales Coordinator</h4>
<h4 className="mb-3">Add Territory Manager</h4>
<Button variant="danger" onClick={handleCancel}>
Cancel
</Button>

View File

@ -205,7 +205,7 @@ const EditTerritoryManager = () => {
<div className="row">
<div className="col-12">
<div className="page-title-box d-flex align-items-center justify-content-between">
<h4 className="mb-3">Edit Sales Coordinator</h4>
<h4 className="mb-3">Edit Territory Manager</h4>
<button
onClick={onCancel}
type="button"
@ -284,11 +284,11 @@ const EditTerritoryManager = () => {
onClick={handleVerifyMobile}
style={{ display: "block" }}
>
Verify Mobile
Verify Mobile Number
</button>
</div>
</div>
<div className="mt-4 mb-4">
{/* <div className="mt-4 mb-4">
<button
type="button"
className="btn btn-danger"
@ -296,7 +296,7 @@ const EditTerritoryManager = () => {
>
Change Password
</button>
</div>
</div> */}
</div>
</div>
</div>

View File

@ -187,7 +187,7 @@ const TerritoryManager = () => {
/>
</div>
<div className="col-lg-3">
<label>Verify TerritoryManager:</label>
<label>Filter by Verify:</label>
<select
className="form-control"
ref={VerifyTerritoryManagerRef}

View File

@ -138,14 +138,14 @@ const WidgetsDropdown = ({ users,salescoordinator,territorymanager }) => {
/>
</CCol>
</CRow>
<h4>Sales CoOrdinator</h4>
<h4>Sales Coordinator</h4>
<CRow>
<CCol sm={6} lg={3}>
<CWidgetStatsA
className="mb-4"
color="primary"
value={<>{salescoordinator}</>}
title="Total Sales CoOrdinator"
title="Total Sales Coordinator"
/>
</CCol>
</CRow>