@extends('admin.layouts.app')

@section('content')
<!-- @if ($errors->any())
<div class="alert alert-danger">
    <ul class="m-0">
        @foreach ($errors->all() as $error)
        <li>{{ $error }}</li>
        @endforeach
    </ul>
</div>
@endif -->
<h2 class="mb-3">{{ awtTrans('اضافة مقال جديد') }} </h2>
<div class="row">
    <div class="col-lg-12">
        {!! Form::open(['method' => 'POST', 'route' => 'admin.posts.store', 'files'=>true]) !!}
        <div class="row">
            <div class="form-group col-lg-6">
                {!! Form::label('title_ar', awtTrans('Title Arabic')) !!}
                {!! Form::text('title_ar', null, ['class' => 'form-control']) !!}
                <small class="text-danger">{{ $errors->first('title_ar') }}</small>
            </div>

            <div class="form-group col-lg-6">
                {!! Form::label('title_en', awtTrans('Title English')) !!}
                {!! Form::text('title_en', null, ['class' => 'form-control']) !!}
                <small class="text-danger">{{ $errors->first('title_en') }}</small>
            </div>
        </div>

        <div class="row">

            <div class="form-group col-lg-6">
                {!! Form::label('body_ar', awtTrans('Description Arabic')) !!}
                {!! Form::textarea('body_ar', null, [ 'class' => 'form-control tinyEditor']) !!}
                <small class="text-danger">{{ $errors->first('body_ar') }}</small>
            </div>

            <div class="form-group col-lg-6">
                {!! Form::label('body_en', awtTrans('Description English')) !!}
                {!! Form::textarea('body_en', null, [ 'class' => 'form-control tinyEditor']) !!}
                <small class="text-danger">{{ $errors->first('body_en') }}</small>
            </div>

        </div>

        <div class="row">

            <div class="form-group col-lg-12">
                {!! Form::label('photo', awtTrans('الصورة')) !!}
                <div class="input-group">
                    <span class="input-group-btn">
                        <a id="lfm" data-input="photo" data-preview="holder" class="btn btn-secondary text-white px-4" style="border-top-right-radius: 0;border-bottom-right-radius: 0;border-top-left-radius: 0;border-bottom-left-radius: 0;">
                            <i class="fa fa-picture-o"></i> {{ awtTrans('اختر الصورة') }}
                        </a>
                    </span>
                    {!! Form::text('photo', null, ['class' => $errors->has('photo') ? 'form-control is-invalid photo' : 'form-control photo' , 'readonly' => 'readonly']) !!}
                </div>
                <div class="mb-3 mt-3 d-block slider-holder holder" id="holder">
                    <img width="100" src="http://127.0.0.1:8000/storage/1/th.jpeg" alt="">
                </div>
                <small class="text-danger">{{ $errors->first('photo') }}</small>
            </div>

        </div>



        <div class="row">

            <div class="form-group col-lg-12">
                {!! Form::label('images', awtTrans('Choose Images')) !!}
                <div class="input-group">
                    <span class="input-group-btn">
                        <a data-input="images" data-preview="images" class="lfm btn btn-secondary text-white px-4" style="border-top-right-radius: 0;border-bottom-right-radius: 0;border-top-left-radius: 0;border-bottom-left-radius: 0;">
                            <i class="fa fa-picture-o"></i> {{ awtTrans('اختر الصورة') }}
                        </a>
                    </span>
                    {!! Form::text('images', null, ['class' => $errors->has('images') ? 'form-control is-invalid images' : 'form-control images' , 'readonly' => 'readonly']) !!}
                </div>
                <div class="mb-3 mt-3 d-block slider-holder images" id="holder">
                    
                </div>
                <small class="text-danger">{{ $errors->first('images') }}</small>
            </div>

        </div>

        <div class="row">

            <div class="form-group col-lg-12">
                <button type="button" class="btn btn-info btn-block" id="add-keyword"><i class="fas fa-plus"></i></button>
            </div>
        </div>

        <div class="row" id="append-keyword">

            <div class="row col-lg-12">


                <div class="form-group col-lg-6">
                    {!! Form::label('keyword_ar', awtTrans('الكلمات المفتاحية بالعربي')) !!}
                    {!! Form::text('keyword_ar[]', null, [ 'class' => 'form-control']) !!}
                    <small class="text-danger">{{ $errors->first('keyword_ar') }}</small>
                </div>

                <div class="form-group col-lg-6">
                    {!! Form::label('keyword_en', awtTrans('الكلمات المفتاحية بالانجليزي')) !!}
                    {!! Form::text('keyword_en[]', null, [ 'class' => 'form-control']) !!}
                    <small class="text-danger">{{ $errors->first('keyword_en') }}</small>
                </div>

            </div>

        </div>

        {!! Form::submit(awtTrans('Add Post'), ['class' => 'btn btn-success']) !!}
        <a class="btn btn-primary" href="{{ route('admin.posts.index') }}" role="button"><i class="fas fa-arrow-alt-circle-left   mr-2 "></i>{{awtTrans('Back')}}</a>
        {!! Form::close() !!}
    </div>
</div>
@endsection