
<div class="row">
    <div class="col-lg-12 col-md-12">
        <h1 class="page-header"><?php echo PROPS_HEADER; ?>
    
        <ol class="breadcrumb">
            <li><a href="/ajax/devices.php" class="ajax-content"><?php echo ALL_DEVICES; ?></a></li>
            <li class="active"><?php echo $ipCamera->info['device_name']; ?></li>
        </ol>
        </h1>
    </div>
</div>


<div class="row">
    <div class="col-lg-12 col-md-12">
        <div class="panel panel-default">
            <div class="panel-body">

                <div class="form-group">
                    <div class="col-lg-7 col-lg-offset-3 col-md-7 col-md-offset-2">
                        <div id="connStat" class="alert alert-info"> 
                            <span id="csText" style="line-height: 34px;"><?php echo AIP_TEST_CONNECTION_MESSAGE ?></span>
                            <form action="/ajax/editip.php/test" method="POST" class="form-horizontal" style="display: inline;">
                                <input type="hidden" name="mode" value="editIp" />
                                <input type="hidden" name="id" value="<?php echo $ipCamera->info['id']; ?>" />
                                <a type="submit" class="btn btn-warning send-req-form pull-right" data-func="testCameraLoadingHeader" data-func-after="testCameraConnection">
                                    <i class="fa fa-check fa-fw"></i><?php echo AIP_TEST_CONNECTION ?>
                                </a>
                            </form>
                        </div>
                    </div>
                </div>
                
                <form action="/ajax/editip.php" method="POST" class="form-horizontal">
                    <input type="hidden" name="mode" value="editIp" />
                    <input type="hidden" name="id" value="<?php echo $ipCamera->info['id']; ?>" />
                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo VA_AUDIO_ENABLE; ?></label>

                        <div class="col-lg-6 col-md-6 form-control-static">
                            <input class="" type="checkbox" name="audio_enabled" <?php echo (!($ipCamera->info['audio_disabled']) ? ' checked="checked"' : ''); ?>  />
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo AIP_CAMERA_NAME; ?></label>

                        <div class="col-lg-6 col-md-6">
                            <input class="form-control" type="text" name="camName" value="<?php echo $ipCamera->info['device_name']; ?>"  />
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo AIP_IP_ADDR; ?></label>

                        <div class="col-lg-6 col-md-6">
                            <input class="form-control" type="text" name="ipAddr" value="<?php echo $ipCamera->info['ipAddr']; ?>"  />
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo AIP_USER; ?></label>

                        <div class="col-lg-6 col-md-6">
                            <input class="form-control" type="text" name="user" value="<?php echo $ipCamera->info['rtsp_username']; ?>"  />
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo AIP_PASS; ?></label>

                        <div class="col-lg-6 col-md-6">
                            <input class="form-control" type="password" name="pass" value="<?php echo $ipCamera->info['rtsp_password']; ?>"  />
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo AIP_PROTOCOL; ?></label>

                        <div class="col-lg-6 col-md-6">
			                <select name="protocol" class="form-control change-event" data-function="protocolBlocks">
                				<option value="IP-RTSP">RTSP</option>
                				<option value="IP-MJPEG" <?php echo ($ipCamera->info['protocol']) == 'IP-MJPEG' ? "selected" : "";  ?>>MJPEG</option>
                			</select>
                        </div>
                    </div>
                    
                    <div class="devices-rtsp-setting" <?php echo ($ipCamera->info['protocol']) == 'IP-MJPEG' ? 'style="display:none;"' : ""; ?>>
                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo AIP_RTSP; ?></label>

                        <div class="col-lg-6 col-md-6">
                            <input class="form-control" type="text" name="rtsp" value="<?php echo $ipCamera->info['rtsp']; ?>"  />
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo AIP_PORT; ?></label>

                        <div class="col-lg-6 col-md-6">
                            <input class="form-control" type="text" name="port" value="<?php echo $ipCamera->info['port']; ?>"  />
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo IPCAM_TCPUDP_LEVEL; ?></label>

                        <div class="col-lg-6 col-md-6">
                            <select name="prefertcp" class="form-control">
                                <option value="0">AUTO</option>
                                <option value="1" <?php echo ($ipCamera->info['rtsp_rtp_prefer_tcp'] == 1) ? "selected" : ""; ?>>TCP</option>
                                <option value="2" <?php echo ($ipCamera->info['rtsp_rtp_prefer_tcp'] == 2) ? "selected" : ""; ?>>UDP</option>
                            </select>
                        </div>
                    </div>

                    </div>

                    <div class="devices-mjpeg-setting" <?php echo ($ipCamera->info['protocol']) == 'IP-MJPEG' ? '' : 'style="display:none;"'; ?>>
                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo AIP_MJPATH; ?></label>

                        <div class="col-lg-6 col-md-6">
                            <input class="form-control" type="text" name="mjpeg" value="<?php echo $ipCamera->info['mjpeg_path']; ?>"  />
                        </div>
                    </div>
                    
                    <div class="form-group" style="display:none;">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo AIP_IP_ADDR_MJPEG; ?></label>

                        <div class="col-lg-6 col-md-6">
                            <input class="form-control" type="text" name="ipAddrMjpeg" value="<?php echo $ipCamera->info['ipAddrMjpeg']; ?>"  />
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo AIP_PORT_MJPEG; ?></label>

                        <div class="col-lg-6 col-md-6">
                            <input class="form-control" type="text" name="portMjpeg" value="<?php echo $ipCamera->info['portMjpeg']; ?>"  />
                        </div>
                    </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo AIP_HLS_WINDOW_SIZE; ?></label>

                        <div class="col-lg-6 col-md-6">
                            <input class="form-control" type="text" name="hls_window_size" value="<?php echo $ipCamera->info['hls_window_size']; ?>"  />
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo AIP_HLS_SEGMENT_SIZE; ?><p class='help-block'><small><?php echo AIP_HLS_SEGMENT_SIZE_EX; ?></small></p></label>

                        <div class="col-lg-6 col-md-6">
                            <input class="form-control" type="text" name="hls_segment_size" value="<?php echo $ipCamera->info['hls_segment_size']; ?>"  />
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo AIP_HLS_SEGMENT_DURATION; ?></label>

                        <div class="col-lg-6 col-md-6">
                            <input class="form-control" type="text" name="hls_segment_duration" value="<?php echo $ipCamera->info['hls_segment_duration']; ?>"  />
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo AIP_SUBSTREAM_ENABLE; ?></label>

                        <div class="col-lg-6 col-md-6 form-control-static">
                            <input class="" type="checkbox" name="substream_enabled" <?php echo (($ipCamera->info['substream_enabled'] == 1) ? ' checked="checked"' : ''); ?>  />
                        </div>
		    </div>
                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo AIP_SUBSTREAM_PATH; ?></label>

                        <div class="col-lg-6 col-md-6">
                            <input class="form-control" type="text" name="substream" value="<?php echo $ipCamera->info['substream']; ?>"  />
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo AIP_ONVIF_PORT; ?></label>

                        <div class="col-lg-6 col-md-6">
                            <div class="input-group">
                                <input class="form-control" type="text" name="onvif_port" value="<?php echo $ipCamera->info['onvif_port']; ?>" />
                                <span class="input-group-btn">
                                    <button type="button" class="btn btn-default click-event" data-function="addIpCheckOnvifPort"><?php echo AIP_CHECK_ONVIF_PORT; ?></button>
                                </span>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-4 col-md-4 control-label">
                            <a href="javascript:void(0);" class="btn btn-default" id="edittip-advanced-settings"><?php echo AIP_ADVANCED_SETTINGS; ?></a>
                        </label>
                        <div class="col-lg-6 col-md-6">
                        </div>
                    </div>
                    
                    <div class="form-group" id="edittip-advanced-settings-block" style="display: none;">
                        <label class="col-lg-4 col-md-4 control-label"><?php echo IPCAM_DEBUG_LEVEL; ?></label>

                        <div class="col-lg-6 col-md-6 form-control-static">
                            <input type="checkbox" name="debug_level" <?php echo ($ipCamera->info['debug_level']==1) ? 'checked' : ''; ?>  />
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-6 col-lg-offset-4 col-md-6 col-md-offset-4">
                            <button class="btn btn-success send-req-form"  data-func="testCameraLoadingHeader" data-func-after="testCameraConnection" type="submit">
                                <i class="fa fa-check fa-fw"></i> <?php echo SAVE_CHANGES." & ".AIP_TEST_CONNECTION?>
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

