Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
RHamzaZulfiqarJ committed Sep 28, 2023
2 parents a9b3448 + c710754 commit 95b2b49
Show file tree
Hide file tree
Showing 20 changed files with 306 additions and 263 deletions.
1 change: 0 additions & 1 deletion client/src/Pages/DashBoard/EventCalendar/EventCalendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const EventCalendar = () => {

const dispatch = useDispatch()
const { events } = useSelector(state => state.event)
console.log(events)
const [selectedEvent, setSelectedEvent] = useState(null)
const [showViewModal, setShowViewModal] = useState(false)
const [showCreateModal, setShowCreateModal] = useState(false)
Expand Down
1 change: 0 additions & 1 deletion client/src/Pages/DashBoard/EventCalendar/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const ViewEvent = ({ open, setOpen, event, setOpenDeleteModal, setOpenUpdateModa

//////////////////////////////////// Variables /////////////////////////////////////
const dispatch = useDispatch();
console.log(event)

//////////////////////////////////// States ////////////////////////////////////////

Expand Down
23 changes: 13 additions & 10 deletions client/src/Pages/Leads/Kanban/Board.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ import { Add } from "@mui/icons-material";
import { Droppable } from "react-beautiful-dnd";

const Board = ({ leads, title, _id }) => {

console.log(title, ' ', leads, ' ', _id)

return (
<div
className={`bg-[#ebf2f5] border-t-[2px] ${title == "Successful" ? "border-t-green-500" : ""}${
title == "Remaining" ? "border-t-sky-400" : ""
} ${title == "Declined" ? "border-t-red-400" : ""} ${
title == "Under Process" ? "border-t-yellow-500" : ""
} ${
title == "Unsuccessful" ? "border-t-orange-500" : ""
} rounded-[10px] min-w-[260px] -[270px] h-[700px]`}>
className={`bg-[#ebf2f5] border-t-[2px]
${title == "Successful" ? "border-t-green-500" : ""}
${title == "Remaining" ? "border-t-sky-400" : ""}
${title == "Declined" ? "border-t-red-400" : ""}
${title == "Under Process" ? "border-t-yellow-500" : ""}
${title == "Unsuccessful" ? "border-t-orange-500" : ""}
rounded-[10px] min-w-[260px] -[270px] h-[700px]`}
>
<div className="flex justify-between items-center h-[32px] px-[4px] ">
<h4 className="text-[16px] text-primary-gray ">{title}</h4>
<button className="w-[18px] h-[18px] rounded-full bg-primary-gray text-white flex justify-center items-center ">
Expand All @@ -26,9 +30,8 @@ const Board = ({ leads, title, _id }) => {
<div
ref={provided.innerRef}
{...provided.droppableProps}
className={`relative flex-1 flex flex-col gap-[1rem] p-[12px] h-full ${
snapshot.isDraggingOver ? "bg-gray-300" : ""
}`}>
className={`relative flex-1 flex flex-col gap-[1rem] p-[12px] h-full ${snapshot.isDraggingOver ? "bg-gray-300" : ""}`}
>
{leads.map((lead, index) => (
<React.Fragment key={index}>
<KanbanLead key={lead._id} lead={lead} index={index} />
Expand Down
70 changes: 49 additions & 21 deletions client/src/Pages/Leads/Kanban/Kanban.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,37 @@ const Kanban = ({ options, setOptions }) => {
const archivedLeads = leads.filter(lead => lead.isArchived)
const unarchivedLeads = leads.filter(lead => !lead.isArchived)
let initialFilteredLeadsState = {
successful: [],
unsuccessful: [],
underProcess: [],
declined: [],
remaining: [],
closedLost: [],
followedUpCall: [],
contactedCallAttempt: [],
contactedCall: [],
followedUpEmail: [],
contactedEmail: [],
new: [],
meetingDone: [],
closedWon: [],
meetingAttempt: [],
};
const statusEnum = ["successful", "unsuccessful", "underProcess", "declined", "remaining"];

const statuses = [
'closedLost',
'followedUpCall',
'contactedCallAttempt',
'contactedCall',
'followedUpEmail',
'contactedEmail',
'new',
'meetingDone',
'closedWon',
'meetingAttempt',
]
/////////////////////////////////////// STATE ////////////////////////////////////////
let [filteredLeads, setFilteredLeads] = useState(initialFilteredLeadsState);
const { successful, unsuccessful, underProcess, declined, remaining } = filteredLeads;
const { closedLost, followedUpCall, contactedCallAttempt, contactedCall, followedUpEmail, contactedEmail, new: newLeads, meetingDone, closedWon, meetingAttempt, } = filteredLeads;

/////////////////////////////////////// USE EFFECT /////////////////////////////////////
useEffect(() => {
statusEnum.forEach(
statuses.forEach(
(status) =>
(filteredLeads[status] = (options.showArchivedLeads ? archivedLeads : unarchivedLeads).filter(
(lead) => lead.status == status
Expand Down Expand Up @@ -57,17 +73,25 @@ const Kanban = ({ options, setOptions }) => {
const getSourceColumn = (droppableId) => {
switch (droppableId) {
case "1":
return { leads: newLeads, title: "new" };
return { leads: closedLost, title: "closedLost" };
case "2":
return { leads: successful, title: "successful" };
return { leads: followedUpCall, title: "followedUpCall" };
case "3":
return { leads: unsuccessful, title: "unsuccessful" };
return { leads: contactedCallAttempt, title: "contactedCallAttempt" };
case "4":
return { leads: underProcess, title: "underProcess" };
return { leads: contactedCall, title: "contactedCall" };
case "5":
return { leads: remaining, title: "remaining" };
return { leads: followedUpEmail, title: "followedUpEmail" };
case "6":
return { leads: declined, title: "declined" };
return { leads: contactedEmail, title: "contactedEmail" };
case "7":
return { leads: newLeads, title: "new" };
case "8":
return { leads: meetingDone, title: "meetingDone" };
case "9":
return { leads: closedWon, title: "closedWon" };
case "10":
return { leads: meetingAttempt, title: "meetingAttempt" };
default:
return newLeads;
}
Expand All @@ -91,17 +115,21 @@ const Kanban = ({ options, setOptions }) => {
) : (
<DragDropContext onDragEnd={handleDragEnd}>
<div className="flex justify-start gap-[1rem] w-full min-h-[30rem] h-fit pb-[1rem] overflow-x-scroll ">
{/* <Board leads={newLeads} title='New' _id='1' /> */}
<Board leads={successful} title="Successful" _id="2" />
<Board leads={unsuccessful} title="Unsuccessful" _id="3" />
<Board leads={underProcess} title="Under Process" _id="4" />
<Board leads={remaining} title="Remaining" _id="5" />
<Board leads={declined} title="Declined" _id="6" />
<Board leads={closedLost} title='closedLost' _id='1' />
<Board leads={followedUpCall} title="followedUpCall" _id="2" />
<Board leads={contactedCallAttempt} title="contactedCallAttempt" _id="3" />
<Board leads={contactedCall} title="Under contactedCall" _id="4" />
<Board leads={followedUpEmail} title="followedUpEmail" _id="5" />
<Board leads={contactedEmail} title="contactedEmail" _id="6" />
<Board leads={newLeads} title="new" _id="7" />
<Board leads={meetingDone} title="Under meetingDone" _id="8" />
<Board leads={closedWon} title="closedWon" _id="9" />
<Board leads={meetingAttempt} title="meetingAttempt" _id="10" />
</div>
</DragDropContext>
)}
</div>
);
};

export default Kanban;
export default Kanban;
1 change: 0 additions & 1 deletion client/src/Pages/Leads/Kanban/KanbanLead.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { useDispatch } from 'react-redux';


const Lead = ({ lead, index, }) => {

const dispatch = useDispatch()

const handleCopyLink = () => {
Expand Down
2 changes: 1 addition & 1 deletion client/src/Pages/Leads/Lead.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const Lead = ({ open, setOpen, leadId, scroll }) => {
<div className="bg-[#d1dfe4] px-2 py-1 w-full rounded-lg">
<div className="flex items-center gap-2">
<PiIdentificationCard className="text-gray-700" /> CNIC :{" "}
<span className="text-black">{currentLead?.clientId?.cnic}</span>
<span className="text-black">{currentLead?.clientId?.CNIC}</span>
</div>
</div>
<div className="bg-[#d1dfe4] px-2 py-1 w-full rounded-lg">
Expand Down
7 changes: 3 additions & 4 deletions client/src/Pages/Leads/Leads.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -270,19 +270,18 @@ function Leads({ type, showSidebar }) {
showEmployeeLeads: false,
showArchivedLeads: false,
});

console.log(leads)
////////////////////////////////////// USE EFFECTS //////////////////////////////
useEffect(() => {
// dispatch(getLeads()); // only find my leads (of one who is logged in)
dispatch(getEmployeeLeads()); // only find my leads (of one who is logged in)
// dispatch(getLeads());
dispatch(getEmployeeLeads()); // only find my leads (of one who is logged in)
}, []);
useEffect(() => {
if (!isFiltered) {
dispatch(getLeadsReducer(allLeads))
}
}, [isFiltered])

console.log('this')
////////////////////////////////////// FUNCTION //////////////////////////////
const handleOpenAttachmentModal = (leadId) => {
setSelectedLeadId(leadId);
Expand Down
1 change: 0 additions & 1 deletion client/src/Pages/Users/CreateEmployee.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const CreateUser = ({ open, setOpen, scroll }) => {
const handleSubmit = (e) => {
e.preventDefault();
const { firstName, lastName, username, city, email, password, CNIC, phone, officialNumber, gender, martialStatus, salaryType, activeStatus, } = employeeData
console.log(firstName, lastName, username, city, email, password, CNIC, phone, officialNumber, gender, martialStatus, salaryType, activeStatus)
if (!firstName || !lastName || !username || !city || !email || !password || !CNIC || !phone || !officialNumber || !gender || !martialStatus || !salaryType || !activeStatus)
return alert("Make sure to provide all the fields")
dispatch(createEmployee(employeeData, setOpen));
Expand Down
2 changes: 1 addition & 1 deletion client/src/Pages/Users/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const EditModal = ({ open, setOpen }) => {
city: "",
email: "",
password: "",
cnic: "",
CNIC: "",
phone: "",
officialNumber: "",
gender: "male",
Expand Down
2 changes: 1 addition & 1 deletion client/src/Pages/Users/User.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const User = ({ open, setOpen }) => {
// </div>
// <div className="flex flex-col">
// <span className='text-[14px] text-gray-900 ' >CNIC:</span>
// <span className='text-gray-500 text-[16px] ' >{user?.cnic}</span>
// <span className='text-gray-500 text-[16px] ' >{user?.CNIC}</span>
// </div>
// </div>

Expand Down
Loading

0 comments on commit 95b2b49

Please sign in to comment.