Skip to content

Commit

Permalink
Merge pull request #614 from culturecreates/feature/issue-564
Browse files Browse the repository at this point in the history
Feature/issue 564
  • Loading branch information
AbhishekPAnil authored Sep 25, 2023
2 parents dab0634 + ca580bf commit d52b395
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 42 deletions.
2 changes: 2 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ REACT_APP_FEATURE_FLAG_ORG_PERSON_PLACE_VIEW=true
REACT_APP_FEATURE_FLAG_QUICK_CREATE_PEOPLE_PLACE=true
REACT_APP_FEATURE_FLAG_IMAGE_CROP=false
REACT_APP_ENV="production"
REACT_APP_INVITE_URL=" https://cms.footlight.io/join?invitationId="
REACT_APP_ACCEPT_URL=" https://cms.footlight.io/accept?invitationId="
2 changes: 2 additions & 0 deletions .env.staging
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ REACT_APP_FEATURE_FLAG_EDIT_SCREEN_PEOPLE_PLACE_ORGANIZATION=true
REACT_APP_FEATURE_FLAG_USERS=true
REACT_APP_FEATURE_FLAG_IMAGE_CROP=true
REACT_APP_ENV="staging"
REACT_APP_INVITE_URL="http://staging.cms.footlight.io/join?invitationId="
REACT_APP_ACCEPT_URL="http://staging.cms.footlight.io/accept?invitationId="
22 changes: 18 additions & 4 deletions src/components/List/User/CalenderSelect/CalendarSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import { Avatar, Button, Dropdown, List } from 'antd';
// import useSelection from 'antd/lib/table/hooks/useSelection';
import { PlusOutlined, DownOutlined } from '@ant-design/icons';
import React from 'react';
import { userRolesWithTranslation } from '../../../../constants/userRoles';
import { userRoles, userRolesWithTranslation } from '../../../../constants/userRoles';
import { useTranslation } from 'react-i18next';
import './calendarSelect.css';

// import { getUserDetails } from '../../../../redux/reducer/userSlice';
import { getUserDetails } from '../../../../redux/reducer/userSlice';
import { useSelector } from 'react-redux';
import { useParams } from 'react-router-dom';

const CalendarSelect = (props) => {
const {
Expand All @@ -18,9 +20,11 @@ const CalendarSelect = (props) => {
calenderItem,
selectedCalendars,
setSelectedCalendars,
isRoleOptionHidden,
// isRoleOptionHidden,
} = props;
const { t } = useTranslation();
const { user } = useSelector(getUserDetails);
const { calendarId } = useParams();

const userTypeFilterChangeHandler = ({ selectedKeys }) => {
const updatedSelectedData = selectedCalendars.map((item) => {
Expand All @@ -30,9 +34,19 @@ const CalendarSelect = (props) => {
return item;
}
});
console.log(updatedSelectedData, 'hel');
setSelectedCalendars([...updatedSelectedData]);
};

const calendar = user?.roles.filter((calendar) => {
return calendar.calendarId === calendarId;
});

const adminCheckHandler = () => {
if (calendar[0]?.role === userRoles.ADMIN || user?.isSuperAdmin) return true;
else return false;
};

return (
<div
className="selection-item-wrapper calender-card-item"
Expand Down Expand Up @@ -61,7 +75,7 @@ const CalendarSelect = (props) => {
}
title={<span className="selection-item-title">{name}</span>}
/>
{!isRoleOptionHidden && (
{adminCheckHandler() && (
<div>
{calenderItem?.role ? (
<Dropdown
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en/translationEn.json
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,7 @@
"languagePreference": "Language preference",
"organization": "Organization",
"organizationDescription": "Add organization that will be linked to this user profile.",
"searchOrganizations": "Search Organizations",
"dropDownOptions": {
"langagePreference": {
"en": "English",
Expand All @@ -799,6 +800,7 @@
"calendars": "Calendars",
"calendarsDescription": "Select available calendar for this user to join.",
"calendarSearchHeading": "Calendar access",
"searchCalendars": "Search calendars",
"leave": "Leave",
"role": "Role",
"passwordModal": {
Expand Down
2 changes: 2 additions & 0 deletions src/locales/fr/transalationFr.json
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,7 @@
"languagePreference": "Préférence de langue",
"organization": "Organisation",
"organizationDescription": "Ajouter une organisation qui sera liée à ce profile d’utilisateur.",
"searchOrganizations": "Recherchez des Organisations",
"dropDownOptions": {
"langagePreference": {
"en": "Anglais",
Expand All @@ -788,6 +789,7 @@
"calendars": "Calendriers",
"calendarsDescription": "Sélectionnez des calendriers disponibles auxquels cet utilisateur peut se joindre.",
"calendarSearchHeading": "Accès aux calendriers",
"searchCalendars": "Rechercher des calendriers",
"leave": "Quitter",
"role": "Role",
"passwordModal": {
Expand Down
Loading

0 comments on commit d52b395

Please sign in to comment.