-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarcas.php
161 lines (121 loc) · 5.67 KB
/
marcas.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php require("header.php"); ?>
<!-- BEGIN PAGE HEAD -->
<div class="page-head">
<div class="container">
<!-- BEGIN PAGE TITLE -->
<div class="page-title">
<h1>Marcas</h1>
</div>
<!-- END PAGE TITLE -->
<!-- BEGIN PAGE TOOLBAR -->
<div class="page-toolbar">
<p> </p>
Bem vindo, hoje é <?php echo date("d/m/Y"); ?>
</div>
<!-- END PAGE TOOLBAR -->
</div>
</div>
<!-- END PAGE HEAD -->
<!-- BEGIN PAGE CONTENT -->
<div class="page-content">
<div class="container portlet light">
<div class="row margin-top-10">
<div class="col-md-12">
<p> </p>
<a href="adicionar-marca.php" class="btn btn-primary">Adicionar Marca</a>
<p> </p>
<table id="dataSelect" data-order='[[ 0, "asc" ]]' class="table table-hover">
<thead>
<th style="padding-left:8px;"><b>#</b></th>
<th style="padding-left:8px;"><b>Foto</b></th>
<th style="padding-left:8px;"><b>Nome</b></th>
<th style="padding-left:8px;"><b>Ações</b></th>
</thead>
<tbody>
<?php
require("conexao.php");
$sql = "SELECT * FROM marcas";
$result = $PDO->query( $sql );
$linha = $result->fetchAll( PDO::FETCH_ASSOC );
$tot_cliente = count($linha);
$i = 0;
while($i<$tot_cliente):
?>
<tr>
<td><?php echo $linha[$i]["id"]; ?></td>
<td><img src="images/<?php echo $linha[$i]["foto"]; ?>" style="width:130px;height:auto;" /></td>
<td><?php echo $linha[$i]["nome"]; ?></td>
<td>
<a href="editar-marca.php?id=<?php echo $linha[$i]["id"]; ?>" class="btn btn-warning btn-xs" >editar</a>
<a href="marcas.php?id=<?php echo $linha[$i]["id"]; ?>" class="btn btn-danger btn-xs">excluir</a>
</td>
</tr>
<?php
$i++;
endwhile;
?>
</tbody>
</table>
</div>
</div>
</div>
<!-- END PAGE CONTAINER -->
<!-- BEGIN FOOTER -->
<div class="scroll-to-top">
<i class="icon-arrow-up"></i>
</div>
<!-- END FOOTER -->
<!-- BEGIN JAVASCRIPTS (Load javascripts at bottom, this will reduce page load time) -->
<!-- BEGIN CORE PLUGINS -->
<!--[if lt IE 9]>
<script src="assets/global/plugins/respond.min.js"></script>
<script src="assets/global/plugins/excanvas.min.js"></script>
<![endif]-->
<script src="assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="assets/global/plugins/jquery-migrate.min.js" type="text/javascript"></script>
<!-- IMPORTANT! Load jquery-ui.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
<script src="assets/global/plugins/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
<script src="assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="assets/global/plugins/jquery.cokie.min.js" type="text/javascript"></script>
<script src="assets/global/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
<script src="assets/global/scripts/metronic.js" type="text/javascript"></script>
<script src="assets/admin/layout3/scripts/layout.js" type="text/javascript"></script>
<script src="assets/admin/layout3/scripts/demo.js" type="text/javascript"></script>
<script src="assets/admin/pages/scripts/index3.js" type="text/javascript"></script>
<script src="assets/admin/pages/scripts/tasks.js" type="text/javascript"></script>
<!-- END PAGE LEVEL SCRIPTS -->
<script src="js/sweetalert.min.js"></script>
<script type="text/javascript" language="javascript" src="//cdn.datatables.net/1.10-dev/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="js/dataTables.bootstrap.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#dataSelect').dataTable({"order": [[ 0, "asc" ]],"language": {"url": "ptbr.json"} });
} );
</script>
<script>
jQuery(document).ready(function() {
Metronic.init(); // init metronic core componets
Layout.init(); // init layout
Demo.init(); // init demo(theme settings page)
Index.init(); // init index page
Tasks.initDashboardWidget(); // init tash dashboard widget
});
</script>
<?php
if($_GET["id"]):
?>
<script type="text/javascript">
swal({ title: "Confirma a exclusão da marca?", text: "Essa ação não pode ser revertida", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Sim, apagar", cancelButtonText: "Não, cancelar!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { swal("Apagado!", "Marca apagada com sucesso.", "success"); location.href="excluir-marca.php?id=<?php echo $_GET['id']; ?>" } else { swal("Cancelado", "Pedido cancelado", "error"); } });
</script>
<?php endif; ?>
<?php
// ALERTA DE CONFIRMAÇÃO DE EXCLUSÃO DE CLIENTE
if($_GET["status"]=="sucesso"): echo '<script type="text/javascript">swal("Muito bem!", "Marca foi removida com sucesso", "success");</script>'; endif; ?>
?>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>