

		 {!! Form::open(array('url'=>'pagewidgets/savepublic', 'class'=>'form-horizontal','files' => true , 'parsley-validate'=>'','novalidate'=>' ')) !!}

	@if(Session::has('messagetext'))
	  
		   {!! Session::get('messagetext') !!}
	   
	@endif
	<ul class="parsley-error-list">
		@foreach($errors->all() as $error)
			<li>{{ $error }}</li>
		@endforeach
	</ul>		


<div class="sbox1"><div class="col-md-12">
						<fieldset class="sbox" style="border-top:0; border-radius: 5px;"><legend> Page Widgets</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-title  " >
										<label for="Title" class=" control-label col-md-3 text-left"> Title <span class="asterix"> * </span></label>
										
										
										<div class="col-md-9">
										  <?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 {{$is_first ? "active" : null}}' id='title_{{$ilang}}_{{$curTime}}'>
				<input  type='text' name="title[{{$ilang}}]" id='title' value='{{   isset($val->{$ilang}) ? $val->{$ilang} : ''   }}' 
						required  placeholder='Title - {{$ilang}}'     class='form-control input-sm ' />
						</div>
						<?php  $is_first = false;?>
						@endforeach
						</div>
						 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> 					
									  <div class="form-group depen- wrap-subtitle  " >
										<label for="Subtitle" class=" control-label col-md-3 text-left"> Subtitle </label>
										
										
										<div class="col-md-9">
										  <?php if( !isset($row['subtitle']))  $row['subtitle'] = null;   ?>
		 <?php $val = json_decode($row['subtitle']); $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='#subtitle_{{$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 {{$is_first ? "active" : null}}' id='subtitle_{{$ilang}}_{{$curTime}}'>
				<input  type='text' name="subtitle[{{$ilang}}]" id='subtitle' value='{{   isset($val->{$ilang}) ? $val->{$ilang} : ''   }}' 
						  placeholder='Subtitle - {{$ilang}}'     class='form-control input-sm ' />
						</div>
						<?php  $is_first = false;?>
						@endforeach
						</div>
						 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> 					
									  <div class="form-group depen- wrap-for_page  " >
										<label for="Page" class=" control-label col-md-3 text-left"> Page <span class="asterix"> * </span></label>
										
										
										<div class="col-md-9">
										  <?php if( !isset($row['for_page']))  $row['for_page'] = null;   ?>
		<?php $for_page = (isset($row['for_page'])) ? $row['for_page'] : null ; ?>
					
					<input type='radio' name='for_page' value ='homepage' required    @if( $for_page == 'homepage') checked="checked" @endif class='minimal-red' > Homepage 
					
					<input type='radio' name='for_page' value ='all_stores' required    @if( $for_page == 'all_stores') checked="checked" @endif class='minimal-red' > All_stores 
					
					<input type='radio' name='for_page' value ='store_category' required    @if( $for_page == 'store_category') checked="checked" @endif class='minimal-red' > Store_category 
					
					<input type='radio' name='for_page' value ='store' required    @if( $for_page == 'store') checked="checked" @endif class='minimal-red' > Store 
					
					<input type='radio' name='for_page' value ='category' required    @if( $for_page == 'category') checked="checked" @endif class='minimal-red' > Category 
					
					<input type='radio' name='for_page' value ='tag' required    @if( $for_page == 'tag') checked="checked" @endif class='minimal-red' > Tag 
					
					<input type='radio' name='for_page' value ='brand' required    @if( $for_page == 'brand') checked="checked" @endif class='minimal-red' > Brand  
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> 					
									  <div class="form-group depen- wrap-widget_type  " >
										<label for="Type" class=" control-label col-md-3 text-left"> Type <span class="asterix"> * </span></label>
										
										
										<div class="col-md-9">
										  <?php if( !isset($row['widget_type']))  $row['widget_type'] = null;   ?>
		 
					<?php $row['widget_type'] = trim($row['widget_type'],'[]'); ?>

					 <select name='widget_type' rows='5' id='widget_type' class='select2 ' required   data-parsley-maxlength=  ></select> 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> <?php if( !isset($row['widget_content']))  $row['widget_content'] = null;   ?>
		<input  type='hidden' name='widget_content' id='widget_content' value='{{$row['widget_content']}}' />
				<?php if( !isset($row['object_type']))  $row['object_type'] = null;   ?>
		<input  type='hidden' name='object_type' id='object_type' value='{{$row['object_type']}}' />
									
									  <div class="form-group depen- wrap-link  " >
										<label for="Hyperlink" class=" control-label col-md-3 text-left"> Hyperlink </label>
										
										
										<div class="col-md-9">
										  <?php if( !isset($row['link']))  $row['link'] = null;   ?>
		<input  type='text' name='link' id='link' value='{{ $row['link'] }}' 
						   data-parsley-maxlength="500"    class='form-control input-sm ' /> 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> 					
									  <div class="form-group depen- wrap-sort_order  " >
										<label for="Sequence - Sort " class=" control-label col-md-3 text-left"> Sequence - Sort  <span class="asterix"> * </span></label>
										
										
										<div class="col-md-9">
										  <?php if( !isset($row['sort_order']))  $row['sort_order'] = null;   ?>
		<input  type='number' name='sort_order' id='sort_order' value='{{ $row['sort_order'] }}' 
						required   data-parsley-maxlength="11"    class='form-control is_number'  /> 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> 					
									  <div class="form-group depen- wrap-status  " >
										<label for="Enable" class=" control-label col-md-3 text-left"> Enable <span class="asterix"> * </span></label>
										
										
										<div class="col-md-9">
										  <?php if( strlen($row['status']) < 1 )  $row['status']  = '1'; 	  ?>
		<div class='switch-wrap'> <label class='switch'>
				    <input type='hidden' name='status' value ='0' />
					<input type='checkbox' name='status' value ='1' 
					@if($row['status']) checked @endif 
					 />   <span class="slider round"></span></label></div> 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> </fieldset>
			</div>
			
			
		</div>
		
		

			<div style="clear:both"></div>	
				
					
				  <div class="form-group">
					<label class="col-sm-4 text-right">&nbsp;</label>
					<div class="col-sm-8">	
					<button type="submit" name="apply" class="btn btn-info btn-sm" ><i class="fa  fa-check-circle"></i> {{ Lang::get('core.sb_apply') }}</button>
					<button type="submit" name="submit" class="btn btn-primary btn-sm" ><i class="fa  fa-save "></i> {{ Lang::get('core.sb_save') }}</button>
				  </div>	  
			
		</div> 
		 <input type="hidden" name="action_task" value="public" />
		 {!! Form::close() !!}
		 
   <script type="text/javascript">
	$(document).ready(function() { 
		
		
		$("#widget_type").jCombo("{!! url('/manage/pagewidgets/comboselect?filter=widget_types:code:name&values='.$row["widget_type"]) !!}",
		{  selected_value : '{{ $row["widget_type"] }}' });
		 

		$('.removeCurrentFiles').on('click',function(){
			var removeUrl = $(this).attr('href');
			$.get(removeUrl,function(response){});
			$(this).parent('div').empty();	
			return false;
		});		
		
	});
	</script>		 
