<div class="container-fluid">
    <div>
        <h3>Video & Audio Settings</h3>
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item">
                    <a href="#">Home</a>
                </li>
                <li class="breadcrumb-item">
                    <a href="#">Settings</a>
                </li>
                <li class="breadcrumb-item active" aria-current="page">Video & Audio Settings</li>
            </ol>
        </nav>
    </div>
    <!-- Vertical Layout -->
    <div class="row">
        <div class="col-lg-6 col-md-6">
            <div class="card">
                <div class="card-body">
                    <h6 class="card-title">Video & Audio Chat Settings</h6>
                    <div class="email-settings-alert"></div>
                    <form class="email-settings" method="POST">
                        <label for="video_chat">Video Call</label>
                        <div class="form-group">
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="radio" name="video_chat" id="video_chat-enabled" value="1" <?php echo ($wo['config']['video_chat'] == 1) ? 'checked': '';?>>
                                <label class="form-check-label" for="video_chat-enabled">Enabled</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="radio" name="video_chat" id="video_chat-disabled" value="0" <?php echo ($wo['config']['video_chat'] == 0) ? 'checked': '';?>>
                                <label class="form-check-label" for="video_chat-disabled" class="m-l-20">Disabled</label>
                            </div>
                        </div>
                        <label for="audio_chat">Audio Call</label>
                        <div class="form-group">
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="radio" name="audio_chat" id="audio_chat-enabled" value="1" <?php echo ($wo['config']['audio_chat'] == 1) ? 'checked': '';?>>
                                <label class="form-check-label" for="audio_chat-enabled">Enabled</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="radio" name="audio_chat" id="audio_chat-disabled" value="0" <?php echo ($wo['config']['audio_chat'] == 0) ? 'checked': '';?>>
                                <label class="form-check-label" for="audio_chat-disabled" class="m-l-20">Disabled</label>
                            </div>
                        </div>
                        <input type="hidden" name="hash_id" value="<?php echo Wo_CreateSession();?>">
                        <button type="submit" class="btn btn-primary m-t-15 waves-effect">Save</button>
                    </form>
                </div>
            </div>
            <div class="card">
                <div class="card-body">
                    <h6 class="card-title">Twilio Settings</h6>
                    <div class="twilio-settings-alert"></div>
                    <form class="twilio-settings" method="POST">
                        <label for="twilio_video_chat">Twilio Chat Video</label>
                        <div class="form-group">
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="radio" name="twilio_video_chat" id="twilio_video_chat-enabled" value="1" <?php echo ($wo['config']['twilio_video_chat'] == 1) ? 'checked': '';?>>
                                <label class="form-check-label" for="twilio_video_chat-enabled">Enabled</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="radio" name="twilio_video_chat" id="twilio_video_chat-disabled" value="0" <?php echo ($wo['config']['twilio_video_chat'] == 0) ? 'checked': '';?>>
                                <label class="form-check-label" for="twilio_video_chat-disabled" class="m-l-20">Disabled</label>
                            </div>
                        </div>
                        <div>
                            To start using this feature, you'll need to create an account in Twilio and buy "Programmable Video" product.
                        </div>
                        <br><br>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Live accountSid</label>
                                <input type="text" id="video_accountSid" name="video_accountSid" class="form-control" value="<?php echo $wo['config']['video_accountSid'];?>">
                            </div>
                        </div>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">apiKeySid</label>
                                <input type="text" id="video_apiKeySid" name="video_apiKeySid" class="form-control" value="<?php echo $wo['config']['video_apiKeySid'];?>">
                            </div>
                        </div>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">apiKeySecret</label>
                                <input type="password" id="video_apiKeySecret" name="video_apiKeySecret" class="form-control" value="<?php echo $wo['config']['video_apiKeySecret'];?>">
                            </div>
                        </div>
                        <input type="hidden" name="hash_id" value="<?php echo Wo_CreateSession();?>">
                        <button type="submit" class="btn btn-primary m-t-15 waves-effect">Save</button>
                    </form>
                </div>
            </div>
        </div>
        <div class="col-lg-6 col-md-6" style="float: right;">
            <div class="card">
                <div class="card-body">
                    <h6 class="card-title">Agora Settings</h6>
                    <div class="agora-settings-alert"></div>
                    <form class="agora-settings" method="POST">
                        <label for="agora_chat_video">Agora Chat Video</label>
                        <div class="form-group">
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="radio" name="agora_chat_video" id="agora_chat_video-enabled" value="1" <?php echo ($wo['config']['agora_chat_video'] == 1) ? 'checked': '';?>>
                                <label class="form-check-label" for="agora_chat_video-enabled">Enabled</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="radio" name="agora_chat_video" id="agora_chat_video-disabled" value="0" <?php echo ($wo['config']['agora_chat_video'] == 0) ? 'checked': '';?>>
                                <label class="form-check-label" for="agora_chat_video-disabled" class="m-l-20">Disabled</label>
                            </div>
                        </div>
                        <div>
                            To start using this feature, you'll need to create an account in <a href="https://www.agora.io/en/">Agora</a>.
                        </div>
                        <br><br>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">App ID</label>
                                <input type="text" id="agora_chat_app_id" name="agora_chat_app_id" class="form-control" value="<?php echo $wo['config']['agora_chat_app_id'];?>">
                            </div>
                        </div>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">App Certificate</label>
                                <input type="text" id="agora_chat_app_certificate" name="agora_chat_app_certificate" class="form-control" value="<?php echo $wo['config']['agora_chat_app_certificate'];?>">
                            </div>
                        </div>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Customer ID</label>
                                <input type="text" id="agora_chat_customer_id" name="agora_chat_customer_id" class="form-control" value="<?php echo $wo['config']['agora_chat_customer_id'];?>">
                            </div>
                        </div>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Customer Secret</label>
                                <input type="text" id="agora_chat_customer_certificate" name="agora_chat_customer_certificate" class="form-control" value="<?php echo $wo['config']['agora_chat_customer_certificate'];?>">
                            </div>
                        </div>
                        <br>
                        <input type="hidden" name="hash_id" value="<?php echo Wo_CreateSession();?>">
                        <button type="submit" class="btn btn-primary m-t-15 waves-effect">Save</button>
                    </form>
                </div>
            </div>
        </div>
        <div class="clearfix"></div>
    </div>
    <!-- #END# Vertical Layout -->
