implement mobile devices in reception

This commit is contained in:
2022-02-19 14:51:58 +01:00
parent 9fb0485066
commit 34fca82e7d
13 changed files with 834 additions and 185 deletions

View File

@@ -1,57 +1,85 @@
<?php
use yii\helpers\Url;
?>
<?php
$route = Yii::$app->controller->id .'/'. Yii::$app->controller->action->id;
$route = Yii::$app->controller->id . '/' . Yii::$app->controller->action->id;
/** @noinspection PhpUnhandledExceptionInspection */
$todayDateTime = Yii::$app->formatter->asDatetime(strtotime('today UTC'));
$items = [
[ 'Recepció', ['customer/reception', 'number' => $card->number ]],
[ 'Termék eladás', ['product/sale', 'number' => $card->number ]],
[ 'Adatlap', ['customer/update', 'number' => $card->number ]],
[ 'Befizetések', ['ticket/index', 'number' => $card->number] ],
[ 'Kulcsok', ['key/index', 'id_card' => $card->id_card] ],
[ 'Szerződések', ['contract/index', 'id_card' => $card->id_card ]],
[ 'Kosár', ['transfer/customer-cart', 'id_card' => $card->id_card ]],
[ 'Kártya', ['card/info', 'id_card' => $card->id_card ]],
[ 'Törölköző Bérlés', ['log/towel', 'id_card' => $card->id_card , 'LogSearch[start]' => $todayDateTime ]],
[ 'Ujjlenyomat', ['fingerprint/index', 'FingerprintSearch[id_card]' => $card->id_card ]],
[ 'Jelszó küldése', ['customer/password-change', 'id_card' => $card->id_card ]],
['Recepció', ['customer/reception', 'number' => $card->number]],
['Termék eladás', ['product/sale', 'number' => $card->number]],
['Adatlap', ['customer/update', 'number' => $card->number]],
['Befizetések', ['ticket/index', 'number' => $card->number]],
['Kulcsok', ['key/index', 'id_card' => $card->id_card]],
['Szerződések', ['contract/index', 'id_card' => $card->id_card]],
['Kosár', ['transfer/customer-cart', 'id_card' => $card->id_card]],
['Kártya', ['card/info', 'id_card' => $card->id_card]],
['Törölköző Bérlés', ['log/towel', 'id_card' => $card->id_card, 'LogSearch[start]' => $todayDateTime]],
['Ujjlenyomat', ['fingerprint/index', 'FingerprintSearch[id_card]' => $card->id_card]],
['Jelszó küldése', ['customer/password-change', 'id_card' => $card->id_card]],
['Mobil Eszközök', ['mobile-device/index', 'id_card' => $card->id_card]],
];
?>
<style>
.fitness-nav {
}
.fitness-nav-item.active a, .fitness-nav-item a:hover {
background: #0b93d5;
}
.fitness-nav-item > a {
padding: 8px 16px;
display: block;
margin-bottom: 8px;
background: #204d74;
color: #ffffff;
border-radius: 4px;
text-align: center;
}
.fitness-nav-container{
background: #e2e2e2;
padding: 8px 8px 0 8px;
border-radius: 4px;
}
</style>
<div class="fitness-nav-container">
<ul class="nav nav-tabs">
<?php foreach ($items as $item){?>
<?php
if ( empty($title)){
if ( $item[1][0] == $route) {
$title = $item[0];
}
}
?>
<li role="presentation" class="<?php echo $item[1][0] == $route ? 'active' : '' ?>"><a href="<?php echo Url::toRoute($item[1])?>"><?php echo $item[0] ?></a></li>
<?php }?>
</ul>
<div class="row fitness-nav">
<?php foreach ($items as $item) { ?>
<?php
if (empty($title)) {
if ($item[1][0] == $route) {
$title = $item[0];
}
}
?>
<div role="presentation"
class="col-lg-2 fitness-nav-item <?php echo $item[1][0] == $route ? 'active' : '' ?>"><a
href="<?php echo Url::toRoute($item[1]) ?>"><?php echo $item[0] ?></a></div>
<?php } ?>
</div>
</div>
<?php if ( !empty($title)) {?>
<h1><?php echo $title?></h1>
<?php if (!empty($title)) { ?>
<h1><?php echo $title ?></h1>
<p>Vendég: <?php echo $card->customer->name ?></p>
<p>Kártyaszám: <?php echo $card->number ?></p>
<?php }?>
<?php } ?>

View File

