diff --git a/src/components/AreaSelection.tsx b/src/components/AreaSelection.tsx index 0234d73f..b985ca1f 100644 --- a/src/components/AreaSelection.tsx +++ b/src/components/AreaSelection.tsx @@ -78,7 +78,7 @@ const AreaSelection: React.FC = ({ isMediumScreen, isCenterSelection = false, inModal = false, - handleCenterChangeWrapper = () => {}, + handleCenterChangeWrapper = () => { }, stateDefaultValue, blockDefaultValue, districtDefaultValue, @@ -117,15 +117,15 @@ const AreaSelection: React.FC = ({ }, }} > - {userType && !reAssignModal && inModal===false && ( + {userType && !reAssignModal && inModal === false && ( - {userType=== Role.CONTENT_CREATOR?t("SIDEBAR.SCTA"):userType} + {userType === Role.CONTENT_CREATOR ? t("SIDEBAR.SCTA") : userType} )} - { ( = ({ /> - - {userType!== FormContextType.CONTENT_CREATOR && inModal && - ( - <> - district.label)} - codes={districts?.map((district) => district.value)} - tagName={t("FACILITATORS.DISTRICT")} - selectedCategories={selectedDistrict} - onCategoryChange={handleDistrictChangeWrapper} - disabled={ - districts?.length <= 0 || - (selectedState.length === 0 && - stateDefaultValue === t("COMMON.ALL_STATES")) - } - overall={!inModal} - defaultValue={ - reAssignModal - ? districtDefaultValue - : selectedState.length > 0 && districts?.length === 0 - ? t("COMMON.NO_DISTRICTS") - : t("COMMON.ALL_DISTRICTS") - } - /> - - - {shouldRenderSelectCheckmarks &&( + 0 ? blocks.map((block) => block.label) : [] - // blocks.map((block) => block.label) - - )} - codes={ - - blocks?.length > 0 ? blocks?.map((block) => block.value) : [] - // blocks?.map((block) => block.value) - } - tagName={t("FACILITATORS.BLOCK")} - selectedCategories={capitalizeFirstLetterOfEachWordInArray( - selectedBlock - )} - onCategoryChange={handleBlockChangeWrapper} + names={districts?.map((district) => district.label)} + codes={districts?.map((district) => district.value)} + tagName={t("FACILITATORS.DISTRICT")} + selectedCategories={selectedDistrict} + onCategoryChange={handleDistrictChangeWrapper} disabled={ - blocks?.length <= 0 || - selectedDistrict?.length === 0 || - selectedDistrict[0] === t("COMMON.ALL_DISTRICTS") + districts?.length <= 0 || + (selectedState.length === 0 && + stateDefaultValue === t("COMMON.ALL_STATES")) } overall={!inModal} defaultValue={ - selectedDistrict?.length > 0 && (blocks?.length === 0) - ? t("COMMON.NO_BLOCKS") - : t("COMMON.ALL_BLOCKS") + reAssignModal + ? districtDefaultValue + : selectedState.length > 0 && districts?.length === 0 + ? t("COMMON.NO_DISTRICTS") + : t("COMMON.ALL_DISTRICTS") } /> - )} - - ) - } + + + {shouldRenderSelectCheckmarks && ( + 0 ? blocks.map((block) => block.label) : [] + // blocks.map((block) => block.label) + + )} + codes={ + + blocks?.length > 0 ? blocks?.map((block) => block.value) : [] + // blocks?.map((block) => block.value) + } + tagName={t("FACILITATORS.BLOCK")} + selectedCategories={capitalizeFirstLetterOfEachWordInArray( + selectedBlock + )} + onCategoryChange={handleBlockChangeWrapper} + disabled={ + blocks?.length <= 0 || + selectedDistrict?.length === 0 || + selectedDistrict[0] === t("COMMON.ALL_DISTRICTS") + } + overall={!inModal} + defaultValue={ + selectedDistrict?.length > 0 && (blocks?.length === 0) + ? t("COMMON.NO_BLOCKS") + : t("COMMON.ALL_BLOCKS") + } + /> + )} + {isCenterSelection && ( @@ -260,7 +255,7 @@ const AreaSelection: React.FC = ({ /> )} - + )}