<?php $__env->startSection('title', 'Paid services - Create'); ?>

<?php $__env->startSection('content_header', 'Paid services <small>create new paid service</small>'); ?>

<?php $__env->startSection('content'); ?>
    <div class="row">
        <section class="col-lg-12">
            <div class="nav-tabs-custom">
                <ul class="nav nav-tabs box-tools">
                    <li class="active"><a href="<?php echo e(route('admin.paid_services.create')); ?>">Create</a></li>
                    <li class="pull-right"><a href="<?php echo e(route('admin.paid_services.index')); ?>" class="btn btn-box-tool" data-toggle="tooltip" title="Back to list" data-widget="chat-pane-toggle" data-original-title="Back to list"><i class="fa fa-arrow-left"></i> Back to list</a></li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active">
                        <form class="form-horizontal" method="POST" action="<?php echo e(route('admin.paid_services.store')); ?>">
                            <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
                            <?php if(count($errors) > 0): ?>
                                <div class="alert alert-danger alert-dismissable">
                                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                    <h4><i class="icon fa fa-ban"></i> <strong>Whoops!</strong> There were some problems with your input.</h4>
                                    <ul>
                                        <?php foreach($errors->all() as $error): ?>
                                            <li><?php echo e($error); ?></li>
                                        <?php endforeach; ?>
                                    </ul>
                                </div>
                            <?php endif; ?>
                            <div class="form-group <?php if($errors->has('active')): ?> has-error <?php endif; ?>">
                                <label class="col-sm-2 control-label"></label>
                                <div class="col-sm-10">
                                    <div class="checkbox">
                                        <label>
                                            <input name="active" type="hidden" value="0">
                                            <input name="active" type="checkbox" value="1" <?php if(old('active')): ?> checked <?php endif; ?>>
                                            Active
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group <?php if($errors->has('type')): ?> has-error <?php endif; ?>">
                                <label for="selectType" class="col-sm-2 control-label">Type</label>
                                <div class="col-sm-10">
                                    <select name="type" id="selectType" class="form-control">
                                        <option value="">-- select --</option>
                                        <option value="featured" <?php if(old('type') == 'featured'): ?> selected <?php endif; ?>>featured</option>
                                        <option value="activation" <?php if(old('type') == 'activation'): ?> selected <?php endif; ?>>activation</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group <?php if($errors->has('title')): ?> has-error <?php endif; ?>">
                                <label for="inputTitle" class="col-sm-2 control-label">Title</label>
                                <div class="col-sm-10">
                                    <input name="title" type="text" class="form-control" id="inputTitle" value="<?php echo e(old('title')); ?>">
                                </div>
                            </div>
                            <div class="form-group <?php if($errors->has('description')): ?> has-error <?php endif; ?>">
                                <label for="inputDescription" class="col-sm-2 control-label">Description</label>
                                <div class="col-sm-10">
                                    <textarea name="description" type="text" class="form-control" id="inputDescription"><?php echo e(old('description')); ?></textarea>
                                </div>
                            </div>
                            <div class="form-group <?php if($errors->has('price')): ?> has-error <?php endif; ?>">
                                <label for="inputPrice" class="col-sm-2 control-label">Price</label>
                                <div class="col-sm-10">
                                    <input name="price" type="text" class="form-control <?php if((bool) old('free', false) == true): ?> hidden <?php endif; ?>" id="inputPrice" value="<?php echo e(old('price')); ?>">
                                    <div class="checkbox">
                                        <label>
                                            <input name="free" type="hidden" value="0">
                                            <input name="free" type="checkbox" value="1" id="checkboxFree" <?php if(old('free')): ?> checked <?php endif; ?>>
                                            Free of charge
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div id="configurationContainer" <?php if((bool) old('type', '') == ''): ?> class="hidden" <?php endif; ?>>
                                <hr>
                                <div id="featuredConfiguration" class="configuration-container <?php if(old('type', '') != 'featured'): ?> hidden <?php endif; ?> "><?php echo $__env->make('admin.paid_services._config.featured', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?></div>
                                <div id="activationConfiguration" class="configuration-container <?php if(old('type', '') != 'activation'): ?> hidden <?php endif; ?> "><?php echo $__env->make('admin.paid_services._config.activation', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?></div>
                            </div>
                            <hr>
                            <div class="clearfix">
                                <div class="pull-right">
                                    <button type="submit" class="btn btn-success">Save</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </section>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('bottom_scripts'); ?>
    <script type="text/javascript">

        $(document).ready(function () {

            $type = $("#selectType");

            $type.on({
                change: function (e) {
                    var value = $(this).val();

                    $configuration = $("#configurationContainer");

                    $(".configuration-container").addClass("hidden");

                    if (value == '') {
                        $configuration.addClass("hidden");
                    } else {
                        $configuration.removeClass("hidden");

                        $("#" + value + "Configuration").removeClass("hidden");
                    }
                }
            });

            $("#checkboxFree").on("change", function () {
                if ($(this).is(":checked")) {
                    $("#inputPrice").addClass("hidden");
                } else {

                    $("#inputPrice").removeClass("hidden");
                }
            });

        });

    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>