diff --git a/src/component/calendar/Calendar.jsx b/src/component/calendar/Calendar.jsx
index 4524662..eead0d8 100644
--- a/src/component/calendar/Calendar.jsx
+++ b/src/component/calendar/Calendar.jsx
@@ -1,4 +1,4 @@
-import React, { useCallback, useState } from "react";
+import React, { useCallback, useEffect, useState } from "react";
import { useQuery } from '@tanstack/react-query'
import BreadcrumbComBS from "../breadcrumb/BreadcrumbComBS";
@@ -25,14 +25,7 @@ export default function Calendar(){
const category = receievedEvents?.category //EVENT CATEGORIES FROM API
const eventList = receievedEvents?.list //EVENT LIST FROM API
- const events = [
- {id: '1111', title: 'Family Vacation', color: 'fc-event-primary', start: new Date('2025-01-18')},
- {id: '2222', title: 'Meeting In Office', color: 'fc-event-warning', start: new Date('2025-01-19')},
- {id: '3333', title: 'Client Call', color: 'fc-event-danger', start: new Date('2025-01-22')},
- {id: '4444', title: 'Interview', color: 'fc-event-success', start: new Date('2025-01-1')}
- ]
-
- const [dummyEvents, setDummyEvents] = useState(events)
+ const [activeCategory, setActiveCategory] = useState('1')
const [removeAfterDrop, setRemoveAfterDrop] = useState(false)
@@ -47,11 +40,14 @@ export default function Calendar(){
const handleAddNewEvent = () => {
if(newEvent.title && newEvent.color){
const eventToAdd = {...newEvent}
- setDummyEvents(prev => ([...prev, eventToAdd]))
+ setDefaultCategory(prev => ([...prev, eventToAdd]))
setNewEvent({title: '', color: ''})
}
}
+ const handleActiveCategory = (id) => {
+ setActiveCategory(id)
+ }
return(
<>
@@ -79,38 +75,54 @@ export default function Calendar(){
:
<>
-
- {/*
-
- Drag and drop your event or click in the calendar.
-
*/}
- {/* {dummyEvents.map((item, index) => (
-
- handleDragStart({...item})
- }
- >
-
{item.title}
+
+ {/*
+
+ Drag and drop your event or click in the calendar.
+
*/}
+
+ {category.map((item, index) => {
+ let color = item?.cid == '1' ? 'fc-event-success' : item?.cid == '2' ? 'fc-event-danger' : item?.cid == '3' ? 'fc-event-warning' : 'fc-event-primary'
+ return (
+ //
+ // // handleDragStart({...item})
+ // // }
+ // >
+ // {item.description}
+ //
+
+ handleActiveCategory(item.cid)} />
+
- ))} */}
+ )
+ }
+ )}
+
+ {/*
- {/*
- setRemoveAfterDrop(prev => !prev)} />
-
-
*/}
-
+
*/}
+
+ {/*
+ setRemoveAfterDrop(prev => !prev)} />
+
+
*/}
diff --git a/src/component/calendar/EventCalendar.jsx b/src/component/calendar/EventCalendar.jsx
index 73c17b2..7720cdb 100644
--- a/src/component/calendar/EventCalendar.jsx
+++ b/src/component/calendar/EventCalendar.jsx
@@ -6,7 +6,7 @@ import timeGridPlugin from '@fullcalendar/timegrid';
import interactionPlugin from '@fullcalendar/interaction';
import { INITIAL_EVENTS, createEventId } from './event-utils';
-export default function EventCalendar({removeAfterDrop, eventList}) {
+export default function EventCalendar({removeAfterDrop, eventList, activeCategory}) {
const [weekendsVisible, setWeekendsVisible] = useState(true);
const [currentEvents, setCurrentEvents] = useState([]);
@@ -79,9 +79,11 @@ export default function EventCalendar({removeAfterDrop, eventList}) {
}
useEffect(()=>{
- let newEventList = eventList.map(item => ({...item, start: new Date(item?.start)}))
+ // let newEventList = eventList?.map(item => ({...item, start: new Date(item?.start)}))
+ let newEventList = eventList?.filter(item => (Number(item.category) == Number(activeCategory)))?.map(item => ({...item, start: new Date(item?.start)}))
+ console.log('newEventList', newEventList)
setCurrentEvents(newEventList)
- },[eventList])
+ },[activeCategory])
return (
diff --git a/src/css/calendar/_calendar.scss b/src/css/calendar/_calendar.scss
index e114752..f7033c4 100644
--- a/src/css/calendar/_calendar.scss
+++ b/src/css/calendar/_calendar.scss
@@ -31,13 +31,14 @@
.fc-event {
border-radius: 2px;
border: none;
- cursor: move;
+ // cursor: move;
font-size: 13px;
margin: 5px 0px;
padding: 10px 10px 10px 40px;
text-align: left;
position:relative;
&:before {
+ display: none;
content:'';
position:absolute;
width:15px;