@extends('layouts.app')

@section('content')
<section class="page-header row">
	<h2> {{ $pageTitle }} </h2>
	<ol class="breadcrumb">
		<li><a href="{{ url('') }}"> Dashboard </a></li>
		<li><a href="{{ url('/manage/'.$pageModule) }}"> {{ $pageTitle }} </a></li>
		<li class="active"> Form  </li>		
	</ol>
</section>
<div class="page-content row">
	<div class="page-content-wrapper no-margin">
	
	{!! Form::open(array('url'=>'/manage/userpanelpages?return='.$return, 'class'=>'form-vertical validated','files' => true )) !!}
	<input type="hidden" name="status_type" value="{{ $pageTitle }}" />
	
		<div class="sbox-title clearfix">
			<div class="sbox-tools pull-right" >
				<a href="{{ url('/manage/'.$pageModule.'?return='.$return) }}" class="tips btn btn-sm "  title="{{ __('core.btn_back') }}" ><i class="fa  fa-times"></i></a> 
			</div>
			<div class="sbox-tools1 pull-left1" >
				<button name="apply" class="btn btn-sm btn-primary  "  title="{{ __('core.btn_back') }}" ><i class="fa  fa-check"></i> {{ __('core.sb_apply') }} </button>
				<button name="save" class="btn btn-sm btn-success"  title="{{ __('core.btn_back') }}" ><i class="fa  fa-paste"></i> {{ __('core.sb_save') }} </button> 
				<?php if($frontendSlug!='') {
				$fsconfig = explode('@',$frontendSlug);
				if( ($row[$fsconfig[1]]) ) 
				echo '<a  class="btn btn-sm btn-outline-primary" target="_blank"  title="FrontEnd" href="'. (config('website.cnf_appurl') .'/'.config('website.cnf_lang') . str_replace('//','/',('/'.$fsconfig[0].'/'.$row[$fsconfig[1]]))).'"><i class="fa  fa-desktop"></i> FrontEnd</a>';
				 } ?>
			</div>
		</div>	
		<div class="sbox1">
		<div class="sbox-content clearfix row">
		<div class="col-xs-12">
	<ul class="parsley-error-list">
		@foreach($errors->all() as $error)
			<li>{{ $error }}</li>
		@endforeach
	</ul>		

	<?php $curTime = time();?>

