<?php 
/********************************************************************************* 
 *  This file is part of Sentrifugo.
 *  Copyright (C) 2014 Sapplica
 *   
 *  Sentrifugo is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Sentrifugo is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Sentrifugo.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  Sentrifugo Support <support@sentrifugo.com>
 ********************************************************************************/
?>

<?php
if($this->nodata != '')
{
?>
<div class="ml-alert-1-info m1-info-set-2">
    <div class="style-1-icon info"></div>
       No data found.
</div>
<?php 
}
else 
{
sapp_Global::generateClientValidations($this->form);
$bunit_name = $this->bunit_name;
$group_name = $this->group_name;
?>
<div id="error_message" style="display:none;"></div>

<form name="<?php echo $this->form->getName(); ?>" id="<?php echo $this->form->getId(); ?>" action="<?php echo $this->form->getAction();?>" method="<?php echo $this->form->getMethod(); ?>">
		<?php echo $this->form->id; ?>
        <div class="total-form-controller">
	<div class="new-form-ui clearb">
			  <label>Business Unit</label>
			<div class="division loca_state_div"><?php //echo $this->form->business_unit_id; ?>
                        <input type="hidden" name="business_unit_id" id="business_unit_id" value="<?php echo $this->form->business_unit_id->getValue();?>" />
                        <select disabled>
                            <option><?php echo $bunit_name;?></option>
                        </select>
                        </div>
			<span class="errors" id="errors-business_unit_id"></span>
			</div>		
            <div class="new-form-ui clearb">
			  <label class="required">Group</label>
			<div class="division loca_state_div"><?php //echo $this->form->group_id; ?>
                        <input type="hidden" name="group_id" id="group_id" value="<?php echo $this->form->group_id->getValue();?>" />
                        <select disabled>
                            <option><?php echo $group_name;?></option>
                        </select></div>
			<div class="errors" id="errors-group_id"></div>
			</div>
			
			<div class="new-form-ui clearb">
			  <label class="required">Group Email </label>
			<div class="division"><?php echo $this->form->groupEmail; ?>
                        <input type="hidden" name="hid_groupemail" value="<?php echo $this->form->groupEmail->getValue();?>" />
                        </div>
			 <div class="errors" id="errors-groupEmail" ></div>
			</div>
        <div class="new-form-ui-submit">
        <?php echo $this->form->submit; ?>
        <button onclick="window.location.href='<?php echo BASE_URL; ?>emailcontacts';" type="button" id="Cancel" name="Cancel">Cancel</button>
        </div>
</div>
</form>


<?php if(!empty($this->msgarray))	{	?>
<script type="text/javascript" language="javascript">
	var group_idError = "<?php echo (isset($this->msgarray["group_id"]) && $this->msgarray["group_id"] != "")?$this->msgarray["group_id"] : ''; ?>";
        var bunit_idError = "<?php echo (isset($this->msgarray["business_unit_id"]) && $this->msgarray["business_unit_id"] != "")?$this->msgarray["business_unit_id"] : ''; ?>";
	var grpEmailError = "<?php echo (isset($this->msgarray["groupEmail"]) && $this->msgarray["groupEmail"] != "")? $this->msgarray["groupEmail"] : ''; ?>";
	
	if(group_idError != "")          $("#errors-group_id").text(group_idError);
	else                                    $("#errors-group_id").text("");
	
        if(grpEmailError != "")           
            $("#errors-groupEmail").text(grpEmailError);
	else
            $("#errors-groupEmail").text("");
        
        if(bunit_idError != "")           
            $("#errors-business_unit_id").text(bunit_idError);
	else
            $("#errors-business_unit_id").text("");
	
</script>
<?php	}
?>
    
    
<?php
}	?>