diff --git a/apps/front-end/.env.development b/apps/front-end/.env.development new file mode 100644 index 000000000..0498ea8eb --- /dev/null +++ b/apps/front-end/.env.development @@ -0,0 +1,2 @@ +REACT_APP_API_URL=https://eg-dev.uniteframework.io/mw +REACT_APP_BASE_URL=https://eg-dev.uniteframework.io \ No newline at end of file diff --git a/apps/front-end/.env.production b/apps/front-end/.env.production new file mode 100644 index 000000000..0498ea8eb --- /dev/null +++ b/apps/front-end/.env.production @@ -0,0 +1,2 @@ +REACT_APP_API_URL=https://eg-dev.uniteframework.io/mw +REACT_APP_BASE_URL=https://eg-dev.uniteframework.io \ No newline at end of file diff --git a/apps/front-end/public/check.svg b/apps/front-end/public/check.svg new file mode 100644 index 000000000..18195489a --- /dev/null +++ b/apps/front-end/public/check.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/front-end/public/dropout.svg b/apps/front-end/public/dropout.svg new file mode 100644 index 000000000..b3cf8fef6 --- /dev/null +++ b/apps/front-end/public/dropout.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/front-end/public/error.png b/apps/front-end/public/error.png new file mode 100644 index 000000000..a48a235c7 Binary files /dev/null and b/apps/front-end/public/error.png differ diff --git a/apps/front-end/public/locales/en/translation.json b/apps/front-end/public/locales/en/translation.json index 1af252fd3..1b3d069b2 100644 --- a/apps/front-end/public/locales/en/translation.json +++ b/apps/front-end/public/locales/en/translation.json @@ -216,5 +216,41 @@ "ATTENDANCE_CAMERA_SUBTITLE": "Make sure this image has a clear profile view of your Face. Improper Image might result in disqualification of the Application.", "MARK_ABSENT": "Mark Absent", "ENTER_USERNAME_PASSWORD_SENT_ON_MOBILE": "Enter the Username and Password sent on your Mobile Number", - "AADHAAR_NUMBER_ALREADY_EXISTS": "Aadhaar number already exists" + "AADHAAR_NUMBER_ALREADY_EXISTS": "Aadhaar number already exists", + "OWNERSHIP": "Ownership", + "IDENTIFY_THE_AG_LEARNER": "Identify the AG Learner", + "MARITAL_STATUS": "Marital status", + "SOCIAL_CATEGORY": "Social Category", + "TYPE_OF_STUDENT": "Type of Student", + "LAST_YEAR_OF_EDUCATION": "Last Year of Education", + "LAST_STANDARD_OF_EDUCATION": "Last Standard of Education", + "REASON_FOR_LEAVING_EDUCATION": "Reason for Leaving Education", + "AADHAAR_VERIFICATION_SUCCESSFUL": "Aadhaar Verification Successful", + "AG_LEARNER_ALREADY_IDENTIFIED": "AG Learner Already Identified!", + "AG_LEARNER_ALREADY_IDENTIFIED_DES": "You can continue to Add the AG Learner but they might not be assigned to you ", + "FULL_NAME": "Full Name", + "VERIFICATION_ID_NUMBER": "Verification ID number", + "CONTINUE_ADDING": "Continue Adding", + "CANCEL_AND_GO_BACK": "Cancel and Go Back", + "AG_ADDED_SUCCESSFULLY": "AG Added Successfully!", + "ADD_DETAILS": "Add Details", + "DOCUMENTS_CHECKLIST": "Documents Checklist", + "ADD_RSOS_NIOS_NO": "Add RSOS/NIOS No.", + "NOT_AVAILABLE": "Not Available", + "AVAILABLE": "Available", + "COMPLETE": "Complete", + "UPDATE_REQUIRED": "Update Required", + "AADHAAR_CARD": "Aadhaar Card", + "JAN_AADHAAR_CARD": "Jan Aadhaar Card", + "PHOTO": "Photo", + "MARKSHEET": "Marksheet", + "BANK_PASSBOOK": "Bank Passbook", + "BIRTH_CERTIFICATE": "Birth Certificate", + "CASTE_CERTIFICATE": "Cast Certificate", + "TRANSFER_CERTIFICATE": "Transfer certificate", + "AFFIDAVIT": "Affidavit for non schooling Certification, notary", + "CBOSIGN": "Marksheet With CBO Sign", + "CBOSIGNTRANSFER": "Transfer certificate with CBO Sign", + "MARK_AS_DROPOUT": "Mark as Dropout", + "PROFILE_DETAILS": "Profile Details" } diff --git a/apps/front-end/public/locales/hi/translation.json b/apps/front-end/public/locales/hi/translation.json index e50209bf6..0dd2052ac 100644 --- a/apps/front-end/public/locales/hi/translation.json +++ b/apps/front-end/public/locales/hi/translation.json @@ -205,5 +205,41 @@ "CALL_SUPPORT": "मदद के लिए कॉल करें", "LOGOUT": "लॉग आउट", "ENTER_USERNAME_PASSWORD_SENT_ON_MOBILE": "आपके मोबाइल नंबर पर भेजा गया यूजरनेम और पासवर्ड दर्ज करें", - "AADHAAR_NUMBER_ALREADY_EXISTS": "आधार नंबर पहले से मौजूद है" + "AADHAAR_NUMBER_ALREADY_EXISTS": "आधार नंबर पहले से मौजूद है", + "OWNERSHIP": "स्वामित्व", + "IDENTIFY_THE_AG_LEARNER": "एजी लर्नर की पहचान करें", + "MARITAL_STATUS": "वैवाहिक स्थिति", + "SOCIAL_CATEGORY": "सामाजिक श्रेणी", + "TYPE_OF_STUDENT": "छात्र का प्रकार", + "LAST_YEAR_OF_EDUCATION": "शिक्षा का अंतिम वर्ष", + "LAST_STANDARD_OF_EDUCATION": "शिक्षा का अंतिम मानक", + "REASON_FOR_LEAVING_EDUCATION": "शिक्षा छोड़ने का कारण", + "AADHAAR_VERIFICATION_SUCCESSFUL": "आधार सत्यापन सफल रहा", + "AG_LEARNER_ALREADY_IDENTIFIED": "एजी लर्नर की पहले ही पहचान की जा चुकी है!", + "AG_LEARNER_ALREADY_IDENTIFIED_DES": "आप एजी लर्नर को जोड़ना जारी रख सकते हैं, लेकिन वे आपको आवंटित नहीं किए जा सकते हैं", + "FULL_NAME": "पूरा नाम", + "VERIFICATION_ID_NUMBER": "सत्यापन आईडी संख्या", + "CONTINUE_ADDING": "जोड़ना जारी रखें", + "CANCEL_AND_GO_BACK": "रद्द करें और वापस जाएं", + "AG_ADDED_SUCCESSFULLY": "एजी सफलतापूर्वक जोड़ा गया!", + "ADD_DETAILS": "विवरण जोड़ें", + "DOCUMENTS_CHECKLIST": "दस्तावेजों की जांच सूची", + "ADD_RSOS_NIOS_NO.": "आरएसओएस/एनआईओएस संख्या जोड़ें।", + "NOT_AVAILABLE": "उपलब्ध नहीं", + "AVAILABLE": "उपलब्ध ", + "UPDATE_REQUIRED": "अद्यतन आवश्यक है", + "COMPLETE": "पूरा", + "AADHAAR_CARD": "आधार कार्ड ", + "JAN_AADHAAR_CARD": "आधार कार्ड ", + "PHOTO": "तस्वीर", + "MARKSHEET": "अंकपत्र", + "BANK_PASSBOOK": "बैंक पासबुक", + "BIRTH_CERTIFICATE": "जन्म प्रमाण पत्र", + "CASTE_CERTIFICATE ": "जाति प्रमाण पत्र ", + "TRANSFER_CERTIFICATE": "प्रमाणपत्र", + "AFFIDAVIT": "शपत पात्र", + "CBOSIGN": "सीबीओ हस्ताक्षर के साथ मार्कशीट", + "CBOSIGNTRANSFER": "सीबीओ हस्ताक्षर के साथ हस्तांतरण प्रमाण पत्र", + "PROFILE_DETAILS": "प्रोफ़ाइल विवरण", + "MARK_AS_DROPOUT": "मार्क एज ड्रूपॉट" } diff --git a/apps/front-end/src/pages/admin/AdminHome.js b/apps/front-end/src/pages/admin/AdminHome.js index 6faff4666..d558b228b 100644 --- a/apps/front-end/src/pages/admin/AdminHome.js +++ b/apps/front-end/src/pages/admin/AdminHome.js @@ -53,7 +53,7 @@ export default function AdminHome({ footerLinks, userTokenInfo }) { return ( setRefAppBar(e)} _sidebar={footerLinks}> - {/* +

