$(function () {
$(".js-query-item__delete").on("click", function () {
delete_offer_confirm($(this).data("id"));
});
});
function deleteOffer(id) {
$.post("/api?method=project_deleteOffer", {"oid": id}, function (response) {
if (response.success == true) {
location.reload();
} else {
$('.deleteOffer_error').html('Произошла ошибка');
}
}, "json");
}
function delete_offer_confirm(id) {
var html = "" +
"<div>" +
"<input type=\"hidden\" name=\"id\" value=\"" + id + "\" />" +
"<input type=\"hidden\" name=\"action\" value=\"delete\" />" +
"<h1 class=\"popup__title\">Подтверждение удаления</h1>" +
"<hr class=\"gray\" style=\"margin-bottom:32px;\">" +
"<div class=\"deleteOffer_error\" style=\"display:inline-block;width:100%;\">" +
"<p class=\"f15 pb50 ml10\">Удалить предложение?</p>" +
"<button class=\"popup__button RedBtnStyle w160 mt20 pull-left f16\" style=\"height:40px;\" onclick=\"deleteOffer(" + id + ")\">Удалить</button>" +
"<button class=\"white-btn w160 mt20 pull-right popup-close-js f16\" onclick=\"return false;\" style=\"height:40px;\">Отменить</button></div>" +
"</div>" +
"</div>";
show_popup(html);
}