diff --git a/src/app/(routes)/recruiter/jobs/[jobID]/page.tsx b/src/app/(routes)/recruiter/jobs/[jobID]/page.tsx index 1628fef..d887f8d 100644 --- a/src/app/(routes)/recruiter/jobs/[jobID]/page.tsx +++ b/src/app/(routes)/recruiter/jobs/[jobID]/page.tsx @@ -17,6 +17,7 @@ import { GenderSelectList, } from "@/components/Recruiters/jobEdit"; import Loader from "@/components/Loader/loader"; +import Salaries from "@/components/Recruiters/Salaries"; const JobDetailPage = ({ params }: { params: { jobID: string } }) => { const [job, setData] = useState(null); @@ -61,6 +62,18 @@ const JobDetailPage = ({ params }: { params: { jobID: string } }) => { const handleOpenJD = async (filename: string) => { OpenJD(filename); }; + const handleChange2 = (e: React.ChangeEvent, index: number, field: string) => { + console.log("Event:", e); + console.log("Index:", index); + console.log("Field:", field); + + setFormData(prevFormData => ({ + ...prevFormData, + salaries: prevFormData.salaries.map((salary, i) => + i === index ? { ...salary, [field]: e.target.value } : salary + ), + })); + }; const handleSubmit = async () => { const c1 = await patchJobData(job.id, formData); @@ -546,190 +559,14 @@ const JobDetailPage = ({ params }: { params: { jobID: string } }) => { ))} -
-
Salaries
- {job.salaries.map((salary, salaryIndex) => ( -
-
-
-
Base Salary
{" "} - {editMode ? ( - { - const updatedSalaries = formData.salaries.map( - (s, i) => - i === salaryIndex - ? { ...s, baseSalary: e.target.value } - : s, - ); - setFormData((prev) => ({ - ...prev, - salaries: updatedSalaries, - })); - }} - /> - ) : ( -
{salary.baseSalary}
- )} -
-
-
CTC
{" "} - {editMode ? ( - { - const updatedSalaries = formData.salaries.map( - (s, i) => - i === salaryIndex - ? { ...s, totalCTC: e.target.value } - : s, - ); - setFormData((prev) => ({ - ...prev, - salaries: updatedSalaries, - })); - }} - /> - ) : ( -
{salary.totalCTC}
- )} -
-
-
Take Home Salary
{" "} - {editMode ? ( - { - const updatedSalaries = formData.salaries.map( - (s, i) => - i === salaryIndex - ? { ...s, takeHomeSalary: e.target.value } - : s, - ); - setFormData((prev) => ({ - ...prev, - salaries: updatedSalaries, - })); - }} - /> - ) : ( -
{salary.takeHomeSalary}
- )} -
-
-
Gross Salary
{" "} - {editMode ? ( - { - const updatedSalaries = formData.salaries.map( - (s, i) => - i === salaryIndex - ? { ...s, grossSalary: e.target.value } - : s, - ); - setFormData((prev) => ({ - ...prev, - salaries: updatedSalaries, - })); - }} - /> - ) : ( -
{salary.grossSalary}
- )} -
-
-
- Other Compensations -
{" "} - {editMode ? ( - { - const updatedSalaries = formData.salaries.map( - (s, i) => - i === salaryIndex - ? { ...s, otherCompensations: e.target.value } - : s, - ); - setFormData((prev) => ({ - ...prev, - salaries: updatedSalaries, - })); - }} - /> - ) : ( -
{salary.otherCompensations}
- )} -
-
- {/* Genders */} -
-

Genders

- {editMode ? ( - - ) : ( -
- {salary.genders?.map((gender, genderIndex) => ( -
- {editMode ? null : ( -
- {gender} -
- )} -
- ))} -
- )} -
- - {/* Categories */} -
-

Categories

