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

Re render assumption fix, atleast one mdms check, blank custom name check, #1884

Merged
merged 28 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
bf22f9e
added serving facility
NabeelAyubee Nov 19, 2024
9663588
Merge branch 'console' into qquickfix
NabeelAyubee Nov 20, 2024
42f5559
form composer action bar fix
NabeelAyubee Nov 20, 2024
91d278f
Merge branch 'console' into qquickfix
NabeelAyubee Nov 20, 2024
2ce9f7d
plan inbox assignee fix
NabeelAyubee Nov 20, 2024
5aee746
Merge branch 'console' into qquickfix
NabeelAyubee Nov 20, 2024
870f16f
formula and assumption refresh issue
NabeelAyubee Nov 20, 2024
21fe438
Merge branch 'console' into qquickfix
NabeelAyubee Nov 20, 2024
fa9df24
Merge branch 'console' into qquickfix
NabeelAyubee Nov 20, 2024
7449c7d
action bar hidden fixes, session fixes
NabeelAyubee Nov 21, 2024
a3c837b
Merge branch 'console' into qquickfix
NabeelAyubee Nov 21, 2024
00f3383
Merge branch 'console' into qquickfix
NabeelAyubee Nov 21, 2024
ca8ce40
fixes
NabeelAyubee Nov 21, 2024
7cac560
Merge branch 'console' into qquickfix
NabeelAyubee Nov 21, 2024
77260f7
fix
NabeelAyubee Nov 21, 2024
1ca7d64
action bar fix, formula next back issue
NabeelAyubee Nov 22, 2024
13226db
Merge branch 'console' into qquickfix
NabeelAyubee Nov 22, 2024
7e08742
assumption and formula one mdms check and refetch blank label check
NabeelAyubee Nov 22, 2024
8ad815c
Merge branch 'console' into qquickfix
NabeelAyubee Nov 22, 2024
7314d8b
Merge branch 'console' into qquickfix
NabeelAyubee Nov 25, 2024
392ba1d
remove status log column
NabeelAyubee Nov 25, 2024
5343037
fix
NabeelAyubee Nov 25, 2024
0aff786
adhoc fix
NabeelAyubee Nov 25, 2024
12d97e9
Merge branch 'console' into qquickfix
NabeelAyubee Nov 25, 2024
60f44b9
fix
NabeelAyubee Nov 25, 2024
e343818
fix
NabeelAyubee Nov 25, 2024
29d5f78
del session
NabeelAyubee Nov 25, 2024
9665aca
Merge branch 'console' into qquickfix
NabeelAyubee Nov 25, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const FormulaConfigWrapper = ({ onSelect, props: customProps }) => {
const curr = Digit.SessionStorage.get("MICROPLAN_DATA")?.FORMULA_CONFIGURATION?.formulaConfiguration?.formulaConfigValues;
if (curr?.length > 0) {
setFormulaParams(curr);
setFormulaConfigValues(curr);
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
}
}, []);

