@include("messages")
<?php
$yes_no = Config::get('params.yes_no');
$template = Config::get('params.template');
$required = "";
$action = "widgets";
//d($roles,1);
//$currency = $currencies[Config::get('params.currency_default')]['symbol'];
?>
<div class="row">
    <div class="col-md-6">
        <div class="form-group">
            {!! Form::label('Title') !!}
            {!! Form::text('Title', null , array('class' => 'form-control',$required) ) !!}
        </div>
    </div>
    
    <div class="col-md-6">
        <div class="form-group">
            {!! Form::label('Code') !!}
            {!! Form::text('code', null , array('class' => 'form-control',$required) ) !!}
        </div>
    </div>
</div>
<div class="row">

    <div class="col-sm-12">
        <div class="row form-group">
            <label class="col-xl-2 col-lg-2 col-form-label"> Image</label>
            <div class="col-lg-6 col-xl-6">
                <input   value="<?php echo isset($model->ImageName) ? $model->ImageName : ""; ?>"  placeholder="Upload Image" id="ImageName" name="ImageName" type="text" class="form-control "  readonly="">
                <br clear="all"/>
               
            </div>
            <div class="col-lg-2 col-xl-2">
                <button type="button" class="btn btn-warning btn-label-brand btn-md mediaModel" data-toggle="modal" data-target="#media-model" data-control="ImageName">Browse</button>
            </div>
            <div class="col-lg-1 col-xl-1 ">

                <p id="removeImage" class="btn btn-outline-warning mr-1 mb-1 waves-effect waves-light float-right">Remove</p>

            </div>
        </div>
    </div>   
</div>


<div class="card-content collapse show">
<div class="row" >
    <div class="col-md-12 col-xs-12 col-lg-12">
        <div class="form-group " >
                
            {!! Form::label('Content') !!}    
           {!! Form::textarea('Content', null, ['class'=>'form-control mb-20 editor','id'=>'ckview','rows' => 15, 'cols' => 80]) !!}

        </div>
    </div> 
</div>

</div>
<br clear="all"/>
<br clear="all">
<br clear="all">
<div class="row">
    <div class="col-md-12 col-xs-12 col-lg-12">
        <div class="form-group">
            {!! Form::label('Link') !!}
            {!! Form::text('Link', null , array('class' => 'form-control',$required) ) !!}
        </div>
    </div>

</div>

<br clear="all"/>
<div class="row">
    <div class="col-md-8">
        <button type="submit" class="btn btn-primary mr-1 mb-1 waves-effect waves-light">Save</button>
        <a href="{{url('admin/widgets')}}" class="btn btn-outline-warning mr-1 mb-1 waves-effect waves-light">Cancel</a>
    </div>
</div>
<!--/ Add rows table -->
<!--/ Scroll - horizontal and vertical table -->

@include('vendor_script')
@section('myscript')
{{-- Page js files --}}
<script src="{{ asset(mix('/vendors/js/extensions/jquery.nestable.js')) }}"></script>
<script>
var updateOutput = function (e) {
    var list = e.length ? e : $(e.target);
    if ((list.attr("id") == "nestable_menus") || (list.attr("id") == "assigned_menus") || (list.attr("id") == "nestable_widget") || (list.attr("id") == "nestable_locker") || (list.attr("id") == "nestable_franchise_post_code") || (list.attr("id") == "nestable_time")) {
        var output = list.data('output');
        if (window.JSON) {
            output.val(window.JSON.stringify(list.nestable('serialize')));//, null, 2));
        } else {
            //output.html('JSON browser support required for this demo.');
        }
    }
};
$(document).ready(function ()
{
    $('#media_action').val("<?php echo $action; ?>");

});
</script>

 <script>
    var ckview = document.getElementById("ckview");
    CKEDITOR.config.allowedContent = true;
  CKEDITOR.replace(ckview, {filebrowserImageBrowseUrl: '/file-manager/ckeditor',
    });
    
    $( "#removeImage" ).click(function() {
            $("#ImageName").val(" ");
            
          });

</script>

@endsection