forked from SimplesIP/pabx-app
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
760 lines
45 KiB
760 lines
45 KiB
<?php |
|
// |
|
//include('ajaxFuncoes.php'); |
|
|
|
$fields = array('id', 'nome', 'discar', 'id_horario', 'horario_inicio', 'horario_fim', 'todos_dias_semana', 'semana', |
|
'semana_fim', 'todos_dias_mes', 'dias_mes', 'dias_mes_fim', 'todos_mes', 'mes', |
|
'mes_fim', 'opcaoH', 'acaoH', 'opcao_nao', 'acao_nao', 'feriado', 'item'); |
|
|
|
/* |
|
* Parametros necessarios para manter a paginação. |
|
*/ |
|
$param = sprintf('&numRamal=%s&pgn=%s&bloco=%s&pg=%s', $_REQUEST['numRamal'], $_REQUEST['pgn'], $_REQUEST['bloco'], $_REQUEST['pg']); |
|
|
|
if (IsPostBack()) { |
|
/* |
|
* Atribui valores de post para variaveis globais |
|
*/ |
|
foreach ($fields as $value) |
|
$GLOBALS[$value] = $value == 'nome' ? RemoveAcentos ($_POST[$value], true) : $_POST[$value]; |
|
|
|
$numItens = $_POST['numItens']; |
|
$acao = $_POST["acao"]; |
|
$id = $_POST["id"]; |
|
|
|
if (isset($_POST["btSalvar"])) { |
|
$query = sprintf("update pbx_horarios set nome = %s, discar = %s, opcao_nao = %s, acao_nao = %s, status = 1 where id = %s", QuotedStr($nome), QuotedStr($discar), QuotedStr($opcao_nao), QuotedStr($acao_nao), $id); |
|
|
|
$result = pg_query($dbcon, $query); |
|
gera_arquivos($dbcon, 'HORARIOS'); |
|
gera_arquivos($dbcon, 'TESTES'); |
|
} else if (isset($_POST["btNovoHorario"])) { |
|
if ($id == 0) { |
|
$query = sprintf("insert into pbx_horarios(nome, discar, opcao_nao, acao_nao) values(%s, %s, %s, %s)", QuotedStr($nome), QuotedStr($discar), QuotedStr($opcao_nao), QuotedStr($acao_nao)); |
|
$result = pg_query($dbcon, $query); |
|
|
|
$query = "select max(id) from pbx_horarios"; |
|
$result = pg_query($dbcon, $query); |
|
$row = pg_fetch_row($result); |
|
$id = $row[0]; |
|
} |
|
|
|
$query = "insert into pbx_horarios_itens( id_horario, horario_inicio, horario_fim, todos_dias_semana, semana, |
|
semana_fim, todos_dias_mes, dias_mes, dias_mes_fim, todos_mes, mes, |
|
mes_fim, opcao, acao, feriado) |
|
values( %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"; |
|
$query = sprintf($query, QuotedStr($id), QuotedStr($horario_inicio), QuotedStr($horario_fim), QuotedStr($todos_dias_semana), QuotedStr($semana ? $semana : '0'), QuotedStr($semana_fim ? $semana_fim : '0'), QuotedStr($todos_dias_mes), QuotedStr($dias_mes ? $dias_mes : '0'), QuotedStr($dias_mes_fim ? $dias_mes_fim : '0'), QuotedStr($todos_mes), QuotedStr($mes ? $mes : '0'), QuotedStr($mes_fim ? $mes_fim : '0'), QuotedStr($opcaoH), QuotedStr($acaoH), QuotedStr($feriado)); |
|
$result = pg_query($dbcon, $query); |
|
|
|
$query = sprintf("update pbx_horarios set status = 0 where id = %s", $id); |
|
$result = pg_query($dbcon, $query); |
|
} else if (isset($_POST["btEditar"])) { |
|
$query = "UPDATE pbx_horarios_itens SET " |
|
. "horario_inicio = %s, " |
|
. "horario_fim = %s, " |
|
. "todos_dias_semana = %s, " |
|
. "semana = %s, " |
|
. "semana_fim = %s, " |
|
. "todos_dias_mes = %s, " |
|
. "dias_mes = %s, " |
|
. "dias_mes_fim = %s, " |
|
. "todos_mes = %s, " |
|
. "mes = %s, " |
|
. "mes_fim = %s, " |
|
. "opcao = %s, " |
|
. "acao = %s, " |
|
. "feriado = %s " |
|
. "WHERE id = %s AND id_horario = %s;"; |
|
$query = sprintf($query, QuotedStr($horario_inicio), QuotedStr($horario_fim), QuotedStr($todos_dias_semana), QuotedStr($semana ? $semana : '0'), QuotedStr($semana_fim ? $semana_fim : '0'), QuotedStr($todos_dias_mes), QuotedStr($dias_mes ? $dias_mes : '0'), QuotedStr($dias_mes_fim ? $dias_mes_fim : '0'), QuotedStr($todos_mes), QuotedStr($mes ? $mes : '0'), QuotedStr($mes_fim ? $mes_fim : '0'), QuotedStr($opcaoH), QuotedStr($acaoH), QuotedStr($feriado), $_SESSION['SSHorarioEditItem'], $id); |
|
|
|
$_SESSION['SSHorarioEditItem'] = null; |
|
$result = pg_query($dbcon, $query); |
|
} |
|
|
|
SetInicio(); |
|
} else { |
|
$acaoH = $_GET["acaoH"]; |
|
if (!isset($_GET["id"])) { |
|
$id = 0; |
|
$numItens = 0; |
|
$GLOBALS["nome"] = ""; |
|
$GLOBALS["opcaoH"] = null; |
|
$GLOBALS["acaoH"] = null; |
|
$GLOBALS["opcao_nao"] = null; |
|
$GLOBALS["acao_nao"] = null; |
|
SetInicio(); |
|
} else { |
|
|
|
if (isset($_GET["deletar"])) { |
|
DeletaItens($dbcon, $_GET["deletar"]); |
|
} |
|
|
|
if ($_GET["action"] == 'edit') { |
|
$_SESSION['SSHorarioEditItem'] = $_GET['item']; |
|
$itemHorario = GetHorarioItem($dbcon, $_GET['id'], $_GET['item']); |
|
} |
|
|
|
$id = $_GET["id"]; |
|
$linhas = GetHorarios($dbcon, $id, $acaoH); |
|
SetInicio($itemHorario); |
|
} |
|
} |
|
|
|
function DeletaItens($dbcon, $id) { |
|
$query = "delete from pbx_horarios_itens where id = $id"; |
|
$result = pg_query($dbcon, $query); |
|
} |
|
|
|
function SetInicio($data = null) { |
|
$GLOBALS["semana"] = isset($data['semana']) ? $data['semana'] : "mon"; |
|
$GLOBALS["semana_fim"] = isset($data['semana_fim']) ? $data['semana_fim'] : "mon"; |
|
$GLOBALS["dias_mes"] = isset($data['dias_mes']) ? $data['dias_mes'] : "1"; |
|
$GLOBALS["dias_mes_fim"] = isset($data['dias_mes_fim']) ? $data['dias_mes_fim'] : "1"; |
|
$GLOBALS["mes"] = isset($data['mes']) ? $data['mes'] : "jan"; |
|
$GLOBALS["mes_fim"] = isset($data['mes_fim']) ? $data['mes_fim'] : "jan"; |
|
$GLOBALS["horario_inicio"] = isset($data['horario_inicio']) ? $data['horario_inicio'] : "08:00"; |
|
$GLOBALS["horario_fim"] = isset($data['horario_fim']) ? $data['horario_fim'] : "17:59"; |
|
$GLOBALS["todos_dias_semana"] = isset($data['todos_dias_semana']) ? $data['todos_dias_semana'] : 1; |
|
$GLOBALS["todos_dias_mes"] = isset($data['todos_dias_mes']) ? $data['todos_dias_mes'] : 1; |
|
$GLOBALS["todos_mes"] = isset($data['todos_mes']) ? $data['todos_mes'] : 1; |
|
$GLOBALS["opcaoH"] = isset($data['opcao']) ? $data['opcao'] : null; |
|
$GLOBALS["acaoH"] = isset($data['acaoh']) ? $data['acaoh'] : null; |
|
$GLOBALS["opcao"] = isset($data['opcao']) ? $data['opcao'] : null; |
|
$GLOBALS["opc"] = isset($data['opc']) ? $data['opc'] : null; |
|
$GLOBALS["feriado"] = isset($data['feriado']) ? $data['feriado'] : null; |
|
} |
|
|
|
function DiasSemana($dia) { |
|
$semana = array("Domingo" => "sun", "Segunda" => "mon", "Terça" => "tue", "Quarta" => "wed", "Quinta" => "thu", "Sexta" => "fri", "Sabado" => "sat"); |
|
|
|
$opt = ""; |
|
$sel = ""; |
|
foreach ($semana as $key => $value) { |
|
if ($value == $dia) |
|
$sel = "selected"; |
|
else |
|
$sel = ""; |
|
$opt .= "<option value=\"$value\" $sel>$key</option>"; |
|
} |
|
|
|
return $opt; |
|
} |
|
|
|
function DiasMes($data) { |
|
$dias_mes = array("1" => "1", "2" => "2", "3" => "3", "4" => "4", "5" => "5", "6" => "6", "7" => "7", "8" => "8", "9" => "9", "10" => "10", "11" => "11", "12" => "12", "13" => "13", "14" => "14", "15" => "15", "16" => "16", "17" => "17", "18" => "18", "19" => "19", "20" => "20", "21" => "21", "22" => "22", "23" => "23", "24" => "24", "25" => "25", "26" => "26", "27" => "27", "28" => "28", "29" => "29", "30" => "30", "31" => "31"); |
|
$opt = ""; |
|
$sel = ""; |
|
foreach ($dias_mes as $key => $value) { |
|
if ($value == $data) |
|
$sel = "selected"; |
|
else |
|
$sel = ""; |
|
$opt .= "<option value=\"$value\" $sel>$key</option>"; |
|
} |
|
|
|
return $opt; |
|
} |
|
|
|
function Meses($mes) { |
|
$meses = array("Janeiro" => "jan", "Fevereiro" => "feb", "Março" => "mar", "Abril" => "apr", "Maio" => "may", "Junho" => "jun", "Julho" => "jul", "Agosto" => "aug", "Setembro" => "sep", "Outubro" => "oct", "Novembro" => "nov", "Dezembro" => "dec"); |
|
|
|
$opt = ""; |
|
$sel = ""; |
|
foreach ($meses as $key => $value) { |
|
if ($value == $mes) |
|
$sel = "selected"; |
|
else |
|
$sel = ""; |
|
$opt .= "<option value=\"$value\" $sel>$key</option>"; |
|
} |
|
|
|
return $opt; |
|
} |
|
|
|
function GetHorarioItem($dbcon, $id_horario, $id) { |
|
$query = "select * from ( select a.id, a.id_horario, a.horario_inicio, a.horario_fim, a.todos_dias_semana, a.semana, |
|
a.semana_fim, a.todos_dias_mes, a.dias_mes, a.dias_mes_fim, a.todos_mes, a.mes, |
|
a.mes_fim, b.name as opcao, c.descricao as acao, a.opcao as opc, acao as acaoh, case when(feriado = 'A')then 0 else 1 end as feriado |
|
from pbx_horarios_itens a |
|
left outer join pbx_opcoes b on b.value = a.opcao |
|
left outer join pbx_opcao_acao c on c.opcao = a.opcao and c.id = a.acao |
|
where id_horario = $id_horario and a.id = $id) as itens order by feriado asc, id"; |
|
$result = pg_query($dbcon, $query); |
|
$row = pg_fetch_assoc($result); |
|
return $row; |
|
} |
|
|
|
function GetHorarios($dbcon, $id, $acaoH) { |
|
$mesesDisp = array("jan" => "Jan", "feb" => "Fev", "mar" => "Mar", "apr" => "Abr", "may" => "Mai", "jun" => "Jun", "jul" => "Jul", "aug" => "Ago", "sep" => "Set", "oct" => "Out", "nov" => "Nov", "dec" => "Dez"); |
|
$semanaDisp = array("sun" => "Dom", "mon" => "Seg", "tue" => "Ter", "wed" => "Qua", "thu" => "Qui", "fri" => "Sex", "sat" => "Sab"); |
|
|
|
$query = "select id, nome, discar, opcao_nao, acao_nao from pbx_horarios where id = $id"; |
|
|
|
$result = pg_query($dbcon, $query); |
|
$row = pg_fetch_array($result); |
|
$nome = $row["nome"]; |
|
$discar = $row["discar"]; |
|
$opcao_nao = $row["opcao_nao"] ? $row["opcao_nao"] : '-'; |
|
$acao_nao = $row["acao_nao"] ? $row["acao_nao"] : '-'; |
|
|
|
$query = "select * from ( select a.id, a.id_horario, a.horario_inicio, a.horario_fim, a.todos_dias_semana, a.semana, |
|
a.semana_fim, a.todos_dias_mes, a.dias_mes, a.dias_mes_fim, a.todos_mes, a.mes, |
|
a.mes_fim, b.name as opcao, a.acao as acao, case when(feriado = 'A')then 0 else 1 end as feriado |
|
from pbx_horarios_itens a |
|
left outer join pbx_opcoes b on b.value = a.opcao |
|
left outer join pbx_opcao_acao c on c.opcao = a.opcao and c.id = a.acao |
|
where id_horario = $id) as itens order by feriado asc, id"; |
|
|
|
$result = pg_query($dbcon, $query); |
|
$linha = ""; |
|
$numReg = 0; |
|
while ($row = pg_fetch_array($result)) { |
|
$numReg++; |
|
$horario_inicio = $row["horario_inicio"]; |
|
$horario_fim = $row["horario_fim"]; |
|
$todos_dias_semana = $row["todos_dias_semana"] ? 'sim' : 'nao'; |
|
$semana = $row["semana"] ? $semanaDisp[$row["semana"]] : '-'; |
|
$semana_fim = $row["semana_fim"] ? $semanaDisp[$row["semana_fim"]] : '-'; |
|
$todos_dias_mes = $row["todos_dias_mes"] ? 'sim' : 'nao'; |
|
$dias_mes = $row["dias_mes"] ? $row["dias_mes"] : '-'; |
|
$dias_mes_fim = $row["dias_mes_fim"] ? $row["dias_mes_fim"] : '-'; |
|
$todos_mes = $row["todos_mes"] ? 'sim' : 'nao'; |
|
$mes = $row["mes"] ? $mesesDisp[$row["mes"]] : '-'; |
|
$mes_fim = $row["mes_fim"] ? $mesesDisp[$row["mes_fim"]] : '-'; |
|
$opcaoH = $row["opcao"] ? $row["opcao"] : '-'; |
|
$acaoH = $row["acao"] ? $row["acao"] : '-'; |
|
$feriado = $row['feriado'] == '0'; |
|
$feriado = sprintf('<img src="images/%s" width="12" height="12" border="0" title="%s">', ($feriado ? "button_ok16.png" : "fecha16.png"), ($feriado ? "Feriado!" : "Dia Normal!")); |
|
$link = sprintf('<a href="index.php?idProg=11033&pbxRequest=1&acaoH=%s&id=%s&deletar=%s">Apagar</a>', $acaoH, $row["id_horario"], $row["id"]); |
|
$edit = sprintf('<a href="index.php?idProg=11033&pbxRequest=1&acaoH=%s&id=%s&item=%s&action=edit">Editar</a>', $acaoH, $row["id_horario"], $row["id"]); |
|
$linha .= " |
|
<tr class=\"labels\" style=\"color:#000000;\"> |
|
<td bgcolor=\"#CCCCCC\" align=\"center\">$feriado</td> |
|
<td bgcolor=\"#CCCCCC\">$horario_inicio</td> |
|
<td bgcolor=\"#CCCCCC\">$horario_fim</td> |
|
<td bgcolor=\"#CCCCCC\">$todos_dias_semana</td> |
|
<td bgcolor=\"#CCCCCC\">$semana</td> |
|
<td bgcolor=\"#CCCCCC\">$semana_fim</td> |
|
<td bgcolor=\"#CCCCCC\">$todos_dias_mes</td> |
|
<td bgcolor=\"#CCCCCC\">$dias_mes</td> |
|
<td bgcolor=\"#CCCCCC\">$dias_mes_fim</td> |
|
<td bgcolor=\"#CCCCCC\">$todos_mes</td> |
|
<td bgcolor=\"#CCCCCC\">$mes</td> |
|
<td bgcolor=\"#CCCCCC\">$mes_fim</td> |
|
<td bgcolor=\"#CCCCCC\">$opcaoH</td> |
|
<td bgcolor=\"#CCCCCC\">$acaoH</td> |
|
<td bgcolor=\"#CCCCCC\" align=\"center\">$edit</td> |
|
<td bgcolor=\"#CCCCCC\" align=\"center\">$link</td> |
|
</tr>"; |
|
} |
|
$GLOBALS['nome'] = $nome; |
|
$GLOBALS['discar'] = $discar; |
|
$GLOBALS['opcaoH'] = null; |
|
$GLOBALS['acaoH'] = null; |
|
$GLOBALS['opcao_nao'] = $opcao_nao; |
|
$GLOBALS['acao_nao'] = $acao_nao; |
|
$GLOBALS['numItens'] = $numReg; |
|
return $linha; |
|
} |
|
|
|
//gera arquivos e executa o reload dos dados no asterisk |
|
// gera_arquivos($dbcon,'HORARIOS');//gera arquivos e executa o reload dos dados no asterisk |
|
// gera_arquivos($dbcon,'TESTES'); |
|
?> |
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
|
"http://www.w3.org/TR/html4/loose.dtd"> |
|
<html> |
|
<head> |
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> |
|
<link rel="stylesheet" href="admin/css/validationEngine.jquery.css" type="text/css" media="screen" title="no title" charset="ISO-8859-1" /> |
|
<link type="text/css" rel="stylesheet" href="js/dhtmlgoodies_calendar.css?random=20051112" media="screen" /> |
|
<script type="text/javascript" src="admin/js/dhtmlgoodies_calendar.js?random=20060118"></script> |
|
<script type="text/javascript" src="admin/js/jquery-1.4.js"></script> |
|
<script type="text/javascript" src="admin/js/jquery.blockUI.js?v2.29"></script> |
|
<script src="admin/js/jquery.min.js" type="text/javascript"></script> |
|
<script src="admin/js/jquery.validationEngine.js" type="text/javascript"></script> |
|
<script src="admin/js/jquery.validationEngine-en.js" type="text/javascript"></script> |
|
<script src="admin/js/pbxAjax.js" type="text/javascript"></script> |
|
<script> |
|
$(document).ready(function() { |
|
$("#form1").validationEngine({ |
|
sucess : function(){ document.form1.submit();}, |
|
failure : function() {} |
|
}) |
|
}); |
|
|
|
function MM_jumpMenu(targ,selObj,restore){ //v3.0 |
|
eval("opco.location='admin/lista_opcoes.php?tipo="+selObj.options[selObj.selectedIndex].value+"&id="+document.form1.acao.value+"&id_ura=<? echo $id_ura;?>'"); |
|
if (restore) selObj.selectedIndex=0; |
|
} |
|
|
|
function sleep(milliseconds) { |
|
var start = new Date().getTime(); |
|
for (var i = 0; i < 1e7; i++) { |
|
if ((new Date().getTime() - start) > milliseconds){ |
|
break; |
|
} |
|
} |
|
} |
|
</script> |
|
|
|
<script type="text/javascript"> |
|
<!-- |
|
var h = <?=date("H", time());?>; <!-- Aqui indicas o número de horas a mais ou a menos do servidor (neste caso 3) --> |
|
var m = <?=date("i")?>; |
|
var s = <?=date("s");?>; |
|
function Relogio(){ |
|
if(s>=59){s=-1;m=m+1; |
|
if(m>=60){m=00;h=h+1; |
|
if(h>=24){h=00;}}}s=s+1; |
|
if(h<=9){xh="0"+h;}else{xh=h;} |
|
if(m<=9){xm="0"+m;}else{xm=m;} |
|
if(s<=9){xs="0"+s;}else{xs=s;} |
|
document.getElementById("Relogio").innerHTML = xh+":"+xm+":"+xs; |
|
t=setTimeout("Relogio()", 1000); |
|
} |
|
|
|
|
|
function soNumero(str){ |
|
var s = ""; |
|
// var charValido = new Array('0','1','2','3','4','5','6','7','8','9', ' '); |
|
var vr = str; |
|
|
|
tam = vr.length; |
|
for(i=0; i < tam; i++) |
|
{ |
|
if( (vr.substr(i,1) == '0') || |
|
(vr.substr(i,1) == '1') || |
|
(vr.substr(i,1) == '2') || |
|
(vr.substr(i,1) == '3') || |
|
(vr.substr(i,1) == '4') || |
|
(vr.substr(i,1) == '5') || |
|
(vr.substr(i,1) == '6') || |
|
(vr.substr(i,1) == '7') || |
|
(vr.substr(i,1) == '8') || |
|
(vr.substr(i,1) == '9') |
|
) |
|
s += vr.substr(i,1); |
|
|
|
} |
|
return s; |
|
} |
|
|
|
|
|
function Get(id) |
|
{ |
|
return document.getElementById(id); |
|
} |
|
|
|
function HabilitaCombo(rb, inicio, fim) |
|
{ |
|
var habilita = Get(rb).checked; |
|
Get(inicio).disabled = habilita; |
|
Get(fim).disabled = habilita; |
|
} |
|
|
|
|
|
function RemoveHorario() |
|
{ |
|
var selectBox = document.getElementById("horariosCad"); |
|
if(selectBox.options[selectBox.selectedIndex]) |
|
{ |
|
selectBox.options[selectBox.selectedIndex] = null; |
|
} |
|
|
|
var numeros = ""; |
|
document.getElementById("horariosCadSet").value = numeros; |
|
|
|
for (var i = 0; i < selectBox.options.length; i++) |
|
{ |
|
numeros += !numeros ? selectBox.options[i].value : '|' + selectBox.options[i].value; |
|
selectBox.options[i].selected = true; |
|
} |
|
|
|
|
|
} |
|
|
|
var acao = 'incluir'; |
|
|
|
function Verify() |
|
{ |
|
if(this.acao == 'salvar') |
|
{ |
|
var numItens = document.getElementById("numItens").value; |
|
if(numItens == 0) |
|
{ |
|
alert('Insira pelo menos um horário!'); |
|
return false; |
|
} |
|
|
|
} |
|
else |
|
{ |
|
|
|
if(!document.getElementById('opcaoH').value) |
|
{ |
|
alert('Informe uma "Opção" para o Horário!'); |
|
return false; |
|
} |
|
|
|
else if(!document.getElementById('acaoH').value) |
|
{ |
|
alert('Informe a "Ação" para o Horário"!'); |
|
return false; |
|
} |
|
|
|
if(!document.getElementById('feriado_sim').checked && !document.getElementById('feriado_nao').checked) |
|
{ |
|
alert('Marque a Opção Feriado"!'); |
|
return false; |
|
} |
|
} |
|
return true; |
|
} |
|
|
|
function SetAcao(val) |
|
{ |
|
this.acao = val; |
|
} |
|
|
|
--> |
|
</script> |
|
|
|
<link href="admin/css/forms.css" rel="stylesheet" type="text/css"> |
|
<style type="text/css"> |
|
<!-- |
|
body { |
|
background-color: #EAEAEA; |
|
margin-left: 0px; |
|
margin-top: 0px; |
|
margin-right: 0px; |
|
margin-bottom: 0px; |
|
} |
|
--> |
|
</style> |
|
</head> |
|
<body onload="Relogio();"> |
|
<?php |
|
if (isset($_POST["btSalvar"])) { |
|
echo "<script> |
|
fecha_popup(0,'index.php?idProg=10033&pbxRequest=1$param&acao=$acao'); |
|
</script>"; |
|
} else if (isset($_POST["btEditar"]) || isset($_POST["btNovoHorario"])) { |
|
echo "<script> |
|
window.location = 'index.php?idProg=11033&&acao=edita&id=$id'; |
|
</script>"; |
|
} |
|
?> |
|
<form action="index.php?idProg=11033&pbxRequest=1<?php echo $param; ?>" onsubmit="return Verify();" method="post" name="form1" id="form1"> |
|
<table width="98%" border="1" align="center" cellpadding="0" cellspacing="0" class="tabela"> |
|
<tr bordercolor="#EAEAEA" class="cabecalho" background="img/button03.gif"> |
|
<td width="99%" class="cabecalho"> |
|
<div align="center">CADASTRO DE HORÁRIOS |
|
<input name="id" type="hidden" id="id2" value="<?php echo $id; ?>" /> |
|
<input name="acao" type="hidden" id="id2" value="<?php echo $acao; ?>" /> |
|
<input name="numItens" type="hidden" id="id" value="<?php echo $numItens; ?>" /> |
|
</div> |
|
</td> |
|
</tr> |
|
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA"> |
|
<td class="labels"> |
|
<table width="100%" border="0" cellspacing="0" cellpadding="0"> |
|
<tr> |
|
<td colspan="2" class="tabela"> |
|
<div align="center" class="cabecalho"> |
|
Horário : <span id="Relogio"></span> |
|
</div> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td> |
|
<div align="left"> |
|
<fieldset> |
|
<legend class="labels">Nome:</legend> |
|
<input name="nome" type="text" class="validate[required,length[0,100]] caixas" id="nome2" value="<?php echo $nome; ?>" size="70" /> |
|
</fieldset> |
|
</div> |
|
</td> |
|
<td> |
|
<div align="left"> |
|
<fieldset> |
|
<legend class="labels">Discar:</legend> |
|
<input name="discar" type="text" class="caixas" id="discar" size="7" maxlength="5" value="<?php echo $discar; ?>"/> |
|
</fieldset> |
|
</div> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA"> |
|
<td class="labels"> |
|
<table width="100%" border="0" cellspacing="0" cellpadding="2"> |
|
<tr> |
|
<td> |
|
<fieldset> |
|
<legend class="labels">Opções fora de Horário:</legend> |
|
<select style="width: 160px" name="opcao_nao" class="validate[optional] caixas" id="opcao_nao" onchange="ajaxComboBox('admin/popula.php?id=<?php echo $acao_nao; ?>', 'acao_nao', 'opcao_nao', '<? echo $acao2; ?>');"> |
|
<?php |
|
$opcao = $opcao_nao; |
|
include_once("admin/opcoes.php"); |
|
echo _GetOpcoes($dbcon, $opcao, 0, 1); |
|
?> |
|
</select> |
|
<select style="width: 120px" name="acao_nao" class="caixas" id="acao_nao"> |
|
</select> |
|
</fieldset> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA"> |
|
<td class="labels"> |
|
<fieldset> |
|
<legend class="labels">Horários</legend> |
|
Início |
|
<input name="horario_inicio" type="text" class="caixas" id="horario_inicio" size="5" maxlength="5" value="<?php echo $horario_inicio; ?>" onkeydown="formataHora('horario_inicio', event);" /> |
|
Fim |
|
<input name="horario_fim" type="text" class="caixas" id="horario_fim" value="<?php echo $horario_fim; ?>" size="5" maxlength="5"/> |
|
</fieldset> |
|
</td> |
|
</tr> |
|
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA"> |
|
<td class="labels"> |
|
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
|
<tr> |
|
<td width="33%" valign="top"> |
|
<fieldset> |
|
<legend class="labels">Dia da Semana</legend> |
|
<table width="100%" border="0" cellspacing="0" cellpadding="0"> |
|
<tr> |
|
<td class="labels"> |
|
<input name="todos_dias_semana" type="radio" id="todos_dias_semana" value="1" <?php echo $todos_dias_semana ? "checked" : ""; ?> onclick="HabilitaCombo('todos_dias_semana', 'semana', 'semana_fim');" /> |
|
Todos |
|
<label> |
|
<input name="todos_dias_semana" type="radio" value="0" <?php echo!$todos_dias_semana ? "checked" : ""; ?> onclick="HabilitaCombo('todos_dias_semana', 'semana', 'semana_fim');"/> |
|
Intervalo |
|
</label> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td> |
|
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
|
<tr> |
|
<td valign="top"> |
|
<fieldset> |
|
<legend class="labels">Início</legend> |
|
<select name="semana" size="1" id="semana" disabled="disabled"> |
|
<?php echo DiasSemana($semana); ?> |
|
</select> |
|
</fieldset> |
|
</td> |
|
<td valign="top"> |
|
<fieldset> |
|
<legend class="labels">Fim</legend> |
|
<select name="semana_fim" size="1" id="semana_fim" disabled="disabled"> |
|
<?php echo DiasSemana($semana_fim); ?> |
|
</select> |
|
</fieldset> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
</fieldset> |
|
</td> |
|
<td width="33%" valign="top"> |
|
<fieldset> |
|
<legend class="labels">Dia do Mês</legend> |
|
<table width="100%" border="0" cellspacing="0" cellpadding="0"> |
|
<tr> |
|
<td colspan="2" class="labels"> |
|
<input name="todos_dias_mes" type="radio" id="todos_dias_mes" value="1" <?php echo $todos_dias_mes ? "checked" : ""; ?> onclick="HabilitaCombo('todos_dias_mes', 'dias_mes', 'dias_mes_fim');" /> |
|
Todos |
|
<label><input name="todos_dias_mes" type="radio" <?php echo!$todos_dias_mes ? "checked" : ""; ?> onclick="HabilitaCombo('todos_dias_mes', 'dias_mes', 'dias_mes_fim');" value="0"/>Intervalo </label> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td> |
|
<fieldset> |
|
<legend class="labels">Início</legend> |
|
<select name="dias_mes" size="1" id="dias_mes" disabled="disabled"> |
|
<?php echo DiasMes($dias_mes); ?> |
|
</select> |
|
</fieldset> |
|
</td> |
|
<td width="50%"> |
|
<fieldset> |
|
<legend class="labels">Fim</legend> |
|
<select name="dias_mes_fim" size="1" id="dias_mes_fim" disabled="disabled"> |
|
<?php echo DiasMes($dias_mes_fim); ?> |
|
</select> |
|
</fieldset> |
|
</td> |
|
</tr> |
|
</table> |
|
</fieldset> |
|
</td> |
|
<td valign="top"> |
|
<fieldset> |
|
<legend class="labels">Meses</legend> |
|
<table width="100%" border="0" cellspacing="0" cellpadding="0"> |
|
<tr> |
|
<td colspan="3" class="labels"> |
|
<input name="todos_mes" type="radio" id="todos_mes" value="1" <?php echo $todos_mes ? "checked" : ""; ?> onclick="HabilitaCombo('todos_mes', 'mes', 'mes_fim');" /> |
|
Todos |
|
<label><input name="todos_mes" id="todos_mes" type="radio" <?php echo!$todos_mes ? "checked" : ""; ?> onclick="HabilitaCombo('todos_mes', 'mes', 'mes_fim');" value="0"/> Intervalo </label></td> |
|
</tr> |
|
<tr> |
|
<td width="50%" valign="top"> |
|
<fieldset> |
|
<legend class="labels">Início</legend> |
|
<select name="mes" size="1" id="mes" disabled="disabled"> |
|
<?php echo Meses($mes); ?> |
|
</select> |
|
</fieldset> |
|
</td> |
|
<td width="50%" valign="top"> |
|
<fieldset> |
|
<legend class="labels">Fim</legend> |
|
<select name="mes_fim" size="1" id="mes_fim" disabled="disabled"> |
|
<?php echo Meses($mes_fim); ?> |
|
</select> |
|
</fieldset> |
|
</td> |
|
</tr> |
|
</table> |
|
</fieldset> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA"> |
|
<td class="labels"> |
|
<table width="100%" border="0" cellspacing="0" cellpadding="0"> |
|
<tr> |
|
<td> |
|
<table cellpadding="0" cellspacing="0" border="0"> |
|
<tr> |
|
<td> |
|
<fieldset> |
|
<legend class="labels">Caso Combine</legend> |
|
<select style="width: 160px" name="opcaoH" class="validate[optional] caixas" id="opcaoH" onchange="ajaxComboBox('admin/popula.php?id=<?php echo $acaoH; ?>', 'acaoH', 'opcaoH', '<? echo $acao2; ?>');"> |
|
<?php |
|
//$opcao = $opc; |
|
include_once("admin/opcoes.php"); |
|
echo _GetOpcoes($dbcon, $opc, 0, 1); |
|
?> |
|
</select> |
|
<select style="width: 120px" name="acaoH" class="caixas" id="acaoH"> |
|
</select> |
|
</fieldset> |
|
</td> |
|
<td> |
|
<fieldset> |
|
<legend class="labels">Feriado</legend> |
|
<span class="style1"> |
|
|
|
Sim<input name="feriado" type="radio" class="labels" id="feriado_sim" value="A" <?= (!$feriado && !is_null($feriado) ? 'checked="checked"' : ''); ?> /> |
|
Não<input name="feriado" type="radio" class="labels" id="feriado_nao" value="I" <?= ($feriado || is_null($feriado) ? 'checked="checked"' : ''); ?> /> |
|
</span> |
|
</fieldset> |
|
</td> |
|
<td> |
|
<fieldset> |
|
<legend class="labels">Ação</legend> |
|
<span class="style1"> |
|
<?php if ($_GET['action'] == 'edit') { ?> |
|
<input name="btEditar" type="submit" class="labels" onclick="SetAcao('incluir');" id="btNovoHorario" value="Editar" /> |
|
<?php } else { ?> |
|
<input name="btNovoHorario" type="submit" class="labels" onclick="SetAcao('incluir');" id="btNovoHorario" value="Cadastrar" /> |
|
<?php } ?> |
|
</span> |
|
</fieldset> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td class="labels">Horários Disponíveis </td> |
|
</tr> |
|
<tr> |
|
<td height="130" valign="top" class="labels"> |
|
<div style="height: 180px; width: 100%; overflow: auto; padding: 2px; margin:0"> |
|
<table width="98%" align="center" border="1" cellspacing="1" cellpadding="0" class="grid"> |
|
<tr> |
|
<th rowspan="2" align="center" bgcolor="#999999"><span title="Feriado">Feriado</span></th> |
|
<th colspan="2" align="center" bgcolor="#999999">Horário</th> |
|
<th colspan="3" align="center" bgcolor="#999999">Dia da semana</th> |
|
<th colspan="3" align="center" bgcolor="#999999">Dia do Mês </th> |
|
<th colspan="3" align="center" bgcolor="#999999">Meses</th> |
|
<th colspan="2" align="center" bgcolor="#999999">Caso Combine</th> |
|
<th rowspan="2" align="center" bgcolor="#999999" colspan="2">Ações</th> |
|
</tr> |
|
<tr class="labels"> |
|
<th bgcolor="#999999">Início</th> |
|
<th bgcolor="#999999">Fim</th> |
|
<th bgcolor="#999999">Todos</th> |
|
<th bgcolor="#999999">Inicio</th> |
|
<th bgcolor="#999999">Fim</th> |
|
<th bgcolor="#999999">Todos</th> |
|
<th bgcolor="#999999">Início</th> |
|
<th bgcolor="#999999">Fim</th> |
|
<th bgcolor="#999999">Todos</th> |
|
<th bgcolor="#999999">Início</th> |
|
<th bgcolor="#999999">Fim</th> |
|
<th bgcolor="#999999">Opção</th> |
|
<th bgcolor="#999999">Ação</th> |
|
</tr> |
|
<?php echo $linhas; ?> |
|
</table> |
|
</div> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
|
|
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA"> |
|
<td class="labels"> |
|
<table width="100%" border="0" cellspacing="0" cellpadding="0"> |
|
<tr> |
|
<td width="50%"></td> |
|
<td width="50%"></td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
|
|
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA"> |
|
<td align="center"> |
|
<div align="center"> |
|
<span class="style1"></span> |
|
<span class="style1"></span> |
|
<span class="style1"></span> |
|
<span class="style1"> |
|
<input name="Submit2" type="button" class="labels" onclick="fecha_popup();" value="Fechar" /> |
|
<input name="btSalvar" type="submit" onclick="SetAcao('salvar');" class="labels" value="Salvar" id="btSalvar" /> |
|
</span> |
|
</div> |
|
</td> |
|
</tr> |
|
</table> |
|
</form> |
|
</body> |
|
<script type="text/javascript"> |
|
$(document).ready(function () { |
|
window.resizeTo($('#form1').width() + 100, $('#form1').height()); |
|
}); |
|
|
|
ajaxComboBox4('admin/popula.php?id=<?php echo $acao_nao; ?>','acao_nao','opcao_nao','<?php echo $acao_nao; ?>'); |
|
ajaxComboBox4('admin/popula.php?id=<?php echo $acaoH; ?>', 'acaoH', 'opcaoH', '<?php echo $acaoH; ?>') |
|
|
|
HabilitaCombo('todos_dias_semana', 'semana', 'semana_fim'); |
|
HabilitaCombo('todos_dias_mes', 'dias_mes', 'dias_mes_fim'); |
|
HabilitaCombo('todos_mes', 'mes', 'mes_fim'); |
|
</script>
|
|
|