Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implementation of update rolePermission #90

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"date-fns": "^2.29.3",
"dotenv": "^16.0.3",
"flowbite": "^1.5.3",
"formik": "^2.4.3",
"formik": "^2.4.5",
"googleapis": "^126.0.1",
"graphql": "^16.6.0",
"graphql-request": "^5.1.0",
Expand Down Expand Up @@ -124,7 +124,7 @@
"stream-http": "^3.2.0",
"ts-jest": "^29.0.3",
"with-click-outside": "^1.0.1",
"yup": "^1.2.0",
"yup": "^1.3.2",
"zod": "^3.22.2"
},
"browserslist": {
Expand Down
82 changes: 38 additions & 44 deletions src/components/roles&permissions/ApplicationEntity.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as IoIcons from 'react-icons/io5';

function ApplicationEntity({
appSelectedEntity,
setAppSelectedEntity,
Expand All @@ -12,36 +10,32 @@ function ApplicationEntity({
return (
<div className={`${className}`}>
<select
name='entity'
id='entity'
name="entity"
id="entity"
value={appSelectedEntity}
onChange={(e) => {
setAppSelectedEntity(e.target.value);
setAppOpen(true);
}}
className='dark:bg-dark-tertiary border dark:text-white border-primary py-2 rounded outline-none px-5 font-sans text-xs w-4/5 pt-4 ml-20 md:ml-4'
className="dark:bg-dark-tertiary border dark:text-white border-primary py-2 rounded outline-none px-5 font-sans text-xs w-4/5 pt-4 ml-20 md:ml-4"
>
<option className='' value=''>
<option className="" value="">
-- Please choose an Entity --
</option>
{appEntities?.map((entity: string) => (
<option className='dark:text-white' key={entity} value={entity}>
<option className="dark:text-white" key={entity} value={entity}>
{entity}
</option>
))}
</select>
{appOpen && (
<div className='mt-2 dark:bg-dark-tertiary dark:text-white p-5 relative m-auto w-[80%] ml-20 md:ml-4 '>
{/* <IoIcons.IoClose
onClick={() => setOpenP(false)}
className='cursor-pointer dark:text-white top-[10px] text-[25px] flex justify-end absolute right-0'
/> */}
<div className='grid grid-cols-5 md:grid-cols-2'>
<div className='p-1 dark:text-white text-[13px] flex gap-2'>
<div className="mt-2 dark:bg-dark-tertiary dark:text-white p-5 relative m-auto w-[80%] ml-20 md:ml-4 ">
<div className="grid grid-cols-5 md:grid-cols-2">
<div className="p-1 dark:text-white text-[13px] flex gap-2">
<input
type='checkbox'
className=''
value='create'
type="checkbox"
className=""
value="create"
onChange={(e) =>
setAppPermissions((currentState) => [
...currentState,
Expand All @@ -52,10 +46,10 @@ function ApplicationEntity({
<span>create</span>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='viewOne'
type="checkbox"
value="viewOne"
onChange={(e) =>
setAppPermissions((currentState) => [
...currentState,
Expand All @@ -67,10 +61,10 @@ function ApplicationEntity({
</div>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='viewOwn'
type="checkbox"
value="viewOwn"
onChange={(e) =>
setAppPermissions((currentState) => [
...currentState,
Expand All @@ -82,10 +76,10 @@ function ApplicationEntity({
</div>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='viewMultiple'
type="checkbox"
value="viewMultiple"
onChange={(e) =>
setAppPermissions((currentState) => [
...currentState,
Expand All @@ -97,10 +91,10 @@ function ApplicationEntity({
</div>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='updateOne'
type="checkbox"
value="updateOne"
onChange={(e) =>
setAppPermissions((currentState) => [
...currentState,
Expand All @@ -112,10 +106,10 @@ function ApplicationEntity({
</div>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='updateOwn'
type="checkbox"
value="updateOwn"
onChange={(e) =>
setAppPermissions((currentState) => [
...currentState,
Expand All @@ -127,10 +121,10 @@ function ApplicationEntity({
</div>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='updateMultiple'
type="checkbox"
value="updateMultiple"
onChange={(e) =>
setAppPermissions((currentState) => [
...currentState,
Expand All @@ -142,10 +136,10 @@ function ApplicationEntity({
</div>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='deleteOne'
type="checkbox"
value="deleteOne"
onChange={(e) =>
setAppPermissions((currentState) => [
...currentState,
Expand All @@ -157,10 +151,10 @@ function ApplicationEntity({
</div>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='deleteOwn'
type="checkbox"
value="deleteOwn"
onChange={(e) =>
setAppPermissions((currentState) => [
...currentState,
Expand All @@ -172,10 +166,10 @@ function ApplicationEntity({
</div>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='deleteMultiple'
type="checkbox"
value="deleteMultiple"
onChange={(e) =>
setAppPermissions((currentState) => [
...currentState,
Expand Down
78 changes: 38 additions & 40 deletions src/components/roles&permissions/CohortEntity.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as IoIcons from 'react-icons/io5';

function CohortEntity({
selectedCohortEntity,
setSelectedCohortEntity,
Expand All @@ -12,36 +10,36 @@ function CohortEntity({
return (
<div className={`${className}`}>
<select
name='entity'
id='entity'
name="entity"
id="entity"
value={selectedCohortEntity}
onChange={(e) => {
setSelectedCohortEntity(e.target.value);
setOpenCohort(true);
}}
className='dark:bg-dark-tertiary border dark:text-white border-primary py-2 rounded outline-none px-5 font-sans text-xs w-4/5 pt-4 ml-20 md:ml-4'
className="dark:bg-dark-tertiary border dark:text-white border-primary py-2 rounded outline-none px-5 font-sans text-xs w-4/5 pt-4 ml-20 md:ml-4"
>
<option className='' value=''>
<option className="" value="">
-- Please choose an Entity --
</option>
{cohortEntities?.map((entity: string) => (
<option className='dark:text-white' key={entity} value={entity}>
<option className="dark:text-white" key={entity} value={entity}>
{entity}
</option>
))}
</select>
{openCohort && (
<div className='mt-2 dark:bg-dark-tertiary dark:text-white p-5 relative m-auto w-[80%] ml-20 md:ml-4 '>
<div className="mt-2 dark:bg-dark-tertiary dark:text-white p-5 relative m-auto w-[80%] ml-20 md:ml-4 ">
{/* <IoIcons.IoClose
onClick={() => setOpenP(false)}
className='cursor-pointer dark:text-white top-[10px] text-[25px] flex justify-end absolute right-0'
/> */}
<div className='grid grid-cols-5 md:grid-cols-2'>
<div className='p-1 dark:text-white text-[13px] flex gap-2'>
<div className="grid grid-cols-5 md:grid-cols-2">
<div className="p-1 dark:text-white text-[13px] flex gap-2">
<input
type='checkbox'
className=''
value='create'
type="checkbox"
className=""
value="create"
onChange={(e) =>
setCohortPermissions((currentState) => [
...currentState,
Expand All @@ -52,10 +50,10 @@ function CohortEntity({
<span>create</span>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='viewOne'
type="checkbox"
value="viewOne"
onChange={(e) =>
setCohortPermissions((currentState) => [
...currentState,
Expand All @@ -67,10 +65,10 @@ function CohortEntity({
</div>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='viewOwn'
type="checkbox"
value="viewOwn"
onChange={(e) =>
setCohortPermissions((currentState) => [
...currentState,
Expand All @@ -82,10 +80,10 @@ function CohortEntity({
</div>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='viewMultiple'
type="checkbox"
value="viewMultiple"
onChange={(e) =>
setCohortPermissions((currentState) => [
...currentState,
Expand All @@ -97,10 +95,10 @@ function CohortEntity({
</div>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='updateOne'
type="checkbox"
value="updateOne"
onChange={(e) =>
setCohortPermissions((currentState) => [
...currentState,
Expand All @@ -112,10 +110,10 @@ function CohortEntity({
</div>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='updateOwn'
type="checkbox"
value="updateOwn"
onChange={(e) =>
setCohortPermissions((currentState) => [
...currentState,
Expand All @@ -127,10 +125,10 @@ function CohortEntity({
</div>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='updateMultiple'
type="checkbox"
value="updateMultiple"
onChange={(e) =>
setCohortPermissions((currentState) => [
...currentState,
Expand All @@ -142,10 +140,10 @@ function CohortEntity({
</div>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='deleteOne'
type="checkbox"
value="deleteOne"
onChange={(e) =>
setCohortPermissions((currentState) => [
...currentState,
Expand All @@ -157,10 +155,10 @@ function CohortEntity({
</div>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='deleteOwn'
type="checkbox"
value="deleteOwn"
onChange={(e) =>
setCohortPermissions((currentState) => [
...currentState,
Expand All @@ -172,10 +170,10 @@ function CohortEntity({
</div>
</div>
<div>
<div className='mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2'>
<div className="mr-3 p-1 dark:text-white text-[13px] flex items-center gap-2">
<input
type='checkbox'
value='deleteMultiple'
type="checkbox"
value="deleteMultiple"
onChange={(e) =>
setCohortPermissions((currentState) => [
...currentState,
Expand Down
1 change: 1 addition & 0 deletions src/pages/TraineApplicant/Trainee.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const AddTrainee = (props: any) => {
useEffect(() => {
dispatch(fetchtraine(input));
}, [delettraine, softdeletettraine, page, itemsPerPage, itemsPerPage]);

const [moredrop, setmoredrop] = useState("");
const onSubmitHandler = (userid: any) => {
if (!moredrop) setmoredrop(userid);
Expand Down
Loading