
<?php $__env->startSection('title', 'افزودن نوشته جدید'); ?>

<?php $__env->startSection('breadcrumb'); ?>
    <!-- start page title -->
    <div class="row">
        <div class="col-12">
            <div class="page-title-box">
                <div class="page-title-right">
                    <ol class="breadcrumb m-0">
                        <li class="breadcrumb-item"><a href="javascript: void(0);">پنل کاربری</a></li>
                        <li class="breadcrumb-item"><a href="<?php echo e(route('panel.users.index')); ?>">اخبار و سوالات متداول</a></li>
                        <li class="breadcrumb-item active">افزودن</li>
                    </ol>
                </div>
                <h4 class="page-title">افزودن نوشته جدید</h4>
            </div>
        </div>
    </div>
    <!-- end page title -->
<?php $__env->stopSection(); ?>

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

    <div class="row">
        <div class="col">
            <div class="card-box clearfix">
                <div class="card-header mb-3">
                    <h4 class="header-title">اطلاعات نوشته</h4>
                </div>
                <form action="<?php echo e(route('panel.posts.store')); ?>" method="post">
                    <?php echo csrf_field(); ?>
                    <div class="row">
                        <div class="col-sm-9">
                            <div class="p-1">
                                <div class="form-group">
                                    <label for="title" class="form-label">عنوان</label>
                                    <input type="text" name="title" class="form-control <?php $__errorArgs = ['title'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" id="title" placeholder="عنوان نوشته را وارد کنید" value="<?php echo e(old('title')); ?>" required/>
                                    <?php $__errorArgs = ['title'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <span class="invalid-feedback" role="alert">
                                        <strong><?php echo e($message); ?></strong>
                                    </span>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                                <div class="form-group">
                                    <label for="richtext">متن</label>
                                    <?php $__errorArgs = ['text'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <p class="text-danger" role="alert">
                                        <strong><?php echo e($message); ?></strong>
                                    </p>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                    <textarea name="text" class="form-control" id="richtext" cols="30" rows="20" placeholder="متن نوشته را وارد کنید"><?php echo e(old('text')); ?></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="post-side">
                                <div id="post-status" class="border-bottom border-white pb-2 mb-2">
                                    <h5 class="header-title pb-2">وضعیت</h5>
                                    <div class="custom-control custom-radio">
                                        <input type="radio" name="postStatus" value="public" id="public" class="custom-control-input" <?php echo e(old('postStatus') != 'draft' ? 'checked' : ''); ?>/>
                                        <label for="public" class="custom-control-label">عمومی</label>
                                    </div>
                                    <div class="custom-control custom-radio">
                                        <input type="radio" name="postStatus" id="draft" value="draft" class="custom-control-input" <?php echo e(old('postStatus') == 'draft' ? 'checked' : ''); ?>/>
                                        <label for="draft" class="custom-control-label">پیش نویس</label>
                                        <span class="remixicon-question-fill" data-toggle="tooltip" title="با انتخاب این گزینه نوشته شما به عنوان پیش نویس ذخیره خواهد و نمایش داده نمیشود"></span>
                                    </div>
                                </div>
                                <div id="post-type" class="pb-2 mb-1">
                                    <h5 class="header-title mb-2">نوع</h5>
                                    <div class="custom-control custom-radio">
                                        <input type="radio" name="postType" id="news" value="news" class="custom-control-input"  <?php echo e(old('postStatus') != 'faq' ? 'checked' : ''); ?>/>
                                        <label for="news" class="custom-control-label">اخبار</label>
                                    </div>
                                    <div class="custom-control custom-radio">
                                        <input type="radio" name="postType" id="faq" value="faq" class="custom-control-input" <?php echo e(old('postStatus') == 'faq' ? 'checked' : ''); ?>/>
                                        <label for="faq" class="custom-control-label">سوالات متداول</label>
                                    </div>
                                </div>
                                <button type="submit" class="btn btn-bordered-success btn-block waves-effect waves-light">ذخیره</button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div><!-- end col -->
    </div>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('script'); ?>
    <script src="<?php echo e(asset('assets/js/tinymce/tinymce.min.js')); ?>"></script>
    <script>
        tinymce.init({
            selector:'#richtext',
            directionality: 'rtl',
            language: 'fa_IR',
            content_css: '<?php echo e(asset('assets/css/app-rtl.min.css')); ?>',
            plugins: "link,image",
            image_uploadtab: true,
            menubar: 'edit insert view format table',
            plugins: [
                "advlist autolink lists link image charmap preview hr anchor pagebreak",
                "searchreplace wordcount visualblocks visualchars code fullscreen",
                "insertdatetime media save table contextmenu directionality",
                "paste textcolor colorpicker textpattern"
            ],
            toolbar: "insertfile undo redo | formatselect styleselect | bold italic strikethrough forecolor backcolor permanentpen formatpainter | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media | fullscreen code",
            images_upload_handler: function (blobInfo, success, failure) {
                var xhr, formData;

                xhr = new XMLHttpRequest();
                xhr.withCredentials = false;
                xhr.open('POST', '<?php echo e(route('panel.posts.addMedia')); ?>');

                xhr.onload = function() {
                    var json;

                    if (xhr.status != 200) {
                        failure('HTTP Error: ' + xhr.status);
                        return;
                    }

                    json = JSON.parse(xhr.responseText);

                    if (!json || typeof json.location != 'string') {
                        failure('Invalid JSON: ' + xhr.responseText);
                        return;
                    }

                    success(json.location);
                };

                formData = new FormData();
                formData.append('file', blobInfo.blob(), blobInfo.filename());
                formData.append('_token', '<?php echo e(csrf_token()); ?>');

                xhr.send(formData);
            }
        })
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/iphoneun/public_html/peygirsho.ir/patronic/resources/views/panel/posts/add.blade.php ENDPATH**/ ?>