<?php $__env->startSection('title'); ?> <?php if( ! empty($title)): ?> <?php echo e($title); ?> | <?php endif; ?> ##parent-placeholder-3c6de1b7dd91465d437ef415f94f36afc1fbc8a8## <?php $__env->stopSection(); ?>


<?php $__env->startSection('main'); ?>

        <div id="wrapper">

            <?php echo $__env->make('admin.sidebar_menu', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>

            <div id="page-wrapper">
                <?php if( ! empty($title)): ?>
                    <div class="row">
                        <div class="col-lg-12">
                            <h1 class="page-header"> <?php echo e($title); ?>  </h1>
                        </div> <!-- /.col-lg-12 -->
                    </div> <!-- /.row -->
                <?php endif; ?>

                <div class="row">
                    <div class="col-md-10 col-xs-12">

                        <?php echo e(Form::open(['route'=>'save_settings','class' => 'form-horizontal', 'files' => true])); ?>

                        <div class="form-group <?php echo e($errors->has('default_storage')? 'has-error':''); ?>">
                            <label for="default_storage" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.default_storage'); ?></label>
                            <div class="col-sm-8">
                                <label>
                                    <input type="radio" name="default_storage" value="public" <?php echo e(get_option('default_storage') == 'public'? 'checked' :''); ?> /> <?php echo app('translator')->getFromJson('app.local_server'); ?> <small class="text-info"> (<?php echo app('translator')->getFromJson('app.local_server_help_text'); ?>) </small>
                                </label> <br />
                                <label>
                                    <input type="radio" name="default_storage" value="s3" <?php echo e(get_option('default_storage') == 's3'? 'checked' :''); ?> /> <?php echo app('translator')->getFromJson('app.amazon_s3'); ?> <small class="text-info"> (<?php echo app('translator')->getFromJson('app.amazon_s3_help_text'); ?>) </small>
                                </label>

                            </div>
                        </div>


                        <div class="amazon_s3_settings_wrap" style="display: <?php echo e(get_option('default_storage') == 's3' ? 'block':'none'); ?>;">

                            <hr />
                            <div class="form-group">
                                <label for="amazon_key" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.amazon_key'); ?></label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" id="amazon_key" value="<?php echo e(get_option('amazon_key')); ?>" name="amazon_key" placeholder="<?php echo app('translator')->getFromJson('app.amazon_key'); ?>">
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="amazon_secret" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.amazon_secret'); ?></label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" id="amazon_secret" value="<?php echo e(get_option('amazon_secret')); ?>" name="amazon_secret" placeholder="<?php echo app('translator')->getFromJson('app.amazon_secret'); ?>">
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="amazon_region" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.amazon_region'); ?></label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" id="amazon_region" value="<?php echo e(get_option('amazon_region')); ?>" name="amazon_region" placeholder="<?php echo app('translator')->getFromJson('app.amazon_region'); ?>">
                                    <a href="http://docs.aws.amazon.com/general/latest/gr/rande.html" target="_blank"><?php echo app('translator')->getFromJson('app.amazon_region_help'); ?></a>
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="bucket" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.bucket'); ?></label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" id="bucket" value="<?php echo e(get_option('bucket')); ?>" name="bucket" placeholder="<?php echo app('translator')->getFromJson('app.bucket'); ?>">
                                </div>
                            </div>


                        </div>


                        <hr />

                        <div class="form-group">
                            <div class="col-sm-offset-4 col-sm-8">
                                <button type="submit" id="settings_save_btn" class="btn btn-primary"><?php echo app('translator')->getFromJson('app.save_settings'); ?></button>
                            </div>
                        </div>

                        <?php echo e(Form::close()); ?>

                    </div>
                </div>

            </div>   <!-- /#page-wrapper -->

        </div>   <!-- /#wrapper -->
<?php $__env->stopSection(); ?>


<?php $__env->startSection('page-js'); ?>
    <script>
        $(document).ready(function(){

            $('input[type="checkbox"], input[type="radio"]').click(function(){
                var input_name = $(this).attr('name');
                var input_value = 0;
                if ($(this).prop('checked')){
                    input_value = $(this).val();
                }
                $.ajax({
                    url : '<?php echo e(route('save_settings')); ?>',
                    type: "POST",
                    data: { [input_name]: input_value, '_token': '<?php echo e(csrf_token()); ?>' },
                });
            });


            $('input[name="default_storage"]').click(function(){
                var default_storage = $(this).val();

                if (default_storage == 's3'){
                    $('.amazon_s3_settings_wrap').slideDown('slow');
                } else {
                    $('.amazon_s3_settings_wrap').slideUp();
                }
            });

            /**
             * Send settings option value to server
             */
            $('#settings_save_btn').click(function(e){
                e.preventDefault();

                var this_btn = $(this);
                this_btn.attr('disabled', 'disabled');

                var form_data = this_btn.closest('form').serialize();
                $.ajax({
                    url : '<?php echo e(route('save_settings')); ?>',
                    type: "POST",
                    data: form_data,
                    success : function (data) {
                        if (data.success == 1){
                            this_btn.removeAttr('disabled');
                            toastr.success(data.msg, '<?php echo app('translator')->getFromJson('app.success'); ?>', toastr_options);
                        }
                    }
                });
            });

        });
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout.main', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>