@extends('webprofile.backend.layouts.master')

@section('title')
  {{ $title }}
@stop

@section('assets')
<link rel="stylesheet" href="{!! asset('backend/assets/select2/select2.min.css') !!}">
<style media="screen">
  .tkh{
    color: black;
  }
</style>
@stop

@section('breadcrumbs')
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.create_page')</li>
@stop

@section('content')
<!-- page start-->
<div class="row">
  {!! Form::model($data, ['route' => ['pages.update', $data->id], 'method'=>'patch', 'files' => true]) !!}
  {!! csrf_field() !!}
	<div class="col-md-12">
	    <div class="panel panel-default">
	        <div class="panel-heading">
	            <h3 class="panel-title"><strong>@lang('label.create')</strong> @lang('feature.page')</h3>
	        </div>
	        <div class="panel-body">
	            <div class="row">
					<div style="padding: 10px 10px 10px 10px; font-weight: bold; font-size: 14pt;">
						Bahasa Indonesia
					</div>
	                <div class="col-md-12">
	                    <div class="form-group @if ($errors->has('title')) has-error @endif">
	                        <div class="col-md-12">
	                          {{ Form::text('title', old('title'), array('class' => 'form-control', 'placeholder'=>trans('label.title'), 'style'=>'font-size: 14pt;')) }}
	                          @if ($errors->has('title'))
	                          <label id="login-error" class="error" for="login">{{$errors->first('title')}}</label>
	                          @endif
	                        </div>
	                    </div>
                  </div>
                  <div class="col-md-12">
	                    <div class="block">
	                      {{ Form::textarea('content', null, array('id'=>'content')) }}
	                    </div>
	                </div>
				</div>
				<div class="row">
					<div style="padding: 10px 10px 10px 10px; font-weight: bold; font-size: 14pt;">
						English Language
					</div>
	                <div class="col-md-12">
	                    <div class="form-group @if ($errors->has('title')) has-error @endif">
	                        <div class="col-md-12">
								@if($data->rEn)
								{{ Form::text('title_en', $data->rEn->title, array('class' => 'form-control', 'placeholder'=>trans('label.title'), 'style'=>'font-size: 14pt;')) }}
								@else
								{{ Form::text('title_en', null, array('class' => 'form-control', 'placeholder'=>trans('label.title'), 'style'=>'font-size: 14pt;')) }}
								@endif
								@if ($errors->has('title'))
								<label id="login-error" class="error" for="login">{{$errors->first('title')}}</label>
								@endif
	                        </div>
	                    </div>
					</div>
					<div class="col-md-12">
	                    <div class="block">
							@if ($data->rEn)
							{{ Form::textarea('content_en', $data->rEn->content, array('id'=>'content_en')) }}
							@else
							{{ Form::textarea('content_en', null, array('id'=>'content_en')) }}
							@endif
	                    </div>
	                </div>
	            </div>
	        </div>
	    </div>
	</div>
	
	<div class="col-md-12">
	    <div class="panel panel-default">
	        <div class="panel-footer">
	            <button class="btn btn-info pull-right">@lang('label.save')</button>
	        </div>
	    </div>
	</div>
  {!! Form::close() !!}
</div>
<!-- page end-->
@stop

@section('script')
{!! Html::script('backend/assets/select2/select2.full.min.js') !!}
{!! Html::script('backend/js/plugins/bootstrap/bootstrap-datepicker.js') !!}
{!! Html::script('backend/js/plugins/bootstrap/bootstrap-timepicker.min.js') !!}
{!! Html::script('backend/js/plugins/bootstrap/bootstrap-file-input.js') !!}
{!! Html::script('backend/js/plugins/summernote/summernote.js') !!}

<script type="text/javascript">
	function PreviewImage() {
		var oFReader = new FileReader();
		oFReader.readAsDataURL(document.getElementById("uploadImage").files[0]);

		oFReader.onload = function (oFREvent) {
		document.getElementById("uploadPreview").src = oFREvent.target.result;
		};
	};
	
	$(document).ready(function() {
		$('#content').summernote({
			height: 400
		});
		$('#content_en').summernote({
			height: 400
		});
	});

  	$('#categories').select2();
</script>
@stop
