<?php
ini_set('display_errors', 0);
require_once './Control/ControlContato.php';
//require_once './Control/ControlFoto.php';
require_once './Util/formAjax/FormAjax.php';
extract($_POST);
//var_dump($_POST);
if (!isset($lang))
{
	$lang = 'pt';
} else 
{
	if ($lang == 'undefined')
	{
		$lang = 'pt';
	}
}
$controlContato = new ControlContato();
if ($acao == 'inserir')
{
        echo 'Novo Registro...';
        $pk = '';
	$contatoDepartamento = new Contatodepartamento();
        $contatoDepartamento->setHabilitado(1);
} else
{
	$contatoDepartamento = $controlContato->pegarUmContatodepartamento($pk);
}
$contatoDepartamento->lang = $lang;
$arquivoGrid = 'adm_contatoDepartamentoGrid.php';
?>
<form name="frm" id="frm" action="adm_contatoDepartamentoCMD.php" method="post">
    <input id="hacao" name="acao" type="hidden" value="<?php echo $acao?>">
    <input id="lang" name="lang" type="hidden" value="<?php echo $lang?>">
    <input id="arqFrm" name="arqFrm" type="hidden" value="<?php echo end(explode("/", $_SERVER['PHP_SELF']))?>">
	<fieldset>
		<label>Departamento</label>
                <?php Idiomas::ComboSelecionarIdiomaPainelControle($acao, $pk, $lang);?>
		<section><label for="pk">ID</label>
                    <div><input  readonly="true" type="text" id="pk" name="pk" value="<?php echo $contatoDepartamento->getContatodepartamentoid(); ?>" placeholder="Este campo é gerido de forma automática."></div>
		</section>
                <section><label for="txtNome">Nome</label>
                    <div><input type="text" id="txtNome" name="txtNome" required value="<?php echo $contatoDepartamento->gNome(); ?>"></div>
		</section>
                <section><label for="txtEmail">E-mail</label>
                    <div><input type="text" id="txtEmail" name="txtEmail" required value="<?php echo $contatoDepartamento->getEmail(); ?>"></div>
		</section>
                <section><label for="txtTelefone">Telefone</label>
                    <div><input type="text" id="txtTelefone" name="txtTelefone" required value="<?php echo $contatoDepartamento->getTelefone(); ?>"></div>
		</section>
                <section><label for="txtRamal">Ramal</label>
                    <div><input type="text" id="txtRamal" name="txtRamal" value="<?php echo $contatoDepartamento->getRamal(); ?>"></div>
		</section>
                <section><label for="cbHabilitado">Visível ao público:</label>
                    <div>					
                        <select name="cbHabilitado" id="cbContatoTipoID">
                            <optgroup label="Habilitado">
                                <?php echo Utilidades::formSeletorBoleano('cbHabilitado',$contatoDepartamento->getHabilitado())?>
                            </optgroup>
                        </select>
                    </div>
		</section>
                <section>
                    <div><button onclick="mostrarArquivo('<?php echo $arquivoGrid; ?>','#dados');" >Cancelar</button><button id="salvar" class="submit" name="submitbuttonname" value="submitbuttonvalue">Salvar</button></div>
		</section>
	</fieldset>
</form>
<?php
      FormAjax::javascriptTrocarIdioma('adm_contatoDepartamentoForm.php');
      FormAjax::PrepararFormAjax('#frm');
?>