{t("MY_PRERAKS")}

@@ -139,7 +139,7 @@ export default function AdminHome({ footerLinks, userTokenInfo }) { -
*/} +
setPage("Form")} onClickPrerakDuties={() => setPage("Prerak_Duties")} - onPreferedLanguage={()=>setPage("Prerak_Duties")} + onPreferedLanguage={() => setPage("Prerak_Duties")} /> ) : page === "Prerak_Duties" ? ( setPage("Form")} /> diff --git a/apps/front-end/src/pages/front-end/Orientation.js b/apps/front-end/src/pages/front-end/Orientation.js index e0d67fb59..7f35f9c25 100644 --- a/apps/front-end/src/pages/front-end/Orientation.js +++ b/apps/front-end/src/pages/front-end/Orientation.js @@ -60,13 +60,13 @@ export default function Orientation({ footerLinks, onShowScreen }) { }, }, }; - const styles={ - modalxxl:{ - maxWidth:"950px", - width:"100%", - height:"100%" + const styles = { + modalxxl: { + maxWidth: "950px", + width: "100%", + height: "100%", }, - } + }; return ( - + - Prerak Orientation - Prerak Orientation + Prerak Orientation + + Prerak Orientation + @@ -119,7 +121,9 @@ export default function Orientation({ footerLinks, onShowScreen }) { size={"sm"} resizeMode="contain" /> - Prerak Training + + Prerak Training + @@ -132,7 +136,9 @@ export default function Orientation({ footerLinks, onShowScreen }) { size={"sm"} resizeMode="contain" /> - My MT + + My MT + @@ -145,7 +151,9 @@ export default function Orientation({ footerLinks, onShowScreen }) { size={"sm"} resizeMode="contain" /> - Add a Prerak + + Add a Prerak + @@ -154,37 +162,46 @@ export default function Orientation({ footerLinks, onShowScreen }) { - - Interview + + Interview + - Orientation Days + + Orientation Days + - Training Days + + Training Days + - Camp visits + + Camp visits + @@ -194,10 +211,11 @@ export default function Orientation({ footerLinks, onShowScreen }) { plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin]} initialView={"timeGridWeek"} events={[ - { title: 'event 1', date: moment().format("YYYY-MM-DD HH:mm:ss") }, - + { + title: "event 1", + date: moment().format("YYYY-MM-DD HH:mm:ss"), + }, ]} - headerToolbar={{ start: "prev,thisweek,next", center: "timeGridWeek,dayGridMonth,dayGridYear", @@ -205,7 +223,6 @@ export default function Orientation({ footerLinks, onShowScreen }) { height: "50hv", }} /> - @@ -217,10 +234,13 @@ export default function Orientation({ footerLinks, onShowScreen }) { // height={"450px"} overflowY={"scroll"} > - + -

Schedule an Event

+

+ {" "} + Schedule an Event +

{/* @@ -351,26 +371,26 @@ export default function Orientation({ footerLinks, onShowScreen }) { /> - - + - + onPress={() => { + setShowModal(false); + }} + shadow="BlueFillShadow" + > + Send Invites + +
diff --git a/apps/front-end/src/pages/front-end/ag-form/Agduplicate.js b/apps/front-end/src/pages/front-end/ag-form/Agduplicate.js new file mode 100644 index 000000000..90c8fc9cb --- /dev/null +++ b/apps/front-end/src/pages/front-end/ag-form/Agduplicate.js @@ -0,0 +1,248 @@ +import { H1, H3, H4, IconByName, Layout, t } from "@shiksha/common-lib"; +import React, { useState } from "react"; +import { + Image, + Text, + VStack, + HStack, + Button, + Modal, + TextArea, +} from "native-base"; +import { useNavigate } from "react-router-dom"; + +const Agduplicate = () => { + const [lang, setLang] = React.useState(localStorage.getItem("lang")); + const [modalVisible, setModalVisible] = React.useState(false); + const [addmodal, setaddmodal] = React.useState(false); + + const navigate = useNavigate(); + + const [firstname, setfirstname] = useState("Rachana Wagh"); + const [alreadyreg, setalreadyreg] = useState(true); + const [regsuccess, setregsuccess] = useState(false); + + const [DOB, setDOB] = useState("10-11-1995"); + const [gender, setgender] = useState("Female"); + const [verify_id, setverify_id] = useState("xxxx xxxx 8880"); + + const navToScreen = () => { + console.log("reached "); + + if (alreadyreg) { + console.log("reached here"); + setModalVisible(!modalVisible); + } else { + setModalVisible(false); + } + }; + + return ( + {}, + onlyIconsShow: ["backBtn", "userInfo"], + }} + > + {alreadyreg && ( + + + + + + {t("AG_LEARNER_ALREADY_IDENTIFIED")} + + {t("AG_LEARNER_ALREADY_IDENTIFIED_DES")} + + + + + )} + + {regsuccess && ( + + + + {t("AADHAAR_VERIFICATION_SUCCESSFUL")} + + + )} + + + + + + + + +

{t("FULL_NAME")}

+

{firstname}

+
+ +

{t("GENDER")}

+

{gender}

+
+ +

{t("DATE_OF_BIRTH")}

+

{DOB}

+
+ +

{t("VERIFICATION_ID_NUMBER")}

+

{verify_id}

+
+ + + + + + + + + +
+ + + + setModalVisible(false)}> + + + + + + + + {t("AG_LEARNER_ALREADY_IDENTIFIED")} + + + + + + {t("AG_LEARNER_ALREADY_IDENTIFIED_DES")} + + + + + + + + setaddmodal(false)}> + + + + + + + + {t("AG_ADDED_SUCCESSFULLY")} + + + + + + + + + + +
+
+ ); +}; + +export default Agduplicate; diff --git a/apps/front-end/src/pages/front-end/ag-form/Agform.js b/apps/front-end/src/pages/front-end/ag-form/Agform.js new file mode 100644 index 000000000..e1244e4e7 --- /dev/null +++ b/apps/front-end/src/pages/front-end/ag-form/Agform.js @@ -0,0 +1,827 @@ +import React, { useState } from "react"; +import Form from "@rjsf/core"; +import validator from "@rjsf/validator-ajv8"; +import schema1 from "../ag-form/parts/Schema.js"; +import { + Alert, + Box, + Button, + Center, + HStack, + Image, + Modal, + Radio, + Stack, + VStack, +} from "native-base"; +import CustomRadio from "../../../component/CustomRadio"; +import Steper from "../../../component/Steper"; +import { + facilitatorRegistryService, + geolocationRegistryService, + uploadRegistryService, + Camera, + Layout, + H1, + t, + login, + H3, + IconByName, + BodySmall, + filtersByObject, + H2, + getBase64, + BodyMedium, + changeLanguage, + StudentEnumService, +} from "@shiksha/common-lib"; +import moment from "moment"; +import { useNavigate } from "react-router-dom"; +import Clipboard from "component/Clipboard.js"; +import { + TitleFieldTemplate, + DescriptionFieldTemplate, + FieldTemplate, + ObjectFieldTemplate, + ArrayFieldTitleTemplate, +} from "../../../component/BaseInput"; +import { useScreenshot } from "use-screenshot-hook"; + +const CustomR = ({ options, value, onChange, required }) => { + return ( + onChange(value)} + /> + ); +}; + +const RadioBtn = ({ options, value, onChange, required }) => { + const items = options?.enumOptions; + return ( + onChange(value)} + > + + {items.map((item) => ( + + {item?.label} + + ))} + + + ); +}; + +// App +export default function Agform({ userTokenInfo }) { + const { authUser } = userTokenInfo; + const [page, setPage] = React.useState(); + const [pages, setPages] = React.useState(); + const [schema, setSchema] = React.useState({}); + const [cameraModal, setCameraModal] = React.useState(false); + const [credentials, setCredentials] = React.useState(); + const [cameraUrl, setCameraUrl] = React.useState(); + const [submitBtn, setSubmitBtn] = React.useState(); + const [addBtn, setAddBtn] = React.useState(t("YES")); + const formRef = React.useRef(); + const uplodInputRef = React.useRef(); + const [formData, setFormData] = React.useState({}); + const [errors, setErrors] = React.useState({}); + const [alert, setAlert] = React.useState(); + const [yearsRange, setYearsRange] = React.useState([1980, 2030]); + const [lang, setLang] = React.useState(localStorage.getItem("lang")); + const navigate = useNavigate(); + + const onPressBackButton = async () => { + const data = await nextPreviewStep("p"); + }; + const ref = React.createRef(null); + + const updateData = (data, deleteData = false) => {}; + + const uiSchema = { + type_mobile: { + "ui:widget": CustomR, + }, + marital_status: { + "ui:widget": CustomR, + }, + social_category: { + "ui:widget": CustomR, + }, + ownership: { + "ui:widget": RadioBtn, + }, + }; + + const nextPreviewStep = async (pageStape = "n") => { + setAlert(); + const index = pages.indexOf(page); + const properties = schema1.properties; + if (index !== undefined) { + let nextIndex = ""; + if (pageStape.toLowerCase() === "n") { + nextIndex = pages[index + 1]; + } else { + nextIndex = pages[index - 1]; + } + if (nextIndex !== undefined) { + setPage(nextIndex); + setSchema(properties[nextIndex]); + } else if (pageStape.toLowerCase() === "n") { + await formSubmitUpdate({ ...formData, form_step_number: "13" }); + setPage("upload"); + } else { + return true; + } + } + }; + + const getLocation = () => { + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition(showPosition); + } else { + console.log("Geolocation is not supported by this browser."); + } + }; + + const showPosition = (position) => { + console.log( + "Latitude: " + + position.coords.latitude + + "/n Longitude: " + + position.coords.longitude + ); + }; + + console.log("nextIndex", page); + + if (page == "3") { + console.log("FormData"); + getLocation(); + } else { + } + + const setStep = async (pageNumber = "") => { + if (schema1.type === "step") { + const properties = schema1.properties; + if (pageNumber !== "") { + if (page !== pageNumber) { + setPage(pageNumber); + setSchema(properties[pageNumber]); + } + } else { + nextPreviewStep(); + } + } + }; + + const getOptions = (schema, { key, arr, title, value, filters } = {}) => { + let enumObj = {}; + let arrData = arr; + if (!_.isEmpty(filters)) { + arrData = filtersByObject(arr, filters); + } + enumObj = { + ...enumObj, + ["enumNames"]: arrData.map((e) => `${e?.[title]}`), + }; + enumObj = { ...enumObj, ["enum"]: arrData.map((e) => `${e?.[value]}`) }; + const newProperties = schema["properties"][key]; + let properties = {}; + if (newProperties) { + if (newProperties.enum) delete newProperties.enum; + let { enumNames, ...remainData } = newProperties; + properties = remainData; + } + return { + ...schema, + ["properties"]: { + ...schema["properties"], + [key]: { + ...properties, + ...(_.isEmpty(arr) ? {} : enumObj), + }, + }, + }; + }; + + React.useEffect(async () => { + if (schema?.properties?.state) { + const qData = await geolocationRegistryService.getStates(); + let newSchema = schema; + if (schema["properties"]["state"]) { + newSchema = getOptions(newSchema, { + key: "state", + arr: qData, + title: "state_name", + value: "state_name", + }); + } + newSchema = await setDistric({ + schemaData: newSchema, + state: formData?.state, + district: formData?.district, + block: formData?.block, + }); + setSchema(newSchema); + } + }, [page]); + + // Type Of Student + + React.useEffect(async () => { + const studentTypeData = await StudentEnumService.getTypeStudent(); + const studentLastData = await StudentEnumService.lastYear(); + const lastStandard = await StudentEnumService.lastStandard(); + const ReasonOfLeaving = await StudentEnumService.ReasonOfLeaving(); + let newSchema = schema; + if (schema["properties"]["type_of_student"]) { + newSchema = getOptions(newSchema, { + key: "type_of_student", + arr: studentTypeData, + title: "title", + value: "value", + }); + + newSchema = getOptions(newSchema, { + key: "last_year_of_education", + arr: studentLastData, + title: "title", + value: "value", + }); + } + + setSchema(newSchema); + }, [page]); + + React.useEffect(() => {}, []); + + React.useEffect(() => { + if (schema1.type === "step") { + const properties = schema1.properties; + const newSteps = Object.keys(properties); + setPage(newSteps[0]); + setSchema(properties[newSteps[0]]); + setPages(newSteps); + let minYear = moment().subtract("years", 50); + let maxYear = moment().subtract("years", 18); + setYearsRange([minYear.year(), maxYear.year()]); + setSubmitBtn(t("NEXT")); + } + }, []); + + const userExist = async (filters) => { + return await facilitatorRegistryService.isExist(filters); + }; + + const formSubmitUpdate = async (formData) => { + const { id } = authUser; + + if (id) { + updateData({}, true); + } + }; + + const formSubmitCreate = async (formData) => {}; + + const goErrorPage = (key) => { + if (key) { + pages.forEach((e) => { + const data = schema1["properties"][e]["properties"][key]; + if (data) { + setStep(e); + } + }); + } + }; + + const customValidate = (data, errors, c) => { + if (data?.mobile) { + if (data?.mobile?.toString()?.length !== 10) { + errors.mobile.addError(t("MINIMUM_LENGTH_IS_10")); + } + if (!(data?.mobile > 6666666666 && data?.mobile < 9999999999)) { + errors.mobile.addError(t("PLEASE_ENTER_VALID_NUMBER")); + } + } + if (data?.aadhar_token) { + if ( + data?.aadhar_token && + !`${data?.aadhar_token}`?.match(/^[2-9]{1}[0-9]{3}[0-9]{4}[0-9]{4}$/) + ) { + errors?.aadhar_token?.addError( + `${t("AADHAAR_SHOULD_BE_12_DIGIT_VALID_NUMBER")}` + ); + } + } + if (data?.dob) { + const years = moment().diff(data?.dob, "years"); + if (years < 18) { + errors?.dob?.addError(t("MINIMUM_AGE_18_YEAR_OLD")); + } + } + ["grampanchayat", "first_name", "last_name"].forEach((key) => { + if ( + key === "first_name" && + data?.first_name?.replaceAll(" ", "") === "" + ) { + errors?.[key]?.addError( + `${t("REQUIRED_MESSAGE")} ${t(schema?.properties?.[key]?.title)}` + ); + } + + if (data?.[key] && !data?.[key]?.match(/^[a-zA-Z ]*$/g)) { + errors?.[key]?.addError( + `${t("REQUIRED_MESSAGE")} ${t(schema?.properties?.[key]?.title)}` + ); + } + }); + ["vo_experience", "experience"].forEach((keyex) => { + data?.[keyex]?.map((item, index) => { + ["role_title", "organization", "description"].forEach((key) => { + if (item?.[key] && !item?.[key]?.match(/^[a-zA-Z ]*$/g)) { + errors[keyex][index]?.[key]?.addError( + `${t("REQUIRED_MESSAGE")} ${t(schema?.properties?.[key]?.title)}` + ); + } + }); + }); + }); + + return errors; + }; + + const transformErrors = (errors, uiSchema) => { + return errors.map((error) => { + if (error.name === "required") { + if (schema?.properties?.[error?.property]?.title) { + error.message = `${t("REQUIRED_MESSAGE")} "${t( + schema?.properties?.[error?.property]?.title + )}"`; + } else { + error.message = `${t("REQUIRED_MESSAGE")}`; + } + } else if (error.name === "enum") { + error.message = `${t("SELECT_MESSAGE")}`; + } + return error; + }); + }; + + const setDistric = async ({ state, district, block, schemaData }) => { + let newSchema = schemaData; + if (schema?.properties?.district && state) { + const qData = await geolocationRegistryService.getDistricts({ + name: state, + }); + if (schema["properties"]["district"]) { + newSchema = getOptions(newSchema, { + key: "district", + arr: qData, + title: "district_name", + value: "district_name", + }); + } + if (schema["properties"]["block"]) { + newSchema = await setBlock({ district, block, schemaData: newSchema }); + setSchema(newSchema); + } + } else { + newSchema = getOptions(newSchema, { key: "district", arr: [] }); + if (schema["properties"]["block"]) { + newSchema = getOptions(newSchema, { key: "block", arr: [] }); + } + if (schema["properties"]["village"]) { + newSchema = getOptions(newSchema, { key: "village", arr: [] }); + } + setSchema(newSchema); + } + formData; + return newSchema; + }; + + const setBlock = async ({ district, block, schemaData }) => { + let newSchema = schemaData; + if (schema?.properties?.block && district) { + const qData = await geolocationRegistryService.getBlocks({ + name: district, + }); + if (schema["properties"]["block"]) { + newSchema = getOptions(newSchema, { + key: "block", + arr: qData, + title: "block_name", + value: "block_name", + }); + } + if (schema["properties"]["village"]) { + newSchema = await setVilage({ block, schemaData: newSchema }); + setSchema(newSchema); + } + } else { + newSchema = getOptions(newSchema, { key: "block", arr: [] }); + if (schema["properties"]["village"]) { + newSchema = getOptions(newSchema, { key: "village", arr: [] }); + } + setSchema(newSchema); + } + return newSchema; + }; + + const setVilage = async ({ block, schemaData }) => { + let newSchema = schemaData; + if (schema?.properties?.village && block) { + const qData = await geolocationRegistryService.getVillages({ + name: block, + }); + if (schema["properties"]["village"]) { + newSchema = getOptions(newSchema, { + key: "village", + arr: qData, + title: "village_ward_name", + value: "village_ward_name", + }); + } + setSchema(newSchema); + } else { + newSchema = getOptions(newSchema, { key: "village", arr: [] }); + setSchema(newSchema); + } + return newSchema; + }; + + const onChange = async (e, id) => { + const data = e.formData; + setErrors(); + const newData = { ...formData, ...data }; + setFormData(newData); + updateData(newData); + if (id === "root_mobile") { + if (data?.mobile?.toString()?.length === 10) { + const result = await userExist({ mobile: data?.mobile }); + if (result.isUserExist) { + const newErrors = { + mobile: { + __errors: [t("MOBILE_NUMBER_ALREADY_EXISTS")], + }, + }; + setErrors(newErrors); + } + } + } + + if (id === "root_state") { + await setDistric({ + schemaData: schema, + state: data?.state, + district: data?.district, + block: data?.block, + }); + } + + if (id === "root_district") { + await setBlock({ + district: data?.district, + block: data?.block, + schemaData: schema, + }); + } + + if (id === "root_block") { + await setVilage({ block: data?.block, schemaData: schema }); + } + }; + + const onError = (data) => { + if (data[0]) { + const key = data[0]?.property?.slice(1); + goErrorPage(key); + } + }; + + const onSubmit = async (data) => { + if (addBtn !== t("YES")) setAddBtn(t("YES")); + let newFormData = data.formData; + if (schema?.properties?.first_name) { + newFormData = { + ...newFormData, + ["first_name"]: newFormData?.first_name.replaceAll(" ", ""), + }; + } + + if (schema?.properties?.last_name && newFormData?.last_name) { + newFormData = { + ...newFormData, + ["last_name"]: newFormData?.last_name.replaceAll(" ", ""), + }; + } + + const newData = { + ...formData, + ...newFormData, + ["form_step_number"]: parseInt(page) + 1, + }; + setFormData(newData); + updateData(newData); + if (_.isEmpty(errors)) { + const { id } = authUser; + let success = false; + if (id) { + // const data = await formSubmitUpdate(newData); + // if (!_.isEmpty(data)) { + success = true; + // } + } else if (page === "2") { + const data = await formSubmitCreate(newFormData); + if (data?.error) { + const newErrors = { + mobile: { + __errors: data?.error + ? data?.error + : [t("MOBILE_NUMBER_ALREADY_EXISTS")], + }, + }; + setErrors(newErrors); + } else { + if (data?.username && data?.password) { + setCredentials(data); + } + } + } else if (page <= 1) { + success = true; + } + if (success) { + setStep(); + } + } else { + const key = Object.keys(errors); + if (key[0]) { + goErrorPage(key[0]); + } + } + }; + + const [cameraFile, setcameraFile] = useState(); + + const handleFileInputChange = async (e) => { + let file = e.target.files[0]; + if (file.size <= 1048576 * 2) { + const data = await getBase64(file); + setCameraUrl(data); + setcameraFile(file); + setFormData({ ...formData, ["profile_url"]: data }); + } else { + setErrors({ fileSize: t("FILE_SIZE") }); + } + }; + + const uploadProfile = async () => { + const { id } = authUser; + if (id) { + const form_data = new FormData(); + const item = { + file: cameraFile, + document_type: "profile", + user_id: 1, + }; + for (let key in item) { + form_data.append(key, item[key]); + } + return await uploadRegistryService.uploadFile(form_data); + } + }; + + if (cameraUrl) { + return ( + { + setCameraUrl(); + setCameraModal(false); + }, + onlyIconsShow: ["backBtn", "userInfo"], + }} + _page={{ _scollView: { bg: "white" } }} + > + +

{t("IDENTIFY_THE_AG_LEARNER")}

+
+ +
+ + +
+
+ ); + } + if (cameraModal) { + return ( + { + setCameraUrl(url); + setFormData({ ...formData, ["profile_url"]: url }); + }, + }} + /> + ); + } + + if (page === "upload") { + return ( + setPage("5"), + lang, + setLang, + onlyIconsShow: ["backBtn", "userInfo"], + }} + _page={{ _scollView: { bg: "white" } }} + > + +

{t("IDENTIFY_THE_AG_LEARNER")}

+

DO's

+
+
+
+
+

Don’ts

+
+
+
+
+ + + + + {errors?.fileSize ? ( +

{errors?.fileSize}

+ ) : ( + + )} +
+
+
+ ); + } + + return ( + + + {alert ? ( + + + + {alert} + + + ) : ( + + )} + {page && page !== "" ? ( +
+ +
+ ) : ( + + )} +
+
+ ); +} diff --git a/apps/front-end/src/pages/front-end/ag-form/Docschecklist.js b/apps/front-end/src/pages/front-end/ag-form/Docschecklist.js new file mode 100644 index 000000000..b848b1348 --- /dev/null +++ b/apps/front-end/src/pages/front-end/ag-form/Docschecklist.js @@ -0,0 +1,393 @@ +import { H1, H3, H4, Layout, t } from "@shiksha/common-lib"; +import React, { useState } from "react"; +import { + Image, + Text, + VStack, + HStack, + Button, + Modal, + TextArea, + Select, + CheckIcon, +} from "native-base"; +import { useNavigate } from "react-router-dom"; + +const Docschecklist = () => { + const [lang, setLang] = React.useState(localStorage.getItem("lang")); + const [service, setService] = React.useState(""); + const [selectData, setselectData] = useState([ + t("NOT_AVAILABLE"), + t("AVAILABLE"), + t("COMPLETE"), + t("UPDATE_REQUIRED"), + ]); + + const navigate = useNavigate(); + + return ( + { + navigate("/agduplicate"); + }, + onlyIconsShow: ["backBtn", "userInfo"], + }} + > + + + {t("JAN_AADHAAR_CARD")} + + + + + {t("AADHAAR_CARD")} + + + + + {t("PHOTO")} + + + + + {t("MOBILE_NUMBER")} + + + + + {t("MARKSHEET")} + + + + + {t("BANK_PASSBOOK")} + + + + + {t("BIRTH_CERTIFICATE")} + + + + + {t("CASTE_CERTIFICATE")} + + + + + {t("TRANSFER_CERTIFICATE")} + + + + + {t("AFFIDAVIT")} + + + + + {t("CBOSIGN")} + + + + + {t("CBOSIGNTRANSFER")} + + + + + ); +}; + +export default Docschecklist; diff --git a/apps/front-end/src/pages/front-end/ag-form/LearnerProfile.js b/apps/front-end/src/pages/front-end/ag-form/LearnerProfile.js new file mode 100644 index 000000000..bddf9226e --- /dev/null +++ b/apps/front-end/src/pages/front-end/ag-form/LearnerProfile.js @@ -0,0 +1,189 @@ +import { Collapsible, H1, H3, H4, Layout, t } from "@shiksha/common-lib"; +import React, { useState } from "react"; +import { + Image, + Text, + VStack, + HStack, + Button, + Modal, + TextArea, +} from "native-base"; +import { useNavigate } from "react-router-dom"; + +const LearnerProfile = () => { + const [lang, setLang] = React.useState(localStorage.getItem("lang")); + const [modalVisible, setModalVisible] = React.useState(false); + const [addmodal, setaddmodal] = React.useState(false); + + const navigate = useNavigate(); + + const [firstname, setfirstname] = useState("Rachana Wagh"); + const [alreadyreg, setalreadyreg] = useState(true); + const [regsuccess, setregsuccess] = useState(false); + + const [DOB, setDOB] = useState("10-11-1995"); + const [gender, setgender] = useState("Female"); + const [verify_id, setverify_id] = useState("xxxx xxxx 8880"); + + const navToScreen = () => { + console.log("reached "); + + if (alreadyreg) { + console.log("reached here"); + setModalVisible(!modalVisible); + } else { + setModalVisible(false); + } + }; + + return ( + {}, + onlyIconsShow: ["backBtn", "userInfo"], + }} + > + {alreadyreg && ( + + + + + {t("AG_LEARNER_ALREADY_IDENTIFIED")} + + {t("AG_LEARNER_ALREADY_IDENTIFIED_DES")} + + + + + )} + + {regsuccess && ( + + + + {t("AADHAAR_VERIFICATION_SUCCESSFUL")} + + + )} + + + + + + + + + Added On 12th May 2023 + + + + + + + Basic + + + Educational + + + Aadhaar + + + + + + + + Basic + + + Educational + + + Aadhaar + + + + + + + + Basic + + + Educational + + + Aadhaar + + + + + + + + Basic + + + Educational + + + Aadhaar + + + + + + + + ); +}; + +export default LearnerProfile; diff --git a/apps/front-end/src/pages/front-end/ag-form/parts/Schema.js b/apps/front-end/src/pages/front-end/ag-form/parts/Schema.js new file mode 100644 index 000000000..386cdd1bc --- /dev/null +++ b/apps/front-end/src/pages/front-end/ag-form/parts/Schema.js @@ -0,0 +1,127 @@ +export default { + description: "1.Basic details", + type: "step", + properties: { + 1: { + title: "IDENTIFY_THE_AG_LEARNER", + type: "object", + required: ["first_name"], + properties: { + first_name: { + type: "string", + title: "FIRST_NAME", + }, + }, + }, + 2: { + title: "Contact Information", + description: "PLEASE_WHATSAPP_NUMBER", + type: "object", + required: ["mobile"], + properties: { + mobile: { + type: "number", + title: "MOBILE_NUMBER", + }, + ownership: { + type: "string", + title: "OWNERSHIP", + enumNames: ["Self", "Family Member", "Neighbour", "Other", "any"], + enum: ["self", "familymember", "neighbour", "other", "any"], + }, + type_mobile: { + type: "string", + title: "TYPE_OF_MOBILE_PHONE", + enumNames: ["Android", "IPhone"], + enum: ["android", "iphone"], + }, + }, + }, + + 3: { + title: "Complete Address", + type: "object", + // required: ["state", "district", "block", "village"], + properties: { + state: { + title: "STATE", + type: "string", + format: "select", + }, + district: { + title: "DISTRICT", + type: "string", + format: "select", + }, + block: { + title: "BLOCK", + type: "string", + format: "select", + }, + village: { + title: "VILLAGE_WARD", + type: "string", + format: "select", + }, + grampanchayat: { + title: "GRAMPANCHAYAT", + type: "string", + }, + }, + }, + + 4: { + title: "Personal Details", + type: "object", + //required: ["marital_status", "social_category"], + properties: { + marital_status: { + title: "MARITAL_STATUS", + type: "string", + enumNames: [ + "Married", + "Unmarried", + "Single (Divorced, widow, separated, etc.)", + ], + enum: ["married", "unmarried", "single"], + }, + social_category: { + title: "SOCIAL_CATEGORY", + type: "string", + enumNames: ["General", "S.C.", "S.T.", "O.B.C.", "Other"], + enum: ["general", "sc", "st", "obc", "other"], + }, + }, + }, + + 5: { + title: "Education Details", + type: "object", + required: [], + properties: { + type_of_student: { + title: "TYPE_OF_STUDENT", + type: "string", + format: "select", + // enumNames: ["General", "S.C.","S.T.","O.B.C.","Other"], + // enum: ["general", "sc","st","obc","other"], + }, + last_year_of_education: { + title: "LAST_YEAR_OF_EDUCATION", + type: "string", + format: "select", + }, + last_standard_of_education: { + title: "LAST_STANDARD_OF_EDUCATION", + type: "string", + format: "select", + }, + reason_for_leaving_education: { + title: "REASON_FOR_LEAVING_EDUCATION", + type: "string", + format: "select", + }, + }, + }, + }, +}; diff --git a/apps/front-end/src/pages/front-end/orientation/orientationScreen.js b/apps/front-end/src/pages/front-end/orientation/orientationScreen.js index 10abf80a7..511078309 100644 --- a/apps/front-end/src/pages/front-end/orientation/orientationScreen.js +++ b/apps/front-end/src/pages/front-end/orientation/orientationScreen.js @@ -27,29 +27,29 @@ import { Radio, Checkbox, Switch, - Badge + Badge, } from "native-base"; import React from "react"; let switchAttendance = false; const stylesheet = { - modalxxl:{ - maxWidth:"950px", - width:"100%", - height:"100%" + modalxxl: { + maxWidth: "950px", + width: "100%", + height: "100%", }, }; const customStyles = { headCells: { style: { background: "#E0E0E0", - fontSize:"14px", - color:"#616161" + fontSize: "14px", + color: "#616161", }, }, cells: { style: { - padding:"15px 0" + padding: "15px 0", }, }, }; @@ -75,7 +75,9 @@ const columns = (e) => [ _icon={{ size: "35" }} /> )} - {row?.first_name + " " + row.last_name} + + {row?.first_name + " " + row.last_name} +
), sortable: false, @@ -148,9 +150,9 @@ const scheduleCandidates = (e) => [ name: t("INVITE_STATUS"), selector: (row) => Accepted, sortable: false, - attr: "email", - }, - { + attr: "email", + }, + { name: t("MARK_ATTENDANCE"), selector: (row) => ( <> @@ -231,9 +233,7 @@ export default function orientationScreen() { const Page1 = ({ onShowScreen }) => { return ( - + ); }; @@ -266,55 +266,63 @@ const Page2 = ({ onClick }) => { }; return ( - - - - - -

{t("SELECT_CANDIDATE")}

-
-
- - setLimit(e)} - // onChangePage={(e) => setPage(e)} - /> - + + + + + +

+ {" "} + {t("SELECT_CANDIDATE")} +

+
+
+ + setLimit(e)} + // onChangePage={(e) => setPage(e)} + /> + - - + + - - -
-
+ + +
+
); }; @@ -384,8 +392,15 @@ const Page3 = () => {

{t("PRERAK_ORIENTATION")}

- @@ -398,32 +413,46 @@ const Page3 = () => { > - {t("ORIENTATION_SHEDULE")} - + + {t("ORIENTATION_SHEDULE")} + + - + - 16th April, 11:00 to 12:00 + + 16th April, 11:00 to 12:00 + - Jaipur, 412213 + + Jaipur, 412213 + - Master Trainer - + + Master Trainer - + { borderRadius={"10px"} p={"3px"} > - Prakash Wagh + Prakash Wagh @@ -445,7 +474,9 @@ const Page3 = () => { color="gray" _icon={{ size: "35" }} /> - Candidates (25) + + Candidates (25) + @@ -479,7 +513,10 @@ const Page3 = () => { -

{t("EDIT_DETAILS")}

+

+ {" "} + {t("EDIT_DETAILS")} +

@@ -507,7 +544,9 @@ const Page3 = () => { _icon={{ size: "35" }} /> )} -

{rowData?.first_name + " " + rowData?.last_name}

+

+ {rowData?.first_name + " " + rowData?.last_name} +

@@ -561,7 +600,9 @@ const Page3 = () => { _icon={{ size: "25" }} /> -

{t("MARK_ATTENDANCE")}

+

+ {t("MARK_ATTENDANCE")} +

{ setAttendance(nextValue); }} > - - Present + + + {" "} + Present + - - Absent + + + {" "} + Absent + @@ -591,7 +649,9 @@ const Page3 = () => { color="gray.400" _icon={{ size: "25" }} /> -

{t("COMPLETE_AADHAR_KYC")}

+

+ {t("COMPLETE_AADHAR_KYC")} +

{ setAadharKYC(nextValue); }} > - - QR code scan + + + QR code scan + - - Aadhaar Offline KYC + + + {" "} + Aadhaar Offline KYC + - - Manual Aadhaar Upload + + + {" "} + Manual Aadhaar Upload + @@ -625,7 +710,9 @@ const Page3 = () => { color="gray.400" _icon={{ size: "25" }} /> -

{t("DOCUMENT_VERIFICATION")}

+

+ {t("DOCUMENT_VERIFICATION")} +

{ space={3} alignItems="flex-start" > - - Qualification Certificate + + + {" "} + Qualification Certificate + + + + + Volunteer Proof + - - Volunteer Proof + + + Work Proof + - Work Proof
@@ -653,10 +757,20 @@ const Page3 = () => { mt={"20px"} justifyContent={"end"} > - - +
@@ -668,7 +782,11 @@ const Page3 = () => { safeAreaTop={true} size={"full"} > - + { bg="white" textAlign={"left"} > -

{t("MARK_ATTENDANCE_ORIENTATION")}

+

+ {" "} + {t("MARK_ATTENDANCE_ORIENTATION")} +

- Present 0 - Absent 0 + + Present + {" "} + 0 + + Absent + {" "} + 0 + + + Candidates - 1/25 - Candidates - 1/25 - {t("ATTENDANCE_CAMERA_SUBTITLE")} + + {t("ATTENDANCE_CAMERA_SUBTITLE")} + {/* {cameraModal && ( */} { /> {/* )} */} - - - + + +
diff --git a/apps/front-end/src/routes/admin.js b/apps/front-end/src/routes/admin.js index 0e933c307..c8049cf25 100644 --- a/apps/front-end/src/routes/admin.js +++ b/apps/front-end/src/routes/admin.js @@ -10,7 +10,7 @@ export default [ { path: "/admin/view/:id", component: FacilitatorView }, { path: "/admin/facilitator-onbording", component: FacilitatorForm }, { path: "/admin/profile", component: Profile }, - { path: "/orientation", component: orientationScreen }, + { path: "/orientation", component: orientationScreen }, { path: "/admin", component: AdminHome }, { path: "/", component: AdminHome }, { path: "*", component: NotFound }, diff --git a/apps/front-end/src/routes/routes.js b/apps/front-end/src/routes/routes.js index e06d444fa..7b8e2e049 100644 --- a/apps/front-end/src/routes/routes.js +++ b/apps/front-end/src/routes/routes.js @@ -1,5 +1,9 @@ import Dashboard from "pages/front-end/Dashboard"; import Home from "pages/front-end/Home"; +import Agduplicate from "pages/front-end/ag-form/Agduplicate"; +import Agform from "pages/front-end/ag-form/Agform"; +import Docschecklist from "pages/front-end/ag-form/Docschecklist"; +import LearnerProfile from "pages/front-end/ag-form/LearnerProfile"; export default [ { path: "/form", component: Home }, @@ -8,5 +12,10 @@ export default [ component: Home, }, { path: "/dashboard", component: Dashboard }, + { path: "/agform", component: Agform }, + { path: "/agduplicate", component: Agduplicate }, + { path: "/learnerProfile", component: LearnerProfile }, + { path: "/docschecklist", component: Docschecklist }, + { path: "/*", component: Dashboard }, ]; diff --git a/lib/common-lib/src/components/IconByName.js b/lib/common-lib/src/components/IconByName.js index be1523902..2b0dadea0 100644 --- a/lib/common-lib/src/components/IconByName.js +++ b/lib/common-lib/src/components/IconByName.js @@ -104,6 +104,7 @@ import LoginCircleLineIcon from 'remixicon-react/LoginCircleLineIcon' import VidiconLineIcon from 'remixicon-react/VidiconLineIcon' import UserAddLineIcon from 'remixicon-react/UserAddLineIcon' import CalendarLineIcon from 'remixicon-react/CalendarLineIcon' +import ErrorWarningLineIcon from 'remixicon-react/ErrorWarningLineIcon' function IconButton({ icon, isDisabled, prefix, ...props }) { if (!isDisabled) { @@ -943,6 +944,14 @@ export default function IconByName({ _icon, ...props }) { /> ) break + case 'ErrorWarningLineIcon': + icon = ( + } + /> + ) + break default: if (props.name !== 'Home4LineIcon') { diff --git a/lib/common-lib/src/components/admin_layout/AppBar.js b/lib/common-lib/src/components/admin_layout/AppBar.js index 977594fb3..5b421630e 100644 --- a/lib/common-lib/src/components/admin_layout/AppBar.js +++ b/lib/common-lib/src/components/admin_layout/AppBar.js @@ -50,13 +50,13 @@ export default function AppBar({ alignItems='center' minH='32px' > - logo {/* - {headerName} + {headerName ? headerName : 'Add an AG'} ) : ( diff --git a/lib/common-lib/src/components/layout/HeaderTags/BoxBlue.js b/lib/common-lib/src/components/layout/HeaderTags/BoxBlue.js index be2706ee3..158fecbde 100644 --- a/lib/common-lib/src/components/layout/HeaderTags/BoxBlue.js +++ b/lib/common-lib/src/components/layout/HeaderTags/BoxBlue.js @@ -3,7 +3,13 @@ import { Box } from 'native-base' const BoxBlue = ({ children, ...props }) => { return ( - + {children} ) diff --git a/lib/common-lib/src/components/theme.ts b/lib/common-lib/src/components/theme.ts index d06b4066f..1809a80a2 100644 --- a/lib/common-lib/src/components/theme.ts +++ b/lib/common-lib/src/components/theme.ts @@ -138,7 +138,7 @@ const DEFAULT_THEME = { bg: `#ffffff`, borderWidth: '1', borderColor: `#084B82`, - _text:`#084B82`, + _text: `#084B82`, _hover: { bg: `#cce2f3` }, @@ -153,11 +153,11 @@ const DEFAULT_THEME = { borderColor: `#14242D`, _hover: { bg: `#133142`, - _text: `#14242D`, + _text: `#14242D` }, _pressed: { bg: `#133142`, - _text: `#14242D`, + _text: `#14242D` }, rounded: '30px' }), @@ -399,17 +399,17 @@ const DEFAULT_THEME = { 100: '#616161', 300: '#888888', 400: '#F5F5F5', - 500:'#424242', - 550:'##757575', - 800:'#212121', - 900:'#1E1E1E' + 500: '#424242', + 550: '##757575', + 800: '#212121', + 900: '#1E1E1E' }, textMaroonColor: { 400: '#790000' }, - blueText:{ - 400:'#084B82', - 450:'#3F8BF1' + blueText: { + 400: '#084B82', + 450: '#3F8BF1' } } } diff --git a/lib/common-lib/src/index.tsx b/lib/common-lib/src/index.tsx index cdcdbe484..80fabe70f 100644 --- a/lib/common-lib/src/index.tsx +++ b/lib/common-lib/src/index.tsx @@ -15,6 +15,8 @@ import Tab from './components/Tab' import Loading from './components/Loading' import FilterButton from './components/FilterButton' import * as facilitatorRegistryService from './services/facilitatorRegistryService' +import * as uploadRegistryService from './services/uploadRegistryService' +import * as StudentEnumService from './services/StudentEnumService' import * as authRegistryService from './services/authRegistryService' import * as geolocationRegistryService from './services/geolocationRegistryService' import { t, changeLanguage } from 'i18next' @@ -41,6 +43,8 @@ export { facilitatorRegistryService, authRegistryService, geolocationRegistryService, + uploadRegistryService, + StudentEnumService, t, changeLanguage, Camera diff --git a/lib/common-lib/src/services/StudentEnumService.js b/lib/common-lib/src/services/StudentEnumService.js new file mode 100644 index 000000000..94e059729 --- /dev/null +++ b/lib/common-lib/src/services/StudentEnumService.js @@ -0,0 +1,86 @@ +import { get, post, update as coreUpdate } from './RestClient' +import mapInterfaceData from './mapInterfaceData' + +export const getTypeStudent = async (filters = {}, header = {}) => { + let headers = { + Authorization: 'Bearer ' + localStorage.getItem('token'), + ...header + } + return [ + { + title: '1', + value: '1' + }, + { + title: '2', + value: '2' + }, + { + title: '3', + value: '3' + } + ] +} + +export const lastYear = async (filters = {}, header = {}) => { + let headers = { + Authorization: 'Bearer ' + localStorage.getItem('token'), + ...header + } + return [ + { + title: '1995', + value: '1995' + }, + { + title: '1996', + value: '1996' + }, + { + title: '1997', + value: '1997' + } + ] +} + +export const lastStandard = async (filters = {}, header = {}) => { + let headers = { + Authorization: 'Bearer ' + localStorage.getItem('token'), + ...header + } + return [ + { + title: 'First', + value: 'First' + }, + { + title: 'Second', + value: 'Second' + }, + { + title: 'Third', + value: 'Third' + } + ] +} + +export const ReasonOfLeaving = async (filters = {}, header = {}) => { + let headers = { + Authorization: 'Bearer ' + localStorage.getItem('token'), + ...header + } + return [ + { + title: 'Family Reason', + value: 'First' + }, + { + title: 'Second', + value: 'Second' + }, + { + title: 'Third', + value: 'Third' + } + ] +} diff --git a/lib/common-lib/src/services/geolocationRegistryService.js b/lib/common-lib/src/services/geolocationRegistryService.js index be6fd85dc..85a8d6cea 100644 --- a/lib/common-lib/src/services/geolocationRegistryService.js +++ b/lib/common-lib/src/services/geolocationRegistryService.js @@ -20,6 +20,26 @@ export const getStates = async (params = {}, header = {}) => { } } +export const getType = async (params = {}, header = {}) => { + let headers = { + ...header + } + const result = await post( + `${process.env.REACT_APP_API_URL}/locationmaster/states`, + params, + { + params, + headers + } + ) + + if (result?.data) { + return result?.data?.data + } else { + return {} + } +} + export const getDistricts = async ({ name, ...params } = {}, header = {}) => { let headers = { ...header diff --git a/lib/common-lib/src/services/uploadRegistryService.js b/lib/common-lib/src/services/uploadRegistryService.js new file mode 100644 index 000000000..82cfb9fd5 --- /dev/null +++ b/lib/common-lib/src/services/uploadRegistryService.js @@ -0,0 +1,51 @@ +import { get, post, update as coreUpdate } from './RestClient' + +export const getOne = async ({ id, ...params } = {}, header = {}) => { + try { + let headers = { + ...header, + Authorization: 'Bearer ' + localStorage.getItem('token') + } + const result = await get( + `${process.env.REACT_APP_API_URL}/uploadFile/${id}/get-file`, + { + headers + } + ) + + if (result?.data?.data) { + return result?.data?.data + } else { + return {} + } + } catch ({ response, message }) { + return { + status: response?.status ? response?.status : 404, + error: response?.data?.message ? response?.data?.message : message + } + } +} + +export const uploadFile = async (params = {}, header = {}) => { + let headers = { + 'Content-Type': 'multipart/form-data', + ...header + } + + const result = await post( + `${process.env.REACT_APP_API_URL}/uploadFile/${params?.get( + 'user_id' + )}/upload-file`, + params, + { + params, + headers + } + ) + + if (result?.data?.data) { + return result?.data?.data + } else { + return {} + } +} diff --git a/yarn.lock b/yarn.lock index 2ff2541ab..ac371416c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1645,6 +1645,47 @@ dependencies: tslib "^2.1.0" +"@fullcalendar/core@~6.1.7": + version "6.1.7" + resolved "https://registry.yarnpkg.com/@fullcalendar/core/-/core-6.1.7.tgz#83d8b109fbf0deb1d4c3262ca4b2d70e77a287c4" + integrity sha512-Hc63ARSyABlNo10B3NkA0z8ndaDmq5MKpcBB2iQsGQyn8N8cyn/x6V284Je1EwDoKsBlbrZAj+j+efBO+QQf5g== + dependencies: + preact "~10.12.1" + +"@fullcalendar/daygrid@^6.1.7", "@fullcalendar/daygrid@~6.1.7": + version "6.1.7" + resolved "https://registry.yarnpkg.com/@fullcalendar/daygrid/-/daygrid-6.1.7.tgz#529d5f1989081c5ab9d129fcaf409111b31be976" + integrity sha512-IB+QdRcs+TeTlsK8qJFtYZ/2GugmXEFC0C00/n1aLT7GLgFn3ueV1GN0EKvXv9HJ5ai8My65mYbSyQizY/Ishw== + +"@fullcalendar/interaction@^6.1.7", "@fullcalendar/interaction@~6.1.7": + version "6.1.7" + resolved "https://registry.yarnpkg.com/@fullcalendar/interaction/-/interaction-6.1.7.tgz#f2d86312371b284b46caae8c74b303e1fc7bdd4c" + integrity sha512-C2KHSinc9cFUTcGYxRSIj7cBYNSroce+1d2Wa+HKVHguVv4kQuEvm/oPxJpTLXqFjNLfxyxVac7Zd4U0znjFtg== + +"@fullcalendar/list@~6.1.7": + version "6.1.7" + resolved "https://registry.yarnpkg.com/@fullcalendar/list/-/list-6.1.7.tgz#27d1b11984c9e4fc66da9a71b2429d38c427be94" + integrity sha512-Fl6jGKylhrk+g/RCISsv66vzpzjCFhd4r3nUDeHTAAE375OYGlVPKpH67YaKxpMrofj82JLIzS3JEzyQBZo0Cg== + +"@fullcalendar/multimonth@~6.1.7": + version "6.1.7" + resolved "https://registry.yarnpkg.com/@fullcalendar/multimonth/-/multimonth-6.1.7.tgz#bec09460746abd96b147306c4b5a342c56dbf049" + integrity sha512-x4Z8XjmjlXNElZsVYr+AdNYiGPrYdmG3nxDYjxIDPl1CvH/pAmZinaRlOmVP4wq7ES9RP/9xOlAhe2/RKpsh3w== + dependencies: + "@fullcalendar/daygrid" "~6.1.7" + +"@fullcalendar/react@^6.1.7": + version "6.1.7" + resolved "https://registry.yarnpkg.com/@fullcalendar/react/-/react-6.1.7.tgz#acdfaa84b0b12a9a70b26a6e8d494c14de0d3b44" + integrity sha512-Pwe88D4zXwP/XQsYWOa1foroF/OpHSLet5CiE4crnaKvngEtzt3SBDIO01agQOpo+yE1KM/n3yE5ePbdJtVJIQ== + +"@fullcalendar/timegrid@^6.1.7", "@fullcalendar/timegrid@~6.1.7": + version "6.1.7" + resolved "https://registry.yarnpkg.com/@fullcalendar/timegrid/-/timegrid-6.1.7.tgz#1c2dac33a7870928359f17a5e142d26f08022f79" + integrity sha512-kVgJVswu96LrCozr+GyYzF+LUZjURC4HyDg11tCfrj2wMTsrYKqUxilTGXuD3daD4T7qp3CLCg5GdD6lbYHI7A== + dependencies: + "@fullcalendar/daygrid" "~6.1.7" + "@gar/promisify@^1.0.1": version "1.1.3" resolved "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz" @@ -5291,6 +5332,13 @@ dependencies: "@types/lodash" "*" +"@types/lodash.memoize@^4.1.7": + version "4.1.7" + resolved "https://registry.yarnpkg.com/@types/lodash.memoize/-/lodash.memoize-4.1.7.tgz#aff94ab32813c557cbc1104e127030e3d60a3b27" + integrity sha512-lGN7WeO4vO6sICVpf041Q7BX/9k1Y24Zo3FY0aUezr1QlKznpjzsDk3T3wvH8ofYzoK0QupN9TWcFAFZlyPwQQ== + dependencies: + "@types/lodash" "*" + "@types/lodash@*": version "4.14.179" resolved "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.179.tgz" @@ -5980,6 +6028,11 @@ "@webassemblyjs/wast-parser" "1.9.0" "@xtuc/long" "4.2.2" +"@wojtekmaj/date-utils@^1.1.3": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@wojtekmaj/date-utils/-/date-utils-1.1.3.tgz#7be7fb33a2b987d886ff868877ee8c7908176e85" + integrity sha512-rHrDuTl1cx5LYo8F4K4HVauVjwzx4LwrKfEk4br4fj4nK8JjJZ8IG6a6pBHkYmPLBQHCOEDwstb0WNXMGsmdOw== + "@xtuc/ieee754@^1.2.0": version "1.2.0" resolved "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz" @@ -7361,6 +7414,11 @@ caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001297, can resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001314.tgz" integrity sha512-0zaSO+TnCHtHJIbpLroX7nsD+vYuOVjl3uzFbJO1wMVbuveJA0RK2WcQA9ZUIOiO0/ArMiMgHJLxfEZhQiC0kw== +caniuse-lite@^1.0.30001482: + version "1.0.30001487" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001487.tgz#d882d1a34d89c11aea53b8cdc791931bdab5fe1b" + integrity sha512-83564Z3yWGqXsh2vaH/mhXfEM0wX+NlBCm1jYHOb97TrTWJEmPTccZgeLTPBUUb0PNVo+oomb7wkimZBIERClA== + capture-exit@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz" @@ -7614,6 +7672,11 @@ clsx@^1.1.1: resolved "https://registry.npmjs.org/clsx/-/clsx-1.1.1.tgz" integrity sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA== +clsx@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12" + integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg== + cmd-shim@^4.1.0: version "4.1.0" resolved "https://registry.npmjs.org/cmd-shim/-/cmd-shim-4.1.0.tgz" @@ -10152,6 +10215,11 @@ file-loader@^6.2.0: loader-utils "^2.0.0" schema-utils "^3.0.0" +file-saver@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/file-saver/-/file-saver-2.0.5.tgz#d61cfe2ce059f414d899e9dd6d4107ee25670c38" + integrity sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA== + file-system-cache@^1.0.5: version "1.0.5" resolved "https://registry.npmjs.org/file-system-cache/-/file-system-cache-1.0.5.tgz" @@ -10527,6 +10595,18 @@ fsevents@^2.1.2, fsevents@^2.3.2, fsevents@~2.3.2: resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== +fullcalendar@^6.1.7: + version "6.1.7" + resolved "https://registry.yarnpkg.com/fullcalendar/-/fullcalendar-6.1.7.tgz#f1ab71bd128a584359b4c823ac93646d01c6dd17" + integrity sha512-e4KF/wf0gOilgDRAhOOJZrAzzPqDDAGF0SogyM0rTrZvn4HgC3ZL9CfBttc4juMMnmKQGNcGt649+ZnG+zxUTA== + dependencies: + "@fullcalendar/core" "~6.1.7" + "@fullcalendar/daygrid" "~6.1.7" + "@fullcalendar/interaction" "~6.1.7" + "@fullcalendar/list" "~6.1.7" + "@fullcalendar/multimonth" "~6.1.7" + "@fullcalendar/timegrid" "~6.1.7" + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" @@ -10662,6 +10742,14 @@ get-symbol-description@^1.0.0: call-bind "^1.0.2" get-intrinsic "^1.1.1" +get-user-locale@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/get-user-locale/-/get-user-locale-2.2.1.tgz#e7e9f365a202458a360d74c8a3516766d38402ae" + integrity sha512-3814zipTZ2MvczOcppEXB3jXu+0HWwj5WmPI6//SeCnUIUaRXu7W4S54eQZTEPadlMZefE+jAlPOn+zY3tD4Qw== + dependencies: + "@types/lodash.memoize" "^4.1.7" + lodash.memoize "^4.1.1" + get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz" @@ -11266,6 +11354,11 @@ html-tags@^3.1.0: resolved "https://registry.npmjs.org/html-tags/-/html-tags-3.1.0.tgz" integrity sha512-1qYz89hW3lFDEazhjW0yVAV87lw8lVkrJocr72XmBkMKsoSVJCQx3W8BXsC7hO2qAt8BoVjYjtAcZ9perqGnNg== +html-to-image@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/html-to-image/-/html-to-image-0.1.3.tgz#9661a54c30ed9c4b269f4612416b1c7e887de3a7" + integrity sha512-8JTGEAAdJGL/nlp3wb/WI8fLMx2dHKOFZMdsvdon23D45ZdtsXDeRm39Wddf04ludQe3OPmvjMJ9nPjI/7hPlg== + html-void-elements@^1.0.0: version "1.0.5" resolved "https://registry.npmjs.org/html-void-elements/-/html-void-elements-1.0.5.tgz" @@ -13260,10 +13353,10 @@ lodash.isnil@^4.0.0: resolved "https://registry.npmjs.org/lodash.isnil/-/lodash.isnil-4.0.0.tgz" integrity sha1-SeKM1VkBNFjIFMVHnTxmOiG/qmw= -lodash.memoize@^4.1.2: +lodash.memoize@^4.1.1, lodash.memoize@^4.1.2: version "4.1.2" - resolved "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz" - integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= + resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" + integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== lodash.merge@^4.6.2: version "4.6.2" @@ -16094,6 +16187,11 @@ posthog-js@^1.20.4: fflate "^0.4.1" rrweb-snapshot "^1.1.14" +preact@~10.12.1: + version "10.12.1" + resolved "https://registry.yarnpkg.com/preact/-/preact-10.12.1.tgz#8f9cb5442f560e532729b7d23d42fd1161354a21" + integrity sha512-l8386ixSsBdbreOAkqtrwqHwdvR35ID8c3rKPa8lCWuO86dBi32QWHV4vfsZK1utLLFMvw+Z5Ad4XLkZzchscg== + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" @@ -16509,6 +16607,17 @@ react-app-polyfill@^3.0.0: regenerator-runtime "^0.13.9" whatwg-fetch "^3.6.2" +react-calendar@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/react-calendar/-/react-calendar-4.2.1.tgz#3706bfd5ff727f877c8a60c36bc352b4f8fdee55" + integrity sha512-T5oKXD+KLy/g6bmJJkZ7E9wj0iRMesWMZcrC7q2kI6ybOsu9NlPQx8uXJzG4A4C3Sh5Xi0deznyzWIVsUpF8tA== + dependencies: + "@types/react" "*" + "@wojtekmaj/date-utils" "^1.1.3" + clsx "^1.2.1" + get-user-locale "^2.2.1" + prop-types "^15.6.0" + react-colorful@^5.1.2: version "5.5.1" resolved "https://registry.npmjs.org/react-colorful/-/react-colorful-5.5.1.tgz" @@ -19489,6 +19598,13 @@ use-latest@^1.0.0: dependencies: use-isomorphic-layout-effect "^1.0.0" +use-screenshot-hook@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/use-screenshot-hook/-/use-screenshot-hook-1.0.2.tgz#dd8cadb4f21162b47f02f4394d97ba3b853f8017" + integrity sha512-H4/OCjh+lF3t3++lHChfldQ+muTVGvUUJMdfIQab//oSbi2mzIZa+mO1I5IOAgSYnzwib3JBWO597PBZAlckSg== + dependencies: + html-to-image "^0.1.1" + use@^3.1.0: version "3.1.1" resolved "https://registry.npmjs.org/use/-/use-3.1.1.tgz"