add feature word_typed_listener_allowed_only_for_empty_customerf
This commit is contained in:
parent
beb3c3944e
commit
89fe6a37c1
@ -552,4 +552,11 @@ class Helper {
|
||||
return Helper::getArrayValue(\Yii::$app->params ,'door_pass_validity_interval_minutes','10');
|
||||
}
|
||||
|
||||
public static function isWordTypedListenerAllowedOnlyForEmptyCustomer(){
|
||||
$key = "word_typed_listener_allowed_only_for_empty_customer";
|
||||
// return Helper::getArrayValue(\Yii::$app->params ,$key,'0') === '1';
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
$REST_ALLOW_VERIFY_ONLY=getenv('FITNESS_REST_ALLOW_VERIFY_ONLY');
|
||||
$FITNESS_WORD_TYPED_LISTENER_ALLOWED_ONLY_FOR_EMPTY_CUSTOMER=getenv('FITNESS_WORD_TYPED_LISTENER_ALLOWED_ONLY_FOR_EMPTY_CUSTOMER');
|
||||
|
||||
return [
|
||||
'user.passwordResetTokenExpire' => 3600,
|
||||
@ -23,5 +24,6 @@ return [
|
||||
'reception_show_stock' => false,
|
||||
'login_admin_email' => false,
|
||||
'warn_ticket_expire_in_usage_count' => 10,
|
||||
'rest_allow_verify_only' => $REST_ALLOW_VERIFY_ONLY === 'true'
|
||||
'rest_allow_verify_only' => $REST_ALLOW_VERIFY_ONLY === 'true',
|
||||
'word_typed_listener_allowed_only_for_empty_customer' => $FITNESS_WORD_TYPED_LISTENER_ALLOWED_ONLY_FOR_EMPTY_CUSTOMER,
|
||||
];
|
||||
|
||||
@ -26,6 +26,7 @@ AppAsset::register($this);
|
||||
<title><?= Html::encode($this->title) ?></title>
|
||||
<script>
|
||||
var reception_card_url = '<?php echo Url::toRoute('customer/reception');?>';
|
||||
var isWordTypedListenerAllowedOnlyForEmptyCustomer = <?= \common\components\Helper::isWordTypedListenerAllowedOnlyForEmptyCustomer() ? 'true' : 'false' ?>
|
||||
</script>
|
||||
<?php $this->head() ?>
|
||||
</head>
|
||||
@ -34,17 +35,17 @@ AppAsset::register($this);
|
||||
|
||||
<div class="wrap">
|
||||
<?php
|
||||
|
||||
|
||||
// with growl
|
||||
echo AlertBlock::widget([
|
||||
'useSessionFlash' => true,
|
||||
'type' => AlertBlock::TYPE_GROWL,
|
||||
'delay' => '1'
|
||||
]);
|
||||
|
||||
|
||||
$menuStruct = new FrontendMenuStructure();
|
||||
$items = $menuStruct->run();
|
||||
|
||||
|
||||
NavBar::begin([
|
||||
'brandLabel' => 'Web Recepció',
|
||||
'brandUrl' => Yii::$app->homeUrl,
|
||||
|
||||
@ -4,7 +4,7 @@ var seq = '';
|
||||
var socket;
|
||||
$(document).ready(
|
||||
function(){
|
||||
|
||||
|
||||
$("input[name='number']").on('focus', function (e) {
|
||||
$(this)
|
||||
.one('mouseup', function () {
|
||||
@ -13,7 +13,7 @@ $(document).ready(
|
||||
})
|
||||
.select();
|
||||
});
|
||||
|
||||
|
||||
addDocumentKeypressedListener();
|
||||
}
|
||||
);
|
||||
@ -23,9 +23,9 @@ function addDocumentKeypressedListener(){
|
||||
$( document ).keypress(function( event ) {
|
||||
var tag = event.target.tagName.toLowerCase();
|
||||
if ( tag != 'input' && tag != 'textarea' && tag != 'select') {
|
||||
|
||||
|
||||
resetSequenceIfToMuchTimePassedOrEnterWasPressed(event);
|
||||
|
||||
|
||||
if ( event.which == 13 ) {
|
||||
enterPressed = 1;
|
||||
if ( seq ){
|
||||
@ -35,19 +35,27 @@ function addDocumentKeypressedListener(){
|
||||
appendCharToSeq(event);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$( document ).on( "wordtyped", function( event, data ) {
|
||||
var word;
|
||||
word = data.word;
|
||||
if ( word && word.length > 0){
|
||||
|
||||
location.href= reception_card_url +'&number=' + word;
|
||||
|
||||
|
||||
var redirectAllowed = true;
|
||||
if ( isWordTypedListenerAllowedOnlyForEmptyCustomer ){
|
||||
if ( location.href !== reception_card_url ){
|
||||
redirectAllowed = false;
|
||||
console.info("disalbling customer redirect. reason: isWordTypedListenerAllowedOnlyForEmptyCustomer = true")
|
||||
}
|
||||
}
|
||||
if ( redirectAllowed){
|
||||
location.href= reception_card_url +'&number=' + word;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function resetSequenceIfToMuchTimePassedOrEnterWasPressed(){
|
||||
var prevDate, timePassed;
|
||||
prevDate= keyDate;
|
||||
@ -58,7 +66,7 @@ function addDocumentKeypressedListener(){
|
||||
enterPressed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function appendCharToSeq(event){
|
||||
var code,s;
|
||||
code = event.which;
|
||||
@ -68,7 +76,7 @@ function addDocumentKeypressedListener(){
|
||||
seq += s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user