INFRA-3705 : Add checkbox for is cx

This commit is contained in:
Vijay Joshi
2024-09-17 15:45:51 +05:30
parent 3a34d49b4d
commit 15d03dbd83
3 changed files with 28 additions and 1 deletions

View File

@@ -50,6 +50,7 @@ export const actionTypes = {
SET_TEAM_NAME_ERROR: 'SET_TEAM_NAME_ERROR',
SET_EMAIL_ERROR: 'SET_EMAIL_ERROR',
SET_EMAIL: 'SET_EMAIL',
SET_IS_CX: 'SET_IS_CX',
SET_CLEAR_MODAL: 'SET_CLEAR_MODAL',
SET_ADD_MEMBER_ERROR: 'SET_ADD_MEMBER_ERROR',
};
@@ -82,6 +83,7 @@ export const initialState: AppState = {
teamName: '',
teamNameError: '',
emailError: '',
isCx: false,
email: '',
clearModal: false,
addMemberError: '',
@@ -190,6 +192,11 @@ export const reducer = (state: AppState, action: ActionType): AppState => {
...state,
addMemberError: action.payload,
};
case actionTypes.SET_IS_CX:
return {
...state,
isCx: action.payload,
};
default:
return state;
}

View File

@@ -1,6 +1,6 @@
import { useReducer } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { Typography } from '@navi/web-ui/lib/primitives';
import { Checkbox, Typography } from '@navi/web-ui/lib/primitives';
import { AlertOutlineIcon } from '@navi/web-ui/lib/icons';
import { BorderedInput, ModalDialog } from '@navi/web-ui/lib/primitives';
import { toast } from '@navi/web-ui/lib/primitives/Toast';
@@ -76,6 +76,14 @@ const CreateTeam: React.FC<CreateTeamProps> = ({ handleSetTeam }) => {
validateEmail(inputValue);
};
const handleIsCxChange = (e: React.ChangeEvent<HTMLInputElement>): void => {
const inputValue = e.target.checked;
dispatchData({
type: actionTypes.SET_IS_CX,
payload: inputValue,
});
};
const addTeamHandler = (): void => {
fireEvent(EVENT_NAME.Houston_Create_Team, {
screen_name: SCREEN_NAME.TEAM_PAGE,
@@ -86,6 +94,7 @@ const CreateTeam: React.FC<CreateTeamProps> = ({ handleSetTeam }) => {
email: state.email,
severity_id: DEFAULT_SEVERITY_ID,
},
team_type: state.isCx ? 'CX' : '',
})
.then(response => {
const toastMessage = `${response?.data?.data?.message}`;
@@ -168,6 +177,16 @@ const CreateTeam: React.FC<CreateTeamProps> = ({ handleSetTeam }) => {
/>
</Typography>
</div>
<div>
<Typography variant="p4" color="#F98600">
<Checkbox
checked={state.isCx}
title={'Is this a CX team?'}
onChange={handleIsCxChange}
/>
</Typography>
</div>
</ModalDialog>
)}
</div>

View File

@@ -120,6 +120,7 @@ export interface AppState {
teamNameError: string;
emailError: string;
email: string;
isCx: boolean;
clearModal: boolean;
addMemberError: string;
}