diff --git a/packages/plugin-meetings-api/src/graphql/resolvers/queries/meeting.ts b/packages/plugin-meetings-api/src/graphql/resolvers/queries/meeting.ts index 89e510c3f7..201a476831 100644 --- a/packages/plugin-meetings-api/src/graphql/resolvers/queries/meeting.ts +++ b/packages/plugin-meetings-api/src/graphql/resolvers/queries/meeting.ts @@ -20,7 +20,7 @@ const generateFilter = async (params, user) => { participantIds.length > 0 && !participantIds.includes('') ) { - selector.participantIds = { $in: participantIds }; + selector.participantIds = { $in: [user._id, ...participantIds] }; } if (userId) { selector.createdBy = userId; diff --git a/packages/plugin-meetings-api/src/models/Meetings.ts b/packages/plugin-meetings-api/src/models/Meetings.ts index 63fc1f0099..56370e0147 100644 --- a/packages/plugin-meetings-api/src/models/Meetings.ts +++ b/packages/plugin-meetings-api/src/models/Meetings.ts @@ -72,7 +72,8 @@ export const loadMeetingClass = (model: IModels) => { createdBy: user._id }); if (result) { - return model.Meetings.deleteOne({ _id }); + await model.Meetings.deleteOne({ _id }); + return await model.Topics.deleteMany({ meetingId: _id }); } throw new Error('You cannot remove '); } diff --git a/packages/plugin-meetings-ui/src/components/List.tsx b/packages/plugin-meetings-ui/src/components/List.tsx index af3b75d350..9fbf196f48 100755 --- a/packages/plugin-meetings-ui/src/components/List.tsx +++ b/packages/plugin-meetings-ui/src/components/List.tsx @@ -25,7 +25,6 @@ type Props = { refetchQueries?: any; currentUser: IUser; meetingQuery?: MeetingsQueryResponse; - participantUsers: IUser[]; }; function List(props: Props) { @@ -35,8 +34,7 @@ function List(props: Props) { queryParams, history, currentUser, - meetingQuery, - participantUsers + meetingQuery } = props; const { meetingId, searchValue } = queryParams; @@ -76,6 +74,7 @@ function List(props: Props) { queryParams={queryParams} meetings={meetings} loading={loading} + currentUser={currentUser} /> ); break; diff --git a/packages/plugin-meetings-ui/src/components/myCalendar/ChooseOwnerForm.tsx b/packages/plugin-meetings-ui/src/components/myCalendar/ChooseOwnerForm.tsx index 4c5580a970..202225fc3c 100644 --- a/packages/plugin-meetings-ui/src/components/myCalendar/ChooseOwnerForm.tsx +++ b/packages/plugin-meetings-ui/src/components/myCalendar/ChooseOwnerForm.tsx @@ -3,14 +3,16 @@ import { Button, ControlLabel, Form, SelectTeamMembers } from '@erxes/ui/src'; import FormGroup from '@erxes/ui/src/components/form/Group'; import { ModalFooter } from '@erxes/ui/src/styles/main'; import { IButtonMutateProps } from '@erxes/ui/src/types'; +import { IUser } from '@erxes/ui/src/auth/types'; type Props = { closeModal: () => void; pinnedUserIds: string[]; renderButton: (props: IButtonMutateProps) => JSX.Element; + currentUser: IUser; }; const ChooseOwnerForm = (props: Props) => { - const { pinnedUserIds } = props; + const { pinnedUserIds, currentUser } = props; const [pinnedIds, setPinnedUserIds] = useState([pinnedUserIds] || []); @@ -43,7 +45,7 @@ const ChooseOwnerForm = (props: Props) => { { - const { queryParams, meetings, loading, pinnedUsers } = props; + const { queryParams, meetings, loading, pinnedUsers, currentUser } = props; const { meetingId } = queryParams; const [filteredMeeting, setFilteredMeeting] = useState(meetings); const { pinnedUsersInfo = [] } = pinnedUsers; @@ -192,6 +193,7 @@ export const SideBar = (props: Props) => { ); }; diff --git a/packages/plugin-meetings-ui/src/components/myCalendar/meeting/Calendar.tsx b/packages/plugin-meetings-ui/src/components/myCalendar/meeting/Calendar.tsx index cabaf0cfa6..3ad3918437 100644 --- a/packages/plugin-meetings-ui/src/components/myCalendar/meeting/Calendar.tsx +++ b/packages/plugin-meetings-ui/src/components/myCalendar/meeting/Calendar.tsx @@ -94,25 +94,28 @@ function CalendarComponent(props: Props) { return ( <> - +
+ +
setShowModal(false)} size="lg"> Create Meeting diff --git a/packages/plugin-meetings-ui/src/components/myCalendar/meeting/Detail.tsx b/packages/plugin-meetings-ui/src/components/myCalendar/meeting/Detail.tsx index bfe96b5b12..0b96c0adb1 100644 --- a/packages/plugin-meetings-ui/src/components/myCalendar/meeting/Detail.tsx +++ b/packages/plugin-meetings-ui/src/components/myCalendar/meeting/Detail.tsx @@ -123,8 +123,8 @@ export const MeetingDetail = (props: Props) => { Team members:{' '} {meetingDetail?.participantUser?.map((user, index) => { if (index != meetingDetail?.participantUser?.length - 1) - return <>{user.details?.fullName},; - return <>{user.details?.fullName}; + return
{user.details?.fullName},
; + return
{user.details?.fullName}
; })} diff --git a/packages/plugin-meetings-ui/src/components/myMeetings/Row.tsx b/packages/plugin-meetings-ui/src/components/myMeetings/Row.tsx index 4d6367877e..66a263ac40 100644 --- a/packages/plugin-meetings-ui/src/components/myMeetings/Row.tsx +++ b/packages/plugin-meetings-ui/src/components/myMeetings/Row.tsx @@ -33,12 +33,16 @@ export const Row = (props: Props) => { const content = props =>
; + const onTrClick = () => { + history.push(`/meetings/myCalendar?meetingId=${meeting._id}`); + }; + + const onClick = e => { + e.stopPropagation(); + }; + return ( - { - history.push(`/meetings/myCalendar?meetingId=${meeting._id}`); - }} - > + {meeting.title} {meeting.createdUser?.username || ''} {meeting.createdAt} @@ -51,7 +55,7 @@ export const Row = (props: Props) => { {meeting.status} - + { const { history, queryParams } = props; - const [companyId, setCompanyId] = useState(''); - const [userId, setUserId] = useState(''); + const [companyId, setCompanyId] = useState(queryParams?.companyId || ''); + const [userId, setUserId] = useState(queryParams?.ownerId || ''); const [createdAtFrom, setCreatedForm] = useState( queryParams.createdAtFrom || '' ); diff --git a/packages/plugin-meetings-ui/src/containers/myCalendar/ChooseOwnerForm.tsx b/packages/plugin-meetings-ui/src/containers/myCalendar/ChooseOwnerForm.tsx index 58d6793f99..01d491a361 100644 --- a/packages/plugin-meetings-ui/src/containers/myCalendar/ChooseOwnerForm.tsx +++ b/packages/plugin-meetings-ui/src/containers/myCalendar/ChooseOwnerForm.tsx @@ -4,10 +4,12 @@ import { mutations } from '../../graphql'; import ChooseOwnerForm from '../../components/myCalendar/ChooseOwnerForm'; import { IButtonMutateProps } from '@erxes/ui/src/types'; import { ButtonMutate } from '@erxes/ui/src'; +import { IUser } from '@erxes/ui/src/auth/types'; type Props = { closeModal: () => void; pinnedUserIds: string[]; + currentUser: IUser; }; export const ChooseOwnerFormContainer = (props: Props) => { const renderButton = ({ diff --git a/packages/plugin-meetings-ui/src/containers/myCalendar/SideBar.tsx b/packages/plugin-meetings-ui/src/containers/myCalendar/SideBar.tsx index 1a184fd0d6..bbf0e2256d 100644 --- a/packages/plugin-meetings-ui/src/containers/myCalendar/SideBar.tsx +++ b/packages/plugin-meetings-ui/src/containers/myCalendar/SideBar.tsx @@ -5,6 +5,7 @@ import { gql, useQuery } from '@apollo/client'; import { queries as userQueries } from '@erxes/ui/src/team/graphql'; import { Spinner } from '@erxes/ui/src/components'; import { queries } from '../../graphql'; +import { IUser } from '@erxes/ui/src/auth/types'; type Props = { history: any; @@ -12,6 +13,7 @@ type Props = { queryParams: any; meetings: IMeeting[]; loading: boolean; + currentUser: IUser; }; const SideBarContainer = (props: Props) => { @@ -32,7 +34,7 @@ const SideBarContainer = (props: Props) => { const updatedProps = { ...props, participantUsers: data.users, - pinnedUsers: pinnedUsers.meetingPinnedUsers || { + pinnedUsers: pinnedUsers?.meetingPinnedUsers || { pinnedUserIds: [], userId: '', pinnedUsersInfo: [] diff --git a/packages/plugin-meetings-ui/src/containers/myMeetings/List.tsx b/packages/plugin-meetings-ui/src/containers/myMeetings/List.tsx index dae8eec39a..32460fc913 100644 --- a/packages/plugin-meetings-ui/src/containers/myMeetings/List.tsx +++ b/packages/plugin-meetings-ui/src/containers/myMeetings/List.tsx @@ -44,7 +44,8 @@ const MyMeetingListContainer = (props: FinalProps) => { userId: ownerId, companyId, searchValue - } + }, + fetchPolicy: 'no-cache' }); const { data: countData, loading: countLoading } = useQuery(