Expand Down Expand Up @@ -194,7 +195,14 @@ const FormulaConfigWrapper = ({ onSelect, props: customProps }) => {

const handleNext = () => {
//here just check formulConfigValues
if (formulaConfigValues.some((i) => i.operatorName === "SUBSTRACTION" && i.input === i.assumptionValue)) {
if (formulaConfigValues?.filter((row) => row?.category === currentCategory)?.filter((i) => i.source === "MDMS")?.length === 0) {
setShowToast({
key: "error",
label: t("ATLEAST_ONE_MDMS_FORMULA"),
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
transitionTime: 3000,
});
return;
} else if (formulaConfigValues.some((i) => i.operatorName === "SUBSTRACTION" && i.input === i.assumptionValue)) {
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
setShowToast({
key: "error",
label: t("ERR_MANDATORY_FIELD_SAME_OPERAND"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,42 @@ const FormulaConfiguration = ({ onSelect, category, customProps, formulas: initi
variation={"secondary"}
label={t("YES")}
onClick={() => {
if(selectedDeletedFormula?.code === "NEW_FORMULA" && !selectedDeletedFormula){
setShowToast({
key: "error",
label: t("PLS_ENTER_FORMULA_NAME"),
transitionTime: 3000,
style:{
zIndex:1000000
}
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
});
return;
}

if(selectedDeletedFormula?.code === "NEW_FORMULA" && selectedDeletedFormula?.name?.trim()?.length === 0){
setShowToast({
key: "error",
label: t("INVALID_FORMULA_NAME"),
transitionTime: 3000,
style:{
zIndex:1000000
}
});
return;
}

if(selectedDeletedFormula?.code === "NEW_FORMULA" && selectedDeletedFormula?.name?.length > 100){
setShowToast({
key: "error",
label: t("SELECT_FORMULA_NAME_LONG_THAN_100"),
transitionTime: 3000,
style:{
zIndex:1000000
}
});
return;
}
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved

addNewFormula();
}}
/>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { PRIMARY_COLOR } from "../utils/utilities";
import { useMyContext } from "../utils/context";
import { useAssumptionContext } from "./HypothesisWrapper";

const Hypothesis = ({ category, assumptions: initialAssumptions, setShowToast, allMdmsAssumptionsForThisCategory,campaignType }) => {
const Hypothesis = ({ category, assumptions: initialAssumptions, setShowToast, allMdmsAssumptionsForThisCategory, campaignType }) => {
const { state, dispatch } = useMyContext();
const { t } = useTranslation();
const [showPopUP, setShowPopUp] = useState(false);
Expand Down Expand Up @@ -322,27 +322,51 @@ const Hypothesis = ({ category, assumptions: initialAssumptions, setShowToast, a
variation={"primary"}
label={t("YES")}
onClick={() => {
//here if assumption name is not given then show a toast message and return
if(!selectedDeletedAssumption){
//here if assumption name is not given then show a toast message and return
if (selectedDeletedAssumption?.name?.length > 100) {
setShowToast({
key: "error",
label: t("SELECT_ASSUMPTION_NAME_LONG_THAN_100"),
transitionTime: 3000,
style: {
zIndex: 1000000,
},
});
return;
}
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved

if (!selectedDeletedAssumption) {
setShowToast({
key: "error",
label: t("PLS_SELECT_ASSUMPTION"),
transitionTime: 3000,
style:{
zIndex:1000000
}
style: {
zIndex: 1000000,
},
});
return;
}

if(selectedDeletedAssumption?.code === "NEW_ASSUMPTION" && !selectedDeletedAssumption?.name){

if (selectedDeletedAssumption?.code === "NEW_ASSUMPTION" && selectedDeletedAssumption?.name?.trim()?.length === 0) {
setShowToast({
key: "error",
label: t("INVALID_ASSUMPTION_NAME"),
transitionTime: 3000,
style: {
zIndex: 1000000,
},
});
return;
}
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved

if (selectedDeletedAssumption?.code === "NEW_ASSUMPTION" && !selectedDeletedAssumption?.name) {
setShowToast({
key: "error",
label: t("PLS_ENTER_ASSUMPTION_NAME"),
transitionTime: 3000,
style:{
zIndex:1000000
}
style: {
zIndex: 1000000,
},
});
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const HypothesisWrapper = ({ onSelect, props: customProps }) => {
const curr = Digit.SessionStorage.get("MICROPLAN_DATA")?.HYPOTHESIS?.Assumptions?.assumptionValues;
if (curr?.length > 0) {
setHypothesisParams(curr);
setAssumptionValues(curr);
}
}, []);

Expand Down Expand Up @@ -165,6 +166,15 @@ const HypothesisWrapper = ({ onSelect, props: customProps }) => {
const visibleAssumptions = currentAssumptions.filter((item) => existingAssumptionKeys?.includes(item) && !deletedAssumptions?.includes(item));

//Validate: Check if any value is empty for visible assumptions
const atleastOneMDMS = visibleAssumptions?.filter((i) => i?.source === "MDMS")?.length === 0;
if (atleastOneMDMS) {
setShowToast({
key: "error",
label: t("ATLEAST_ONE_MDMS_ASSUMPTION"),
transitionTime: 3000,
});
return; // Prevent moving to the next step
}
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
const hasEmptyFields = visibleAssumptions.some((item) => {
const value = assumptionValues.find((assumption) => assumption.key === item)?.value;
return !value; // Check if any value is empty
Expand Down Expand Up @@ -324,12 +334,22 @@ const HypothesisWrapper = ({ onSelect, props: customProps }) => {
}, [internalKey]);

useEffect(() => {
const initialAssumptions = filteredAssumptions.map((item) => ({
source: "MDMS",
category: undefined,
key: item,
value: undefined,
}));
const result = assumptionValues?.filter((item) => filteredAssumptions?.includes(item?.key));

const initialAssumptions =
result.length > 0
? result.map((item) => ({
source: item.source,
category: item.category,
key: item.key,
value: item.value,
}))
: filteredAssumptions.map((item) => ({
source: "MDMS",
category: undefined,
key: item,
value: undefined,
}));
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved

// Create a set of existing keys for quick lookup
const existingKeys = new Set(assumptionValues.map((assumption) => assumption.key));
Expand Down Expand Up @@ -363,7 +383,7 @@ const HypothesisWrapper = ({ onSelect, props: customProps }) => {
setDeletedAssumptions((prev) => [...prev, ...deletedAssumptionsForThisCategory]);
}
}
}, [planObject, isLoadingPlanObject, internalKey]);
}, [planObject, filteredAssumptions, isLoadingPlanObject, internalKey]);
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved

useEffect(() => {
if (internalKey === assumptionCategories.length) {
Expand Down Expand Up @@ -413,7 +433,11 @@ const HypothesisWrapper = ({ onSelect, props: customProps }) => {
>
<Hypothesis
category={assumptionCategories[internalKey - 1]?.category}
assumptions={[...filteredAssumptions.filter((item) => !deletedAssumptions?.includes(item)), ...customAssumption]}
assumptions={
filteredAssumptions?.filter((i) => assumptionValues?.some((j) => j.key === i))?.length > 0
? [...filteredAssumptions?.filter((i) => assumptionValues?.some((j) => j.key === i)), ...customAssumption]
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
: [...filteredAssumptions.filter((item) => !deletedAssumptions?.includes(item)), ...customAssumption]
}
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
onSelect={onSelect}
customProps={customProps}
setShowToast={setShowToast}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,24 @@ const PlanInbox = () => {
...getSecurityDetailsColumns(),
...getAdditionalFieldsColumns(),
...getResourceColumns(),
{
name: t("INBOX_STATUSLOGS"),
cell: (row, index, column, id) => (
<Button
label={t(`VIEW_LOGS`)}
onClick={() => {
setSelectedBusinessId(row?.original?.id); // Set the row.id to state
setSelectedBoundaryCode(row.boundaryCode);
setShowTimelinePopup(true);
}}
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
variation="link"
style={{}}
size={"medium"}
/>
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
),
sortable: false,
width: "180px",
},
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
// {
// name: t(`TOTAL_POPULATION`),
// cell: (row) => t(row?.totalPop) || "NA",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ const SetupMicroplan = ({ hierarchyType, hierarchyData }) => {

const handleUrlChange = (event) => {
const searchParams = new URLSearchParams(location.search);
setIsLastVerticalStep(searchParams.get("isLastVerticalStep"));
setIsFormulaLastVerticalStep(searchParams.get("isFormulaLastVerticalStep"));
setIsLastVerticalStep(searchParams.get("internalKey") === "6" || searchParams.get("internalKey") === "9"? true : searchParams.get("isLastVerticalStep"));
setIsFormulaLastVerticalStep(searchParams.get("internalKey") === "6" ? true : searchParams.get("isFormulaLastVerticalStep"));
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
};
useEffect(() => {
// Add event listener for popstate to detect URL changes
Expand Down Expand Up @@ -225,7 +225,7 @@ const SetupMicroplan = ({ hierarchyType, hierarchyData }) => {
},
});
}

refetchPlan();
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
setLoader(false);
},
onError: (error, variables) => {
Expand Down