@extends('layouts.admin.app')
@section('content')

<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.5/jquery.validate.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.18/css/bootstrap-select.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.18/js/bootstrap-select.min.js"></script> -->

<main id="main" class="main">
    @if( Session::get('permissions.user_type') == 'A' || Session::get('permissions.user_type') == 'SA')
        <div class="page-breadcrumb">
            <div class="row">
                <div class="col-12 d-flex no-block align-items-center justify-content-between px-4 mb-2">
                    <h4 class="page-title">Edit False URL</h4>
                    <div class="ml-auto text-right">
                        <a href="{{url('admin/falseurl/list/')}}/{{$siteId}}" class="btn btn-outline-info">Back</a>
                    </div>
                </div>
            </div>
        </div>
        <div class="container-fluid">
		    <div class="row">
		        <div class="col-12">
		            <div class="card">
		                @foreach (['danger', 'warning', 'success', 'info'] as $msg)
		                    @if(Session::has('alert-' . $msg))
		                        <h4 class="font-weight-light alert alert-{{ $msg }}">{{ Session::get('alert-' . $msg) }}</h4>
		                    @endif
		                @endforeach
		                <form action="{{route('admin.falseurl.edit', [$dataDetails->id])}}" method="POST" class="form-horizontal" id="formadd" enctype="multipart/form-data">
		                    @csrf
		                    <div class="card-body">
		                        <h4 class="card-title">Edit False URL</h4>
		                        
		                        <input type="hidden" name="formid" value="<?php echo $dataDetails->id; ?>">
		                        <input type="hidden" name="site_id" value="<?php echo $dataDetails->site_id; ?>">
		                        <div class="form-group m-t-20">
		                            <label>False URL<span>*</span></label>
		                            <div class="input-group">
		                                <div class="input-group-prepend">
		                                    <span class="input-group-text" id="basic-addon1"></span>
		                                </div>
		                                <input type="text" class="form-control" id="falseurl" name="falseurl" value="{{$dataDetails->slug_url}}" placeholder="Enter False Extension" required>
		                            </div>
		                        </div>
		                        <div class="form-group m-t-20">
		                            <label>Category<span>*</span></label>
		                            <select id="category" name="category" class="form-control" required>
		                                @foreach($catdata as $c)
		                                    <option @if($c->id == $dataDetails->category_id) selected @endif value="{{$c->id}}">{{$c->name}}</option>
		                                @endforeach 
		                            </select>
		                        </div>
		                        <div class="form-group m-t-20">
		                            <label>Banner Alt</label>
		                            <input type="text" class="form-control" id="baneeralt" name="banneralt"  value="{{$dataDetails->banner_img_alt}}"placeholder="Enter Banner ALT" >
		                        </div>
		                        <div class="form-group m-t-20">
		                            <label>Banner Heading</label>
		                            <input type="text" class="form-control" id="bannerheading" name="bannerheading" value="{{$dataDetails->banner_heading}}" placeholder="Enter Banner Heading" required>
		                        </div>
		                        <div class="form-group m-t-20">
		                            <label>Content Top</label>
		                            <textarea class="form-control" rows="5" id="falseurlcontenttop" name="falseurlcontenttop" placeholder="Enter Content Top" >{{$dataDetails->content_top}}</textarea>
		                        </div>
		                        <div class="form-group m-t-20">
		                            <label>Content Bottom</label>
		                            <textarea class="form-control" rows="5" id="falseurlcontentbottom" name="falseurlcontentbottom" placeholder="Enter Content Bottom" >{{$dataDetails->content_bottom}}</textarea>
		                        </div>
		                        <div class="form-group m-t-20">
		                            <label>Product Sort Order<span>*</span></label>
		                            <select id="productsorder"  name="productsorder" class="form-control" required>
		                                @foreach($sort_order as $od)
		                                    <option @if($od->id == $dataDetails->sort_order) selected @endif value="{{$od->id}}">{{$od->name}}</option>
		                                @endforeach
		                            </select>
		                        </div>
		                        <div class="form-group m-t-20">
		                            <label>Meta Title</label>
		                            <input type="text" class="form-control" id="falseurlmeta_title" name="falseurlmeta_title" value="{{$dataDetails->meta_title}}" placeholder="Enter Meta Title" required>
		                        </div>
		                        <div class="form-group m-t-20">
		                            <label>Meta Description</label>
		                            <textarea class="form-control" rows="5" id="falseurlmeta_description" name="falseurlmeta_description" placeholder="Enter Meta Description" required>{{$dataDetails->meta_description}}</textarea>
		                        </div>
		                        <div class="form-group m-t-20">
		                            <label>Tagline</label>
		                            <input type="text" class="form-control" id="falseurltagline" name="falseurltagline" value="{{$dataDetails->tag_line}}" placeholder="Enter Tagline" >
		                        </div>
		                        <div class="form-group m-t-20">
		                            <label>Top Head</label>
		                            <input type="text" class="form-control" id="falseurltophead" name="falseurltophead" value="{{$dataDetails->tophead}}" placeholder="Enter Tophead" >
		                        </div>
		                    </div>
		                    <div class="border-top">
		                        <div class="card-body">
		                            <input class="btn btn-primary" type="submit" value="UPDATE">
		                        </div>
		                    </div>
		                </form>
		            </div>
		        </div>
		    </div>
		</div>
    @endif
</main> 

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.5/jquery.validate.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.18/css/bootstrap-select.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.18/js/bootstrap-select.min.js"></script>   

<script type="text/javascript">

	$(document).ready(function () {
        setTimeout(function () {
            $('.cke_notifications_area').attr("style", "display: none !important");
        }, 1000); // 60000ms = 1 minute
    });

    $.validator.setDefaults({
	    submitHandler: function(form) {
	        form.submit();
	    }
    });

    $(function() {
        // validate the comment form when it is submitted
        $("#formadd").validate({
            ignore: [],
            errorPlacement: function(label, element) {
                label.addClass('mt-2 text-danger');
                label.insertAfter(element);
            },
            highlight: function(element, errorClass) {
                $(element).parents('.form-group').addClass('has-danger')
                $(element).addClass('form-control-danger')
            }
          });
    });

    CKEDITOR.replace("falseurlcontenttop");
    CKEDITOR.replace("falseurlcontentbottom");

</script>     

@endsection