<div class="container-fluid">
    <div>
        <h3>Video 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 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">Upload Settings</h6>
                    <div class="upload_settings-alert"></div>
                    <form class="upload-settings" method="POST">
                        <label for="upload_system_type">Upload System Type</label>
                        <select class="form-control show-tick" id="upload_system_type" name="upload_system_type">
                            <option value="0" <?php if($pt->config->upload_system_type == 0){ echo "selected";} ?>>All Users</option>
                            <option value="1" <?php if($pt->config->upload_system_type == 1){ echo "selected";} ?>>Pro & Free</option>
                        </select>
                        <br><br>
                        <div id="all_users_" <?php if($pt->config->upload_system_type == 1){ ?> class="hidden" <?php } ?>>
                            <label for="max_upload_all_users">All users upload limit</label>
                            <select class="form-control show-tick" id="max_upload_all_users" name="max_upload_all_users">
                                <option value="2000000" <?php if($pt->config->max_upload_all_users == '2000000'){ echo "selected";} ?>>2MB</option>
                                <option value="6000000" <?php if($pt->config->max_upload_all_users == '6000000'){ echo "selected";} ?>>6MB</option>
                                <option value="12000000" <?php if($pt->config->max_upload_all_users == '12000000'){ echo "selected";} ?>>12MB</option>
                                <option value="24000000" <?php if($pt->config->max_upload_all_users == '24000000'){ echo "selected";} ?>>24MB</option>
                                <option value="48000000" <?php if($pt->config->max_upload_all_users == '48000000'){ echo "selected";} ?>>48MB</option>
                                <option value="96000000" <?php if($pt->config->max_upload_all_users == '96000000'){ echo "selected";} ?>>96MB</option>
                                <option value="256000000" <?php if($pt->config->max_upload_all_users == '256000000'){ echo "selected";} ?>>256MB</option>
                                <option value="512000000" <?php if($pt->config->max_upload_all_users == '512000000'){ echo "selected";} ?>>512MB</option>
                                <option value="1000000000" <?php if($pt->config->max_upload_all_users == '1000000000'){ echo "selected";} ?>>1GB</option>
                                <option value="10000000000" <?php if($pt->config->max_upload_all_users == '10000000000'){ echo "selected";} ?>>10GB</option>
                                <option value="0" <?php if($pt->config->max_upload_all_users == '0'){ echo "selected";} ?>>Unlimited</option>
                            </select>
                        </div>
                        <div id="p_f_users_" <?php if($pt->config->upload_system_type == 0){ ?> class="hidden" <?php } ?>>
                            <label for="max_upload_free_users">Free users upload limit</label>
                            <select class="form-control show-tick" id="max_upload_free_users" name="max_upload_free_users">
                                <option value="1" <?php if($pt->config->max_upload_all_users == '1'){ echo "selected";} ?>>0</option>
                                <option value="2000000" <?php if($pt->config->max_upload_free_users == '2000000'){ echo "selected";} ?>>2MB</option>
                                <option value="6000000" <?php if($pt->config->max_upload_free_users == '6000000'){ echo "selected";} ?>>6MB</option>
                                <option value="12000000" <?php if($pt->config->max_upload_free_users == '12000000'){ echo "selected";} ?>>12MB</option>
                                <option value="24000000" <?php if($pt->config->max_upload_free_users == '24000000'){ echo "selected";} ?>>24MB</option>
                                <option value="48000000" <?php if($pt->config->max_upload_free_users == '48000000'){ echo "selected";} ?>>48MB</option>
                                <option value="96000000" <?php if($pt->config->max_upload_free_users == '96000000'){ echo "selected";} ?>>96MB</option>
                                <option value="256000000" <?php if($pt->config->max_upload_free_users == '256000000'){ echo "selected";} ?>>256MB</option>
                                <option value="512000000" <?php if($pt->config->max_upload_free_users == '512000000'){ echo "selected";} ?>>512MB</option>
                                <option value="1000000000" <?php if($pt->config->max_upload_free_users == '1000000000'){ echo "selected";} ?>>1GB</option>
                                <option value="10000000000" <?php if($pt->config->max_upload_free_users == '10000000000'){ echo "selected";} ?>>10GB</option>
                                <option value="0" <?php if($pt->config->max_upload_free_users == '0'){ echo "selected";} ?>>Unlimited</option>
                            </select>
                            <br><br>
                            <label for="max_upload_pro_users">Pro users upload limit</label>
                            <select class="form-control show-tick" id="max_upload_pro_users" name="max_upload_pro_users">
                                <option value="2000000" <?php if($pt->config->max_upload_pro_users == '2000000'){ echo "selected";} ?>>2MB</option>
                                <option value="6000000" <?php if($pt->config->max_upload_pro_users == '6000000'){ echo "selected";} ?>>6MB</option>
                                <option value="12000000" <?php if($pt->config->max_upload_pro_users == '12000000'){ echo "selected";} ?>>12MB</option>
                                <option value="24000000" <?php if($pt->config->max_upload_pro_users == '24000000'){ echo "selected";} ?>>24MB</option>
                                <option value="48000000" <?php if($pt->config->max_upload_pro_users == '48000000'){ echo "selected";} ?>>48MB</option>
                                <option value="96000000" <?php if($pt->config->max_upload_pro_users == '96000000'){ echo "selected";} ?>>96MB</option>
                                <option value="256000000" <?php if($pt->config->max_upload_pro_users == '256000000'){ echo "selected";} ?>>256MB</option>
                                <option value="512000000" <?php if($pt->config->max_upload_pro_users == '512000000'){ echo "selected";} ?>>512MB</option>
                                <option value="1000000000" <?php if($pt->config->max_upload_pro_users == '1000000000'){ echo "selected";} ?>>1GB</option>
                                <option value="10000000000" <?php if($pt->config->max_upload_pro_users == '10000000000'){ echo "selected";} ?>>10GB</option>
                                <option value="0" <?php if($pt->config->max_upload_pro_users == '0'){ echo "selected";} ?>>Unlimited</option>
                            </select>
                        </div>
                        <br>
                        
                        <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">Player Settings</h6>
                    <div class="alert alert-warning">
                    <i class="fa fa-fw fa-exclamation-triangle"></i> <strong>Note:</strong> For youtube videos, the default player will be always used, the options below work for self hosted videos.
                  </div>
                    <div class="player_settings-alert"></div>
                    <form class="player-settings" method="POST">
                        <label for="comments_default_num">Player Type</label>
                        <select class="form-control show-tick" id="player_type" name="player_type">
                            <option value="default" <?php echo ($pt->config->player_type == 'default') ? 'selected': '';?>>Default (This player support  Video Ads , Image Ads , Vast/Vpaid Ads )</option>
                            <option value="fluidPlayer" <?php echo ($pt->config->player_type == 'fluidPlayer') ? 'selected': '';?>>Fluid Player (This player support Vast/Vpaid Ads , Image Ads)</option>
                            <option value="videojs" <?php echo ($pt->config->player_type == 'videojs') ? 'selected': '';?>>Video js Player (This player support Video Ads , Image Ads)</option>
                            <option value="cloudinary" <?php echo ($pt->config->player_type == 'cloudinary') ? 'selected': '';?>>Cloudinary Player (This player support Vast/Vpaid Ads , Image Ads)</option>
                        </select>
                        <br>
                        <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">Stock Videos Settings (Require FFMPEG)</h6>
                    <div class="stock-settings-alert"></div>
                    <form class="stock-settings" method="POST">
                        <label for="stock_videos">Stock Videos</label>
                        <div class="form-group">
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="stock_videos" id="stock_videos-enabled" value="on" <?php echo ($pt->config->stock_videos == 'on') ? 'checked': '';?>>
                                <label class="form-check-label" for="stock_videos-enabled">Enabled</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="stock_videos" id="stock_videos-disabled" value="off" <?php echo ($pt->config->stock_videos == 'off') ? 'checked': '';?>>
                                <label class="form-check-label" for="stock_videos-disabled" class="m-l-20">Disabled</label>
                            </div>
                        </div>
                        <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">
            <div class="card">
                <div class="card-body">
                    <h6 class="card-title">Paid Videos</h6>
                    <div class="paid-video-settings-alert"></div>
                    <form class="paid-video-settings" method="POST">
                        <label for="sell_videos_system">Paid videos system</label>
                        <div class="form-group">
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="sell_videos_system" id="sell_videos_system-enabled" value="on" <?php echo ($pt->config->sell_videos_system == 'on') ? 'checked': '';?>>
                                <label class="form-check-label" for="sell_videos_system-enabled">Enabled</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="sell_videos_system" id="sell_videos_system-disabled" value="off" <?php echo ($pt->config->sell_videos_system == 'off') ? 'checked': '';?>>
                                <label class="form-check-label" for="sell_videos_system-disabled" class="m-l-20">Disabled</label>
                            </div>
                        </div>
                        <label for="who_sell">Who can sell videos</label>
                        <div class="form-group">
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="who_sell" id="who_sell-enabled" value="users" <?php echo ($pt->config->who_sell == 'users') ? 'checked': '';?>>
                                <label class="form-check-label" for="who_sell-enabled">All users</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="who_sell" id="who_sell-disabled" value="pro_users" <?php echo ($pt->config->who_sell == 'pro_users') ? 'checked': '';?>>
                                <label class="form-check-label" for="who_sell-disabled" class="m-l-20">Pro members</label>
                            </div>
                        </div>
                        <label for="auto_approve_">Auto approve selling videos?</label>
                        <div class="form-group">
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="auto_approve_" id="auto_approve_-enabled" value="yes" <?php echo ($pt->config->auto_approve_ == 'yes') ? 'checked': '';?>>
                                <label class="form-check-label" for="auto_approve_-enabled">yes</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="auto_approve_" id="auto_approve_-disabled" value="no" <?php echo ($pt->config->auto_approve_ == 'no') ? 'checked': '';?>>
                                <label class="form-check-label" for="auto_approve_-disabled" class="m-l-20">no</label>
                            </div>
                        </div>
                        <label for="com_type">Commission Type</label>
                        <div class="form-group">
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="com_type" id="com_type-enabled" value="0" <?php echo ($pt->config->com_type == '0') ? 'checked': '';?>>
                                <label class="form-check-label" for="com_type-enabled">Fixed Price</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="com_type" id="com_type-disabled" value="1" <?php echo ($pt->config->com_type == '1') ? 'checked': '';?>>
                                <label class="form-check-label" for="com_type-disabled" class="m-l-20">Percentage</label>
                            </div>
                        </div>
                        <label for="demo_video">Create Demo Video <small>(its will not work if ffmpeg disabled)</small> </label>
                        <div class="form-group">
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="demo_video" id="demo_video-enabled" value="on" <?php echo ($pt->config->demo_video == 'on') ? 'checked': '';?>>
                                <label class="form-check-label" for="demo_video-enabled">Enabled</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="demo_video" id="demo_video-disabled" value="off" <?php echo ($pt->config->demo_video == 'off') ? 'checked': '';?>>
                                <label class="form-check-label" for="demo_video-disabled" class="m-l-20">Disabled</label>
                            </div>
                        </div>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Get Commission from sell videos <small>(Set to 0 if you don't want to get any commission)</small></label>
                                <input type="text" id="admin_com_sell_videos" name="admin_com_sell_videos" class="form-control" value="<?php echo ($pt->config->admin_com_sell_videos);?>">
                                
                            </div>
                        </div>
                        <label for="rent_videos_system">Rent videos system</label>
                        <div class="form-group">
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="rent_videos_system" id="rent_videos_system-enabled" value="on" <?php echo ($pt->config->rent_videos_system == 'on') ? 'checked': '';?>>
                                <label class="form-check-label" for="rent_videos_system-enabled">Enabled</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="rent_videos_system" id="rent_videos_system-disabled" value="off" <?php echo ($pt->config->rent_videos_system == 'off') ? 'checked': '';?>>
                                <label class="form-check-label" for="rent_videos_system-disabled" class="m-l-20">Disabled</label>
                            </div>
                        </div>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Get Commission from rent videos <small>(Set to 0 if you don't want to get any commission)</small></label>
                                <input type="text" id="admin_com_rent_videos" name="admin_com_rent_videos" class="form-control" value="<?php echo ($pt->config->admin_com_rent_videos);?>">
                                
                            </div>
                        </div>
                        <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">Videos Settings</h6>
                    <div class="all-video-settings-alert"></div>
                    <form class="all-video-settings" method="POST">
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Video pagination limit for each page</label>
                                <input type="number" id="videos_load_limit" name="videos_load_limit" class="form-control" value="<?php echo ($pt->config->videos_load_limit);?>" min="2" max="10000">
                                
                            </div>
                        </div>
                        <label for="trailer_system">Add Trailer With Movie</label>
                        <div class="form-group">
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="trailer_system" id="trailer_system-enabled" value="on" <?php echo ($pt->config->trailer_system == 'on') ? 'checked': '';?>>
                                <label class="form-check-label" for="trailer_system-enabled">Enabled</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="trailer_system" id="trailer_system-disabled" value="off" <?php echo ($pt->config->trailer_system == 'off') ? 'checked': '';?>>
                                <label class="form-check-label" for="trailer_system-disabled" class="m-l-20">Disabled</label>
                            </div>
                        </div>
                        <label for="restrict_embedding_system">Restrict A Video From Embedding</label>
                        <div class="form-group">
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="restrict_embedding_system" id="restrict_embedding_system-enabled" value="on" <?php echo ($pt->config->restrict_embedding_system == 'on') ? 'checked': '';?>>
                                <label class="form-check-label" for="restrict_embedding_system-enabled">Enabled</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="restrict_embedding_system" id="restrict_embedding_system-disabled" value="off" <?php echo ($pt->config->restrict_embedding_system == 'off') ? 'checked': '';?>>
                                <label class="form-check-label" for="restrict_embedding_system-disabled" class="m-l-20">Disabled</label>
                            </div>
                        </div>
                        <label for="video_text_system">Cards System</label>
                        <div class="form-group">
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="video_text_system" id="video_text_system-enabled" value="on" <?php echo ($pt->config->video_text_system == 'on') ? 'checked': '';?>>
                                <label class="form-check-label" for="video_text_system-enabled">Enabled</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input  class="form-check-input" type="radio" name="video_text_system" id="video_text_system-disabled" value="off" <?php echo ($pt->config->video_text_system == 'off') ? 'checked': '';?>>
                                <label class="form-check-label" for="video_text_system-disabled" class="m-l-20">Disabled</label>
                            </div>
                        </div>
                        <button type="submit" class="btn btn-primary m-t-15 waves-effect">Save</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
<script type="text/javascript">
    $(function() {
        var upload_settings = $('form.upload-settings');
        var player_settings = $('form.player-settings');
        

        upload_settings.ajaxForm({
            url: '{{LINK aj/ap/save-settings}}',
            beforeSend: function() {
                upload_settings.find('.waves-effect').text("{{LANG please_wait}}");
            },
            success: function(data) {
                if (data.status == 200) {
                    upload_settings.find('.waves-effect').text('Save');
                    $('.upload_settings-alert').html('<div class="alert alert-success"><i class="fa fa-check"></i> Settings updated successfully</div>');
                    setTimeout(function () {
                        $('.upload_settings-alert').empty();
                    }, 2000);
                }
            }
        });
        player_settings.ajaxForm({
            url: '{{LINK aj/ap/save-settings}}',
            beforeSend: function() {
                player_settings.find('.waves-effect').text("{{LANG please_wait}}");
            },
            success: function(data) {
                if (data.status == 200) {
                    player_settings.find('.waves-effect').text('Save');
                    $('.player_settings-alert').html('<div class="alert alert-success"><i class="fa fa-check"></i> Settings updated successfully</div>');
                    setTimeout(function () {
                        $('.player_settings-alert').empty();
                    }, 2000);
                }
            }
        });
        var stock_settings = $('form.stock-settings');

        stock_settings.ajaxForm({
            url: '{{LINK aj/ap/save-settings}}',
            beforeSend: function() {
                stock_settings.find('button').text("{{LANG please_wait}}");
            },
            success: function(data) {
                if (data.status == 200) {
                    stock_settings.find('button').text('Save');
                    $('.stock-settings-alert').html('<div class="alert alert-success"><i class="fa fa-check"></i> Settings updated successfully</div>');
                    setTimeout(function () {
                        $('.stock-settings-alert').empty();
                    }, 2000);
                }
            }
        });
        var form_paid_videos_settings = $('form.paid-video-settings');

        form_paid_videos_settings.ajaxForm({
            url: '{{LINK aj/ap/save-settings}}',
            beforeSend: function() {
                form_paid_videos_settings.find('button').text("{{LANG please_wait}}");
            },
            success: function(data) {
                if (data.status == 200) {
                    form_paid_videos_settings.find('button').text('Save');
                    $('.paid-video-settings-alert').html('<div class="alert alert-success"><i class="fa fa-check"></i> Settings updated successfully</div>');
                    setTimeout(function () {
                        $('.paid-video-settings-alert').empty();
                    }, 2000);
                }
            }
        });
        var form_all_videos_settings = $('form.all-video-settings');
        form_all_videos_settings.ajaxForm({
            url: '{{LINK aj/ap/save-settings}}',
            beforeSend: function() {
                form_all_videos_settings.find('button').text("{{LANG please_wait}}");
            },
            success: function(data) {
                if (data.status == 200) {
                    form_all_videos_settings.find('button').text('Save');
                    $('.all-video-settings-alert').html('<div class="alert alert-success"><i class="fa fa-check"></i> Settings updated successfully</div>');
                    setTimeout(function () {
                        $('.all-video-settings-alert').empty();
                    }, 2000);
                }
            }
        });
    });
</script>