diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 8881ce12..af9b987a 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -112,7 +112,6 @@ "NEW": "New {{role}}", "USER_CREDENTIAL_SEND_SUCCESSFULLY": "User credentials sent successfully!", "USER_CREDENTIALS_WILL_BE_SEND_SOON": "User credentials will be sent soon", - "REASSIGN_CENTERS": "Re-assign Center", "REASSIGN_BLOCKS": "Re-assign Blocks", "REASSIGN": "Reassign", @@ -121,8 +120,22 @@ "BLOCKS_REASSIGN_SUCCESSFULLY": "Block reassign successfully", "CENTERS_REASSIGN_FAILED": "Center Reassignment fails", "BLOCKS_REASSIGN_FAILED": "Block Reassignment fails", - "USER_COHORTS": "{{name}} belongs to below cohorts", - "DELETE_COHORT_WARNING": "Do you want to delete user from cohort?" + "USER_BLOCK": "{{name}} belongs to below block", + "USER_CENTERS": "{{name}} belongs to below centers", + "USER_CENTER": "{{name}} belongs to below center", + "DELETE_FROM_BLOCK_WARNING": "Do you want to delete user from block?", + "DELETE_FROM_CENTER_WARNING": "Do you want to delete user from center?", + "DELETE_FROM_CENTERS_WARNING": "Do you want to delete user from centers?", + "NO_CENTER_AVAILABLE": "No centers available", + "NO_BLOCK_AVAILABLE": "No blocks available", + "PLEASE_SELECT_BLOCK_LIST": "Please select block from block list", + "ALL_CENTERS": "All centers", + "NO_CENTERS": "No centers", + "MULTIPLE_TEAM_LEADERS_ASSIGNED": "Selected block {{selectedBlockForTL}} already has {{assignedTeamLeader}} Team Leaders assigned.", + "SINGLE_TEAM_LEADERS_ASSIGNED":"Selected block {{selectedBlockForTL}} already has {{assignedTeamLeader}} Team Leader assigned.", + "CONTINUE_ASSIGNED_TEAM_LEADER":"Still do you want to continue to assign team leader to {{selectedBlockForTL}}", + "ASSIGNED_TEAM_LEADERS":"{{assignedTeamLeaderNames}} and more..", + "CONTINUE":"Continue" }, "LOGIN_PAGE": { "USERNAME": "Username", @@ -156,7 +169,6 @@ "SEARCHBAR_PLACEHOLDER": "Search Facilitators..", "FACILITATOR_CREATED_SUCCESSFULLY": "Teacher is created, and credentials sent successfully!", "USER_CREDENTIALS_WILL_BE_SEND_SOON": "Teacher is created ,credentials will be sent soon", - "FACILITATOR_UPDATED_SUCCESSFULLY": "Teacher has been successfully updated!", "EDIT_FACILITATOR": "Edit Facilitator" }, @@ -169,7 +181,6 @@ "FIRST_SELECT_REQUIRED_FIELDS": "First select required fields", "LEARNER_CREATED_SUCCESSFULLY": "Learner has been successfully created!", "USER_CREDENTIALS_WILL_BE_SEND_SOON": "Learner is created, credentials will be sent soon", - "LEARNER_UPDATED_SUCCESSFULLY": "Learner has been successfully updated!", "EDIT_LEARNER": "Edit Learner" }, @@ -179,14 +190,12 @@ "FIRST_SELECT_REQUIRED_FIELDS": "First select required fields", "TEAM_LEADER_CREATED_SUCCESSFULLY": "Team Leader is created, and credentials sent successfully!", "USER_CREDENTIALS_WILL_BE_SEND_SOON": "Team Leader is created ,credentials will be sent soon", - "TEAM_LEADER_UPDATED_SUCCESSFULLY": "Team Leader has been successfully updated!", "EDIT_TEAM_LEADER": "Edit Team Leader" }, "ADMIN": { "ADMIN_UPDATED_SUCCESSFULLY": "Admin has been successfully updated!" }, - "COHORTS": { "SEARCHBAR_PLACEHOLDER": "Search Center.." }, @@ -208,11 +217,17 @@ "UPLOAD": "Upload", "COURSE_CREATED_SUCCESSFULLY": "Course created successfully", "COURSE_NOT_CREATED": "Course not created", - "SUB-TOPIC":"Sub-topic", - "SUBTOPICS":"Sub-Topics", + "SUB-TOPIC": "Sub-topic", + "SUBTOPICS": "Sub-Topics", "RESOURCES": "Resources", "TOPIC": "Topic", - "DURATION/MONTH": "Duration/Month" + "DURATION/MONTH": "Duration/Month", + "LEARNERS_PREREQISITE":"Learners Pre-requisites", + "NO_DATA_PRE":"No data available for Learners Pre-requisites", + "LEARNERS_POSTREQISITE":"Learners Post-requisites", + "NO_DATA_POST":"No data available for Learners Post-requisites", + "FACILITATORS":"Facilitators Requisites", + "NO_DATA":"No data available for Facilitators Requisites" }, "MASTER": { @@ -385,4 +400,4 @@ "CODE": "Code", "DISTRICT": "District" } -} +} \ No newline at end of file diff --git a/public/locales/hi/common.json b/public/locales/hi/common.json index 6ec1a9d4..c45dc088 100644 --- a/public/locales/hi/common.json +++ b/public/locales/hi/common.json @@ -1,66 +1,87 @@ { "COMMON": { "LANGUAGE": "भाषा", - "LOADING": "लोडिंग", + "LOADING": "लोड हो रहा है", + "ADD_NEW": "नया जोड़ें", + "PAGE_SIZE": "पृष्ठ आकार", + "DELETE_USER": "उपयोगकर्ता को स्थायी रूप से हटाएं", + "DELETE_USER_WITH_REASON": "उपयोगकर्ता को हटाएं", + "USER_DELETED_PERMANENTLY": "उपयोगकर्ता सफलतापूर्वक हटाया गया!", + "OTHER_REASON": "अन्य कारण", + "OTHER_REASON_PLACEHOLDER": "अन्य कारण दर्ज करें", + "REASON_FOR_DELETION": "हटाने का कारण", + "INCORRECT_DATA_ENTRY": "गलत डेटा प्रविष्टि", + "DUPLICATED_USER": "डुप्लिकेट उपयोगकर्ता", + "NO_USER_FOUND": "उपयोगकर्ता नहीं मिला", + "ALL": "सभी", + "NO_GO_BACK": "नहीं, वापस जाएं", + "YES": "हाँ", + "SURE_REASSIGN_CENTER": "क्या आप सुनिश्चित हैं कि आप इस उपयोगकर्ता को केंद्र पुनः आवंटित करना चाहते हैं?", + "OTHER": "अन्य", + "SORT": "छाँटें", + "EDIT_COHORT_NAME": "समूह संपादित करें", + "NAME": "नाम", + "UPDATE_COHORT": "समूह अपडेट करें", "EDIT": "संपादित करें", - "DELETE": "हटाएं" + "DELETE": "हटाएं", + "NO_DATA_FOUND": "कोई डेटा नहीं मिला", + "SUBMIT": "जमा करें", + "BACK": "वापस" }, "LOGIN_PAGE": { "USERNAME": "उपयोगकर्ता नाम", "PASSWORD": "पासवर्ड", - "LOGIN": "लॉग इन करें", + "LOGIN": "लॉगिन", "USERNAME_PLACEHOLDER": "उपयोगकर्ता नाम दर्ज करें", "PASSWORD_PLACEHOLDER": "पासवर्ड दर्ज करें", - "USERNAME_PASSWORD_NOT_CORRECT": "आपका यूजरनेम या पासवर्ड गलत है", + "USERNAME_PASSWORD_NOT_CORRECT": "आपके द्वारा दर्ज किया गया उपयोगकर्ता नाम या पासवर्ड गलत है", "FORGOT_PASSWORD": "पासवर्ड भूल गए?", - "REMEMBER_ME": "मुझे याद रखें", - "NO_GO_BACK": "नहीं, वापस जाओ", - "YES": "हाँ", - "OTHER": "अन्य", - "SORT": "क्रमबद्ध करें", - "EDIT_COHORT_NAME": "समूह संपादित करें", - "UPDATE_COHORT": "अद्यतन समूह" + "REMEMBER_ME": "मुझे याद रखें" }, - "COHORTS": { - "SEARCHBAR_PLACEHOLDER": "कोहॉर्ट्स खोजें.." + "SIDEBAR": { + "HI": "नमस्ते", + "DASHBOARD": "डैशबोर्ड", + "MANAGE_USERS": "उपयोगकर्ताओं का प्रबंधन करें", + "COURSE_PLANNER": "पाठ्यक्रम योजनाकार", + "COHORTS": "समूह", + "FACILITATORS": "सुविधा प्रदाता", + "LEARNERS": "शिक्षार्थी", + "TEAM_LEADERS": "टीम लीडर", + "CREATE_PLAN": "योजना बनाएं", + "VIEW_PLANS": "योजनाएँ देखें" }, - "ACTIONBUTONS": { - "EDIT": "संपादित करें", - "DELETE": "हटाएं" + "FACILITATORS": { + "ALL_STATES": "सभी राज्य", + "ALL_DISTRICTS": "सभी जिले", + "ALL_BLOCKS": "सभी ब्लॉक", + "SEARCHBAR_PLACEHOLDER": "सुविधा प्रदाता खोजें.." }, - "SIDEBAR": { - "FOUNDATION_COURSE": "आधार पाठ्यक्रम", - "MAIN_COURSE": "मुख्य पाठ्यक्रम" + "NAVBAR": { + "SEARCHBAR_PLACEHOLDER": "पाठ्यक्रम, विषय, छात्र, पीडीएफ आदि खोजें.." + }, + "LEARNERS": { + "SEARCHBAR_PLACEHOLDER": "शिक्षार्थियों को खोजें..", + "NEW_LEARNER": "नया शिक्षार्थी", + "FIRST_SELECT_REQUIRED_FIELDS": "पहले आवश्यक फ़ील्ड चुनें" }, - - "COURSE_PLANNER": { - "GRADE": "कक्षा", - "MEDIUM": "माध्यम", - "FILTER": "फिल्टर", - "BOARDS_FULLY_UPLOADED": "बोर्ड्स पूरी तरह से अपलोड हुए", - "ACTIVITY": "गतिविधि", - "COPY_LINK": "लिंक कॉपी करें", - "SEARCH": "खोजें", - "DATA_NOT_FOUND": "डेटा नहीं मिला", - "SUBJECTS_UPLOADED": "विषय अपलोड किए गए", - "IMPORT_PLANNER": "आयात नियोजक", - "REMOVE_FILE": "फाइल हटाएं", - "IMPORT_PLANNER_TO_UPLOADING": "अपलोड शुरू करने के लिए 'आयात नियोजक' पर क्लिक करें", - "TOPIC_DETAILS": "विषय विवरण" + "TEAM_LEADERS": { + "SEARCHBAR_PLACEHOLDER": "टीम लीडर्स को खोजें.." + }, + "COHORTS": { + "SEARCHBAR_PLACEHOLDER": "समूहों को खोजें.." }, "MASTER": { "STATE": "राज्य", - "SORT": "क्रमबद्ध करें", - "DISTRICT_NAMES": "जिला नाम", - "ACTIONS": "क्रियाएँ", + "STATE_NAMES": "राज्य के नाम", + "SORT": "छाँटें", + "DISTRICT_NAMES": "जिलों के नाम", + "BLOCK_NAMES": "ब्लॉक के नाम", + "ACTIONS": "कार्य", "DISTRICTS": "जिले", "SEARCHBAR_PLACEHOLDER_STATE": "राज्यों को खोजें", "SEARCHBAR_PLACEHOLDER_DISTRICT": "जिलों को खोजें", - "SEARCHBAR_PLACEHOLDER_BLOCK": "ब्लॉकों को खोजें", - "BLOCKS": "ब्लॉक", - "BLOCK_NAMES": "ब्लॉक के नाम", - "ALL_DISTRICTS": "सभी जिले", - "ALL_BLOCKS": "सभी ब्लॉक" + "SEARCHBAR_PLACEHOLDER_BLOCK": "ब्लॉक्स को खोजें", + "BLOCKS": "ब्लॉक्स" }, "CENTERS": { "CENTERS": "केंद्र", @@ -69,8 +90,8 @@ "REMOTE_CENTER": "दूरस्थ केंद्र", "REGULAR": "नियमित", "REMOTE": "दूरस्थ", - "SEARCH_BLOCKS": "ब्लॉक खोजें", - "BLOCK_REQUEST": "आप इस उपयोगकर्ता को ब्लॉक पुनः असाइन करने के लिए राज्य टीम लीडर को अनुरोध भेज रहे हैं", + "SEARCH_BLOCKS": "ब्लॉक्स को खोजें", + "BLOCK_REQUEST": "आप इस उपयोगकर्ता को ब्लॉक पुनः आवंटित करने के लिए राज्य टीम लीडर को अनुरोध भेज रहे हैं", "NEW_CENTER": "नया केंद्र", "CENTER_TYPE": "केंद्र प्रकार", "UNIT_NAME": "इकाई का नाम", @@ -82,5 +103,60 @@ "CENTER_RENAMED": "केंद्र का नाम सफलतापूर्वक बदला गया!", "SEND_REQUEST": "अनुरोध भेजें", "REQUEST_TO_DELETE_HAS_BEEN_SENT": "हटाने का अनुरोध भेजा गया है" + }, + "FORM": { + "FULL_NAME": "पूरा नाम", + "ENTER_FULL_NAME": "पूरा नाम दर्ज करें", + "CONTACT_NUMBER": "संपर्क नंबर", + "ENTER_CONTACT_NUMBER": "संपर्क नंबर दर्ज करें", + "HOW_WAS_LEARNER_MOBILISED": "शिक्षार्थी को कैसे जुटाया गया?", + "SECOND_CHANCE_ALUMNI": "सेकंड चांस पूर्व छात्र", + "PRATHAM_TEAM_MEMBER": "प्रथम टीम सदस्य", + "OTHER": "अन्य", + "AGE": "आयु", + "GENDER": "लिंग", + "MALE": "पुरुष", + "FEMALE": "महिला", + "LEARNERS_PRIMARY_WORK": "शिक्षार्थी का प्राथमिक कार्य", + "ENROLLED_IN_EDUCATIONAL_INSTITUTE": "शैक्षिक संस्थान में नामांकित", + "OWN_FARMING": "स्वयं की खेती", + "AGRICULTURAL_FARM_LABORER": "कृषि खेत मजदूर", + "NON_AGRICULTURAL_LABORER": "गैर-कृषि मजदूर", + "SALARIED_WORK": "वेतनभोगी कार्य", + "SELF_EMPLOYMENT": "स्व-रोजगार", + "UNEMPLOYED": "बेरोज़गार", + "INVOLVED_IN_DOMESTIC_WORK": "घरेलू कार्यों में शामिल", + "FATHER_NAME": "पिता का नाम", + "ENTER_YOUR_FATHER_NAME": "अपने पिता का नाम दर्ज करें", + "CLASS_OR_LAST_PASSED_GRADE": "कक्षा (अंतिम उत्तीर्ण ग्रेड)", + "NO_SCHOOLING": "कोई स्कूली शिक्षा नहीं", + "REASON_FOR_DROPOUT_FROM_SCHOOL": "स्कूल से बाहर होने का कारण", + "SCHOOL_INACCESSIBLE": "स्कूल पहुंच से बाहर", + "FINANCIAL_CONSTRAINTS": "वित्तीय सीमाएँ", + "LACK_OF_INTEREST": "रुचि की कमी", + "FAMILY_RESPONSIBILITIES": "पारिवारिक ज़िम्मेदारियाँ", + "FAILED": "असफल", + "ILLNESS": "बीमारी", + "MARRIAGE": "विवाह", + "MIGRATION": "प्रवास", + "STARTED_VOCATIONAL_COURSE": "व्यावसायिक पाठ्यक्रम शुरू किया", + "STARTED_A_JOB": "नौकरी शुरू की", + "SCHOOL_CLOSURE_DUE_TO_COVID": "कोविड के कारण स्कूल बंद", + "MARITAL_STATUS": "वैवाहिक स्थिति", + "UNMARRIED": "अविवाहित", + "MARRIED": "विवाहित", + "DIVORCED": "तलाकशुदा", + "PHONE_TYPE_AVAILABLE": "उपलब्ध फ़ोन का प्रकार", + "SMARTPHONE": "स्मार्टफोन", + "KEYPAD": "कीपैड", + "NO_PHONE": "कोई फोन नहीं", + "IS_IT_YOUR_OWN_PHONE": "क्या यह आपका खुद का फोन है?", + "YES": "हाँ", + "NO": "नहीं", + "TYPE_OF_PHONE_AVAILABLE": "उपलब्ध फ़ोन का प्रकार", + "REASON_FOR_DROP_OUT_FROM_SCHOOL": "स्कूल से बाहर होने का कारण", + "EMAIL": "ईमेल", + "YEAR_OF_ JOINING_SCP": "एससीपी में शामिल होने का वर्ष", + "ASSIGN_CENTERS": "केंद्र आवंटित करें" } -} +} \ No newline at end of file diff --git a/public/locales/mr/common.json b/public/locales/mr/common.json index b08edf2a..31789647 100644 --- a/public/locales/mr/common.json +++ b/public/locales/mr/common.json @@ -1,67 +1,87 @@ { "COMMON": { "LANGUAGE": "भाषा", - "LOADING": "लोड होत आहे", + "LOADING": "लोड करत आहे", + "ADD_NEW": "नवीन जोडा", + "PAGE_SIZE": "पृष्ठ आकार", + "DELETE_USER": "वापरकर्त्याला कायमस्वरूपी हटवा", + "DELETE_USER_WITH_REASON": "वापरकर्त्याला हटवा", + "USER_DELETED_PERMANENTLY": "वापरकर्ता यशस्वीरित्या हटविला गेला!", + "OTHER_REASON": "इतर कारण", + "OTHER_REASON_PLACEHOLDER": "इतर कारण प्रविष्ट करा", + "REASON_FOR_DELETION": "हटवण्याचे कारण", + "INCORRECT_DATA_ENTRY": "चुकीची डेटा नोंद", + "DUPLICATED_USER": "डुप्लिकेट वापरकर्ता", + "NO_USER_FOUND": "वापरकर्ता सापडला नाही", + "ALL": "सर्व", + "NO_GO_BACK": "नाही, परत जा", + "YES": "होय", + "SURE_REASSIGN_CENTER": "तुम्ही खात्री आहात की तुम्हाला या वापरकर्त्यास केंद्र पुन्हा नियुक्त करायचे आहे?", "OTHER": "इतर", "SORT": "क्रमवारी लावा", - "EDIT_COHORT_NAME": "समूह संपादित करा", + "EDIT_COHORT_NAME": "गट संपादित करा", "NAME": "नाव", - "UPDATE_COHORT": "कोहॉर्ट अपडेट करा", + "UPDATE_COHORT": "गट अद्यतनित करा", "EDIT": "संपादित करा", - "DELETE": "हटवा" + "DELETE": "हटवा", + "NO_DATA_FOUND": "डेटा सापडला नाही", + "SUBMIT": "सबमिट करा", + "BACK": "परत जा" }, "LOGIN_PAGE": { - "USERNAME": "वापरकर्तानाव", + "USERNAME": "वापरकर्ता नाव", "PASSWORD": "पासवर्ड", - "LOGIN": "लॉग इन करा", - "USERNAME_PLACEHOLDER": "वापरकर्तानाव प्रविष्ट करा", - "PASSWORD_PLACEHOLDER": "पासवर्ड टाका", - "USERNAME_PASSWORD_NOT_CORRECT": "आपलं वापरकर्तानाव किंवा संकेतशब्द चुकीचं आहे", - "FORGOT_PASSWORD": "पासवर्ड विसरलात?", - "REMEMBER_ME": "मला लक्षात ठेवा", - "NO_GO_BACK": "नाही, परत जा", - "YES": "होय" + "LOGIN": "लॉगिन", + "USERNAME_PLACEHOLDER": "वापरकर्ता नाव प्रविष्ट करा", + "PASSWORD_PLACEHOLDER": "पासवर्ड प्रविष्ट करा", + "USERNAME_PASSWORD_NOT_CORRECT": "तुम्ही प्रविष्ट केलेले वापरकर्ता नाव किंवा पासवर्ड चुकीचा आहे", + "FORGOT_PASSWORD": "पासवर्ड विसरलात का?", + "REMEMBER_ME": "मला लक्षात ठेवा" }, - "COHORTS": { - "SEARCHBAR_PLACEHOLDER": "कोहॉर्ट्स शोधा.." + "SIDEBAR": { + "HI": "नमस्कार", + "DASHBOARD": "डॅशबोर्ड", + "MANAGE_USERS": "वापरकर्त्यांचे व्यवस्थापन करा", + "COURSE_PLANNER": "अभ्यासक्रम नियोजक", + "COHORTS": "गट", + "FACILITATORS": "प्रशिक्षक", + "LEARNERS": "शिकणारे", + "TEAM_LEADERS": "टीम लीडर", + "CREATE_PLAN": "योजना तयार करा", + "VIEW_PLANS": "योजना पहा" }, - "ACTIONBUTONS": { - "EDIT": "संपादित करा", - "DELETE": "हटवा" + "FACILITATORS": { + "ALL_STATES": "सर्व राज्ये", + "ALL_DISTRICTS": "सर्व जिल्हे", + "ALL_BLOCKS": "सर्व ब्लॉक्स", + "SEARCHBAR_PLACEHOLDER": "प्रशिक्षक शोधा.." }, - "SIDEBAR": { - "FOUNDATION_COURSE": "मूलभूत अभ्यासक्रम", - "MAIN_COURSE": "मुख्य अभ्यासक्रम" + "NAVBAR": { + "SEARCHBAR_PLACEHOLDER": "अभ्यासक्रम, विषय, विद्यार्थी, पीडीएफ इत्यादी शोधा.." }, - "COURSE_PLANNER": { - "GRADE": "इयत्ता", - "MEDIUM": "माध्यम", - "FILTER": "फिल्टर", - "BOARDS_FULLY_UPLOADED": "बोर्ड्स पूर्णपणे अपलोड केले", - "ACTIVITY": "क्रियाकलाप", - "COPY_LINK": "लिंक कॉपी करा", - "SEARCH": "शोधा", - "DATA_NOT_FOUND": "डेटा आढळला नाही", - "SUBJECTS_UPLOADED": "विषय अपलोड केले", - "IMPORT_PLANNER": "आयात नियोजक", - "REMOVE_FILE": "फाईल काढा", - "IMPORT_PLANNER_TO_UPLOADING": "अपलोड करण्यास सुरुवात करण्यासाठी 'आयात नियोजक' वर क्लिक करा", - "TOPIC_DETAILS": "विषय तपशील" + "LEARNERS": { + "SEARCHBAR_PLACEHOLDER": "शिकणारे शोधा..", + "NEW_LEARNER": "नवीन शिकणारा", + "FIRST_SELECT_REQUIRED_FIELDS": "प्रथम आवश्यक फील्ड निवडा" + }, + "TEAM_LEADERS": { + "SEARCHBAR_PLACEHOLDER": "टीम लीडर शोधा.." + }, + "COHORTS": { + "SEARCHBAR_PLACEHOLDER": "गट शोधा.." }, - "MASTER": { "STATE": "राज्य", + "STATE_NAMES": "राज्याची नावे", "SORT": "क्रमवारी लावा", "DISTRICT_NAMES": "जिल्ह्यांची नावे", + "BLOCK_NAMES": "ब्लॉकची नावे", "ACTIONS": "कृती", "DISTRICTS": "जिल्हे", - "SEARCHBAR_PLACEHOLDER_STATE": "राज्य शोधा", + "SEARCHBAR_PLACEHOLDER_STATE": "राज्ये शोधा", "SEARCHBAR_PLACEHOLDER_DISTRICT": "जिल्हे शोधा", - "SEARCHBAR_PLACEHOLDER_BLOCK": "ब्लॉक शोधा", - "BLOCKS": "ब्लॉक", - "BLOCK_NAMES": "ब्लॉकचे नावे", - "ALL_DISTRICTS": "सर्व जिल्हे", - "ALL_BLOCKS": "सर्व ब्लॉक" + "SEARCHBAR_PLACEHOLDER_BLOCK": "ब्लॉक्स शोधा", + "BLOCKS": "ब्लॉक्स" }, "CENTERS": { "CENTERS": "केंद्रे", @@ -70,18 +90,73 @@ "REMOTE_CENTER": "दूरस्थ केंद्र", "REGULAR": "नियमित", "REMOTE": "दूरस्थ", - "SEARCH_BLOCKS": "ब्लॉक शोधा", - "BLOCK_REQUEST": "आपण या वापरकर्त्यास ब्लॉक पुन्हा नियुक्त करण्यासाठी राज्य टीम लीडरला विनंती पाठवत आहात", + "SEARCH_BLOCKS": "ब्लॉक्स शोधा", + "BLOCK_REQUEST": "तुम्ही या वापरकर्त्यास ब्लॉक पुन्हा नियुक्त करण्यासाठी राज्य टीम लीडरला विनंती पाठवत आहात", "NEW_CENTER": "नवीन केंद्र", "CENTER_TYPE": "केंद्र प्रकार", "UNIT_NAME": "युनिटचे नाव", - "NOTE": "टीप: हे केंद्राचे नाव असेल", - "CENTER_CREATED": "केंद्र यशस्वीरित्या तयार झाले!", + "NOTE": "लक्षात घ्या: हे केंद्राचे नाव असेल", + "CENTER_CREATED": "केंद्र यशस्वीरित्या तयार केले गेले!", "RENAME_CENTER": "केंद्राचे नाव बदला", - "REQUEST_TO_DELETE": "हटविण्याची विनंती", + "REQUEST_TO_DELETE": "हटवण्याची विनंती", "RENAME": "नाव बदला", - "CENTER_RENAMED": "केंद्राचे नाव यशस्वीरित्या बदलले!", + "CENTER_RENAMED": "केंद्राचे नाव यशस्वीरित्या बदलले गेले!", "SEND_REQUEST": "विनंती पाठवा", - "REQUEST_TO_DELETE_HAS_BEEN_SENT": "हटविण्याची विनंती पाठविण्यात आली आहे" + "REQUEST_TO_DELETE_HAS_BEEN_SENT": "हटवण्याची विनंती पाठवली गेली आहे" + }, + "FORM": { + "FULL_NAME": "पूर्ण नाव", + "ENTER_FULL_NAME": "पूर्ण नाव प्रविष्ट करा", + "CONTACT_NUMBER": "संपर्क क्रमांक", + "ENTER_CONTACT_NUMBER": "संपर्क क्रमांक प्रविष्ट करा", + "HOW_WAS_LEARNER_MOBILISED": "शिकणार्‍यास कसे एकत्रित केले?", + "SECOND_CHANCE_ALUMNI": "सेकंड चान्स माजी विद्यार्थी", + "PRATHAM_TEAM_MEMBER": "प्रथम टीम सदस्य", + "OTHER": "इतर", + "AGE": "वय", + "GENDER": "लिंग", + "MALE": "पुरुष", + "FEMALE": "महिला", + "LEARNERS_PRIMARY_WORK": "शिकणार्‍याचे प्राथमिक कार्य", + "ENROLLED_IN_EDUCATIONAL_INSTITUTE": "शैक्षणिक संस्थेत नावनोंदणी केली", + "OWN_FARMING": "स्वत:ची शेती", + "AGRICULTURAL_FARM_LABORER": "कृषी शेतमजूर", + "NON_AGRICULTURAL_LABORER": "गैर-कृषी मजूर", + "SALARIED_WORK": "पगारी काम", + "SELF_EMPLOYMENT": "स्वयंरोजगार", + "UNEMPLOYED": "बेरोजगार", + "INVOLVED_IN_DOMESTIC_WORK": "घरगुती कामात गुंतलेले", + "FATHER_NAME": "वडिलांचे नाव", + "ENTER_YOUR_FATHER_NAME": "तुमचे वडिलांचे नाव प्रविष्ट करा", + "CLASS_OR_LAST_PASSED_GRADE": "वर्ग (शेवटचा उत्तीर्ण ग्रेड)", + "NO_SCHOOLING": "शालेय शिक्षण नाही", + "REASON_FOR_DROPOUT_FROM_SCHOOL": "शाळा सोडण्याचे कारण", + "SCHOOL_INACCESSIBLE": "शाळा उपलब्ध नाही", + "FINANCIAL_CONSTRAINTS": "आर्थिक मर्यादा", + "LACK_OF_INTEREST": "आवडीचा अभाव", + "FAMILY_RESPONSIBILITIES": "कौटुंबिक जबाबदाऱ्या", + "FAILED": "अयशस्वी", + "ILLNESS": "आजारपण", + "MARRIAGE": "लग्न", + "MIGRATION": "स्थलांतर", + "STARTED_VOCATIONAL_COURSE": "व्यावसायिक कोर्स सुरू केला", + "STARTED_A_JOB": "नोकरी सुरू केली", + "SCHOOL_CLOSURE_DUE_TO_COVID": "कोविडमुळे शाळा बंद", + "MARITAL_STATUS": "वैवाहिक स्थिती", + "UNMARRIED": "अविवाहित", + "MARRIED": "विवाहित", + "DIVORCED": "घटस्फोटीत", + "PHONE_TYPE_AVAILABLE": "उपलब्ध फोनचा प्रकार", + "SMARTPHONE": "स्मार्टफोन", + "KEYPAD": "कीपॅड", + "NO_PHONE": "फोन नाही", + "IS_IT_YOUR_OWN_PHONE": "हा तुमचा स्वत:चा फोन आहे का?", + "YES": "होय", + "NO": "नाही", + "TYPE_OF_PHONE_AVAILABLE": "उपलब्ध फोनचा प्रकार", + "REASON_FOR_DROP_OUT_FROM_SCHOOL": "शाळा सोडण्याचे कारण", + "EMAIL": "ईमेल", + "YEAR_OF_ JOINING_SCP": "एससीपीमध्ये सामील होण्याचे वर्ष", + "ASSIGN_CENTERS": "केंद्रे नियुक्त करा" } -} +} \ No newline at end of file diff --git a/public/locales/or/common.json b/public/locales/or/common.json index fcba4fdf..fd989feb 100644 --- a/public/locales/or/common.json +++ b/public/locales/or/common.json @@ -1,85 +1,162 @@ { "COMMON": { "LANGUAGE": "ଭାଷା", - "LOADING": "ଲୋଡ୍ ହେଉଛି (Loading)", - "UPDATE_COHORT": "କୋହୋର୍ଟ୍ ଅଦ୍ୟତନ କରନ୍ତୁ", - "SORT": "ସର୍ଟ", - "OTHER": "ଅନ୍ୟ", + "LOADING": "ଲୋଡ୍ ହେଉଛି", + "ADD_NEW": "ନୂତନ ଯୋଡନ୍ତୁ", + "PAGE_SIZE": "ପୃଷ୍ଠା ଆକାର", + "DELETE_USER": "ଉପଭୋକ୍ତାକୁ ଶାଶ୍ଵତ ଭାବରେ ହଟାନ୍ତୁ", + "DELETE_USER_WITH_REASON": "ଉପଭୋକ୍ତାକୁ ହଟାନ୍ତୁ", + "USER_DELETED_PERMANENTLY": "ଉପଭୋକ୍ତାକୁ ସଫଳତାର ସହ ହଟାଯାଇଛି!", + "OTHER_REASON": "ଅନ୍ୟାନ୍ୟ କାରଣ", + "OTHER_REASON_PLACEHOLDER": "ଅନ୍ୟାନ୍ୟ କାରଣ ଲେଖନ୍ତୁ", + "REASON_FOR_DELETION": "ହଟାଇବାର କାରଣ", + "INCORRECT_DATA_ENTRY": "ତ୍ରୁଟିପୂର୍ଣ୍ଣ ତଥ୍ୟ ଆବେଶ", + "DUPLICATED_USER": "ଡୁପ୍ଲିକେଟ୍ ଉପଭୋକ୍ତା", + "NO_USER_FOUND": "ଉପଭୋକ୍ତାକୁ ପାଇଁ ହେବନାହିଁ", + "ALL": "ସମସ୍ତ", + "NO_GO_BACK": "ନାହିଁ, ପଛକୁ ଯାଆନ୍ତୁ", + "YES": "ହଁ", + "SURE_REASSIGN_CENTER": "ଆପଣ ନିଶ୍ଚିତ କି ଏହି ଉପଭୋକ୍ତାଙ୍କୁ କେନ୍ଦ୍ର ପୁନର୍ନିୟୁକ୍ତ କରିବାକୁ ଚାହୁଁଛନ୍ତି?", + "OTHER": "ଅନ୍ୟାନ୍ୟ", + "SORT": "ବିନ୍ୟାସ", + "EDIT_COHORT_NAME": "ଗୋଷ୍ଠୀ ସମ୍ପାଦନା", "NAME": "ନାମ", - "EDIT": "ସଂପାଦନା", - "DELETE": "ବିଲୋପ" + "UPDATE_COHORT": "ଗୋଷ୍ଠୀ ଅଦ୍ୟତନ କରନ୍ତୁ", + "EDIT": "ସମ୍ପାଦନା", + "DELETE": "ହଟାନ୍ତୁ", + "NO_DATA_FOUND": "ତଥ୍ୟ ମିଳିଲା ନାହିଁ", + "SUBMIT": "ଦାଖଲ କରନ୍ତୁ", + "BACK": "ପଛକୁ ଯାଆନ୍ତୁ" }, "LOGIN_PAGE": { - "USERNAME": "ଉପଯୋଗକର୍ତା ନାମ", - "PASSWORD": "ପାସୱାର୍ଡ", + "USERNAME": "ଉପଭୋକ୍ତା ନାମ", + "PASSWORD": "ପ୍ରବେଶ କୋଡ଼", "LOGIN": "ପ୍ରବେଶ", - "USERNAME_PLACEHOLDER": "ଉପଯୋଗକର୍ତା ନାମ ଏଣ୍ଟର କର", - "PASSWORD_PLACEHOLDER": "ପାସୱାର୍ଡ ଏଣ୍ଟର କର", - "USERNAME_PASSWORD_NOT_CORRECT": "ଆପଣଙ୍କ ବ୍ୟବହାରକୃତ ନାମ କିମ୍ବା ପାସ୍‌ୱାର୍ଡ ଭୁଲ ଅଛି", - "FORGOT_PASSWORD": "ପାସ୍‌ୱାର୍ଡ ଭୁଲିଛନ୍ତି?", - "REMEMBER_ME": "ମୋତେ ମନ ରଖ", - "NO_GO_BACK": "ନାହିଁ, ପଛକୁ ଯାଆନ୍ତୁ", - "YES": "ହଁ" + "USERNAME_PLACEHOLDER": "ଉପଭୋକ୍ତା ନାମ ଲେଖନ୍ତୁ", + "PASSWORD_PLACEHOLDER": "ପ୍ରବେଶ କୋଡ଼ ଲେଖନ୍ତୁ", + "USERNAME_PASSWORD_NOT_CORRECT": "ଆପଣ ଲେଖିଥିବା ଉପଭୋକ୍ତା ନାମ କିମ୍ବା ପ୍ରବେଶ କୋଡ଼ ତ୍ରୁଟିପୂର୍ଣ୍ଣ", + "FORGOT_PASSWORD": "ପ୍ରବେଶ କୋଡ଼କୁ ଭୁଲିଗଲେ?", + "REMEMBER_ME": "ମୋତେ ମନେ ରଖନ୍ତୁ" }, - "ACTIONBUTONS": { - "EDIT": "ସଂପାଦନା", - "DELETE": "ବିଲୋପ" + "SIDEBAR": { + "HI": "ନମସ୍କାର", + "DASHBOARD": "ଡ୍ୟାସବୋର୍ଡ", + "MANAGE_USERS": "ଉପଭୋକ୍ତାମାନଙ୍କୁ ପରିଚାଳନା କରନ୍ତୁ", + "COURSE_PLANNER": "ପାଠ୍ୟକ୍ରମ ପ୍ରଣାଳୀକାରୀ", + "COHORTS": "ଗୋଷ୍ଠୀମାନେ", + "FACILITATORS": "ସହଜକାରୀମାନେ", + "LEARNERS": "ଶିକ୍ଷାର୍ଥୀମାନେ", + "TEAM_LEADERS": "ଦଳ ନେତାମାନେ", + "CREATE_PLAN": "ଯୋଜନା ସୃଷ୍ଟି କରନ୍ତୁ", + "VIEW_PLANS": "ଯୋଜନାଗୁଡ଼ିକୁ ଦେଖନ୍ତୁ" }, - "COHORTS": { - "SEARCHBAR_PLACEHOLDER": "କୋହର୍ଟସ୍ ସନ୍ଧାନ କରନ୍ତୁ.." + "FACILITATORS": { + "ALL_STATES": "ସମସ୍ତ ରାଜ୍ୟ", + "ALL_DISTRICTS": "ସମସ୍ତ ଜିଲ୍ଲା", + "ALL_BLOCKS": "ସମସ୍ତ ବ୍ଲକ୍", + "SEARCHBAR_PLACEHOLDER": "ସହଜକାରୀମାନଙ୍କୁ ଖୋଜନ୍ତୁ.." }, - "SIDEBAR": { - "FOUNDATION_COURSE": "ମୂଳ ପାଠ୍ୟକ୍ରମ", - "MAIN_COURSE": "ମୁଖ୍ୟ ପାଠ୍ୟକ୍ରମ" + "NAVBAR": { + "SEARCHBAR_PLACEHOLDER": "ପାଠ୍ୟକ୍ରମ, ବିଷୟ, ଛାତ୍ର, ପିଡ଼ଏଫ୍ ଇତ୍ୟାଦି ଖୋଜନ୍ତୁ.." }, - "COURSE_PLANNER": { - "GRADE": "ଶ୍ରେଣୀ", - "MEDIUM": "ମାଧ୍ୟମ", - "FILTER": "ଫିଲ୍ଟର", - "BOARDS_FULLY_UPLOADED": "ବୋର୍ଡ୍ସ ସମ୍ପୂର୍ଣ୍ଣ ଅପଲୋଡ୍ ହେଲା", - "ACTIVITY": "କାର୍ଯ୍ୟକଳାପ", - "COPY_LINK": "ଲିଙ୍କ କପି କରନ୍ତୁ", - "SEARCH": "ସନ୍ଧାନ", - "DATA_NOT_FOUND": "ଡାଟା ମିଳିଲା ନାହିଁ", - "SUBJECTS_UPLOADED": "ବିଷୟ ଅପଲୋଡ୍ ହେଲା", - "IMPORT_PLANNER": "ଆୟାତ ପ୍ଲାନର", - "REMOVE_FILE": "ଫାଇଲ୍ ବାହାର କରନ୍ତୁ", - "IMPORT_PLANNER_TO_UPLOADING": "ଅପଲୋଡ୍ ଆରମ୍ଭ କରିବାକୁ ‘ଆୟାତ ପ୍ଲାନର’ ଉପରେ କ୍ଲିକ୍ କରନ୍ତୁ", - "TOPIC_DETAILS": "ବିଷୟ ବିବରଣୀ" + "LEARNERS": { + "SEARCHBAR_PLACEHOLDER": "ଶିକ୍ଷାର୍ଥୀମାନଙ୍କୁ ଖୋଜନ୍ତୁ..", + "NEW_LEARNER": "ନୂତନ ଶିକ୍ଷାର୍ଥୀ", + "FIRST_SELECT_REQUIRED_FIELDS": "ପ୍ରଥମେ ଆବଶ୍ୟକ ତଥ୍ୟଗୁଡ଼ିକୁ ଚୟନ କରନ୍ତୁ" + }, + "TEAM_LEADERS": { + "SEARCHBAR_PLACEHOLDER": "ଦଳ ନେତାମାନଙ୍କୁ ଖୋଜନ୍ତୁ.." + }, + "COHORTS": { + "SEARCHBAR_PLACEHOLDER": "ଗୋଷ୍ଠୀମାନଙ୍କୁ ଖୋଜନ୍ତୁ.." }, "MASTER": { "STATE": "ରାଜ୍ୟ", - "SORT": "ଛାଟାନ୍ତୁ", - "DISTRICT_NAMES": "ଜିଲ୍ଲା ନାମ", + "STATE_NAMES": "ରାଜ୍ୟ ନାମଗୁଡ଼ିକ", + "SORT": "ବିନ୍ୟାସ", + "DISTRICT_NAMES": "ଜିଲ୍ଲା ନାମଗୁଡ଼ିକ", + "BLOCK_NAMES": "ବ୍ଲକ୍ ନାମଗୁଡ଼ିକ", "ACTIONS": "କାର୍ଯ୍ୟ", - "DISTRICTS": "ଜିଲ୍ଲା", - "SEARCHBAR_PLACEHOLDER_STATE": "ରାଜ୍ୟ ଖୋଜନ୍ତୁ", - "SEARCHBAR_PLACEHOLDER_DISTRICT": "ଜିଲ୍ଲା ଖୋଜନ୍ତୁ", - "SEARCHBAR_PLACEHOLDER_BLOCK": "ବ୍ଲକ୍ ଖୋଜନ୍ତୁ", - "BLOCKS": "ବ୍ଲକ୍", - "BLOCK_NAMES": "ବ୍ଲକ୍ ନାମ", - "ALL_DISTRICTS": "ସମସ୍ତ ଜିଲ୍ଲା", - "ALL_BLOCKS": "ସମସ୍ତ ବ୍ଲକ୍‌" + "DISTRICTS": "ଜିଲ୍ଲାମାନେ", + "SEARCHBAR_PLACEHOLDER_STATE": "ରାଜ୍ୟଗୁଡ଼ିକୁ ଖୋଜନ୍ତୁ", + "SEARCHBAR_PLACEHOLDER_DISTRICT": "ଜିଲ୍ଲାମାନଙ୍କୁ ଖୋଜନ୍ତୁ", + "SEARCHBAR_PLACEHOLDER_BLOCK": "ବ୍ଲକ୍ ଗୁଡ଼ିକୁ ଖୋଜନ୍ତୁ", + "BLOCKS": "ବ୍ଲକ୍ମାନେ" }, "CENTERS": { - "CENTERS": "କେନ୍ଦ୍ରଗୁଡିକ", - "REGULAR_CENTERS": "ନିୟମିତ କେନ୍ଦ୍ରଗୁଡିକ", - "REMOTE_CENTERS": "ଦୂରସ୍ଥ କେନ୍ଦ୍ରଗୁଡିକ", + "CENTERS": "କେନ୍ଦ୍ରଗୁଡ଼ିକ", + "REGULAR_CENTERS": "ନିୟମିତ କେନ୍ଦ୍ରଗୁଡ଼ିକ", + "REMOTE_CENTERS": "ଦୂରସ୍ଥ କେନ୍ଦ୍ରଗୁଡ଼ିକ", "REMOTE_CENTER": "ଦୂରସ୍ଥ କେନ୍ଦ୍ର", "REGULAR": "ନିୟମିତ", "REMOTE": "ଦୂରସ୍ଥ", - "SEARCH_BLOCKS": "ବ୍ଲକଗୁଡ଼ିକୁ ଖୋଜନ୍ତୁ", - "BLOCK_REQUEST": "ଆପଣ ଏହି ବ୍ୟବହାରକାରୀଙ୍କୁ ବ୍ଲକ ପୁନଃ ନିଯୁକ୍ତ କରିବା ପାଇଁ ରାଜ୍ୟ ଟିମ୍ ଲିଡରକୁ ଅନୁରୋଧ ପଠାଉଛନ୍ତି", + "SEARCH_BLOCKS": "ବ୍ଲକ୍ଗୁଡ଼ିକୁ ଖୋଜନ୍ତୁ", + "BLOCK_REQUEST": "ଆପଣ ଏହି ଉପଭୋକ୍ତାଙ୍କୁ ବ୍ଲକ୍ ପୁନର୍ନିୟୁକ୍ତ କରିବା ପାଇଁ ରାଜ୍ୟ ଟିମ୍ ଲିଡର୍କୁ ଅନୁରୋଧ ପଠାଉଛନ୍ତି", "NEW_CENTER": "ନୂତନ କେନ୍ଦ୍ର", "CENTER_TYPE": "କେନ୍ଦ୍ର ପ୍ରକାର", - "UNIT_NAME": "ଅଂଶର ନାମ", - "NOTE": "ଟିପ୍ପଣୀ: ଏହା ହେବ କେନ୍ଦ୍ରର ନାମ", - "CENTER_CREATED": "କେନ୍ଦ୍ର ସଫଳତାପୂର୍ଣ୍ଣ ଭାବରେ ସୃଷ୍ଟି ହେଲା!", - "RENAME_CENTER": "କେନ୍ଦ୍ରର ନାମ ପରିବର୍ତ୍ତନ କରନ୍ତୁ", - "REQUEST_TO_DELETE": "ମିଟାଇବାକୁ ଅନୁରୋଧ", - "RENAME": "ନାମ ପରିବର୍ତ୍ତନ କରନ୍ତୁ", - "CENTER_RENAMED": "କେନ୍ଦ୍ରର ନାମ ସଫଳତାପୂର୍ଣ୍ଣ ଭାବରେ ପରିବର୍ତ୍ତିତ ହେଲା!", - "SEND_REQUEST": "ଅନୁରୋଧ ପଠାଅନ୍ତୁ", - "REQUEST_TO_DELETE_HAS_BEEN_SENT": "ମିଟାଇବା ପାଇଁ ଅନୁରୋଧ ପଠାଯାଇଛି" + "UNIT_NAME": "ଏକକ ନାମ", + "NOTE": "ଦୟାକରି ଲକ୍ଷ୍ୟ କରନ୍ତୁ: ଏହା କେନ୍ଦ୍ରର ନାମ ହେବ", + "CENTER_CREATED": "କେନ୍ଦ୍ର ସଫଳତାର ସହ ସୃଷ୍ଟି ହେଲା!", + "RENAME_CENTER": "କେନ୍ଦ୍ରର ନାମ ପରିବର", + "REQUEST_TO_DELETE": "ମିଟିବା ପାଇଁ ଅନୁରୋଧ", + "RENAME": "ପୁନର୍ନାମକରଣ", + "CENTER_RENAMED": "କେନ୍ଦ୍ର ଶୁଭକାମନାର ସହିତ ପୁନର୍ନାମ କରାଯାଇଛି!", + "SEND_REQUEST": "ଅନୁରୋଧ ପଠାନ୍ତୁ", + "REQUEST_TO_DELETE_HAS_BEEN_SENT": "ମିଟିବା ପାଇଁ ଅନୁରୋଧ ପଠାଇ ଦିଆଯାଇଛି" + }, + "FORM": { + "FULL_NAME": "ପୂର୍ଣ୍ଣ ନାମ", + "ENTER_FULL_NAME": "ପୂର୍ଣ୍ଣ ନାମ ଭରନ୍ତୁ", + "CONTACT_NUMBER": "ସମ୍ପର୍କ ସଂଖ୍ୟା", + "ENTER_CONTACT_NUMBER": "ସମ୍ପର୍କ ସଂଖ୍ୟା ଭରନ୍ତୁ", + "HOW_WAS_LEARNER_MOBILISED": "ଶିକ୍ଷାର୍ଥୀ କିପରି ସଙ୍ଗଠିତ ହେଲେ?", + "SECOND_CHANCE_ALUMNI": "ଦ୍ବିତୀୟ ସୁଯୋଗ ପାଠଶାଳୀ", + "PRATHAM_TEAM_MEMBER": "ପ୍ରଥମ ଟିମ୍ ସଦସ୍ୟ", + "OTHER": "ଅନ୍ୟ", + "AGE": "ବୟସ", + "GENDER": "ଲିଙ୍ଗ", + "MALE": "ପୁରୁଷ", + "FEMALE": "ସ୍ତ୍ରୀ", + "LEARNERS_PRIMARY_WORK": "ଶିକ୍ଷାର୍ଥୀର ପ୍ରାଥମିକ କାମ", + "ENROLLED_IN_EDUCATIONAL_INSTITUTE": "ଶିକ୍ଷା ସଂସ୍ଥାରେ ଭର୍ତ୍ତି ହୋଇଛନ୍ତି", + "OWN_FARMING": "ନିଜର କୃଷି", + "AGRICULTURAL_FARM_LABORER": "କୃଷି କଷ୍ଟକର୍ମୀ", + "NON_AGRICULTURAL_LABORER": "ଅକୃଷି କଷ୍ଟକର୍ମୀ", + "SALARIED_WORK": "ଶାଳୀତ କାମ", + "SELF_EMPLOYMENT": "ସ୍ୱୟଂ ସେବା", + "UNEMPLOYED": "ବେକାର", + "INVOLVED_IN_DOMESTIC_WORK": "ଘରୋଇ କାମରେ ଲିପ୍ତ", + "FATHER_NAME": "ବାପାଙ୍କ ନାମ", + "ENTER_YOUR_FATHER_NAME": "ଆପଣଙ୍କ ବାପାଙ୍କ ନାମ ଭରନ୍ତୁ", + "CLASS_OR_LAST_PASSED_GRADE": "କ୍ଲାସ୍ (ଶେଷ ପାଠାଗତ ଶ୍ରେଣୀ)", + "NO_SCHOOLING": "କୌଣସି ଶିକ୍ଷା ନାହିଁ", + "REASON_FOR_DROPOUT_FROM_SCHOOL": "ପାଠଶାଳାରୁ ତ୍ୟାଗ କରିବାର କାରଣ", + "SCHOOL_INACCESSIBLE": "ପାଠଶାଳା ଅପହେଲିତ", + "FINANCIAL_CONSTRAINTS": "ଆର୍ଥିକ ଅସୁବିଧା", + "LACK_OF_INTEREST": "ରୁଚିର ଅଭାବ", + "FAMILY_RESPONSIBILITIES": "ପରିବାରିକ ଦାୟିତ୍ୱ", + "FAILED": "ବିଫଳ", + "ILLNESS": "ରୋଗ", + "MARRIAGE": "ବିବାହ", + "MIGRATION": "ପରିବର୍ତ୍ତନ", + "STARTED_VOCATIONAL_COURSE": "ପେଶାଗତ ପାଠ୍ୟକ୍ରମ ଆରମ୍ଭ କରିଛନ୍ତି", + "STARTED_A_JOB": "ଏକ କାମ ଆରମ୍ଭ କରିଛନ୍ତି", + "SCHOOL_CLOSURE_DUE_TO_COVID": "କୋଭିଡ୍ ଦ୍ବାରା ପାଠଶାଳା ବନ୍ଦ", + "MARITAL_STATUS": "ବିବାହିତ ଅବସ୍ଥା", + "UNMARRIED": "ବିବାହିତ ନୁହେଁ", + "MARRIED": "ବିବାହିତ", + "DIVORCED": "ବିବାହ ବିଚ୍ଛିନ୍ନ", + "PHONE_TYPE_AVAILABLE": "ଉପଲବ୍ଧ ଫୋନର ପ୍ରକାର", + "SMARTPHONE": "ସ୍ମାର୍ଟଫୋନ୍", + "KEYPAD": "କୀପ୍ୟାଡ୍", + "NO_PHONE": "କୌଣସି ଫୋନ୍ ନାହିଁ", + "IS_IT_YOUR_OWN_PHONE": "ଏହା ଆପଣଙ୍କ ନିଜର ଫୋନ୍ କି?", + "YES": "ହଁ", + "NO": "ନାହିଁ", + "TYPE_OF_PHONE_AVAILABLE": "ଉପଲବ୍ଧ ଫୋନର ପ୍ରକାର", + "REASON_FOR_DROP_OUT_FROM_SCHOOL": "ପାଠଶାଳାରୁ ତ୍ୟାଗ କରିବାର କାରଣ", + "EMAIL": "ଇମେଲ୍", + "YEAR_OF_ JOINING_SCP": "SCP ମଧ୍ୟରେ ସାମିଲ ହେବାର ବର୍ଷ", + "ASSIGN_CENTERS": "କେନ୍ଦ୍ର ସୁପର୍ଦ୍ଦ କରନ୍ତୁ" } -} +} \ No newline at end of file diff --git a/public/placeholderImage.png b/public/placeholderImage.png new file mode 100644 index 00000000..c342af7b Binary files /dev/null and b/public/placeholderImage.png differ diff --git a/src/components/AreaSelection.tsx b/src/components/AreaSelection.tsx index c0735459..8a3dcf09 100644 --- a/src/components/AreaSelection.tsx +++ b/src/components/AreaSelection.tsx @@ -5,6 +5,7 @@ import React, { useEffect, useState } from "react"; import MultipleSelectCheckmarks from "./FormControl"; import { capitalizeFirstLetterOfEachWordInArray } from "@/utils/Helper"; import { useMediaQuery } from "@mui/material"; +import { Role } from "@/utils/app.constant"; interface State { value: string; @@ -56,6 +57,9 @@ interface DropdownBoxProps { isCenterSelection?: boolean; stateDefaultValue?: string; userType?: string; + reAssignModal?: boolean; + blockDefaultValue?: string; + districtDefaultValue?: string; } const AreaSelection: React.FC = ({ @@ -76,125 +80,173 @@ const AreaSelection: React.FC = ({ inModal = false, handleCenterChangeWrapper = () => {}, stateDefaultValue, + blockDefaultValue, + districtDefaultValue, + userType, + reAssignModal = false, }) => { + console.log(selectedState.length); const { t } = useTranslation(); const theme = useTheme(); const [singleState, setSingleState] = useState(true); const [stateValue, setStateValue] = useState(""); const [stateCode, setStateCode] = useState(""); - const isSmallScreen = useMediaQuery((theme: any) => + let isSmallScreen = useMediaQuery((theme: any) => theme.breakpoints.down("sm") ); - + // isSmallScreen=isMobile?true: false; + const blockDisable = districtDefaultValue ? false : true; + const shouldRenderSelectCheckmarks = !( + reAssignModal && userType === Role.TEAM_LEADERS + ); return ( - {userType && ( - - {userType} - - )} - {!isSmallScreen && ( - + {userType && !reAssignModal && ( + + + {userType} + + )} + - - state.label?.toLowerCase().charAt(0).toUpperCase() + - state.label?.toLowerCase().slice(1) - )} - codes={states?.map((state) => state.value)} - tagName={t("FACILITATORS.STATE")} - selectedCategories={selectedState} - onCategoryChange={handleStateChangeWrapper} - disabled={ - stateDefaultValue === t("COMMON.ALL_STATES") ? false : true - } - overall={!inModal} - defaultValue={stateDefaultValue} - /> - districts.label)} - codes={districts?.map((districts) => districts.value)} - tagName={t("FACILITATORS.DISTRICT")} - selectedCategories={selectedDistrict} - onCategoryChange={handleDistrictChangeWrapper} - disabled={ - districts?.length <= 0 || - (selectedState.length === 0 && - stateDefaultValue === t("COMMON.ALL_STATES")) - } - overall={!inModal} - defaultValue={ - selectedState.length > 0 && districts?.length <= 0 - ? t("COMMON.NO_DISTRICTS") - : t("COMMON.ALL_DISTRICTS") - } - /> - blocks.label) - )} - codes={blocks?.map((blocks) => blocks.value)} - tagName={t("FACILITATORS.BLOCK")} - selectedCategories={capitalizeFirstLetterOfEachWordInArray(selectedBlock)} - onCategoryChange={handleBlockChangeWrapper} - disabled={ - blocks?.length <= 0 || - selectedDistrict?.length === 0 || - (selectedDistrict && selectedDistrict[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 && ( - centers.name) + + + + state.label?.toLowerCase().charAt(0).toUpperCase() + + state.label?.toLowerCase().slice(1) + )} + codes={states?.map((state) => state.value)} + tagName={t("FACILITATORS.STATE")} + selectedCategories={selectedState} + onCategoryChange={handleStateChangeWrapper} + disabled={stateDefaultValue !== t("COMMON.ALL_STATES")} + overall={!inModal} + defaultValue={stateDefaultValue} + /> + + + 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 && ( + block.label) + )} + codes={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") + } + /> )} - codes={allCenters?.map((centers) => centers.cohortId)} - tagName={t("CENTERS.CENTERS")} - selectedCategories={selectedCenter} - onCategoryChange={handleCenterChangeWrapper} - disabled={selectedBlock.length === 0 || selectedCenter[0] === ""} - overall={!inModal} - /> - )} + + {isCenterSelection && ( + + center.name) + )} + codes={allCenters?.map((center) => center.cohortId)} + tagName={t("CENTERS.CENTERS")} + selectedCategories={selectedCenter} + onCategoryChange={handleCenterChangeWrapper} + disabled={ + selectedBlock.length === 0 || + selectedBlock[0] === t("COMMON.ALL_BLOCKS") || + (selectedBlock?.length > 0 && allCenters?.length === 0) + } + overall={!inModal} + defaultValue={ + selectedBlock?.length > 0 && allCenters?.length === 0 + ? t("COMMON.NO_CENTERS") + : t("COMMON.ALL_CENTERS") + } + /> + + )} + diff --git a/src/components/CommonUserModal.tsx b/src/components/CommonUserModal.tsx index 69c57a52..89e263b5 100644 --- a/src/components/CommonUserModal.tsx +++ b/src/components/CommonUserModal.tsx @@ -9,23 +9,36 @@ import { getFormRead, updateUser, } from "@/services/CreateUserService"; -import { generateUsernameAndPassword } from "@/utils/Helper"; +import { sendCredentialService } from "@/services/NotificationService"; +import { + firstLetterInUpperCase, + generateUsernameAndPassword, +} from "@/utils/Helper"; import { FormData } from "@/utils/Interfaces"; -import { FormContext, FormContextType, RoleId ,Role, apiCatchingDuration} from "@/utils/app.constant"; +import { + FormContext, + FormContextType, + Role, + RoleId, + Status, + apiCatchingDuration, +} from "@/utils/app.constant"; import { useLocationState } from "@/utils/useLocationState"; import useSubmittedButtonStore from "@/utils/useSharedState"; -import { Box, Button, useTheme } from "@mui/material"; +import { Box, Button, Checkbox, FormControlLabel, Typography, useTheme } from "@mui/material"; import { IChangeEvent } from "@rjsf/core"; import { RJSFSchema } from "@rjsf/utils"; +import { useQuery } from "@tanstack/react-query"; import { useTranslation } from "next-i18next"; import React, { useEffect, useState } from "react"; import { tenantId } from "../../app.config"; import { transformArray } from "../utils/Helper"; import AreaSelection from "./AreaSelection"; +import SendCredentialModal from "./SendCredentialModal"; import { showToastMessage } from "./Toastify"; -import SendCredentialModal from './SendCredentialModal'; -import { sendCredentialService } from "@/services/NotificationService"; -import { useQuery } from "@tanstack/react-query"; +import { cohortMemberList } from "@/services/UserList"; +import CustomModal from "./CustomModal"; +import { setConfig } from "next/config"; interface UserModalProps { open: boolean; @@ -37,6 +50,8 @@ interface UserModalProps { userType: string; } + + const CommonUserModal: React.FC = ({ open, onClose, @@ -51,16 +66,23 @@ const CommonUserModal: React.FC = ({ const [uiSchema, setUiSchema] = React.useState(); const [openModal, setOpenModal] = React.useState(false); const [adminInfo, setAdminInfo] = React.useState(); + const [createTLAlertModal, setcreateTLAlertModal] = useState(false); + const [confirmButtonDisable, setConfirmButtonDisable] = useState(true); + const [checkedConfirmation, setCheckedConfirmation] = useState(false); + const messageKeyMap: Record = { [FormContextType.STUDENT]: "LEARNERS.LEARNER_CREATED_SUCCESSFULLY", [FormContextType.TEACHER]: "FACILITATORS.FACILITATOR_CREATED_SUCCESSFULLY", - [FormContextType.TEAM_LEADER]: "TEAM_LEADERS.TEAM_LEADER_CREATED_SUCCESSFULLY", + [FormContextType.TEAM_LEADER]: + "TEAM_LEADERS.TEAM_LEADER_CREATED_SUCCESSFULLY", [FormContextType.ADMIN]: "ADMIN.ADMIN_UPDATED_SUCCESSFULLY", }; const delayCredentialsMessageMap: Record = { [FormContextType.STUDENT]: "LEARNERS.USER_CREDENTIALS_WILL_BE_SEND_SOON", - [FormContextType.TEACHER]: "FACILITATORS.USER_CREDENTIALS_WILL_BE_SEND_SOON", - [FormContextType.TEAM_LEADER]: "TEAM_LEADERS.USER_CREDENTIALS_WILL_BE_SEND_SOON", + [FormContextType.TEACHER]: + "FACILITATORS.USER_CREDENTIALS_WILL_BE_SEND_SOON", + [FormContextType.TEAM_LEADER]: + "TEAM_LEADERS.USER_CREDENTIALS_WILL_BE_SEND_SOON", }; const [submitButtonEnable, setSubmitButtonEnable] = React.useState(false); @@ -77,36 +99,38 @@ const CommonUserModal: React.FC = ({ const setSubmittedButtonStatus = useSubmittedButtonStore( (state: any) => state.setSubmittedButtonStatus ); - const noError = useSubmittedButtonStore( - (state: any) => state.noError); + const noError = useSubmittedButtonStore((state: any) => state.noError); - const userEnteredEmail = useSubmittedButtonStore( + const userEnteredEmail = useSubmittedButtonStore( (state: any) => state.userEnteredEmail ); - const { data:teacherFormData ,isLoading: teacherFormDataLoading, error :teacherFormDataErrror} = useQuery({ + const { + data: teacherFormData, + isLoading: teacherFormDataLoading, + error: teacherFormDataErrror, + } = useQuery({ queryKey: ["teacherFormData"], - queryFn: () => getFormRead( - FormContext.USERS, - FormContextType.TEACHER - ), + queryFn: () => getFormRead(FormContext.USERS, FormContextType.TEACHER), staleTime: apiCatchingDuration.GETREADFORM, - }) - const { data:studentFormData ,isLoading: studentFormDataLoading, error :studentFormDataErrror} = useQuery({ + }); + const { + data: studentFormData, + isLoading: studentFormDataLoading, + error: studentFormDataErrror, + } = useQuery({ queryKey: ["studentFormData"], - queryFn: () => getFormRead( - FormContext.USERS, - FormContextType.STUDENT - ), - staleTime: apiCatchingDuration.GETREADFORM, - }) - const { data:teamLeaderFormData ,isLoading: teamLeaderFormDataLoading, error :teamLeaderFormDataErrror} = useQuery({ + queryFn: () => getFormRead(FormContext.USERS, FormContextType.STUDENT), + staleTime: apiCatchingDuration.GETREADFORM, + }); + const { + data: teamLeaderFormData, + isLoading: teamLeaderFormDataLoading, + error: teamLeaderFormDataErrror, + } = useQuery({ queryKey: ["teamLeaderFormData"], - queryFn: () => getFormRead( - FormContext.USERS, - FormContextType.TEAM_LEADER - ), - staleTime: apiCatchingDuration.GETREADFORM, - }) + queryFn: () => getFormRead(FormContext.USERS, FormContextType.TEAM_LEADER), + staleTime: apiCatchingDuration.GETREADFORM, + }); // const { data:adminFormData ,isLoading: adminFormDataLoading, error :adminFormDataErrror} = useQuery({ // queryKey: ["adminFormData"], // queryFn: () => getFormRead( @@ -152,13 +176,14 @@ const CommonUserModal: React.FC = ({ districtFieldId, stateFieldId, dynamicFormForBlock, - stateDefaultValue + stateDefaultValue, + assignedTeamLeader, + assignedTeamLeaderNames } = useLocationState(open, onClose, roleType); - - + console.log(assignedTeamLeaderNames) useEffect(() => { - const getAddUserFormData = () => { + const getAddUserFormData = () => { try { // const response: FormData = await getFormRead( // FormContext.USERS, @@ -169,10 +194,15 @@ const CommonUserModal: React.FC = ({ // userType // ); // console.log("sortedFields", response); - - const response : FormData = userType===FormContextType.TEACHER? teacherFormData: userType===FormContextType.STUDENT? studentFormData : teamLeaderFormData; - // console.log(studentFormData) - console.log(response) + + const response: FormData = + userType === FormContextType.TEACHER + ? teacherFormData + : userType === FormContextType.STUDENT + ? studentFormData + : teamLeaderFormData; + // console.log(studentFormData) + console.log(response); if (response) { if (userType === FormContextType.TEACHER) { @@ -189,7 +219,7 @@ const CommonUserModal: React.FC = ({ setFormValue(formValues); setSchema(schema); setUiSchema(uiSchema); - console.log("teacher2") + console.log("teacher2"); } else if (userType === FormContextType.TEAM_LEADER) { const { schema, uiSchema, formValues } = GenerateSchemaAndUiSchema( response, @@ -207,7 +237,6 @@ const CommonUserModal: React.FC = ({ setUiSchema(uiSchema); } } - } catch (error) { console.error("Error fetching form data:", error); } @@ -229,7 +258,18 @@ const CommonUserModal: React.FC = ({ const formData = data.formData; console.log("Form data submitted:", formData); const schemaProperties = schema.properties; - const result = generateUsernameAndPassword(selectedStateCode, userType); + + console.log(formData["year of joining scp"]); + let result; + if (formData["year of joining scp"]) { + result = generateUsernameAndPassword( + selectedStateCode, + userType, + formData["year of joining scp"] + ); + } else { + result = generateUsernameAndPassword(selectedStateCode, userType); + } if (result !== null) { const { username, password } = result; @@ -315,7 +355,7 @@ const CommonUserModal: React.FC = ({ name: apiBody?.name, mobile: apiBody?.mobile, father_name: apiBody?.father_name, - email:apiBody?.email + email: apiBody?.email, }; const customFields = apiBody?.customFields; console.log(customFields); @@ -333,121 +373,100 @@ const CommonUserModal: React.FC = ({ showToastMessage(t(messageKey), "success"); } else { - const response = await createUser(apiBody); console.log(response); if (response) { - const messageKey = messageKeyMap[userType] - - if(userType===FormContextType.STUDENT) - { - - showToastMessage(t(messageKey), "success"); - } - // if(userType===FormContextType.STUDENT) - // setOpenModal(true); + const messageKey = messageKeyMap[userType]; + + if (userType === FormContextType.STUDENT) { + showToastMessage(t(messageKey), "success"); + } } else { showToastMessage(t("COMMON.SOMETHING_WENT_WRONG"), "error"); } - } onSubmit(true); onClose(); onCloseModal(); + if (!isEditModal) { + const isQueue = false; + const context = "USER"; + let creatorName; + const key = + userType === FormContextType.STUDENT + ? "onLearnerCreated" + : userType === FormContextType.TEACHER + ? "onFacilitatorCreated" + : "onTeamLeaderCreated"; - - if(!isEditModal) - { - // setOpenModal(true); - - const isQueue = false; - const context = 'USER'; - let createrName; - const key = userType === FormContextType.STUDENT - ? 'onLearnerCreated' - : userType === FormContextType.TEACHER - ? 'onFacilitatorCreated' - : 'onTeamLeaderCreated'; - - if (typeof window !== 'undefined' && window.localStorage) { - createrName = localStorage.getItem('name'); - } - let replacements: { [key: string]: string }; - replacements={} - console.log(Object.keys(replacements).length === 0) - if (createrName) { - if(userType===FormContextType.STUDENT) - { - replacements = - { - "{FirstName}": createrName, - "{UserName}": username, - "{LearnerName}" : apiBody['name'], - "{Password}": password + if (typeof window !== "undefined" && window.localStorage) { + creatorName = localStorage.getItem("name"); } + let replacements: { [key: string]: string }; + replacements = {}; + console.log(Object.keys(replacements).length === 0); + if (creatorName) { + if (userType === FormContextType.STUDENT) { + replacements = { + "{FirstName}": firstLetterInUpperCase(creatorName), + "{UserName}": username, + "{LearnerName}": firstLetterInUpperCase(apiBody["name"]), + "{Password}": password, + }; + } else { + replacements = { + "{FirstName}": firstLetterInUpperCase(apiBody["name"]), + "{UserName}": username, + "{Password}": password, + }; + } } - else{ - replacements = - { - "{FirstName}": apiBody['name'], - "{UserName}": username, - "{Password}": password - } - - } - - } - const sendTo = { - // receipients: [userEmail], - receipients: userType === FormContextType.STUDENT?[adminInfo?.email]: [formData?.email], - - }; - if (Object.keys(replacements).length !== 0 && sendTo) { - - const response = await sendCredentialService({ - isQueue, - context, - key, - replacements, - email: sendTo, - }); - if(userType!==FormContextType.STUDENT) - { - const messageKey = messageKeyMap[userType] + const sendTo = { + // receipients: [userEmail], + receipients: + userType === FormContextType.STUDENT + ? [adminInfo?.email] + : [formData?.email], + }; + if (Object.keys(replacements).length !== 0 && sendTo) { + const response = await sendCredentialService({ + isQueue, + context, + key, + replacements, + email: sendTo, + }); + if (userType !== FormContextType.STUDENT) { + const messageKey = messageKeyMap[userType]; - if (response?.result[0]?.data[0]?.status === 'success') { + if (response?.result[0]?.data[0]?.status === "success") { showToastMessage(t(messageKey), "success"); + } else { + const messageKey = + delayCredentialsMessageMap[userType] || + "TEAM_LEADERS.USER_CREDENTIALS_WILL_BE_SEND_SOON"; - } - else { - const messageKey = delayCredentialsMessageMap[userType] || "TEAM_LEADERS.USER_CREDENTIALS_WILL_BE_SEND_SOON"; - - showToastMessage(t(messageKey), "success"); - + showToastMessage(t(messageKey), "success"); + } } + if (userType === FormContextType.STUDENT) { + if ( + response?.result[0]?.data[0]?.status === "success" && + !isEditModal + ) { + setOpenModal(true); + } else { + showToastMessage( + t("LEARNERS.USER_CREDENTIALS_WILL_BE_SEND_SOON"), + "success" + ); + } + } + } else { + showToastMessage(t("COMMON.SOMETHING_WENT_WRONG"), "error"); } - if(userType===FormContextType.STUDENT ) - { - if( response?.result[0]?.data[0]?.status === 'success' && !isEditModal) - { - setOpenModal(true); - - } - else{ - showToastMessage( - t('LEARNERS.USER_CREDENTIALS_WILL_BE_SEND_SOON'), - 'success' - ); - } - } - - - - } else { - showToastMessage(t('COMMON.SOMETHING_WENT_WRONG'), 'error'); } - } } catch (error) { onClose(); console.log(error); @@ -458,7 +477,6 @@ const CommonUserModal: React.FC = ({ const handleChange = (event: IChangeEvent) => { console.log("Form data changed:", event.formData); }; - const handleError = (errors: any) => { console.log("Form errors:", errors); }; @@ -466,7 +484,7 @@ const CommonUserModal: React.FC = ({ setCreateFacilitator(false); setOpenModal(false); }; - + const handleAction = () => { setTimeout(() => { setCreateFacilitator(true); @@ -493,116 +511,150 @@ const CommonUserModal: React.FC = ({ setSubmitButtonEnable(true); } }, [dynamicForm, dynamicFormForBlock, open]); + + + const handleChangeCheckBox = (event: React.ChangeEvent) => { + setCheckedConfirmation(event.target.checked); + + }; + + const wrappedHandleContinueAction = () => { + handleCloseConfirmation(); + setOpenModal(true); + //onClose(); + + + +} + + const handleCancelAction = async () => { + // await handleDeleteAction(); + handleCloseConfirmation(); +//setAssignedTeamLeaderNames([]); + }; + const handleCloseConfirmation= () => { + // await handleDeleteAction(); + // handleCloseConfirmation(); + setcreateTLAlertModal(false); + setCheckedConfirmation(false); + setConfirmButtonDisable(true); + // setAssignedTeamLeaderNames([]); + + }; + + + useEffect(() => { + if (checkedConfirmation) { + setConfirmButtonDisable(false); + } else { + setConfirmButtonDisable(true); + } + }, [checkedConfirmation]); useEffect(() => { if (typeof window !== "undefined" && window.localStorage) { const admin = localStorage.getItem("adminInfo"); if (admin) setAdminInfo(JSON.parse(admin)); - console.log(adminInfo?.email) + console.log(adminInfo?.email); } }, []); return ( <> - - - + + + } + > + {!isEditModal && ( + - {!isEditModal ? t("COMMON.CREATE") : t("COMMON.UPDATE")} - - - } - > - {!isEditModal && ( - - - - )} - {formData - ? schema && - uiSchema && ( - - {/* */} - - ) - : userType === FormContextType.TEAM_LEADER - ? dynamicFormForBlock && - schema && + + + )} + {formData + ? schema && uiSchema && ( = ({ // widgets={{}} showErrorList={true} customFields={customFields} - formData={formValue} + formData={formData} > {/* */} ) - : dynamicForm && - schema && - uiSchema && ( - - {/* */} - - )} - - - + : userType === FormContextType.TEAM_LEADER + ? dynamicFormForBlock && + schema && + uiSchema && ( + + {/* */} + + ) + : dynamicForm && + schema && + uiSchema && ( + + {/* */} + + )} + + + + + + + + + + + + + + +{assignedTeamLeaderNames.length>1 ?( + <> + {t('COMMON.MULTIPLE_TEAM_LEADERS_ASSIGNED', { selectedBlockForTL: selectedBlock[0],assignedTeamLeader: assignedTeamLeader})} + + + ):(<> + + {t('COMMON.SINGLE_TEAM_LEADERS_ASSIGNED', { selectedBlockForTL: selectedBlock[0],assignedTeamLeader: assignedTeamLeader})} + + ) +} + + + + {assignedTeamLeaderNames.length>1 ?( + <> + {t('COMMON.ASSIGNED_TEAM_LEADERS', { assignedTeamLeaderNames:assignedTeamLeaderNames[0]})} + + + + + ):(<> + {assignedTeamLeaderNames[0]} + ) + + } + + + } + label={ t('COMMON.CONTINUE_ASSIGNED_TEAM_LEADER', {selectedBlockForTL: selectedBlock[0]})} + sx={{ marginTop: "12px", color: "#555" }} + /> + + + ); }; -export default CommonUserModal; +export default CommonUserModal; \ No newline at end of file diff --git a/src/components/CustomModal.tsx b/src/components/CustomModal.tsx index bb554afa..3a32cdd9 100644 --- a/src/components/CustomModal.tsx +++ b/src/components/CustomModal.tsx @@ -8,13 +8,14 @@ import { Divider, useMediaQuery, Theme, + useTheme } from "@mui/material"; import CloseIcon from "@mui/icons-material/Close"; interface CustomModalProps { open: boolean; handleClose: () => void; - title: string; + title?: string; subtitle?: string; primaryBtnText: string; secondaryBtnText?: string; @@ -24,6 +25,7 @@ interface CustomModalProps { backdropClose?: boolean; primaryBtnDisabled?: boolean; children: React.ReactNode; + width?:string } const CustomModal: React.FC = ({ @@ -39,11 +41,15 @@ const CustomModal: React.FC = ({ backdropClose = true, primaryBtnDisabled = true, children, + width }) => { - const isSmallScreen = useMediaQuery((theme: Theme) => - theme.breakpoints.down("sm"), - ); + // const isSmallScreen = useMediaQuery((theme: Theme) => + // theme.breakpoints.down("sm"), + // ); + const theme = useTheme(); + const isSmallScreen = useMediaQuery(theme.breakpoints.down("sm")); + const isLargeScreen = useMediaQuery(theme.breakpoints.up("lg")); return ( = ({ top: "50%", left: "50%", transform: "translate(-50%, -50%)", - width: isSmallScreen ? "90%" : 400, + width: isSmallScreen ? "90%" : isLargeScreen ? width : width, maxWidth: "90%", bgcolor: "background.paper", boxShadow: 24, diff --git a/src/components/DeleteUserModal.tsx b/src/components/DeleteUserModal.tsx index 2103d2f8..11bd32db 100644 --- a/src/components/DeleteUserModal.tsx +++ b/src/components/DeleteUserModal.tsx @@ -10,6 +10,7 @@ import React, { useEffect, useState } from "react"; import { useTheme } from "@mui/material/styles"; import { useTranslation } from "next-i18next"; import CustomModal from "./CustomModal"; +import { Role } from "@/utils/app.constant"; interface DeleteUserModalProps { open: boolean; @@ -40,7 +41,9 @@ const DeleteUserModal: React.FC = ({ centers, userId, userName, + userType }) => { + console.log(centers) const { t } = useTranslation(); const theme = useTheme(); const reasons = [ @@ -86,6 +89,7 @@ const DeleteUserModal: React.FC = ({ return ( = ({ variant="body1" sx={{ marginBottom: "12px", fontWeight: "bold", color: "#333" }} > - {t("COMMON.USER_COHORTS", { name: userName })} + {userType===Role.TEAM_LEADERS?t("COMMON.USER_BLOCK", { name: userName }): centers.split(', ').length===1 ? t("COMMON.USER_CENTER", { name: userName }) : t("COMMON.USER_CENTERS", { name: userName })} = ({ color="primary" /> } - label={t("COMMON.DELETE_COHORT_WARNING")} + label={userType===Role.TEAM_LEADERS?t("COMMON.DELETE_FROM_BLOCK_WARNING"): centers.split(', ').length===1 ? t("COMMON.DELETE_FROM_CENTER_WARNING") : t("COMMON.DELETE_FROM_CENTERS_WARNING")} + sx={{ marginTop: "12px", color: "#555" }} /> diff --git a/src/components/DynamicForm.tsx b/src/components/DynamicForm.tsx index dec1dd95..8ff64385 100644 --- a/src/components/DynamicForm.tsx +++ b/src/components/DynamicForm.tsx @@ -9,7 +9,7 @@ import CustomRadioWidget from "./form/CustomRadioWidget"; import MultiSelectCheckboxes from "./form/MultiSelectCheckboxes"; import MultiSelectDropdown from "./form/MultiSelectDropdown"; const FormWithMaterialUI = withTheme(MaterialUITheme); -import { getCurrentYearPattern } from '@/utils/Helper'; +import { getCurrentYearPattern } from "@/utils/Helper"; interface DynamicFormProps { schema: any; @@ -55,9 +55,7 @@ const DynamicForm: React.FC = ({ const setUserEnteredEmail = useSubmittedButtonStore( (state: any) => state.setUserEnteredEmail ); - const setNoError= useSubmittedButtonStore( - (state: any) => state.setNoError - ); + const setNoError = useSubmittedButtonStore((state: any) => state.setNoError); const widgets: any = { MultiSelectDropdown: MultiSelectDropdown, @@ -67,9 +65,9 @@ const DynamicForm: React.FC = ({ const handleError = (errors: any) => { if (errors.length === 0) { - console.log("No errors"); - // You can perform any additional action here when there are no errors - } + console.log("No errors"); + // You can perform any additional action here when there are no errors + } console.log("handle error1"); if (errors.length > 0) { const property = errors[0].property?.replace(/^root\./, ""); @@ -117,7 +115,7 @@ const DynamicForm: React.FC = ({ console.log("Form data changed:", cleanedFormData); setLocalFormData(cleanedFormData); - setUserEnteredEmail(cleanedFormData?.email) + setUserEnteredEmail(cleanedFormData?.email); onChange({ ...event, formData: cleanedFormData }); }; @@ -125,14 +123,14 @@ const DynamicForm: React.FC = ({ const currentYearPattern = new RegExp(getCurrentYearPattern()); console.log("errors", errors); - errors.length===0? setNoError(true): setNoError(false) - + errors.length === 0 ? setNoError(true) : setNoError(false); + console.log("schema", schema); return errors?.map((error: any) => { switch (error.name) { case "required": { - console.log(submittedButtonStatus) + console.log(submittedButtonStatus); error.message = submittedButtonStatus ? t("FORM_ERROR_MESSAGES.THIS_IS_REQUIRED_FIELD") : ""; @@ -211,7 +209,7 @@ const DynamicForm: React.FC = ({ default: { const validRange = currentYearPattern.test(pattern); if (!validRange) { - error.message = t('FORM_ERROR_MESSAGES.ENTER_VALID_YEAR'); + error.message = t("FORM_ERROR_MESSAGES.ENTER_VALID_YEAR"); } break; } @@ -250,10 +248,10 @@ const DynamicForm: React.FC = ({ }); }; useEffect(() => { - // setSubmittedButtonStatus(false); + // setSubmittedButtonStatus(false); }, []); return ( -
+
= ({ fields={customFields} id={id} > - + {children}
diff --git a/src/components/FormControl.tsx b/src/components/FormControl.tsx index b5cad019..85d81116 100644 --- a/src/components/FormControl.tsx +++ b/src/components/FormControl.tsx @@ -6,7 +6,7 @@ import FormControl from "@mui/material/FormControl"; import ListItemText from "@mui/material/ListItemText"; import Select, { SelectChangeEvent } from "@mui/material/Select"; import { useTranslation } from "next-i18next"; -import { useMediaQuery } from "@mui/material"; +import { useMediaQuery } from "@mui/material"; const ITEM_HEIGHT = 48; const ITEM_PADDING_TOP = 8; @@ -42,27 +42,25 @@ const MultipleSelectCheckmarks: React.FC = ({ }) => { const { t } = useTranslation(); const isSmallScreen = useMediaQuery((theme: any) => - theme.breakpoints.down("sm"), + theme.breakpoints.down("sm") ); const isMediumScreen = useMediaQuery("(max-width:900px)"); - const handleChange = ( - event: SelectChangeEvent, + event: SelectChangeEvent ) => { const { target: { value }, } = event; - let selectedNames = - typeof value === "string" ? value.split(",") : value; + let selectedNames = typeof value === "string" ? value.split(",") : value; if (selectedNames.includes("all")) { selectedNames = defaultValue ? [defaultValue] : []; } const selectedCodes = selectedNames?.map( - (name) => codes[names.indexOf(name)], + (name) => codes[names.indexOf(name)] ); onCategoryChange(selectedNames, selectedCodes); @@ -70,9 +68,8 @@ const MultipleSelectCheckmarks: React.FC = ({ return (
- - {tagName} + + {tagName} diff --git a/src/components/HeaderComponent.tsx b/src/components/HeaderComponent.tsx index 89daf7e7..58141a47 100644 --- a/src/components/HeaderComponent.tsx +++ b/src/components/HeaderComponent.tsx @@ -24,6 +24,10 @@ import { transformArray } from "../utils/Helper"; import Tab from "@mui/material/Tab"; import Tabs from "@mui/material/Tabs"; import { useQueryClient } from "@tanstack/react-query"; +import { formatedBlocks, formatedDistricts } from "@/services/formatedCohorts"; +import { useRouter } from "next/router"; +import useSubmittedButtonStore from "@/utils/useSharedState"; +import { userAgent } from "next/server"; interface State { value: string; @@ -73,9 +77,18 @@ const HeaderComponent = ({ statusValue, shouldFetchDistricts = true, setStatusValue, + setSelectedDistrictCode, + setSelectedDistrict, + setSelectedBlockCode, + setSelectedBlock, + setSelectedCenter, + selectedCenterCode, + setSelectedCenterCode, + setSelectedStateCode, }: any) => { const { t } = useTranslation(); const queryClient = useQueryClient(); + const router = useRouter(); const theme = useTheme(); const isMobile = useMediaQuery("(max-width:600px)"); @@ -86,9 +99,27 @@ const HeaderComponent = ({ const [allCenters, setAllCenters] = useState([]); const [initialDistrict, setInitialDistrict] = useState(""); const [initialBlock, setInitialBlock] = useState(""); + const [initialized, setInitialized] = useState(false); const [blocks, setBlocks] = useState([]); - + const selectedBlockStore = useSubmittedButtonStore( + (state: any) => state.selectedBlockStore + ); + const setSelectedBlockStore = useSubmittedButtonStore( + (state: any) => state.setSelectedBlockStore + ); + const selectedDistrictStore = useSubmittedButtonStore( + (state: any) => state.selectedDistrictStore + ); + const setSelectedDistrictStore = useSubmittedButtonStore( + (state: any) => state.setSelectedDistrictStore + ); + const selectedCenterStore = useSubmittedButtonStore( + (state: any) => state.selectedCenterStore + ); + const setSelectedCenterStore = useSubmittedButtonStore( + (state: any) => state.setSelectedCenterStore + ); const handleStateChangeWrapper = async ( selectedNames: string[], selectedCodes: string[] @@ -118,6 +149,7 @@ const HeaderComponent = ({ // console.log(object); // const response = await getStateBlockDistrictList(object); const result = response?.result?.values; + setDistricts(result); } catch (error) { console.log(error); @@ -150,7 +182,9 @@ const HeaderComponent = ({ // }; // const response = await getStateBlockDistrictList(object); const result = response?.result?.values; - setBlocks(result); + const blockResult = await formatedBlocks(selectedCodes[0]); + + setBlocks(blockResult); } catch (error) { console.log(error); } @@ -209,6 +243,20 @@ const HeaderComponent = ({ useEffect(() => { const fetchData = async () => { + const { state, district, center } = router.query; + console.log(router.asPath); + const fullPath = router.asPath; + + // Extract query parameters + const queryString = fullPath.split("?")[1]; // Get the part after '?' + console.log(queryString); + const params = new URLSearchParams(queryString); + + // Check if 'block' is present + const hasBlock = params.has("block"); + const hasDistrict = params.has("district"); + const hasCenter = params.has("center"); + const hasState = params.has("state"); try { const object = { // "limit": 20, @@ -251,7 +299,116 @@ const HeaderComponent = ({ // console.log(object); // const response = await getStateBlockDistrictList(object); const result = response?.result?.values; - setDistricts(result); + const districtResult = await formatedDistricts(); + + setDistricts(districtResult); + if (!hasDistrict) { + setSelectedDistrict([districtResult[0]?.label]); + setSelectedDistrictCode(districtResult[0]?.value); + localStorage.setItem( + "selectedDistrict", + districtResult[0]?.label + ); + setSelectedDistrictStore(districtResult[0]?.label); + } + const blockResult = await formatedBlocks( + districtResult[0]?.value + ); + setBlocks(blockResult); + if (!hasBlock && !hasDistrict) { + if (userType === Role.TEAM_LEADERS) { + setSelectedBlock([t("COMMON.ALL_BLOCKS")]); + //setSelectedBlockCode("") + router.replace({ + pathname: router.pathname, + query: { + ...router.query, + state: stateField.code, + district: districtResult[0]?.value, + }, + }); + } else { + setSelectedBlock([blockResult[0]?.label]); + setSelectedBlockCode(blockResult[0]?.value); + localStorage.setItem("selectedBlock", blockResult[0]?.label); + setSelectedBlockStore(blockResult[0]?.label); + + router.replace({ + pathname: router.pathname, + query: { + ...router.query, + state: stateField.code, + district: districtResult[0]?.value, + block: blockResult[0]?.value, + }, + }); + } + } + + const getCentersObject = { + limit: 0, + offset: 0, + filters: { + // "type":"COHORT", + status: ["active"], + states: stateField.code, + districts: districtResult[0]?.value, + blocks: blockResult[0]?.value, + // "name": selected[0] + }, + }; + const centerResponse = await queryClient.fetchQuery({ + queryKey: [ + QueryKeys.FIELD_OPTION_READ, + getCentersObject.limit, + getCentersObject.offset, + getCentersObject.filters, + ], + queryFn: () => getCenterList(getCentersObject), + }); + // const response = await getCenterList(getCentersObject); + console.log(centerResponse); + // setSelectedBlockCohortId( + // response?.result?.results?.cohortDetails[0].cohortId + // ); + // const result = response?.result?.cohortDetails; + const dataArray = centerResponse?.result?.results?.cohortDetails; + console.log(dataArray); + + const cohortInfo = dataArray + ?.filter((cohort: any) => cohort.type !== "BLOCK") + .map((item: any) => ({ + cohortId: item?.cohortId, + name: item?.name, + })); + setAllCenters(cohortInfo); + + console.log(dataArray); + console.log(userType); + if ( + !hasCenter && + !hasBlock && + !hasDistrict && + userType !== Role.TEAM_LEADERS + ) { + console.log(hasCenter); + setSelectedCenter([t("COMMON.ALL_CENTERS")]); + // setSelectedCenterCode([cohortInfo[0]?.cohortId]) + // localStorage.setItem('selectedCenter',cohortInfo[0]?.name ) + // setSelectedCenterStore(cohortInfo[0]?.name) + router.replace({ + pathname: router.pathname, + query: { + ...router.query, + state: stateField.code, + district: districtResult[0]?.value, + block: blockResult[0]?.value, + // center: cohortInfo[0]?.cohortId + }, + }); + } + + console.log(cohortInfo); } const object = [ @@ -273,7 +430,7 @@ const HeaderComponent = ({ if (shouldFetchDistricts) { fetchData(); } - }, [shouldFetchDistricts]); + }, [shouldFetchDistricts, userType]); const handleChange = (event: React.SyntheticEvent, newValue: any) => { console.log(newValue); setStatusValue(newValue); @@ -295,7 +452,46 @@ const HeaderComponent = ({ // } // }, [blocks, selectedBlock, handleBlockChangeWrapper]); - + useEffect(() => { + const { state, district, block, center } = router.query; + { + if (state) { + setSelectedStateCode(state.toString()); + } + console.log(selectedDistrict) + if (district) { + setSelectedDistrictCode(district.toString()); + // setSelectedDistrict([selectedDistrictStore]) + setSelectedDistrict([localStorage.getItem("selectedDistrict")]); + if (!localStorage.getItem("selectedDistrict")) { + setSelectedDistrict([selectedDistrictStore]); + } + } + + + if (block ) { + setSelectedBlockCode(block.toString()); + console.log(selectedBlockCode); + // setSelectedBlock([selectedBlockStore]) + setSelectedBlock([localStorage.getItem("selectedBlock")]); + if (!localStorage.getItem("selectedBlock")) + setSelectedBlock([selectedBlockStore]); + } + + + if (center) { + console.log(center); + + setSelectedCenterCode([center.toString()]); + // setSelectedCenter([selectedCenterStore]) + setSelectedCenter([localStorage.getItem("selectedCenter")]); + if (!localStorage.getItem("selectedCenter")) + setSelectedCenter([selectedCenterStore]); + } + + // setInitialized(true) + } + }, [router]); return ( = ({ open, onClose, cohortData, userId, userType, - blocks, - blockName -}) => { - console.log(blocks) + blockList, + blockName, + cohortId, + blockCode, + districtName, + districtCode, + centers + +}) => { + console.log(userId) const { t } = useTranslation(); const theme = useTheme(); + const roleType = userType; + const defaultBlock=blockName; - const cohorts: Cohort[] = cohortData?.map( +const { + states, + districts, + blocks, + allCenters, + isMobile, + isMediumScreen, + selectedState, + selectedStateCode, + selectedDistrict, + selectedDistrictCode, + selectedCenter, + dynamicForm, + selectedBlock, + selectedBlockCode, + handleStateChangeWrapper, + handleDistrictChangeWrapper, + handleBlockChangeWrapper, + handleCenterChangeWrapper, + selectedCenterCode, + selectedBlockCohortId, + blockFieldId, + districtFieldId, + stateFieldId, + dynamicFormForBlock, + stateDefaultValue, + setSelectedBlock, + setSelectedDistrict, + setSelectedDistrictCode, + setSelectedBlockCode + } =useLocationState(open, onClose, roleType, true) + let cohorts: Cohort[] = allCenters?.map( (cohort: { cohortId: any; name: string }) => ({ name: cohort.name, id: cohort.cohortId, }) ); - const [searchInput, setSearchInput] = useState(""); - const [selectedBlockId, setselectedBlockId] = useState(""); + console.log(blockCode) + console.log(selectedBlock) + const names = cohortData.map((item : any)=> item.name); + const setReassignButtonStatus = useSubmittedButtonStore((state:any) => state.setReassignButtonStatus); + const reassignButtonStatus = useSubmittedButtonStore( + (state: any) => state.reassignButtonStatus + ); + console.log(names); + // const [filters, setFilters] = useState({ + // // cohortId:selectedBlockCohortId, + // role: Role.TEAM_LEADER, + // status:[Status.ACTIVE] + + // }); + const [searchInput, setSearchInput] = useState(""); + const [reassignAlertModal, setReassignAlertModal] = useState(false); + const [assignedTeamLeader, setAssignedTeamLeader] = useState(""); + const [selectedBlockForTL, setSelectedBlockForTL] = useState(""); + const [assignedTeamLeaderNames, setAssignedTeamLeaderNames] = useState([]); + const [confirmButtonDisable, setConfirmButtonDisable] = useState(true); + const [checkedConfirmation, setCheckedConfirmation] = useState(false); + const [selectedBlockCohortIdForTL, setSelectedBlockCohortIdForTL] = useState(""); + const [selectedTLUserID, setSelectedTLUserID] = useState(userId); + + + // const [reassignOpen, setReassignOpen] = useState(false); - const [checkedCenters, setCheckedCenters] = useState([]); + + + + + + //const [selectedBlockId, setselectedBlockId] = useState(blockName); + + const [checkedCenters, setCheckedCenters] = useState([]); + //const [checkedCenters, setCheckedCenters] = useState([]); const handleSearchInputChange = ( event: React.ChangeEvent @@ -65,39 +156,133 @@ const ReassignCenterModal: React.FC = ({ }; const handleClose = () => { + setCheckedCenters([]); onClose(); }; const handleToggle = (name: string) => { - setCheckedCenters((prev) => + if(userType===Role.LEARNERS) + { + setCheckedCenters([name]); + } + else{ + setCheckedCenters((prev) => prev.includes(name) ? prev.filter((center) => center !== name) : [...prev, name] ); + } + }; + useEffect(() => { + if (blockName) { + if(userType===Role.TEAM_LEADERS) + setCheckedCenters([blockName]); + } + if(centers) + { + if(userType!==Role.TEAM_LEADERS) + setCheckedCenters(centers?.split(',').map((center :any)=> center.trim())) + + } + }, [blockName, centers, open]); + console.log(checkedCenters) + console.log(centers) + const handleReassign = async () => { try { - const selectedData = cohorts - .filter((center) => checkedCenters.includes(center.name)) - .map((center) => center.id); - const unSelectedData = cohorts - .filter((center) => !checkedCenters.includes(center.name)) - .map((center) => center.id); - + let selectedData; + let unSelectedData: string[]; + if(userType!== Role.TEAM_LEADERS) + { + selectedData = cohorts + .filter((center) => center?.name && checkedCenters.includes(center.name)) + .map((center) => center!.id); + + unSelectedData = cohorts + .filter((center) => center?.name && !checkedCenters.includes(center.name)) + .map((center) => center!.id); + + } + else + { + selectedData = blocks + .filter((center) => center?.value && checkedCenters.includes(center.value)) + .map((center) => center!.value); + + unSelectedData= blocks + .filter((center) => center?.label && !checkedCenters.includes(center.label)) + .map((center) => center!.label); + } + + + console.log(blocks) + console.log(selectedData) + let payload; - if (userType !== Role.TEAM_LEADERS) { payload = { userId: [userId], cohortId: selectedData, - removeCohortId: unSelectedData, + removeCohortId: unSelectedData.length===0?cohortId:unSelectedData, }; await bulkCreateCohortMembers(payload); + let customFields; + + if(selectedBlock[0]!==blockName) + { + + const userDetails = await getUserDetailsInfo(userId); + const blockField = userDetails?.userData?.customFields.find( + (field: any) => field.label === "BLOCKS" + ); + console.log(checkedCenters) + customFields = [ + + { + fieldId: blockField.fieldId, + value: selectedBlockCode, + }, + + ]; + + + if(selectedDistrict[0]!==districtName) + { + const userDetails = await getUserDetailsInfo(userId); + const blockField = userDetails?.userData?.customFields.find( + (field: any) => field.label === "BLOCKS" + ); + customFields = [ + { + fieldId: districtFieldId, + value: selectedDistrictCode, + }, + { + fieldId: blockField.fieldId, + value: selectedBlockCode, + }, + + ]; + + } + } + + + const updateObject = { + userData: {}, + customFields: customFields, + }; + if (userId) { + await updateUser(userId, updateObject); + } handleClose(); + + showToastMessage( t( userType === Role.TEAM_LEADERS @@ -107,6 +292,8 @@ const ReassignCenterModal: React.FC = ({ "success" ); } else { + + const reassignBlockObject = { limit: 200, offset: 0, @@ -121,15 +308,46 @@ const ReassignCenterModal: React.FC = ({ const selectedBlockCohortId = cohortDetails?.find( (item: any) => item?.type === "BLOCK" )?.cohortId; - - if (!selectedBlockCohortId) { + setSelectedBlockCohortIdForTL(selectedBlockCohortId) + // setFilters({ + // cohortId:selectedBlockCohortId, + // role: Role.TEAM_LEADER, + // status:[Status.ACTIVE]} + // ) +const filters: FilterDetails= +{ + cohortId:selectedBlockCohortId, + role: Role.TEAM_LEADER, + status:[Status.ACTIVE]} +console.log(filters) + // let limit=200; + // let offset=0; + let sort= ["name", "asc"] + let resp; + try { + resp = await cohortMemberList({ filters, sort }); + } catch (apiError) { + console.log("API call failed, proceeding to else block"); + resp = null; + } + if (!selectedBlockCohortId) { showToastMessage( t("COMMON.COHORT_ID_NOT_FOUND", { block: checkedCenters[0] }), "info" ); return; } - + if(resp?.userDetails) + { + handleClose(); + setReassignAlertModal(true) + setAssignedTeamLeader(resp?.userDetails?.length) + setSelectedBlockForTL(checkedCenters[0]) + const userNames = resp?.userDetails?.map((user: any )=> user.name); + setSelectedTLUserID(userId) + setAssignedTeamLeaderNames(userNames) + } + else{ const previousBlockObject = { limit: 200, offset: 0, @@ -144,11 +362,22 @@ const ReassignCenterModal: React.FC = ({ const previousBlockId = previousCohortDetails?.find( (item: any) => item?.type === "BLOCK" )?.cohortId; - + + let unSelectedBlockCohortIds: string[] = []; + + + unSelectedBlockCohortIds.push(previousBlockId); + let cohortCode = formattedBlocks +.filter((item:any) => item.label === checkedCenters[0]) +.map((item:any) => item.value); + let cohortIds = blocks + .filter((item:any) => item.value !== cohortCode[0]) + .map((item:any) => item.cohortId); + cohortIds.push(previousBlockId) payload = { userId: [userId], cohortId: [selectedBlockCohortId], - removeCohortId: [previousBlockId], + removeCohortId:cohortIds, }; await bulkCreateCohortMembers(payload); @@ -158,20 +387,33 @@ const ReassignCenterModal: React.FC = ({ const blockField = userDetails?.userData?.customFields.find( (field: any) => field.label === "BLOCKS" ); - - const customFields = [ + const selectedCenterCode = filteredCBlocks.find(location => location.label === checkedCenters[0])?.value; + let customFields = [ { fieldId: blockField.fieldId, - value: checkedCenters[0], + value: cohortCode, }, ]; - + console.log(selectedBlockCode,checkedCenters[0]) + if(selectedDistrict[0]!==districtName) + { + customFields = [ + { + fieldId: blockField.fieldId, + value: selectedCenterCode, + }, + { + fieldId: districtFieldId, + value: selectedDistrictCode, + }, + ]; + } const updateObject = { userData: {}, customFields: customFields, }; - if (userId) { + await updateUser(userId, updateObject); } @@ -179,8 +421,11 @@ const ReassignCenterModal: React.FC = ({ t("COMMON.BLOCKS_REASSIGN_SUCCESSFULLY"), "success" ); + reassignButtonStatus ? setReassignButtonStatus(false) : setReassignButtonStatus(true); + } } } catch (error) { + console.log(error) showToastMessage( t( userType === Role.TEAM_LEADERS @@ -191,20 +436,43 @@ const ReassignCenterModal: React.FC = ({ ); } }; - - const filteredCohorts = cohorts?.filter((cohort) => - cohort.name.toLowerCase().includes(searchInput) + + let filteredCohorts = cohorts?.filter((cohort) => + cohort?.name?.toLowerCase().includes(searchInput) ); + + + const formattedCohorts = filteredCohorts?.map(location => ({ + ...location, + name: location.name + ? location.name.split(' ') + .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) + .join(' ') + : '' + })); + // const filteredCBlocks = blocks?.filter((cohort: any) => // cohort.label.toLowerCase().includes(searchInput) // ); - const filteredCBlocks = blocks?.filter((cohort: any) => + let filteredCBlocks = blocks?.filter((cohort: any) => cohort.label.toLowerCase().includes(searchInput) ).map((cohort: any) => ({ label: cohort.label, value: cohort.value, })); + +const formattedBlocks = filteredCBlocks.map(location => ({ + ...location, + label: location.label + ? location.label.split(' ') + .map((word: any) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) + .join(' ') + : '' +})); +console.log(filteredCBlocks) +console.log(formattedBlocks) + const handleToggle2 = (centerName: string) => { // If the selected center is already checked, uncheck it if (checkedCenters.includes(centerName)) { @@ -214,9 +482,126 @@ const ReassignCenterModal: React.FC = ({ setCheckedCenters([centerName]); } }; + const handleChange = (event: React.ChangeEvent) => { + setCheckedConfirmation(event.target.checked); + + }; + + const wrappedHandleReassignAction = async () => { + try{ + console.log(selectedTLUserID) + // await handleDeleteAction(); + const previousBlockObject = { + limit: 200, + offset: 0, + filters: { + status: ["active"], + name: blockName, + }, + }; + + const previousResponse = await getCenterList(previousBlockObject); + const previousCohortDetails = previousResponse?.result?.results?.cohortDetails; + const previousBlockId = previousCohortDetails?.find( + (item: any) => item?.type === "BLOCK" + )?.cohortId; + +let unSelectedBlockCohortIds: string[] = []; + +console.log(previousBlockId) +unSelectedBlockCohortIds.push(previousBlockId); +let cohortCode = formattedBlocks +.filter((item:any) => item.label === selectedBlockForTL) +.map((item:any) => item.value); +let cohortIds = blocks +.filter((item:any) => item.value !== cohortCode) +.map((item:any) => item.cohortId); +cohortIds.push(previousBlockId) + const payload = { + userId: [selectedTLUserID], + cohortId: [selectedBlockCohortIdForTL], + removeCohortId:cohortIds, + }; + + await bulkCreateCohortMembers(payload); + handleClose(); + + const userDetails = await getUserDetailsInfo(selectedTLUserID); + const blockField = userDetails?.userData?.customFields.find( + (field: any) => field.label === "BLOCKS" + ); + const selectedCenterCode = filteredCBlocks.find(location => location.label === selectedBlockForTL)?.value; + let customFields = [ + { + fieldId: blockField.fieldId, + value: selectedCenterCode, + }, + ]; + console.log(selectedBlockCode,selectedBlockForTL) + if(selectedDistrict[0]!==districtName) + { + customFields = [ + { + fieldId: blockField.fieldId, + value: cohortCode, + }, + { + fieldId: districtFieldId, + value: selectedDistrictCode, + }, + ]; + } + const updateObject = { + userData: {}, + customFields: customFields, + }; + if (selectedTLUserID) { + + await updateUser(selectedTLUserID, updateObject); + } + + showToastMessage( + t("COMMON.BLOCKS_REASSIGN_SUCCESSFULLY"), + "success" + ); + reassignButtonStatus ? setReassignButtonStatus(false) : setReassignButtonStatus(true); + } + catch(error) + { + console.log(error) + showToastMessage( + t("COMMON.SOMETHING_WENT_WRONG"), + "error" + ); + } + +finally{ handleCloseConfirmation(); +} + }; + const handleCancelAction = async () => { + // await handleDeleteAction(); + handleCloseConfirmation(); + }; + const handleCloseConfirmation= () => { + // await handleDeleteAction(); + // handleCloseConfirmation(); + setReassignAlertModal(false) + setCheckedConfirmation(false); + setConfirmButtonDisable(true) + }; + + + useEffect(() => { + if (checkedConfirmation) { + setConfirmButtonDisable(false); + } else { + setConfirmButtonDisable(true); + } + }, [checkedConfirmation]); return ( <> = ({ primaryBtnClick={handleReassign} primaryBtnDisabled={checkedCenters.length === 0} > - - + {(selectedBlock.length===0 && userType!==Role.TEAM_LEADERS)? (<> + + { t("COMMON.PLEASE_SELECT_BLOCK_LIST")} + + + ): + (<> + + + + ), + }} + /> + + + + {userType !== Role.TEAM_LEADERS ? ( + formattedCohorts && formattedCohorts.length > 0 ? ( + formattedCohorts.map((center) => ( + + + {center.name} + center?.name && handleToggle(center.name)} + sx={{ + color: theme.palette.text.primary, + "&.Mui-checked": { + color: "black", + }, + verticalAlign: "middle", + marginTop: "-10px", + }} + /> + + + + )) + ) : ( + { t("COMMON.NO_CENTER_AVAILABLE")} + + ) + ) : formattedBlocks && formattedBlocks.length > 0 ? ( + formattedBlocks.map((center: any) => ( + + + {center.label} + handleToggle2(center.label)} sx={{ - backgroundColor: theme.palette.warning["A700"], - borderRadius: 8, - "& .MuiOutlinedInput-root fieldset": { border: "none" }, - "& .MuiOutlinedInput-input": { borderRadius: 8 }, - }} - placeholder={ userType===Role.TEAM_LEADERS?t("MASTER.SEARCHBAR_PLACEHOLDER_BLOCK"): t("CENTERS.SEARCHBAR_PLACEHOLDER")} - value={searchInput} - onChange={handleSearchInputChange} - fullWidth - InputProps={{ - endAdornment: ( - - - - ), + color: theme.palette.text.primary, + "&.Mui-checked": { + color: "black", + }, + verticalAlign: "middle", + marginTop: "-10px", }} /> - - { userType!==Role.TEAM_LEADERS? (filteredCohorts?.map((center) => ( - - - {center.name} - handleToggle(center.name)} - sx={{ - color: theme.palette.text.primary, - "&.Mui-checked": { - color: "black", - }, - verticalAlign: "middle", - marginTop: "-10px", - }} - /> - - - - ))): - (filteredCBlocks?.map((center: any) => ( - - - {center.label} - handleToggle2(center.value)} - sx={{ - color: theme.palette.text.primary, - "&.Mui-checked": { - color: "black", - }, - verticalAlign: "middle", - marginTop: "-10px", - }} - /> - - - - ))) - } - + + + )) + ) : ( + { t("COMMON.NO_BLOCK_AVAILABLE")} + )} + - + + + )} + + { ( + + + +{assignedTeamLeaderNames.length>1 ?( + <> + {t('COMMON.MULTIPLE_TEAM_LEADERS_ASSIGNED', { selectedBlockForTL: selectedBlockForTL,assignedTeamLeader: assignedTeamLeader})} + + + ):(<> + + {t('COMMON.SINGLE_TEAM_LEADERS_ASSIGNED', { selectedBlockForTL: selectedBlockForTL,assignedTeamLeader: assignedTeamLeader})} + + ) +} + + + + {assignedTeamLeaderNames.length>1 ?( + <> + {t('COMMON.ASSIGNED_TEAM_LEADERS', { assignedTeamLeaderNames:assignedTeamLeaderNames[0]})} + + + + + ):(<> + {assignedTeamLeaderNames[0]} + ) + + } + + + } + label={ t('COMMON.CONTINUE_ASSIGNED_TEAM_LEADER', {selectedBlockForTL: selectedBlockForTL})} + sx={{ marginTop: "12px", color: "#555" }} + /> + + + )} ); }; diff --git a/src/components/ResourceCard.tsx b/src/components/ResourceCard.tsx new file mode 100644 index 00000000..3882eb95 --- /dev/null +++ b/src/components/ResourceCard.tsx @@ -0,0 +1,41 @@ +import React from 'react'; +import { Card, CardContent, Typography, Box } from '@mui/material'; +import Image from 'next/image'; +import placeholderImage from '../../public/placeholderImage.png'; + +interface ResourceCardProps { + title: string; + type: string; + resource: string; +} + +const ResourceCard: React.FC = ({ title, type, resource }) => { + return ( + + + + Resource Placeholder + + + {title} + + + {type} + + + + ); +}; + +export default ResourceCard; diff --git a/src/components/SimpleModal.tsx b/src/components/SimpleModal.tsx index 54486e87..ea2d188c 100644 --- a/src/components/SimpleModal.tsx +++ b/src/components/SimpleModal.tsx @@ -46,10 +46,10 @@ const SimpleModal: React.FC = ({ top: "50%", left: "50%", transform: "translate(-50%, -50%)", - width: isSmallScreen ? "90%" : isLargeScreen ? "65%" : "85%", + width: isSmallScreen ? "90%" : "40%", maxHeight: "80vh", backgroundColor: "#fff", - borderRadius: '8px', + borderRadius: "8px", boxShadow: theme.shadows[5], }; @@ -60,8 +60,8 @@ const SimpleModal: React.FC = ({ padding: theme.spacing(2), zIndex: 9999, borderBottom: `1px solid ${theme.palette.divider}`, - borderTopLeftRadius: '8px', - borderTopRightRadius: '8px', + borderTopLeftRadius: "8px", + borderTopRightRadius: "8px", }; const contentStyle = { diff --git a/src/components/UserTable.tsx b/src/components/UserTable.tsx index 88d03c10..f7d98dba 100644 --- a/src/components/UserTable.tsx +++ b/src/components/UserTable.tsx @@ -22,7 +22,7 @@ import PersonSearchIcon from "@mui/icons-material/PersonSearch"; import { Role, apiCatchingDuration } from "@/utils/app.constant"; import { getFormRead } from "@/services/CreateUserService"; import { showToastMessage } from "./Toastify"; -import { capitalizeFirstLetterOfEachWordInArray } from "../utils/Helper"; +import { capitalizeFirstLetterOfEachWordInArray , firstLetterInUpperCase} from "../utils/Helper"; import { getUserTableColumns, getTLTableColumns } from "@/data/tableColumns"; import { TablePagination, useMediaQuery } from "@mui/material"; import { Theme } from "@mui/system"; @@ -31,6 +31,8 @@ import { useQuery } from "@tanstack/react-query"; import ReassignCenterModal from "./ReassignCenterModal"; import { getCenterList, getStateBlockDistrictList } from "@/services/MasterDataService"; import { updateCohortMemberStatus } from "@/services/CohortService/cohortService"; +import useSubmittedButtonStore from "@/utils/useSharedState"; +import { useRouter } from "next/router"; type UserDetails = { userId: any; username: any; @@ -47,7 +49,9 @@ type UserDetails = { districtCode?:any; blockCode?:any; centerMembershipIdList?:any; - blockMembershipIdList?:any + blockMembershipIdList?:any; + cohortIds?:any; + districtValue?:any }; type FilterDetails = { role: any; @@ -93,8 +97,30 @@ const UserTable: React.FC = ({ const [selectedState, setSelectedState] = React.useState([]); const [blockMembershipIdList, setBlockMembershipIdList] = React.useState([]); const [centerMembershipIdList, setCenterMembershipIdList] = React.useState([]); + const router = useRouter(); + + const selectedBlockStore = useSubmittedButtonStore( + (state: any) => state.selectedBlockStore + ); + const setSelectedBlockStore = useSubmittedButtonStore( + (state: any) => state.setSelectedBlockStore + ); + const selectedDistrictStore = useSubmittedButtonStore( + (state: any) => state.selectedDistrictStore + ); + const setSelectedDistrictStore = useSubmittedButtonStore( + (state: any) => state.setSelectedDistrictStore + ); + const selectedCenterStore = useSubmittedButtonStore( + (state: any) => state.selectedCenterStore + ); + const setSelectedCenterStore = useSubmittedButtonStore( + (state: any) => state.setSelectedCenterStore + ); + + const [selectedStateCode, setSelectedStateCode] = useState(""); const [selectedDistrict, setSelectedDistrict] = React.useState([]); const [selectedDistrictCode, setSelectedDistrictCode] = useState(""); @@ -117,15 +143,27 @@ const UserTable: React.FC = ({ const [centers, setCenters] = useState([]); const [userName, setUserName] = useState(""); const [blocks, setBlocks] = useState([]); - const [userCohort, setUserCohorts] = useState ("") + const [userCohort, setUserCohorts] = useState (""); + const [assignedCenters, setAssignedCenters] = useState(); + + const [initialized, setInitialized] = useState(false); const [selectedUserId, setSelectedUserId] = useState(""); + const [cohortId, setCohortId] = useState([]); + const [block, setBlock] = useState(""); + const [district, setDistrict] = useState(""); + + const [blockCode, setBlockCode] = useState(""); + const [districtCode, setDistrictCode] = useState(""); + const [selectedReason, setSelectedReason] = useState(""); const [otherReason, setOtherReason] = useState(""); const [deleteUserState, setDeleteUserState] = useState(false); const [selectedCenter, setSelectedCenter] = useState([]); + const [selectedCenterCode, setSelectedCenterCode] = useState([]); + const [enableCenterFilter, setEnableCenterFilter] = useState(false); @@ -142,6 +180,10 @@ const UserTable: React.FC = ({ const [openAddLearnerModal, setOpenAddLearnerModal] = React.useState(false); const [userId, setUserId] = useState(); const [submitValue, setSubmitValue] = useState(false); + console.log(selectedBlockCode) + const reassignButtonStatus = useSubmittedButtonStore( + (state: any) => state.reassignButtonStatus + ); const { data:teacherFormData ,isLoading: teacherFormDataLoading, error :teacherFormDataErrror } = useQuery({ queryKey: ["teacherFormData"], queryFn: () => Promise.resolve([]), @@ -236,11 +278,36 @@ const UserTable: React.FC = ({ /> ); const handleStateChange = async (selected: string[], code: string[]) => { + const newQuery = { ...router.query }; + + if (newQuery.center) { + delete newQuery.center; + } + if (newQuery.district) { + delete newQuery.district; + } + if (newQuery.block) { + delete newQuery.block; + } + router.replace({ + pathname: router.pathname, + query: { + ...newQuery, + state: code?.join(","), + } + }); + setSelectedCenterCode([]) + setEnableCenterFilter(false) setSelectedDistrict([]); - setSelectedBlock([]); + setSelectedCenter([]); + setSelectedBlock([]); + setSelectedBlockCode(""); + setSelectedDistrictCode(""); setSelectedState(selected); + + console.log(selected[0]) if (selected[0] === "" || selected[0] === t("COMMON.ALL_STATES")) { if (filters.status) setFilters({ status: [filters.status], role: role }); @@ -287,13 +354,28 @@ const UserTable: React.FC = ({ }; const handleDistrictChange = (selected: string[], code: string[]) => { + const newQuery = { ...router.query }; +console.log(selected) + if (newQuery.center) { + delete newQuery.center; + } + if (newQuery.block) { + delete newQuery.block; + } + + setSelectedCenterCode([]) + setEnableCenterFilter(false) + setSelectedCenter([]); setSelectedBlock([]); setSelectedDistrict(selected); +setSelectedBlockCode(""); +localStorage.setItem('selectedDistrict', selected[0]) - +setSelectedDistrictStore(selected[0]) if (selected[0] === "" || selected[0] === t("COMMON.ALL_DISTRICTS")) { + if (filters.status) { setFilters({ states: selectedStateCode, @@ -307,7 +389,25 @@ const UserTable: React.FC = ({ role: role, }); } + if (newQuery.district) { + delete newQuery.district; + } + router.replace({ + pathname: router.pathname, + query: { + ...newQuery, + state: selectedStateCode, + } + }); } else { + router.replace({ + pathname: router.pathname, + query: { + ...newQuery, + state: selectedStateCode, + district: code?.join(",") + } + }); const districts = code?.join(","); setSelectedDistrictCode(districts); if (filters.status) { @@ -329,10 +429,36 @@ const UserTable: React.FC = ({ console.log("Selected categories:", selected); }; const handleBlockChange = (selected: string[], code: string[]) => { - setEnableCenterFilter(false) + setSelectedCenterCode([]) + setEnableCenterFilter(false) + setSelectedCenter([]); + const newQuery = { ...router.query }; + if (newQuery.center) { + delete newQuery.center; + } + if (newQuery.block) { + delete newQuery.block; + } + console.log(code?.join(",")) + + + setSelectedBlock(selected); + localStorage.setItem('selectedBlock', selected[0]) + setSelectedBlockStore(selected[0]) if (selected[0] === "" || selected[0] === t("COMMON.ALL_BLOCKS")) { + if (newQuery.block) { + delete newQuery.block; + } + router.replace({ + pathname: router.pathname, + query: { + ...newQuery, + state: selectedStateCode, + district: selectedDistrictCode, + } + }); if (filters.status) { setFilters({ states: selectedStateCode, @@ -349,6 +475,15 @@ const UserTable: React.FC = ({ }); } } else { + router.replace({ + pathname: router.pathname, + query: { + ...newQuery, + state: selectedStateCode, + district: selectedDistrictCode, + block: code?.join(",") + } + }); const blocks = code?.join(","); setSelectedBlockCode(blocks); if (filters.status) { @@ -372,17 +507,83 @@ const UserTable: React.FC = ({ console.log("Selected categories:", selected); }; const handleCenterChange = async(selected: string[], code: string[]) => { + if(code[0]) + { +console.log(code[0]) + router.replace({ + pathname: router.pathname, + query: { + ...router.query, + state: selectedStateCode, + district: selectedDistrictCode, + block: selectedBlockCode, + center: code[0] + } + }); + } + else + { + const newQuery = { ...router.query }; + if (newQuery.center) { + delete newQuery.center; + router.replace({ + ...newQuery, + + }); + } + + } + + + + + + + setSelectedCenterCode([code[0]]) + setSelectedCenter(selected) + localStorage.setItem('selectedCenter',selected[0] ) + setSelectedCenterStore(selected[0]) + console.log(selected[0]) + if (selected[0] === "" || selected[0] === t("COMMON.ALL_CENTERS")) { + setEnableCenterFilter(false) + setSelectedCenterCode([]) + if (filters.status) { - setEnableCenterFilter(true) - setFilters({ - // states: selectedStateCode, - // districts: selectedDistrictCode, - // blocks: blocks, - cohortId:code[0], - role: role, - status:[statusValue] - }); + setFilters({ + states: selectedStateCode, + districts: selectedDistrictCode, + blocks: selectedBlockCode, + role: role, + status: filters.status, + + }); + } else { + + setFilters({ + states: selectedStateCode, + districts: selectedDistrictCode, + blocks: selectedBlockCode, + role: role, + }); + } + } + else + { + setEnableCenterFilter(true) + + setFilters({ + // states: selectedStateCode, + // districts: selectedDistrictCode, + // blocks: blocks, + cohortId:code[0], + role: role, + status:[statusValue] + }); + + } + + }; const handleSortChange = async (event: SelectChangeEvent) => { @@ -472,9 +673,9 @@ const UserTable: React.FC = ({ return initialFormData; }; const handleEdit = async (rowData: any) => { - if (submitValue) { - setSubmitValue(false); - } + + submitValue ? setSubmitValue(false) : setSubmitValue(true); + console.log("Edit row:", rowData); try { @@ -534,8 +735,23 @@ const UserTable: React.FC = ({ const handleReassignCohort = async(rowData: any) => { // setIsDeleteModalOpen(true); console.log(rowData) - setSelectedUserId(rowData.userId ); - setBlock(rowData.blocks) + setSelectedUserId(rowData?.userId ); + setCohortId(rowData?.cohortIds); + setBlock(rowData?.blocks) + console.log(rowData?.districtValue) + + setDistrict(rowData?.districtValue) + setDistrictCode(rowData?.districtCode) + setBlockCode(rowData?.blockCode) + setAssignedCenters(rowData?.centers) + const reassignUserInfo = { + blocks: rowData?.blocks || [], + districtValue: rowData?.districtValue || '', + districtCode: rowData?.districtCode || '', + blockCode: rowData?.blockCode || '' + }; + + localStorage.setItem('reassignuserInfo', JSON.stringify(reassignUserInfo)); setIsReassignCohortModalOpen(true) //const userData=""; @@ -648,19 +864,19 @@ const UserTable: React.FC = ({ { finalResult = result?.map((user: any) => { const ageField = user?.customField?.find( - (field: any) => field?.fieldname === "AGE" + (field: any) => field?.label === "AGE" ); const genderField = user?.customField?.find( - (field: any) => field?.fieldname === "GENDER" + (field: any) => field?.label === "GENDER" ); const blockField = user?.customField?.find( - (field: any) => field?.fieldname === "BLOCKS" + (field: any) => field?.label === "BLOCKS" ); const districtField = user?.customField?.find( - (field: any) => field?.fieldname === "DISTRICTS" + (field: any) => field?.label === "DISTRICTS" ); const stateField = user?.customField?.find( - (field: any) => field?.fieldname === "STATES" + (field: any) => field?.label === "STATES" ); return { userId: user?.userId, @@ -672,18 +888,24 @@ const UserTable: React.FC = ({ role: user.role, // gender: user.gender, mobile: user.mobile === "NaN" ? "-" : user.mobile, - age: ageField ? ageField?.fieldvalues : "-", - district: districtField ? districtField?.fieldvalues+" , "+blockField?.fieldvalues : "-", - state: stateField ? stateField?.fieldvalues : "-", - blocks: blockField ? blockField?.fieldvalues : "-", + age: ageField ? ageField?.value : "-", + district: districtField ? districtField?.value+" , "+firstLetterInUpperCase(blockField?.value) : "-", + state: stateField ? stateField?.value : "-", + blocks: blockField ? firstLetterInUpperCase(blockField?.value) : "-", gender: genderField - ? genderField.fieldvalues?.charAt(0)?.toUpperCase() + - genderField.fieldvalues.slice(1).toLowerCase() + ? genderField?.value?.charAt(0)?.toUpperCase() + + genderField?.value?.slice(1).toLowerCase() : "-", // createdAt: user?.createdAt, // updatedAt: user?.updatedAt, createdBy: user?.createdBy, updatedBy: user?.updatedBy, + stateCode:stateField?.code, + + districtCode:districtField?.code, + blockCode:blockField?.code, + districtValue:districtField? districtField?.value: "-" + // // centers: null, // Programs: null, }; @@ -697,7 +919,7 @@ const UserTable: React.FC = ({ (field: any) => field?.label === "AGE" ); const genderField = user?.customFields?.find( - (field: any) => field?.label === "GENDER" + (field: any) => field?.label === "GENDER" ); const blockField = user?.customFields?.find( (field: any) => field?.label === "BLOCKS" @@ -719,11 +941,11 @@ const UserTable: React.FC = ({ user.name.slice(1).toLowerCase(), role: user.role, // gender: user.gender, - mobile: user.mobile === "NaN" ? "-" : user.mobile, - age: ageField ? ageField.value : "-", - district: districtField ? districtField.value+" , "+blockField.value : "-", - state: stateField ? stateField.value : "-", - blocks: blockField ? blockField.value : "-", + mobile: user.mobile === "NaN" ? "-" : user?.mobile, + age: ageField ? ageField?.value : "-", + district: districtField ? districtField?.value+" , "+firstLetterInUpperCase(blockField?.value) : "-", + state: stateField ? stateField?.value : "-", + blocks: blockField ? firstLetterInUpperCase(blockField?.value) : "-", gender: genderField ? genderField.value?.charAt(0)?.toUpperCase() + genderField.value.slice(1).toLowerCase() @@ -734,7 +956,9 @@ const UserTable: React.FC = ({ updatedBy: user.updatedBy, stateCode:stateField?.code, districtCode:districtField?.code, - blockCode:blockField?.code + blockCode:blockField?.code, + districtValue:districtField? districtField?.value: "-" + // centers: null, // Programs: null, }; @@ -770,7 +994,12 @@ const UserTable: React.FC = ({ console.log(error); } }; - fetchUserList(); + console.log(data ) + if ((selectedBlockCode !== "") || (selectedDistrictCode !== "" && selectedBlockCode === "") || (userType===Role.TEAM_LEADERS && selectedDistrictCode!=="") ){ + fetchUserList(); + } + // fetchUserList(); + }, [ pageOffset, submitValue, @@ -779,9 +1008,12 @@ const UserTable: React.FC = ({ filters, parentState, deleteUserState, - sortByForCohortMemberList + sortByForCohortMemberList, + reassignButtonStatus, + enableCenterFilter, + userType ]); - +console.log(selectedBlockStore) useEffect(() => { const fetchData = async () => { try { @@ -795,17 +1027,21 @@ const UserTable: React.FC = ({ // (cohort: Cohort) => cohort.name, // ); const cohortNames = response?.result?.cohortData - ?.filter((cohort: Cohort) => cohort.type !== "BLOCK" && cohort?.cohortMemberStatus!=="archived") // Filter out cohorts with type 'block' - .map((cohort: Cohort) => cohort.name); + ?.filter((cohort: Cohort) => cohort.type !== "BLOCK" && cohort?.cohortMemberStatus!=="archived") + .map((cohort: Cohort) => cohort.name); + const cohortIds = response?.result?.cohortData + ?.filter((cohort: Cohort) => cohort.type !== "BLOCK" && cohort?.cohortMemberStatus!=="archived") + .map((cohort: Cohort) => cohort.cohortId); + const centerMembershipIdList = response?.result?.cohortData - ?.filter((cohort: Cohort) => cohort.type !== "BLOCK" && cohort?.cohortMemberStatus!=="archived") // Filter out cohorts with type 'block' + ?.filter((cohort: Cohort) => cohort.type !== "BLOCK" && cohort?.cohortMemberStatus!=="archived") .map((cohort: Cohort) => cohort.cohortMembershipId); const blockMembershipIdList = response?.result?.cohortData - ?.filter((cohort: Cohort) => cohort.type === "BLOCK" && cohort?.cohortMemberStatus!=="archived") // Filter out cohorts with type 'block' + ?.filter((cohort: Cohort) => cohort.type === "BLOCK" && cohort?.cohortMemberStatus!=="archived") .map((cohort: Cohort) => cohort.cohortMembershipId); // const cohortMembershipId=response?.result?.cohortData?.cohortMembershipId; console.log(blockMembershipIdList) - console.log(centerMembershipIdList) + console.log(cohortIds) let finalArray; @@ -813,12 +1049,12 @@ const UserTable: React.FC = ({ finalArray = capitalizeFirstLetterOfEachWordInArray(cohortNames); } // const finalArray=capitalizeFirstLetterOfEachWordInArray(cohortNames) - // console.log(finalArray) + console.log(finalArray) return { ...user, centerMembershipIdList: centerMembershipIdList, blockMembershipIdList: blockMembershipIdList, - + cohortIds:cohortIds, centers: finalArray ? finalArray?.join(" , ") : "-", }; }) @@ -853,19 +1089,94 @@ const UserTable: React.FC = ({ if (!stateField.value.includes(',')) { setSelectedState([stateField.value]); setSelectedStateCode(stateField.code) - setFilters({ - states: stateField.code, - role: role, - status:[statusValue], - } + + + // setFilters({ + // states: stateField.code, + // //districts:selectedDistrictCode, + // // blocks:selectedBlockCode, + // role: role, + // status:[statusValue], + // } - ) + // ) + // console.log(selectedDistrict) + // console.log(selectedBlock) + // if( selectedDistrict.length===0 ||selectedDistrict[0]==="All Districts") + // { + // const newQuery = { ...router.query }; + + // if (newQuery.district) { + // delete newQuery.district; + // } + // if (newQuery.block) { + // delete newQuery.block; + // } + // if(newQuery.center) + // { + // delete newQuery.center; + // } + // console.log(newQuery) + // router.replace({ + // pathname: router.pathname, + // query: { + // ...newQuery, + // } + // }); + + // } + // console.log(selectedBlock) + // if( selectedBlock.length===0 ||selectedBlock[0]==="All Blocks") + // { + // const newQuery = { ...router.query }; + + // // if (newQuery.district) { + // // delete newQuery.district; + // // } + + // if (newQuery.block) { + // delete newQuery.block; + // } + // if(newQuery.center) + // { + // delete newQuery.center; + // } + // router.replace({ + // pathname: router.pathname, + // query: { + // ...newQuery, + // } + // }); + + // } + + + if(selectedDistrictCode && selectedDistrict.length!==0 &&selectedDistrict[0]!==t("COMMON.ALL_DISTRICTS")) + { + console.log("true---") + setFilters({ + states: stateField.code, + districts:selectedDistrictCode, + // blocks:selectedBlockCode, + role: role, + status:[statusValue], + }) + } + if(selectedBlockCode && selectedBlock.length!==0 && selectedBlock[0]!==t("COMMON.ALL_BLOCKS")) + { + setFilters({ + states: stateField.code, + districts:selectedDistrictCode, + blocks:selectedBlockCode, + role: role, + status:[statusValue], + }) + } + + } - const object=[{ - value:stateField.code, - label:stateField.value - }] + // setStates(object); } @@ -877,13 +1188,164 @@ const UserTable: React.FC = ({ }; fetchData(); - }, []); - + }, [selectedBlockCode, selectedDistrictCode]); + useEffect(() => { + const fetchData = () => { + // console.log(selectedCenter.length) + if(userType===Role.TEAM_LEADERS) + { + setEnableCenterFilter(false); + } + else{ + if(selectedCenter.length!==0) + { + if (selectedCenter[0] === "" || selectedCenter[0] === t("COMMON.ALL_CENTERS")) { + setEnableCenterFilter(false); + } + else + { + console.log(selectedCenterCode) + setEnableCenterFilter(true); + } + //setEnableCenterFilter(true); + if(selectedCenterCode.length!==0) + { + setFilters({ + // states: selectedStateCode, + // districts: selectedDistrictCode, + // blocks: blocks, + cohortId:selectedCenterCode[0], + role: role, + status:[statusValue] + });} + + + } + else{ + setEnableCenterFilter(false) + if(selectedCenterCode.length!==0) + setSelectedCenterCode([]) + } + } + + + + }; + + fetchData(); + }, [selectedCenter, selectedCenterCode]); + console.log(enableCenterFilter) + // useEffect(() => { + // const { state, district, block, center } = router.query; + + // { + // if (state) { + // setSelectedStateCode(state.toString()); + // } + // if (district) { + // setSelectedDistrictCode(district.toString()); + // } + // if (block) { + // setSelectedBlockCode(block.toString()); + // } + // if ( center) { + // setSelectedCenter([center.toString()]); + // } + // setInitialized(true); + // } + // }, []); + + // useEffect(() => { + + // // Handle replacement when only state and district codes are available + // if (selectedStateCode!=="" && selectedDistrictCode==="" && selectedBlockCode==="") { + // console.log("true") + // const newQuery = { ...router.query }; + // console.log(newQuery) + + // if (newQuery.center) { + // delete newQuery.center; + // } + // if (newQuery.district) { + // delete newQuery.district; + // } + // if (newQuery.block) { + // delete newQuery.block; + // } + // router.replace({ + // pathname: router.pathname, + // query: { + // ...newQuery, + // state: selectedStateCode, + // } + // }); + // } + // if (selectedStateCode!=="" && selectedDistrictCode!=="" && selectedBlockCode==="") { + // const newQuery = { ...router.query }; + // console.log(newQuery) + + // if (newQuery.center) { + // delete newQuery.center; + // } + // if (newQuery.block) { + // delete newQuery.block; + // } + // router.replace({ + // pathname: router.pathname, + // query: { + // ...newQuery, + // state: selectedStateCode, + // district: selectedDistrictCode + // } + // }); + // } + + // // Handle replacement when state, district, and block codes are available + // if (selectedStateCode!=="" && selectedDistrictCode!=="" && selectedBlockCode!=="" && selectedCenter.length === 0) { + // const newQuery = { ...router.query }; + + // if (newQuery.center) { + // delete newQuery.center; + // } + // if (newQuery.block) { + // delete newQuery.block; + // } + // router.replace({ + // pathname: router.pathname, + // query: { + // ...newQuery, + // state: selectedStateCode, + // district: selectedDistrictCode, + // block: selectedBlockCode + // } + // }); + // } + + // // Handle replacement when state, district, block, and center are all selected + // if (selectedStateCode !==""&& selectedDistrictCode!=="" && selectedBlockCode!=="" && selectedCenter.length !== 0) { + // console.log("heyyy") + + // console.log(selectedCenter); + // if (userType !== Role.TEAM_LEADERS) { + // router.replace({ + // pathname: router.pathname, + // query: { + // ...router.query, + // state: selectedStateCode, + // district: selectedDistrictCode, + // block: selectedBlockCode, + // center: selectedCenter + // } + // }); + // } + // } + // }, [selectedStateCode]); + const handleCloseDeleteModal = () => { @@ -988,7 +1450,9 @@ const UserTable: React.FC = ({ searchPlaceHolder: searchPlaceholder, selectedState: selectedState, selectedDistrict: selectedDistrict, + setSelectedDistrict:setSelectedDistrict, selectedBlock: selectedBlock, + setSelectedBlock:setSelectedBlock, selectedSort: selectedSort, statusValue:statusValue, setStatusValue:setStatusValue, @@ -1001,11 +1465,18 @@ const UserTable: React.FC = ({ handleSearch: handleSearch, handleAddUserClick: handleAddUserClick, selectedBlockCode: selectedBlockCode, + setSelectedBlockCode:setSelectedBlockCode, selectedDistrictCode: selectedDistrictCode, + setSelectedDistrictCode:setSelectedDistrictCode, selectedStateCode: selectedStateCode, handleCenterChange:handleCenterChange, - selectedCenter: selectedCenter + selectedCenter: selectedCenter, + setSelectedCenter:setSelectedCenter, + selectedCenterCode:selectedCenterCode, + setSelectedCenterCode: setSelectedCenterCode, + setSelectedStateCode:setSelectedStateCode }; + return ( @@ -1088,7 +1559,7 @@ const UserTable: React.FC = ({ centers={userCohort} userId={selectedUserId} userName={userName} - + userType={userType} /> = ({ onClose={handleCloseReassignModal} userType={userType} cohortData={centers} - blocks={blocks} + blockList={blocks} userId={selectedUserId} blockName={block} + districtName={district} + blockCode={blockCode} + districtCode={districtCode} + cohortId={cohortId} + centers={assignedCenters} + /> { return await getCohortMemberlistData(cohortId); }) ); - - result?.forEach((item: any, index: number) => { +console.log(result) +const finalResult= result +?.filter((cohort: any) => cohort.type === "COHORT") +finalResult?.forEach((item: any, index: number) => { const cohortType = item?.customFields?.find( (field: any) => field.label === "TYPE_OF_COHORT" @@ -243,6 +245,7 @@ const Center: React.FC = () => { }; resultData?.push(requiredData); }); + console.log(resultData) setCohortData(resultData); const totalCount = resp?.count; setTotalCound(totalCount); diff --git a/src/pages/course-planner/index.tsx b/src/pages/course-planner/index.tsx index 8e6539f0..7602a9e3 100644 --- a/src/pages/course-planner/index.tsx +++ b/src/pages/course-planner/index.tsx @@ -154,24 +154,10 @@ const Foundation = () => { return ( <> - handleFilter(event.target.value)} - card={undefined} - selectFilter={selectFilter} - onBackClick={undefined} - /> - {loading ? ( ) : ( - + {/* { }} sx={{ minWidth: "auto", padding: 0 }} > - diff --git a/src/pages/importCsv.tsx b/src/pages/importCsv.tsx index 5270ab9f..3cb17426 100644 --- a/src/pages/importCsv.tsx +++ b/src/pages/importCsv.tsx @@ -67,6 +67,7 @@ const ImportCsv = () => { const [subTopics, setSubTopics] = useState(0); const theme = useTheme(); const isSmallScreen = useMediaQuery(theme.breakpoints.down("sm")); + const setResources = taxonomyStore((state) => state.setResources); useEffect(() => { const fetchData = async () => { @@ -153,18 +154,9 @@ const ImportCsv = () => { const userProjectDetailsResponse = await getUserProjectDetails({ id: courseId, }); - setUserProjectDetails(userProjectDetailsResponse.result.tasks); + setUserProjectDetails(userProjectDetailsResponse?.result?.tasks); if (userProjectDetails?.length) { - const totalChildren = userProjectDetails.reduce( - (acc: number, project: any) => { - return acc + (project?.children?.length || 0); - }, - 0 - ); - - if (totalChildren !== subTopics) { - setSubTopics(totalChildren); - } + } setLoading(false); } catch (error) { @@ -305,6 +297,24 @@ const ImportCsv = () => { return months[date.getMonth()]; }; + const handleResources = (subTopic: any) => { + setResources(subTopic); + router.push({ + pathname: "/resourceList", + }); + }; + + const totalChildren = userProjectDetails?.reduce( + (acc: number, project: any) => { + return acc + (project?.children?.length || 0); + }, + 0 + ); + + if (totalChildren !== subTopics) { + setSubTopics(totalChildren); + } + return ( { - - {subjectDetails?.subject} + + {tstore.taxonomySubject} @@ -367,27 +377,11 @@ const ImportCsv = () => { }} onClick={handleCopyLink} > - + {/* */} - {}} - handleMediumChange={() => {}} - handleSearchChange={() => {}} - selectedOption="" - handleDropdownChange={() => {}} - card={undefined} - selectFilter={undefined} - onBackClick={() => {}} - showGradeMedium={false} - showFoundaitonCourse={false} - /> - {loading ? ( @@ -497,7 +491,7 @@ const ImportCsv = () => { display: "flex", flexDirection: "row", justifyContent: "space-between", - padding: "10px 25px 0px 25px ", + padding: "10px 25px 0px 25px", borderRadius: "8px", }} > @@ -510,10 +504,8 @@ const ImportCsv = () => { {t("COURSE_PLANNER.DURATION/MONTH")} - - {t("COURSE_PLANNER.COPY_LINK")} - + { {topic.children.map((subTopic: any) => ( handleResources(subTopic)} sx={{ border: `1px solid #E0E0E0`, padding: "10px", backgroundColor: "white", marginBottom: "20px", + cursor: "pointer", }} > { )} - - - diff --git a/src/pages/resourceList.tsx b/src/pages/resourceList.tsx new file mode 100644 index 00000000..a06ae5d0 --- /dev/null +++ b/src/pages/resourceList.tsx @@ -0,0 +1,130 @@ +import React, { useEffect, useState } from "react"; +import { Grid, Typography, Box, IconButton } from "@mui/material"; +import ArrowBackIcon from "@mui/icons-material/ArrowBack"; // Import the back arrow icon +import ResourceCard from "../components/ResourceCard"; +import taxonomyStore from "@/store/tanonomyStore"; +import { serverSideTranslations } from "next-i18next/serverSideTranslations"; +import { ResourceType } from "@/utils/app.constant"; +import { useTranslation } from "next-i18next"; + +const ResourceList = () => { + const [learnersPreReq, setLearnersPreReq] = useState([]); + const [learnersPostReq, setLearnersPostReq] = useState([]); + const [facilitatorsPreReq, setFacilitatorsPreReq] = useState([]); + + const tstore = taxonomyStore(); + const { t } = useTranslation(); + + useEffect(() => { + const fetchData = async () => { + const resources = tstore.resources; + + const fetchedLearningResources = resources.learningResources || []; + + const preReqs = fetchedLearningResources.filter( + (item: any) => item.type === ResourceType.PREREQUISITE + ); + const postReqs = fetchedLearningResources.filter( + (item: any) => item.type === ResourceType.POSTREQUISITE + ); + const facilitatorsReqs = fetchedLearningResources.filter( + (item: any) => !item.type + ); + + setLearnersPreReq(preReqs); + setLearnersPostReq(postReqs); + setFacilitatorsPreReq(facilitatorsReqs); + }; + + fetchData(); + }, [tstore.resources]); + + return ( + + {tstore.taxonomyType} + + window.history.back()}> + + + + {/* Course Name */} + + {tstore?.resources?.name} + + + + + + {t("COURSE_PLANNER.LEARNERS_PREREQISITE")} + + {learnersPreReq.length > 0 ? ( + + {learnersPreReq.map((item, index) => ( + + + + ))} + + ) : ( + + {t("COURSE_PLANNER.NO_DATA_PRE")} + + )} + + + {t("COURSE_PLANNER.LEARNERS_POSTREQISITE")} + + {learnersPostReq.length > 0 ? ( + + {learnersPostReq.map((item, index) => ( + + + + ))} + + ) : ( + + {t("COURSE_PLANNER.NO_DATA_POST")} + + )} + + + {t("COURSE_PLANNER.FACILITATORS")} + + {facilitatorsPreReq.length > 0 ? ( + + {facilitatorsPreReq.map((item, index) => ( + + + + ))} + + ) : ( + {t("COURSE_PLANNER.NO_DATA")} + )} + + + ); +}; + +export default ResourceList; + +export async function getStaticProps({ locale }: { locale: string }) { + return { + props: { + ...(await serverSideTranslations(locale, ["common"])), + }, + }; +} diff --git a/src/pages/stateDetails.tsx b/src/pages/stateDetails.tsx index 7c01464b..26dbf323 100644 --- a/src/pages/stateDetails.tsx +++ b/src/pages/stateDetails.tsx @@ -49,7 +49,7 @@ const StateDetails = () => { const channel = store?.boards; setBoards(channel); - + localStorage.removeItem("overallCommonSubjects") setLoading(false); }, 1000); }; @@ -107,38 +107,16 @@ const StateDetails = () => { return ( - {}} - /> - + + {card.state} - - - ({card.boardsUploaded}/{card.totalBoards} - {t("COURSE_PLANNER.BOARDS_FULLY_UPLOADED")}) - - + {boards.map((board: any, index: number) => ( { {board?.name} - - - - - - {card.boardsUploaded} / {card.totalBoards}{" "} - {t("COURSE_PLANNER.SUBJECTS_UPLOADED")} - - + + diff --git a/src/pages/subjectDetails.tsx b/src/pages/subjectDetails.tsx index 90778271..abd73e7b 100644 --- a/src/pages/subjectDetails.tsx +++ b/src/pages/subjectDetails.tsx @@ -80,6 +80,24 @@ const SubjectDetails = () => { const setTaxonomyType = taxonomyStore((state) => state.setTaxonomyType); const setTaxonomySubject = taxonomyStore((state) => state.setTaxonomySubject); + useEffect(() => { + const subjects = localStorage.getItem('overallCommonSubjects'); + + if (subjects) { + try { + const parsedData = JSON.parse(subjects); + setSubject(parsedData); + } catch (error) { + console.error("Failed to parse subjects from localStorage:", error); + } + } else { + console.log("No subjects found in localStorage."); + setSubject([]); + } + }, []); + + + useEffect(() => { const fetchFrameworkDetails = async () => { if (typeof boardDetails === "string") { @@ -343,6 +361,7 @@ const SubjectDetails = () => { const overallCommonSubjects = findOverallCommonSubjects(arrays); setSubject(overallCommonSubjects); + localStorage.setItem("overallCommonSubjects", JSON.stringify(overallCommonSubjects)) } }; @@ -358,11 +377,16 @@ const SubjectDetails = () => { sx={{ "& .MuiSelect-select": { padding: "8px 16px", + textAlign: "left", + }, + "& fieldset": { + border: "none", }, - border: "1px solid black", - borderRadius: "10px", + border: "1px solid #3C3C3C", + borderRadius: "8px", marginRight: "16px", - height: 30, + height: 40, + width: "170px", }} > @@ -384,15 +408,20 @@ const SubjectDetails = () => { sx={{ "& .MuiSelect-select": { padding: "8px 16px", + textAlign: "left", }, - border: "1px solid black", - borderRadius: "10px", + "& fieldset": { + border: "none", + }, + border: "1px solid #3C3C3C", + borderRadius: "8px", marginRight: "16px", - height: 30, + height: 40, + width: "170px", }} > - Select Grade + Select Grade {grade.map((item: any) => ( @@ -401,6 +430,7 @@ const SubjectDetails = () => { ))} + + { - {subject && subject.length > 0 ? ( + {subject && subject.length > 1 ? ( subject.map((subj: any, index: any) => ( { }} sx={{ minWidth: "auto", padding: 0 }} > - diff --git a/src/pages/team-leader.tsx b/src/pages/team-leader.tsx index b7cf2c6e..6277123e 100644 --- a/src/pages/team-leader.tsx +++ b/src/pages/team-leader.tsx @@ -4,12 +4,15 @@ import UserTable from "@/components/UserTable"; import { useTranslation } from "next-i18next"; import { Role, FormContextType } from "@/utils/app.constant"; import CommonUserModal from "@/components/CommonUserModal"; +import useSubmittedButtonStore from "@/utils/useSharedState"; + const TeamLeader: React.FC = () => { const { t } = useTranslation(); const handleAddTeamLeaderClick = () => { handleOpenAddTeamLeaderModal(); }; const [submitValue, setSubmitValue] = React.useState(false); + const setSubmittedButtonStatus = useSubmittedButtonStore((state:any) => state.setSubmittedButtonStatus); const [openAddTeamLeaderModal, setOpenAddTeamLeaderModal] = React.useState(false); @@ -20,6 +23,8 @@ const TeamLeader: React.FC = () => { setSubmitValue(true); }; const handleCloseAddTeamLeaderModal = () => { + setSubmittedButtonStatus(false) + setOpenAddTeamLeaderModal(false); }; diff --git a/src/pages/teamLeader.tsx b/src/pages/teamLeader.tsx deleted file mode 100644 index 6277123e..00000000 --- a/src/pages/teamLeader.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import React from "react"; -import { serverSideTranslations } from "next-i18next/serverSideTranslations"; -import UserTable from "@/components/UserTable"; -import { useTranslation } from "next-i18next"; -import { Role, FormContextType } from "@/utils/app.constant"; -import CommonUserModal from "@/components/CommonUserModal"; -import useSubmittedButtonStore from "@/utils/useSharedState"; - -const TeamLeader: React.FC = () => { - const { t } = useTranslation(); - const handleAddTeamLeaderClick = () => { - handleOpenAddTeamLeaderModal(); - }; - const [submitValue, setSubmitValue] = React.useState(false); - const setSubmittedButtonStatus = useSubmittedButtonStore((state:any) => state.setSubmittedButtonStatus); - - const [openAddTeamLeaderModal, setOpenAddTeamLeaderModal] = - React.useState(false); - const handleOpenAddTeamLeaderModal = () => { - setOpenAddTeamLeaderModal(true); - }; - const handleModalSubmit = (value: boolean) => { - setSubmitValue(true); - }; - const handleCloseAddTeamLeaderModal = () => { - setSubmittedButtonStatus(false) - - setOpenAddTeamLeaderModal(false); - }; - - return ( - <> - - - - - ); -}; - -export async function getStaticProps({ locale }: any) { - return { - props: { - ...(await serverSideTranslations(locale, ["common"])), - }, - }; -} - -export default TeamLeader; diff --git a/src/services/CreateUserService.ts b/src/services/CreateUserService.ts index 84a248ff..2742256c 100644 --- a/src/services/CreateUserService.ts +++ b/src/services/CreateUserService.ts @@ -45,13 +45,14 @@ export const getFormRead = async ( } }; + export const createUser = async (userData: any): Promise => { const apiUrl: string = `${process.env.NEXT_PUBLIC_BASE_URL}/create`; try { const response = await post(apiUrl, userData); return response?.data?.result; } catch (error) { - console.error("error in getting cohort list", error); + console.error('error in getting cohort list', error); // throw error; } }; diff --git a/src/services/UserList.ts b/src/services/UserList.ts index 632e7c2d..0ce35335 100644 --- a/src/services/UserList.ts +++ b/src/services/UserList.ts @@ -1,10 +1,10 @@ import { post, get } from "./RestClient"; export interface userListParam { - limit: number; + limit?: number; // page: number; filters: { - role: string; + role?: string; status?: string; states?: string; districts?: string; @@ -12,7 +12,7 @@ export interface userListParam { }; fields?: any; sort?: object; - offset: number; + offset?: number; } export const userList = async ({ diff --git a/src/services/coursePlanner.ts b/src/services/coursePlanner.ts index e32e9247..8dfc9b6b 100644 --- a/src/services/coursePlanner.ts +++ b/src/services/coursePlanner.ts @@ -30,7 +30,7 @@ export const getFrameworkDetails = async (frameworkId: string): Promise => }; export const uploadCoursePlanner = async (file: File, metaData: CoursePlannerMetaData): Promise => { - const apiUrl: string = `${process.env.NEXT_PUBLIC_TELEMETRY_URL}/user/v1/course-planner/upload`; + const apiUrl: string = `${process.env.NEXT_PUBLIC_BASE_URL}/course-planner/upload`; const formData = new FormData(); formData.append('file', file); formData.append('metaData', JSON.stringify(metaData)); diff --git a/src/services/formatedCohorts.ts b/src/services/formatedCohorts.ts new file mode 100644 index 00000000..ec678d13 --- /dev/null +++ b/src/services/formatedCohorts.ts @@ -0,0 +1,120 @@ + +import { + getCohortList, + } from "@/services/CohortService/cohortService"; +import { + CohortTypes, + + } from "@/utils/app.constant"; +import { getStateBlockDistrictList } from "./MasterDataService"; +interface Cohort { + name: string; + [key: string]: any; +} + +interface BlockValue { + label: string; + [key: string]: any; +} + +interface FormattedBlocksResult { + cohortDetails: Cohort[]; + matchedCohorts: BlockValue[]; +} +export const formatedDistricts = async () => { + const adminState = JSON.parse( + localStorage.getItem("adminInfo") || "{}" + ).customFields.find( + (field: any) => field.label === "STATES" + );; + try { + const reqParams = { + limit: 0, + offset: 0, + filters: { + // name: searchKeyword, + states: adminState.code, + type: CohortTypes.DISTRICT, + status: ["active"] + + }, + sort: ["name", "asc"], + }; + + const response = await getCohortList(reqParams); + + const cohortDetails = response?.results?.cohortDetails || []; + const object = { + controllingfieldfk: adminState.code, + fieldName: "districts", + }; + const optionReadResponse = await getStateBlockDistrictList(object); + //console.log(blockFieldId) + const result = optionReadResponse?.result?.values; + console.log(cohortDetails) + console.log(result) + const matchedCohorts = result?.map((value: any) => { + const cohortMatch = cohortDetails.find((cohort: any )=> cohort.name === value.label); + return cohortMatch ? { ...value } : null; + }).filter(Boolean); + return matchedCohorts; + // console.log(matchedCohorts); + + } catch (error) { + console.log('Error in getting Channel Details', error); + return error; + } +}; + + +export const formatedBlocks = async (districtCode: string) => { + const adminState = JSON.parse( + localStorage.getItem("adminInfo") || "{}" + ).customFields.find( + (field: any) => field.label === "STATES" + ); + try { + const reqParams = { + limit: 0, + offset: 0, + filters: { + // name: searchKeyword, + states: adminState.code, + districts: districtCode, + type: CohortTypes.BLOCK, + status: ["active"], + }, + sort: ["name", "asc"], + }; + + const response = await getCohortList(reqParams); + const cohortDetails = response?.results?.cohortDetails || []; + + const object = { + controllingfieldfk: districtCode, + fieldName: "blocks", + }; + const optionReadResponse = await getStateBlockDistrictList(object); + const result = optionReadResponse?.result?.values; + + console.log(cohortDetails); + console.log(result); + + const matchedCohorts = result + ?.map((value: any) => { + const cohortMatch = cohortDetails.find( + (cohort: any) => cohort.name === value.label + ); + // Include cohortId if the match is found + return cohortMatch ? { ...value, cohortId: cohortMatch.cohortId } : null; + }) + .filter(Boolean); + + + return matchedCohorts; + } catch (error) { + console.log("Error in getting Channel Details", error); + return error; + } +}; + diff --git a/src/store/tanonomyStore.js b/src/store/tanonomyStore.js index 52450ef4..5d114d75 100644 --- a/src/store/tanonomyStore.js +++ b/src/store/tanonomyStore.js @@ -11,6 +11,7 @@ const taxonomyStore = create( taxonomyGrade: "", taxonomyType: "", taxonomySubject: "", + resources:"", setState: (newState) => set((state) => ({ state: newState})), setBoard: (newBoard) => @@ -23,6 +24,8 @@ const taxonomyStore = create( set((state) => ({ taxonomyType: newTaxonomyType})), setTaxonomySubject: (newTaxonomySubject) => set((state) => ({ taxonomySubject: newTaxonomySubject})), + setResources: (newResources) => + set((state) => ({ resources: newResources})), }), { name: "taxonomy", diff --git a/src/utils/Helper.ts b/src/utils/Helper.ts index 19ba12e8..9aeaea82 100644 --- a/src/utils/Helper.ts +++ b/src/utils/Helper.ts @@ -4,6 +4,24 @@ import { Role, FormContextType, FormValues, InputTypes } from "./app.constant"; import { State } from "./Interfaces"; import { useQueryClient } from '@tanstack/react-query'; +interface Value { + value: string; + label: string; + createdAt: string; + updatedAt: string; + createdBy: string | null; + updatedBy: string | null; + cohortId?: string; +} + +interface CohortDetail { + cohortId: string; + name: string; + createdAt: string; + updatedAt: string; + createdBy: string | null; + updatedBy: string | null; +} export const generateUUID = () => { let d = new Date().getTime(); let d2 = @@ -47,7 +65,10 @@ export const getDeviceId = () => { export const generateUsernameAndPassword = ( stateCode: string, - role: string + role: string, + yearOfJoining?: string, + + ) => { const currentYear = new Date().getFullYear().toString().slice(-2); // Last two digits of the current year const randomNum = Math.floor(10000 + Math.random() * 90000).toString(); //NOSONAR @@ -62,9 +83,10 @@ export const generateUsernameAndPassword = ( console.warn(`Unknown role: ${role}`); // Log a warning for unknown roles return null; // Return null or handle as needed } - + const yearSuffix = + yearOfJoining ? yearOfJoining?.slice(-2) : currentYear; const prefix = rolePrefixes[role]; - const username = `${prefix}${stateCode}${currentYear}${randomNum}`; + const username = `${prefix}${stateCode}${yearSuffix}${randomNum}`; return { username, password: randomNum }; }; @@ -89,9 +111,9 @@ export const transformArray = (arr: State[]): State[] => { })); }; -export const firstLetterInUpperCase = (label: string): string | null => { +export const firstLetterInUpperCase = (label: string): string => { if (!label) { - return null; + return ''; } return label @@ -106,8 +128,8 @@ export const capitalizeFirstLetterOfEachWordInArray = ( return arr; } console.log(arr); - return arr.map((str) => - str.replace(/\b[a-z]/g, (char) => char.toUpperCase()) + return arr?.map((str) => + str?.replace(/\b[a-z]/g, (char) => char.toUpperCase()) ); }; export const fieldTextValidation = (text: string) => { @@ -117,9 +139,21 @@ export const fieldTextValidation = (text: string) => { const regex = /^[A-Za-z\s]+$/; return regex.test(text); }; + export const getCurrentYearPattern = () => { const currentYear = new Date().getFullYear(); - return `^(19[0-9][0-9]|20[0-${Math.floor(currentYear / 10) % 10}][0-${currentYear % 10}])$`; + + // Build the dynamic part for the current century + let regexPart = ''; + if (currentYear >= 2000 && currentYear < 2100) { + const lastDigit = currentYear % 10; + const middleDigit = Math.floor((currentYear % 100) / 10); + + regexPart = `20[0-${middleDigit - 1}][0-9]|20${middleDigit}[0-${lastDigit}]`; + } + + // Full regex covering 1900–1999, 2000 to current year + return `^(19[0-9]{2}|${regexPart})$`; }; export const mapFields = (formFields: any, Details: any) => { @@ -249,6 +283,28 @@ export const findCommonAssociations = (data1: any[], data2: any[]) => { }).filter(Boolean); }; +export function mergeCohortDetails(values: Value[], cohortDetails: CohortDetail[]): Value[] { + const filteredValues = values.map(value => ({ + value: value.value, + label: value.label, + createdAt: value.createdAt, + updatedAt: value.updatedAt, + createdBy: value.createdBy, + updatedBy: value.updatedBy, + })); + + const newValues = cohortDetails.map(cohort => ({ + value: cohort.name, + label: cohort.name, + createdAt: cohort.createdAt, + updatedAt: cohort.updatedAt, + createdBy: cohort.createdBy, + updatedBy: cohort.updatedBy, + cohortId: cohort.cohortId, + })); + + return [...filteredValues, ...newValues]; +} interface DataItem { name: string; diff --git a/src/utils/app.constant.ts b/src/utils/app.constant.ts index f7774ced..0c4b96a0 100644 --- a/src/utils/app.constant.ts +++ b/src/utils/app.constant.ts @@ -113,4 +113,9 @@ export const monthColors:any = { "Oct": "#FFD6D6", "Nov": "#FFD6D6", "Dec": "#FFD6D6" -}; \ No newline at end of file +}; + +export enum ResourceType { + PREREQUISITE = "prerequisite", + POSTREQUISITE = "postrequisite", +} \ No newline at end of file diff --git a/src/utils/useLocationState.tsx b/src/utils/useLocationState.tsx index 29afadf7..0fa78df2 100644 --- a/src/utils/useLocationState.tsx +++ b/src/utils/useLocationState.tsx @@ -5,9 +5,20 @@ import { getCenterList, } from "../services/MasterDataService"; // Update the import path as needed import { getCohortList } from "@/services/CohortService/cohortService"; -import { FormContextType, QueryKeys } from "./app.constant"; +import { FormContextType, QueryKeys, Status, Role } from "./app.constant"; import { useTranslation } from "react-i18next"; import { useQueryClient } from "@tanstack/react-query"; +import { formatedBlocks, formatedDistricts } from "@/services/formatedCohorts"; +import { cohortMemberList } from "@/services/UserList"; +type FilterDetails = { + role: any; + status?: any; + districts?: any; + states?: any; + blocks?: any; + name?: any; + cohortId?: any +}; interface FieldProp { value: string; label: string; @@ -19,8 +30,11 @@ interface CenterProp { export const useLocationState = ( open: boolean, onClose: () => void, - userType?: any + userType?: any, + reAssignModal?:boolean ) => { + console.log(reAssignModal) + const [states, setStates] = useState([]); const [districts, setDistricts] = useState([]); const [blocks, setBlocks] = useState([]); @@ -29,13 +43,13 @@ export const useLocationState = ( const isMediumScreen = useMediaQuery("(max-width:986px)"); const [selectedState, setSelectedState] = useState([]); const [selectedStateCode, setSelectedStateCode] = useState(""); - const [selectedDistrict, setSelectedDistrict] = useState([]); + const [selectedDistrict, setSelectedDistrict] = useState( []); const [selectedDistrictCode, setSelectedDistrictCode] = useState(""); const [selectedCenter, setSelectedCenter] = useState([]); const [dynamicForm, setDynamicForm] = useState(false); const [dynamicFormForBlock, setdynamicFormForBlock] = useState(false); - const [selectedBlock, setSelectedBlock] = useState([]); + const [selectedBlock, setSelectedBlock] = useState( []); const [selectedBlockCode, setSelectedBlockCode] = useState(""); const [selectedCenterCode, setSelectedCenterCode] = useState(""); const [selectedBlockCohortId, setSelectedBlockCohortId] = useState(""); @@ -45,6 +59,8 @@ export const useLocationState = ( const [stateDefaultValue, setStateDefaultValue] = useState(""); const { t } = useTranslation(); const queryClient = useQueryClient(); + const [assignedTeamLeader, setAssignedTeamLeader] = useState(""); + const [assignedTeamLeaderNames, setAssignedTeamLeaderNames] = useState([]); const handleStateChangeWrapper = useCallback( async (selectedNames: string[], selectedCodes: string[]) => { @@ -91,8 +107,14 @@ export const useLocationState = ( handleBlockChange([], []); } try { - setBlocks([]); - setAllCenters([]); + console.log(reAssignModal) + + // if(!reAssignModal) + // { + setBlocks([]); + setAllCenters([]); + + setSelectedDistrictCode(selectedCodes[0]); setSelectedBlockCohortId(""); const object = { @@ -103,7 +125,9 @@ export const useLocationState = ( setBlockFieldId(response?.result?.fieldId); //console.log(blockFieldId) const result = response?.result?.values; - setBlocks(result); + const blockResult=await formatedBlocks(selectedCodes[0]) + setBlocks(blockResult); + //setBlocks(result); } catch (error) { console.log(error); } @@ -141,17 +165,54 @@ export const useLocationState = ( }; const response = await getCenterList(object); const getCohortDetails = response?.result?.results?.cohortDetails; + console.log(getCohortDetails) const blockId = getCohortDetails?.map((item: any) => { if (item?.type === "BLOCK") { return item?.cohortId; } - }); - if (blockId) { - console.log("blockId", blockId[0]); - setSelectedBlockCohortId(blockId[0]); + }) + const blockCohortId = getCohortDetails?.find( + (item: any) => item?.type === "BLOCK" + )?.cohortId; + console.log(blockCohortId) + if (blockCohortId) { + console.log("blockId", blockId); + setSelectedBlockCohortId(blockCohortId); } else { console.log("No Block Id found"); } + + + const filters: FilterDetails= + { + cohortId:blockCohortId, + role: Role.TEAM_LEADER, + status:[Status.ACTIVE]} + + let sort= ["name", "asc"] + let resp; + try { + resp = await cohortMemberList({ filters, sort }); + } catch (apiError) { + console.log("API call failed, proceeding to else block"); + resp = null; + } + if(resp?.userDetails) + { + + // onClose(); + // setcreateTLAlertModal(true) + setAssignedTeamLeader(resp?.userDetails?.length) + // setSelectedBlockForTL(selectedBlock[0]) + const userNames = resp?.userDetails?.map((user: any )=> user.name); + //setSelectedTLUserID(userId) + setAssignedTeamLeaderNames(userNames) + } + else{ + setAssignedTeamLeader(""); + setAssignedTeamLeaderNames([]) + } + } else { const getCentersObject = { limit: 0, @@ -167,9 +228,14 @@ export const useLocationState = ( }; const response = await getCenterList(getCentersObject); console.log(response?.result?.results?.cohortDetails[0].cohortId); - setSelectedBlockCohortId( - response?.result?.results?.cohortDetails[0].cohortId - ); + // setSelectedBlockCohortId( + // response?.result?.results?.cohortDetails[0].cohortId + // ); + const blockCohortId = response?.result?.results?.cohortDetails?.find( + (item: any) => item?.type === "BLOCK" + )?.cohortId; + console.log(blockCohortId) + setSelectedBlockCohortId(blockCohortId) // const result = response?.result?.cohortDetails; const dataArray = response?.result?.results?.cohortDetails; @@ -182,7 +248,9 @@ export const useLocationState = ( console.log(dataArray); setAllCenters(cohortInfo); } - console.log(selected); + + + console.log(selected); } catch (error) { setAllCenters([]); @@ -260,10 +328,11 @@ export const useLocationState = ( setdynamicFormForBlock(false); } }, [onClose, open]); - + useEffect(() => { const fetchData = async () => { try { + if(open){ const response = await queryClient.fetchQuery({ queryKey: [ QueryKeys.FIELD_OPTION_READ, @@ -316,33 +385,81 @@ export const useLocationState = ( setStateDefaultValue(stateField.value); localStorage.setItem('userStateName',stateField?.value ) - setSelectedState([stateField.value]); - setSelectedStateCode(stateField.code); - const response = await queryClient.fetchQuery({ - queryKey: [ - QueryKeys.FIELD_OPTION_READ, - stateField.code, - "districts", - ], - queryFn: () => - getStateBlockDistrictList({ - controllingfieldfk: stateField.code, - fieldName: "districts", - }), - }); - const result = response?.result?.values; - console.log(result); - setDistricts(result); - } else { - setStateDefaultValue(t("COMMON.ALL_STATES")); - } - const object2 = [ - { - value: stateField.code, - label: stateField.value, - }, - ]; - setStates(object2); + setSelectedState([stateField.value]); + setSelectedStateCode(stateField.code) + const object = { + controllingfieldfk: stateField.code, + + fieldName: "districts", + }; + console.log(object); + const response = await getStateBlockDistrictList(object); + const result = response?.result?.values; + const districtResult= await formatedDistricts(); + + console.log(districtResult) + setDistricts(districtResult); + if(reAssignModal) + { + const data = getStoredData(); + console.log(data) + setSelectedBlock([data.blocks]); + setSelectedDistrict([data.districtValue] ); + setSelectedDistrictCode(data.districtCode); + setSelectedBlockCode(data.blockCode); + // if(selectedDistrict.length!==0) + { + // setSelectedDistrictCode(selectedCodes[0]); + // setSelectedBlockCohortId(""); + const object = { + controllingfieldfk:data.districtCode, + fieldName: "blocks", + }; + const response = await getStateBlockDistrictList(object); + setBlockFieldId(response?.result?.fieldId); + //console.log(blockFieldId) + const result = response?.result?.values; + const blockResult=await formatedBlocks(data.districtCode) + setBlocks(blockResult); + const getCentersObject = { + limit: 0, + offset: 0, + filters: { + // "type":"COHORT", + status: ["active"], + states: stateField.code, + districts: data.districtCode, + blocks: data.blockCode + // "name": selected[0] + }, + }; + const centerResponse = await getCenterList(getCentersObject); + + // const result = response?.result?.cohortDetails; + const dataArray = centerResponse?.result?.results?.cohortDetails; + + const cohortInfo = dataArray + ?.filter((cohort: any) => cohort.type !== "BLOCK") + .map((item: any) => ({ + cohortId: item?.cohortId, + name: item?.name, + })); + console.log(dataArray); + setAllCenters(cohortInfo); + } + } + + } + else{ + setStateDefaultValue(t("COMMON.ALL_STATES")) + + } + const object2=[{ + value:stateField.code, + label:stateField.value + }] + setStates(object2); + } //console.log(JSON.parse(admin)?.customFields) // setAdminInfo(JSON.parse(admin)) @@ -351,14 +468,26 @@ export const useLocationState = ( //console.log(result) // setStates(result); console.log(typeof states); - } catch (error) { + }} catch (error) { console.log(error); } }; fetchData(); - }, []); - console.log(stateDefaultValue); + }, [open]); + const getStoredData = () => { + const storedData = localStorage.getItem('reassignuserInfo'); + if (storedData) { + try { + return JSON.parse(storedData); + } catch (error) { + console.error('Failed to parse localStorage data:', error); + return {}; // Return default if parsing fails + } + } + return {}; // Return default if no data is found + }; + console.log(stateDefaultValue) return { states, districts, @@ -385,5 +514,12 @@ export const useLocationState = ( selectedCenterCode, selectedBlockCohortId, stateDefaultValue, + setSelectedBlock, + setSelectedDistrict, + setSelectedDistrictCode, + setSelectedBlockCode, + assignedTeamLeaderNames, + assignedTeamLeader + }; }; diff --git a/src/utils/useSharedState.ts b/src/utils/useSharedState.ts index eb68c385..dba16d34 100644 --- a/src/utils/useSharedState.ts +++ b/src/utils/useSharedState.ts @@ -4,6 +4,9 @@ const useSubmittedButtonStore = create((set) => ({ submittedButtonStatus: false, setSubmittedButtonStatus: (status: boolean) => set({ submittedButtonStatus: status }), + reassignButtonStatus: false, + setReassignButtonStatus: (status: boolean) => + set({ reassignButtonStatus: status }), adminInformation: {}, setAdminInformation: (data: any) => set({ adminInformation: data }), // setSubmittedButtonStatus: (status: boolean) => set({ submittedButtonStatus: status }), @@ -13,6 +16,17 @@ const useSubmittedButtonStore = create((set) => ({ setUserEnteredEmail: (status: string) => set({ userEnteredEmail: status }), shouldFetch:true, setShouldFetch:(data: boolean) => set({ shouldFetch: data }), + selectedBlockStore:"", + setSelectedBlockStore: (status: string) => set({ selectedBlockStore: status }), + + selectedDistrictStore:"", + setSelectedDistrictStore: (status: string) => set({ selectedDistrictStore: status }), + + selectedCenterStore:"", + setSelectedCenterStore: (status: string) => set({ selectedCenterStore: status }), + + + }));