Display maximum quantity warning to admin during new booking creation
This commit is contained in:
@@ -134,7 +134,10 @@
|
||||
<p>{$product['name']|escape:'html':'UTF-8'}</p>
|
||||
{if $product.allow_multiple_quantity}
|
||||
<div class="qty_container">
|
||||
<input type="number" class="form-control room_type_service_product_qty qty" id="qty_{$product.id_product}" name="service_product_qty_{$product.id_product}" data-id-product="{$product.id_product}" min="1" value="{if isset($selectedRoomServiceProduct['selected_service']) && $selectedRoomServiceProduct['selected_service'] && ($product['id_product']|array_key_exists:$selectedRoomServiceProduct['selected_service'])}{$selectedRoomServiceProduct['selected_service'][$product['id_product']]['quantity']}{else}1{/if}">
|
||||
<input type="number" class="form-control room_type_service_product_qty qty" id="qty_{$product.id_product}" name="service_product_qty_{$product.id_product}" data-id-product="{$product.id_product}" min="1" data-max-quantity="{$product.max_quantity}" value="{if isset($selectedRoomServiceProduct['selected_service']) && $selectedRoomServiceProduct['selected_service'] && ($product['id_product']|array_key_exists:$selectedRoomServiceProduct['selected_service'])}{$selectedRoomServiceProduct['selected_service'][$product['id_product']]['quantity']}{else}1{/if}">
|
||||
<p style="display:{if isset($selectedRoomServiceProduct['selected_service']) && $selectedRoomServiceProduct['selected_service'] && ($product['id_product']|array_key_exists:$selectedRoomServiceProduct['selected_service'])}block{else}none{/if}; margin-top: 4px;">
|
||||
<span class="label label-warning">{l s='Maximum allowed quantity: %s' sprintf=$product.max_quantity}</span>
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -1579,6 +1579,17 @@
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('change', '.room_type_service_product_qty', function(e) {
|
||||
let quantityInputField = this;
|
||||
let maximumQuantity = parseInt($(quantityInputField).attr('data-max-quantity'));
|
||||
let currentQuantity = parseInt($(quantityInputField).val());
|
||||
if (currentQuantity > maximumQuantity) {
|
||||
$(quantityInputField).siblings('p').show();
|
||||
} else {
|
||||
$(quantityInputField).siblings('p').hide();
|
||||
}
|
||||
});
|
||||
|
||||
function updateServiceProducts(element)
|
||||
{
|
||||
var operator = $(element).is(':checked') ? 'up' : 'down';
|
||||
|
||||
Reference in New Issue
Block a user