update services modal in admin view order

This commit is contained in:
Shreesh Arora
2023-03-07 11:46:17 +00:00
parent e81c0fbbee
commit efdfbe99ab
4 changed files with 182 additions and 186 deletions

View File

@@ -22,12 +22,8 @@
<span aria-hidden="true">&times;</span>
</button>
<ul class="nav nav-tabs" role="tablist">
{if (isset($extraDemands) && $extraDemands) || (isset($roomTypeDemands) && $roomTypeDemands)}
<li role="presentation" class="active"><a href="#room_type_demands_desc" aria-controls="facilities" role="tab" data-toggle="tab">{l s='Facilities'}</a></li>
{/if}
{if (isset($additionalServices) && $additionalServices) || (isset($roomTypeServiceProducts) && $roomTypeServiceProducts)}
<li role="presentation" {if !(isset($extraDemands) && $extraDemands) && !(isset($roomTypeDemands) && $roomTypeDemands)}class="active"{/if}><a href="#room_type_service_product_desc" aria-controls="services" role="tab" data-toggle="tab">{l s='Services'}</a></li>
{/if}
<li role="presentation" class="active"><a href="#room_type_demands_desc" aria-controls="facilities" role="tab" data-toggle="tab">{l s='Facilities'}</a></li>
<li role="presentation"><a href="#room_type_service_product_desc" aria-controls="services" role="tab" data-toggle="tab">{l s='Services'}</a></li>
</ul>
</div>
<div class="modal-body" id="rooms_extra_demands">
@@ -37,7 +33,6 @@
</div>
</div>
<div class="modal-footer">
{* <button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">{l s='Close'}</button> *}
</div>
@@ -51,8 +46,8 @@
margin: 0px;}
#rooms_type_extra_demands .demand_edit_badge {
font-size: 14px;}
#rooms_extra_demands .room_ordered_demands td, #rooms_extra_demands .room_demand_detail {
font-size: 14px;}
/* #rooms_extra_demands .room_ordered_demands td, #rooms_extra_demands .room_demand_detail { */
/* font-size: 14px;} */
#rooms_extra_demands .demand_header {
padding: 10px;
color: #333;

View File

