Skip to content

Commit

Permalink
Merge pull request #256 from AkshataKatwal16/admin
Browse files Browse the repository at this point in the history
Issue feat : update translation as per sheet
  • Loading branch information
itsvick authored Oct 16, 2024
2 parents 881cee0 + f431905 commit a1f8532
Show file tree
Hide file tree
Showing 9 changed files with 735 additions and 87 deletions.
259 changes: 251 additions & 8 deletions public/locales/hi/common.json

Large diffs are not rendered by default.

259 changes: 251 additions & 8 deletions public/locales/mr/common.json

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions public/locales/or/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"NO_DATA_FOUND": "ତଥ୍ୟ ମିଳିଲା ନାହିଁ",
"SUBMIT": "ଦାଖଲ କରନ୍ତୁ",
"BACK": "ପଛକୁ ଯାଆନ୍ତୁ"

},
"LOGIN_PAGE": {
"USERNAME": "ଉପଭୋକ୍ତା ନାମ",
Expand All @@ -49,12 +50,14 @@
"TEAM_LEADERS": "ଦଳ ନେତାମାନେ",
"CREATE_PLAN": "ଯୋଜନା ସୃଷ୍ଟି କରନ୍ତୁ",
"VIEW_PLANS": "ଯୋଜନାଗୁଡ଼ିକୁ ଦେଖନ୍ତୁ"

},
"FACILITATORS": {
"ALL_STATES": "ସମସ୍ତ ରାଜ୍ୟ",
"ALL_DISTRICTS": "ସମସ୍ତ ଜିଲ୍ଲା",
"ALL_BLOCKS": "ସମସ୍ତ ବ୍ଲକ୍",
"SEARCHBAR_PLACEHOLDER": "ସହଜକାରୀମାନଙ୍କୁ ଖୋଜନ୍ତୁ.."

},
"NAVBAR": {
"SEARCHBAR_PLACEHOLDER": "ପାଠ୍ୟକ୍ରମ, ବିଷୟ, ଛାତ୍ର, ପିଡ଼ଏଫ୍ ଇତ୍ୟାଦି ଖୋଜନ୍ତୁ.."
Expand All @@ -63,9 +66,11 @@
"SEARCHBAR_PLACEHOLDER": "ଶିକ୍ଷାର୍ଥୀମାନଙ୍କୁ ଖୋଜନ୍ତୁ..",
"NEW_LEARNER": "ନୂତନ ଶିକ୍ଷାର୍ଥୀ",
"FIRST_SELECT_REQUIRED_FIELDS": "ପ୍ରଥମେ ଆବଶ୍ୟକ ତଥ୍ୟଗୁଡ଼ିକୁ ଚୟନ କରନ୍ତୁ"

},
"TEAM_LEADERS": {
"SEARCHBAR_PLACEHOLDER": "ଦଳ ନେତାମାନଙ୍କୁ ଖୋଜନ୍ତୁ.."

},
"COHORTS": {
"SEARCHBAR_PLACEHOLDER": "ଗୋଷ୍ଠୀମାନଙ୍କୁ ଖୋଜନ୍ତୁ.."
Expand All @@ -82,6 +87,7 @@
"SEARCHBAR_PLACEHOLDER_DISTRICT": "ଜିଲ୍ଲାମାନଙ୍କୁ ଖୋଜନ୍ତୁ",
"SEARCHBAR_PLACEHOLDER_BLOCK": "ବ୍ଲକ୍ ଗୁଡ଼ିକୁ ଖୋଜନ୍ତୁ",
"BLOCKS": "ବ୍ଲକ୍ମାନେ"

},
"CENTERS": {
"CENTERS": "କେନ୍ଦ୍ରଗୁଡ଼ିକ",
Expand All @@ -103,6 +109,7 @@
"CENTER_RENAMED": "କେନ୍ଦ୍ର ଶୁଭକାମନାର ସହିତ ପୁନର୍ନାମ କରାଯାଇଛି!",
"SEND_REQUEST": "ଅନୁରୋଧ ପଠାନ୍ତୁ",
"REQUEST_TO_DELETE_HAS_BEEN_SENT": "ମିଟିବା ପାଇଁ ଅନୁରୋଧ ପଠାଇ ଦିଆଯାଇଛି"

},
"FORM": {
"FULL_NAME": "ପୂର୍ଣ୍ଣ ନାମ",
Expand Down Expand Up @@ -158,5 +165,9 @@
"EMAIL": "ଇମେଲ୍",
"YEAR_OF_ JOINING_SCP": "SCP ମଧ୍ୟରେ ସାମିଲ ହେବାର ବର୍ଷ",
"ASSIGN_CENTERS": "କେନ୍ଦ୍ର ସୁପର୍ଦ୍ଦ କରନ୍ତୁ"

}



}
10 changes: 9 additions & 1 deletion src/components/AddNewCenters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,15 @@ const AddNewCenters: React.FC<AddLearnerModalProps> = ({
fields: formResponse.fields.filter((field: any) => !field.isHidden),
};
}

