<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>

      <div class="main my-0">
        <div class="row mt-3 mx-0">
          <div class="col-md-6">
            <h3><?php echo $pgheading;?></h3>
          </div>
          <div class="col-md-5 text-right">
            &nbsp;
          </div>
        </div>
        
        <div class="container_fluid mt-2 px-3">
		<form name="frmgeneral" method="post" action="account/staff/managedata" autocomplete="off" enctype="multipart/form-data" onsubmit="return checkform();">
		<input type="hidden" name="rsrcid" value="<?php echo $rsrcid;?>">                
		<input type="hidden" name="usertype" value="staff">                
        <table class="webforms mt-0 table-responsive-sm">
         <tr>
         <tr>
          <td width="20%"><label>Name:</label></td>
          <td width="80%"><input type="text" name="name" id="name" value="<?php if($info4edit) { echo $info4edit->fld_name; }?>" required></td>
         </tr> 
		

         <tr>
          <td width="20%"><label>Email:</label></td>
          <td width="80%"><input type="email" name="email" id="email" value="<?php if($info4edit) { echo $info4edit->fld_email; }?>" ></td>
         </tr>		
         <tr>
          <td width="20%"><label> Mobile:</label></td>
          <td width="80%"><input type="text" name="mobile" id="mobile" value="<?php if($info4edit) { echo $info4edit->fld_mobile; }?>" ></td>
         </tr>
         <tr>
          <td width="20%"><label> Username:</label></td>
          <td width="80%"><input type="text" name="username" id="username" value="<?php if($info4edit) { echo $info4edit->fld_username; }?>" <?php if($info4edit) { echo 'readonly'; }?> autocomplete="off"></td>
         </tr>
         <tr>
          <td width="20%"><label> Password:</label></td>
          <td width="80%"><input type="password" name="upass" id="upass" value="" autocomplete="off"></td>
         </tr>
         <tr>
          <td width="20%"><label> Assign Right:</label></td>
          <td width="80%">
			<div class="row">
		<?php
			$idx = 0;
			$arrrights = array();
			if($info4edit->fld_access) $arrrights = explode(",", $info4edit->fld_access);
			foreach(getuserrights() as $vkey=>$kvalue)
			{
				$idx++;
				$tpindex++;
				$sel_zone = "";									
				if(in_array($vkey, $arrrights))
				{
					$sel_zone = 'checked="checked"';
				}
			?>
				<div class="col-md-4"><label class="container-checkbox horzbox">
				<input type="checkbox" name="userrights[]" id="userrights<?php echo $tpindex;?>" value="<?php echo $vkey;?>"<?php echo $sel_zone;?>><?php echo $kvalue ;?>
				<span class="checkmark leftchkbx"></span>
				</label>
				</div>
			<?php
			}
			?>
			</div>
			  
          </td>
         </tr>

		 <tr>
             <td></td>
             <td><button class="btn btn-danger">Submit</button></td>
         </tr>
         </table>
         </form> 
	         <div class="clearfix"></div>          
        </div>
       </div>
<script>
function checkform()
{
	if($('input[name="userrights[]"]:checked').length > 0)
	{
		return true;
	}
	else
	{
		alert("Please select user right(s)");
		return false;
	}
}
</script>
