@@ -69,6 +69,7 @@ export type InitialValues = {
6969 stream : string ;
7070 record : string ;
7171 layout : string ;
72+ cameraPosition : string ;
7273}
7374
7475/**
@@ -179,6 +180,19 @@ const EventDetailsSchedulingTab = ({
179180 }
180181 } ;
181182
183+ const getCameraPosition = ( deviceId : Recording [ "id" ] ) => {
184+ if ( deviceId === source . device . id ) {
185+ return source . device . parsedCapabilities . cameraPosition ? source . device . parsedCapabilities . cameraPosition : [ ] ;
186+ } else {
187+ for ( const agent of filterDevicesForAccess ( user , captureAgents ) ) {
188+ if ( agent . id === deviceId ) {
189+ return agent . parsedCapabilities . cameraPosition ? agent . parsedCapabilities . cameraPosition : [ ] ;
190+ }
191+ }
192+ return [ ] ;
193+ }
194+ } ;
195+
182196 const getInputForAgent = ( deviceId : Recording [ "id" ] , input : string ) => {
183197 const inputs = getInputs ( deviceId ) ;
184198 const value = inputs . find ( agent => agent . id === input ) ?. value ;
@@ -203,6 +217,12 @@ const EventDetailsSchedulingTab = ({
203217 return value ? t ( value as ParseKeys ) : "" ;
204218 } ;
205219
220+ const getCameraPositionForAgent = ( deviceId : Recording [ "id" ] , s : string ) => {
221+ const cameraPosition = getCameraPosition ( deviceId ) ;
222+ const value = cameraPosition . find ( agent => agent . id === s ) ?. value ;
223+ return value ? t ( value as ParseKeys ) : "" ;
224+ } ;
225+
206226 // changes the inputs in the formik
207227 const changeInputs = ( deviceId : Recording [ "id" ] , setFieldValue : ( field : string , value : any ) => Promise < void | FormikErrors < any > > ) => {
208228 setFieldValue ( "captureAgent" , deviceId ) ;
@@ -315,6 +335,9 @@ const EventDetailsSchedulingTab = ({
315335 const layout = source . device . capabilitiesMethods . layout && source . device . capabilitiesMethods . layout . length > 0
316336 ? source . device . capabilitiesMethods . layout [ 0 ]
317337 : "" ;
338+ const cameraPosition = source . device . capabilitiesMethods . cameraPosition && source . device . capabilitiesMethods . cameraPosition . length > 0
339+ ? source . device . capabilitiesMethods . cameraPosition [ 0 ]
340+ : "" ;
318341
319342 startDate . setHours ( 0 , 0 , 0 ) ;
320343 endDate . setHours ( 0 , 0 , 0 ) ;
@@ -333,6 +356,7 @@ const EventDetailsSchedulingTab = ({
333356 stream : stream ,
334357 record : record ,
335358 layout : layout ,
359+ cameraPosition : cameraPosition ,
336360 } ;
337361 } ;
338362
@@ -701,6 +725,33 @@ const EventDetailsSchedulingTab = ({
701725 ) }
702726 </ td >
703727 </ tr >
728+
729+ { /* cameraPosition */ }
730+ < tr >
731+ < td >
732+ { t (
733+ "EVENTS.EVENTS.DETAILS.SOURCE.PLACEHOLDER.CAMERA_POSITION" ,
734+ ) }
735+ </ td >
736+ < td >
737+ { ! ! formik . values . captureAgent &&
738+ ! ! getCameraPosition ( formik . values . captureAgent ) &&
739+ getCameraPosition ( formik . values . captureAgent ) . length >
740+ 0 &&
741+ ( hasAccessRole &&
742+ accessAllowed ( formik . values . captureAgent )
743+ ? < SchedulingRadio
744+ name = "cameraPosition"
745+ inputs = { getCameraPosition ( formik . values . captureAgent ) }
746+ />
747+ :
748+ < span >
749+ { getCameraPositionForAgent ( formik . values . captureAgent , formik . values . cameraPosition ) }
750+ < br />
751+ </ span >
752+ ) }
753+ </ td >
754+ </ tr >
704755 </ tbody >
705756 </ table >
706757 </ div >
0 commit comments