fix move out , if usage count reached max usage count

fix gui: card number will be loaded only if form is empty
This commit is contained in:
Schneider Roland
2023-05-24 16:36:41 +02:00
parent 3d8516c50f
commit cb1b2e2d13
5 changed files with 53 additions and 24 deletions

View File

@@ -26,7 +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' ?>
var isWordTypedListenerAllowedOnlyForEmptyCustomer = <?= \common\components\Helper::isWordTypedListenerAllowedOnlyForEmptyCustomer() ? 'true' : 'false' ?>;
</script>
<?php $this->head() ?>
</head>

View File

@@ -40,12 +40,17 @@ function addDocumentKeypressedListener(){
$( document ).on( "wordtyped", function( event, data ) {
var word;
word = data.word;
console.info("word typed",word);
console.info("isWordTypedListenerAllowedOnlyForEmptyCustomer",isWordTypedListenerAllowedOnlyForEmptyCustomer);
if ( word && word.length > 0){
var redirectAllowed = true;
if ( isWordTypedListenerAllowedOnlyForEmptyCustomer ){
if ( location.href !== reception_card_url ){
let params = new URLSearchParams(location.search)
let cardNumber = params.get("number");
if ( cardNumber && cardNumber.length > 0){
redirectAllowed = false;
console.info("disalbling customer redirect. reason: isWordTypedListenerAllowedOnlyForEmptyCustomer = true")
console.info("redirect disabled! number param exists", word, cardNumber );
}
}
if ( redirectAllowed){