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,6 +23,7 @@ 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.
@ -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,11 +105,15 @@ 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 {
if(!empty($this->seat)){
$seats = ""; $seats = "";
foreach($this->seat as $value){ foreach($this->seat as $value){
$seats .= $value.", "; $seats .= $value.", ";
} }
$promo = "";
if($this->code > 0) $promo = "<pre>(Se ha aplicado un descuento por código promocional).</pre>";
$html = "<div class='row'> $html = "<div class='row'>
<fieldset id='datos_entrada'> <fieldset id='datos_entrada'>
<legend>Resumen de la Compra</legend> <legend>Resumen de la Compra</legend>
@ -110,7 +124,8 @@ class FormPurchase extends Form {
<p>Asiento(s):".$seats."</p> <p>Asiento(s):".$seats."</p>
<p>Fecha: ".date_format(date_create($this->session->getDate()), 'd-m-Y')."</p> <p>Fecha: ".date_format(date_create($this->session->getDate()), 'd-m-Y')."</p>
<p>Hora: ".$this->session->getStartTime()."</p> <p>Hora: ".$this->session->getStartTime()."</p>
<p>Precio Total: ".$this->session->getSeatPrice()*count($this->seat)." (Precio por asiento: ".$this->session->getSeatPrice()." )</p> <p>Precio Total: ".intval($this->session->getSeatPrice()*count($this->seat)-$this->code)." (Precio por asiento: ".$this->session->getSeatPrice()." )</p>
<p>".$promo."</p>
</fieldset> </fieldset>
<fieldset id='pagar_entrada'><pre>".$htmlErroresGlobales."</pre> <fieldset id='pagar_entrada'><pre>".$htmlErroresGlobales."</pre>
<legend>Datos Bancarios</legend> <legend>Datos Bancarios</legend>
@ -141,6 +156,12 @@ class FormPurchase extends Form {
<input type='reset' id='reset' value='Borrar' /> <input type='reset' id='reset' value='Borrar' />
</div> </div>
</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 '