Fixed: Getting error in growl while deleting the hotel image or while changing the cover image
This commit is contained in:
@@ -907,6 +907,7 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
public function ajaxProcessChangeCoverImage()
|
||||
{
|
||||
$idImage = Tools::getValue('id_image');
|
||||
$response = array('status' => false);
|
||||
if ($idImage) {
|
||||
$idHotel = Tools::getValue('id_hotel');
|
||||
if ($coverImg = HotelImage::getCover($idHotel)) {
|
||||
@@ -918,17 +919,15 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
$objHtlImage = new HotelImage((int) $idImage);
|
||||
$objHtlImage->cover = 1;
|
||||
if ($objHtlImage->update()) {
|
||||
die(true);
|
||||
} else {
|
||||
die(false);
|
||||
$response['status'] = true;
|
||||
}
|
||||
} else {
|
||||
die(false);
|
||||
}
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
public function ajaxProcessDeleteHotelImage()
|
||||
{
|
||||
$response = array('status' => false);
|
||||
if ($idImage = Tools::getValue('id_image')) {
|
||||
if ($idHotel = Tools::getValue('id_hotel')) {
|
||||
if (Validate::isLoadedObject($objHtlImage = new HotelImage((int) $idImage))) {
|
||||
@@ -941,12 +940,12 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
$objHtlImage->save();
|
||||
}
|
||||
}
|
||||
die(true);
|
||||
$response['status'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
die(false);
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
public function ajaxProcessUpdateSlidesPosition()
|
||||
|
||||
@@ -293,32 +293,6 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
// delete hotel image
|
||||
$('.deleteHtlImage').on('click', function(){
|
||||
var imgId = $(this).attr('id_htl_img');
|
||||
var $this = $(this);
|
||||
$.ajax({
|
||||
url: statebycountryurl,
|
||||
data: {
|
||||
id_htl_img: imgId,
|
||||
ajax: true,
|
||||
action: 'deleteHotelImage',
|
||||
},
|
||||
method: 'POST',
|
||||
success: function(data) {
|
||||
if (data == 1) {
|
||||
$this.closest('.img-container-div').remove();
|
||||
showSuccessMessage(htlImgDeleteSuccessMsg);
|
||||
} else {
|
||||
showErrorMessage(htlImgDeleteErrMsg);
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert(textStatus);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#hotel_country').on('change', function() {
|
||||
$('#hotel_state').empty();
|
||||
$.ajax({
|
||||
|
||||
@@ -109,6 +109,7 @@ $(document).ready(function () {
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: adminHotelCtrlUrl,
|
||||
dataType: 'json',
|
||||
data: {
|
||||
ajax: true,
|
||||
action: 'changeCoverImage',
|
||||
@@ -116,7 +117,7 @@ $(document).ready(function () {
|
||||
id_image: idImage,
|
||||
},
|
||||
success: function(result) {
|
||||
if (result) {
|
||||
if (result.status) {
|
||||
// remover cover image identifier from old cover image
|
||||
var oldCoverImageTr = $("#hotel-image-table tbody tr.cover-image-tr");
|
||||
oldCoverImageTr.removeClass("cover-image-tr").find("td.cover-image-td").removeClass("cover-image-td").find("a.changer-cover-image").removeClass("text-success").addClass("text-danger").attr("data-is-cover", "0").find("i.icon-check").removeClass("icon-check").addClass("icon-times");
|
||||
@@ -149,6 +150,7 @@ $(document).ready(function () {
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: adminHotelCtrlUrl,
|
||||
dataType: 'json',
|
||||
data: {
|
||||
ajax: true,
|
||||
action: 'deleteHotelImage',
|
||||
@@ -156,7 +158,7 @@ $(document).ready(function () {
|
||||
id_image: idImage,
|
||||
},
|
||||
success: function(result) {
|
||||
if (result) {
|
||||
if (result.status) {
|
||||
if (parseInt(isCover)) {
|
||||
location.reload();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user