Add files via upload

This commit is contained in:
Fernando Méndez 2021-06-03 13:40:11 +02:00 committed by GitHub
parent 6326ff3e1e
commit 5c460bf06f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 69 additions and 47 deletions

View File

@ -18,7 +18,7 @@
$forms = self::manage(); $forms = self::manage();
return $reply = '<div class="code info"> return $reply = '<div class="code info">
<h1>Bienvenido, '.$name.', a tu Panel de Usuario.</h1> <h1>Bienvenido '.$name.', a tu Panel de Usuario.</h1>
<hr /> <hr />
<a href="./?option=change_profile_pic"><img src='.$userPic.' alt="user_profile_picture"/></a> <a href="./?option=change_profile_pic"><img src='.$userPic.' alt="user_profile_picture"/></a>
<h3>'.strftime("%A %e de %B de %Y | %H:%M").'</h3> <h3>'.strftime("%A %e de %B de %Y | %H:%M").'</h3>

View File

@ -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/hall.php');
include_once($prefix.'assets/php/includes/purchase_dao.php'); include_once($prefix.'assets/php/includes/purchase_dao.php');
include_once($prefix.'assets/php/includes/purchase.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'); include_once($prefix.'assets/php/includes/user.php');
class FormPurchase extends Form { class FormPurchase extends Form {
@ -22,9 +23,10 @@ class FormPurchase extends Form {
private $seat; // Seat of the film to be purchased. private $seat; // Seat of the film to be purchased.
private $row; // Row of the seat. private $row; // Row of the seat.
private $col; // Column of the seat. private $col; // Column of the seat.
private $code; // Promotional code.
private $years; // Actual year. private $years; // Actual year.
private $months; // Months of the year. private $months; // Months of the year.
private $_TODAY; // Actual date. private $_TODAY; // Actual date.
public function __construct() { public function __construct() {
parent::__construct('formPurchase'); 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(); $TODAY = getdate();
$year = "$TODAY[year]"; $year = "$TODAY[year]";
@ -95,52 +105,63 @@ class FormPurchase extends Form {
<p>Vuelva atrás para selecionar otra sesión.</p> <p>Vuelva atrás para selecionar otra sesión.</p>
</div>"; </div>";
} else { } else {
$seats = ""; if(!empty($this->seat)){
foreach($this->seat as $value){ $seats = "";
$seats .= $value.", "; foreach($this->seat as $value){
} $seats .= $value.", ";
}
$html = "<div class='row'> $promo = "";
<fieldset id='datos_entrada'> if($this->code > 0) $promo = "<pre>(Se ha aplicado un descuento por código promocional).</pre>";
<legend>Resumen de la Compra</legend>
<img src='"."../img/films/".$this->film->getImg()."' alt='".$this->film->getTittle()."' /> $html = "<div class='row'>
<p>Película: ".str_replace('_', ' ', strtoupper($this->film->getTittle()))."</p> <fieldset id='datos_entrada'>
<p>Cine: ".$this->cinema->getName()."</p> <legend>Resumen de la Compra</legend>
<p>Sala: ".$this->session->getIdhall()."</p> <img src='"."../img/films/".$this->film->getImg()."' alt='".$this->film->getTittle()."' />
<p>Asiento(s):".$seats."</p> <p>Película: ".str_replace('_', ' ', strtoupper($this->film->getTittle()))."</p>
<p>Fecha: ".date_format(date_create($this->session->getDate()), 'd-m-Y')."</p> <p>Cine: ".$this->cinema->getName()."</p>
<p>Hora: ".$this->session->getStartTime()."</p> <p>Sala: ".$this->session->getIdhall()."</p>
<p>Precio Total: ".$this->session->getSeatPrice()*count($this->seat)." (Precio por asiento: ".$this->session->getSeatPrice()." )</p> <p>Asiento(s):".$seats."</p>
</fieldset> <p>Fecha: ".date_format(date_create($this->session->getDate()), 'd-m-Y')."</p>
<fieldset id='pagar_entrada'><pre>".$htmlErroresGlobales."</pre> <p>Hora: ".$this->session->getStartTime()."</p>
<legend>Datos Bancarios</legend> <p>Precio Total: ".intval($this->session->getSeatPrice()*count($this->seat)-$this->code)." (Precio por asiento: ".$this->session->getSeatPrice()." )</p>
<label for='card-holder'>Titular de la Tarjeta: <span id='cardNameValid'>&#x2714;</span><span id='cardNameInvalid'>&#x274C;</span></label><pre>".$errorNombre."</pre><br /> <p>".$promo."</p>
<input type='text' name='card-holder' id='card-holder' class='card-holder' placeholder='NOMBRE APELLIDO1 APELLIDO2' required /> </fieldset>
<br /> <fieldset id='pagar_entrada'><pre>".$htmlErroresGlobales."</pre>
<label for='card-number'>Número de Tarjeta: <span id='carNumberValid'>&#x2714;</span><span id='cardNumerInvalid'>&#x274C;</span></label><pre>".$errorCardNumber."</pre><br /> <legend>Datos Bancarios</legend>
<input type='num' name='card-number-0' id='card-number-0' class='input-cart-number' placeholder='XXXX' maxlength='4' required /> <label for='card-holder'>Titular de la Tarjeta: <span id='cardNameValid'>&#x2714;</span><span id='cardNameInvalid'>&#x274C;</span></label><pre>".$errorNombre."</pre><br />
<input type='num' name='card-number-1' id='card-number-1' class='input-cart-number' placeholder='XXXX' maxlength='4' required /> <input type='text' name='card-holder' id='card-holder' class='card-holder' placeholder='NOMBRE APELLIDO1 APELLIDO2' required />
<input type='num' name='card-number-2' id='card-number-2' class='input-cart-number' placeholder='XXXX' maxlength='4' required /> <br />
<input type='num' name='card-number-3' id='card-number-3' class='input-cart-number' placeholder='XXXX' maxlength='4' required /> <label for='card-number'>Número de Tarjeta: <span id='carNumberValid'>&#x2714;</span><span id='cardNumerInvalid'>&#x274C;</span></label><pre>".$errorCardNumber."</pre><br />
<label for='card-cvv'>CVV: <span id='cvvValid'>&#x2714;</span><span id='cvvInvalid'>&#x274C;</span></label> <input type='num' name='card-number-0' id='card-number-0' class='input-cart-number' placeholder='XXXX' maxlength='4' required />
<input type='text' name='card-cvv' id='card-cvv' class='fieldset-cvv' maxlength='3' placeholder='XXX' required /><pre>".$errorCVV."</pre> <input type='num' name='card-number-1' id='card-number-1' class='input-cart-number' placeholder='XXXX' maxlength='4' required />
<br /> <input type='num' name='card-number-2' id='card-number-2' class='input-cart-number' placeholder='XXXX' maxlength='4' required />
<label for='card-expiration'>Fecha de Expiración: <span id='dateValid'>&#x2714;</span><span id='dateInvalid'>&#x274C;</span></label><pre>".$errorCardExpirationMonth.$errorCardExpirationYear."</pre><br /> <input type='num' name='card-number-3' id='card-number-3' class='input-cart-number' placeholder='XXXX' maxlength='4' required />
<select name='card-expiration-month' id='card-expiration-month' required> <label for='card-cvv'>CVV: <span id='cvvValid'>&#x2714;</span><span id='cvvInvalid'>&#x274C;</span></label>
".$monthsHTML." <input type='text' name='card-cvv' id='card-cvv' class='fieldset-cvv' maxlength='3' placeholder='XXX' required /><pre>".$errorCVV."</pre>
</select> <br />
<select name='card-expiration-year' id='card-expiration-year' required> <label for='card-expiration'>Fecha de Expiración: <span id='dateValid'>&#x2714;</span><span id='dateInvalid'>&#x274C;</span></label><pre>".$errorCardExpirationMonth.$errorCardExpirationYear."</pre><br />
".$yearsHTML." <select name='card-expiration-month' id='card-expiration-month' required>
</select> ".$monthsHTML."
</fieldset> </select>
<div class='actions'> <select name='card-expiration-year' id='card-expiration-year' required>
<input type='hidden' name='sessions' id='sessions' value='".$_POST["sessions"]."' /> ".$yearsHTML."
<input type='hidden' name='row' id='row' value='".serialize($this->row)."' /> </select>
<input type='hidden' name='col' id='col' value='".serialize($this->col)."' /> </fieldset>
<input type='submit' id='submit' value='Pagar' class='primary' /> <div class='actions'>
<input type='reset' id='reset' value='Borrar' /> <input type='hidden' name='sessions' id='sessions' value='".$_POST["sessions"]."' />
</div> <input type='hidden' name='row' id='row' value='".serialize($this->row)."' />
</div>"; <input type='hidden' name='col' id='col' value='".serialize($this->col)."' />
<input type='submit' id='submit' value='Pagar' class='primary' />
<input type='reset' id='reset' value='Borrar' />
</div>
</div>";
} else {
$html = "<div class='code info'>
<h2>No se ha seleccionado asiento(s).</h2>
<p>Vuelva atrás para selecionar una butaca.</p>
</div>";
}
} }
return $html; return $html;
} }

View File

@ -83,6 +83,7 @@ class FormSelectSeat extends Form {
//Pay button: //Pay button:
$pay = '<input type="hidden" name="sessions" id="sessions" value="'.$_POST["sessions"].'" /> $pay = '<input type="hidden" name="sessions" id="sessions" value="'.$_POST["sessions"].'" />
<input type="hidden" name="code" id="code" value="'.$_POST["code"].'" />
<input type="submit" id="submit" value="Pagar" />'; <input type="submit" id="submit" value="Pagar" />';
return ' return '