Skip to content

Commit

Permalink
Merge pull request #1008 from gitmedha/feature/mentorhsip
Browse files Browse the repository at this point in the history
Added src file
  • Loading branch information
rohit-sharma-medha authored Nov 12, 2024
2 parents 4e1483d + 8655e45 commit b4cc5e2
Show file tree
Hide file tree
Showing 19 changed files with 297 additions and 55 deletions.
49 changes: 49 additions & 0 deletions src/validations/OperationsValidation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import * as Yup from "yup";

const pincodeRegExp = /^[1-9]{1}[0-9]{2}\s{0,1}[0-9]{3}$/;
const status = Yup.string().required("Status is required.");
const assigned_to = Yup.string().required("Assignee is required.");
const type = Yup.string().required("Type is required.");
const employer = Yup.string().required("Employer is required.");
const role_or_designation = Yup.string().required("Role/Designation is required.");
const number_of_opportunities = Yup.string().required("No. of opportunities is required.");
const department_or_team = Yup.string().required("Department/Team is required.");
const salary = Yup.string().required("Salary is required.");
const compensation_type = Yup.string().required("Paid/Unpaid is required.");
const skills_required = Yup.string().required("Skills required is required.");
const role_description = Yup.string().required("Description is required.");
const state = Yup.string().required("State is required.");
const medha_area = Yup.string().required("Medha area is required.");
const address = Yup.string().required("Address is required.");
const pin_code = Yup.string("Should be a number.")
.matches(pincodeRegExp, 'Pincode is not valid')
.max(6, "Pincode is too long")
.required("Pincode is required.");
const city = Yup.string().required("City is required.");
const district= Yup.string().required("District is required.");
const email = Yup.string().required("Email is required.");

const phoneRegExp =
/^((\\+[1-9]{1,4}[ \\-]*)|(\\([0-9]{2,3}\\)[ \\-]*)|([0-9]{2,4})[ \\-]*)*?[0-9]{3,4}?[ \\-]*[0-9]{3,4}?$/;



