Skip to content

Commit

Permalink
updated view and new proforma admin and company side
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshatGupta15 committed Jun 18, 2024
1 parent 8eb5aad commit f332d64
Show file tree
Hide file tree
Showing 4 changed files with 314 additions and 29 deletions.
24 changes: 12 additions & 12 deletions pages/admin/rc/[rcid]/proforma/[proformaid]/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,18 @@ function View() {
sx={textFieldSX}
/>
</Grid>
<Grid item xs={12} md={6} key="ctc">
<h4>Tentative CTC for PPO Selects</h4>
{isFetched && (
<RichText onChange={setCtc} readOnly value={ctc} />
)}
</Grid>
<Grid item xs={12} md={6} key="pd">
<h4>PPO provision on Performance</h4>
{isFetched && (
<RichText onChange={setPd} readOnly value={pd} />
)}
</Grid>
<Grid item xs={12} md={6} key="accommodation" padding={0}>
<h4>Accommodation provided / Trip Fare</h4>
<TextField
Expand All @@ -783,12 +795,6 @@ function View() {
sx={textFieldSX}
/>
</Grid>
<Grid item xs={12} md={6} key="pd">
<h4>PPO provision on Performance</h4>
{isFetched && (
<RichText onChange={setPd} readOnly value={pd} />
)}
</Grid>
<Grid item xs={12} md={6} key="base" padding={0}>
<h4>Tentative date of confirming of PPOs</h4>
<TextField
Expand All @@ -815,12 +821,6 @@ function View() {
sx={textFieldSX}
/>
</Grid>
<Grid item xs={12} md={6} key="ctc">
<h4>Tentative CTC for PPO Selects</h4>
{isFetched && (
<RichText onChange={setCtc} readOnly value={ctc} />
)}
</Grid>
<Grid item xs={12} md={6} key="MedReq">
<h4>Medical Requirements</h4>
<TextField
Expand Down
293 changes: 289 additions & 4 deletions pages/admin/rc/[rcid]/proforma/new.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import {
Autocomplete,
Button,
Card,
Checkbox,
FormControl,
InputLabel,
ListItemText,
MenuItem,
Select,
SelectChangeEvent,
Stack,
TextField,
} from "@mui/material";
Expand All @@ -11,7 +17,7 @@ import { useForm } from "react-hook-form";
import { useRouter } from "next/router";

import Meta from "@components/Meta";
import RichTextEditor from "@components/Editor/RichText";
// import RichTextEditor from "@components/Editor/RichText";
import useStore from "@store/store";
import requestCompany, { CompanyRc } from "@callbacks/admin/rc/company";
import requestProforma, {
Expand All @@ -22,7 +28,12 @@ import requestProforma, {
const ROUTE = "/admin/rc/[rcId]/proforma/[proformaid]/step2";

function ProformaNew() {
const [value, onChange] = useState("");
const [industrySectors, setIndustrySectors] = useState<string[]>([]);
const [type, setType] = useState<string>("");
const [industrySectorsString, setIndustrySectorsString] =
useState<string>("");
const [jobDesc, setJobDesc] = useState("");
// const [value, onChange] = useState("");
const { token, name } = useStore();
const {
register,
Expand All @@ -46,6 +57,21 @@ function ProformaNew() {
label: "",
cid: 0,
});
const handleTypeChange = (event: SelectChangeEvent<string>) => {
const {
target: { value },
} = event;
const selectedValue = value;
setType(selectedValue);
};
const handleIndustrySectorChange = (event: SelectChangeEvent<string[]>) => {
const {
target: { value },
} = event;
const selectedValues = typeof value === "string" ? value.split(",") : value;
setIndustrySectors(selectedValues);
setIndustrySectorsString(selectedValues.join(", ")); // Store the comma-separated string
};

useEffect(() => {
const getCompanydata = async () => {
Expand All @@ -61,8 +87,10 @@ function ProformaNew() {
company_id: company.cid,
company_name: company.label,
company_recruitment_cycle_id: company.id,
job_description: value,
job_description: jobDesc,
recruitment_cycle_id: parseInt(rid, 10),
type_of_org: type,
role: industrySectorsString,
};
const res: ProformaResponse = await requestProforma.post(token, rid, info);
if (res.pid !== 0) {
Expand All @@ -71,7 +99,8 @@ function ProformaNew() {
role: "",
tentative_job_location: "",
});
onChange("");
// onChange("");
setJobDesc("");
router.push({
pathname: ROUTE,
query: { rcId: rid, proformaid: res.pid },
Expand All @@ -81,6 +110,261 @@ function ProformaNew() {

return (
<div>
<Meta title="New Proforma" />
<Card
elevation={5}
sx={{
padding: 3,
width: { xs: "330px", sm: "600px", margin: "0px auto" },
}}
>
<Stack spacing={3}>
<h2>Step 1/6 : Basic Details</h2>
<FormControl sx={{ m: 1 }}>
<Autocomplete
disablePortal
id="selectCompany"
options={companies.map((row) => ({
id: row.ID,
label: row.company_name,
cid: row.company_id,
}))}
renderInput={(params) => (
<TextField {...params} label="Select Company" />
)}
onChange={(e, v) => {
e.preventDefault();
if (v != null) setCompany(v);
}}
/>
</FormControl>
<FormControl sx={{ m: 1 }}>
<p style={{ fontWeight: 300 }}>Company Name</p>
<TextField
id="Cname"
disabled
required
sx={{ marginLeft: "5 rem" }}
fullWidth
multiline
variant="standard"
error={!!errors.company_name}
helperText={errors.company_name?.message}
{...register("company_name", { required: true })}
/>
</FormControl>
<FormControl sx={{ m: 1 }}>
<p style={{ fontWeight: 300 }}>Postal Address</p>
<TextField
id="postalAddress"
required
fullWidth
multiline
variant="standard"
error={!!errors.postal_address}
helperText={errors.postal_address?.message}
{...register("postal_address", {
required: "Postal Address is required",
})}
/>
</FormControl>

<FormControl sx={{ m: 1 }}>
<p style={{ fontWeight: 300 }}>Date of Establishment</p>
<TextField
id="dateOfEstablishment"
type="date"
required
fullWidth
variant="standard"
error={!!errors.establishment_date}
helperText={errors.establishment_date?.message}
InputLabelProps={{
shrink: true,
}}
{...register("establishment_date", {
required: "Date of Establishment is required",
})}
/>
</FormControl>

<FormControl sx={{ m: 1 }}>
<p style={{ fontWeight: 300 }}>Number of Employees</p>
<TextField
id="numberOfEmployees"
required
fullWidth
variant="standard"
error={!!errors.total_employees}
helperText={errors.total_employees?.message}
{...register("total_employees", {
required: "Number of Employees is required",
})}
/>
</FormControl>

<FormControl sx={{ m: 1 }}>
<p style={{ fontWeight: 300 }}>Social Media Page Link (optional)</p>
<TextField
id="socialMediaPageLink"
fullWidth
variant="standard"
{...register("social_media")}
/>
</FormControl>

<FormControl sx={{ m: 1 }}>
<p style={{ fontWeight: 300 }}>Website</p>
<TextField
id="website"
required
fullWidth
variant="standard"
error={!!errors.website}
helperText={errors.website?.message}
{...register("website", {
required: "Website is required",
})}
/>
</FormControl>

<FormControl sx={{ m: 1 }}>
<p style={{ fontWeight: 300 }}>Company Turnover for NIRF Purpose</p>
<TextField
id="companyTurnover"
required
fullWidth
variant="standard"
error={!!errors.turnover}
helperText={errors.turnover?.message}
{...register("turnover", {
required: "Company Turnover is required",
})}
/>
</FormControl>

<FormControl sx={{ m: 1 }}>
<InputLabel>Type of Organization</InputLabel>
<Select
id="typeOfOrganization"
required
fullWidth
variant="standard"
error={!!errors.company_name}
value={type}
onChange={handleTypeChange}
renderValue={(selected) => selected}
// {...register("type_of_org", {
// required: "Type of Organization is required",
// })}
>
<MenuItem value="Private (Indian/Foreign)">
Private (Indian/Foreign)
</MenuItem>
<MenuItem value="Multi National Company (Indian Origin)">
Multi National Company (Indian Origin)
</MenuItem>
<MenuItem value="Multi National Company (Foreign Origin)">
Multi National Company (Foreign Origin)
</MenuItem>
<MenuItem value="Government">Government</MenuItem>
<MenuItem value="Public Sector Undertakings (Indian)">
Public Sector Undertakings (Indian)
</MenuItem>
<MenuItem value="Non-Government Organisation">
Non-Government Organisation
</MenuItem>
<MenuItem value="STARTUP">STARTUP</MenuItem>
<MenuItem value="Others">Others</MenuItem>
</Select>
</FormControl>

<FormControl sx={{ m: 1 }}>
<p style={{ fontWeight: 300 }}>
Location and Head office of the parent company (if MnC)
</p>
<TextField
id="mncDetails"
fullWidth
variant="standard"
error={!!errors.head_office}
helperText={errors.head_office?.message}
{...register("head_office", {
required: "Company Turnover is required",
})}
/>
</FormControl>

<FormControl sx={{ m: 1 }}>
<InputLabel>Nature of Business / Industry Sector</InputLabel>
<Select
id="NatureOfBusiness"
multiple
fullWidth
required
variant="standard"
value={industrySectors}
onChange={handleIndustrySectorChange}
renderValue={(selected) => selected.join(", ")}
>
{[
"Core Engineering & Technology",
"Analytics",
"IT / Software",
"Oil & Gas / Energy",
"Data Science/ AI/ ML",
"Cyber Security",
"Finance & Consulting",
"Management",
"Academics/Research",
"Media",
"E-Commerce",
"Construction",
"Design",
"Manufacturing",
"Infrastructure",
"HealthCare/ Biomedical",
"Edutech",
"Policy",
].map((sector) => (
<MenuItem key={sector} value={sector}>
<Checkbox checked={industrySectors.indexOf(sector) > -1} />
<ListItemText primary={sector} />
</MenuItem>
))}
</Select>
</FormControl>

<Stack
spacing={3}
direction="row"
justifyContent="center"
alignItems="center"
>
<Button
variant="contained"
sx={{ width: "50%" }}
disabled={!router.isReady || rid === ""}
onClick={handleSubmit(handleNext)}
>
Next
</Button>
<Button
variant="contained"
sx={{ width: "50%" }}
onClick={() => {
reset({
company_name: "",
role: "",
});
}}
>
Reset
</Button>
</Stack>
</Stack>
</Card>
{/* <div>
<Meta title="Step 1/6 - Basic Details" />
<Card
elevation={5}
Expand Down Expand Up @@ -204,6 +488,7 @@ function ProformaNew() {
</Stack>
</Stack>
</Card>
</div> */}
</div>
);
}
Expand Down
Loading

0 comments on commit f332d64

Please sign in to comment.