useEffect(() => {
if (!open) {
setShowForm(false)
}
else
{

}
}, [onClose, open]);
useEffect(() => {
const getAddLearnerFormData = async () => {
const admin = localStorage.getItem("adminInfo");
Expand Down
82 changes: 46 additions & 36 deletions src/pages/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,18 @@ const Block: React.FC = () => {
sort: sortBy,
};

const response = await queryClient.fetchQuery({
queryKey: [
QueryKeys.FIELD_OPTION_READ,
reqParams.limit,
reqParams.offset,
searchKeyword || "",
CohortTypes.DISTRICT,
reqParams.sort.join(","),
],
queryFn: () => getCohortList(reqParams),
});
// const response = await queryClient.fetchQuery({
// queryKey: [
// QueryKeys.FIELD_OPTION_READ,
// reqParams.limit,
// reqParams.offset,
// searchKeyword || "",
// CohortTypes.DISTRICT,
// reqParams.sort.join(","),
// ],
// queryFn: () => getCohortList(reqParams),
// });
const response= await getCohortList(reqParams)

const cohortDetails = response?.results?.cohortDetails || [];

Expand Down Expand Up @@ -277,19 +278,26 @@ const Block: React.FC = () => {

const fetchBlocks = async () => {
try {
const response = await queryClient.fetchQuery({
queryKey: [
QueryKeys.FIELD_OPTION_READ,
// const response = await queryClient.fetchQuery({
// queryKey: [
// QueryKeys.FIELD_OPTION_READ,
// selectedDistrict === t("COMMON.ALL") ? "" : selectedDistrict,
// "blocks",
// ],
// queryFn: () =>
// getBlocksForDistricts({
// controllingfieldfk:
// selectedDistrict === t("COMMON.ALL") ? "" : selectedDistrict,
// fieldName: "blocks",
// }),
// });


const response=await getBlocksForDistricts({
controllingfieldfk:
selectedDistrict === t("COMMON.ALL") ? "" : selectedDistrict,
"blocks",
],
queryFn: () =>
getBlocksForDistricts({
controllingfieldfk:
selectedDistrict === t("COMMON.ALL") ? "" : selectedDistrict,
fieldName: "blocks",
}),
});
fieldName: "blocks",
})
const blocks = response?.result?.values || [];
setBlocksOptionRead(blocks);

Expand Down Expand Up @@ -335,19 +343,21 @@ const Block: React.FC = () => {
sort: sortBy,
};

const response = await queryClient.fetchQuery({
queryKey: [
QueryKeys.FIELD_OPTION_READ,
reqParams.limit,
reqParams.offset,
searchKeyword || "",
stateCode,
reqParams.filters.districts,
CohortTypes.BLOCK,
reqParams.sort.join(","),
],
queryFn: () => getCohortList(reqParams),
});
// const response = await queryClient.fetchQuery({
// queryKey: [
// QueryKeys.FIELD_OPTION_READ,
// reqParams.limit,
// reqParams.offset,
// searchKeyword || "",
// stateCode,
// reqParams.filters.districts,
// CohortTypes.BLOCK,
// reqParams.sort.join(","),
// ],
// queryFn: () => getCohortList(reqParams),
// });
const response= await getCohortList(reqParams)


const cohortDetails = response?.results?.cohortDetails || [];
const filteredBlockData = cohortDetails
Expand Down
49 changes: 25 additions & 24 deletions src/pages/district.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,19 +218,19 @@ const District: React.FC = () => {
sort: sortBy,
};

const response = await queryClient.fetchQuery({
queryKey: [
QueryKeys.FIELD_OPTION_READ,
reqParams.limit,
reqParams.offset,
searchKeyword || "",
stateCode,
CohortTypes.DISTRICT,
reqParams.sort.join(","),
],
queryFn: () => getCohortList(reqParams),
});

// const response = await queryClient.fetchQuery({
// queryKey: [
// QueryKeys.FIELD_OPTION_READ,
// reqParams.limit,
// reqParams.offset,
// searchKeyword || "",
// stateCode,
// CohortTypes.DISTRICT,
// reqParams.sort.join(","),
// ],
// queryFn: () => getCohortList(reqParams),
// });
const response= await getCohortList(reqParams)
const cohortDetails = response?.results?.cohortDetails || [];

const filteredDistrictData = cohortDetails
Expand Down Expand Up @@ -302,17 +302,18 @@ const District: React.FC = () => {
},
sort: sortBy,
};
const response = await queryClient.fetchQuery({
queryKey: [
QueryKeys.FIELD_OPTION_READ,
reqParams.limit,
reqParams.offset,
reqParams.filters.districts || "",
CohortTypes.BLOCK,
reqParams.sort.join(","),
],
queryFn: () => getCohortList(reqParams),
});
// const response = await queryClient.fetchQuery({
// queryKey: [
// QueryKeys.FIELD_OPTION_READ,
// reqParams.limit,
// reqParams.offset,
// reqParams.filters.districts || "",
// CohortTypes.BLOCK,
// reqParams.sort.join(","),
// ],
// queryFn: () => getCohortList(reqParams),
// });
const response= await getCohortList(reqParams)

const activeBlocks = response?.results?.cohortDetails || [];

Expand Down
2 changes: 1 addition & 1 deletion src/pages/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const LoginPage = () => {
localStorage.setItem('adminInfo', JSON.stringify(userInfo))
localStorage.setItem('stateName', userInfo?.customFields[0]?.value);
}
if(userInfo.role!==Role.ADMIN)
if(userInfo?.role!==Role.ADMIN)
{
const errorMessage = t("LOGIN_PAGE.USERNAME_PASSWORD_NOT_CORRECT");
showToastMessage(errorMessage, "error");
Expand Down
32 changes: 27 additions & 5 deletions src/pages/logout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,33 @@ function Logout() {
}
};
userLogout();
localStorage.removeItem("token");
localStorage.removeItem("userId");
localStorage.removeItem("name");
localStorage.removeItem("tenantId");
localStorage.removeItem("adminInfo");
if (typeof window !== 'undefined' && window.localStorage) {
// Specify the keys you want to keep
const keysToKeep = [
'preferredLanguage',
'mui-mode',
'mui-color-scheme-dark',
'mui-color-scheme-light',
'hasSeenTutorial',
];
// Retrieve the values of the keys to keep
const valuesToKeep: { [key: string]: any } = {};
keysToKeep.forEach((key: string) => {
valuesToKeep[key] = localStorage.getItem(key);
});

// Clear all local storage
localStorage.clear();

// Re-add the keys to keep with their values
keysToKeep.forEach((key: string) => {
if (valuesToKeep[key] !== null) {
// Check if the key exists and has a value
localStorage.setItem(key, valuesToKeep[key]);
}
});
}




Expand Down
Loading

0 comments on commit a1f8532

Please sign in to comment.