@mseva/digit-ui-module-engagement 1.1.10 → 1.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +217 -53
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +217 -53
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -19664,7 +19664,7 @@ const FillQuestions = props => {
|
|
|
19664
19664
|
var _response$responseInf, _response$responseInf2;
|
|
19665
19665
|
if (((response === null || response === void 0 ? void 0 : (_response$responseInf = response.responseInfo) === null || _response$responseInf === void 0 ? void 0 : _response$responseInf.status) === "200" || (response === null || response === void 0 ? void 0 : (_response$responseInf2 = response.responseInfo) === null || _response$responseInf2 === void 0 ? void 0 : _response$responseInf2.status) === "201") && (response === null || response === void 0 ? void 0 : response.user.length) > 0) {
|
|
19666
19666
|
var _response$user$, _response$user$2, _response$user$3, _response$user$4, _response$user$5, _response$user$6;
|
|
19667
|
-
if ((response === null || response === void 0 ? void 0 : (_response$user$ = response.user[0]) === null || _response$user$ === void 0 ? void 0 : _response$user$.gender) === null || (response === null || response === void 0 ? void 0 : (_response$user$2 = response.user[0]) === null || _response$user$2 === void 0 ? void 0 : _response$user$2.
|
|
19667
|
+
if ((response === null || response === void 0 ? void 0 : (_response$user$ = response.user[0]) === null || _response$user$ === void 0 ? void 0 : _response$user$.gender) === null || (response === null || response === void 0 ? void 0 : (_response$user$2 = response.user[0]) === null || _response$user$2 === void 0 ? void 0 : _response$user$2.emailId) === null || (response === null || response === void 0 ? void 0 : (_response$user$3 = response.user[0]) === null || _response$user$3 === void 0 ? void 0 : _response$user$3.dob) === null || (response === null || response === void 0 ? void 0 : (_response$user$4 = response.user[0]) === null || _response$user$4 === void 0 ? void 0 : _response$user$4.gender) === "" || (response === null || response === void 0 ? void 0 : (_response$user$5 = response.user[0]) === null || _response$user$5 === void 0 ? void 0 : _response$user$5.emailId) === "" || (response === null || response === void 0 ? void 0 : (_response$user$6 = response.user[0]) === null || _response$user$6 === void 0 ? void 0 : _response$user$6.dob) === "") {
|
|
19668
19668
|
setHasCitizenDetails(false);
|
|
19669
19669
|
} else {
|
|
19670
19670
|
var _response$user$7;
|
|
@@ -20442,7 +20442,7 @@ const FillQuestions = props => {
|
|
|
20442
20442
|
}, "--Please choose a city--"), cities.map((option, index) => /*#__PURE__*/React.createElement("option", {
|
|
20443
20443
|
key: index,
|
|
20444
20444
|
value: option.code
|
|
20445
|
-
}, option === null || option === void 0 ? void 0 : option.
|
|
20445
|
+
}, option === null || option === void 0 ? void 0 : option.name))), errors && errors["city"] && /*#__PURE__*/React.createElement(CardLabelError$2, {
|
|
20446
20446
|
style: {
|
|
20447
20447
|
marginTop: "0px",
|
|
20448
20448
|
marginBottom: "0px",
|
|
@@ -22053,6 +22053,7 @@ const useInboxTableConfig = ({
|
|
|
22053
22053
|
setShowToast
|
|
22054
22054
|
}) => {
|
|
22055
22055
|
var _formState$tableForm, _formState$tableForm2, _formState$tableForm7, _formState$searchForm;
|
|
22056
|
+
const history = useHistory();
|
|
22056
22057
|
const GetCell = value => /*#__PURE__*/React.createElement("span", {
|
|
22057
22058
|
className: "cell-text styled-cell"
|
|
22058
22059
|
}, value);
|
|
@@ -22085,7 +22086,15 @@ const useInboxTableConfig = ({
|
|
|
22085
22086
|
row
|
|
22086
22087
|
}) => {
|
|
22087
22088
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
22088
|
-
className: "link"
|
|
22089
|
+
className: "link",
|
|
22090
|
+
onClick: () => {
|
|
22091
|
+
history.push({
|
|
22092
|
+
pathname: `/digit-ui/employee/engagement/surveys/previewQuestions`,
|
|
22093
|
+
state: {
|
|
22094
|
+
data: row.original
|
|
22095
|
+
}
|
|
22096
|
+
});
|
|
22097
|
+
}
|
|
22089
22098
|
}, row.original.surveyTitle));
|
|
22090
22099
|
}
|
|
22091
22100
|
}, {
|
|
@@ -25142,7 +25151,7 @@ const StepWrapper = ({
|
|
|
25142
25151
|
flex: 1,
|
|
25143
25152
|
color: isActive ? "#3f51b5" : "#ccc",
|
|
25144
25153
|
padding: "10px 10px",
|
|
25145
|
-
width:
|
|
25154
|
+
width: "260px"
|
|
25146
25155
|
});
|
|
25147
25156
|
const circleStyle = stepNumber => {
|
|
25148
25157
|
let backgroundColor;
|
|
@@ -25168,7 +25177,7 @@ const StepWrapper = ({
|
|
|
25168
25177
|
};
|
|
25169
25178
|
};
|
|
25170
25179
|
const labelStyle = {
|
|
25171
|
-
fontSize: "
|
|
25180
|
+
fontSize: "18px",
|
|
25172
25181
|
color: "#1E1E1E",
|
|
25173
25182
|
fontWeight: "500",
|
|
25174
25183
|
fontFamily: "Noto Sans,sans-serif",
|
|
@@ -25179,7 +25188,7 @@ const StepWrapper = ({
|
|
|
25179
25188
|
color: "#263238",
|
|
25180
25189
|
fontWeight: "400",
|
|
25181
25190
|
fontFamily: "Noto Sans,sans-serif",
|
|
25182
|
-
margin:
|
|
25191
|
+
margin: "0px 6px 0px 0px"
|
|
25183
25192
|
};
|
|
25184
25193
|
const lineStyle = {
|
|
25185
25194
|
position: "absolute",
|
|
@@ -25225,7 +25234,7 @@ const StepWrapper = ({
|
|
|
25225
25234
|
}, index + 1 === totalSteps ? null : /*#__PURE__*/React.createElement("div", {
|
|
25226
25235
|
className: "step-number",
|
|
25227
25236
|
style: stepNumberStyle
|
|
25228
|
-
}
|
|
25237
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
25229
25238
|
className: "step-label",
|
|
25230
25239
|
style: labelStyle
|
|
25231
25240
|
}, t(_stepsList[index].stepLabel))), /*#__PURE__*/React.createElement("div", {
|
|
@@ -25329,21 +25338,22 @@ const newConfig = [{
|
|
|
25329
25338
|
const UPDATE_SURVEY_FORM = "UPDATE_SURVEY_FORM";
|
|
25330
25339
|
const SET_SURVEY_STEP = "SET_SURVEY_STEP";
|
|
25331
25340
|
const FIELD_CHANGE = "FIELD_CHANGE";
|
|
25332
|
-
const ADD_CATEGORY =
|
|
25333
|
-
const ADD_QUESTIONS =
|
|
25334
|
-
const ADD_QUESTIONS_LIST =
|
|
25335
|
-
const RECALCULATE_WEIGHTAGE =
|
|
25336
|
-
const UPDATE_CATEGORY =
|
|
25337
|
-
const UPDATE_QUESTION_SELECTION =
|
|
25338
|
-
const UPDATE_MANDATORY_QUESTION_SELECTION =
|
|
25339
|
-
const UPDATE_QUESTION_WEIGHTAGE =
|
|
25340
|
-
const SET_QUESTIONS =
|
|
25341
|
-
const DELETE_CATEGORY =
|
|
25342
|
-
const GO_PREV =
|
|
25343
|
-
const GO_NEXT =
|
|
25344
|
-
const NEXT_STEP =
|
|
25345
|
-
const PREVIOUS_STEP =
|
|
25346
|
-
const SET_STEP_DATA =
|
|
25341
|
+
const ADD_CATEGORY = "ADD_CATEGORY";
|
|
25342
|
+
const ADD_QUESTIONS = "ADD_QUESTIONS";
|
|
25343
|
+
const ADD_QUESTIONS_LIST = "ADD_QUESTIONS_LIST";
|
|
25344
|
+
const RECALCULATE_WEIGHTAGE = "RECALCULATE_WEIGHTAGE";
|
|
25345
|
+
const UPDATE_CATEGORY = "UPDATE_CATEGORY";
|
|
25346
|
+
const UPDATE_QUESTION_SELECTION = "UPDATE_QUESTION_SELECTION";
|
|
25347
|
+
const UPDATE_MANDATORY_QUESTION_SELECTION = "UPDATE_MANDATORY_QUESTION_SELECTION";
|
|
25348
|
+
const UPDATE_QUESTION_WEIGHTAGE = "UPDATE_QUESTION_WEIGHTAGE";
|
|
25349
|
+
const SET_QUESTIONS = "SET_QUESTIONS";
|
|
25350
|
+
const DELETE_CATEGORY = "DELETE_CATEGORY";
|
|
25351
|
+
const GO_PREV = "GO_PREV";
|
|
25352
|
+
const GO_NEXT = "GO_NEXT";
|
|
25353
|
+
const NEXT_STEP = "NEXT_STEP";
|
|
25354
|
+
const PREVIOUS_STEP = "PREVIOUS_STEP";
|
|
25355
|
+
const SET_STEP_DATA = "SET_STEP_DATA";
|
|
25356
|
+
const AUTO_CALCULATE_CATEGORY = "AUTO_CALCULATE_CATEGORY";
|
|
25347
25357
|
|
|
25348
25358
|
const updateSurveyForm = (key, value) => ({
|
|
25349
25359
|
type: UPDATE_SURVEY_FORM,
|
|
@@ -25408,6 +25418,10 @@ const deleteCategory = categoryId => ({
|
|
|
25408
25418
|
const goPrev = () => ({
|
|
25409
25419
|
type: GO_PREV
|
|
25410
25420
|
});
|
|
25421
|
+
const autoCalculateCategoriesWeight = categoryWeight => ({
|
|
25422
|
+
type: AUTO_CALCULATE_CATEGORY,
|
|
25423
|
+
categoryWeight
|
|
25424
|
+
});
|
|
25411
25425
|
|
|
25412
25426
|
const surveyConfig = [{
|
|
25413
25427
|
head: "SURVEY_DETAILS",
|
|
@@ -26921,6 +26935,142 @@ const Response$6 = props => {
|
|
|
26921
26935
|
}))));
|
|
26922
26936
|
};
|
|
26923
26937
|
|
|
26938
|
+
const PreviewQuestions = props => {
|
|
26939
|
+
const prevProps = props.location.state;
|
|
26940
|
+
const data = prevProps.data;
|
|
26941
|
+
console.log("questions data", data);
|
|
26942
|
+
const [selectedOption, setSelectedOption] = useState("");
|
|
26943
|
+
const handleChange = event => {
|
|
26944
|
+
setSelectedOption("");
|
|
26945
|
+
};
|
|
26946
|
+
const displayAnswerField = (answerType, question, section) => {
|
|
26947
|
+
console.log("answer type", answerType, question);
|
|
26948
|
+
switch (answerType) {
|
|
26949
|
+
case "SHORT_ANSWER_TYPE":
|
|
26950
|
+
return /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(TextInput$1, {
|
|
26951
|
+
name: question.uuid,
|
|
26952
|
+
disable: true,
|
|
26953
|
+
textInputStyle: {
|
|
26954
|
+
maxWidth: "none"
|
|
26955
|
+
},
|
|
26956
|
+
type: "text"
|
|
26957
|
+
}));
|
|
26958
|
+
case "LONG_ANSWER_TYPE":
|
|
26959
|
+
return /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(TextArea$1, {
|
|
26960
|
+
name: question.uuid,
|
|
26961
|
+
style: {
|
|
26962
|
+
maxWidth: "none"
|
|
26963
|
+
},
|
|
26964
|
+
disable: true,
|
|
26965
|
+
disabled: true
|
|
26966
|
+
}));
|
|
26967
|
+
case "DROP_DOWN_MENU_ANSWER_TYPE":
|
|
26968
|
+
return /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement("select", {
|
|
26969
|
+
id: "dropdown",
|
|
26970
|
+
value: selectedOption,
|
|
26971
|
+
onChange: handleChange
|
|
26972
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
26973
|
+
value: ""
|
|
26974
|
+
}, "--Please choose an option--"), question.options.map((option, index) => /*#__PURE__*/React.createElement("option", {
|
|
26975
|
+
key: index,
|
|
26976
|
+
value: option === null || option === void 0 ? void 0 : option.optionText
|
|
26977
|
+
}, option === null || option === void 0 ? void 0 : option.optionText))));
|
|
26978
|
+
case "MULTIPLE_ANSWER_TYPE":
|
|
26979
|
+
return /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement("div", {
|
|
26980
|
+
style: {
|
|
26981
|
+
display: "flex",
|
|
26982
|
+
flexDirection: "column"
|
|
26983
|
+
}
|
|
26984
|
+
}, question.options.map(option => /*#__PURE__*/React.createElement("h4", {
|
|
26985
|
+
key: option === null || option === void 0 ? void 0 : option.uuid,
|
|
26986
|
+
style: {
|
|
26987
|
+
display: "flex",
|
|
26988
|
+
alignItems: "center",
|
|
26989
|
+
marginBottom: "10px",
|
|
26990
|
+
fontSize: "18px"
|
|
26991
|
+
}
|
|
26992
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
26993
|
+
type: "radio",
|
|
26994
|
+
name: question.uuid,
|
|
26995
|
+
value: option === null || option === void 0 ? void 0 : option.optionText,
|
|
26996
|
+
disabled: true,
|
|
26997
|
+
required: true,
|
|
26998
|
+
style: {
|
|
26999
|
+
marginRight: "10px",
|
|
27000
|
+
width: "25px",
|
|
27001
|
+
height: "25px"
|
|
27002
|
+
}
|
|
27003
|
+
}), option === null || option === void 0 ? void 0 : option.optionText))));
|
|
27004
|
+
case "CHECKBOX_ANSWER_TYPE":
|
|
27005
|
+
return /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement("div", {
|
|
27006
|
+
style: {
|
|
27007
|
+
display: "flex",
|
|
27008
|
+
flexDirection: "column"
|
|
27009
|
+
}
|
|
27010
|
+
}, question.options.map(option => /*#__PURE__*/React.createElement("h4", {
|
|
27011
|
+
key: option === null || option === void 0 ? void 0 : option.uuid,
|
|
27012
|
+
style: {
|
|
27013
|
+
display: "flex",
|
|
27014
|
+
alignItems: "center",
|
|
27015
|
+
marginBottom: "10px",
|
|
27016
|
+
fontSize: "18px"
|
|
27017
|
+
}
|
|
27018
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
27019
|
+
style: {
|
|
27020
|
+
width: "25px",
|
|
27021
|
+
height: "25px",
|
|
27022
|
+
marginRight: "10px"
|
|
27023
|
+
},
|
|
27024
|
+
type: "checkbox",
|
|
27025
|
+
value: option === null || option === void 0 ? void 0 : option.optionText,
|
|
27026
|
+
disabled: true
|
|
27027
|
+
}), option.optionText))));
|
|
27028
|
+
case "DATE_ANSWER_TYPE":
|
|
27029
|
+
return /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(TextInput$1, {
|
|
27030
|
+
type: "date",
|
|
27031
|
+
textInputStyle: {
|
|
27032
|
+
maxWidth: "none"
|
|
27033
|
+
},
|
|
27034
|
+
disable: true
|
|
27035
|
+
}));
|
|
27036
|
+
case "TIME_ANSWER_TYPE":
|
|
27037
|
+
return /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(TextInput$1, {
|
|
27038
|
+
type: "time",
|
|
27039
|
+
textInputStyle: {
|
|
27040
|
+
maxWidth: "none"
|
|
27041
|
+
},
|
|
27042
|
+
disable: true
|
|
27043
|
+
}));
|
|
27044
|
+
default:
|
|
27045
|
+
return /*#__PURE__*/React.createElement(TextInput$1, {
|
|
27046
|
+
name: question.uuid,
|
|
27047
|
+
disable: true,
|
|
27048
|
+
type: "text"
|
|
27049
|
+
});
|
|
27050
|
+
}
|
|
27051
|
+
};
|
|
27052
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27053
|
+
className: "create-survey-page",
|
|
27054
|
+
style: {
|
|
27055
|
+
background: "white",
|
|
27056
|
+
display: "block",
|
|
27057
|
+
padding: "15px"
|
|
27058
|
+
}
|
|
27059
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
27060
|
+
className: "category-card"
|
|
27061
|
+
}, /*#__PURE__*/React.createElement("form", null, data.sections.length > 0 ? data.sections.map(section => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h2", null, section.title), section.questions.map((question, index) => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", null, question.questionStatement), /*#__PURE__*/React.createElement("div", {
|
|
27062
|
+
className: "surveyQuestion-wrapper"
|
|
27063
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
27064
|
+
style: {
|
|
27065
|
+
display: "inline"
|
|
27066
|
+
}
|
|
27067
|
+
}, index + 1, ". ", question.question.questionStatement, " ", (question === null || question === void 0 ? void 0 : question.required) && /*#__PURE__*/React.createElement("span", {
|
|
27068
|
+
style: {
|
|
27069
|
+
color: "red"
|
|
27070
|
+
}
|
|
27071
|
+
}, "*")), displayAnswerField(question.question.type, question.question), /*#__PURE__*/React.createElement("div", null)))))) : null)));
|
|
27072
|
+
};
|
|
27073
|
+
|
|
26924
27074
|
const SurveyDetailsForms = ({
|
|
26925
27075
|
t,
|
|
26926
27076
|
registerRef,
|
|
@@ -28080,6 +28230,9 @@ const Surveys = ({
|
|
|
28080
28230
|
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
28081
28231
|
path: `${path}/inbox/results/:id`,
|
|
28082
28232
|
component: props => /*#__PURE__*/React.createElement(SurveyResults, props)
|
|
28233
|
+
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
28234
|
+
path: `${path}/previewQuestions`,
|
|
28235
|
+
component: props => /*#__PURE__*/React.createElement(PreviewQuestions, props)
|
|
28083
28236
|
}));
|
|
28084
28237
|
};
|
|
28085
28238
|
|
|
@@ -28339,24 +28492,25 @@ const ShowSurvey = ({
|
|
|
28339
28492
|
const initialState = {
|
|
28340
28493
|
surveyDetails: [{
|
|
28341
28494
|
id: 1,
|
|
28342
|
-
ulb:
|
|
28343
|
-
tenantIds:
|
|
28344
|
-
name:
|
|
28345
|
-
description:
|
|
28346
|
-
fromDate:
|
|
28347
|
-
fromTime:
|
|
28348
|
-
toDate:
|
|
28349
|
-
toTime:
|
|
28495
|
+
ulb: "",
|
|
28496
|
+
tenantIds: "",
|
|
28497
|
+
name: "",
|
|
28498
|
+
description: "",
|
|
28499
|
+
fromDate: "",
|
|
28500
|
+
fromTime: "",
|
|
28501
|
+
toDate: "",
|
|
28502
|
+
toTime: ""
|
|
28350
28503
|
}],
|
|
28351
28504
|
categories: [{
|
|
28352
28505
|
id: 1,
|
|
28353
|
-
title:
|
|
28506
|
+
title: "",
|
|
28354
28507
|
weightage: 100,
|
|
28355
|
-
selectCategory:
|
|
28356
|
-
questionStatement:
|
|
28508
|
+
selectCategory: "",
|
|
28509
|
+
questionStatement: "",
|
|
28357
28510
|
questions: [],
|
|
28358
28511
|
selectedQuestions: []
|
|
28359
28512
|
}],
|
|
28513
|
+
autoCalculateCategoriesWeight: true,
|
|
28360
28514
|
goPrev: false,
|
|
28361
28515
|
goNext: false,
|
|
28362
28516
|
stepData: {},
|
|
@@ -28376,12 +28530,17 @@ const surveyFormReducer = (state = initialState, action) => {
|
|
|
28376
28530
|
...state,
|
|
28377
28531
|
goNext: true
|
|
28378
28532
|
};
|
|
28533
|
+
case AUTO_CALCULATE_CATEGORY:
|
|
28534
|
+
return {
|
|
28535
|
+
...state,
|
|
28536
|
+
autoCalculateCategoriesWeight: action.categoryWeight
|
|
28537
|
+
};
|
|
28379
28538
|
case ADD_CATEGORY:
|
|
28380
28539
|
const newCategories = [...state.categories, {
|
|
28381
28540
|
id: action.id,
|
|
28382
|
-
title:
|
|
28383
|
-
weightage:
|
|
28384
|
-
selectCategory:
|
|
28541
|
+
title: "",
|
|
28542
|
+
weightage: "",
|
|
28543
|
+
selectCategory: "",
|
|
28385
28544
|
questions: [],
|
|
28386
28545
|
selectedQuestions: []
|
|
28387
28546
|
}];
|
|
@@ -29760,7 +29919,8 @@ const FormComposer = props => {
|
|
|
29760
29919
|
errors,
|
|
29761
29920
|
setError,
|
|
29762
29921
|
clearErrors,
|
|
29763
|
-
unregister
|
|
29922
|
+
unregister,
|
|
29923
|
+
setApi
|
|
29764
29924
|
} = useForm({
|
|
29765
29925
|
defaultValues: props.defaultValues
|
|
29766
29926
|
});
|
|
@@ -29859,7 +30019,8 @@ const FormComposer = props => {
|
|
|
29859
30019
|
setError: setError,
|
|
29860
30020
|
clearErrors: clearErrors,
|
|
29861
30021
|
formState: formState,
|
|
29862
|
-
onBlur: props.onBlur
|
|
30022
|
+
onBlur: props.onBlur,
|
|
30023
|
+
setApi: setApi
|
|
29863
30024
|
}),
|
|
29864
30025
|
name: config.key,
|
|
29865
30026
|
control: control
|
|
@@ -30042,7 +30203,7 @@ const FormComposer = props => {
|
|
|
30042
30203
|
props.onBackClick && props.onBackClick(formData);
|
|
30043
30204
|
};
|
|
30044
30205
|
const styles = {
|
|
30045
|
-
boxShadow:
|
|
30206
|
+
boxShadow: "none",
|
|
30046
30207
|
padding: "20px 48px 48px"
|
|
30047
30208
|
};
|
|
30048
30209
|
return /*#__PURE__*/React.createElement("form", {
|
|
@@ -30613,6 +30774,7 @@ const CategoryCard = ({
|
|
|
30613
30774
|
name: "weightage",
|
|
30614
30775
|
value: category.weightage,
|
|
30615
30776
|
onChange: handleFieldChange,
|
|
30777
|
+
onWheel: e => e.target.blur(),
|
|
30616
30778
|
readOnly: checked,
|
|
30617
30779
|
placeholder: "Section Weightage",
|
|
30618
30780
|
required: true
|
|
@@ -30767,8 +30929,9 @@ const SurveyCreationPage = ({
|
|
|
30767
30929
|
hideQuestionLabel
|
|
30768
30930
|
}) => {
|
|
30769
30931
|
const categories = useSelector(state => state.engagement.surveyForm.categories);
|
|
30932
|
+
const categoryWeight = useSelector(state => state.engagement.surveyForm.autoCalculateCategoriesWeight);
|
|
30770
30933
|
const dispatch = useDispatch();
|
|
30771
|
-
const [checked, setChecked] = useState(
|
|
30934
|
+
const [checked, setChecked] = useState(categoryWeight);
|
|
30772
30935
|
console.log("categories", categories);
|
|
30773
30936
|
const [index, setIndex] = useState(2);
|
|
30774
30937
|
const handleDeleteCategory = categoryId => {
|
|
@@ -30777,7 +30940,7 @@ const SurveyCreationPage = ({
|
|
|
30777
30940
|
alert("Atleast one category must be there");
|
|
30778
30941
|
return;
|
|
30779
30942
|
}
|
|
30780
|
-
if (
|
|
30943
|
+
if (categoryWeight) {
|
|
30781
30944
|
dispatch(deleteCategory(categoryId));
|
|
30782
30945
|
dispatch(recalculateWeightage());
|
|
30783
30946
|
} else {
|
|
@@ -30787,14 +30950,14 @@ const SurveyCreationPage = ({
|
|
|
30787
30950
|
return /*#__PURE__*/React.createElement("div", {
|
|
30788
30951
|
className: "create-survey-page",
|
|
30789
30952
|
style: {
|
|
30790
|
-
background:
|
|
30791
|
-
display:
|
|
30792
|
-
padding:
|
|
30953
|
+
background: "white",
|
|
30954
|
+
display: "block",
|
|
30955
|
+
padding: "15px"
|
|
30793
30956
|
}
|
|
30794
30957
|
}, categories.map(category => /*#__PURE__*/React.createElement(CategoryCard, {
|
|
30795
30958
|
key: category.id,
|
|
30796
30959
|
category: category,
|
|
30797
|
-
checked:
|
|
30960
|
+
checked: categoryWeight,
|
|
30798
30961
|
readOnly: readOnly,
|
|
30799
30962
|
onDelete: handleDeleteCategory,
|
|
30800
30963
|
hideQuestionLabel: hideQuestionLabel
|
|
@@ -30806,11 +30969,11 @@ const SurveyCreationPage = ({
|
|
|
30806
30969
|
backgroundColor: "#007bff",
|
|
30807
30970
|
color: "white",
|
|
30808
30971
|
cursor: "pointer",
|
|
30809
|
-
marginBottom:
|
|
30972
|
+
marginBottom: "10px"
|
|
30810
30973
|
},
|
|
30811
30974
|
onClick: () => {
|
|
30812
|
-
console.log("checked",
|
|
30813
|
-
if (
|
|
30975
|
+
console.log("checked", categoryWeight);
|
|
30976
|
+
if (categoryWeight === true) {
|
|
30814
30977
|
dispatch(addCategory(index));
|
|
30815
30978
|
dispatch(recalculateWeightage());
|
|
30816
30979
|
setIndex(index + 1);
|
|
@@ -30821,7 +30984,7 @@ const SurveyCreationPage = ({
|
|
|
30821
30984
|
}
|
|
30822
30985
|
}, "Add Section"), /*#__PURE__*/React.createElement("div", {
|
|
30823
30986
|
style: {
|
|
30824
|
-
marginTop:
|
|
30987
|
+
marginTop: "20px"
|
|
30825
30988
|
}
|
|
30826
30989
|
}, /*#__PURE__*/React.createElement("div", {
|
|
30827
30990
|
style: {
|
|
@@ -30830,14 +30993,15 @@ const SurveyCreationPage = ({
|
|
|
30830
30993
|
}
|
|
30831
30994
|
}, /*#__PURE__*/React.createElement("input", {
|
|
30832
30995
|
style: {
|
|
30833
|
-
height:
|
|
30834
|
-
width:
|
|
30996
|
+
height: "20px",
|
|
30997
|
+
width: "20px"
|
|
30835
30998
|
},
|
|
30836
30999
|
type: "checkbox",
|
|
30837
|
-
checked:
|
|
30838
|
-
|
|
31000
|
+
checked: categoryWeight,
|
|
31001
|
+
disabled: readOnly,
|
|
30839
31002
|
onChange: e => {
|
|
30840
31003
|
console.log("e checked", e.target.checked);
|
|
31004
|
+
dispatch(autoCalculateCategoriesWeight(e.target.checked));
|
|
30841
31005
|
setChecked(e.target.checked);
|
|
30842
31006
|
if (e.target.checked === true) {
|
|
30843
31007
|
dispatch(recalculateWeightage());
|