Файл: html/admin/auk/edit.php
Строк: 315
<?php
require_once '../../system/func.php';
require_once '../../system/header.php';
if (!$user OR $user['access'] < 3) {
?><script>showContent("/");</script><?php
exit(0);
}
if (isset($_GET['add_new']) && isset($_GET['auk_lvl_min']) && isset($_GET['auk_lvl_max'])) {
$mc->query("INSERT INTO `auk_list` (`id`, `lvl_min`, `lvl_max`, `date`) VALUES (NULL, '" . $_GET['auk_lvl_min'] . "', '" . $_GET['auk_lvl_max'] . "', CURRENT_TIMESTAMP)");
message("Добавлено");
}
if (isset($_GET['id_auk']) && $_GET['id_auk'] > 0) {
//список аукционов
$auk_list_Res = $mc->query("SELECT * FROM `auk_list` WHERE `id`='" . $_GET['id_auk'] . "'");
if ($auk_list_Res->num_rows > 0) {
$auk_list = $auk_list_Res->fetch_array(MYSQLI_ASSOC);
?>
<center>- Аукцион <?= $auk_list['lvl_min']; ?> - <?= $auk_list['lvl_max']; ?> -</center>
<hr style="background-color: black;">
<form id="lots">
<?php
//список лотов
$auk_lots_Res = $mc->query("SELECT * FROM `auk_lots` WHERE `id_auk_list` = '" . $_GET['id_auk'] . "' ORDER BY `count` ASC");
if ($auk_lots_Res->num_rows > 0) {
$auk_lots = $auk_lots_Res->fetch_all(MYSQLI_ASSOC);
foreach ($auk_lots as $value) {
$shopThing = $mc->query("SELECT * FROM `shop` WHERE `id` = '" . $value['id_shop'] . "'")->fetch_array(MYSQLI_ASSOC);
?>
<div class="clanturblock element" style="padding: 6px;" >
<table style="width: 100%;margin: auto;">
<tr>
<td style="width: 40px;">
<font style="font-size: 30px" onclick="element_up($(this));">▲</font>
<br>
<font style="font-size: 30px" onclick="element_down($(this));">▼</font>
</td>
<td style="width: 40px;">
<div class="shop2icobg shop2ico<?= $shopThing['id_image']; ?>"></div>
</td>
<td style="max-width: 100%;">
<?= $shopThing['name']; ?>[<?= $shopThing['level']; ?>]
</td>
<td style="width: 50px;text-align: center">
<button onclick="dellLots($(this));" class="button" style="width:100%;text-align: center" >Убрать</button>
</td>
</tr>
</table>
<input name="elements[][id_shop]" type="number" value="<?= $value['id_shop']; ?>" hidden>
<table style="width:98%;margin: auto;background-color: #FFFFCC;border-style: solid;border-width: 2px;">
<tr>
<td style="width:50%;text-align: center;border-style: solid;border-width: 2px;">открытые дн</td>
<td style="width:50%;text-align: center;border-style: solid;border-width: 2px;"><input name="elements[][open_day]" type="number" style="width: 90%;text-align: center;" value="<?= $value['open_day']; ?>" min="1" max="99999999999"></td>
</tr>
<tr>
<td style="width:50%;text-align: center;border-style: solid;border-width: 2px;">закрытые дн</td>
<td style="width:50%;text-align: center;border-style: solid;border-width: 2px;"><input name="elements[][close_day]" type="number" style="width: 90%;text-align: center;" value="<?= $value['close_day']; ?>" min="1" max="99999999999"></td>
</tr>
<tr>
<td style="width:50%;text-align: center;border-style: solid;border-width: 2px;">мин ставка<img src="/images/icons/plata.png" width="16px"></td>
<td style="width:50%;text-align: center;border-style: solid;border-width: 2px;"><input name="elements[][min_platina]" type="number" style="width: 90%;text-align: center;" value="<?= $value['min_platina']; ?>" min="0" max="99999999999"></td>
</tr> <tr>
<td style="width:50%;text-align: center;border-style: solid;border-width: 2px;">стоп ставка<img src="/images/icons/plata.png" width="16px"></td>
<td style="width:50%;text-align: center;border-style: solid;border-width: 2px;"><input name="elements[][stop_platina]" type="number" style="width: 90%;text-align: center;" value="<?= $value['stop_platina']; ?>" min="0" max="99999999999"></td>
</tr>
</table>
</div>
<?php
}
}
?>
</form>
<hr style="background-color: black;">
<div style='width: 100%;text-align: center'>
<input onclick="auk_save_lots_msg();" class='button_alt_01' style='width:200px' type='button' value='сохранить'>
</div>
<div class="auk_lots_msg_save" style="opacity: 0;z-index: 99999999;background-color: rgba(0,0,0,0.5);width: 100%;height: 100%;position: fixed;top: 0;left: 0;display: none;">
<table style="margin: auto;width: 240px;height: 100%">
<tr>
<td style="vertical-align: middle;text-align: center;">
<div style="width:100%;background-color: #FFFFCC;border-color: black;border-style: solid;border-width: 2px;border-radius: 4px;">
<div style="margin: 10px;">
Внимание !!!<br>
Данный аукцион будет прекращен и сброшен вместе со всем списком лотов а участникам возвращены ставки.
</div>
<div class="button_alt_01" onclick="close_auk_lots_msg_save(1);" style="margin: auto;margin-bottom: 5px;" >Подтверждаю</div>
<div class="button_alt_01" onclick="close_auk_lots_msg_save(0);" style="margin: auto;margin-bottom: 5px;">Отмена</div>
</div>
</td>
</tr>
</table>
</div>
<div class="templateLots" style="display: none;">
<div class="clanturblock element" style="padding: 6px;" >
<table style="width: 100%;margin: auto;">
<tr>
<td style="width: 40px;">
<font style="font-size: 30px" onclick="element_up($(this));">▲</font>
<br>
<font style="font-size: 30px" onclick="element_down($(this));">▼</font>
</td>
<td style="width: 40px;">
<div id="new_image_class_tmp" class="shop2icobg"></div>
</td>
<td style="max-width: 100%;" id="name_lvl_tmp_lots"></td>
<td style="width: 50px;text-align: center">
<button onclick="dellLots($(this));" class="button" style="width:100%;text-align: center" >Убрать</button>
</td>
</tr>
</table>
<input name="elements[][id_shop]" id="id_shop_tmp_lots" type="number" value="" hidden>
<table style="width:98%;margin: auto;background-color: #FFFFCC;border-style: solid;border-width: 2px;">
<tr>
<td style="width:50%;text-align: center;border-style: solid;border-width: 2px;">открытые дн</td>
<td style="width:50%;text-align: center;border-style: solid;border-width: 2px;"><input name="elements[][open_day]" type="number" style="width: 90%;text-align: center;" value="1" min="1" max="99999999999"></td>
</tr>
<tr>
<td style="width:50%;text-align: center;border-style: solid;border-width: 2px;">закрытые дн</td>
<td style="width:50%;text-align: center;border-style: solid;border-width: 2px;"><input name="elements[][close_day]" type="number" style="width: 90%;text-align: center;" value="1" min="1" max="99999999999"></td>
</tr>
<tr>
<td style="width:50%;text-align: center;border-style: solid;border-width: 2px;">мин ставка<img src="/images/icons/plata.png" width="16px"></td>
<td style="width:50%;text-align: center;border-style: solid;border-width: 2px;"><input name="elements[][min_platina]" type="number" style="width: 90%;text-align: center;" value="0" min="0" max="99999999999"></td>
</tr>
<tr>
<td style="width:50%;text-align: center;border-style: solid;border-width: 2px;">стоп ставка<img src="/images/icons/plata.png" width="16px"></td>
<td style="width:50%;text-align: center;border-style: solid;border-width: 2px;"><input name="elements[][stop_platina]" type="number" style="width: 90%;text-align: center;" value="1000000" min="0" max="99999999999"></td>
</tr>
</table>
</div>
</div>
<hr style="background-color: black;">
<center>- Добавить вещи -</center>
<table style="width: 100%;margin: auto;">
<tr>
<td style="max-width: 100%;">
<input onkeyup="search(this.value)" class='name_monster' type='text' style='width: 98%;height: 40px;' placeholder="поиск по названию">
</td>
</tr>
</table>
<div class="search">
</div>
<script>
MyLib.auk_lots_msg_save = $('.auk_lots_msg_save');
MyLib.auk_id =<?= $_GET['id_auk']; ?>;
if (typeof dellLots !== 'function') {
function add_lots(ico, id_shop, name, lvl) {
var tmp3533 = $(".templateLots").find(".element").clone();
$(tmp3533).find("#name_lvl_tmp_lots").html(name + "[" + lvl + "]");
$(tmp3533).find("#id_shop_tmp_lots").val(id_shop);
$(tmp3533).find("#new_image_class_tmp").removeClass().addClass("shop2icobg shop2ico" + ico);
$("#lots").append(tmp3533);
}
function dellLots(e) {
e.closest('.element').remove();
}
function element_up(e) {
e.closest(".element").insertBefore(e.closest(".element").prev());
}
function element_down(e) {
e.closest(".element").insertAfter(e.closest(".element").next());
}
var auk_save_lots_msg = function () {
$.fn.serializeObject = FormSerializer.serializeObject;
MyLib.auk_lots_array = $('#lots').serializeObject();
auk_lots_msg_save();
};
auk_lots_msg_save = function () {
$("mobitva").append(MyLib.auk_lots_msg_save);
$('.auk_lots_msg_save:eq(-1)').css({display: "block"});
$('.auk_lots_msg_save:eq(-1)').animate({'opacity': '1'}, 300);
};
close_auk_lots_msg_save = function (e) {
$('.auk_lots_msg_save:eq(-1)').animate({'opacity': '0'}, 300);
MyLib.setTimeid[250] = setTimeout(function () {
$('.auk_lots_msg_save:eq(-1)').css({display: "none"});
$('.auk_lots_msg_save:eq(-1)').remove();
}, 300);
if (e == 1) {
$.ajax({
url: "/admin/auk/save_auk_lots.php",
type: 'GET',
data: {
auk_lots_array: MyLib.auk_lots_array,
auk_id: MyLib.auk_id
},
success: function (data) {
questmsg(data);
},
error: function (e) {
NewFuckOff();
}
});
}
};
function search(etext) {
var arr;
$.ajax({
type: "POST",
url: "/admin/auk/search.php?etext=" + etext,
dataType: "text",
success: function (data) {
$(".search").html("");
if (data != "") {
arr = JSON.parse(data);
for (var i = 0; i < arr.length; i++) {
addShopSearched(arr[i].id_image, arr[i].id, arr[i].name, arr[i].level);
}
}
},
error: function () {
$(".search").html("error");
}
});
}
function addShopSearched(ico, id_shop, name, lvl) {
$(".search").append(
'<table style="width: 100%;margin: auto;"><tr><td style="max-width: 100%;text-align: center;">' +
name + ' [' + lvl + '] id : ' + id_shop +
'</td><td style="width: 50px;text-align: center;">' +
'<button onclick="add_lots(' + ico + ',' + id_shop + ','' + htmlspecialchars(name) + '',' + lvl + ');" class="button" style="width:100%;height: 40px;text-align: center" >Добавить</button></td></tr></table>'
);
}
function htmlspecialchars(str) {
if (typeof (str) == "string") {
str = str.replace(/&/g, "&"); /* must do & first */
str = str.replace(/"/g, """);
str = str.replace(/'/g, "'");
str = str.replace(/</g, "<");
str = str.replace(/>/g, ">");
}
return str;
}
}
</script>
<?php
}
} else {
?>
<script>/*nextshowcontemt*/showContent("/main?msg=error_50432220");</script>
<?php
exit(0);
}
$footval = 'auk_edit';
require_once '../../system/foot/foot.php';