<?php if(!empty($event->language) && $event->language->rtl == 1): ?>
<?php $__env->startSection('styles'); ?>
<style>
    form input,
    form textarea,
    form select {
        direction: rtl;
    }
    form .note-editor.note-frame .note-editing-area .note-editable {
        direction: rtl;
        text-align: right;
    }
</style>
<?php $__env->stopSection(); ?>
<?php endif; ?>

<?php $__env->startSection('content'); ?>
  <div class="page-header">
    <h4 class="page-title">Edit Event</h4>
    <ul class="breadcrumbs">
      <li class="nav-home">
        <a href="<?php echo e(route('admin.dashboard')); ?>">
          <i class="flaticon-home"></i>
        </a>
      </li>
      <li class="separator">
        <i class="flaticon-right-arrow"></i>
      </li>
      <li class="nav-item">
        <a href="#">Event Page</a>
      </li>
      <li class="separator">
        <i class="flaticon-right-arrow"></i>
      </li>
      <li class="nav-item">
        <a href="#">Edit Event</a>
      </li>
    </ul>
  </div>
  <div class="row">
    <div class="col-md-12">
      <div class="card">
        <div class="card-header">
          <div class="card-title d-inline-block">Edit Event</div>
          <a class="btn btn-info btn-sm float-right d-inline-block" href="<?php echo e(route('admin.event.index') . '?language=' . request()->input('language')); ?>">
            <span class="btn-label">
              <i class="fas fa-backward" style="font-size: 12px;"></i>
            </span>
            Back
          </a>
        </div>
        <div class="card-body pt-5 pb-5">
          <div class="row">
            <div class="col-lg-6 offset-lg-3">
                
                
                
                
              <form id="ajaxForm" class="" action="<?php echo e(route('admin.event.update')); ?>" method="post">
                <?php echo csrf_field(); ?>
                <input type="hidden" name="event_id" value="<?php echo e($event->id); ?>">
                <input type="hidden" name="lang_id" value="<?php echo e($event->lang_id); ?>">
                
                <div class="form-group">
                    <label for="">Video ** </label>
                    <br>
                    <div class="video-preview" id="videoPreview1">
                        <video width="320" height="240" controls id="video_src">
                            <source src="<?php echo e(asset("assets/front/img/events/videos/".$event->video)); ?>" type="video/mp4">
                        </video>
                    </div>
                    <br>


                    <input id="fileInput1" type="hidden" name="video">
                    <button id="chooseVideo1" class="choose-video btn btn-primary" type="button" data-multiple="false" data-video="true" data-toggle="modal" data-target="#lfmModal1">Choose Video</button>


                    <p class="text-warning mb-0">MP4 video is allowed</p>
                    <p class="em text-danger mb-0" id="errvideo"></p>

                    <!-- Video LFM Modal -->
                    <div class="modal fade lfm-modal" id="lfmModal1" tabindex="-1" role="dialog" aria-labelledby="lfmModalTitle" aria-hidden="true">
                        <i class="fas fa-times-circle"></i>
                        <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
                            <div class="modal-content">
                                <div class="modal-body p-0">
                                    <iframe src="<?php echo e(url('laravel-filemanager')); ?>?serial=1" style="width: 100%; height: 500px; overflow: hidden; border: none;"></iframe>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                

                
                <div class="row">
                    <div class="col-12">
                        <div class="form-group">
                            <label for="">Slider Images ** </label>
                            <br>
                            <div class="slider-thumbs" id="sliderThumbs2">

                            </div>

                            <input id="fileInput2" type="hidden" name="slider" value="" />
                            <button id="chooseImage2" class="choose-image btn btn-primary" type="button" data-multiple="true" data-toggle="modal" data-target="#lfmModal2">Choose Images</button>


                            <p class="text-warning mb-0">JPG, PNG, JPEG images are allowed</p>
                            <p id="errslider" class="mb-0 text-danger em"></p>

                            <!-- slider LFM Modal -->
                            <div class="modal fade lfm-modal" id="lfmModal2" tabindex="-1" role="dialog" aria-labelledby="lfmModalTitle" aria-hidden="true">
                                <i class="fas fa-times-circle"></i>
                                <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
                                    <div class="modal-content">
                                        <div class="modal-body p-0">
                                            <iframe id="lfmIframe2" src="<?php echo e(url('laravel-filemanager')); ?>?serial=2&event=<?php echo e($event->id); ?>" style="width: 100%; height: 500px; overflow: hidden; border: none;"></iframe>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                

                <div class="form-group">
                  <label for="">Title **</label>
                  <input type="text" class="form-control" name="title" value="<?php echo e($event->title); ?>" placeholder="Enter title">
                  <p id="errtitle" class="mb-0 text-danger em"></p>
                </div>
                <div class="form-group">
                  <label for="">Category **</label>
                  <select class="form-control" name="cat_id">
                    <option value="" selected disabled>Select a category</option>
                    <?php $__currentLoopData = $event_categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $event_category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                      <option value="<?php echo e($event_category->id); ?>" <?php echo e($event_category->id == $event->eventCategories->id ? 'selected' : ''); ?>><?php echo e($event_category->name); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  </select>
                  <p id="errcat_id" class="mb-0 text-danger em"></p>
                </div>
                <div class="form-group">
                  <label for="">Content **</label>
                  <textarea class="form-control summernote" name="content" data-height="300" placeholder="Enter content"><?php echo e(replaceBaseUrl($event->content)); ?></textarea>
                  <p id="errcontent" class="mb-0 text-danger em"></p>
                </div>
                  <div class="form-group">
                      <label for="">Date</label>
                      <input type="date" class="form-control ltr" name="date" value="<?php echo e($event->date); ?>" placeholder="Enter Event Date">
                      <p id="errdate" class="mb-0 text-danger em"></p>
                  </div>
                  <div class="form-group">
                      <label for="">Time</label>
                      <input type="time" class="form-control ltr" name="time" value="<?php echo e(\Carbon\Carbon::parse($event->time)->format('H:i:s')); ?>" placeholder="Enter Event Time">
                      <p id="errtime" class="mb-0 text-danger em"></p>
                  </div>
                  <div class="form-group">
                      <label for="">Cost (in <?php echo e($abx->base_currency_text); ?>) **</label>
                      <input type="number" class="form-control ltr" name="cost" value="<?php echo e($event->cost); ?>" placeholder="Enter Ticket Cost">
                      <p id="errcost" class="mb-0 text-danger em"></p>
                  </div>
                <div class="form-group">
                  <label for="">Available Tickets **</label>
                  <input type="number" class="form-control ltr" name="available_tickets" value="<?php echo e($event->available_tickets); ?>" placeholder="Enter Number of available tickets">
                  <p id="erravailable_tickets" class="mb-0 text-danger em"></p>
                </div>
                  <div class="form-group">
                      <label for="">Organizer</label>
                      <input type="text" class="form-control ltr" name="organizer" value="<?php echo e($event->organizer); ?>" placeholder="Event Organizer">
                      <p id="errorganizer" class="mb-0 text-danger em"></p>
                  </div>
                  <div class="form-group">
                      <label for="">Organizer Email</label>
                      <input type="text" class="form-control ltr" name="organizer_email" value="<?php echo e($event->organizer_email); ?>" placeholder="Organizer Email">
                      <p id="errorganizer_email" class="mb-0 text-danger em"></p>
                  </div>
                  <div class="form-group">
                      <label for="">Organizer Phone</label>
                      <input type="text" class="form-control ltr" name="organizer_phone" value="<?php echo e($event->organizer_phone); ?>" placeholder="Organizer Email">
                      <p id="errorganizer_phone" class="mb-0 text-danger em"></p>
                  </div>
                  <div class="form-group">
                      <label for="">Organizer Website</label>
                      <input type="text" class="form-control ltr" name="organizer_website" value="<?php echo e($event->organizer_website); ?>" placeholder="Organizer Website">
                      <p id="errserial_number" class="mb-0 text-danger em"></p>
                  </div>
                  <div class="form-group">
                      <label for="">Venue</label>
                      <input type="text" class="form-control ltr" name="venue" value="<?php echo e($event->venue); ?>" placeholder="Enter Venue">
                      <p id="errvenue" class="mb-0 text-danger em"></p>
                  </div>
                  <div class="form-group">
                      <label for="">Venue Location</label>
                      <input type="text" class="form-control ltr" name="venue_location" value="<?php echo e($event->venue_location); ?>" placeholder="Venue Location">
                      <p id="errvenue_location" class="mb-0 text-danger em"></p>
                  </div>
                  <div class="form-group">
                      <label for="">Venue Phone</label>
                      <input type="text" class="form-control ltr" name="venue_phone" value="<?php echo e($event->venue_phone); ?>" placeholder="Venue Phone">
                      <p id="errvenue_phone" class="mb-0 text-danger em"></p>
                  </div>
                <div class="form-group">
                  <label for="">Meta Keywords</label>
                  <input type="text" class="form-control" name="meta_tags" value="<?php echo e($event->meta_tags); ?>" data-role="tagsinput">
                  <p id="errmeta_keywords" class="mb-0 text-danger em"></p>
                </div>
                <div class="form-group">
                  <label for="">Meta Description</label>
                  <textarea type="text" class="form-control" name="meta_description" rows="5"><?php echo e($event->meta_description); ?></textarea>
                  <p id="errmeta_description" class="mb-0 text-danger em"></p>
                </div>
              </form>
            </div>
          </div>
        </div>
        <div class="card-footer">
          <div class="form">
            <div class="form-group from-show-notify row">
              <div class="col-12 text-center">
                <button type="submit" id="submitBtn" class="btn btn-success">Update</button>
              </div>
            </div>
          </div>
        </div>
      </div>

    </div>
  </div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('scripts'); ?>
    <script>
        $(document).ready(function() {
            $("select[name='lang_id']").on('change', function() {
                $("#bcategory").removeAttr('disabled');
                let langid = $(this).val();
                let url = "<?php echo e(url('/')); ?>/admin/event/" + langid + "/get-categories";
                $.get(url, function(data) {
                    console.log(data);
                    let options = `<option value="" disabled selected>Select a category</option>`;
                    for (let i = 0; i < data.length; i++) {
                        options += `<option value="${data[i].id}">${data[i].name}</option>`;
                    }
                    $("#bcategory").html(options);

                });
            });

            // make input fields RTL
            $("select[name='lang_id']").on('change', function() {
                $(".request-loader").addClass("show");
                let url = "<?php echo e(url('/')); ?>/admin/rtlcheck/" + $(this).val();
                $.get(url, function(data) {
                    $(".request-loader").removeClass("show");
                    if (data == 1) {
                        $("form input").each(function() {
                            if (!$(this).hasClass('ltr')) {
                                $(this).addClass('rtl');
                            }
                        });
                        $("form select").each(function() {
                            if (!$(this).hasClass('ltr')) {
                                $(this).addClass('rtl');
                            }
                        });
                        $("form textarea").each(function() {
                            if (!$(this).hasClass('ltr')) {
                                $(this).addClass('rtl');
                            }
                        });
                        $("form .summernote").each(function() {
                            $(this).siblings('.note-editor').find('.note-editable').addClass('rtl text-right');
                        });

                    } else {
                        $("form input, form select, form textarea").removeClass('rtl');
                        $("form.modal-form .summernote").siblings('.note-editor').find('.note-editable').removeClass('rtl text-right');
                    }
                })
            });

            // translatable portfolios will be available if the selected language is not 'Default'
            $("#language").on('change', function() {
                let language = $(this).val();
                if (language == 0) {
                    $("#translatable").attr('disabled', true);
                } else {
                    $("#translatable").removeAttr('disabled');
                }
            });

            $("#upload-video").on('change',function (event){
                let formData = new FormData($('#video-frm')[0]);
                let file = $('input[type=file]')[0].files[0];
                // formData.append('upload_video', file, file.name);
                formData.append('upload_video', file);
                $.ajax({
                    url: '<?php echo e(route('admin.event.upload')); ?>',
                    headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
                    type: 'POST',
                    contentType: false,
                    processData: false,
                    cache: false,
                    data: formData,
                    success: function(data) {
                        console.log(data.filename,"edit");
                        $("#my_video").val(data.filename);
                        var url = '<?php echo e(asset("assets/front/img/events/videos/filename")); ?>';
                        url = url.replace('filename', data.filename);
                        $("#video_src").attr('src',url);
                    },
                    error: function(data) {
                        console.log(data);
                    }
                })
            })
        });
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/linknsbh/sabel-eltaqwa.com/core/resources/views/admin/event/event/edit.blade.php ENDPATH**/ ?>