From 5c460bf06f36f921bf050df6c95f27680fc0dbf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20M=C3=A9ndez?= <45081533+FerMdez@users.noreply.github.com> Date: Thu, 3 Jun 2021 13:40:11 +0200 Subject: [PATCH] Add files via upload --- panel_user/panelUser.php | 2 +- purchase/includes/formPurchase.php | 113 ++++++++++++++++----------- purchase/includes/formSelectSeat.php | 1 + 3 files changed, 69 insertions(+), 47 deletions(-) diff --git a/panel_user/panelUser.php b/panel_user/panelUser.php index 23c0786..85e1363 100644 --- a/panel_user/panelUser.php +++ b/panel_user/panelUser.php @@ -18,7 +18,7 @@ $forms = self::manage(); return $reply = '
-

Bienvenido, '.$name.', a tu Panel de Usuario.

+

Bienvenido '.$name.', a tu Panel de Usuario.


user_profile_picture

'.strftime("%A %e de %B de %Y | %H:%M").'

diff --git a/purchase/includes/formPurchase.php b/purchase/includes/formPurchase.php index 5882cbe..7ac688c 100644 --- a/purchase/includes/formPurchase.php +++ b/purchase/includes/formPurchase.php @@ -10,6 +10,7 @@ include_once($prefix.'assets/php/includes/hall_dao.php'); include_once($prefix.'assets/php/includes/hall.php'); include_once($prefix.'assets/php/includes/purchase_dao.php'); include_once($prefix.'assets/php/includes/purchase.php'); +include_once($prefix.'assets/php/includes/promotion_dao.php'); include_once($prefix.'assets/php/includes/user.php'); class FormPurchase extends Form { @@ -22,9 +23,10 @@ class FormPurchase extends Form { private $seat; // Seat of the film to be purchased. private $row; // Row of the seat. private $col; // Column of the seat. + private $code; // Promotional code. private $years; // Actual year. private $months; // Months of the year. - private $_TODAY; // Actual date. + private $_TODAY; // Actual date. public function __construct() { parent::__construct('formPurchase'); @@ -57,6 +59,14 @@ class FormPurchase extends Form { } } + $promoDAO = new Promotion_DAO("complucine"); + $this->code = intval(0); + if(isset($_POST["code"]) && $_POST["code"] !== ""){ + if($promoDAO->GetPromotion($_POST["code"])->data_seek(0)){ + $this->code = intval(3); + } + } + $TODAY = getdate(); $year = "$TODAY[year]"; @@ -95,52 +105,63 @@ class FormPurchase extends Form {

Vuelva atrás para selecionar otra sesión.

"; } else { - $seats = ""; - foreach($this->seat as $value){ - $seats .= $value.", "; - } + if(!empty($this->seat)){ + $seats = ""; + foreach($this->seat as $value){ + $seats .= $value.", "; + } - $html = "
-
- Resumen de la Compra - ".$this->film->getTittle()." -

Película: ".str_replace('_', ' ', strtoupper($this->film->getTittle()))."

-

Cine: ".$this->cinema->getName()."

-

Sala: ".$this->session->getIdhall()."

-

Asiento(s):".$seats."

-

Fecha: ".date_format(date_create($this->session->getDate()), 'd-m-Y')."

-

Hora: ".$this->session->getStartTime()."

-

Precio Total: ".$this->session->getSeatPrice()*count($this->seat)."€ (Precio por asiento: ".$this->session->getSeatPrice()." €)

-
-
".$htmlErroresGlobales."
- Datos Bancarios -
".$errorNombre."

- -
-
".$errorCardNumber."

- - - - - -
".$errorCVV."
-
-
".$errorCardExpirationMonth.$errorCardExpirationYear."

- - -
-
- - - - - -
-
"; + $promo = ""; + if($this->code > 0) $promo = "
(Se ha aplicado un descuento por código promocional).
"; + + $html = "
+
+ Resumen de la Compra + ".$this->film->getTittle()." +

Película: ".str_replace('_', ' ', strtoupper($this->film->getTittle()))."

+

Cine: ".$this->cinema->getName()."

+

Sala: ".$this->session->getIdhall()."

+

Asiento(s):".$seats."

+

Fecha: ".date_format(date_create($this->session->getDate()), 'd-m-Y')."

+

Hora: ".$this->session->getStartTime()."

+

Precio Total: ".intval($this->session->getSeatPrice()*count($this->seat)-$this->code)."€ (Precio por asiento: ".$this->session->getSeatPrice()." €)

+

".$promo."

+
+
".$htmlErroresGlobales."
+ Datos Bancarios +
".$errorNombre."

+ +
+
".$errorCardNumber."

+ + + + + +
".$errorCVV."
+
+
".$errorCardExpirationMonth.$errorCardExpirationYear."

+ + +
+
+ + + + + +
+
"; + } else { + $html = "
+

No se ha seleccionado asiento(s).

+

Vuelva atrás para selecionar una butaca.

+
"; + } } return $html; } diff --git a/purchase/includes/formSelectSeat.php b/purchase/includes/formSelectSeat.php index fbb85bb..6eb4e99 100644 --- a/purchase/includes/formSelectSeat.php +++ b/purchase/includes/formSelectSeat.php @@ -83,6 +83,7 @@ class FormSelectSeat extends Form { //Pay button: $pay = ' + '; return '