- {editMode ? ( - - ) : ( -
- {salary.categories?.map((category, categoryIndex) => ( -
- {editMode ? null : ( -
- {category} -
- )} -
- ))} -
- )} -
- - -
- ))} -
+ )} diff --git a/src/components/Recruiters/Salaries.tsx b/src/components/Recruiters/Salaries.tsx new file mode 100644 index 0000000..82cfeef --- /dev/null +++ b/src/components/Recruiters/Salaries.tsx @@ -0,0 +1,445 @@ +import React from "react"; +import { Button } from "@/components/ui/button"; +import { Separator } from "@/components/ui/separator"; +import Loader from "@/components/Loader/loader"; + +const Salaries = ({ + salaries, + seasonType, + editMode, + handleChange, + + formData, + loading, +}) => ( +
+
Salaries
+ {salaries.map((salary, index) => ( +
+ {seasonType === 'PLACEMENT' ? ( +
+
+
Base Salary
+ {editMode ? ( + handleChange(e, index, "baseSalary")} + /> + ) : ( +
{salary.baseSalary}
+ )} +
+ +
+
Total CTC
+ {editMode ? ( + handleChange(e, index, "totalCTC")} + /> + ) : ( +
{salary.totalCTC}
+ )} +
+ +
+
Take Home Salary
+ {editMode ? ( + handleChange(e, index, "takeHomeSalary")} + /> + ) : ( +
{salary.takeHomeSalary}
+ )} +
+ +
+
Gross Salary
+ {editMode ? ( + handleChange(e, index, "grossSalary")} + /> + ) : ( +
{salary.grossSalary}
+ )} +
+ +
+
Joining Bonus
+ {editMode ? ( + handleChange(e, index, "joiningBonus")} + /> + ) : ( +
{salary.joiningBonus}
+ )} +
+ +
+
Performance Bonus
+ {editMode ? ( + handleChange(e, index, "performanceBonus")} + /> + ) : ( +
{salary.performanceBonus}
+ )} +
+ +
+
Relocation
+ {editMode ? ( + handleChange(e, index, "relocation")} + /> + ) : ( +
{salary.relocation}
+ )} +
+ +
+
Bond Amount
+ {editMode ? ( + handleChange(e, index, "bondAmount")} + /> + ) : ( +
{salary.bondAmount}
+ )} +
+ +
+
ESOP Amount
+ {editMode ? ( + handleChange(e, index, "esopAmount")} + /> + ) : ( +
{salary.esopAmount}
+ )} +
+ +
+
ESOP Vest Period
+ {editMode ? ( + handleChange(e, index, "esopVestPeriod")} + /> + ) : ( +
{salary.esopVestPeriod}
+ )} +
+ +
+
First Year CTC
+ {editMode ? ( + handleChange(e, index, "firstYearCTC")} + /> + ) : ( +
{salary.firstYearCTC}
+ )} +
+ +
+
Retention Bonus
+ {editMode ? ( + handleChange(e, index, "retentionBonus")} + /> + ) : ( +
{salary.retentionBonus}
+ )} +
+ +
+
Deductions
+ {editMode ? ( + handleChange(e, index, "deductions")} + /> + ) : ( +
{salary.deductions}
+ )} +
+ +
+
Medical Allowance
+ {editMode ? ( + handleChange(e, index, "medicalAllowance")} + /> + ) : ( +
{salary.medicalAllowance}
+ )} +
+ +
+
Bond Duration
+ {editMode ? ( + handleChange(e, index, "bondDuration")} + /> + ) : ( +
{salary.bondDuration}
+ )} +
+ +
+
Foreign Currency CTC
+ {editMode ? ( + handleChange(e, index, "foreignCurrencyCTC")} + /> + ) : ( +
{salary.foreignCurrencyCTC}
+ )} +
+ +
+
Foreign Currency Code
+ {editMode ? ( + handleChange(e, index, "foreignCurrencyCode")} + /> + ) : ( +
{salary.foreignCurrencyCode}
+ )} +
+ +
+
Other Compensations
+ {editMode ? ( + handleChange(e, index, "otherCompensations")} + /> + ) : ( +
{salary.otherCompensations}
+ )} +
+ +
+
Salary Period
+ {editMode ? ( + handleChange(e, index, "salaryPeriod")} + /> + ) : ( +
{salary.salaryPeriod}
+ )} +
+ +
+
Others
+ {editMode ? ( + handleChange(e, index, "others")} + /> + ) : ( +
{salary.others}
+ )} +
+
+ ) : ( +
+
+
Stipend
+ {editMode ? ( + handleChange(e, index, "stipend")} + /> + ) : ( +
{salary.stipend}
+ )} +
+ +
+
Foreign Currency Stipend
+ {editMode ? ( + handleChange(e, index, "foreignCurrencyStipend")} + /> + ) : ( +
{salary.foreignCurrencyStipend}
+ )} +
+ +
+
Accommodation
+ {editMode ? ( + handleChange(e, index, "accomodation")} + /> + ) : ( +
{salary.accomodation}
+ )} +
+ +
+
Tentative CTC
+ {editMode ? ( + handleChange(e, index, "tenetativeCTC")} + /> + ) : ( +
{salary.tenetativeCTC}
+ )} +
+
+ )} + +
+
+
Minimum CPI
+ {editMode ? ( + handleChange(e, index, "minCPI")} + /> + ) : ( +
{salary.minCPI}
+ )} +
+
+
Tenth Marks
+ {editMode ? ( + handleChange(e, index, "tenthMarks")} + /> + ) : ( +
{salary.tenthMarks}
+ )} +
+
+
Twelth Marks
+ {editMode ? ( + handleChange(e, index, "twelthMarks")} + /> + ) : ( +
{salary.twelthMarks}
+ )} +
+
+
+

Programs

+
+ {salary.programs.map((program, programIndex) => ( +
+
+ {program.department} - {program.course} - {program.year} +
+
+ ))} +
+
+
+

Genders

+
+ {salary.genders.map((gender, genderIndex) => ( +
+
+ {gender} +
+
+ ))} +
+
+
+

Categories

+
+ {salary.categories.map((category, categoryIndex) => ( +
+
+ {category} +
+
+ ))} +
+
+ + +
+ ))} +
+); + +export default Salaries;