Current File : /home/tradevaly/demo.tradevaly.com.bd/resources/views/backend/latest-news/edit.blade.php
@extends('layouts.backend')

    @section('content')  
<!-- Container Fluid-->
            <div class="row">
                <div class="col-lg-12">
                  <!-- Form Basic -->
                  <div class="card mb-4">
                    <div class="card-header card-header-modify py-3 d-flex flex-row align-items-center justify-content-between">
                      <h6 class="m-0 font-weight-bold text-heading-bar">Edit Latest News</h6>
                        <a href="{{route('latest-news.index')}}" class="btn btn-default-index  btn-sm text-right "><i class="fas fa-arrow-alt-circle-left"></i> Back</a>
                    </div>
                    <div class="card-body">
                        
                        {!! Form::model($latestNews, ['method' => 'PATCH','route' => ['latest-news.update', $latestNews->id], 'enctype'  => 'multipart/form-data']) !!}

                            
                            <div class="row">

                                
                                <div class="form-group col-sm-6">
                                    <label for="exampleInputEmail1"> News Category<span style="color: red"> *</span></label>
                                    <div>
                                        {!! Form::select('category_id', [''=>'Select News Category']+$newsCatList,$latestNews->category_id, array('id' => '', 'class' => 'js-example-basic-multiple js-states form-control select2-hidden-accessible news_top_category', 'tabindex' => '-1', 'aria-hidden' => 'true',  'single', 'detect' => 0)) !!} 
                                    
                                        @error('category_id')
                                            <span class="invalid-feedback" role="alert">
                                                <strong>{{ $errors->first('category_id') }}</strong>
                                            </span>
                                        @enderror

                                        <span class="invalid-feedback  alert-news_top_category" role="alert" style="font-weight: bold;"></span>
                                    </div>
                                </div>

                               
                                <div class="form-group col-sm-6">
                                  <label for="exampleInputEmail1">Title<span style="color: red"> *</span></label>
                                    <div>
                                        {!! Form::text('title', null, array('placeholder' => 'Enter title','class' => 'form-control', 'required' => '')) !!}
                                        @error('title')
                                            <span class="invalid-feedback" role="alert">
                                                <strong>{{ $errors->first('title') }}</strong>
                                            </span>
                                        @enderror
                                    </div>
                                </div>


                                <div class="form-group col-sm-6">
                                  <label for="exampleInputEmail1">Image <!-- (<span style="color: red; font-size: 12px">Width:180, Height:76</span>) --><span style="color: red"> *</span></label>
                                    <div>
                                        {!! Form::file('image', array('class' => 'form-control')) !!}
                                        @error('image')
                                            <span class="invalid-feedback" role="alert">
                                                <strong>{{ $errors->first('image') }}</strong>
                                            </span>
                                        @enderror

                                        <br/>
                                        <img src="{{ asset('storage/app/public/latest-news/'.$latestNews->image) }}" width="80">

                                    </div>
                                </div>


                                <div class="form-group col-sm-6">
                                    <label for="exampleInputEmail1">News Tag</label>
                                    <div>
                                        {!! Form::select('news_tag_id[]', $newsTag,$newsTagMappingNewsTagMapping, array('id' => '', 'class' => 'js-example-basic-multiple js-states form-control select2-hidden-accessible news_top_category', 'tabindex' => '-1', 'aria-hidden' => 'true',  'multiple')) !!} 
                                
                                        @error('news_tag_id')
                                            <span class="invalid-feedback" role="alert">
                                                <strong>{{ $errors->first('news_tag_id') }}</strong>
                                            </span>
                                        @enderror
                                    </div>
                                </div>


                                <div class="form-group col-sm-12">
                                  <label for="exampleInputEmail1">Description<span style="color: red"> *</span></label>
                                    <div>
                                        {!! Form::textarea('description', null, array('placeholder' => '','class' => 'form-control content', 'required' => '')) !!}
                                        @error('description')
                                            <span class="invalid-feedback" role="alert">
                                                <strong>{{ $errors->first('description') }}</strong>
                                            </span>
                                        @enderror
                                    </div>
                                </div>
                                                                                   
                            </div>                            
                          
                        <button type="submit" class="btn btn-success">Update</button>
                        {!! Form::close() !!}
                    </div>
                  </div>
                </div>
            </div>
          <!--Row-->


          <script type="text/javascript">
                $(document).on('change', '#news_top_category', function() {   
                
                    var value = [];
                    value = $(this).val();

                    route = {!! json_encode(url('/')) !!}+'/get-news-cat/second_step_cat/'+ value;

                    emptyFieldClass = ['sub_category'];
                    
                    targetShowClass = 'sub_category';

                    getAutoDropdownData(targetShowClass, route, emptyFieldClass);

                    //alert('Response');

                });
          </script>

    @endsection