-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrearpromocion.php
72 lines (66 loc) · 2.6 KB
/
crearpromocion.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
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./css/estilos.css">
<link rel="icon" href="./favicon.ico">
<title>Registrar promoción</title>
</head>
<body>
<div class="container">
<?php
$enlaceActivo = null;
$esTemaOscuro = TRUE;
require_once "./commons/header.php";
?>
<?php
if (isset($_POST['idshabitaciones'])) :
if (isset($_POST['nombre'], $_POST['porcentajedescuento'], $_POST['fechainicio'], $_POST['fechafin'])) :
$nombre = $_POST['nombre'];
$porcentajeDescuento = $_POST['porcentajedescuento'];
$fechaInicio = $_POST['fechainicio'];
$fechaFin = $_POST['fechafin'];
$idsHabitaciones = $_POST['idshabitaciones'];
include('database-init.php');
try {
if ($idPromo = $db->storePromo($nombre, $porcentajeDescuento, $fechaInicio, $fechaFin, $idsHabitaciones)) :
?>
<div class="alert alert--success">
<h4 class="alert-title">Registro de promociones</h4>
<p class="alert-content">Promoción registrada correctamente</p>
</div>
<?php
else :
?>
<div class="alert alert--danger">
<h4 class="alert-title">Registro de promociones</h4>
<p class="alert-content">No se puedo registrar la promoción</p>
</div>
<?php
endif;
} catch (\Throwable $th) {
echo "Error: {$th->getMessage()}";
}
else :
?>
<div class="alert alert--danger">
<h4 class="alert-title">Registro de promociones</h4>
<p class="alert-content">Envie todos los datos necesarios</p>
</div>
<?php
endif;
else :
?>
<div class="alert alert--danger">
<h4 class="alert-title">Registro de promociones</h4>
<p class="alert-content">Seleccione al menos una habitacion para registrar en la promoción</p>
</div>
<?php
endif;
?>
<meta http-equiv="refresh" content="1; url=./promociones.php">
</div>
</body>
</html>