

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


<?php if(session('slide_update_msg')): ?>
<div class="alert alert-success">
    <?php echo e(session('slide_update_msg')); ?>

</div>
<?php endif; ?>

<h2 class="mb-3"><?php echo e(awtTrans('تعديل الاعلان')); ?></h2>

<div class="row">
    <div class="col-lg-12">
        <?php echo Form::model($slider, ['method' => 'PATCH', 'route' => ['admin.sliders.update', $slider->id]  , 'enctype' => 'multipart/form-data']); ?>


        <div class="row">
            <div class="form-group col-lg-6">
                <?php echo Form::label('title_ar', awtTrans('Title Arabic')); ?>

                <?php echo Form::text('title_ar', null, ['class' => 'form-control']); ?>

                <small class="text-danger"><?php echo e($errors->first('title_ar')); ?></small>
            </div>

            <div class="form-group col-lg-6">
                <?php echo Form::label('title_en', awtTrans('Title English')); ?>

                <?php echo Form::text('title_en', null, ['class' => 'form-control']); ?>

                <small class="text-danger"><?php echo e($errors->first('title_en')); ?></small>
            </div>
        </div>

        <div class="row">

            <div class="form-group col-lg-6">
                <?php echo Form::label('desc_ar', awtTrans('Description Arabic')); ?>

                <?php echo Form::textarea('desc_ar', null, [ 'class' => 'form-control tinyEditor']); ?>

                <small class="text-danger"><?php echo e($errors->first('desc_ar')); ?></small>
            </div>

            <div class="form-group col-lg-6">
                <?php echo Form::label('desc_en', awtTrans('Description English')); ?>

                <?php echo Form::textarea('desc_en', null, [ 'class' => 'form-control tinyEditor']); ?>

                <small class="text-danger"><?php echo e($errors->first('desc_en')); ?></small>
            </div>

        </div>

        <div class="row">

            <div class="form-group col-lg-12">
                <?php echo Form::label('link', awtTrans('رابط الاعلان')); ?>

                <?php echo Form::text('link', null, ['class' => 'form-control']); ?>

                <small class="text-danger"><?php echo e($errors->first('link')); ?></small>
            </div>

        </div>


        <div class="row">
            <div class="form-group col-lg-6">
                <label for="radio_image"><?php echo e(awtTrans('الصورة')); ?></label>
                <input type="radio" name="check_vedio_or_image" class="check_vedio_or_image" id="radio_image" <?php echo e($slider->type == 'image' ? 'checked' : ''); ?> value="image">
            </div>
            <div class="form-group col-lg-6">
                <label for="radio_video"><?php echo e(awtTrans('الفيديو')); ?></label>
                <input type="radio" name="check_vedio_or_image" class="check_vedio_or_image" id="radio_video" <?php echo e($slider->type == 'device' || $slider->type == 'youtube' ? 'checked' : ''); ?> value="video">
            </div>
            <small class="text-danger"><?php echo e($errors->first('check_vedio_or_image')); ?></small>
            <small class="text-danger"><?php echo e($errors->first('type_video')); ?></small>
            <small class="text-danger"><?php echo e($errors->first('video_youtube')); ?></small>
            <small class="text-danger"><?php echo e($errors->first('video_device')); ?></small>
        </div>


        <div class="row" id="append_image_or_video">

            <div class="form-group col-lg-12" id="file_image" style="<?php echo e($slider->type == 'image' ? 'display: block;' : 'display: none;'); ?>">
                <?php echo Form::label('photo', awtTrans('الصورة')); ?>

                <div class="input-group">
                    <span class="input-group-btn">
                        <a id="lfm" data-input="photo" data-preview="photo" class="btn btn-secondary text-white px-4" style="border-top-right-radius: 0;border-bottom-right-radius: 0;border-top-left-radius: 0;border-bottom-left-radius: 0;">
                            <i class="fa fa-picture-o"></i> <?php echo e(awtTrans('اختر الصورة')); ?>

                        </a>
                    </span>
                    <input type="text" name="photo" class="form-control photo <?php echo e($errors->has('photo') ? 'is-invalid' : ''); ?>" value="<?php echo e($slider->type == 'image' ? $slider->photo : ''); ?>" readonly>
                </div>
                <div class="mb-3 mt-3 d-block slider-holder photo" id="photo">
                    <img width="100" src="<?php echo e($slider->type == 'image' ? $slider->photo : ''); ?>" alt="">
                </div>
                <small class="text-danger"><?php echo e($errors->first('photo')); ?></small>
            </div>

            <div class="col-lg-12 row" id="file_video_or_youtube" style="<?php echo e($slider->type == 'youtube' || $slider->type == 'device' ? 'display: block;' : 'display: none;'); ?>">
                <div class="form-group col-lg-6">
                    <label for="video_youtube"><?php echo e(awtTrans('فيديو من اليوتيوب')); ?></label>
                    <input type="radio" name="type_video" class="type_video" id="video_youtube" <?php echo e($slider->type == 'youtube' ? 'checked' : ''); ?> value="youtube">
                </div>
                <div class="form-group col-lg-6">
                    <label for="video_device"><?php echo e(awtTrans('فيديو من الجهاز')); ?></label>
                    <input type="radio" name="type_video" class="type_video" id="video_device" <?php echo e($slider->type == 'device' ? 'checked' : ''); ?> value="device">
                </div>
            </div>

            <div class="col-lg-12 row" id="device" style="<?php echo e($slider->type == 'device' ? 'display: block;' : 'display: none;'); ?>">
                <div class="form-group col-lg-12">
                    <label for="video_device"><?php echo e(awtTrans('الفيديو')); ?></label>
                    <input type="file" accept="video/mp4" name="video_device" class="form-control">
                    <?php if($slider->type == 'device'): ?>
                    <video width="300px" controls>
                        <source src="<?php echo e(url($slider->photo)); ?>" type="video/mp4">
                        <source src="<?php echo e(url($slider->photo)); ?>" type="video/ogg">
                    </video>
                    <?php endif; ?>
                </div>
            </div>

            <div class="col-lg-12 row" id="youtube" style="<?php echo e($slider->type == 'youtube' ? 'display: block;' : 'display: none;'); ?>">
                <div class="form-group col-lg-12">
                    <label for=""><?php echo e(awtTrans('فيديو من اليوتيوب')); ?></label>
                    <input type="url" name="video_youtube" value="<?php echo e($slider->type == 'youtube' ? $slider->photo : ''); ?>" class="form-control">
                    <?php if($slider->type == 'youtube'): ?>
                    <?php
                    $url = $slider->photo;
                    $url_components = parse_url($url);
                  
                    if($url_components['path'] != ""){
                        parse_str($url_components['query'], $params);
                        $key = $params['v'];
                    } else {
                        $key = '';
                    }
                    ?>
                    <iframe width="400" height="200" src="https://www.youtube.com/embed/<?php echo e($key); ?>" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
                    <?php endif; ?>
                </div>
            </div>

        </div>

        <div class="row">

            <div class="form-group col-lg-12">
                <button type="button" class="btn btn-info btn-block" id="add-keyword"><i class="fas fa-plus"></i></button>
            </div>
        </div>

        <div class="row" id="append-keyword">

            <?php if($slider->keywords->isNotEmpty()): ?>
            <?php $__currentLoopData = $slider->keywords; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $keyword): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <?php if($key == 0): ?>

            <div class="row col-lg-12">


                <div class="form-group col-lg-5">
                    <lable for="keyword_ar">الكلمات المفتاحية بالعربي</lable>
                    <input type="text" name="keyword_ar[]" value="<?php echo e($keyword->body_ar); ?>" class="form-control" />
                </div>

                <div class="form-group col-lg-5">
                    <lable for="keyword_en">الكلمات المفتاحية بالانجليزي</lable>
                    <input type="text" name="keyword_en[]" value="<?php echo e($keyword->body_en); ?>" class="form-control" />
                </div>


            </div>

            <?php else: ?>

            <div class="row col-lg-12">


                <div class="form-group col-lg-5">
                    <lable for="keyword_ar">الكلمات المفتاحية بالعربي</lable>
                    <input type="text" name="keyword_ar[]" value="<?php echo e($keyword->body_ar); ?>" class="form-control" />
                </div>

                <div class="form-group col-lg-5">
                    <lable for="keyword_en">الكلمات المفتاحية بالانجليزي</lable>
                    <input type="text" name="keyword_en[]" value="<?php echo e($keyword->body_en); ?>" class="form-control" />
                </div>

                <div class="form-group col-lg-2">
                    <lable for="keyword_en">حذف</lable>
                    <button type="button" class="btn btn-danger btn-block" id="delete-keyword"><i class="fas fa-trash"></i></button>
                </div>

            </div>
            <?php endif; ?>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            <?php endif; ?>
        </div>

        <?php echo Form::submit(awtTrans('تعديل الاعلان'), ['class' => 'btn btn-success']); ?>

        <a href="<?php echo e(route('admin.sliders.index')); ?>" class="btn btn-primary"> <i class="fas fa-arrow-left    "></i> <?php echo e(awtTrans('Back')); ?></a>

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

    </div>
</div>



<?php $__env->stopSection(); ?>
<?php $__env->startSection('scripts'); ?>
<script src="<?php echo e(url('dashboard/forms/sliders/create.js')); ?>"></script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/sitejadara/public_html/ics/resources/views/admin/sliders/edit.blade.php ENDPATH**/ ?>