@@ -17,6 +17,8 @@ const UpdateSupportForm = () => {
1717 const [ contact , setContact ] = useState ( undefined ) ;
1818 const [ caseType , setCaseType ] = useState ( undefined ) ;
1919 const [ priorityType , setPriorityType ] = useState ( undefined ) ;
20+ const [ project , setProject ] = useState ( undefined ) ;
21+ const [ projects , setProjects ] = useState ( undefined ) ;
2022 const [ owner , setOwner ] = useState ( undefined ) ;
2123 const [ description , setDescription ] = useState ( undefined ) ;
2224 const [ fileNames , setFileNames ] = useState ( undefined ) ;
@@ -40,6 +42,8 @@ const UpdateSupportForm = () => {
4042 setContact ( support . contact ) ;
4143 setCaseType ( support . caseTypeCode ) ;
4244 setPriorityType ( support . priorityCode ) ;
45+ setProject ( support . project ) ;
46+ setProjects ( support . projects ) ;
4347 setOwner ( support . owner ) ;
4448 setDescription ( support . description ) ;
4549 setFileNames ( support . fileNames ) ;
@@ -53,12 +57,12 @@ const UpdateSupportForm = () => {
5357 } , [ searchParams , i18n ] ) ;
5458
5559 useEffect ( ( ) => {
56- if ( support && support . description === description && support . owner . id === owner . id && support . title === title && parseInt ( support . caseTypeCode ) === parseInt ( caseType ) && parseInt ( support . priorityCode ) === parseInt ( priorityType ) ) {
60+ if ( support && support . description === description && support . owner ? .id === owner ?. id && support . project ?. id === project ? .id && support . title === title && parseInt ( support . caseTypeCode ) === parseInt ( caseType ) && parseInt ( support . priorityCode ) === parseInt ( priorityType ) ) {
5761 tg . MainButton . hide ( ) ;
5862 } else {
5963 tg . MainButton . show ( ) ;
6064 }
61- } , [ tg , support , description , owner , title , caseType , priorityType ] ) ;
65+ } , [ tg , support , description , owner , project , title , caseType , priorityType ] ) ;
6266
6367 const validation = useCallback ( ( ) => {
6468 if ( ! title ) {
@@ -83,13 +87,15 @@ const UpdateSupportForm = () => {
8387 title : title ,
8488 customer : null ,
8589 contact : null ,
90+ project : project ,
91+ projects : projects ,
8692 caseTypeCode : caseType ,
8793 priorityCode : priorityType ,
8894 owner : owner ,
8995 description : description
9096 } ;
9197 tg . sendData ( JSON . stringify ( data ) ) ;
92- } , [ tg , title , caseType , priorityType , owner , description , validation ] ) ;
98+ } , [ tg , title , caseType , priorityType , project , projects , owner , description , validation ] ) ;
9399
94100 const onEditContactHandler = useCallback ( ( ) => {
95101 if ( ! validation ( ) ) {
@@ -100,13 +106,15 @@ const UpdateSupportForm = () => {
100106 title : title ,
101107 customer : customer ,
102108 contact : null ,
109+ project : project ,
110+ projects : projects ,
103111 caseTypeCode : caseType ,
104112 priorityCode : priorityType ,
105113 owner : owner ,
106114 description : description
107115 } ;
108116 tg . sendData ( JSON . stringify ( data ) ) ;
109- } , [ tg , title , customer , caseType , priorityType , owner , description , validation ] ) ;
117+ } , [ tg , title , customer , caseType , priorityType , project , projects , owner , description , validation ] ) ;
110118
111119 const onSendData = useCallback ( ( ) => {
112120 if ( ! validation ( ) ) {
@@ -117,13 +125,15 @@ const UpdateSupportForm = () => {
117125 title : title ,
118126 customer : customer ,
119127 contact : contact ,
128+ project : project ,
129+ projects : projects ,
120130 caseTypeCode : caseType ,
121131 priorityCode : priorityType ,
122132 owner : owner ,
123133 description : description
124134 } ;
125135 tg . sendData ( JSON . stringify ( data ) ) ;
126- } , [ tg , title , customer , contact , caseType , priorityType , owner , description , validation ] ) ;
136+ } , [ tg , title , customer , contact , caseType , priorityType , project , projects , owner , description , validation ] ) ;
127137
128138 useEffect ( ( ) => {
129139 tg . onEvent ( 'mainButtonClicked' , onSendData ) ;
@@ -150,6 +160,13 @@ const UpdateSupportForm = () => {
150160 fullName : selectedOption . label
151161 } ) ;
152162 } ;
163+
164+ const handleProjectChange = ( selectedOption ) => {
165+ setProject ( selectedOption && {
166+ id : selectedOption . value ,
167+ name : selectedOption . label
168+ } ) ;
169+ } ;
153170
154171 const handleCaseTypeChange = ( selectedOption ) => {
155172 setCaseType ( selectedOption . value ) ;
@@ -294,6 +311,18 @@ const UpdateSupportForm = () => {
294311 </ button >
295312 </ div >
296313 </ div >
314+ < div className = 'update-support-form-item' >
315+ < p > { translation ( 'project' ) } </ p >
316+ < Select
317+ className = 'update-support-form-select-control'
318+ value = { project && { value : project . id , label : project . name } }
319+ onChange = { handleProjectChange }
320+ options = { projects && projects . map ( project => ( { value : project . id , label : project . name } ) ) }
321+ isSearchable = { true }
322+ isClearable = { true }
323+ styles = { customSelectStyles }
324+ />
325+ </ div >
297326 < div className = 'update-support-form-item' >
298327 < p > { translation ( 'caseType' ) } </ p >
299328 < Select
0 commit comments