File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -301,6 +301,37 @@ const JobDetails = ({
301301 const [ courses , setCourses ] = useState < string [ ] > ( [ ] ) ;
302302 const [ branches , setBranches ] = useState < string [ ] > ( [ ] ) ;
303303
304+ // Prevent placement-only required fields from blocking INTERN submissions
305+ useEffect ( ( ) => {
306+ if ( seasonType !== "INTERN" ) return ;
307+
308+ const currentSalaries = form . getFieldValue ( "salaries" ) || [ ] ;
309+ if ( ! Array . isArray ( currentSalaries ) || currentSalaries . length === 0 ) return ;
310+
311+ let didChange = false ;
312+ const updated = currentSalaries . map ( ( s : any ) => {
313+ const next = { ...s } ;
314+ if ( next . baseSalary === undefined || next . baseSalary === null ) {
315+ next . baseSalary = 1 ; // minimal placeholder to satisfy required validation elsewhere
316+ didChange = true ;
317+ }
318+ if ( next . totalCTC === undefined || next . totalCTC === null ) {
319+ next . totalCTC = 1 ;
320+ didChange = true ;
321+ }
322+ if ( next . firstYearCTC === undefined || next . firstYearCTC === null ) {
323+ next . firstYearCTC = 1 ;
324+ didChange = true ;
325+ }
326+ return next ;
327+ } ) ;
328+
329+ if ( didChange ) {
330+ form . setFieldValue ( "salaries" , updated ) ;
331+ setFieldValue ( "salaries" , updated ) ;
332+ }
333+ } , [ seasonType ] ) ;
334+
304335 const [ selectedYears , setSelectedYears ] = useState < string [ ] > ( [ ] ) ;
305336 const [ selectedCourses , setSelectedCourses ] = useState < string [ ] > ( [ ] ) ;
306337 const [ selectedBranches , setSelectedBranches ] = useState < string [ ] > ( [ ] ) ;
You can’t perform that action at this time.
0 commit comments