@extends('admin.layouts.app')

@section('content')
@if (session('supplier_update_msg'))
<div class="alert alert-success">
    {{ session('supplier_update_msg') }}
</div>
@endif
<h2 class="mb-3">{{ awtTrans('Edit Supplier') }}</h2>
<div class="row mb-5">
    <div class="col-lg-12">
        {!! Form::model($supplier, ['method' => 'PATCH', 'route' => ['admin.suppliers.update', $supplier->id], 'files'=>true , 'id' => 'form-supplier']) !!}
        <div class="row">
            <div class="form-group col-lg-12">
                {!! Form::label('name', awtTrans('الاسم')) !!}
                {!! Form::text('name', null, ['class' => ($errors->has('name')) ? 'form-control is-invalid' : 'form-control' , 'required' => 'required']) !!}
                <small class="text-danger">{{ $errors->first('name') }}</small>
            </div>

        </div>

        <div class="row">

            <div class="form-group col-lg-12">
                {!! Form::label('pio', awtTrans('Description')) !!}
                {!! Form::textarea('pio', null, [ 'class' => 'form-control tinyEditor' , 'required' => 'required']) !!}
                <small class="text-danger">{{ $errors->first('pio') }}</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="photo" 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' , 'required' => 'required']) !!}
                </div>
                <div class="mb-3 mt-3 d-block slider-holder photo" id="holder">
                    <img width="100" src="{{ $supplier->photo }}" alt="">
                </div>
                <small class="text-danger">{{ $errors->first('photo') }}</small>
            </div>
        </div>

        <div class="text-right float-right">
            <a href="{{ route('admin.suppliers.index') }}" class="btn btn-info px-4 mr-2">{{ awtTrans('الكل') }}</a>
            {!! Form::submit(awtTrans('Update'), ['class' => 'btn btn-success']) !!}
        </div>
        {!! Form::close() !!}

    </div>

</div>


@endsection
@section('scripts')
<script src="{{ url('dashboard/forms/suppliers/create.js') }}"></script>
@endsection