-
Notifications
You must be signed in to change notification settings - Fork 1
/
editarColaborador.php
86 lines (82 loc) · 3.44 KB
/
editarColaborador.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
session_start();
require_once 'classes/Funcionario.php';
$col =new Funcionario();
if(isset($_SESSION['id']) && !empty($_SESSION['id'])){
require 'header.php';
if(!isset($_GET['cpd'])) {
?>
<div class="box2">
<div class="form_fun">
<form action="" method="get">
<div class="form-group">
<input class="form-control" placeholder="CPD" name="cpd">
</div>
<div class="form-group">
<button class="btn btn-dark">
<i style="color: #fff;" class="fas fa-search"></i>
<span>Pesquisar</span>
</button>
</div>
</form>
</div>
</div>
<?php
}else{
$ret = $col->listagemEdicao($_GET['cpd']);
if( (isset($_GET['cdc']) && !empty($_GET['cdc'])) &&
(isset($_GET['nome']) && !empty($_GET['nome'])) &&
(isset($_GET['status']))){
if($col->atualizarFuncionario($_GET['cpd'],$_GET['nome'],$_GET['status'],$_GET['cdc'])){
header("location: editarColaborador.php?cpd=".$_GET['cpd']);
}else{
echo "<script>alert('Falha Ao Atualizar!!')</script>";
}
}
?>
<div class="box2">
<div class="form_fun">
<form action="" method="get">
<input type="hidden" class="form-control" value="<?php echo $ret['cpd']?>" name="cpd">
<div class="form-group">
<label>Nome</label>
<input class="form-control" value="<?php echo $ret['nome'] ?>" name="nome"/>
</div>
<div class="form-group">
<label>Centro De Custo</label>
<select class="form-control" name="cdc" autofocus>
<?php
$lista = $col->listarCentroDeCusto();
foreach ($lista as $l){
?>
<option value="<?php echo $l['id']?>"
<?php
echo ($ret['id_centro_de_custo'] == $l['id'])? 'selected':''; ?>><?php echo $l['cod_cc']." - ".$l['descricao']; ?></option>
<?php
}
?>
</select>
</div>
<div class="form-group">
<label>Status</label>
<select name="status" required class="form-control">
<option value="1" <?php echo ($ret['status'] == 1)?'selected':'';?>>Ativo</option>
<option value="0" <?php echo ($ret['status'] != 1)?'selected':'';?>>Desligado/Afastado</option>
</select>
</div>
<div class="form-group">
<button class="btn btn-dark">
<i style="color: #fff;" class="fas fa-sync"></i>
<span>Atualizar</span>
</button>
</div>
</form>
</div>
</div>
<?php
}
require 'footer.php';
}
else{
header("location: index.php");
}