customer service improvement

This commit is contained in:
azhar bhat
2026-01-21 17:17:38 +05:30
parent 1474ec2c61
commit fae6dff86f
13 changed files with 284 additions and 56 deletions

View File

@@ -720,11 +720,11 @@
<span>{$message['elastname']|escape:'html':'UTF-8'}{else}{$message['cfirstname']|escape:'html':'UTF-8'} {$message['clastname']|escape:'html':'UTF-8'}</span>
{/if},
<span class="message-date">&nbsp;<i class="icon-calendar"></i>
{dateFormat date=$message['date_add']}
{dateFormat date=$message.date_add full=1}
</span>
{if ($message['private'] == 1)}
{* {if ($message['private'] == 1)}
<span class="badge badge-info">{l s='Private'}</span>
{/if}
{/if} *}
</p>
</div>
{if !$smarty.foreach.customerMessage.last}<hr/>{/if}

View File

@@ -128,6 +128,12 @@
</div>
{/if}
</div>
<div class="form-group row">
<div class="col-sm-12">
<label class="control-label">{l s='Remark'}</label>
<textarea class="form-control room_remark" type="text" name="message" value="" maxlength="250"></textarea>
</div>
</div>
{if isset($invoices_collection) && sizeof($invoices_collection)}
<div class="form-group" style="display: none;">

View File

@@ -0,0 +1,54 @@
{*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License version 3.0
* that is bundled with this package in the file LICENSE.md
* It is also available through the world-wide-web at this URL:
* https://opensource.org/license/osl-3-0-php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to support@qloapps.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to a newer
* versions in the future. If you wish to customize this module for your needs
* please refer to https://store.webkul.com/customisation-guidelines for more information.
*
* @author Webkul IN
* @copyright Since 2010 Webkul
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
*}
<div class="modal-body">
<input type="hidden" name="id_product" value="{$id_product}">
<input type="hidden" name="id_order_detail" value="{$id_order_detail}">
<input type="hidden" name="id_hotel" value="{$id_hotel}">
<input type="hidden" name="id_room" value="{$id_room}">
<input type="hidden" name="id_htl_booking" value="{$id_htl_booking}">
<input type="hidden" name="date_from" value="{$date_from}">
<input type="hidden" name="date_to" value="{$date_to}">
<div class="form-group">
<div class="form-group" id="remarkGroup">
<label class="control-label" for="room_remark">
{l s='Remark'}
</label>
<textarea id="room_remark" class="form-control" name="message"
placeholder="{l s='Enter remark for room deletion'}" maxlength="250"></textarea>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-close" data-dismiss="modal">Close</button>
<button type="button" id="submitRoomDelete" class="btn btn-danger">
<i class="icon icon-trash"></i>&nbsp;{l s="Delete Room"}
</button>
</div>
<script>
$(document).ready(function() {
$('#room_remark').on('input', function() {
if ($(this).val().trim() !== '') {
$('#remarkGroup').removeClass('has-error');
}
});
});
</script>

View File

@@ -139,6 +139,12 @@
</div>
</div>
</div>
<div class="row form-group">
<div class="col-sm-12">
<label class="control-label">{l s='Remark'}</label>
<textarea class="form-control room_remark" type="text" name="message" value="" maxlength="250"></textarea>
</div>
</div>
<div class="product_invoice" style="display: none;">
<select name="product_invoice" class="edit_product_invoice">
{foreach from=$invoices_collection item=invoice}

View File

@@ -95,6 +95,12 @@
</div>
<p class="error_text" id="realloc_sel_rm_err_p"></p>
</div>
<div class="row form-group">
<div class="col-sm-12">
<label class="control-label">{l s='Remark'}</label>
<textarea class="form-control room_remark" type="text" name="message" value="" maxlength="250"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-close" data-dismiss="modal">{l s="Close"}</button>
@@ -139,6 +145,12 @@
</div>
</div>
</div>
<div class="row form-group">
<div class="col-sm-12">
<label class="control-label">{l s='Remark'}</label>
<textarea class="form-control room_remark" type="text" name="message" value="" maxlength="250"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-close" data-dismiss="modal">{l s="Close"}</button>