<div class="sbox1"><div class="col-md-6">
						<fieldset class="sbox" style="border-top:0; border-radius: 5px;"><legend> User Dashboard Pages</legend>
				<?php if( !isset($row['id']))  $row['id'] = null;   ?>
		<input  type='hidden' name='id' id='id' value='{{$row['id']}}' />
									
									  <div class="form-group  depen-  wrap-route  " >
										<label for="ipt" class=" control-label "> Route  <span class="asterix"> * </span>  </label>
										
										
										  <?php if( !isset($row['route']))  $row['route'] = null;   ?>
		<input  type='text' name='route' id='route' value='{{ $row['route'] }}' 
						required readonly class='form-control input-sm ' />
									  </div> 					
									  <div class="form-group  depen-  wrap-title  " >
										<label for="ipt" class=" control-label "> Title    </label>
										
										
										  <?php if( !isset($row['title']))  $row['title'] = null;   ?>
		 <?php $val = json_decode($row['title']); $is_first = true; ?>	
				<ul class='editor-nav nav nav-tabs'>

				@foreach(explode(',', config('website.cnf_langs')) as $ilang )<li class='{{$is_first ? "active" : null}} '><a  href='#title_{{$ilang}}_{{$curTime}}' data-toggle='tab'>{{$ilang}}</a></li>
				<?php  $is_first = false;?>
				@endforeach </ul>
				
				<div class="tab-content ">
				<?php $is_first = true; ?>
				@foreach(explode(',', config('website.cnf_langs')) as $ilang )
				<div class='tab-pane tab_{{$ilang}}  {{$is_first ? "active" : null}}' id='title_{{$ilang}}_{{$curTime}}'>
				<input  type='text' name="title[{{$ilang}}]" id='title' value='{{   isset($val->{$ilang}) ? $val->{$ilang} : ''   }}' 
						  placeholder='Title - {{$ilang}}'     class='form-control input-sm ' />
						</div>
						<?php  $is_first = false;?>
						@endforeach
						</div>
						 						
									  </div> 					
									  <div class="form-group  depen-  wrap-content  " >
										<label for="ipt" class=" control-label "> Content    </label>
										
										
										  <?php if( !isset($row['content']))  $row['content'] = null;   ?>
		 <?php $val = json_decode($row['content']); $is_first = true; ?>	
				<ul class='editor-nav nav nav-tabs'>

				@foreach(explode(',', config('website.cnf_langs')) as $ilang )<li class='{{$is_first ? "active" : null}} '><a  href='#content_{{$ilang}}_{{$curTime}}' data-toggle='tab'>{{$ilang}}</a></li>
				<?php  $is_first = false;?>
				@endforeach </ul>
				
				<div class="tab-content ">
				<?php $is_first = true; ?>
				@foreach(explode(',', config('website.cnf_langs')) as $ilang )
				<div class='tab-pane tab_{{$ilang}} {{$is_first ? "active" : null}}' id='content_{{$ilang}}_{{$curTime}}'>
				
				<textarea name="content[{{$ilang}}]" rows='5' id='content' class='form-control input-sm '  
				             >{{   isset($val->{$ilang}) ? $val->{$ilang} : ''   }}</textarea>
				
				
						</div>
						<?php  $is_first = false;?>
						@endforeach
						</div>
						 						
									  </div> </fieldset>
			</div>
			
			<div class="col-md-6">
						<fieldset class="sbox" style="border-top:0; border-radius: 5px;"><legend> Content</legend>
									
									  <div class="form-group  depen-  wrap-footer_content  " >
										<label for="ipt" class=" control-label "> Footer Content    </label>
										
										
										  <?php if( !isset($row['footer_content']))  $row['footer_content'] = null;   ?>
		 <?php $val = json_decode($row['footer_content']); $is_first = true; ?>	
				<ul class='editor-nav nav nav-tabs'>

				@foreach(explode(',', config('website.cnf_langs')) as $ilang )<li class='{{$is_first ? "active" : null}} '><a  href='#footer_content_{{$ilang}}_{{$curTime}}' data-toggle='tab'>{{$ilang}}</a></li>
				<?php  $is_first = false;?>
				@endforeach </ul>
				
				<div class="tab-content ">
				<?php $is_first = true; ?>
				@foreach(explode(',', config('website.cnf_langs')) as $ilang )
				<div class='tab-pane tab_{{$ilang}} {{$is_first ? "active" : null}}' id='footer_content_{{$ilang}}_{{$curTime}}'>
				
				<textarea name="footer_content[{{$ilang}}]" rows='5' id='footer_content' class='form-control input-sm '  
				             >{{   isset($val->{$ilang}) ? $val->{$ilang} : ''   }}</textarea>
				
				
						</div>
						<?php  $is_first = false;?>
						@endforeach
						</div>
						 						
									  </div> </fieldset>
			</div>
			
			
		</div>
		
		
</div>
</div>
</div>
@include('/manage/'.$pageModule.'/subform')

		
		
		<div class="sbox-title clearfix">
			<div class="sbox-tools pull-right" >
				<a href="{{ url('/manage/'.$pageModule.'?return='.$return) }}" class="tips btn btn-sm "  title="{{ __('core.btn_back') }}" ><i class="fa  fa-times"></i></a> 
			</div>
			<div class="sbox-tools pull-left" >
				<button name="apply" class=" btn btn-sm btn-primary  "  title="{{ __('core.btn_back') }}" ><i class="fa  fa-check"></i> {{ __('core.sb_apply') }} </button>
				<button name="save" class=" btn btn-sm btn-success"  title="{{ __('core.btn_back') }}" ><i class="fa  fa-paste"></i> {{ __('core.sb_save') }} </button> 
			</div>
		</div>	
		
	
	
	<input type="hidden" name="action_task" value="save" />
	{!! Form::close() !!}
	</div>
</div>		

	
		 
   <script type="text/javascript">
	$(document).ready(function() { 
		
		
		 		 

		$('.removeMultiFiles').on('click',function(){
			var removeUrl = '{{ url("userpanelpages/removefiles?file=")}}'+$(this).attr('url');
			$(this).parent().remove();
			$.get(removeUrl,function(response){});
			$(this).parent('div').empty();	
			return false;
		});		
		
	});
	</script>		 
@stop