@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/registrationcodes?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> Registration code</legend>
									
									  <div class="form-group  depen-  wrap-code  " >
										<label for="ipt" class=" control-label "> Code  <span class="asterix"> * </span>  </label>
										
										
										  <?php if( !isset($row['code']))  $row['code'] = null;   ?>
		<input  type='text' name='code' id='code' value='{{ $row['code'] }}' 
						required       class='form-control input-sm ' /> 						
									  </div> 					
									  <div class="form-group  depen-  wrap-bonus_amount  " >
										<label for="ipt" class=" control-label "> Bonus Amount  <span class="asterix"> * </span>  </label>
										
										
										  <?php if( !isset($row['bonus_amount']))  $row['bonus_amount'] = null;   ?>
		<input  type='number' name='bonus_amount' id='bonus_amount' value='{{ $row['bonus_amount'] }}' 
						required       class='form-control is_number'  /> 						
									  </div> 					
									  <div class="form-group  depen-  wrap-bonus_qualifying_amount  " >
										<label for="ipt" class=" control-label "> Bonus Qualifying Amount  <span class="asterix"> * </span>  </label>
										
										
										  <?php if( !isset($row['bonus_qualifying_amount']))  $row['bonus_qualifying_amount'] = null;   ?>
		<input  type='number' name='bonus_qualifying_amount' id='bonus_qualifying_amount' value='{{ $row['bonus_qualifying_amount'] }}' 
						required       class='form-control is_number'  /> 						
									  </div> 					
									  <div class="form-group  depen-  wrap-active_from  " >
										<label for="ipt" class=" control-label "> active_from  <span class="asterix"> * </span>  </label>
										
										
										  <?php if( !isset($row['active_from']))  $row['active_from'] = null;   ?>
		
				<div class="input-group m-b" style="width:150px !important;">
				
				<input  type='text' name='active_from' id='active_from' value='{{ $row['active_from'] }}' 
				required       class='form-control input-sm @if(trim('  ')!='readonly') datetime @endif ' />

					<span class="input-group-addon calwrap"><i class="fa fa-calendar"></i></span>
				</div>
				 						
									  </div> 					
									  <div class="form-group  depen-  wrap-active_to  " >
										<label for="ipt" class=" control-label "> active_to    </label>
										
										
										  <?php if( !isset($row['active_to']))  $row['active_to'] = null;   ?>
		
				<div class="input-group m-b" style="width:150px !important;">
				
				<input  type='text' name='active_to' id='active_to' value='{{ $row['active_to'] }}' 
				       class='form-control input-sm @if(trim('  ')!='readonly') datetime @endif ' />

					<span class="input-group-addon calwrap"><i class="fa fa-calendar"></i></span>
				</div>
				 						
									  </div> <?php if( strlen($row['created_at']) < 1 )  $row['created_at']  = '2022-06-09 09:29:25'; 	  ?>
		<input  type='hidden' name='created_at' id='created_at' value='{{ date("Y-m-d H:i:s") }}' /><?php if( !isset($row['updated_at']))  $row['updated_at'] = null;   ?>
		<input  type='hidden' name='updated_at' id='updated_at' value='{{ date("Y-m-d H:i:s") }}' /></fieldset>
			</div>
			
			<div class="col-md-6">
						<fieldset class="sbox" style="border-top:0; border-radius: 5px;"><legend> None</legend>
									
									  <div class="form-group  depen-  wrap-status  " >
										<label for="ipt" class=" control-label "> Status    </label>
										
										
										  <?php if( !isset($row['status']))  $row['status'] = null;   ?>
		<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> </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("registrationcodes/removefiles?file=")}}'+$(this).attr('url');
			$(this).parent().remove();
			$.get(removeUrl,function(response){});
			$(this).parent('div').empty();	
			return false;
		});		
		
	});
	</script>		 
@stop