 
<?php $__env->startSection('content'); ?>
<div class="content-wrapper merchant-right-side">
	<!-- Content Header (Page header) -->
	
	<section class="content">
          <div class="row">
           <div class="col-md-8">
	<div class="box box-warning">
                <div class="box-header with-border">
                  <h3 class="box-title">Edit Loyalty Program Reward</h3>
                </div><!-- /.box-header -->
                <?php echo $__env->make('includes.messages', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                
               <div class="box-body">
                  <?php echo Form::open(array('url'=>'merchant/reward/update/'.$rewards->id,'method'=>'POST','role'=>"form",
							'files'=>true,'id'=>'adds-add-form')); ?>

				    <?php 
				    $type="";
				    $loyalty=LoyaltyProgram::where('merchant_id',Auth::user()->id)->first();
				    if($loyalty->loyalty_type==1){
				    	$type="Stamps";
				    }else{
				    	$type="Credits";
				    	}
			$str =$rewards->valid_on;
			$exp= explode(',', $rewards->valid_on);
			$splittime=explode(',', $rewards->timing);
			$from=$splittime[0];
			$to=$splittime[1];
			?>
						
				<div class="row">
		<div class="col-md-4">	
		<div class="form_group">
			<?php echo Form::label('title',$type,['class' => 'required']); ?>

			<?php echo Form::text('points',$rewards->points,array('class' => 'required numericOnly form-control')); ?>

		</div>
		</div>
		<div class="col-md-8">
		<div class="form_group">
			<?php echo Form::label('title', 'Specify your Reward',['class' => 'required']); ?>

			<?php echo Form::text('name',$rewards->name,array('class' => 'required form-control')); ?>

		</div>
		</div></div>
			<br>		
				<div class="row">
		<div class="col-md-4">	
		<div class="form_group">
			<?php echo Form::label('title', 'Validity Period (in Days)',['class' => 'required']); ?>

			<?php echo Form::text('validity',$rewards->validity,array('class' => 'required numericOnly form-control')); ?>

		</div>
		
		</div><div class="col-md-8">
			<div class="form_group">
			<?php echo Form::label('title', 'Terms & Conditions',['class' => 'required']); ?>

			<?php echo Form::textarea('terms',$rewards->terms,array('class' => 'required form-control','rows'=>'3')); ?>

		</div>
		</div></div>
		<br>
			<div class="row">
		<div class="col-md-4">
		<div class="row">
		<div class="col-md-6"><?php echo Form::label('title', 'Valid From',['class' => 'required']); ?>

			<select name="vfrom" class="form-control">
				<option value="" >Time</option>
			<?php for($i=0; $i<24; $i++){ 
			?>
			<option value="<?=$i?>" <?php if ($from==$i ) echo 'selected' ; ?>><?=$i?>.00</option>
			<?php }?>
			</select>
		</div>
		<div class="col-md-6"><?php echo Form::label('title', 'Valid Till',['class' => 'required']); ?>

			<select name="vto" class="form-control">
			<option value="">Time</option>
			<?php for($i=0; $i<24; $i++){ ?>
			<option value="<?=$i?>" <?php if ($to==$i ) echo 'selected' ; ?>><?=$i?>.00</option>
			<?php }?>
			</select>
		</div>
		</div></div>
		<div class="col-md-8">
			<div class="form_group">
		<?php echo Form::label('title', 'Valid on the following days',['class' => 'required']); ?><br>
		<div class="ck-button">
		 <label><input type="checkbox" class="hidden" name='sun' <?php if (in_array('1', $exp)){ echo 'checked';} ?> value="1" ><span>SUN</span></label>
		 <label><input type="checkbox" class="hidden" name='mon' <?php if (in_array('2', $exp)){ echo 'checked';} ?> value="2"><span>MON</span></label>
		 <label><input type="checkbox" class="hidden" name='tue' <?php if (in_array('3', $exp)){ echo 'checked';} ?> value="3"><span>TUE</span></label>
		 <label><input type="checkbox" class="hidden" name='wed' <?php if (in_array('4', $exp)){ echo 'checked';} ?> value="4"><span>WED</span></label>
		 <label><input type="checkbox" class="hidden" name='thu' <?php if (in_array('5', $exp)){ echo 'checked';} ?> value="5"><span>THU</span></label>
		 <label><input type="checkbox" class="hidden" name='fri' <?php if (in_array('6', $exp)){ echo 'checked';} ?> value="6"><span>FRI</span></label>
		 <label><input type="checkbox" class="hidden" name='sat' <?php if (in_array('7', $exp)){ echo 'checked';} ?> value="7"><span>SAT</span></label>
		</div>
		</div>
		</div></div><br>
		<div class="row">
		<div class="col-md-4">
		<div class="form_group">
			<?php echo Form::label('Timing','Location',array('class'=>'required')); ?>

			<?php echo Form::text('location',$rewards->location,array('class' => 'required form-control')); ?>

		</div>
		</div>
		<div class="col-md-6">
		</div>
		</div><br>
		<div class="form_group">
		<input type="submit" class='btn btn-primary' name="submit" value="Submit">&emsp;
		<?php echo Form::close(); ?>

                </div>
               </div>
</div>
</div>
</section>
	<!-- /.content -->
</div>
<?php $__env->startSection('scripts'); ?>
<script>
$(".numericOnly").keypress(function (e) {
	if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
        return false;
    }
});
</script>
<?php $__env->stopSection(); ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.merchant-backend-layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>