View File

@@ -704,11 +704,11 @@ abstract class PaymentModuleCore extends Module
// Specify order id for message
$old_message = Message::getMessageByCartId((int)$this->context->cart->id);
if ($old_message && !$old_message['private']) {
if ($old_message && $old_message['private']) {
$update_message = new Message((int)$old_message['id_message']);
$update_message->id_order = (int)$order->id;
$update_message->update();
if (Tools::getValue('visibility')) {
// Add this message in the customer thread
$customer_thread = new CustomerThread();
$customer_thread->id_contact = 0;
@@ -726,9 +726,9 @@ abstract class PaymentModuleCore extends Module
$customer_message->id_employee = 0;
$customer_message->message = $update_message->message;
$customer_message->private = !Tools::getValue('visibility');
if (!$customer_message->add()) {
$this->errors[] = Tools::displayError('An error occurred while saving message');
}
}
}

View File

@@ -644,6 +644,7 @@ class AdminCartsControllerCore extends AdminController
$message->message = $message_content;
$message->id_cart = (int)$this->context->cart->id;
$message->id_customer = (int)$this->context->cart->id_customer;
$message->private = 1;
$message->save();
}
} elseif (Validate::isLoadedObject($message)) {

View File

@@ -90,6 +90,14 @@ class AdminCustomerThreadsControllerCore extends AdminController
'align' => 'center',
'class' => 'fixed-width-xs'
),
'id_order' => array(
'title' => $this->l('ID Order'),
'filter_key' => 'a!id_order',
'align' => 'center',
'optional' => true,
'callback' => 'getOrderLink',
'visible_default' => true,
),
'customer' => array(
'title' => $this->l('Customer'),
'filter_key' => 'customer',
@@ -172,13 +180,6 @@ class AdminCustomerThreadsControllerCore extends AdminController
'type' => 'datetime',
'optional' => true,
),
'id_order' => array(
'title' => $this->l('ID Order'),
'filter_key' => 'a!id_order',
'optional' => false,
'visible_default' => false,
'displayed' => false,
),
);
$this->bulk_actions = array(
@@ -346,6 +347,14 @@ class AdminCustomerThreadsControllerCore extends AdminController
return $customer;
}
public function getOrderLink($order, $tr)
{
if ($tr['id_order']) {
return '<a href="'.$this->context->link->getAdminLink('AdminOrders').'&vieworder&id_order='.$tr['id_order'].'">'.'#'.$order.'</a>';
}else{
return '--';
}
}
public function setMedia()
{

View File

@@ -1275,6 +1275,41 @@ class AdminOrdersControllerCore extends AdminController
die(Tools::jsonEncode($response));
}
public function ajaxProcessInitDeleteRoomBookingModal()
{
// set modal details
$response['hasError'] = 1;
if ($id_order = Tools::getValue('id_order')
&& ($idProduct = Tools::getValue('id_product'))
&& ($idOrderDetail = Tools::getValue('id_order_detail'))
&& ($idRoom = Tools::getValue('id_room'))
&& ($dateFrom = Tools::getValue('date_from'))
&& ($dateTo = Tools::getValue('date_to'))
&& ($idHtlBooking = Tools::getValue('id_htl_booking'))
&& ($idHotel = Tools::getValue('id_hotel'))
) {
$smartyVars['id_product'] = $idProduct;
$smartyVars['id_order_detail'] = $idOrderDetail;
$smartyVars['id_room'] = $idRoom;
$smartyVars['date_from'] = $dateFrom;
$smartyVars['date_to'] = $dateTo;
$smartyVars['id_htl_booking'] = $idHtlBooking;
$smartyVars['id_hotel'] = $idHotel;
$smartyVars['id_order'] = $id_order;
$this->context->smarty->assign($smartyVars);
$modal = array(
'modal_id' => 'delete-room-booking-modal',
'modal_class' => 'modal-md order_detail_modal',
'modal_title' => '<i class="icon icon-bed"></i> &nbsp'.$this->l('Delete Room'),
'modal_content' => $this->context->smarty->fetch('controllers/orders/modals/_delete_room_booking.tpl'),
);
$this->context->smarty->assign($modal);
$response['hasError'] = 0;
$response['modalHtml'] = $this->context->smarty->fetch('modal.tpl');
}
die(Tools::jsonEncode($response));
}
public function setMedia()
{
@@ -1558,6 +1593,17 @@ class AdminOrdersControllerCore extends AdminController
if (!count($this->errors)) {
// Finally, reallocate the room
if ($objBookingDetail->reallocateBooking($idHtlBookingFrom, $idRoomToReallocate, $priceDiff)) {
$message = new Message();
if ($message_content = Tools::getValue('message')) {
if (Validate::isMessage($message_content)) {
$message->message = $message_content;
$message->id_cart = (int)$this->context->cart->id;
$message->id_customer = (int)$this->context->cart->id_customer;
$message->id_order = (int)$idOrder;
$message->private = 1;
$message->save();
}
}
Tools::redirectAdmin(self::$currentIndex.'&id_order='.(int) $idOrder.'&vieworder&conf=52&token='.$this->token);
} else {
$this->errors[] = $this->l('Some error occured. Please try again.');
@@ -1600,6 +1646,17 @@ class AdminOrdersControllerCore extends AdminController
if (!count($this->errors)) {
$objBookingDetail = new HotelBookingDetail();
if ($objBookingDetail->swapBooking($idHtlBookingFrom, $idHtlBookingToSwap)) {
$message = new Message();
if ($message_content = Tools::getValue('message')) {
if (Validate::isMessage($message_content)) {
$message->message = $message_content;
$message->id_cart = (int)$this->context->cart->id;
$message->id_customer = (int)$this->context->cart->id_customer;
$message->id_order = (int)$idOrder;
$message->private = 1;
$message->save();
}
}
Tools::redirectAdmin(self::$currentIndex.'&id_order='.(int)$idOrder.'&vieworder&conf=53&token='.$this->token);
} else {
$this->errors[] = $this->l('Some error occured. Please try again.');
@@ -5137,7 +5194,19 @@ class AdminOrdersControllerCore extends AdminController
$order->total_discounts_tax_incl += (float)abs($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS));
// Save changes of order
$order->update();
if($order->update()){
$message = new Message();
if ($message_content = Tools::getValue('message')) {
if (Validate::isMessage($message_content)) {
$message->message = $message_content;
$message->id_cart = (int)$this->context->cart->id;
$message->id_customer = (int)$this->context->cart->id_customer;
$message->id_order = (int)$order->id;
$message->private = 1;
$message->save();
}
}
}
// Update weight SUM
$order_carrier = new OrderCarrier((int)$order->getIdOrderCarrier());
@@ -6197,7 +6266,19 @@ class AdminOrdersControllerCore extends AdminController
$order->total_paid = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_);
$order->total_paid_tax_incl = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_);
$order->total_paid_tax_excl = Tools::ps_round($order->getOrderTotal(false), _PS_PRICE_COMPUTE_PRECISION_);
$order->save();
if($order->save()){
$message = new Message();
if ($message_content = Tools::getValue('message')) {
if (Validate::isMessage($message_content)) {
$message->message = $message_content;
$message->id_cart = (int)$this->context->cart->id;
$message->id_customer = (int)$this->context->cart->id_customer;
$message->id_order = (int)$order->id;
$message->private = 1;
$message->save();
}
}
}
// Save order invoice
if (isset($order_invoice) && $order_invoice instanceof OrderInvoice) {
@@ -6636,7 +6717,19 @@ class AdminOrdersControllerCore extends AdminController
$objBookingDetail->id_order
);
$objBookingDetail->delete();
if($objBookingDetail->delete()){
$message = new Message();
if ($message_content = Tools::getValue('message')) {
if (Validate::isMessage($message_content)) {
$message->message = $message_content;
$message->id_cart = (int)$this->context->cart->id;
$message->id_customer = (int)$this->context->cart->id_customer;
$message->id_order = (int)$order->id;
$message->private = 1;
$message->save();
}
}
}
// delete refund request of the room if exists.
OrderReturnDetail::deleteReturnDetailByIdBookingDetail($id_order, $idHotelBooking);

View File

@@ -490,7 +490,7 @@ class OrderDetailControllerCore extends FrontController
'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues,
'deliveryState' => (Validate::isLoadedObject($addressDelivery) && $addressDelivery->id_state) ? new State($addressDelivery->id_state) : false,
'is_guest' => false,
'messages' => CustomerMessage::getMessagesByOrderId((int) $order->id),
'messages' => CustomerMessage::getMessagesByOrderId((int) $order->id, false),
'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE,
'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD,
'isRecyclable' => Configuration::get('PS_RECYCLABLE_PACK'),

View File

@@ -960,7 +960,7 @@
<value>1</value>
</configuration>
<configuration id="PS_CUSTOMER_SERVICE_DISPLAY_NAME" name="PS_CUSTOMER_SERVICE_DISPLAY_NAME">
<value>1</value>
<value>0</value>
</configuration>
<configuration id="PS_CUSTOMER_SERVICE_REQUIRED_PHONE" name="PS_CUSTOMER_SERVICE_REQUIRED_PHONE">
<value>1</value>
@@ -969,7 +969,7 @@
<value>1</value>
</configuration>
<configuration id="PS_CUSTOMER_SERVICE_DISPLAY_CONTACT" name="PS_CUSTOMER_SERVICE_DISPLAY_CONTACT">
<value>1</value>
<value>0</value>
</configuration>
<configuration id="PS_STANDARD_PRODUCT_ORDER_ADDRESS_PREFRENCE" name="PS_STANDARD_PRODUCT_ORDER_ADDRESS_PREFRENCE">
<value>1</value>

View File

@@ -744,7 +744,7 @@ function initRoomEvents()
var query = 'ajax=1&token='+token+'&action=addRoomOnOrder&id_order='+id_order+'&';
// query += $('#add_product_warehouse').serialize()+'&';
query += $('#new_room select, #new_room input').serialize();
query += $('#new_room select, #new_room input ,#new_room textarea').serialize();
if ($('select#add_product_product_invoice').val() == 0)
query += '&'+$('tr#new_invoice select, tr#new_invoice input').serialize();
@@ -854,46 +854,92 @@ function initRoomEvents()
}
}
});
const DeleteRoomBookingModal = {
show: (data) => {
$(".loading_overlay").show();
$.ajax({
type: 'POST',
url: admin_order_tab_link,
dataType: 'json',
data: {
ajax: true,
action: 'initDeleteRoomBookingModal',
...data
},
beforeSend: function () {
$("#page-loader").show();
},
success: function (result) {
if (!result.hasError && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
$('#delete-room-booking-modal').modal('show');
}
},
complete: function () {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
close: function() {
$('#delete-room-booking-modal').modal('hide');
}
};
$('.delete_room_line').unbind('click').click(function(e) {
if (!confirm(txt_confirm))
return false;
var tr_product = $(this).closest('.product-line-row');
var id_room = tr_product.data('id_room');
var id_product = tr_product.data('id_product');
var id_hotel = tr_product.data('id_hotel');
var date_from = tr_product.data('date_from');
var date_to = tr_product.data('date_to');
var id_order_detail = tr_product.data('id_order_detail');
var id_htl_booking = tr_product.data('id_htl_booking');
//var id_order_detail = $(this).closest('.product-line-row').find('td .edit_product_id_order_detail').val();
var query = 'ajax=1&action=deleteRoomLine&token='+token+'&id_order='+id_order+'&id_htl_booking='+id_htl_booking+'&id_room='+id_room+'&id_product='+id_product+'&id_hotel='+id_hotel+'&date_from='+date_from+'&date_to='+date_to+'&id_order_detail='+id_order_detail;
query += $(this).parent().parent().find('input, select:visible, .edit_product_id_order_detail').serialize();
$.ajax({
type: 'POST',
url: admin_order_tab_link,
cache: false,
dataType: 'json',
data : query,
success : function(data)
{
if (data.result)
{
tr_product.fadeOut('slow', function() {
$(this).remove();
});
updateAmounts(data.order);
updateInvoice(data.invoices);
updateDocuments(data.documents_html);
let tr_product = $(this).closest('.product-line-row');
const data = {
id_room : tr_product.data('id_room'),
id_product : tr_product.data('id_product'),
id_hotel : tr_product.data('id_hotel'),
date_from : tr_product.data('date_from'),
date_to : tr_product.data('date_to'),
id_order_detail : tr_product.data('id_order_detail'),
id_htl_booking : tr_product.data('id_htl_booking'),
id_order : id_order
};
DeleteRoomBookingModal.show(data);
});
window.location.href = admin_order_tab_link + '&conf=1&vieworder&id_order=' + data.order.id;
}
else
jAlert(data.error);
}
$(document).on('click', '#submitRoomDelete', function(e) {
e.preventDefault();
var remark = $('#room_remark').val().trim();
if (remark === '') {
$('#remarkGroup').addClass('has-error');
$('#room_remark').focus();
return false;
}
var id_room = $('input[name="id_room"]').val();
var id_product = $('input[name="id_product"]').val();
var id_hotel = $('input[name="id_hotel"]').val();
var date_from = $('input[name="date_from"]').val();
var date_to = $('input[name="date_to"]').val();
var id_order_detail = $('input[name="id_order_detail"]').val();
var id_htl_booking = $('input[name="id_htl_booking"]').val();
var id_order = $('input[name="id_order"]').val();
var query = 'ajax=1&action=deleteRoomLine&token='+token+'&id_order='+id_order+'&id_htl_booking='+id_htl_booking+'&id_room='+id_room+'&id_product='+id_product+'&id_hotel='+id_hotel+'&date_from='+date_from+'&date_to='+date_to+'&id_order_detail='+id_order_detail;
query += '&' + $(this).parent().parent().find('input, select:visible, textarea').serialize();
$.ajax({
type: 'POST',
url: admin_order_tab_link,
cache: false,
dataType: 'json',
data : query,
success : function(data)
{
if (data.result)
{
updateAmounts(data.order);
updateInvoice(data.invoices);
updateDocuments(data.documents_html);
window.location.href = admin_order_tab_link + '&conf=1&vieworder&id_order=' + data.order.id;
}
else
jAlert(data.error);
}
});
e.preventDefault();
});
});
// order-payment-modal hide and show
$('#add_new_payment').on('click', function(e) {
@@ -1627,7 +1673,7 @@ $(document).ready(function() {
if (confirm(txt_confirm)) {
let query = 'ajax=1&token='+token+'&action=editRoomOnOrder&'+
$('#edit_product').find('input, select').serialize();
$('#edit_product').find('input, select ,textarea').serialize();
$(".loading_overlay").show();
$.ajax({
type: 'POST',

View File

@@ -104,6 +104,7 @@ const RoomReallocationModal = {
} else {
$(".swap_avail_rooms_container").empty().text(no_swap_rm_avail_txt).addClass('text-danger');
$("#swap_room_tab .modal-footer").hide();
$("#swap_room_tab .room_remark").closest('.form-group').hide();
}
// For Rooms Reallocation