@extends('app')
@section('content')
<div class="col-md-12 content-header" >
    <h1><i class="fa fa-cogs"></i> {{trans('application.system_settings')}}</h1>
</div>
<section class="content">
    <div class="row">
        <div class="col-md-3">
        @include('settings.partials._menu')
        </div>
        <div class="col-md-9">
            <div class="box box-primary">
            <div class="box-body">
            @if (count($errors) > 0)
            {!! form_errors($errors) !!}
            @endif
             @if($setting)
                {!! Form::model($setting, ['route' => ['company.update', $setting->uuid], 'method'=>'PATCH', 'files'=>true]) !!}
             @else
                {!! Form::open(['route' => ['company.store'], 'files'=>true]) !!}
            @endif
            <div class="form-group">
                {!! Form::label('name', trans('application.name')) !!}
                {!! Form::text('name', null, ['class' => "form-control input-sm", 'required']) !!}
            </div>
            <div class="form-group">
                {!! Form::label('contact', trans('application.contact_person')) !!}
                {!! Form::text('contact', null, ['class' => "form-control input-sm"]) !!}
            </div>
            <div class="form-group">
                {!! Form::label('email', trans('application.email')) !!}
                {!! Form::input('email', 'email', null, ['class' => "form-control input-sm", 'required']) !!}
            </div>
            <div class="form-group">
                {!! Form::label('phone', trans('application.phone')) !!}
                {!! Form::text('phone', null, ['class' => "form-control input-sm", 'required']) !!}
            </div>
            <div class="form-group">
                {!! Form::label('address1', trans('application.address_1')) !!}
                {!! Form::text('address1', null, ['class' => "form-control input-sm", 'required']) !!}
            </div>
            <div class="form-group">
                {!! Form::label('address2', trans('application.address_2')) !!}
                {!! Form::text('address2', null, ['class' => "form-control input-sm"]) !!}
            </div>
            <div class="form-group">
                {!! Form::label('city', trans('application.city')) !!}
                {!! Form::text('city', null, ['class' => "form-control input-sm", 'required']) !!}
            </div>
            <div class="form-group">
                {!! Form::label('state', trans('application.state_province')) !!}
                {!! Form::text('state', null, ['class' => "form-control input-sm", 'required']) !!}
            </div>
            <div class="form-group">
                {!! Form::label('postal_code', trans('application.zip_postal_code')) !!}
                {!! Form::text('postal_code', null, ['class' => "form-control input-sm"]) !!}
            </div>
            <div class="form-group">
                {!! Form::label('country', trans('application.country')) !!}
                {!! Form::text('country', null, ['class' => "form-control input-sm", 'required']) !!}
            </div>
            <div class="form-group">
                {!! Form::label('vat', trans('application.vat_number')) !!}
                {!! Form::text('vat', null, ['class' => "form-control input-sm"]) !!}
            </div>
            <div class="form-group">
                {!! Form::label('website', trans('application.website')) !!}
                {!! Form::text('website', null, ['class' => "form-control input-sm"]) !!}
            </div>
            <div class="form-group">
                {!! Form::label('logo', trans('application.logo').'('.trans('application.width').': 200)') !!}
                @if($setting && $setting->logo != '')
                {!! HTML::image(asset('assets/img/'.$setting->logo), 'logo', array('class' => 'thumbnail')) !!}
                @endif
                <div class=" form-group input-group input-file" style="margin-bottom: 10px;width:50%">
                    <div class="form-control input-sm"></div>
                      <span class="input-group-addon">
                        <a class='btn btn-sm btn-primary' href='javascript:;'>
                            {{ trans('application.browse') }}
                            <input type="file" name="logo" id="logo" onchange="$(this).parent().parent().parent().find('.form-control').html($(this).val());">
                        </a>
                      </span>
                </div>
            </div>
            <div class="form-group">
                {!! Form::label('favicon', trans('application.favicon').'(16x16)') !!}
                @if($setting && $setting->favicon != '')
                {!! HTML::image(asset('assets/img/'.$setting->favicon), 'favicon', array('class' => 'thumbnail')) !!}
                @endif
                <div class=" form-group input-group input-file" style="margin-bottom: 10px;width:50%">
                    <div class="form-control  input-sm"></div>
                      <span class="input-group-addon">
                        <a class='btn btn-sm btn-primary' href='javascript:;'>
                            {{ trans('application.browse') }}
                            <input type="file" name="favicon" id="favicon" onchange="$(this).parent().parent().parent().find('.form-control').html($(this).val());">
                        </a>
                      </span>
                </div>
            </div>
            <div class="form-group">
                {!! Form::label('date_format', trans('application.date_format')) !!}
                {!! Form::select('date_format', array('d/m/Y' => date('d/m/Y'),
                    'm/d/Y' => date('m/d/Y'),
                    'Y/m/d' => date('Y/m/d'),
                    'F j, Y' => date('F j, Y'),
                    'm.d.y' => date('m.d.Y'),
                    'd-m-Y' => date('d-m-Y'),
                    'D M j Y' => date('D M j Y')),null, ['class' => "form-control input-sm"]) !!}
            </div>
            <div class="form-group">
                {!! Form::label('thousand_separator', trans('application.amount_thousand_separator')) !!}
                {!! Form::select('thousand_separator', array(',' => '1,000 - Comma Separator','.' => '1.000 - Dot Separator'),null, ['class' => "form-control input-sm"]) !!}
            </div>
            <div class="form-group">
                {!! Form::label('decimal_separator', trans('application.amount_decimal_separator')) !!}
                {!! Form::select('decimal_separator', array('.' => '1000.00 - Dot',',' => '1000,00 - Comma'),null, ['class' => "form-control input-sm"]) !!}
            </div>
            <div class="form-group">
                {!! Form::label('decimals', trans('application.amount_decimals')) !!}
                {!! Form::select('decimals', array('1' => '1','2' => '2','3' => '3','4' => '4','5' => '5'),2, ['class' => "form-control input-sm"]) !!}
            </div>
            <div class="form-group">
                {!! Form::submit(trans('application.save_settings'), ['class' => "btn btn-primary btn-sm"]) !!}
            </div>
            {!! Form::close() !!}
            </div>
            </div>
        </div>
    </div>
</section>
@endsection