@@ -13,57 +13,69 @@ use yii\helpers\Url;
<?php
if ( $model->isCardWithCustomer() ){
$attributes = [
[
'label' => 'Kártyaszám',
'value' => $model->card->number
],
[
'label' => 'Vendég',
'value' => $model->customer->name
],
[
'label' => 'E-Mail',
'value' => $model->customer->email
],
[
'label' => 'Telefon',
'value' => $model->customer->phone
],
[
'label' => 'Kiadott törölközők',
'value' => $model->customer->towel_count
],
[
'label' => 'Kulcsok',
'value' =>
empty($model->keysText) ? '' : (
"<form method='POST' action='". Url::toRoute(['key/toggle', "number" => $model->card->number])."'>"
.$model->keysText
.Html::hiddenInput("KeyToggleForm[key]", $model->keysText)
.Html::submitButton("Visszaad", [ 'style' => 'float: right;', 'class' => 'btn btn-primary btn-xs'])
."</form>")
,
'format' => 'raw'
],
[
'label' => 'Fénykép',
'value' => $model->customer->image1 ? Html::img( Url::base( ) . Image::thumb( $model->customer->image1->path,160,120 )) : 'Nincs kép',
'format' => 'raw'
],
];
?>
<div class="row">
<div class="col-md-12">
<?php
echo DetailView::widget([
'model' => $model,
'attributes' =>[
[
'label' => 'Kártyaszám',
'value' => $model->card->number
],
[
'label' => 'Vendég',
'value' => $model->customer->name
],
[
'label' => 'E-Mail',
'value' => $model->customer->email
],
[
'label' => 'Telefon',
'value' => $model->customer->phone
],
[
'label' => 'Kiadott törölközők',
'value' => $model->customer->towel_count
],
[
'label' => 'Kulcsok',
'value' =>
empty($model->keysText) ? '' : (
"<form method='POST' action='". Url::toRoute(['key/toggle', "number" => $model->card->number])."'>"
.$model->keysText
.Html::hiddenInput("KeyToggleForm[key]", $model->keysText)
.Html::submitButton("Visszaad", [ 'style' => 'float: right;', 'class' => 'btn btn-primary btn-xs'])
."</form>")
,
'format' => 'raw'
],
[
'label' => 'Fénykép',
'value' => $model->customer->image1 ? Html::img( Url::base( ) . Image::thumb( $model->customer->image1->path,160,120 )) : 'Nincs kép',
'format' => 'raw'
],
]
'attributes' => $attributes
])
?>
<div>
<?php
echo Html::a('Menü',['customer/update', 'number' => $model->card->number],['class' => 'btn btn-success me-3']);
if ( isset($showLinkDevices) && $showLinkDevices === true ) {
echo Html::a('Eszköz aktiválása', ['mobile-device/index', 'id_card' => $model->card->id_card], ['class' => 'btn btn-success']);
}?>
</div>
</div>
</div>
<?php
}
?>
?>

View File

@@ -0,0 +1,86 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\Url;
use common\models\MobileDevice;
/* @var $this yii\web\View */
/* @var $searchModel frontend\models\CollectionSearch */
/* @var $card \common\models\Card */
/* @var $dataProvider \frontend\controllers\MobileDeviceController */
$this->title = "Vendég - mobil eszközök";
$this->params['breadcrumbs'][] = "Vendég";
$this->params['breadcrumbs'][] = "Mobil eszközök";
echo \frontend\components\CustomerTabWidget::widget(['card' => $card]);
echo GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'card_number',
'label' => 'Kártyaszám',
],
[
'attribute' => 'device_name',
'label' => 'Eszköz neve',
],
[
'attribute' => 'device_created_at',
'label' => 'Létrehozva',
'format' => 'datetime'
],
[
'attribute' => 'device_status',
'label' => 'Státusz',
'value' => function ($model, $key, $index, $column) {
return MobileDevice::toStatusHumanReadable($model['device_status']);
}
],
['class' => 'yii\grid\ActionColumn',
'header' => 'Műveletek',
'template' => '{activate} {delete}',
'buttons' => [
'activate' => function ($url, $model, $key) {
$status = $model['device_status'];
if ($status == MobileDevice::STATUS_ACTIVE) {
return null;
}
$options = [
'title' => 'Az aktuális eszköz aktiválása',
'data-confirm' => "Biztosan aktiválni szerenté ezt az eszközt?",
'data-method' => 'post',
'class' => 'btn btn-xs btn-success'
];
return Html::a('Aktivál', $url, $options);
},
'delete' => function ($url, $model, $key) {
$status = $model['device_status'];
if ($status !== MobileDevice::STATUS_ACTIVE) {
return null;
}
$options = [
'title' => 'Az aktuális eszköz törlése',
'data-confirm' => "Biztosan törölni szerenté ezt az eszközt?",
'data-method' => 'post',
'class' => 'btn btn-xs btn-danger'
];
return Html::a('Töröl', $url, $options);
},
],
'urlCreator' => function ($action, $model, $key, $index) {
$status = MobileDevice::STATUS_DELETED_MANUAL;
if ($action === 'activate') {
$status = MobileDevice::STATUS_ACTIVE;
}
$url = Url::to(['mobile-device/status', 'id_device' => $model['device_id'], 'status' => $status]);
return $url;
}
],
],
]); ?>