Skip to content

Commit

Permalink
Forest Form Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
amit-s19 committed Jan 15, 2024
1 parent 07a1e8c commit 614b40b
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 12 deletions.
83 changes: 76 additions & 7 deletions src/pages/submissions/SubmissionsEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const SubmissionsEdit = () => {
: <AddCommentIcon className={styles.iconStyle} color="error" onClick={() => handleFeedbackClick(`plotNumber${el + 1}`)} fontSize="large" />
: null}
</div>
{feedbackState?.[`plotNumber${el + 1}`] || flag != TITLE_STATUS.PFA ? <TextInput disabled={flag != TITLE_STATUS.PFA} required label={`Feedback for Plot Number ${el + 1}`} source={`feedback.feedbackData.plotNumber${el + 1}`} /> : <></>}
{feedbackState?.[`plotNumber${el + 1}`] || flag != TITLE_STATUS.PFA ? <TextInput disabled={flag != TITLE_STATUS.PFA} required label={`Feedback for Plot Number ${el + 1}`} source={`feedback.feedbackData.plotNumber${el + 1}`} fullWidth /> : <></>}

</>)
return <></>
Expand Down Expand Up @@ -245,17 +245,86 @@ const SubmissionsEdit = () => {


<div className={styles.inputContainer}>
<TextInput disabled label="No. of Plots Claimed Under FRA" source={"submissionData.fraPlotsClaimed"} fullWidth />
{flag == TITLE_STATUS.PFA ? feedbackState?.fraPlotsClaimed ?
<CancelIcon className={styles.iconStyle} fontSize="large" color="error" onClick={() => handleFeedbackClick("fraPlotsClaimed")} />
: <AddCommentIcon className={styles.iconStyle} color="error" onClick={() => handleFeedbackClick("fraPlotsClaimed")} fontSize="large" />
<TextInput disabled label="Description of boundaries by prominent landmarks including khasra/compartment No" source={"submissionData.boundariesDesc"} fullWidth />
{flag == TITLE_STATUS.PFA ? feedbackState?.boundariesDesc ?
<CancelIcon className={styles.iconStyle} fontSize="large" color="error" onClick={() => handleFeedbackClick("boundariesDesc")} />
: <AddCommentIcon className={styles.iconStyle} color="error" onClick={() => handleFeedbackClick("boundariesDesc")} fontSize="large" />
: null}
</div>
{feedbackState?.fraPlotsClaimed || flag != TITLE_STATUS.PFA ? <TextInput disabled={flag != TITLE_STATUS.PFA} required label="Feedback for Plots Claimed" source="feedback.feedbackData.fraPlotsClaimed" /> : <></>}
{feedbackState?.boundariesDesc || flag != TITLE_STATUS.PFA ? <TextInput disabled={flag != TITLE_STATUS.PFA} required label="Feedback for Description of boundaries by prominent landmarks including khasra/compartment No" source="feedback.feedbackData.boundariesDesc" /> : <></>}


<div className={styles.inputContainer}>
<TextInput disabled label="Type of Forest Land" source={"submissionData.forestLandType"} fullWidth />
{flag == TITLE_STATUS.PFA ? feedbackState?.forestLandType ?
<CancelIcon className={styles.iconStyle} fontSize="large" color="error" onClick={() => handleFeedbackClick("forestLandType")} />
: <AddCommentIcon className={styles.iconStyle} color="error" onClick={() => handleFeedbackClick("forestLandType")} fontSize="large" />
: null}
</div>
{feedbackState?.forestLandType || flag != TITLE_STATUS.PFA ? <TextInput disabled={flag != TITLE_STATUS.PFA} required label="Feedback for Type of Forest Land" source="feedback.feedbackData.forestLandType" /> : <></>}

<FunctionField render={(record: any) => {
if (record?.submissionData?.forestLandType == 'revenueForest') {
return <>
<div className={styles.inputContainer}>
<TextInput disabled label="Type of Block" source="submissionData.typeOfBlock" fullWidth />
{flag == TITLE_STATUS.PFA ? feedbackState?.typeOfBlock ?
<CancelIcon className={styles.iconStyle} fontSize="large" color="error" onClick={() => handleFeedbackClick("typeOfBlock")} />
: <AddCommentIcon className={styles.iconStyle} color="error" onClick={() => handleFeedbackClick("typeOfBlock")} fontSize="large" />
: null}
</div>
{feedbackState?.typeOfBlock || flag != TITLE_STATUS.PFA ? <TextInput disabled={flag != TITLE_STATUS.PFA} required label="Feedback for Type of Block" source="feedback.feedbackData.typeOfBlock" fullWidth /> : <></>}
</>
}
}} />

<FunctionField render={(record: any) => {
if (record?.submissionData?.forestLandType == 'revenueForest' && record?.submissionData?.typeOfBlock == 'jungleBlock') {
return <>
<div className={styles.inputContainer}>
<TextInput disabled label="Compartment No" source="submissionData.compartmentNo" fullWidth />
{flag == TITLE_STATUS.PFA ? feedbackState?.compartmentNo ?
<CancelIcon className={styles.iconStyle} fontSize="large" color="error" onClick={() => handleFeedbackClick("compartmentNo")} />
: <AddCommentIcon className={styles.iconStyle} color="error" onClick={() => handleFeedbackClick("compartmentNo")} fontSize="large" />
: null}
</div>
{feedbackState?.compartmentNo || flag != TITLE_STATUS.PFA ? <TextInput disabled={flag != TITLE_STATUS.PFA} required label="Feedback for Compartment No" source="feedback.feedbackData.compartmentNo" fullWidth /> : <></>}
</>
}
}} />

<FunctionField render={(record: any) => {
if (record?.submissionData?.forestLandType == 'revenueForest' && record?.submissionData?.typeOfBlock == 'revenueBlock') {
return <>
<div className={styles.inputContainer}>
<TextInput disabled label="No. of Plots Claimed Under FRA" source={"submissionData.fraPlotsClaimed"} fullWidth />
{flag == TITLE_STATUS.PFA ? feedbackState?.fraPlotsClaimed ?
<CancelIcon className={styles.iconStyle} fontSize="large" color="error" onClick={() => handleFeedbackClick("fraPlotsClaimed")} />
: <AddCommentIcon className={styles.iconStyle} color="error" onClick={() => handleFeedbackClick("fraPlotsClaimed")} fontSize="large" />
: null}
</div>
{feedbackState?.fraPlotsClaimed || flag != TITLE_STATUS.PFA ? <TextInput disabled={flag != TITLE_STATUS.PFA} required label="Feedback for Plots Claimed" source="feedback.feedbackData.fraPlotsClaimed" fullWidth /> : <></>}

{PlotInputs()}
</>
}
}} />

<FunctionField render={(record: any) => {
if (record?.submissionData?.forestLandType == 'reservedForest') {
return <>
<div className={styles.inputContainer}>
<TextInput disabled label="Compartment No" source="submissionData.compartmentNo" fullWidth />
{flag == TITLE_STATUS.PFA ? feedbackState?.compartmentNo ?
<CancelIcon className={styles.iconStyle} fontSize="large" color="error" onClick={() => handleFeedbackClick("compartmentNo")} />
: <AddCommentIcon className={styles.iconStyle} color="error" onClick={() => handleFeedbackClick("compartmentNo")} fontSize="large" />
: null}
</div>
{feedbackState?.compartmentNo || flag != TITLE_STATUS.PFA ? <TextInput disabled={flag != TITLE_STATUS.PFA} required label="Feedback for Compartment No" source="feedback.feedbackData.compartmentNo" fullWidth /> : <></>}
</>
}
}} />

{PlotInputs()}

<div className={styles.inputContainer}>
<TextInput disabled label="Has ROR been updated?" source={"submissionData.rorUpdated"} fullWidth />
Expand Down
17 changes: 12 additions & 5 deletions src/pages/submissions/SubmissionsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,18 @@ const SubmissionsView = () => {
<TextField variant='outlined' label="Tribe Name" value={subData.tribeName} />
<TextField variant='outlined' label="Area Units" value={subData.areaUnits} />
<TextField variant='outlined' label="Area in Hectares (xx.xx)" value={subData.area} />
<TextField variant='outlined' label="No. of Plots Claimed Under FRA" value={subData.fraPlotsClaimed} />
{
//@ts-ignore
[...Array(Number(subData?.fraPlotsClaimed))?.keys()]?.map(el => <TextField variant='outlined' label={`Plot Number ${el + 1}`} value={subData[`plotNumber${el + 1}`]} />)
}
<TextField variant='outlined' label="Description of boundaries by prominent landmarks including khasra/compartment No" value={subData.boundariesDesc} />
<TextField variant='outlined' label="Type of Forest Land" value={subData.forestLandType} />
{subData?.forestLandType == 'revenueForest' && <TextField variant='outlined' label="Type of Block" value={subData.typeOfBlock} />}
{subData?.forestLandType == 'revenueForest' && subData?.typeOfBlock == 'jungleBlock' && <TextField variant='outlined' label="Compartment No" value={subData.compartmentNo} />}
{subData?.forestLandType == 'revenueForest' && subData?.typeOfBlock == 'revenueBlock' && <>
<TextField variant='outlined' label="No. of Plots Claimed Under FRA" value={subData.fraPlotsClaimed} />
{
//@ts-ignore
[...Array(Number(subData?.fraPlotsClaimed))?.keys()]?.map(el => <TextField variant='outlined' label={`Plot Number ${el + 1}`} value={subData[`plotNumber${el + 1}`]} />)
}
</>}
{subData?.forestLandType == 'reservedForest' && <TextField variant='outlined' label="Compartment No" value={subData.compartmentNo} />}
<TextField variant='outlined' label="Has ROR been updated?" value={subData.rorUpdated ? 'Yes' : 'No'} />
<Carousel onClickItem={(index: any) => openImageViewer(index, setRorImageViewer)}>
{rorImages?.map((el: string) => <img src={el} style={{ width: '30%' }} />)}
Expand Down

0 comments on commit 614b40b

Please sign in to comment.