@@ -17,91 +17,91 @@
* @license https://store.webkul.com/license.html
*}
{if (isset($extraDemands) && $extraDemands) || (isset($roomTypeDemands) && $roomTypeDemands)}
<div id="room_type_demands_desc" class="tab-pane active">
<input type="hidden" value="{$id_booking_detail}" id="id_htl_booking">
{if isset($orderEdit) && $orderEdit}
<p class="col-sm-12 facility_nav_btn">
<button id="btn_new_room_demand" class="btn btn-success"><i class="icon-plus"></i> {l s='Add new facility'}</button>
<button id="back_to_demands_btn" class="btn btn-default"><i class="icon-arrow-left"></i> {l s='Back'}</button>
</p>
<div id="room_type_demands_desc" class="tab-pane active">
<input type="hidden" value="{$id_booking_detail}" id="id_htl_booking">
{if isset($orderEdit) && $orderEdit}
<p class="col-sm-12 facility_nav_btn">
<button id="btn_new_room_demand" class="btn btn-success"><i class="icon-plus"></i> {l s='Add new facility'}</button>
<button id="back_to_demands_btn" class="btn btn-default"><i class="icon-arrow-left"></i> {l s='Back'}</button>
</p>
{* Already selected room demands *}
<div class="col-sm-12 room_ordered_demands table-responsive">
<table class="table">
<tbody>
{if isset($extraDemands) && $extraDemands}
{foreach $extraDemands as $roomDemand}
{foreach $roomDemand['extra_demands'] as $demand}
<tr>
<td>{$demand['name']}</td>
<td>{displayPrice price=$demand['total_price_tax_incl'] currency=$orderCurrency}</td>
<td><a class="btn btn-danger pull-right del-order-room-demand" href="#" id_booking_demand="{$demand['id_booking_demand']}"><i class="icon-trash"></i></a></td>
</tr>
{/foreach}
{* Already selected room demands *}
<div class="col-sm-12 room_ordered_demands table-responsive">
<table class="table">
<tbody>
{if isset($extraDemands) && $extraDemands}
{foreach $extraDemands as $roomDemand}
{foreach $roomDemand['extra_demands'] as $demand}
<tr>
<td>{$demand['name']}</td>
<td>{displayPrice price=$demand['total_price_tax_incl'] currency=$orderCurrency}</td>
<td><a class="btn btn-danger pull-right del-order-room-demand" href="#" id_booking_demand="{$demand['id_booking_demand']}"><i class="icon-trash"></i></a></td>
</tr>
{/foreach}
{else}
<tr>
<td colspan="3">
<i class="icon-warning"></i> {l s='No facilities added yet.'}
</td>
</tr>
{/if}
</tbody>
</table>
</div>
{/foreach}
{else}
<tr>
<td colspan="3">
<i class="icon-warning"></i> {l s='No facilities added yet.'}
</td>
</tr>
{/if}
</tbody>
</table>
</div>
{* Room demands available for the current editing room*}
<div class="col-sm-12 room_demands_container">
<div class="room_demand_detail">
{if isset($roomTypeDemands) && $roomTypeDemands}
{foreach $roomTypeDemands as $idGlobalDemand => $demand}
<div class="row room_demand_block">
<div class="col-xs-6">
<div class="row">
<div class="col-xs-2">
<input id_cart_booking="{$roomDemand['id']}" value="{$idGlobalDemand|escape:'html':'UTF-8'}" type="checkbox" class="id_room_type_demand" {if isset($roomDemand['selected_global_demands']) && $roomDemand['selected_global_demands'] && ($idGlobalDemand|in_array:$roomDemand['selected_global_demands'])}checked{/if} />
</div>
<div class="col-xs-10 demand_adv_option_block">
<p>{$demand['name']|escape:'html':'UTF-8'}</p>
{if isset($demand['adv_option']) && $demand['adv_option']}
<select class="id_option">
{foreach $demand['adv_option'] as $idOption => $option}
{assign var=demand_key value="`$idGlobalDemand`-`$idOption`"}
<option optionPrice="{$option['price']|escape:'html':'UTF-8'}" value="{$idOption|escape:'html':'UTF-8'}" {if isset($roomDemand['extra_demands'][$demand_key])}selected{/if} key="{$demand_key}">{$option['name']}</option>
{if isset($roomDemand['extra_demands'][$demand_key])}
{assign var=selected_adv_option value="$idOption"}
{/if}
{/foreach}
</select>
{else}
<input type="hidden" class="id_option" value="0" />
{/if}
</div>
{* Room demands available for the current editing room*}
<div class="col-sm-12 room_demands_container">
<div class="room_demand_detail">
{if isset($roomTypeDemands) && $roomTypeDemands}
{foreach $roomTypeDemands as $idGlobalDemand => $demand}
<div class="row room_demand_block">
<div class="col-xs-6">
<div class="row">
<div class="col-xs-2">
<input id_cart_booking="{$roomDemand['id']}" value="{$idGlobalDemand|escape:'html':'UTF-8'}" type="checkbox" class="id_room_type_demand" {if isset($roomDemand['selected_global_demands']) && $roomDemand['selected_global_demands'] && ($idGlobalDemand|in_array:$roomDemand['selected_global_demands'])}checked{/if} />
</div>
<div class="col-xs-10 demand_adv_option_block">
<p>{$demand['name']|escape:'html':'UTF-8'}</p>
{if isset($demand['adv_option']) && $demand['adv_option']}
<select class="id_option">
{foreach $demand['adv_option'] as $idOption => $option}
{assign var=demand_key value="`$idGlobalDemand`-`$idOption`"}
<option optionPrice="{$option['price']|escape:'html':'UTF-8'}" value="{$idOption|escape:'html':'UTF-8'}" {if isset($roomDemand['extra_demands'][$demand_key])}selected{/if} key="{$demand_key}">{$option['name']}</option>
{if isset($roomDemand['extra_demands'][$demand_key])}
{assign var=selected_adv_option value="$idOption"}
{/if}
{/foreach}
</select>
{else}
<input type="hidden" class="id_option" value="0" />
{/if}
</div>
</div>
<div class="col-xs-6">
<p><span class="pull-right extra_demand_option_price">{if isset($selected_adv_option) && isset($demand['adv_option'][$selected_adv_option]['price'])}{convertPrice price = $demand['adv_option'][$selected_adv_option]['price']|escape:'html':'UTF-8'}{else}{convertPrice price = $demand['price']|escape:'html':'UTF-8'}{/if}</span></p>
</div>
</div>
{/foreach}
{/if}
</div>
<button type="button" id="save_room_demands" class="btn btn-success pull-right"><i class="icon-save"></i> {l s='Save'}</button>
</div>
{elseif isset($extraDemands) && $extraDemands}
{foreach $extraDemands as $roomDemand}
<div class="row room_demand_detail">
{foreach $roomDemand['extra_demands'] as $demand}
<div class="col-sm-12 room_demand_block">
<p>
<span>{$demand['name']}</span>
<span class="pull-right">{displayPrice price=$demand['total_price_tax_incl'] currency=$orderCurrency}</span>
</p>
<div class="col-xs-6">
<p><span class="pull-right extra_demand_option_price">{if isset($selected_adv_option) && isset($demand['adv_option'][$selected_adv_option]['price'])}{convertPrice price = $demand['adv_option'][$selected_adv_option]['price']|escape:'html':'UTF-8'}{else}{convertPrice price = $demand['price']|escape:'html':'UTF-8'}{/if}</span></p>
</div>
</div>
{/foreach}
</div>
{/foreach}
{/if}
</div>
{/if}
{/if}
</div>
<button type="button" id="save_room_demands" class="btn btn-success pull-right"><i class="icon-save"></i> {l s='Save'}</button>
</div>
{elseif isset($extraDemands) && $extraDemands}
{foreach $extraDemands as $roomDemand}
<div class="row room_demand_detail">
{foreach $roomDemand['extra_demands'] as $demand}
<div class="col-sm-12 room_demand_block">
<p>
<span>{$demand['name']}</span>
<span class="pull-right">{displayPrice price=$demand['total_price_tax_incl'] currency=$orderCurrency}</span>
</p>
</div>
{/foreach}
</div>
{/foreach}
{else}
{l s='No facilities available!'}
{/if}
</div>

