
<?php $__env->startSection('head_title', trans('addpost.edit', ['type' => $post->title ]).' | '.getenvcong('sitename')); ?>
<?php $__env->startSection('modedefault', 'mode-add'); ?>
<?php $__env->startSection("header"); ?>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="/assets/plugins/editor/simditor.css">
    <link rel="stylesheet" href="/assets/plugins/selectize.css" data-theme="default">
    <link rel="stylesheet" href="/assets/plugins/selectize.default.css" data-theme="default">
<?php $__env->stopSection(); ?>

<?php $__env->startSection("content"); ?>
    <div class="buzz-container">

        <?php echo Form::open(array('action' => array('PostsController@CreateEditPost', $post->id), 'method' => 'POST', 'onsubmit' => 'return false', 'enctype' => 'multipart/form-data')); ?>

        <div class="global-container container add-container"  style="background: #fcfcfc;">

            <div class="content"  style="background: #fff;">

                <div class="question-post-form" data-type="<?php echo e($typene); ?>">
                    <fieldset>
                        <div class="clear"></div>
                        <section class="form">
                            <legend><?php echo e(trans('addpost.title')); ?></legend>
                            <div class="cd-form">

                                <?php echo Form::text('headline', $post->title, ['class' => 'cd-input title-input', 'style' => 'margin-bottom:10px', 'placeholder' => trans('addpost.titleplace')]); ?>

                                <select id="tagcats" class="demo-default" name="category" multiple placeholder="<?php echo e(trans('addpost.categories')); ?>">
                                    <?php foreach(\App\Categories::where('main', 1)->orwhere('main', 2)->orderBy('order')->get() as $ci => $categorys): ?>
                                        <optgroup label="<?php echo e($categorys->name); ?>">
                                            <option value="<?php echo e($categorys->id.','); ?>" <?php echo e(strpos($post->categories, '"'.$categorys->id.',"') ? 'selected' : ''); ?>><?php echo e($categorys->name); ?></option>
                                            <?php foreach(\App\Categories::where('type', $categorys->id)->orderBy('name')->get() as  $i => $cat): ?>
                                                <option value="<?php echo e($categorys->id .','. $cat->id.','); ?>"  <?php echo e(strpos($post->categories, '"'.$categorys->id .','. $cat->id.',"')  ? 'selected' : ''); ?>><b><?php echo e($categorys->name); ?></b> / <?php echo e($cat->name); ?></option>
                                                <?php foreach(\App\Categories::where('type', $cat->id)->orderBy('name')->get() as  $io => $catq): ?>
                                                    <option value="<?php echo e($categorys->id .','. $cat->id .','. $catq->id.','); ?>" <?php echo e(strpos($post->categories, '"'.$categorys->id .','. $cat->id.','. $catq->id.',"')  ? 'selected' : ''); ?>><strong><?php echo e($categorys->name); ?></strong> / <b><?php echo e($cat->name); ?></b> / <?php echo e($catq->name); ?></option>
                                                <?php endforeach; ?>
                                            <?php endforeach; ?>
                                        </optgroup>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                             <legend><?php echo e(trans('addpost.desc')); ?></legend>
                            <div class="cd-form">
                                <?php echo Form::textarea('description', $post->body , ['class' => 'cd-input ','style' => 'height:80px', 'placeholder' =>  trans('addpost.descplace')]); ?>

                            </div>

                        </section>
                        <?php if($typene=='list'): ?>
                        <section class="form">
                            <legend><?php echo e(trans('addpost.listtype')); ?></legend>
                            <div class="lists-types">
                                <a class="button <?php if($post->ordertype=='asc'): ?> button-gray selected <?php else: ?> button-white <?php endif; ?>" data-order="asc">
                                    <i class="fa fa-sort-numeric-asc"></i>
                                    <strong><?php echo e(trans('addpost.listasc')); ?></strong>
                                </a>
                                <a class=" button <?php if($post->ordertype=='desc'): ?> button-gray selected <?php else: ?> button-white <?php endif; ?>" data-order="desc">
                                    <i class="fa fa-sort-numeric-desc"></i>
                                    <strong><?php echo e(trans('addpost.listdesc')); ?></strong>
                                </a>
                                <a class=" button  <?php if($post->ordertype==null): ?> button-gray selected <?php else: ?> button-white <?php endif; ?> last" data-order="none">
                                    <i class="fa fa-list-ul"></i>
                                    <strong><?php echo e(trans('addpost.normallist')); ?></strong>
                                </a>

                            </div>
                        </section>
                        <?php endif; ?>

                        <?php if($typene=='quiz'): ?>
                            <section class="form" style="display: none">
                                <legend><?php echo e(trans('buzzyquiz.quiztype')); ?></legend>
                                <div class="lists-types">
                                    <a href="<?php echo e(action('PostsController@CreateNew', ['new'=>'quiz'])); ?>" class="button <?php echo e(Request::query('qtype')=='trivia' ?  'button-white' : 'button-gray selected'); ?>"  style="width:48%" data-order="persinalty">
                                        <i class="fa fa-info-circle"></i>
                                        <strong><?php echo trans('buzzyquiz.persinalty'); ?></strong>
                                    </a>
                                    <a href="<?php echo e(action('PostsController@CreateNew', ['new'=>'quiz', 'qtype'=>'trivia'])); ?>" class=" button <?php echo e(Request::query('qtype')=='trivia' ? 'button-gray selected' : 'button-white'); ?> last" style="width:48%" data-order="trivia">
                                        <i class="fa fa-check-circle"></i>
                                        <strong><?php echo trans('buzzyquiz.trivia'); ?></strong>
                                    </a>

                                </div>
                            </section>

                            <?php if($post->ordertype!=='trivia'): ?>
                            <section class="form last" id="addnew"  style="border-bottom: 1px solid #e3e3e3;">


                                <legend><?php echo e(trans('buzzyquiz.quizresults')); ?></legend>

                                <div id="results">
                                    <?php foreach($entrysquizresults as $key => $entry): ?>

                                    <?php echo $__env->make('_forms._buzzyquiz.__addresultform', ['entry' => $entry], array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

                                    <?php endforeach; ?>
                                </div>


                                <a class="submit-button button button-rosy button-big button-full postable" style="width:100%;float:none;padding-left:0;padding-right:0;" data-method="Get" data-target="results" data-puttype="append" data-type="resultform" href="<?php echo e(action('FormController@addnewform')); ?>?addnew=result" ><i class="fa fa-check-circle-o"></i><?php echo e(trans('addpost.add', ['type' => trans('buzzyquiz.result')])); ?></a>
                                <br><br><br><br>
                            </section>
                            <?php endif; ?>
                        <?php endif; ?>

                        <section class="form">
                            <legend><?php echo e(trans('addpost.entries', ['type' => "" ])); ?></legend>
                            <div id="entries">
                                <?php if($typene=='quiz'): ?>

                                    <?php foreach($entrysquizquest as $key => $entry): ?>

                                    <?php echo $__env->make('_forms._buzzyquiz.__addquestionform', ['entry' => $entry], array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

                                    <?php endforeach; ?>

                                <?php else: ?>

                                    <?php echo $__env->make('posts.editentrylistCreate', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

                                <?php endif; ?>
                            </div>
                            <?php if($typene=='quiz'): ?>
                                <a class="submit-button button button-blue button-full postable"  style="width:100%;float:none;padding-left:0;padding-right:0;" data-method="Get" data-target="entries" data-puttype="append" data-type="questionform" href="<?php echo e(action('FormController@addnewform')); ?>?addnew=question<?php echo e(Request::query('qtype')=='trivia' ? '&qtype=trivia' : ''); ?>"><i class="fa fa-question-circle"></i><?php echo e(trans('addpost.add', ['type' => trans('buzzyquiz.question')])); ?></a>


                                <div class="clear"></div>
                                <br><br><br>
                            <?php endif; ?>
                        </section>

                        <?php if ( ! ($typene=='quiz')): ?>
                        <section class="form last" id="addnew">
                            <?php echo $__env->make('posts.add-entry', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                        </section>
                        <?php endif; ?>
                        <div class="clear"></div>

                    </fieldset>

                </div>

            </div>
            <?php echo $__env->make('posts.create-sidebar', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>


        </div>
        <?php echo Form::close(); ?>

    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection("footer"); ?>
    <?php echo $__env->make('posts.create-footerjs', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make("app", array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>