<div class="ulp-stuffbox">

  <h3 class="ulp-h3"><?php _e('Student badges', 'ulp');?></h3>

  <div class="inside">



<form action="" method="post" role = "form">

	<div class="ulp-inside-item">

              <div class="row">

               <div class="col-xs-6">

				<div class="ulp-form-line" style="">

					<h2><?php _e('Activate Student Badges', 'ulp');?></h2>

					<label class="ulp_label_shiwtch" style="margin:10px 0 10px -10px;">

						<input type="checkbox" class="ulp-switch" onClick="ulpCheckAndH(this, '#ulp_student_badges_enable');" <?php if ($data['metas']['ulp_student_badges_enable']) echo 'checked';?> />

						<div class="switch" style="display:inline-block;"></div>

					</label>

                    <input type="hidden" name="ulp_student_badges_enable" id="ulp_student_badges_enable" value="<?php echo $data['metas']['ulp_student_badges_enable'];?>" />



				</div>

      <div class="form-group row" style="margin-top: 30px;">

          <div class="col-4">

              <input type="submit" name="submit" value="<?php _e('Save Changes', 'ulp');?>"  class="btn btn-primary pointer" />

          </div>

      </div>

     </div>

    </div>

</div>

</form>



  </div>

</div>



  <div class="row">

     <div class="col-xs-6">

		<div class="wrap">

   		 <a href="<?php echo admin_url('admin.php?page=ultimate_learning_pro&tab=student_badges&action=new');?>" class="page-title-action ulp-add-new-post-bttn"><?php _e('Add new Badge', 'ulp');?></a>

		</div>

	</div>

 </div>





<div class="ulp-wrapper">

<div style="margin-top: 20px">



	<?php if ($data ['items']):?>

	  <table class="wp-list-table widefat fixed tags ulp-admin-tables striped ">

	      <thead class="thead-inverse">

	        <tr>

	          <th style="width:3%;"><?php _e('ID', 'ulp');?></th>

	          <th style="width:30%;"><?php _e('Badge Image', 'ulp');?></th>

	          <th style="width:25%;"><?php _e('Title', 'ulp');?></th>

	          <th style="width:15%;"><?php _e('Description', 'ulp');?></th>

	          <th style="width:7%;"><?php _e('Type', 'ulp');?></th>

	          <th style="width:20%;"><?php _e('Achievement', 'ulp');?></th>

	        </tr>

	      </thead>

	      <tbody>

	          <?php foreach ($data['items'] as $object):?>

	              <tr id="<?php echo 'table_tr_' . $object->id;?>" onMouseOver="ulpDhSelector(('<?php echo '#hidden' . $object->id;?>', 1);" onMouseOut="ulpDhSelector(('<?php echo '#hidden' . $object->id;?>', 0);">

	                <td scope="row">

	                    <?php echo $object->id;?>

	                </td>

	                <td style="text-align:center;"><img src="<?php echo $object->badge_image;?>" class="uap-admin-badge-image" style="max-width:90%; max-height:100px; margin-bottom:10px; " /></td>

	                <td >

	                    <div style="color: #21759b; font-weight:bold;font-family: 'Oswald', arial, sans-serif !important;font-size: 14px;font-weight: 400;"><?php echo $object->badge_title;?></div>

	                    <div id="<?php echo 'hidden' . $object->id;?>" style="visibility: hidden;">

	                        <a href="<?php echo admin_url('admin.php?page=ultimate_learning_pro&tab=student_badges&action=edit&id=' .$object->id);?>"><?php _e('Edit', 'ulp');?></a>

	                        <span class="ulp-delete" onClick="ulpBadgesDoDelete(<?php echo $object->id;?>);" ><?php _e('Delete', 'ulp');?></span>

	                    </div>



	                </td>

	                <td><?php echo $object->badge_content;?></td>

	                <td><div class="ulp-property"><?php echo ucfirst($object->badge_type);?></div></td>

	                <td style="font-size: 14px;color: #333;font-weight: 500;">

					<?php

							if ($object->rule){

								$rules = json_decode($object->rule, true);

								switch($rules['rule_type']){

								case 'finish_course':

									echo __('Finish the Course with ','ulp').$rules['rule_value'];

									break;

								case 'finish_quiz':

									echo __('Finish the Quiz with ','ulp').$rules['rule_value'];

									break;

								case 'reward_points':

									echo __('Received ','ulp').$rules['rule_value'].__(' points','ulp');

									break;

								default:

									echo '<div><span style="font-weight:bold;">'.__('Reason: ', 'ulp').'</span>' . $rules['rule_type'].'</div>';

									echo '<div><span style="font-weight:bold;">'.__('With: ', 'ulp').'</span>' . $rules['rule_value'].'</div>';

								};

							} else {

									echo '';

							}

									?></td>

	              </tr>

	            <?php endforeach;?>

	      </tbody>

	  </table>

	  <div class="ulp-clear"></div>



	<?php else :?>

	  <div><?php _e('No items yet!', 'ulp');?></div>

	<?php endif;?>





   </div>

 </div>