<script>

$(function() {
    var form_twilio_settings = $('form.twilio-settings');
    form_twilio_settings.ajaxForm({
        url: Wo_Ajax_Requests_File() + '?f=admin_setting&s=update_general_setting',
        beforeSend: function() {
            form_twilio_settings.find('button').text('Please wait..');
        },
        success: function(data) {
            if (data.status == 200) {
                form_twilio_settings.find('button').text('Save');
                $("html, body").animate({ scrollTop: 0 }, "slow");
                $('.twilio-settings-alert').html('<div class="alert alert-success"><i class="fa fa-check"></i> Settings updated successfully</div>');
                setTimeout(function () {
                    $('.twilio-settings-alert').empty();
                }, 2000);
            }
        }
    });
    var form_email_settings = $('form.email-settings');
    form_email_settings.ajaxForm({
        url: Wo_Ajax_Requests_File() + '?f=admin_setting&s=update_general_setting',
        beforeSend: function() {
            form_email_settings.find('button').text('Please wait..');
        },
        success: function(data) {
            if (data.status == 200) {
                form_email_settings.find('button').text('Save');
                $("html, body").animate({ scrollTop: 0 }, "slow");
                $('.email-settings-alert').html('<div class="alert alert-success"><i class="fa fa-check"></i> Settings updated successfully</div>');
                setTimeout(function () {
                    $('.email-settings-alert').empty();
                }, 2000);
            }
        }
    });
    var form_agora_settings = $('form.agora-settings');
    form_agora_settings.ajaxForm({
        url: Wo_Ajax_Requests_File() + '?f=admin_setting&s=update_general_setting',
        beforeSend: function() {
            form_agora_settings.find('.waves-effect').text('Please wait..');
        },
        success: function(data) {
            if (data.status == 200) {
                form_agora_settings.find('.waves-effect').text('Save');
                $("html, body").animate({ scrollTop: 0 }, "slow");
                $('.agora-settings-alert').html('<div class="alert alert-success"><i class="fa fa-check"></i> Settings updated successfully</div>');
                setTimeout(function () {
                    $('.agora-settings-alert').empty();
                }, 2000);
            }
        }
    });
});
</script>