

<?php $__env->startSection('content'); ?>
    
    <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
    <script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
    <style>
.video-control {
	
	left: 1em;
	/*min-width: 7.5em;*/
	padding: 0.2em 0.5em 0.5em 0.5em;
	border-radius: 9in;
	background: #FFF;
}

.video-control:not(.playing) .video-control-pause,
.video-control.playing .video-control-play {
	display: none;
}

.video-control-symbol
{
	font: 0.8em/0 Apple Color Emoji;
	vertical-align: -0.15em;
}
    </style>
    <div class="row">
        <div class="col-12">
            <div class="row">
        <div class="col-md-12">
          <div class="card">
            <div class="card-header pb-0">
              <div class="d-flex align-items-center">
                <p class="mb-0 font-weight-bolder">Edit Video Post</p>
                <label class="btn btn-<?php echo e($errors->first('iserror') == 'false' ? 'success' : 'primary'); ?> btn-sm ms-auto"><?php echo e($errors->first('response')); ?></label>
              </div>
            </div>
            <div class="card-body">
                <!--<img src="<?php echo e(asset('storage/images/test.jpg')); ?>">-->
                <form method="post" action=" <?php echo e(route('video.update',$video->id)); ?> " id="addform" enctype="multipart/form-data" >
                    <?php echo csrf_field(); ?>
                    <?php echo method_field('PUT'); ?>
                    <div class="row">
                        <div class="col-md-6">
                          <div class="form-group">
                            <label for="example-text-input" class="form-control-label">Name <b style="color:red"><?php echo e($errors->first('title')); ?></b></label>
                            <input class="form-control" name="title" type="text" value="<?php echo e($video->title); ?>" required>
                          </div>
                        </div>
                        <div class="col-md-6">
                          <div class="form-group">
                            <label for="example-text-input" class="form-control-label">Select Type</label>
                            
                            <select class="form-control" id="type" name="type" required>
                                <option value="festival" <?php if($video->type == "festival"): ?> selected <?php endif; ?>>Festival</option>
                                <option value="business" <?php if($video->type == "business"): ?> selected <?php endif; ?>>Business</option>
                                <option value="custom" <?php if($video->type == "custom"): ?> selected <?php endif; ?>>Custom</option>
                            </select>
                            
                          </div>
                        </div>
                        
                        <div class="col-md-6">
                          <div class="form-group">
                            <label for="example-text-input" class="form-control-label">Select Language <b style="color:red"><?php echo e($errors->first('language')); ?></b></label>
                            
                            <select class="form-control" name="language" required="required">
                                <?php $__currentLoopData = $languages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $language): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($language->language_code); ?>" <?php if($video->language == $language->language_code): ?> selected <?php endif; ?>><?php echo e($language->language_name); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                            
                          </div>
                        </div>
                        
                        <div class="col-md-6">
                          <div class="form-group" id="cate_lay">
                            <label for="example-text-input" class="form-control-label">Select Festival</label>
                            
                            <select class="form-control" id="category" name="category" required>
                                
                                <?php if($video->type == "festival"): ?>
                                
                                    <?php $__currentLoopData = $festivals; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $festival): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($festival->id); ?>" selected><?php echo e($festival->name); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    
                                <?php elseif($video->type == "business"): ?>
                                
                                    <?php $__currentLoopData = $business; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $festival): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($festival->id); ?>" selected><?php echo e($festival->name); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    
                                <?php elseif($video->type == "custom"): ?>
                                
                                    <?php $__currentLoopData = $custom; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $festival): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($festival->id); ?>" selected><?php echo e($festival->name); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    
                                <?php endif; ?>
                                
                            </select>
                            
                          </div>
                        </div>
                        
                        <div class="col-md-6">
                          <div class="form-group">
                            <label for="example-text-input" class="form-control-label">Video<b style="color:red"><?php echo e($errors->first('image_posts')); ?></b></label>
                            <input class="form-control" type="file" id="video" name="video" accept=".mp4" onchange="videoPreview()">
                          </div>
                        </div>
                        
                        <div class="card-body mt-n3">
                            <div class="mb" id="previewImages">
                                
                            <div class="bg-transparent">
                              <div style="height:240px;background-size: cover;" class="border-radius-xl">
                                  <div class="position-absolute">
                                      <video id="playerElement" class="border-radius-xl position-absolute" width="250" height="auto" style="background:gray;object-fit: cover;">
                                          <source id="videoplayer" src="<?php echo e(asset($video->item_url)); ?>">
                                      </video>
                                  <div class="card-body position-relative z-index-1 p-3">
                                      <a href="javascript:" class="video-control" id="PlayButton">
	                                    	<span class="video-control-play">
	                                    		<span class="video-control-symbol" aria-hidden="true">▶️</span>
	                                    		<span class="text-center text-uppercase text-secondary text-xxs font-weight-bolder">Play</span>
	                                    	</span>
	                                    	<span class="video-control-pause">
	                                    		<span class="video-control-symbol" aria-hidden="true">⏸</span>
	                                    		<span class="text-center text-uppercase text-secondary text-xxs font-weight-bolder">Pause</span>
	                                    	</span>
	                                  </a>
                                  </div>
                                  </div>
                                </div>
                             </div>
                     
                            </div>
                        </div>
                        
                    
                        <div class="col-md-12" >
                          <div class="form-group">
                              
                              <?php if(Session::get('admin_type') == "Demo"): ?>
                              <div class="btn btn-primary col-md-6 demo_action">Submit</div>
                              <?php else: ?>
                              <input class="btn btn-primary col-md-6" type="submit" value="Submit">
                              <?php endif; ?>
                            
                            
                          </div>
                        </div>
                     
                    </div>
                </form>
            </div>
          </div>
        </div>
        
      </div>
        </div>
    </div>