View File

@@ -17,114 +17,114 @@
* @license https://store.webkul.com/license.html
*}
{if (isset($additionalServices) && $additionalServices) || (isset($roomTypeServiceProducts) && $roomTypeServiceProducts)}
<div id="room_type_service_product_desc" class="tab-pane{if !(isset($extraDemands) && $extraDemands) && !(isset($roomTypeDemands) && $roomTypeDemands)} active{/if}">
{if isset($orderEdit) && $orderEdit}
<div id="room_type_service_product_desc" class="tab-pane {if isset($show_active) && $show_active}active{/if}">
{if isset($orderEdit) && $orderEdit}
<p class="col-sm-12 facility_nav_btn">
<button id="btn_new_room_service" class="btn btn-success"><i class="icon-plus"></i> {l s='Add new service'}</button>
<button id="back_to_service_btn" class="btn btn-default"><i class="icon-arrow-left"></i> {l s='Back'}</button>
</p>
<p class="col-sm-12 facility_nav_btn">
<button id="btn_new_room_service" class="btn btn-success"><i class="icon-plus"></i> {l s='Add new service'}</button>
<button id="back_to_service_btn" class="btn btn-default"><i class="icon-arrow-left"></i> {l s='Back'}</button>
</p>
{* Already selected room services *}
<div class="col-sm-12 room_ordered_services table-responsive">
<table class="table">
<tbody>
{if isset($additionalServices) && $additionalServices}
{foreach $additionalServices['additional_services'] as $service}
<tr class="room_demand_block">
<td>
<div>{$service['name']|escape:'html':'UTF-8'}</div>
{if $service['allow_multiple_quantity']}
<div class="qty_container">
<input type="number" class="form-control qty" data-id_room_type_service_product_order_detail="{$service['id_room_type_service_product_order_detail']}" data-id_product="{$service['id_product']|escape:'html':'UTF-8'}" value="{$service['quantity']|escape:'html':'UTF-8'}">
</div>
{/if}
</td>
<td>
{if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT}
<span class="badge badge-info label">{l s='Convenience fee'}</span>
{* Already selected room services *}
<div class="col-sm-12 room_ordered_services table-responsive">
<table class="table">
<tbody>
{if isset($additionalServices) && $additionalServices}
{foreach $additionalServices['additional_services'] as $service}
<tr class="room_demand_block">
<td>
<div>{$service['name']|escape:'html':'UTF-8'}</div>
{if $service['allow_multiple_quantity']}
<div class="qty_container">
<input type="number" class="form-control qty" min="1" data-id_room_type_service_product_order_detail="{$service['id_room_type_service_product_order_detail']}" data-id_product="{$service['id_product']|escape:'html':'UTF-8'}" value="{$service['quantity']|escape:'html':'UTF-8'}">
</div>
{/if}
{if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM}
<span class="badge badge-info label">{l s='Auto added'}</span>
{/if}
</td>
<td>{displayPrice price=$service['total_price_tax_excl']|escape:'html':'UTF-8' currency=$orderCurrency}</td>
<td><a class="btn btn-danger pull-right del_room_additional_service" data-id_room_type_service_product_order_detail="{$service['id_room_type_service_product_order_detail']}" href="#"><i class="icon-trash"></i></a></td>
</tr>
{/foreach}
{else}
<tr>
<td colspan="3">
<i class="icon-warning"></i> {l s='No services added yet.'}
</td>
</tr>
{/if}
</tbody>
</table>
</div>
<form id="add_room_services_form" class="col-sm-12 room_services_container">
<div class="room_demand_detail">
{if isset($roomTypeServiceProducts) && $roomTypeServiceProducts}
{foreach $roomTypeServiceProducts as $product}
<div class="row room_demand_block">
<div class="col-xs-6">
<div class="row">
<div class="col-xs-2">
<input data-id_booking_detail="{$id_booking_detail}" value="{$product['id_product']|escape:'html':'UTF-8'}" name="selected_service[]" type="checkbox" class="id_room_type_service"/>
</div>
<div class="col-xs-10">
<p>{$product['name']|escape:'html':'UTF-8'}</p>
{if $product.allow_multiple_quantity}
<div class="qty_container">
<input type="number" class="form-control qty" id="qty_{$product['id_product']|escape:'html':'UTF-8'}" name="service_qty[{$product['id_product']|escape:'html':'UTF-8'}]" data-id-product="{$product.id_product|escape:'html':'UTF-8'}" value="1">
</div>
{/if}
</div>
</div>
</div>
<div class="col-xs-6">
<p>
<span class="pull-right">{convertPrice price=$product.price_tax_incl}</span>
</p>
</div>
</div>
{/foreach}
{else}
<i class="icon-warning"></i> {l s='No services available to select, All services already added.'}
{/if}
</div>
<input type="hidden" name="id_booking_detail" value="{$id_booking_detail}">
<button type="submit" id="save_service_service" class="btn btn-success pull-right"><i class="icon-save"></i> {l s='Save'}</button>
</form>
{elseif isset($additionalServices) && $additionalServices}
<div class="row room_demand_detail">
{foreach $additionalServices['additional_services'] as $service}
<div class="col-sm-12 room_demand_block">
<div class="row">
<div class="col-xs-8">
<span class="pull-right">
<td>
{if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT}
<span class="badge badge-info label">{l s='Convenience fee'}</span>
{/if}
{if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM}
<span class="badge badge-info label">{l s='Auto added'}</span>
{/if}
</span>
<div>{$service['name']|escape:'html':'UTF-8'}</div>
{if $service['allow_multiple_quantity']}
<div class="quantity">{l s='Qty:'}&nbsp;{$service['quantity']|escape:'html':'UTF-8'}</div>
{/if}
</td>
<td>{displayPrice price=$service['total_price_tax_excl']|escape:'html':'UTF-8' currency=$orderCurrency}</td>
<td><a class="btn btn-danger pull-right del_room_additional_service" data-id_room_type_service_product_order_detail="{$service['id_room_type_service_product_order_detail']}" href="#"><i class="icon-trash"></i></a></td>
</tr>
{/foreach}
{else}
<tr>
<td colspan="3">
<i class="icon-warning"></i> {l s='No services added yet.'}
</td>
</tr>
{/if}
</tbody>
</table>
</div>
<form id="add_room_services_form" class="col-sm-12 room_services_container">
<div class="room_demand_detail">
{if isset($roomTypeServiceProducts) && $roomTypeServiceProducts}
{foreach $roomTypeServiceProducts as $product}
<div class="row room_demand_block">
<div class="col-xs-6">
<div class="row">
<div class="col-xs-2">
<input data-id_booking_detail="{$id_booking_detail}" value="{$product['id_product']|escape:'html':'UTF-8'}" name="selected_service[]" type="checkbox" class="id_room_type_service"/>
</div>
<div class="col-xs-10">
<p>{$product['name']|escape:'html':'UTF-8'}</p>
{if $product.allow_multiple_quantity}
<div class="qty_container">
<input type="number" class="form-control qty" min="1" id="qty_{$product['id_product']|escape:'html':'UTF-8'}" name="service_qty[{$product['id_product']|escape:'html':'UTF-8'}]" data-id-product="{$product.id_product|escape:'html':'UTF-8'}" value="1">
</div>
{/if}
</div>
</div>
</div>
<div class="col-xs-4">
<span class="pull-right">{displayPrice price=$service['total_price_tax_excl'] currency=$orderCurrency}</span>
<div class="col-xs-6">
<p>
<span class="pull-right">{convertPrice price=$product.price_tax_incl}</span>
</p>
</div>
</div>
</div>
{/foreach}
{/foreach}
{else}
<i class="icon-warning"></i> {l s='No services available to select, All services already added.'}
{/if}
</div>
{/if}
</div>
{/if}
<input type="hidden" name="id_booking_detail" value="{$id_booking_detail}">
<button type="submit" id="save_service_service" class="btn btn-success pull-right"><i class="icon-save"></i> {l s='Save'}</button>
</form>
{elseif isset($additionalServices) && $additionalServices}
<div class="row room_demand_detail">
{foreach $additionalServices['additional_services'] as $service}
<div class="col-sm-12 room_demand_block">
<div class="row">
<div class="col-xs-8">
<span class="pull-right">
{if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT}
<span class="badge badge-info label">{l s='Convenience fee'}</span>
{/if}
{if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM}
<span class="badge badge-info label">{l s='Auto added'}</span>
{/if}
</span>
<div>{$service['name']|escape:'html':'UTF-8'}</div>
{if $service['allow_multiple_quantity']}
<div class="quantity">{l s='Qty:'}&nbsp;{$service['quantity']|escape:'html':'UTF-8'}</div>
{/if}
</div>
<div class="col-xs-4">
<span class="pull-right">{displayPrice price=$service['total_price_tax_excl'] currency=$orderCurrency}</span>
</div>
</div>
</div>
{/foreach}
</div>
{else}
{l s='No services available!'}
{/if}
</div>

View File

@@ -4742,6 +4742,7 @@ class AdminOrdersControllerCore extends AdminController
$smartyVars['roomTypeServiceProducts'] = $roomTypeServiceProducts;
}
}
$smartyVars['show_active'] = true;
$this->context->smarty->assign($smartyVars);
$servicesTpl = $this->context->smarty->fetch(