<?php
include('../../../function/__data_app_db.php');
$__data_ction = 'false';
 $_name_in_jsnj  = $__go_to = $errData = $sub_array=$type_desc='';
if(isset($_POST['process'])){
   $i = 0;
    $query_user = mysqli_query($_conn_db,"select * from users where  action='1' order by login_id asc");

    while($data_user = mysqli_fetch_array($query_user)){
        $full_name = show_jsnj_data($data_user['full_name']);
        $password = show_jsnj_data($data_user['password_salt']);
        $email = show_jsnj_data($data_user['email']);
        $contact = show_jsnj_data($data_user['mobile']);
        $type = show_jsnj_data($data_user['type']);
        $referral_code = show_jsnj_data($data_user['referral_code']);
        $crn_num = show_jsnj_data($data_user['login_id']);
        $date_time = show_jsnj_data(date('d-m-Y', strtotime($data_user['date_time'])));
      if($type == 1) {
			$act_de ='<div class="label label-success">Active</div>';
			} else if($type == 2) {
          $act_de = "<div class='label label-danger'>Deactive</div>";
			};
        $i++;
        $sub_array.= "<tr>
        <td>$i</td>
        <td><a class=\"text-info add-tooltip\" href=\"$http://$host$uri/quotation-history?crn=$crn_num\" data-original-title=\"CRN #$crn_num Quotation History\" data-container=\"body\">$crn_num</a></td>
        <td>$date_time</td>
        <td>$full_name</td>
        <td>$email</td>
        <td>$contact</td>
        <td user-password=\"$crn_num\">$password</td>
		<td>$referral_code</td>
        <td>$act_de</td>
         <td class=\"min-width\">
					                       <div class=\"btn-groups\">
					                       <div class=\"btn-group btn-group-sm\" role=\"group\" aria-label=\"Size Small\">
                  <a href=\"$http://$host$uri/quotation-history?crn=$crn_num\" class=\"btn add-tooltip\" data-original-title=\"Quotation History\"  data-container=\"body\"><i class=\"bx bx-file\"></i></a>
                  <a href=\"$http://$host$uri/referral-history?crn=$crn_num\"  class=\"btn add-tooltip\"  data-original-title=\"Referral History\"  data-container=\"body\"><i class=\"bx bx-user-plus\"></i></a>
				  <!--<button user-password-action=\"$crn_num\" class=\"btn btn-icon text-warning demo-pli-pen-5 icon-lg add-tooltip change-password\" data-original-title=\"Change Password\" data-container=\"body\"><i class=\"bx bx-lock\"></i></button>-->
				  <button user-type-action=\"$crn_num\" user-type=\"$type\" class=\"btn btn-icon demo-pli-lock-user icon-lg add-tooltip text-danger user-type\" data-original-title=\"Deactivate Account\" data-container=\"body\"><i class=\"bx bx-user\"></i></button>
					                           
                                                </div>
					                       </div>
					                    </td>
    </tr>";
};
    $output = array(
        "tr" => $sub_array,
        "res"  =>  'true'
    );
    echo json_encode($output);
} else {
 echo 'error found';
};
?>
