attendance and leave update
This commit is contained in:
parent
61db21cf0a
commit
a6fe8988bc
22
src/_nav.js
22
src/_nav.js
@ -38,14 +38,6 @@ const _nav = [
|
|||||||
icon: <CIcon icon={cilSpeedometer} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilSpeedometer} customClassName="nav-icon" />,
|
||||||
group: "",
|
group: "",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
component: CNavItem,
|
|
||||||
name: "Principal Distributor",
|
|
||||||
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
|
||||||
to: "/principal-distributor",
|
|
||||||
group: "PrincipalDistributor",
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
component: CNavGroup,
|
component: CNavGroup,
|
||||||
name: "Product Management",
|
name: "Product Management",
|
||||||
@ -76,6 +68,13 @@ const _nav = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
component: CNavItem,
|
||||||
|
name: "Principal Distributor",
|
||||||
|
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
||||||
|
to: "/principal-distributor",
|
||||||
|
group: "PrincipalDistributor",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Sales Coordinator",
|
name: "Sales Coordinator",
|
||||||
@ -90,6 +89,13 @@ const _nav = [
|
|||||||
to: "/territorymanagers",
|
to: "/territorymanagers",
|
||||||
group: "TerritoryManager",
|
group: "TerritoryManager",
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// component: CNavItem,
|
||||||
|
// name: "retail Distributor",
|
||||||
|
// icon: <CIcon icon={cilCompress} customClassName="nav-icon" />,
|
||||||
|
// to: "/retail-distributor",
|
||||||
|
// group: "RetailDistributor",
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Attendance",
|
name: "Attendance",
|
||||||
|
@ -139,6 +139,7 @@ import AttendanceTerritoryManager from "./views/Attendance/AttendanceTerritoryMa
|
|||||||
import SingleUserAttendance from "./views/Attendance/SingleUserAttendance";
|
import SingleUserAttendance from "./views/Attendance/SingleUserAttendance";
|
||||||
import SingleUserleave from "./views/Leaves/SingleUserLeave";
|
import SingleUserleave from "./views/Leaves/SingleUserLeave";
|
||||||
import LeaveTerritoryManager from "./views/Leaves/LeaveTerritoryManager";
|
import LeaveTerritoryManager from "./views/Leaves/LeaveTerritoryManager";
|
||||||
|
import RetailDistributor from "./views/RetailDistributors/RetailDistributor";
|
||||||
const routes = [
|
const routes = [
|
||||||
//dashboard
|
//dashboard
|
||||||
|
|
||||||
@ -294,6 +295,13 @@ const routes = [
|
|||||||
element: Edittax,
|
element: Edittax,
|
||||||
navName: "Product Management",
|
navName: "Product Management",
|
||||||
},
|
},
|
||||||
|
// RetailDistributor
|
||||||
|
{
|
||||||
|
path: "/retail-distributor",
|
||||||
|
name: "RetailDistributor",
|
||||||
|
element: RetailDistributor,
|
||||||
|
navName: "RetailDistributor",
|
||||||
|
},
|
||||||
//----------------------- End Product Management Routes------------------------------------------------
|
//----------------------- End Product Management Routes------------------------------------------------
|
||||||
|
|
||||||
//Departure
|
//Departure
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import React, { useState, useEffect, useRef } from "react";
|
import React, { useState, useEffect, useRef,useCallback } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import Button from "@material-ui/core/Button";
|
import Button from "@material-ui/core/Button";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { isAutheticated } from "src/auth";
|
import { isAutheticated } from "src/auth";
|
||||||
import swal from "sweetalert";
|
import swal from "sweetalert";
|
||||||
|
import debounce from 'lodash.debounce';
|
||||||
|
|
||||||
const AttendanceSalesCoordinator = () => {
|
const AttendanceSalesCoordinator = () => {
|
||||||
const token = isAutheticated();
|
const token = isAutheticated();
|
||||||
@ -55,7 +56,14 @@ const AttendanceSalesCoordinator = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getSalesCoOrdinatorsData();
|
getSalesCoOrdinatorsData();
|
||||||
}, [success, itemPerPage, currentPage]);
|
}, [success, itemPerPage, currentPage]);
|
||||||
|
const debouncedSearch = useCallback(debounce(() => {
|
||||||
|
setCurrentPage(1);
|
||||||
|
getSalesCoOrdinatorsData();
|
||||||
|
}, 500), []);
|
||||||
|
|
||||||
|
const handleSearchChange = () => {
|
||||||
|
debouncedSearch();
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<div className="main-content">
|
<div className="main-content">
|
||||||
<div className="page-content">
|
<div className="page-content">
|
||||||
@ -119,6 +127,7 @@ const AttendanceSalesCoordinator = () => {
|
|||||||
placeholder="SalesCoOrdinator name"
|
placeholder="SalesCoOrdinator name"
|
||||||
className="form-control"
|
className="form-control"
|
||||||
ref={nameRef}
|
ref={nameRef}
|
||||||
|
onChange={handleSearchChange}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -129,6 +138,7 @@ const AttendanceSalesCoordinator = () => {
|
|||||||
placeholder="Mobile Number"
|
placeholder="Mobile Number"
|
||||||
className="form-control"
|
className="form-control"
|
||||||
ref={mobileRef}
|
ref={mobileRef}
|
||||||
|
onChange={handleSearchChange}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -137,6 +147,7 @@ const AttendanceSalesCoordinator = () => {
|
|||||||
<select
|
<select
|
||||||
className="form-control"
|
className="form-control"
|
||||||
ref={VerifySalesCoOrdinatorRef}
|
ref={VerifySalesCoOrdinatorRef}
|
||||||
|
onChange={handleSearchChange}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
>
|
>
|
||||||
<option value="">----Select----</option>
|
<option value="">----Select----</option>
|
||||||
@ -144,18 +155,6 @@ const AttendanceSalesCoordinator = () => {
|
|||||||
<option value="false">NO</option>
|
<option value="false">NO</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-lg-2">
|
|
||||||
<button
|
|
||||||
className="btn btn-primary ms-1 mt-4"
|
|
||||||
onClick={() => {
|
|
||||||
getSalesCoOrdinatorsData();
|
|
||||||
setCurrentPage(1);
|
|
||||||
}}
|
|
||||||
disabled={loading}
|
|
||||||
>
|
|
||||||
{loading ? "Searching.." : "Filter"}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="table-responsive table-shoot mt-3">
|
<div className="table-responsive table-shoot mt-3">
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import React, { useState, useEffect, useRef } from "react";
|
import React, { useState, useEffect, useRef,useCallback } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import Button from "@material-ui/core/Button";
|
import Button from "@material-ui/core/Button";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { isAutheticated } from "src/auth";
|
import { isAutheticated } from "src/auth";
|
||||||
import swal from "sweetalert";
|
import swal from "sweetalert";
|
||||||
|
import debounce from 'lodash.debounce';
|
||||||
|
|
||||||
const AttendanceTerritoryManager = () => {
|
const AttendanceTerritoryManager = () => {
|
||||||
const token = isAutheticated();
|
const token = isAutheticated();
|
||||||
@ -55,7 +56,14 @@ const AttendanceTerritoryManager = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getterritorymanagerData();
|
getterritorymanagerData();
|
||||||
}, [ itemPerPage, currentPage]);
|
}, [ itemPerPage, currentPage]);
|
||||||
|
const debouncedSearch = useCallback(debounce(() => {
|
||||||
|
setCurrentPage(1);
|
||||||
|
getterritorymanagerData();
|
||||||
|
}, 500), []);
|
||||||
|
|
||||||
|
const handleSearchChange = () => {
|
||||||
|
debouncedSearch();
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<div className="main-content">
|
<div className="main-content">
|
||||||
<div className="page-content">
|
<div className="page-content">
|
||||||
@ -119,6 +127,7 @@ const AttendanceTerritoryManager = () => {
|
|||||||
placeholder="territorymanager name"
|
placeholder="territorymanager name"
|
||||||
className="form-control"
|
className="form-control"
|
||||||
ref={nameRef}
|
ref={nameRef}
|
||||||
|
onChange={handleSearchChange}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -129,6 +138,7 @@ const AttendanceTerritoryManager = () => {
|
|||||||
placeholder="Mobile Number"
|
placeholder="Mobile Number"
|
||||||
className="form-control"
|
className="form-control"
|
||||||
ref={mobileRef}
|
ref={mobileRef}
|
||||||
|
onChange={handleSearchChange}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -137,6 +147,7 @@ const AttendanceTerritoryManager = () => {
|
|||||||
<select
|
<select
|
||||||
className="form-control"
|
className="form-control"
|
||||||
ref={VerifyterritorymanagerRef}
|
ref={VerifyterritorymanagerRef}
|
||||||
|
onChange={handleSearchChange}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
>
|
>
|
||||||
<option value="">----Select----</option>
|
<option value="">----Select----</option>
|
||||||
@ -144,18 +155,6 @@ const AttendanceTerritoryManager = () => {
|
|||||||
<option value="false">NO</option>
|
<option value="false">NO</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-lg-2">
|
|
||||||
<button
|
|
||||||
className="btn btn-primary ms-1 mt-4"
|
|
||||||
onClick={() => {
|
|
||||||
getterritorymanagerData();
|
|
||||||
setCurrentPage(1);
|
|
||||||
}}
|
|
||||||
disabled={loading}
|
|
||||||
>
|
|
||||||
{loading ? "Searching.." : "Filter"}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="table-responsive table-shoot mt-3">
|
<div className="table-responsive table-shoot mt-3">
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import React, { useState, useEffect, useRef } from "react";
|
import React, { useState, useEffect, useRef,useCallback } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import Button from "@material-ui/core/Button";
|
import Button from "@material-ui/core/Button";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { isAutheticated } from "src/auth";
|
import { isAutheticated } from "src/auth";
|
||||||
import swal from "sweetalert";
|
import swal from "sweetalert";
|
||||||
|
import debounce from 'lodash.debounce';
|
||||||
|
|
||||||
const LeaveSalesCoordinator = () => {
|
const LeaveSalesCoordinator = () => {
|
||||||
const token = isAutheticated();
|
const token = isAutheticated();
|
||||||
@ -53,9 +54,13 @@ const LeaveSalesCoordinator = () => {
|
|||||||
getSalesCoOrdinatorsData();
|
getSalesCoOrdinatorsData();
|
||||||
}, [currentPage, itemPerPage]);
|
}, [currentPage, itemPerPage]);
|
||||||
|
|
||||||
const handleFilter = () => {
|
const debouncedSearch = useCallback(debounce(() => {
|
||||||
setCurrentPage(1);
|
setCurrentPage(1);
|
||||||
getSalesCoOrdinatorsData();
|
getSalesCoOrdinatorsData();
|
||||||
|
}, 500), []);
|
||||||
|
|
||||||
|
const handleSearchChange = () => {
|
||||||
|
debouncedSearch();
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -121,6 +126,7 @@ const LeaveSalesCoordinator = () => {
|
|||||||
placeholder="Sales Coordinator name"
|
placeholder="Sales Coordinator name"
|
||||||
className="form-control"
|
className="form-control"
|
||||||
ref={nameRef}
|
ref={nameRef}
|
||||||
|
onChange={handleSearchChange}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -131,6 +137,7 @@ const LeaveSalesCoordinator = () => {
|
|||||||
placeholder="Mobile Number"
|
placeholder="Mobile Number"
|
||||||
className="form-control"
|
className="form-control"
|
||||||
ref={mobileRef}
|
ref={mobileRef}
|
||||||
|
onChange={handleSearchChange}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -139,6 +146,7 @@ const LeaveSalesCoordinator = () => {
|
|||||||
<select
|
<select
|
||||||
className="form-control"
|
className="form-control"
|
||||||
ref={verifyRef}
|
ref={verifyRef}
|
||||||
|
onChange={handleSearchChange}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
>
|
>
|
||||||
<option value="">----Select----</option>
|
<option value="">----Select----</option>
|
||||||
@ -146,15 +154,6 @@ const LeaveSalesCoordinator = () => {
|
|||||||
<option value="false">NO</option>
|
<option value="false">NO</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-lg-2">
|
|
||||||
<button
|
|
||||||
className="btn btn-primary ms-1 mt-4"
|
|
||||||
onClick={handleFilter}
|
|
||||||
disabled={loading}
|
|
||||||
>
|
|
||||||
{loading ? "Searching.." : "Filter"}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="table-responsive table-shoot mt-3">
|
<div className="table-responsive table-shoot mt-3">
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import React, { useState, useEffect, useRef } from "react";
|
import React, { useState, useEffect, useRef,useCallback } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import Button from "@material-ui/core/Button";
|
import Button from "@material-ui/core/Button";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { isAutheticated } from "src/auth";
|
import { isAutheticated } from "src/auth";
|
||||||
import swal from "sweetalert";
|
import swal from "sweetalert";
|
||||||
|
import debounce from 'lodash.debounce';
|
||||||
|
|
||||||
const LeaveTerritoryManager = () => {
|
const LeaveTerritoryManager = () => {
|
||||||
const token = isAutheticated();
|
const token = isAutheticated();
|
||||||
@ -53,9 +54,13 @@ const LeaveTerritoryManager = () => {
|
|||||||
getterritorymanagersData();
|
getterritorymanagersData();
|
||||||
}, [currentPage, itemPerPage]);
|
}, [currentPage, itemPerPage]);
|
||||||
|
|
||||||
const handleFilter = () => {
|
const debouncedSearch = useCallback(debounce(() => {
|
||||||
setCurrentPage(1);
|
setCurrentPage(1);
|
||||||
getterritorymanagersData();
|
getterritorymanagerData();
|
||||||
|
}, 500), []);
|
||||||
|
|
||||||
|
const handleSearchChange = () => {
|
||||||
|
debouncedSearch();
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -121,6 +126,7 @@ const LeaveTerritoryManager = () => {
|
|||||||
placeholder="Territory Manager name"
|
placeholder="Territory Manager name"
|
||||||
className="form-control"
|
className="form-control"
|
||||||
ref={nameRef}
|
ref={nameRef}
|
||||||
|
onChange={handleSearchChange}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -131,6 +137,7 @@ const LeaveTerritoryManager = () => {
|
|||||||
placeholder="Mobile Number"
|
placeholder="Mobile Number"
|
||||||
className="form-control"
|
className="form-control"
|
||||||
ref={mobileRef}
|
ref={mobileRef}
|
||||||
|
onChange={handleSearchChange}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -139,6 +146,7 @@ const LeaveTerritoryManager = () => {
|
|||||||
<select
|
<select
|
||||||
className="form-control"
|
className="form-control"
|
||||||
ref={verifyRef}
|
ref={verifyRef}
|
||||||
|
onChange={handleSearchChange}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
>
|
>
|
||||||
<option value="">----Select----</option>
|
<option value="">----Select----</option>
|
||||||
@ -146,15 +154,6 @@ const LeaveTerritoryManager = () => {
|
|||||||
<option value="false">NO</option>
|
<option value="false">NO</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-lg-2">
|
|
||||||
<button
|
|
||||||
className="btn btn-primary ms-1 mt-4"
|
|
||||||
onClick={handleFilter}
|
|
||||||
disabled={loading}
|
|
||||||
>
|
|
||||||
{loading ? "Searching.." : "Filter"}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="table-responsive table-shoot mt-3">
|
<div className="table-responsive table-shoot mt-3">
|
||||||
|
295
src/views/RetailDistributors/RetailDistributor.js
Normal file
295
src/views/RetailDistributors/RetailDistributor.js
Normal file
@ -0,0 +1,295 @@
|
|||||||
|
import React, { useState, useEffect, useRef, useCallback } from "react";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
import axios from "axios";
|
||||||
|
import Button from "@material-ui/core/Button";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
import { isAutheticated } from "src/auth";
|
||||||
|
import swal from "sweetalert";
|
||||||
|
import debounce from 'lodash.debounce';
|
||||||
|
|
||||||
|
const RetailDistributor = () => {
|
||||||
|
const token = isAutheticated();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [success, setSuccess] = useState(true);
|
||||||
|
const [retailDistributorsData, setRetailDistributorsData] = useState([]);
|
||||||
|
|
||||||
|
const nameRef = useRef();
|
||||||
|
const mobileRef = useRef();
|
||||||
|
const VerifyRetailDistributorRef = useRef();
|
||||||
|
|
||||||
|
const [currentPage, setCurrentPage] = useState(1);
|
||||||
|
const [itemPerPage, setItemPerPage] = useState(10);
|
||||||
|
const [totalData, setTotalData] = useState(0);
|
||||||
|
|
||||||
|
const getRetailDistributorsData = async () => {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
const res = await axios.get(`/api/retaildistributor/getAll/`, {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
page: currentPage,
|
||||||
|
show: itemPerPage,
|
||||||
|
name: nameRef.current.value,
|
||||||
|
mobileNumber: mobileRef.current.value,
|
||||||
|
isVerified: VerifyRetailDistributorRef.current.value,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
setRetailDistributorsData(res.data?.retailDistributors);
|
||||||
|
setTotalData(res.data?.total_data);
|
||||||
|
} catch (err) {
|
||||||
|
const msg = err?.response?.data?.message || "Something went wrong!";
|
||||||
|
swal({
|
||||||
|
title: "Error",
|
||||||
|
text: msg,
|
||||||
|
icon: "error",
|
||||||
|
button: "Retry",
|
||||||
|
dangerMode: true,
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getRetailDistributorsData();
|
||||||
|
}, [success, itemPerPage, currentPage]);
|
||||||
|
|
||||||
|
const debouncedSearch = useCallback(debounce(() => {
|
||||||
|
setCurrentPage(1);
|
||||||
|
getRetailDistributorsData();
|
||||||
|
}, 500), []);
|
||||||
|
|
||||||
|
const handleSearchChange = () => {
|
||||||
|
debouncedSearch();
|
||||||
|
};
|
||||||
|
|
||||||
|
const totalPages = Math.ceil(totalData / itemPerPage);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="main-content">
|
||||||
|
<div className="page-content">
|
||||||
|
<div className="container-fluid">
|
||||||
|
<div className="row">
|
||||||
|
<div className="col-12">
|
||||||
|
<div className="page-title-box d-flex align-items-center justify-content-between">
|
||||||
|
<div style={{ fontSize: "22px" }} className="fw-bold">
|
||||||
|
Retail Distributors
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="row">
|
||||||
|
<div className="col-lg-12">
|
||||||
|
<div className="card">
|
||||||
|
<div className="card-body">
|
||||||
|
<div className="row ml-0 mr-0 mb-10">
|
||||||
|
<div className="col-lg-1">
|
||||||
|
<div className="dataTables_length">
|
||||||
|
<label className="w-100">
|
||||||
|
Show
|
||||||
|
<select
|
||||||
|
onChange={(e) => {
|
||||||
|
setItemPerPage(e.target.value);
|
||||||
|
setCurrentPage(1);
|
||||||
|
}}
|
||||||
|
className="form-control"
|
||||||
|
disabled={loading}
|
||||||
|
>
|
||||||
|
<option value="10">10</option>
|
||||||
|
<option value="25">25</option>
|
||||||
|
<option value="50">50</option>
|
||||||
|
<option value="100">100</option>
|
||||||
|
</select>
|
||||||
|
entries
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="col-lg-3">
|
||||||
|
<label>Retail Distributor Name:</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
placeholder="Retail Distributor name"
|
||||||
|
className="form-control"
|
||||||
|
ref={nameRef}
|
||||||
|
onChange={handleSearchChange}
|
||||||
|
disabled={loading}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="col-lg-3">
|
||||||
|
<label>Mobile Number:</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
placeholder="Mobile Number"
|
||||||
|
className="form-control"
|
||||||
|
ref={mobileRef}
|
||||||
|
onChange={handleSearchChange}
|
||||||
|
disabled={loading}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="col-lg-3">
|
||||||
|
<label>Verify Retail Distributor:</label>
|
||||||
|
<select
|
||||||
|
className="form-control"
|
||||||
|
ref={VerifyRetailDistributorRef}
|
||||||
|
onChange={handleSearchChange}
|
||||||
|
disabled={loading}
|
||||||
|
>
|
||||||
|
<option value="">----Select----</option>
|
||||||
|
<option value="true">YES</option>
|
||||||
|
<option value="false">NO</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="table-responsive table-shoot mt-3">
|
||||||
|
<table className="table table-centered table-nowrap">
|
||||||
|
<thead
|
||||||
|
className="thead-light"
|
||||||
|
style={{ background: "#ecdddd" }}
|
||||||
|
>
|
||||||
|
<tr>
|
||||||
|
<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">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
{loading ? (
|
||||||
|
<tr>
|
||||||
|
<td className="text-center" colSpan="5">
|
||||||
|
Loading...
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
) : retailDistributorsData?.length > 0 ? (
|
||||||
|
retailDistributorsData?.map((retailDistributor, i) => {
|
||||||
|
return (
|
||||||
|
<tr key={i}>
|
||||||
|
<td className="text-start">
|
||||||
|
{retailDistributor?.id}
|
||||||
|
</td>
|
||||||
|
<td className="text-start">
|
||||||
|
{retailDistributor?.tradeName}
|
||||||
|
</td>
|
||||||
|
<td className="text-start">
|
||||||
|
{new Date(
|
||||||
|
retailDistributor.createdAt
|
||||||
|
).toLocaleString("en-IN", {
|
||||||
|
weekday: "short",
|
||||||
|
month: "short",
|
||||||
|
day: "numeric",
|
||||||
|
year: "numeric",
|
||||||
|
hour: "numeric",
|
||||||
|
minute: "numeric",
|
||||||
|
hour12: true,
|
||||||
|
})}
|
||||||
|
</td>
|
||||||
|
<td className="text-start">
|
||||||
|
<div>
|
||||||
|
<div>Principal Distributor: {retailDistributor.principalDistributor || 'N/A'}</div>
|
||||||
|
<div>Territory Manager: {retailDistributor.territoryManager || 'N/A'}</div>
|
||||||
|
<div>Sales Coordinator: {retailDistributor.salesCoordinator || 'N/A'}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td className="text-start">
|
||||||
|
<Link
|
||||||
|
to={`/retaildistributor/view/${retailDistributor._id}`}
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
style={{
|
||||||
|
color: "white",
|
||||||
|
}}
|
||||||
|
type="button"
|
||||||
|
className="btn btn-info btn-sm waves-effect waves-light btn-table ml-2"
|
||||||
|
>
|
||||||
|
View
|
||||||
|
</button>
|
||||||
|
</Link>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
) : (
|
||||||
|
<tr>
|
||||||
|
<td className="text-center" colSpan="5">
|
||||||
|
No Retail Distributor found!
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div className="row mt-20">
|
||||||
|
<div className="col-sm-12 col-md-6 mb-20">
|
||||||
|
<div
|
||||||
|
className="dataTables_info"
|
||||||
|
id="datatable_info"
|
||||||
|
role="status"
|
||||||
|
aria-live="polite"
|
||||||
|
>
|
||||||
|
Showing {currentPage * itemPerPage - itemPerPage + 1} to{" "}
|
||||||
|
{Math.min(currentPage * itemPerPage, totalData)} of{" "}
|
||||||
|
{totalData} entries
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="col-sm-12 col-md-6">
|
||||||
|
<div className="d-flex">
|
||||||
|
<ul className="pagination ms-auto">
|
||||||
|
<li
|
||||||
|
className={
|
||||||
|
currentPage === 1
|
||||||
|
? "paginate_button page-item previous disabled"
|
||||||
|
: "paginate_button page-item previous"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="page-link"
|
||||||
|
onClick={() =>
|
||||||
|
setCurrentPage((prev) =>
|
||||||
|
prev > 1 ? prev - 1 : prev
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Previous
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
className={
|
||||||
|
currentPage === totalPages
|
||||||
|
? "paginate_button page-item next disabled"
|
||||||
|
: "paginate_button page-item next"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="page-link"
|
||||||
|
onClick={() =>
|
||||||
|
setCurrentPage((prev) =>
|
||||||
|
prev < totalPages ? prev + 1 : prev
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Next
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default RetailDistributor;
|
Loading…
Reference in New Issue
Block a user