Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Commit

Permalink
bug fixed in meeting (#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
enkhtuvshinD authored Sep 29, 2023
1 parent 9521721 commit 37f417a
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-meetings-api/src/models/Meetings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ');
}
Expand Down
5 changes: 2 additions & 3 deletions packages/plugin-meetings-ui/src/components/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ type Props = {
refetchQueries?: any;
currentUser: IUser;
meetingQuery?: MeetingsQueryResponse;
participantUsers: IUser[];
};

function List(props: Props) {
Expand All @@ -35,8 +34,7 @@ function List(props: Props) {
queryParams,
history,
currentUser,
meetingQuery,
participantUsers
meetingQuery
} = props;
const { meetingId, searchValue } = queryParams;

Expand Down Expand Up @@ -76,6 +74,7 @@ function List(props: Props) {
queryParams={queryParams}
meetings={meetings}
loading={loading}
currentUser={currentUser}
/>
);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] || []);

Expand Down Expand Up @@ -43,7 +45,7 @@ const ChooseOwnerForm = (props: Props) => {
<SelectTeamMembers
initialValue={pinnedUserIds}
customField="userIds"
filterParams={{}}
filterParams={{ excludeIds: true, ids: [currentUser?._id] }}
label={'Select team member'}
onSelect={onUserSelect}
name="userId"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ type Props = {
userId: string;
pinnedUsersInfo: IUser[];
};
currentUser: IUser;
};

export const SideBar = (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;
Expand Down Expand Up @@ -192,6 +193,7 @@ export const SideBar = (props: Props) => {
<ChooseOwnerFormContainer
closeModal={closeModal}
pinnedUserIds={pinnedUsers.pinnedUserIds}
currentUser={currentUser}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,28 @@ function CalendarComponent(props: Props) {

return (
<>
<FullCalendar
plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin]}
headerToolbar={{
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay'
}}
height="80vh"
initialView="dayGridMonth"
editable={true}
selectMirror={true}
selectable={true}
dayMaxEvents={true}
events={events}
select={handleDateSelect}
eventContent={renderEventContent}
eventClick={handleEventClick}
eventChange={changeEvent}
/>
<div style={{ width: '100%' }}>
<FullCalendar
plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin]}
headerToolbar={{
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay'
}}
height="80vh"
initialView="dayGridMonth"
editable={true}
selectMirror={true}
selectable={true}
dayMaxEvents={true}
events={{}}
select={handleDateSelect}
eventContent={renderEventContent}
eventClick={handleEventClick}
eventChange={changeEvent}
firstDay={1}
/>
</div>
<Modal show={showModal} onHide={() => setShowModal(false)} size="lg">
<Modal.Header closeButton={true}>
<Modal.Title>Create Meeting</Modal.Title>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ export const MeetingDetail = (props: Props) => {
<span>Team members:</span>{' '}
{meetingDetail?.participantUser?.map((user, index) => {
if (index != meetingDetail?.participantUser?.length - 1)
return <>{user.details?.fullName},</>;
return <>{user.details?.fullName}</>;
return <div key={index}>{user.details?.fullName},</div>;
return <div key={index}>{user.details?.fullName}</div>;
})}
</MeetingDetailColumn>
</MeetingDetailRow>
Expand Down
16 changes: 10 additions & 6 deletions packages/plugin-meetings-ui/src/components/myMeetings/Row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ export const Row = (props: Props) => {

const content = props => <Form {...props} meeting={meeting} />;

const onTrClick = () => {
history.push(`/meetings/myCalendar?meetingId=${meeting._id}`);
};

const onClick = e => {
e.stopPropagation();
};

return (
<tr
onClick={() => {
history.push(`/meetings/myCalendar?meetingId=${meeting._id}`);
}}
>
<tr onClick={onTrClick}>
<td>{meeting.title}</td>
<td>{meeting.createdUser?.username || ''}</td>
<td>{meeting.createdAt}</td>
Expand All @@ -51,7 +55,7 @@ export const Row = (props: Props) => {
</FlexCenter>
</td>
<td>{meeting.status}</td>
<td>
<td onClick={onClick}>
<ActionButtons>
<ModalTrigger
title="Edit tag"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ type Props = {

const LeftSideBar = (props: Props) => {
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 || ''
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ 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;
currentTypeId?: string;
queryParams: any;
meetings: IMeeting[];
loading: boolean;
currentUser: IUser;
};

const SideBarContainer = (props: Props) => {
Expand All @@ -32,7 +34,7 @@ const SideBarContainer = (props: Props) => {
const updatedProps = {
...props,
participantUsers: data.users,
pinnedUsers: pinnedUsers.meetingPinnedUsers || {
pinnedUsers: pinnedUsers?.meetingPinnedUsers || {
pinnedUserIds: [],
userId: '',
pinnedUsersInfo: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ const MyMeetingListContainer = (props: FinalProps) => {
userId: ownerId,
companyId,
searchValue
}
},
fetchPolicy: 'no-cache'
});

const { data: countData, loading: countLoading } = useQuery(
Expand Down

0 comments on commit 37f417a

Please sign in to comment.