export const mentorshipValidations = Yup.object({
email: Yup.string().email('Invalid email format').required('Email is required'),
contact: Yup.string()
.matches(phoneRegExp, "Phone number is not valid")
.min(10, "Number is too short")
.max(10, "Number is too long")
.nullable(),
mentor_name: Yup.string().required('Mentor name is required'),
mentor_area: Yup.string().required('Mentor area is required'),
mentor_domain: Yup.string().required('Mentor domain is required'),
mentor_company_name: Yup.string().required('Mentor company name is required'),
assigned_to: Yup.string().required('Assigned to is required'),
program_name: Yup.string().required('Program name is required'),
onboarding_date: Yup.date().required('Onboarding date is required'),
mentor_state: Yup.string().required('Mentor state is required'),
medha_area: Yup.string().required('Medha area is required'),
status: Yup.string().oneOf(['Connected', 'Pipeline', 'Dropped out'], 'Invalid status').required('Status is required'),
outreach: Yup.string().nullable().oneOf(['Online', 'Offline'], 'Invalid status').required('Outreach is required')
});
56 changes: 56 additions & 0 deletions src/views/Address/addressActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,59 @@ export const getStateDistricts = async (value) => {
return Promise.reject(error);
});
};
export const getCities = async (value) => {
const limit = 500; // Number of records per request
let allData = [];
let start = 0;
let totalCount = 0;

try {
const stateFilter = value?.value ? `state: "${value?.value}",` : ``;

const GET_ALL_CITIES = `
query GET_GEOGRAPHIES($start: Int, $limit: Int) {
geographies(where: { ${stateFilter} city_null: false }, start: $start, limit: $limit) {
city
state
}
geographiesConnection {
aggregate {
count
}
}
}
`;

const countResponse = await api.post('/graphql', {
query: GET_ALL_CITIES,
variables: {
start: 0,
limit: 1,
},
});

totalCount = countResponse?.data?.data?.geographiesConnection?.aggregate?.count;

// Fetch data in batches until all records are retrieved
while (start < totalCount) {
const response = await api.post('/graphql', {
query: GET_ALL_CITIES,
variables: {
start,
limit,
},
});

const data = response?.data?.data?.geographies;

if (data && data.length) {
allData = [...allData, ...data];
}

start += limit;
}
return allData;
} catch (error) {
return Promise.reject(error);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
mobileNochecker,
} from "../../../utils/function/OpsModulechecker";
import * as Yup from "yup";
// import { compareObjects, createLatestAcivity } from "src/utils/LatestChange/Api";

const Section = styled.div`
padding-top: 30px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ const CollepitchesEdit = (props) => {
initialValues["remarks"] = props.remarks;
initialValues["area"] = props.area;
initialValues["program_name"] = props.program_name;
initialValues["whatsapp"] = props.whatsapp;
}

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,22 +327,15 @@ const MentorBulkAdd = (props) => {
for (let row of rows) {
for (let key in row) {


/**
|--------------------------------------------------
| !(key == "designation") &&
!(key == "mentor_area") &&
!(key == "mentor_state") &&
!(key == "outreach") &&
!(key == "onboarding_date") &&
!(key == "medha_area") &&
!(key == "program_name")
|--------------------------------------------------
*/
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if((key =="contact" && row[key].length < 10 )){
isEmptyValuFound=true
}
if((key =="email" && (!emailRegex.test(row[key]) ))){
isEmptyValuFound=true
}
if (
!(key == "social_media_profile_link") && (key =="contact" && row[key].length < 10)


!(key == "social_media_profile_link")
) {
if (isEmptyValue(row[key])) {
isEmptyValuFound = true;
Expand Down Expand Up @@ -427,7 +420,7 @@ const MentorBulkAdd = (props) => {
{/* <h2 className="section-header">Basic Info</h2> */}
<div className="d-flex ">
<h2 className="text--primary bebas-thick mb-0">
{props.id ? props.full_name : "Add New Alumni Query"}
{props.id ? props.full_name : " Add Mentorship Data"}
</h2>
</div>
</div>
Expand Down Expand Up @@ -470,7 +463,7 @@ const MentorBulkAdd = (props) => {
<tr>
<th>Mentor Name *</th>
<th>Contact *</th>
<th>Email </th>
<th>Email *</th>
<th>Mentor's Domain *</th>
<th>Mentor's Company Name * </th>
<th>Designation/Title *</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const MentorBulkrow = (props) => {
getStateDistricts(value).then((data) => {
setAreaOptions([]);
setAreaOptions(
data?.data?.data?.geographiesConnection.groupBy.area
data?.data?.data?.geographiesConnection.groupBy.city
.map((area) => ({
key: area.id,
label: area.key,
Expand Down Expand Up @@ -127,7 +127,7 @@ const MentorBulkrow = (props) => {
);
setAreaOptions([]);
setAreaOptions(
data?.data?.data?.geographiesConnection.groupBy.area
data?.data?.data?.geographiesConnection.groupBy.city
.map((area) => ({
key: area.id,
label: area.key,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const MentorshipSearchbar = ({ searchOperationTab, resetSearch }) => {


const handleSubmit = async (values) => {
let baseUrl = "mentorship";
let baseUrl = "mentorships";
await searchOperationTab(
baseUrl,
values.search_by_field,
Expand Down Expand Up @@ -336,7 +336,14 @@ const MentorshipSearchbar = ({ searchOperationTab, resetSearch }) => {
)}
</div>

<div className="col-lg-3 col-md-4 col-sm-12 mt-3 d-flex justify-content-around align-items-center">
<div className="col-lg-3 col-md-4 col-sm-12 mt-3 d-flex justify-content-around align-items-center search_buttons_container">
<button
className="btn btn-primary action_button_sec search_bar_action_sec"
type="submit"
disabled={disabled ? true : false}
>
FIND
</button>
<button
className="btn btn-secondary action_button_sec search_bar_action_sec"
type="button"
Expand All @@ -345,13 +352,7 @@ const MentorshipSearchbar = ({ searchOperationTab, resetSearch }) => {
>
CLEAR
</button>
<button
className="btn btn-primary action_button_sec search_bar_action_sec"
type="submit"
disabled={disabled ? true : false}
>
FIND
</button>

</div>
</div>
</Section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { Link } from "react-router-dom";
import { Anchor } from "../../../../components/content/Utils";
import UpdateMentorship from "./UpdateMentorship";
import DetailField from "src/components/content/DetailField";
// import { createLatestAcivity } from "src/utils/LatestChange/Api";

const Styled = styled.div`
.icon-box {
Expand Down Expand Up @@ -53,6 +54,7 @@ const MentorshipdataField = (props) => {
dataAndEdit: false,
delete: false,
});
const userId = localStorage.getItem("user_id");
const [operationdata] = useState(props);
const hideShowModal1 = async (data) => {
if (!data || data.isTrusted) {
Expand All @@ -77,6 +79,8 @@ const MentorshipdataField = (props) => {
};

const deleteEntry = async () => {
// let datavaluesforlatestcreate={module_name:"Operation",activity:"Mentorship DELETE",event_id:"",updatedby:userId ,changes_in:{...props}};
// await createLatestAcivity(datavaluesforlatestcreate);
const data = await deactivate_mentorship(Number(props.id));
if (data.status === 200) {
setAlert("Entry Deleted Successfully.", "success");
Expand All @@ -97,7 +101,6 @@ const MentorshipdataField = (props) => {
dataAndEdit: false,
});
};
console.log(props);

return (
<>
Expand Down
Loading

0 comments on commit b4cc5e2

Please sign in to comment.