<!--<p class='remove pull-right bg-danger' style='cursor:pointer;position: absolute;top: 0px;right: 15px;padding: 6px 10px;' id='"+i+"'><i class='fa fa-close'></i></p>-->
<script type="text/javascript">

    const videoElement = document.getElementById('playerElement');
    const playPauseButton = document.getElementById('PlayButton');
    
    playPauseButton.addEventListener('click', () => {
    	playPauseButton.classList.toggle('playing');
    	if (playPauseButton.classList.contains('playing')) {
    		videoElement.play();
    	}
    	else {
    		videoElement.pause();
    	}
    });
    
    videoElement.addEventListener('ended', () => {
    	playPauseButton.classList.remove('playing');
    });


    $(document).ready(function(){
       $('#playerElement').bind('contextmenu',function() { return false; });
    });
    
    $('#playerElement').click(function () {
       var mediaVideo = $("#videoplayer").get(0);
       if (mediaVideo.paused) {
           mediaVideo.play();
       } else {
           mediaVideo.pause();
      }
    });

    $("#video").change(function () {
        
        var $source = $('#videoplayer');
        
        $source[0].src = URL.createObjectURL(this.files[0]);
        
        $source.parent()[0].load();
        
    });
    
    $("#type").change(function() {
        $('#cate_lay').empty();
        if($(this).find("option:selected").text() == "Custom")
        {
            $('#cate_lay').append(
                '<label for="example-text-input" class="form-control-label">Select Category</label>'+
                '<select name="category" class="form-control" required>'+
                '<option value="">Select Category</option><?php $__currentLoopData = $custom; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($c->id); ?>"><?php echo e($c->name); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select>');
            create_custom_dropdowns();
        }
        if($(this).find("option:selected").text() == "Festival")
        {
            $('#cate_lay').append(
                '<label for="example-text-input" class="form-control-label">Select Festival</label>'+
                '<select name="category" class="form-control" required>'+
                '<option value="">Select Category</option><?php $__currentLoopData = $festivals; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($c->id); ?>"><?php echo e($c->name); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select>');
            create_custom_dropdowns();
        }
        if($(this).find("option:selected").text() == "Business")
        {
            $('#cate_lay').append(
                '<label for="example-text-input" class="form-control-label">Select Business</label>'+
                '<select name="category" class="form-control" required>'+
                '<option value="">Select Category</option><?php $__currentLoopData = $business; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($c->id); ?>"><?php echo e($c->name); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select>');
            create_custom_dropdowns();
        }
    });
    
    $(document).ready(function () {
        create_custom_dropdowns();
    });

</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('main', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /www/wwwroot/posterbanao.com/resources/views/video/edit.blade.php ENDPATH**/ ?>