import moment from "moment" import { useEffect } from "react" import { useDispatch, useSelector } from "react-redux" import TitleCard from "../../components/Cards/TitleCard" import { openModal } from "../common/modalSlice" import { deleteLead, getLeadsContent } from "./leadSlice" import { CONFIRMATION_MODAL_CLOSE_TYPES, MODAL_BODY_TYPES } from '../../utils/globalConstantUtil' import TrashIcon from '@heroicons/react/24/outline/TrashIcon' import { showNotification } from '../common/headerSlice' const TopSideButtons = () => { const dispatch = useDispatch() const openAddNewLeadModal = () => { dispatch(openModal({title : "Add New Lead", bodyType : MODAL_BODY_TYPES.LEAD_ADD_NEW})) } return(
) } function Leads(){ const {leads } = useSelector(state => state.lead) const dispatch = useDispatch() useEffect(() => { dispatch(getLeadsContent()) }, []) const getDummyStatus = (index) => { if(index % 5 === 0)return
Not Interested
else if(index % 5 === 1)return
In Progress
else if(index % 5 === 2)return
Sold
else if(index % 5 === 3)return
Need Followup
else return
Open
} const deleteCurrentLead = (index) => { dispatch(openModal({title : "Confirmation", bodyType : MODAL_BODY_TYPES.CONFIRMATION, extraObject : { message : `Are you sure you want to delete this lead?`, type : CONFIRMATION_MODAL_CLOSE_TYPES.LEAD_DELETE, index}})) } return( <> }> {/* Leads List in table format loaded from slice after api call */}
{ leads.map((l, k) => { return( ) }) }
Name Email Id Created At Status Assigned To
Avatar
{l.first_name}
{l.last_name}
{l.email} {moment(new Date()).add(-5*(k+2), 'days').format("DD MMM YY")} {getDummyStatus(k)} {l.last_name}
) } export default Leads