228 lines
7.7 KiB
PHP
228 lines
7.7 KiB
PHP
<?php
|
|
use common\components\Helper;
|
|
use common\models\DoorLog;
|
|
use yii\helpers\Html;
|
|
use yii\helpers\Url;
|
|
|
|
/* @var $this yii\web\View */
|
|
/* @var $model \frontend\models\ReceptionForm */
|
|
?>
|
|
<style>
|
|
</style>
|
|
<?php
|
|
/** @var \common\models\Ticket $ticket */
|
|
$ticket = null;
|
|
if ( count($model->tickets) > 0 ){
|
|
$ticket = $model->tickets[0];
|
|
}
|
|
|
|
if ( isset($model->card)){
|
|
if ( isset($model->customer)){
|
|
if ( $model->card->validity == 0 ){
|
|
if ( isset($ticket)){
|
|
echo Html::beginTag("div",['class'=>"alert alert-success" , "role"=>"alert"]);
|
|
echo Html::beginTag("strong",[ ]);
|
|
echo "Érvényes bérlet!" ;
|
|
echo Html::endTag("strong");
|
|
echo Html::tag("br");
|
|
echo Html::beginTag("strong",[ ]);
|
|
echo "Típus: " ;
|
|
echo Html::endTag("strong");
|
|
echo $ticket->ticketTypeName ;
|
|
echo Html::tag("br");
|
|
echo Html::beginTag("strong",[ ]);
|
|
echo "Érvényes: " ;
|
|
echo Html::endTag("strong");
|
|
echo Yii::$app->formatter->asDate($ticket->start);
|
|
echo " - ";
|
|
echo Yii::$app->formatter->asDate($ticket->end);
|
|
echo Html::endTag("div");
|
|
}else{
|
|
echo Html::beginTag("div",['class'=>"alert alert-danger", "role"=>"alert"]);
|
|
echo Html::beginTag("strong",[ ]);
|
|
echo "Bérlet lejárt vagy nem érvényes!";
|
|
echo Html::endTag("strong");
|
|
echo Html::endTag("div");
|
|
}
|
|
|
|
//// //////////////////////////////////
|
|
/// Warn if expires soon
|
|
/// ///////////////////////////////////
|
|
$propertyWarnTicketExpireInDaysCount = \Yii::$app->params['warn_ticket_expire_in_days_count'];
|
|
$propertyWarnTicketExpireInUsageCount = \Yii::$app->params['warn_ticket_expire_in_usage_count'];
|
|
$showWarningExpires = false;
|
|
|
|
// expires in days
|
|
if ( $propertyWarnTicketExpireInDaysCount > 0 ){
|
|
$warnMessageTicketExpireInDaysCountTemplate = "A bérlet már csak {day} érvényes";
|
|
$expiresInDays = $ticket->getDaysUntilExpire();
|
|
$warnMessageTicketExpire = $expiresInDays;
|
|
if ( $expiresInDays <= $propertyWarnTicketExpireInDaysCount ){
|
|
$showWarningExpires = true;
|
|
$variables = array(
|
|
'{day}' => $expiresInDays > 0 ? " $expiresInDays napig" : "ma",
|
|
);
|
|
$warnMessageTicketExpire = strtr($warnMessageTicketExpireInDaysCountTemplate, $variables);
|
|
}
|
|
}
|
|
|
|
//// //////////////////////////////////
|
|
/// Warn if open usage count is low
|
|
/// ///////////////////////////////////
|
|
$showWaringUsageCount = false;
|
|
if ($propertyWarnTicketExpireInUsageCount > 0) {
|
|
$openUsageCount = $ticket->getOpenUsageCount();
|
|
if ($openUsageCount !== false && ($propertyWarnTicketExpireInUsageCount >= $openUsageCount)) {
|
|
$showWaringUsageCount = true;
|
|
$warnMessageTicketUsageCountTemplate = "A bérleten már csak {count} alkalom van";
|
|
$variables = array(
|
|
'{count}' => $openUsageCount,
|
|
);
|
|
$warnMessageTicketUsageCount = strtr($warnMessageTicketUsageCountTemplate, $variables);
|
|
}
|
|
}
|
|
|
|
//// //////////////////////////////////
|
|
/// if any warning is there, display
|
|
/// the warning box
|
|
/// ///////////////////////////////////
|
|
if ( $showWarningExpires || $showWaringUsageCount) {
|
|
?>
|
|
<div class="alert alert-warning-expires">
|
|
<strong>A bérlet hamarosan lejár</strong>
|
|
<?php
|
|
if ($showWarningExpires) {
|
|
echo "<br>";
|
|
echo $warnMessageTicketExpire;
|
|
}
|
|
if ( $showWaringUsageCount){
|
|
echo "<br>";
|
|
echo $warnMessageTicketUsageCount;
|
|
}
|
|
?>
|
|
</div>
|
|
<?php
|
|
}
|
|
|
|
} else{
|
|
echo Html::beginTag("div",['class'=>"alert alert-danger", "role"=>"alert"]);
|
|
echo "Kártya korlátozás:";
|
|
echo "<br>";
|
|
echo Html::beginTag("strong",[ ]);
|
|
echo Helper::getArrayValue(DoorLog::getCardFlagTexts(), $model->card->validity, "Ismeretlen ok") ;
|
|
echo Html::endTag("strong");
|
|
echo Html::endTag("div");
|
|
}
|
|
}else{
|
|
echo Html::beginTag("div",['class'=>"alert alert-info" ,"role"=>"alert"]);
|
|
echo Html::beginTag("strong",[ ]);
|
|
echo "Üres bérlet!";
|
|
echo Html::endTag("strong");
|
|
echo Html::endTag("div");
|
|
}
|
|
}else{
|
|
echo Html::beginTag("div",['class'=>"alert alert-warning" ,"role"=>"alert"]);
|
|
echo Html::beginTag("strong",[ ]);
|
|
echo "Nincs bérlet megadva!";
|
|
echo Html::endTag("strong");
|
|
echo Html::endTag("div");
|
|
}
|
|
|
|
if (Helper::isTicketTypeDoorAllowedCheckOn()) {
|
|
if (isset($model->card) && isset($ticket) ) {
|
|
$alert = "alert " . ($model->card->isFlagDoorAllowed() ? "alert-warning" : "alert-success");
|
|
$text = "Kapun beléphet: " .($model->card->isFlagDoorAllowed() ? "nem" : "igen");
|
|
|
|
echo Html::beginTag("div",['class' => $alert ,"role"=>"alert"]);
|
|
echo Html::beginTag("strong",[ ]);
|
|
echo $text;
|
|
echo Html::endTag("strong");
|
|
echo Html::endTag("div");
|
|
|
|
}
|
|
}
|
|
|
|
if ( isset($model->contract)){
|
|
/** @var common\models\Contract $contract*/
|
|
$contract = $model->contract;
|
|
if ( $contract->isFlagActive() ){
|
|
if ( $model->contract->isStatusNotPaid() ){
|
|
echo Html::beginTag("div",['class'=>"alert alert-danger", "role"=>"alert"]);
|
|
echo Html::beginTag("strong",[ ]);
|
|
echo "Szerződés részlete nincs fizetve!";
|
|
echo Html::a("Szerződés részletei",Url::toRoute(['contract/view','id' => $model->contract->id_contract]));
|
|
echo Html::endTag("strong");
|
|
echo Html::endTag("div");
|
|
}else{
|
|
echo Html::beginTag("div",['class'=>"alert alert-success", "role"=>"alert"]);
|
|
echo Html::beginTag("strong",[ ]);
|
|
echo "Érvényes szerződés!";
|
|
echo Html::a("Szerződés részletei",Url::toRoute(['contract/view','id' => $model->contract->id_contract]));
|
|
echo Html::endTag("strong");
|
|
echo Html::endTag("div");
|
|
}
|
|
}else{
|
|
|
|
if ( $contract->isFlagCanceled() ){
|
|
echo Html::beginTag("div",['class'=>"alert alert-danger", "role"=>"alert"]);
|
|
echo Html::beginTag("strong",[ ]);
|
|
echo "Szerződés felbontva !";
|
|
echo Html::a("Szerződés részletei",Url::toRoute(['contract/view','id' => $model->contract->id_contract]));
|
|
echo Html::endTag("strong");
|
|
echo Html::endTag("div");
|
|
}
|
|
}
|
|
}
|
|
|
|
if ( isset( $model->unpaidTickets ) ) {
|
|
if ( count($model->unpaidTickets) > 0){
|
|
echo Html::beginTag("div",['class'=>"alert alert-warning", "role"=>"alert"]);
|
|
echo Html::beginTag("strong",[ ]);
|
|
echo "Fizetetlen bérletek";
|
|
echo Html::endTag("strong");
|
|
echo "<ul>";
|
|
$formatter = \Yii::$app->formatter;
|
|
foreach ($model->unpaidTickets as $t ){
|
|
echo Html::beginTag("li",[ ]);
|
|
$c = $t->contract;
|
|
if (isset($c)){
|
|
echo "<b>Szerződéses</b>";
|
|
}
|
|
echo $t->getTicketTypeName();
|
|
|
|
echo ": ";
|
|
echo $formatter->asDate($t->start);
|
|
echo " - " ;
|
|
echo $formatter->asDate($t->end);
|
|
echo " (";
|
|
echo $t->price_brutto;
|
|
echo " Ft)";
|
|
echo Html::endTag("li");
|
|
}
|
|
echo "</ul>";
|
|
echo Html::endTag("div");
|
|
}
|
|
}
|
|
|
|
|
|
if ( isset($model->customer)){
|
|
|
|
if ( $model->customer->towel_count > 0 ){
|
|
$towelText = "Kiadott törölközők (db):" . $model->customer->towel_count;
|
|
$towelClass = "alert alert-danger";
|
|
}else{
|
|
$towelText = "Nincs kiadott törölköző";
|
|
$towelClass = "alert alert-success";
|
|
}
|
|
|
|
|
|
echo Html::beginTag("div",['class'=> $towelClass, "role"=>"alert"]);
|
|
echo Html::beginTag("strong",[ ]);
|
|
echo $towelText;
|
|
echo Html::endTag("strong");
|
|
echo Html::endTag("div");
|
|
|
|
}
|
|
|
|
?>
|